smengcl commented on code in PR #11187:
URL: https://github.com/apache/ozone/pull/11187#discussion_r4211195714
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/SCMDeletedBlockTransactionStatusManager.java:
##########
@@ -461,25 +469,35 @@ public void
addTransactions(ArrayList<DeletedBlocksTransaction> txList) throws I
}
if
(VersionedDatanodeFeatures.isFinalized(HDDSLayoutFeature.STORAGE_SPACE_DISTRIBUTION)
&&
!disableDataDistributionForTest) {
- for (DeletedBlocksTransaction tx: txList) {
- if (tx.hasTotalBlockSize()) {
- incrDeletedBlocksSummary(tx);
- }
- }
+ transactionBuffer.lock();
try {
- deletedBlockLogStateManager.addTransactionsToDB(txList, getSummary());
- } catch (IOException e) {
- if (isRatisTimeout(e)) {
- throw e;
+ DeletedBlocksTransactionSummary summary;
+ synchronized (summaryLock) {
+ for (DeletedBlocksTransaction tx: txList) {
+ if (tx.hasTotalBlockSize()) {
+ incrDeletedBlocksSummary(tx);
+ }
+ }
+ onSummaryUpdatedForTest();
+ summary = getSummary();
}
- // Revert the in-memory changes if the DB update fails
- for (DeletedBlocksTransaction tx: txList) {
- if (tx.hasTotalBlockSize()) {
- rollbackDeletedBlocksSummary(tx);
- LOG.warn("{} is decreased from summary due to DB update failure",
transactionToString(tx));
+ try {
+ deletedBlockLogStateManager.addTransactionsToDB(txList, summary);
Review Comment:
This call waits for Ratis through the HA proxy while holding the buffer read
lock. A queued flush writer blocks the applier's read-lock acquisition, so the
request cannot complete until its timeout releases the caller's lock. The
remove path has the same issue.
Please coordinate summary updates and reloads without holding this lock
across the synchronous Ratis call, and cover the interleaving through the HA
proxy.
--
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]