[ 
https://issues.apache.org/jira/browse/GEODE-3030?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16100882#comment-16100882
 ] 

ASF GitHub Bot commented on GEODE-3030:
---------------------------------------

GitHub user upthewaterspout opened a pull request:

    https://github.com/apache/geode/pull/655

    GEODE-3030: Set possibleDuplicate=true for all bucket events after failover

    ### For all changes:
    - [ ] Is there a JIRA ticket associated with this PR? Is it referenced in 
the commit message?
    
    - [ ] Has your PR been rebased against the latest commit within the target 
branch (typically `develop`)?
    
    - [ ] Is your initial contribution a single, squashed commit?
    
    - [ ] Does `gradlew build` run cleanly?
    
    - [ ] Have you written or updated unit tests to verify your changes?
    
    - [ ] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)?
    
    ### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build 
issues and
    submit an update to your PR as soon as possible. If you need help, please 
send an
    email to [email protected].


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/upthewaterspout/incubator-geode 
feature/GEODE-3030

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/geode/pull/655.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #655
    
----
commit 2649d0faf3f64a1f25898f4b3f0ee512a7824f09
Author: Barry Oglesby <[email protected]>
Date:   2017-06-12T22:04:59Z

    GEODE-3030: Set possibleDuplicate=true for all bucket events after failover

----


> The possibleDuplicate boolean may not be set to true in previously processed 
> AEQ events
> ---------------------------------------------------------------------------------------
>
>                 Key: GEODE-3030
>                 URL: https://issues.apache.org/jira/browse/GEODE-3030
>             Project: Geode
>          Issue Type: Bug
>          Components: wan
>            Reporter: Barry Oglesby
>            Assignee: Dan Smith
>
> When a secondary bucket becomes primary, it sets possibleDuplicate=true for 
> batchSize events in AbstractBucketRegionQueue.markEventsAsDuplicate:
> {noformat}
> java.lang.Exception: Stack trace
>       at java.lang.Thread.dumpStack(Thread.java:1329)
>       at 
> com.gemstone.gemfire.internal.cache.AbstractBucketRegionQueue.markEventsAsDuplicate(AbstractBucketRegionQueue.java:329)
>       at 
> com.gemstone.gemfire.internal.cache.BucketRegionQueue.beforeAcquiringPrimaryState(BucketRegionQueue.java:203)
>       at 
> com.gemstone.gemfire.internal.cache.BucketAdvisor.acquiredPrimaryLock(BucketAdvisor.java:1257)
>       at 
> com.gemstone.gemfire.internal.cache.BucketAdvisor.acquirePrimaryRecursivelyForColocated(BucketAdvisor.java:1397)
>       at 
> com.gemstone.gemfire.internal.cache.BucketAdvisor$VolunteeringDelegate.doVolunteerForPrimary(BucketAdvisor.java:2695)
>       at 
> com.gemstone.gemfire.internal.cache.BucketAdvisor$VolunteeringDelegate$1.run(BucketAdvisor.java:2575)
>       at 
> com.gemstone.gemfire.internal.cache.BucketAdvisor$VolunteeringDelegate$2.run(BucketAdvisor.java:2908)
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>       at 
> com.gemstone.gemfire.distributed.internal.DistributionManager.runUntilShutdown(DistributionManager.java:692)
>       at 
> com.gemstone.gemfire.distributed.internal.DistributionManager$6$1.run(DistributionManager.java:1029)
>       at java.lang.Thread.run(Thread.java:745)
> {noformat}
> In my test case, the batch size is 1 so possibleDuplicate is set to true for 
> only 1 event in each bucket. It is not set for the remaining events in the 
> bucket.
> The ParallelQueueRemovalMessage is sent asynchronously from remote members so 
> more than 1 batch of events could have been processed between message sends. 
> So, possibleDuplicate should be set to true for more than batchSize events 
> (possibly all of them).
> Here is an example from my test. 
> Server 1 is primary for bucket 5 and is stopped. Server 2 takes over primary 
> for bucket 5.
> {noformat}
> Server 1
> --------
> Server 1 processed 3 events from bucket 5 right before it was stopped:
> TestGatewayEventListener processed 51427367-8d36-4425-aa02-e44c54774543
> TestGatewayEventListener processed a1af3501-9030-460d-86cc-fe5b88bd5b0a
> TestGatewayEventListener processed c1db3ec2-4dad-4444-9ea7-11bd34e492ec
> No ParallelQueueRemovalMessage was sent to the remote nodes before the member 
> was stopped.
> Server 2
> --------
> Server 2 took over primary for bucket 5 and processed those same 3 events - 
> one with possibleDuplicate=true, the others with possibleDuplicate=false. In 
> all three cases a SQLIntegrityConstraintViolationException was thrown since 
> the event had already been processed by the previous primary server.
> TestGatewayEventListener caught EXPECTED exception 
> eventKey=51427367-8d36-4425-aa02-e44c54774543; operation=CREATE; 
> possibleDuplicate=true; 
> exception=java.sql.SQLIntegrityConstraintViolationException: The statement 
> was aborted because it would have caused a duplicate key value in a unique or 
> primary key constraint or unique index identified by 'SQL170601145521130' 
> defined on 'TRADES'.
> TestGatewayEventListener caught UNEXPECTED exception 
> eventKey=a1af3501-9030-460d-86cc-fe5b88bd5b0a; operation=CREATE; 
> possibleDuplicate=false; 
> exception=java.sql.SQLIntegrityConstraintViolationException: The statement 
> was aborted because it would have caused a duplicate key value in a unique or 
> primary key constraint or unique index identified by 'SQL170601145521130' 
> defined on 'TRADES'.
> TestGatewayEventListener caught UNEXPECTED exception 
> eventKey=c1db3ec2-4dad-4444-9ea7-11bd34e492ec; operation=CREATE; 
> possibleDuplicate=false; 
> exception=java.sql.SQLIntegrityConstraintViolationException: The statement 
> was aborted because it would have caused a duplicate key value in a unique or 
> primary key constraint or unique index identified by 'SQL170601145521130' 
> defined on 'TRADES'.
> AbstractBucketRegionQueue.markEventsAsDuplicate set possibleDuplicate=true 
> for 51427367-8d36-4425-aa02-e44c54774543, but not for the other events:
> AbstractBucketRegionQueue.markEventsAsDuplicate marking posDup 
> eventKey=51427367-8d36-4425-aa02-e44c54774543
> AbstractBucketRegionQueue.markEventsAsDuplicate not marking posDup 
> eventKey=a1af3501-9030-460d-86cc-fe5b88bd5b0a
> AbstractBucketRegionQueue.markEventsAsDuplicate not marking posDup 
> eventKey=c1db3ec2-4dad-4444-9ea7-11bd34e492ec
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to