You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/10/19 11:51:54 UTC

[GitHub] [pulsar] lhotari opened a new pull request #8299: [Issue 8293][managed-ledger] Fix race condition in updating readPosition in ManagedCursorImpl

lhotari opened a new pull request #8299:
URL: https://github.com/apache/pulsar/pull/8299


   Fixes #8293
   
   ### Motivation
   
   Regarding the race condition in #8229, it seems that `ManagedCursorImpl.readPosition` could get out of sync from `OpReadEntry.readPosition` if `ManagedCursorImpl.readPosition` gets updated after the `OpReadEntry` has been created since `OpReadEntry`'s `readPosition` gets initialized from `ManagedCursorImpl.readPosition`.
   
   The race condition seems to happen in this code in the `setAcknowledgePosition` method:
   https://github.com/apache/pulsar/blob/825fdd4222dd65ef3099f1a975a1555226297379/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java#L1512-L1523
   
   The intent of this change is to properly handle concurrent updates when updating `readPosition` in `setAcknowledgePosition` method.
   
   
   ### Modifications
   
   The update of `readPosition` uses `READ_POSITION_UPDATER.updateAndGet` to handle concurrent updates to `readPosition` in `setAcknowledgePosition` method. 
   
   ### Verifying this change
   
   There are currently no separate tests to verify this change.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] lhotari commented on pull request #8299: [Issue 8293][managed-ledger] Fix race condition in updating readPosition in ManagedCursorImpl

Posted by GitBox <gi...@apache.org>.
lhotari commented on pull request #8299:
URL: https://github.com/apache/pulsar/pull/8299#issuecomment-712128458


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] merlimat merged pull request #8299: [Issue 8293][managed-ledger] Fix race condition in updating readPosition in ManagedCursorImpl

Posted by GitBox <gi...@apache.org>.
merlimat merged pull request #8299:
URL: https://github.com/apache/pulsar/pull/8299


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] lhotari commented on pull request #8299: [Issue 8293][managed-ledger] Fix race condition in updating readPosition in ManagedCursorImpl

Posted by GitBox <gi...@apache.org>.
lhotari commented on pull request #8299:
URL: https://github.com/apache/pulsar/pull/8299#issuecomment-712263203


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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:
users@infra.apache.org