@NotThreadSafe public abstract class AbstractLocalAlluxioCluster extends Object
Modifier and Type | Field and Description |
---|---|
protected String |
mHostname |
protected ProxyProcess |
mProxyProcess |
protected Thread |
mProxyThread |
protected String |
mWorkDirectory |
protected List<WorkerProcess> |
mWorkers |
protected List<Thread> |
mWorkerThreads |
Modifier and Type | Method and Description |
---|---|
void |
formatAndRestartMasters()
Stops the masters, formats them, and then restarts them.
|
protected void |
formatJournal() |
abstract FileSystem |
getClient()
Returns a
FileSystem client. |
abstract FileSystem |
getClient(FileSystemContext context) |
protected abstract LocalAlluxioMaster |
getLocalAlluxioMaster() |
ProxyProcess |
getProxyProcess()
Gets the proxy process.
|
abstract void |
initConfiguration(String name)
Creates a default
Configuration for testing. |
boolean |
isStartedWorkers() |
void |
killWorkerProcesses()
Kills all worker processes without forgetting them in the master,
so we can validate the master mechanism handling dead workers.
|
protected void |
reset()
Resets the cluster to original state.
|
protected void |
resetClientPools()
Resets the client pools to the original state.
|
void |
restartMasters()
Restarts the master(s).
|
void |
restartWorkers(Collection<WorkerNetAddress> addresses)
Restarts workers with the addresses provided, so that the workers can restart with
static addresses to simulate a worker restart in the cluster.
|
protected void |
setAlluxioWorkDirectory(String name)
Sets Alluxio work directory.
|
protected void |
setHostname()
Sets hostname.
|
protected void |
setupTest()
Sets up corresponding directories for tests.
|
void |
start()
Starts both master and a worker using the configurations in test conf respectively.
|
protected abstract void |
startMasters()
Configures and starts the master(s).
|
protected void |
startProxy()
Configures and starts the proxy.
|
void |
startWorkers()
Configures and starts the worker(s).
|
void |
stop()
Stops both the alluxio and underfs service threads.
|
void |
stopFS()
Stops the alluxio filesystem's service thread only.
|
protected abstract void |
stopMasters()
Stops the masters.
|
protected void |
stopProxy()
Stops the proxy.
|
void |
stopWorkers()
Stops the workers.
|
protected void |
waitForMasterServing() |
void |
waitForWorkersRegistered(int timeoutMs)
Waits for all workers registered with master.
|
protected ProxyProcess mProxyProcess
protected Thread mProxyThread
protected List<WorkerProcess> mWorkers
protected String mWorkDirectory
protected String mHostname
public void start() throws Exception
Exception
protected abstract void startMasters() throws Exception
Exception
protected void waitForMasterServing() throws TimeoutException, InterruptedException
TimeoutException
InterruptedException
public void restartMasters() throws Exception
Exception
protected void startProxy() throws Exception
Exception
public void startWorkers() throws Exception
Exception
public void restartWorkers(Collection<WorkerNetAddress> addresses) throws Exception
addresses
- worker addresses to useException
protected void setupTest() throws IOException
IOException
protected void formatJournal() throws IOException
IOException
public void stop() throws Exception
Exception
public void stopFS() throws Exception
Exception
public void formatAndRestartMasters() throws Exception
Exception
protected abstract void stopMasters() throws Exception
Exception
public void killWorkerProcesses() throws Exception
Exception
public boolean isStartedWorkers()
public abstract void initConfiguration(String name) throws IOException
Configuration
for testing.name
- the name of the test/clusterIOException
public abstract FileSystem getClient() throws IOException
FileSystem
client.FileSystem
clientIOException
public abstract FileSystem getClient(FileSystemContext context) throws IOException
context
- the FileSystemContext to useFileSystem
client, using a specific contextIOException
protected abstract LocalAlluxioMaster getLocalAlluxioMaster()
public ProxyProcess getProxyProcess()
public void waitForWorkersRegistered(int timeoutMs) throws TimeoutException, InterruptedException, IOException
timeoutMs
- the timeout to waitTimeoutException
InterruptedException
IOException
protected void reset()
protected void resetClientPools()
protected void setHostname()
protected void setAlluxioWorkDirectory(String name)
name
- the name of the test/clusterCopyright © 2023. All Rights Reserved.