forked from apache/geode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GEODE-5828: fixes replicates miss transaction commit. (apache#2571)
* Always send CommitProcessQueryMessage to other replicates to see if anyone received second message as transaction originator for client transaction will be different from transation host. * Do not wait for transaction originator to depart when transaction host is crashed. Originator may not be the same as the crashed transaction host and never departs from distributed system. (cherry picked from commit db8ba67)
- Loading branch information
1 parent
444293e
commit 60ca55e
Showing
4 changed files
with
276 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
geode-core/src/test/java/org/apache/geode/internal/cache/TXCommitMessageTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license | ||
* agreements. See the NOTICE file distributed with this work for additional information regarding | ||
* copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance with the License. You may obtain a | ||
* copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
package org.apache.geode.internal.cache; | ||
|
||
import static org.mockito.Mockito.doReturn; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.spy; | ||
import static org.mockito.Mockito.timeout; | ||
import static org.mockito.Mockito.verify; | ||
import static org.mockito.Mockito.when; | ||
|
||
import java.util.HashSet; | ||
|
||
import org.junit.Test; | ||
|
||
import org.apache.geode.CancelCriterion; | ||
import org.apache.geode.distributed.internal.DistributionManager; | ||
import org.apache.geode.distributed.internal.membership.InternalDistributedMember; | ||
|
||
public class TXCommitMessageTest { | ||
|
||
@Test | ||
public void commitProcessQueryMessageIsSentIfHostDeparted() { | ||
DistributionManager manager = mock(DistributionManager.class); | ||
InternalDistributedMember member = mock(InternalDistributedMember.class); | ||
DistributionManager dm = mock(DistributionManager.class); | ||
TXCommitMessage.CommitProcessQueryReplyProcessor processor = mock( | ||
TXCommitMessage.CommitProcessQueryReplyProcessor.class); | ||
TXCommitMessage.CommitProcessQueryMessage queryMessage = | ||
mock(TXCommitMessage.CommitProcessQueryMessage.class); | ||
HashSet farSiders = mock(HashSet.class); | ||
TXCommitMessage message = spy(new TXCommitMessage()); | ||
doReturn(dm).when(message).getDistributionManager(); | ||
when(dm.getCancelCriterion()).thenReturn(mock(CancelCriterion.class)); | ||
doReturn(member).when(message).getSender(); | ||
doReturn(false).when(message).isProcessing(); | ||
doReturn(processor).when(message).createReplyProcessor(); | ||
doReturn(farSiders).when(message).getFarSiders(); | ||
doReturn(queryMessage).when(message).createQueryMessage(processor); | ||
when(farSiders.isEmpty()).thenReturn(false); | ||
|
||
message.memberDeparted(manager, member, false); | ||
|
||
verify(dm, timeout(60000)).putOutgoing(queryMessage); | ||
verify(processor, timeout(60000)).waitForRepliesUninterruptibly(); | ||
} | ||
|
||
} |
Oops, something went wrong.