ACCUMULO-3928 getMinCIdleThreshold might throw an exception if the table is deleted.
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/2fa41d00 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/2fa41d00 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/2fa41d00 Branch: refs/heads/master Commit: 2fa41d0099de0cff0722dff8e1f0340cd63777b3 Parents: 985c906 Author: Josh Elser <els...@apache.org> Authored: Thu Jul 2 14:05:44 2015 -0400 Committer: Josh Elser <els...@apache.org> Committed: Thu Jul 2 15:26:38 2015 -0400 ---------------------------------------------------------------------- .../tabletserver/LargestFirstMemoryManager.java | 24 +++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/2fa41d00/server/base/src/main/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManager.java ---------------------------------------------------------------------- diff --git a/server/base/src/main/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManager.java b/server/base/src/main/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManager.java index 1281c33..260685e 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManager.java +++ b/server/base/src/main/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManager.java @@ -22,6 +22,7 @@ import java.util.List; import java.util.Map.Entry; import java.util.TreeMap; +import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.server.conf.ServerConfiguration; @@ -170,10 +171,27 @@ public class LargestFirstMemoryManager implements MemoryManager { ingestMemory += memTabletSize; if (minorCompactingSize == 0 && memTabletSize > 0) { TabletInfo tabletInfo = new TabletInfo(ts.getExtent(), memTabletSize, idleTime, timeMemoryLoad); - largestMemTablets.put(timeMemoryLoad, tabletInfo); - if (idleTime > getMinCIdleThreshold(ts.getExtent())) { - largestIdleMemTablets.put(timeMemoryLoad, tabletInfo); + try { + // If the table was deleted, getMinCIdleThreshold will throw an exception + if (idleTime > getMinCIdleThreshold(ts.getExtent())) { + largestIdleMemTablets.put(timeMemoryLoad, tabletInfo); + } + } catch (IllegalArgumentException e) { + Throwable cause = e.getCause(); + if (null != cause && cause instanceof TableNotFoundException) { + if (log.isTraceEnabled()) { + log.trace("Ignoring extent for deleted table: " + ts.getExtent()); + } + + // The table might have been deleted during the iteration of the tablets + // We just want to eat this exception, do nothing with this tablet, and continue + continue; + } + + throw e; } + // Only place the tablet into largestMemTablets map when the table still exists + largestMemTablets.put(timeMemoryLoad, tabletInfo); } compactionMemory += minorCompactingSize;