From b7abdd61c9058967aeedfeaf0a6a6f5499b99ee8 Mon Sep 17 00:00:00 2001 From: Matteo Bertozzi Date: Sat, 18 Apr 2015 09:36:30 +0100 Subject: [PATCH] HBASE-13202 Procedure v2 - core framework (addendum) --- .../store/ProcedureStoreTracker.java | 3 ++- .../store/TestProcedureStoreTracker.java | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/store/ProcedureStoreTracker.java b/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/store/ProcedureStoreTracker.java index a4711f1d16e..152f1317351 100644 --- a/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/store/ProcedureStoreTracker.java +++ b/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/store/ProcedureStoreTracker.java @@ -211,6 +211,7 @@ public class ProcedureStoreTracker { long newStart = alignDown(procId); delta = (int)(start - newStart) >> ADDRESS_BITS_PER_WORD; offset = delta; + start = newStart; } else { // Add to tail long newEnd = alignUp(procId + 1); @@ -383,7 +384,7 @@ public class ProcedureStoreTracker { @InterfaceAudience.Private public void setDeleted(final long procId, final boolean isDeleted) { BitSetNode node = getOrCreateNode(procId); - assert node.contains(procId) : "expected procId in the node"; + assert node.contains(procId) : "expected procId=" + procId + " in the node=" + node; node.updateState(procId, isDeleted); } diff --git a/hbase-procedure/src/test/java/org/apache/hadoop/hbase/procedure2/store/TestProcedureStoreTracker.java b/hbase-procedure/src/test/java/org/apache/hadoop/hbase/procedure2/store/TestProcedureStoreTracker.java index be759dcc6e3..17c71fe31be 100644 --- a/hbase-procedure/src/test/java/org/apache/hadoop/hbase/procedure2/store/TestProcedureStoreTracker.java +++ b/hbase-procedure/src/test/java/org/apache/hadoop/hbase/procedure2/store/TestProcedureStoreTracker.java @@ -190,4 +190,25 @@ public class TestProcedureStoreTracker { tracker.clear(); } } + + @Test + public void testLoad() { + final int MAX_PROCS = 1000; + final ProcedureStoreTracker tracker = new ProcedureStoreTracker(); + for (int numProcs = 1; numProcs < MAX_PROCS; ++numProcs) { + for (int start = 1; start <= numProcs; ++start) { + assertTrue(tracker.isEmpty()); + + LOG.debug("loading " + numProcs + " procs from start=" + start); + for (int i = start; i <= numProcs; ++i) { + tracker.setDeleted(i, false); + } + for (int i = 1; i < start; ++i) { + tracker.setDeleted(i, false); + } + + tracker.clear(); + } + } + } }