HBASE-13202 Procedure v2 - core framework (addendum)

This commit is contained in:
Matteo Bertozzi 2015-04-18 09:36:30 +01:00
parent 60c30c707c
commit a8432fbd5a
2 changed files with 23 additions and 1 deletions

View File

@ -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);
}

View File

@ -189,4 +189,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();
}
}
}
}