Skip to content

Commit 7d7f4f7

Browse files
author
mivanac
committed
WIP ignore stopping
1 parent 7a03e80 commit 7d7f4f7

File tree

4 files changed

+70
-0
lines changed

4 files changed

+70
-0
lines changed

geode-core/src/main/java/org/apache/geode/internal/cache/wan/AbstractGatewaySender.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ public abstract class AbstractGatewaySender implements InternalGatewaySender, Di
238238

239239
protected boolean enforceThreadsConnectSameReceiver;
240240

241+
private boolean shadowRegionCreated = false;
242+
241243
protected AbstractGatewaySender() {
242244
statisticsClock = disabledClock();
243245
}
@@ -1537,6 +1539,14 @@ public String getExpectedReceiverUniqueId() {
15371539
return expectedReceiverUniqueId;
15381540
}
15391541

1542+
public void setShadowRegionCreated() {
1543+
this.shadowRegionCreated = true;
1544+
}
1545+
1546+
public boolean isShadowRegionCreated() {
1547+
return this.shadowRegionCreated;
1548+
}
1549+
15401550
/**
15411551
* Has a reference to a GatewayEventImpl and has a timeout value.
15421552
*/

geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,11 @@ public void addShadowPartitionedRegionForUserPR(PartitionedRegion userPR,
572572
if (prQ == null) {
573573
return;
574574
}
575+
576+
if (!sender.isShadowRegionCreated()) {
577+
sender.setShadowRegionCreated();
578+
}
579+
575580
// TODO This should not be set on the PR but on the GatewaySender
576581
prQ.enableConflation(sender.isBatchConflationEnabled());
577582
if (isAccessor) {

geode-wan/src/distributedTest/java/org/apache/geode/internal/cache/wan/wancommand/AlterGatewaySenderCommandDUnitTest.java

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public void before() throws Exception {
9797

9898
@After
9999
public void after() {
100+
gfsh.executeAndAssertThat("destroy region --name=parentRegion").statusIsSuccess();
100101
gfsh.executeAndAssertThat(DESTROY + " --if-exists").statusIsSuccess();
101102
gfsh.executeAndAssertThat(DESTROY_PARALLEL + " --if-exists").statusIsSuccess();
102103
exln.remove();
@@ -118,6 +119,10 @@ public void testCreateSerialGatewaySenderWithDefault() throws Exception {
118119
gfsh.executeAndAssertThat("list gateways").statusIsSuccess()
119120
.containsOutput("sender1");
120121

122+
gfsh.executeAndAssertThat("create region"
123+
+ " --name=parentRegion"
124+
+ " --type=PARTITION"
125+
+ " --gateway-sender-id=sender1").statusIsSuccess();
121126
// verify that server1's event queue has the default value
122127
server1.invoke(() -> {
123128
InternalCache cache = ClusterStartupRule.getCache();
@@ -142,6 +147,11 @@ public void testCreateSerialGatewaySenderAndAlterBatchSize() throws Exception {
142147
gfsh.executeAndAssertThat("list gateways").statusIsSuccess()
143148
.containsOutput("sender1");
144149

150+
gfsh.executeAndAssertThat("create region"
151+
+ " --name=parentRegion"
152+
+ " --type=PARTITION"
153+
+ " --gateway-sender-id=sender1").statusIsSuccess();
154+
145155
gfsh.executeAndAssertThat(
146156
"alter gateway-sender --id=sender1 --batch-size=200 --alert-threshold=100")
147157
.statusIsSuccess();
@@ -169,6 +179,11 @@ public void testCreateSerialGatewaySenderAndInvalidAlterBatchSize() throws Excep
169179
gfsh.executeAndAssertThat("list gateways").statusIsSuccess()
170180
.containsOutput("sender1");
171181

182+
gfsh.executeAndAssertThat("create region"
183+
+ " --name=parentRegion"
184+
+ " --type=PARTITION"
185+
+ " --gateway-sender-id=sender1").statusIsSuccess();
186+
172187
gfsh.executeAndAssertThat(
173188
"alter gateway-sender --id=sender1 --batch-size=-10 --alert-threshold=100")
174189
.statusIsError();
@@ -196,6 +211,11 @@ public void testCreateSerialGatewaySenderAndAlterBatchSizeCheckConfig() throws E
196211
gfsh.executeAndAssertThat("list gateways").statusIsSuccess()
197212
.containsOutput("sender1");
198213

214+
gfsh.executeAndAssertThat("create region"
215+
+ " --name=parentRegion"
216+
+ " --type=PARTITION"
217+
+ " --gateway-sender-id=sender1").statusIsSuccess();
218+
199219
gfsh.executeAndAssertThat(
200220
"alter gateway-sender --id=sender1 --batch-size=200 --alert-threshold=100")
201221
.statusIsSuccess();
@@ -243,6 +263,11 @@ public void testCreateSerialGatewaySenderAndChangeGroupTransaction() throws Exce
243263
gfsh.executeAndAssertThat("list gateways").statusIsSuccess()
244264
.containsOutput("sender1");
245265

266+
gfsh.executeAndAssertThat("create region"
267+
+ " --name=parentRegion"
268+
+ " --type=PARTITION"
269+
+ " --gateway-sender-id=sender1").statusIsSuccess();
270+
246271
gfsh.executeAndAssertThat("alter gateway-sender --id=sender1 --group-transaction-events=true")
247272
.statusIsError()
248273
.containsOutput("alter-gateway-sender cannot be performed for --group-transaction-events");
@@ -261,6 +286,11 @@ public void testCreateSerialGatewaySenderAndAlterBatchSizeServerDown() throws Ex
261286
gfsh.executeAndAssertThat("list gateways").statusIsSuccess()
262287
.containsOutput("sender1");
263288

289+
gfsh.executeAndAssertThat("create region"
290+
+ " --name=parentRegion"
291+
+ " --type=PARTITION"
292+
+ " --gateway-sender-id=sender1").statusIsSuccess();
293+
264294
server1.stop(false);
265295

266296
gfsh.executeAndAssertThat(
@@ -296,6 +326,11 @@ public void testCreateSerialGatewaySenderAndAlterEventFiters() throws Exception
296326
gfsh.executeAndAssertThat("list gateways").statusIsSuccess()
297327
.containsOutput("sender1");
298328

329+
gfsh.executeAndAssertThat("create region"
330+
+ " --name=parentRegion"
331+
+ " --type=PARTITION"
332+
+ " --gateway-sender-id=sender1").statusIsSuccess();
333+
299334
gfsh.executeAndAssertThat(
300335
"alter gateway-sender --id=sender1 --batch-size=200 --alert-threshold=100 --gateway-event-filter="
301336
+ MyGatewayEventFilter.class.getName())
@@ -365,6 +400,11 @@ public void testCreateSerialGatewaySenderAndAlterEventFitersAndRemove() throws E
365400
gfsh.executeAndAssertThat("list gateways").statusIsSuccess()
366401
.containsOutput("sender1");
367402

403+
gfsh.executeAndAssertThat("create region"
404+
+ " --name=parentRegion"
405+
+ " --type=PARTITION"
406+
+ " --gateway-sender-id=sender1").statusIsSuccess();
407+
368408
gfsh.executeAndAssertThat(
369409
"alter gateway-sender --id=sender1 --batch-size=200 --alert-threshold=100 --gateway-event-filter="
370410
+ MyGatewayEventFilter.class.getName())
@@ -432,6 +472,11 @@ public void testCreateParallelGatewaySenderAndAlterBatchSize() throws Exception
432472
gfsh.executeAndAssertThat("list gateways").statusIsSuccess()
433473
.containsOutput("sender1P");
434474

475+
gfsh.executeAndAssertThat("create region"
476+
+ " --name=parentRegion"
477+
+ " --type=PARTITION"
478+
+ " --gateway-sender-id=sender1P").statusIsSuccess();
479+
435480
gfsh.executeAndAssertThat(
436481
"alter gateway-sender --id=sender1P --batch-size=200 --alert-threshold=100")
437482
.statusIsSuccess();
@@ -459,6 +504,11 @@ public void testCreateParallelGatewaySenderAndChangeGroupTransaction() throws Ex
459504
gfsh.executeAndAssertThat("list gateways").statusIsSuccess()
460505
.containsOutput("sender1P");
461506

507+
gfsh.executeAndAssertThat("create region"
508+
+ " --name=parentRegion"
509+
+ " --type=PARTITION"
510+
+ " --gateway-sender-id=sender1P").statusIsSuccess();
511+
462512
gfsh.executeAndAssertThat("alter gateway-sender --id=sender1P --group-transaction-events=true")
463513
.statusIsSuccess();
464514

geode-wan/src/main/java/org/apache/geode/cache/wan/internal/parallel/ParallelGatewaySenderImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ public void stop() {
115115
if (!this.isRunning()) {
116116
return;
117117
}
118+
119+
if (!isShadowRegionCreated()) {
120+
return;
121+
}
122+
118123
// Stop the dispatcher
119124
stopProcessing();
120125

0 commit comments

Comments
 (0)