use of alluxio.worker.block.BlockWorker in project alluxio by Alluxio.
the class BlockMasterIntegrityIntegrationTest method deleteOrphanedBlocks.
@Test
public void deleteOrphanedBlocks() throws Exception {
AlluxioURI uri = new AlluxioURI("/test");
int len = 10;
FileSystem fs = mCluster.getClient();
BlockWorker worker = mCluster.getWorkerProcess().getWorker(BlockWorker.class);
FileSystemTestUtils.createByteFile(fs, uri, WritePType.MUST_CACHE, len);
Assert.assertEquals(1, worker.getStoreMetaFull().getNumberOfBlocks());
mCluster.stopWorkers();
fs.delete(uri);
mCluster.restartMasters();
// creates a new worker, so need to get the new BlockWorker
mCluster.startWorkers();
BlockWorker newWorker = mCluster.getWorkerProcess().getWorker(BlockWorker.class);
CommonUtils.waitFor("orphan blocks to be deleted", () -> newWorker.getStoreMetaFull().getNumberOfBlocks() == 0, WaitForOptions.defaults().setTimeoutMs(2000));
}
use of alluxio.worker.block.BlockWorker in project alluxio by Alluxio.
the class BlockMasterIntegrityIntegrationTest method deleteInvalidBlocksPeriodically.
@Test
@LocalAlluxioClusterResource.Config(confParams = { PropertyKey.Name.MASTER_PERIODIC_BLOCK_INTEGRITY_CHECK_INTERVAL, "1sec", PropertyKey.Name.MASTER_PERIODIC_BLOCK_INTEGRITY_CHECK_REPAIR, "true" })
public void deleteInvalidBlocksPeriodically() throws Exception {
AlluxioURI uri = new AlluxioURI("/test");
int len = 10;
FileSystem fs = mCluster.getClient();
BlockWorker worker = mCluster.getWorkerProcess().getWorker(BlockWorker.class);
FileSystemTestUtils.createByteFile(fs, uri, WritePType.MUST_CACHE, len);
Assert.assertEquals(1, worker.getStoreMetaFull().getNumberOfBlocks());
removeFileMetadata(uri);
CommonUtils.waitFor("invalid blocks to be deleted", () -> worker.getStoreMetaFull().getNumberOfBlocks() == 0, WaitForOptions.defaults().setTimeoutMs(2000));
}
Aggregations