You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geode.apache.org by Eric Shu <es...@pivotal.io> on 2016/06/02 21:32:57 UTC

Review Request 48187: GEODE-1491 A rollback command could fail with IllegalStateException if the client failed over and the transaction has been rolled back

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/48187/
-----------------------------------------------------------

Review request for geode, Darrel Schneider and Swapnil Bawaskar.


Bugs: GEODE-1491
    https://issues.apache.org/jira/browse/GEODE-1491


Repository: geode


Description
-------

Make sure when checking if a transaction is completed from isHostedTxRecentlyCompleted() method, the rolled back transaction is considered as well.


Diffs
-----

  geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXManagerImpl.java df0176d 
  geode-core/src/main/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionMessage.java 9c54587 
  geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RollbackCommand.java ed7c706 
  geode-core/src/test/java/com/gemstone/gemfire/internal/cache/TXManagerImplTest.java a4b8127 

Diff: https://reviews.apache.org/r/48187/diff/


Testing
-------

precheckin.


Thanks,

Eric Shu


Re: Review Request 48187: GEODE-1491 A rollback command could fail with IllegalStateException if the client failed over and the transaction has been rolled back

Posted by Swapnil Bawaskar <sb...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/48187/#review136005
-----------------------------------------------------------


Ship it!




Ship It!

- Swapnil Bawaskar


On June 2, 2016, 9:33 p.m., Eric Shu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/48187/
> -----------------------------------------------------------
> 
> (Updated June 2, 2016, 9:33 p.m.)
> 
> 
> Review request for geode, Darrel Schneider and Swapnil Bawaskar.
> 
> 
> Bugs: GEODE-1491
>     https://issues.apache.org/jira/browse/GEODE-1491
> 
> 
> Repository: geode
> 
> 
> Description
> -------
> 
> Make sure when checking if a transaction is completed from isHostedTxRecentlyCompleted() method, the rolled back transaction is considered as well.
> Added a unit test that would fail without the fix and pass with the fix.
> 
> 
> Diffs
> -----
> 
>   geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXManagerImpl.java df0176d 
>   geode-core/src/main/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionMessage.java 9c54587 
>   geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RollbackCommand.java ed7c706 
>   geode-core/src/test/java/com/gemstone/gemfire/internal/cache/TXManagerImplTest.java a4b8127 
> 
> Diff: https://reviews.apache.org/r/48187/diff/
> 
> 
> Testing
> -------
> 
> precheckin.
> 
> 
> Thanks,
> 
> Eric Shu
> 
>


Re: Review Request 48187: GEODE-1491 A rollback command could fail with IllegalStateException if the client failed over and the transaction has been rolled back

Posted by Eric Shu <es...@pivotal.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/48187/
-----------------------------------------------------------

(Updated June 3, 2016, 12:05 a.m.)


Review request for geode, Darrel Schneider and Swapnil Bawaskar.


Bugs: GEODE-1491
    https://issues.apache.org/jira/browse/GEODE-1491


Repository: geode


Description
-------

Make sure when checking if a transaction is completed from isHostedTxRecentlyCompleted() method, the rolled back transaction is considered as well.
Added a unit test that would fail without the fix and pass with the fix.


Diffs (updated)
-----

  geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXManagerImpl.java df0176d 
  geode-core/src/main/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionMessage.java 9c54587 
  geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RollbackCommand.java ed7c706 
  geode-core/src/test/java/com/gemstone/gemfire/internal/cache/TXManagerImplTest.java a4b8127 

Diff: https://reviews.apache.org/r/48187/diff/


Testing
-------

precheckin.


Thanks,

Eric Shu


Re: Review Request 48187: GEODE-1491 A rollback command could fail with IllegalStateException if the client failed over and the transaction has been rolled back

Posted by Eric Shu <es...@pivotal.io>.

> On June 2, 2016, 10:58 p.m., Darrel Schneider wrote:
> > geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXManagerImpl.java, line 1024
> > <https://reviews.apache.org/r/48187/diff/1/?file=1405404#file1405404line1024>
> >
> >     failoverMap is synchronized but this code does not look threadsafe. Between the call of "containsKey" and "remove" another thread might do a remove of a non-null value but has not yet put it back in. Then this thread does its remove and sees it return null and does a put of null.
> >     
> >     I think you should bracket your containsKey, remove, and put calls with:
> >     synchronized (failoverMap) {
> >     }

Multiple threads working on the same txId would not happen, only one thread would get the TXStateProxy ReentrantLock to perform on a certain txId. Howver, I agree adding the synchronized keyword would be cleaner and it does not have performance penalty.


- Eric


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/48187/#review136004
-----------------------------------------------------------


On June 3, 2016, 12:05 a.m., Eric Shu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/48187/
> -----------------------------------------------------------
> 
> (Updated June 3, 2016, 12:05 a.m.)
> 
> 
> Review request for geode, Darrel Schneider and Swapnil Bawaskar.
> 
> 
> Bugs: GEODE-1491
>     https://issues.apache.org/jira/browse/GEODE-1491
> 
> 
> Repository: geode
> 
> 
> Description
> -------
> 
> Make sure when checking if a transaction is completed from isHostedTxRecentlyCompleted() method, the rolled back transaction is considered as well.
> Added a unit test that would fail without the fix and pass with the fix.
> 
> 
> Diffs
> -----
> 
>   geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXManagerImpl.java df0176d 
>   geode-core/src/main/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionMessage.java 9c54587 
>   geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RollbackCommand.java ed7c706 
>   geode-core/src/test/java/com/gemstone/gemfire/internal/cache/TXManagerImplTest.java a4b8127 
> 
> Diff: https://reviews.apache.org/r/48187/diff/
> 
> 
> Testing
> -------
> 
> precheckin.
> 
> 
> Thanks,
> 
> Eric Shu
> 
>


Re: Review Request 48187: GEODE-1491 A rollback command could fail with IllegalStateException if the client failed over and the transaction has been rolled back

Posted by Darrel Schneider <ds...@pivotal.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/48187/#review136004
-----------------------------------------------------------




geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXManagerImpl.java (line 1024)
<https://reviews.apache.org/r/48187/#comment201009>

    failoverMap is synchronized but this code does not look threadsafe. Between the call of "containsKey" and "remove" another thread might do a remove of a non-null value but has not yet put it back in. Then this thread does its remove and sees it return null and does a put of null.
    
    I think you should bracket your containsKey, remove, and put calls with:
    synchronized (failoverMap) {
    }



geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXManagerImpl.java (line 1028)
<https://reviews.apache.org/r/48187/#comment201008>

    The comment talks about moving the txid to the front of the queue.
    I would add that is does this by removing and putting the txid back into the Linked map.


- Darrel Schneider


On June 2, 2016, 2:33 p.m., Eric Shu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/48187/
> -----------------------------------------------------------
> 
> (Updated June 2, 2016, 2:33 p.m.)
> 
> 
> Review request for geode, Darrel Schneider and Swapnil Bawaskar.
> 
> 
> Bugs: GEODE-1491
>     https://issues.apache.org/jira/browse/GEODE-1491
> 
> 
> Repository: geode
> 
> 
> Description
> -------
> 
> Make sure when checking if a transaction is completed from isHostedTxRecentlyCompleted() method, the rolled back transaction is considered as well.
> Added a unit test that would fail without the fix and pass with the fix.
> 
> 
> Diffs
> -----
> 
>   geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXManagerImpl.java df0176d 
>   geode-core/src/main/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionMessage.java 9c54587 
>   geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RollbackCommand.java ed7c706 
>   geode-core/src/test/java/com/gemstone/gemfire/internal/cache/TXManagerImplTest.java a4b8127 
> 
> Diff: https://reviews.apache.org/r/48187/diff/
> 
> 
> Testing
> -------
> 
> precheckin.
> 
> 
> Thanks,
> 
> Eric Shu
> 
>


Re: Review Request 48187: GEODE-1491 A rollback command could fail with IllegalStateException if the client failed over and the transaction has been rolled back

Posted by Eric Shu <es...@pivotal.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/48187/
-----------------------------------------------------------

(Updated June 2, 2016, 9:33 p.m.)


Review request for geode, Darrel Schneider and Swapnil Bawaskar.


Bugs: GEODE-1491
    https://issues.apache.org/jira/browse/GEODE-1491


Repository: geode


Description (updated)
-------

Make sure when checking if a transaction is completed from isHostedTxRecentlyCompleted() method, the rolled back transaction is considered as well.
Added a unit test that would fail without the fix and pass with the fix.


Diffs
-----

  geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXManagerImpl.java df0176d 
  geode-core/src/main/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionMessage.java 9c54587 
  geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RollbackCommand.java ed7c706 
  geode-core/src/test/java/com/gemstone/gemfire/internal/cache/TXManagerImplTest.java a4b8127 

Diff: https://reviews.apache.org/r/48187/diff/


Testing
-------

precheckin.


Thanks,

Eric Shu