@Test public void sizeNotInPoolTest() throws Exception { alloc = constructAllocator(); alloc.initializePool( Arrays.asList(new DiskSpaceRequirements(storeId0, 50, 2, 0), new DiskSpaceRequirements(storeId1, 21, 1, 0))); verifyPoolState(new ExpectedState().addStoreSeg(storeId0, 50, 2).addStoreSeg(storeId1, 21, 1)); File f1 = allocateAndVerify(storeId0, "file1", 25, false); verifyPoolState(new ExpectedState().addStoreSeg(storeId0, 50, 2).addStoreSeg(storeId1, 21, 1)); freeAndVerify(storeId0, f1, 25, false); verifyPoolState( new ExpectedState().addStoreSeg(storeId0, 25, 1).addStoreSeg(storeId0, 50, 2).addStoreSeg(storeId1, 21, 1)); File f2 = allocateAndVerify(storeId0, "file2", 25, false); verifyPoolState( new ExpectedState().addStoreSeg(storeId0, 25, 0).addStoreSeg(storeId0, 50, 2).addStoreSeg(storeId1, 21, 1)); freeAndVerify(storeId0, f2, 25, false); verifyPoolState( new ExpectedState().addStoreSeg(storeId0, 25, 1).addStoreSeg(storeId0, 50, 2).addStoreSeg(storeId1, 21, 1)); }
void initializePool(Collection<DiskSpaceRequirements> requirementsList) throws StoreException { long startTime = System.currentTimeMillis(); try { if (enablePooling) { if (poolState == PoolState.NOT_INVENTORIED) { throw inventoryException; } Map<String, Map<Long, Long>> overallRequirements = getOverallRequirements(requirementsList); deleteExtraSegments(overallRequirements); addRequiredSegments(overallRequirements, true); poolState = PoolState.INITIALIZED; } else { logger.info("Disk segment pooling disabled; pool will not be initialized."); } } catch (Exception e) { metrics.diskSpaceAllocatorInitFailureCount.inc(); poolState = PoolState.NOT_INVENTORIED; throw new StoreException("Exception while initializing DiskSpaceAllocator pool", e, StoreErrorCodes.Initialization_Error); } finally { long elapsedTime = System.currentTimeMillis() - startTime; logger.info("initializePool took {} ms", elapsedTime); metrics.diskSpaceAllocatorStartTimeMs.update(elapsedTime); } }
DiskSpaceAllocator { void initializePool(Collection<DiskSpaceRequirements> requirementsList) throws StoreException { long startTime = System.currentTimeMillis(); try { if (enablePooling) { if (poolState == PoolState.NOT_INVENTORIED) { throw inventoryException; } Map<String, Map<Long, Long>> overallRequirements = getOverallRequirements(requirementsList); deleteExtraSegments(overallRequirements); addRequiredSegments(overallRequirements, true); poolState = PoolState.INITIALIZED; } else { logger.info("Disk segment pooling disabled; pool will not be initialized."); } } catch (Exception e) { metrics.diskSpaceAllocatorInitFailureCount.inc(); poolState = PoolState.NOT_INVENTORIED; throw new StoreException("Exception while initializing DiskSpaceAllocator pool", e, StoreErrorCodes.Initialization_Error); } finally { long elapsedTime = System.currentTimeMillis() - startTime; logger.info("initializePool took {} ms", elapsedTime); metrics.diskSpaceAllocatorStartTimeMs.update(elapsedTime); } } }
DiskSpaceAllocator { void initializePool(Collection<DiskSpaceRequirements> requirementsList) throws StoreException { long startTime = System.currentTimeMillis(); try { if (enablePooling) { if (poolState == PoolState.NOT_INVENTORIED) { throw inventoryException; } Map<String, Map<Long, Long>> overallRequirements = getOverallRequirements(requirementsList); deleteExtraSegments(overallRequirements); addRequiredSegments(overallRequirements, true); poolState = PoolState.INITIALIZED; } else { logger.info("Disk segment pooling disabled; pool will not be initialized."); } } catch (Exception e) { metrics.diskSpaceAllocatorInitFailureCount.inc(); poolState = PoolState.NOT_INVENTORIED; throw new StoreException("Exception while initializing DiskSpaceAllocator pool", e, StoreErrorCodes.Initialization_Error); } finally { long elapsedTime = System.currentTimeMillis() - startTime; logger.info("initializePool took {} ms", elapsedTime); metrics.diskSpaceAllocatorStartTimeMs.update(elapsedTime); } } DiskSpaceAllocator(boolean enablePooling, File reserveDir, long requiredSwapSegmentsPerSize,
      StorageManagerMetrics metrics); }
DiskSpaceAllocator { void initializePool(Collection<DiskSpaceRequirements> requirementsList) throws StoreException { long startTime = System.currentTimeMillis(); try { if (enablePooling) { if (poolState == PoolState.NOT_INVENTORIED) { throw inventoryException; } Map<String, Map<Long, Long>> overallRequirements = getOverallRequirements(requirementsList); deleteExtraSegments(overallRequirements); addRequiredSegments(overallRequirements, true); poolState = PoolState.INITIALIZED; } else { logger.info("Disk segment pooling disabled; pool will not be initialized."); } } catch (Exception e) { metrics.diskSpaceAllocatorInitFailureCount.inc(); poolState = PoolState.NOT_INVENTORIED; throw new StoreException("Exception while initializing DiskSpaceAllocator pool", e, StoreErrorCodes.Initialization_Error); } finally { long elapsedTime = System.currentTimeMillis() - startTime; logger.info("initializePool took {} ms", elapsedTime); metrics.diskSpaceAllocatorStartTimeMs.update(elapsedTime); } } DiskSpaceAllocator(boolean enablePooling, File reserveDir, long requiredSwapSegmentsPerSize,
      StorageManagerMetrics metrics);  }
DiskSpaceAllocator { void initializePool(Collection<DiskSpaceRequirements> requirementsList) throws StoreException { long startTime = System.currentTimeMillis(); try { if (enablePooling) { if (poolState == PoolState.NOT_INVENTORIED) { throw inventoryException; } Map<String, Map<Long, Long>> overallRequirements = getOverallRequirements(requirementsList); deleteExtraSegments(overallRequirements); addRequiredSegments(overallRequirements, true); poolState = PoolState.INITIALIZED; } else { logger.info("Disk segment pooling disabled; pool will not be initialized."); } } catch (Exception e) { metrics.diskSpaceAllocatorInitFailureCount.inc(); poolState = PoolState.NOT_INVENTORIED; throw new StoreException("Exception while initializing DiskSpaceAllocator pool", e, StoreErrorCodes.Initialization_Error); } finally { long elapsedTime = System.currentTimeMillis() - startTime; logger.info("initializePool took {} ms", elapsedTime); metrics.diskSpaceAllocatorStartTimeMs.update(elapsedTime); } } DiskSpaceAllocator(boolean enablePooling, File reserveDir, long requiredSwapSegmentsPerSize,
      StorageManagerMetrics metrics);   }