F64116045 opened a new pull request, #11837:
URL: https://github.com/apache/ozone/pull/11837

   ## What changes were proposed in this pull request?
   
   SCM flushes the transaction buffer before serving a DB checkpoint. 
   If a checkpoint download overlaps Ratis transaction apply, `flush()` can 
commit the data for index N before the recorded transaction index is updated 
from N-1 to N.  The checkpoint then contains data through N but records N-1.
   
   This PR uses `flushIfNeeded(0)` to skip the flush while a transaction is 
being applied.
   
   ```text
   Before
   
   Ratis apply path                         gRPC checkpoint path
   ----------------                         --------------------
   
   beginApplyingTransaction()
   
   addToBuffer(dataForIndexN)
   // latestTrxInfo is still N-1
                                            download()
                                              flush()
                                                putWithBatch(transactionInfo, 
N-1)
                                                commitBatchOperation()
                                              checkpoint:
                                                index N-1 + data through N
                                                inconsistent
   
   updateLatestTrxInfo(N)
   endApplyingTransaction()
   ```
   
   ```text
   After
   
   Ratis apply path                         gRPC checkpoint path
   ----------------                         --------------------
   
   beginApplyingTransaction()
   
   addToBuffer(dataForIndexN)
   // latestTrxInfo is still N-1
                                            download()
                                              flushIfNeeded(0)
                                                applyingTransactions > 0
                                                return
                                              checkpoint:
                                                index N-1 + data through N-1
                                                consistent
   
   updateLatestTrxInfo(N)
   endApplyingTransaction()
   
                                            next download()
                                              flushIfNeeded(0)
                                                commitBatchOperation()
                                              checkpoint:
                                                index N + data through N
                                                consistent
   ```
   
   ## What is the link to the Apache JIRA?
   
   https://issues.apache.org/jira/browse/HDDS-16452
   
   ## How was this patch tested?
   
   The regression test fails with the old `flush()` because data for index N is 
committed during transaction apply, and passes with this change.
   
   CI: 
   


-- 
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]

Reply via email to