From 5b184ac783784c1ca4baf1437888c79bd9460763 Mon Sep 17 00:00:00 2001 From: cc Date: Sat, 11 Jul 2015 20:32:07 +0800 Subject: [PATCH] clean up LRUEvictor --- .../worker/block/evictor/LRUEvictor.java | 32 +++---------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/servers/src/main/java/tachyon/worker/block/evictor/LRUEvictor.java b/servers/src/main/java/tachyon/worker/block/evictor/LRUEvictor.java index a22767057b5e..1f83ce2c1bc2 100644 --- a/servers/src/main/java/tachyon/worker/block/evictor/LRUEvictor.java +++ b/servers/src/main/java/tachyon/worker/block/evictor/LRUEvictor.java @@ -109,12 +109,12 @@ private StorageDirView selectDirWithRequestedSpace(long bytesToBeAvailable, * tier, they will be evicted, otherwise, only blocks to be freed in the bottom tier will be * evicted. * - * this method is only used in {@link #freeSpace(long, tachyon.worker.block.BlockStoreLocation)} + * this method is only used in {@link #freeSpaceWithView} * * @param bytesToBeAvailable bytes to be available after eviction * @param location target location to evict blocks from * @param plan the plan to be recursively updated, is empty when first called in - * {@link #freeSpace(long, tachyon.worker.block.BlockStoreLocation)} + * {@link #freeSpaceWithView} * @return the first StorageDirView in the range of location to evict/move bytes from, or null if * there is no plan */ @@ -139,8 +139,8 @@ private StorageDirView cascadingEvict(long bytesToBeAvailable, BlockStoreLocatio if (block.getBlockLocation().belongTo(location)) { int tierAlias = block.getParentDir().getParentTier().getTierAlias(); int dirIndex = block.getParentDir().getDirIndex(); - dirCandidates.add(mManagerView.getTierView(tierAlias).getDirView(dirIndex), - blockId, block.getBlockSize()); + dirCandidates.add(mManagerView.getTierView(tierAlias).getDirView(dirIndex), blockId, + block.getBlockSize()); } } } catch (IOException ioe) { @@ -187,31 +187,7 @@ private StorageDirView cascadingEvict(long bytesToBeAvailable, BlockStoreLocatio public EvictionPlan freeSpaceWithView(long bytesToBeAvailable, BlockStoreLocation location, BlockMetadataManagerView view) throws IOException { mManagerView = view; - return freeSpace(bytesToBeAvailable, location); - } - /** - * This method should only be accessed by {@link freeSpaceWithView} in this class. - * Frees space in the given block store location. - * After eviction, at least one StorageDir in the location - * has the specific amount of free space after eviction. The location can be a specific - * StorageDir, or {@link BlockStoreLocation#anyTier} or {@link BlockStoreLocation#anyDirInTier}. - * The view is generated and passed by the calling {@link BlockStore}. - * - *

- * This method returns null if Evictor fails to propose a feasible plan to meet the requirement, - * or an eviction plan with toMove and toEvict fields to indicate how to free space. If both - * toMove and toEvict of the plan are empty, it indicates that Evictor has no actions to take and - * the requirement is already met. - * - * @param availableBytes the amount of free space in bytes to be ensured after eviction - * @param location the location in block store - * @return an eviction plan (possibly with empty fields) to get the free space, or null if no plan - * is feasible - * @throws IOException if given block location is invalid - */ - private EvictionPlan freeSpace(long bytesToBeAvailable, BlockStoreLocation location) - throws IOException { List> toMove = new ArrayList>(); List toEvict = new ArrayList(); EvictionPlan plan = new EvictionPlan(toMove, toEvict);