Skip to content

Commit 2c2c161

Browse files
committed
Narrow status check for pop
1 parent 73faa93 commit 2c2c161

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

core/src/main/java/org/apache/accumulo/core/fate/accumulo/AccumuloStore.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,8 @@ public void pop() {
269269
verifyReserved(true);
270270

271271
Optional<Integer> top = findTop();
272-
top.ifPresent(t -> newMutator(fateId)
273-
.requireStatus(TStatus.FAILED_IN_PROGRESS, TStatus.SUCCESSFUL, TStatus.FAILED)
274-
.deleteRepo(t).mutate());
272+
top.ifPresent(
273+
t -> newMutator(fateId).requireStatus(TStatus.FAILED_IN_PROGRESS).deleteRepo(t).mutate());
275274
}
276275

277276
@Override

test/src/main/java/org/apache/accumulo/test/fate/accumulo/FateStoreIT.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ protected void testReadWrite(FateStore<TestEnv> store, ServerContext sctx)
7373
assertEquals(1, store.list().count());
7474

7575
// Push a test FATE op and verify we can read it back
76+
txStore.setStatus(TStatus.IN_PROGRESS);
7677
txStore.push(new TestRepo("testOp"));
7778
TestRepo op = (TestRepo) txStore.top();
7879
assertNotNull(op);
@@ -101,7 +102,7 @@ protected void testReadWrite(FateStore<TestEnv> store, ServerContext sctx)
101102
assertEquals(TestRepo.class, ops.get(1).getClass());
102103

103104
// test pop, TestOperation should be left
104-
txStore.setStatus(TStatus.FAILED); // needed to satisfy the condition on pop
105+
txStore.setStatus(TStatus.FAILED_IN_PROGRESS); // needed to satisfy the condition on pop
105106
txStore.pop();
106107
ops = txStore.getStack();
107108
assertEquals(1, ops.size());
@@ -112,8 +113,10 @@ protected void testReadWrite(FateStore<TestEnv> store, ServerContext sctx)
112113
assertEquals(2, store.list().count());
113114

114115
// test delete
116+
txStore.setStatus(TStatus.SUCCESSFUL); // needed to satisfy the condition on delete
115117
txStore.delete();
116118
assertEquals(1, store.list().count());
119+
txStore2.setStatus(TStatus.SUCCESSFUL); // needed to satisfy the condition on delete
117120
txStore2.delete();
118121
assertEquals(0, store.list().count());
119122
}

0 commit comments

Comments
 (0)