priyeshkaratha commented on code in PR #11188:
URL: https://github.com/apache/ozone/pull/11188#discussion_r3954388619
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/DeletedBlockLogStateManagerImpl.java:
##########
@@ -157,14 +157,23 @@ public void
addTransactionsToDB(ArrayList<DeletedBlocksTransaction> txs,
@Override
public void removeTransactionsFromDB(ArrayList<Long> txIDs,
DeletedBlocksTransactionSummary summary)
throws IOException {
- if (deletingTxIDs != null) {
- deletingTxIDs.addAll(txIDs);
- }
- for (Long txID : txIDs) {
- transactionBuffer.removeFromBuffer(deletedTable, txID);
- }
- if (summary != null) {
- transactionBuffer.addToBuffer(statefulConfigTable, SERVICE_NAME,
summary.toByteString());
+ // Hold the buffer lock across the whole mark-remove-summary sequence so
that a concurrent flush()
+ // (checkpoint download or leader transfer) cannot land between marking
these txIDs as hidden and their
+ // removal being durably flushed. Otherwise onFlush() would reset
deletingTxIDs while the row is still
+ // present, re-exposing it to the deletion scanner and causing the summary
to be double-decremented.
+ transactionBuffer.lock();
Review Comment:
swapped the two field initializers so snapshotDeletingTxIDs is captured
before the RocksDB iterator is created, closing the race.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]