With metadata disabled for ask based protocol, there is no need
to purge transaction on the backend and pollute the journal.
Tell based protocol has purges handled by the fronted so it
should be safe for us to remove them on the backend for ask
protocol.
JIRA: CONTROLLER-1879
Change-Id: Ia5c9470782bb4d59b78bbaa605ee5d36c7fb1644
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
(cherry picked from commit
4944f54d4e1fc24404d55e4ab74b6de212844dcd)
// 2 ServerConfigurationPayload entries, the transaction payload entry plus a purge payload.
RaftStateVerifier verifier = raftState -> {
- assertEquals("Commit index", 5, raftState.getCommitIndex());
- assertEquals("Last applied index", 5, raftState.getLastApplied());
+ assertEquals("Commit index", 4, raftState.getCommitIndex());
+ assertEquals("Last applied index", 4, raftState.getLastApplied());
};
verifyRaftState(leaderNode1.configDataStore(), "cars", verifier);
final TransactionIdentifier txId = cohortEntry.getTransactionId();
log.debug("{}: Transaction {} committed as {}, sending response to {}", persistenceId(), txId, result,
sender);
- cohortEntry.getShard().getDataStore().purgeTransaction(txId, null);
cohortCache.remove(cohortEntry.getTransactionId());
sender.tell(CommitTransactionReply.instance(cohortEntry.getClientVersion()).toSerializable(),
public void onFailure(final Throwable failure) {
final TransactionIdentifier txId = cohortEntry.getTransactionId();
log.error("{}, An exception occurred while committing transaction {}", persistenceId(), txId, failure);
- cohortEntry.getShard().getDataStore().purgeTransaction(txId, null);
cohortCache.remove(cohortEntry.getTransactionId());
sender.tell(new Failure(failure), cohortEntry.getShard().self());
cohortEntry.abort(new FutureCallback<Void>() {
@Override
public void onSuccess(final Void result) {
- shard.getDataStore().purgeTransaction(cohortEntry.getTransactionId(), null);
-
if (sender != null) {
sender.tell(AbortTransactionReply.instance(cohortEntry.getClientVersion()).toSerializable(), self);
}
@Override
public void onFailure(final Throwable failure) {
log.error("{}: An exception happened during abort", name, failure);
- shard.getDataStore().purgeTransaction(cohortEntry.getTransactionId(), null);
if (sender != null) {
sender.tell(new Failure(failure), self);
// Wait for the commit to be replicated to the follower.
MemberNode.verifyRaftState(followerDistributedDataStore, "cars",
- raftState -> assertEquals("getLastApplied", 2, raftState.getLastApplied()));
+ raftState -> assertEquals("getLastApplied", 1, raftState.getLastApplied()));
MemberNode.verifyRaftState(followerDistributedDataStore, "people",
- raftState -> assertEquals("getLastApplied", 2, raftState.getLastApplied()));
+ raftState -> assertEquals("getLastApplied", 1, raftState.getLastApplied()));
// Prepare, ready and canCommit a WO tx that writes to 2 shards. This will become the current tx in
// the leader shard.
verifyOuterListEntry(shard, 1);
- verifyLastApplied(shard, 6);
+ verifyLastApplied(shard, 3);
}
@Test
// Committed transaction count should increase as usual
assertEquals(1, shardStats.getCommittedTransactionsCount());
- // Commit index should advance 2 to account for disabling metadata
- assertEquals(2, shardStats.getCommitIndex());
+ // Commit index should advance 1 to account for disabling metadata
+ assertEquals(1, shardStats.getCommitIndex());
}
@Test