Search in sources :

Example 11 with DefaultBlockMeta

use of alluxio.worker.block.meta.DefaultBlockMeta in project alluxio by Alluxio.

the class BlockMetadataManagerTest method moveBlockMetaOutOfSpaceException.

/**
 * Tests that an exception is thrown in the
 * {@link BlockMetadataManager#moveBlockMeta(BlockMeta, TempBlockMeta)} method when the worker is
 * out of space.
 */
@Test
public void moveBlockMetaOutOfSpaceException() throws Exception {
    // Create a committed block under dir2 with larger size than the capacity of dir1,
    // so that WorkerOutOfSpaceException should be thrown when move this block to dir1.
    StorageDir dir1 = mMetaManager.getTier(Constants.MEDIUM_HDD).getDir(0);
    StorageDir dir2 = mMetaManager.getTier(Constants.MEDIUM_HDD).getDir(1);
    long maxHddDir1Capacity = TIER_CAPACITY_BYTES[1][0];
    long blockMetaSize = maxHddDir1Capacity + 1;
    BlockMeta blockMeta = new DefaultBlockMeta(TEST_BLOCK_ID, blockMetaSize, dir2);
    TempBlockMeta tempBlockMeta2 = new DefaultTempBlockMeta(TEST_SESSION_ID, TEST_TEMP_BLOCK_ID2, TEST_BLOCK_SIZE, dir1);
    mMetaManager.addTempBlockMeta(tempBlockMeta2);
    dir2.addBlockMeta(blockMeta);
    mThrown.expect(WorkerOutOfSpaceException.class);
    mThrown.expectMessage(ExceptionMessage.NO_SPACE_FOR_BLOCK_META.getMessage(TEST_BLOCK_ID, blockMetaSize, maxHddDir1Capacity, TIER_ALIAS[1]));
    mMetaManager.moveBlockMeta(blockMeta, tempBlockMeta2);
}
Also used : DefaultBlockMeta(alluxio.worker.block.meta.DefaultBlockMeta) StorageDir(alluxio.worker.block.meta.StorageDir) DefaultTempBlockMeta(alluxio.worker.block.meta.DefaultTempBlockMeta) TempBlockMeta(alluxio.worker.block.meta.TempBlockMeta) DefaultTempBlockMeta(alluxio.worker.block.meta.DefaultTempBlockMeta) BlockMeta(alluxio.worker.block.meta.BlockMeta) DefaultBlockMeta(alluxio.worker.block.meta.DefaultBlockMeta) TempBlockMeta(alluxio.worker.block.meta.TempBlockMeta) DefaultTempBlockMeta(alluxio.worker.block.meta.DefaultTempBlockMeta) Test(org.junit.Test)

Aggregations

DefaultBlockMeta (alluxio.worker.block.meta.DefaultBlockMeta)11 StorageDir (alluxio.worker.block.meta.StorageDir)11 BlockMeta (alluxio.worker.block.meta.BlockMeta)9 TempBlockMeta (alluxio.worker.block.meta.TempBlockMeta)7 Test (org.junit.Test)6 DefaultTempBlockMeta (alluxio.worker.block.meta.DefaultTempBlockMeta)3 StorageTier (alluxio.worker.block.meta.StorageTier)3 BlockDoesNotExistException (alluxio.exception.BlockDoesNotExistException)2 StorageTierEvictorView (alluxio.worker.block.meta.StorageTierEvictorView)2 StorageTierView (alluxio.worker.block.meta.StorageTierView)2 ExpectedException (org.junit.rules.ExpectedException)2 BlockAlreadyExistsException (alluxio.exception.BlockAlreadyExistsException)1 WorkerOutOfSpaceException (alluxio.exception.WorkerOutOfSpaceException)1 DefaultStorageTier (alluxio.worker.block.meta.DefaultStorageTier)1 StorageDirView (alluxio.worker.block.meta.StorageDirView)1 ArrayList (java.util.ArrayList)1