GlenGeng edited a comment on pull request #1852:
URL: https://github.com/apache/ozone/pull/1852#issuecomment-773021881
> unfortunately with transaction buffer that we cannot flush retry count
into DB immediately thus we probably have to accept the non-deterministic
result for this moment.
Not flush retry count into DB immediately may not lead to non-deterministic.
Let's try to prove it:
1, if current SCM(both leader and follower) has not touched the txID, if
will load the count from DB.
2, if current SCM(both leader and follower) touched the txID, then if will
use the count in `transactionRetryCountMap`, which will be accurate if SCM is
not restarted.
3, For a restarted SCM, loading DB and replaying corresponding log entry
will help build a `transactionRetryCountMap` that is exactly the same as the
map in other SCMs.
What we need take care is to move the counter check logic into
ReadOnlyIterator, e.g,
```
if (txn.getCount() > -1 && txn.getCount() <= maxRetry
&& !containerManager.getContainer(id).isOpen()) {
numBlocksAdded += txn.getLocalIDCount();
getTransaction(txn, transactions);
transactionToDNsCommitMap
.putIfAbsent(txn.getTxID(), new LinkedHashSet<>());
}
```
```
private void findNext() {
while (iter.hasNext()) {
TypedTable.KeyValue<Long, DeletedBlocksTransaction> next = iter
.next();
long txID;
try {
txID = next.getKey();
} catch (IOException e) {
throw new IllegalStateException("");
}
int retryCount = transactionRetryCountMap.getOrDefault(txID, 0)
if (!deletingTxIDs.contains(txID) && retryCount > -1 &&
retryCount <= maxRetry) {
nextTx = next;
if (LOG.isTraceEnabled()) {
LOG.trace("DeletedBlocksTransaction matching txID:{}",
txID);
}
return;
}
}
nextTx = null;
}
```
Given the `transactionRetryCountMap.getOrDefault`, we don't need add new
in-memory staff, What do you think ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]