This is an automated email from the ASF dual-hosted git repository.
eshu11 pushed a commit to branch feature/GEODE-6517
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/feature/GEODE-6517 by this
push:
new ca044d8 fix a review comment.
ca044d8 is described below
commit ca044d88355549177e028726dd72e390cbdac0fc
Author: eshu <[email protected]>
AuthorDate: Thu Mar 14 11:59:21 2019 -0700
fix a review comment.
---
.../internal/cache/PRHARedundancyProvider.java | 24 +++++--------------
.../internal/cache/PRHARedundancyProviderTest.java | 28 ----------------------
2 files changed, 6 insertions(+), 46 deletions(-)
diff --git
a/geode-core/src/main/java/org/apache/geode/internal/cache/PRHARedundancyProvider.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/PRHARedundancyProvider.java
index 5676ce4..2942154 100644
---
a/geode-core/src/main/java/org/apache/geode/internal/cache/PRHARedundancyProvider.java
+++
b/geode-core/src/main/java/org/apache/geode/internal/cache/PRHARedundancyProvider.java
@@ -1707,13 +1707,13 @@ public class PRHARedundancyProvider {
ArrayList<ProxyBucketRegion> bucketsHostedLocally =
new ArrayList<ProxyBucketRegion>(proxyBucketArray.length);
- allBucketsRecoveredFromDisk = new CountDownLatch(proxyBucketArray.length);
/*
* Start the redundancy logger before recovering any proxy buckets.
*/
startRedundancyLogger(proxyBucketArray.length);
+ allBucketsRecoveredFromDisk = new CountDownLatch(proxyBucketArray.length);
/*
* Spawn a separate thread for bucket that we previously hosted to recover
that bucket.
*
@@ -1785,26 +1785,14 @@ public class PRHARedundancyProvider {
}
void startRedundancyLogger(int proxyBuckets) {
- try {
- if (proxyBuckets > 0) {
- redundancyLogger = createRedundancyLogger();
- Thread loggingThread = new LoggingThread(
- "RedundancyLogger for region " + this.prRegion.getName(), false,
this.redundancyLogger);
- loggingThread.start();
- }
- } catch (RuntimeException e) {
- for (int i = 0; i < proxyBuckets; i++) {
- allBucketsRecoveredFromDisk.countDown();
- }
- allBucketsRecoveredFromDisk = null;
- throw e;
+ if (proxyBuckets > 0) {
+ redundancyLogger = new RedundancyLogger(this);
+ Thread loggingThread = new LoggingThread(
+ "RedundancyLogger for region " + this.prRegion.getName(), false,
this.redundancyLogger);
+ loggingThread.start();
}
}
- RedundancyLogger createRedundancyLogger() {
- return new RedundancyLogger(this);
- }
-
/**
* Check to see if any colocated region of the current region is persistent.
It's not enough to
* check just the leader region, because a child region might be a
persistent parallel WAN queue,
diff --git
a/geode-core/src/test/java/org/apache/geode/internal/cache/PRHARedundancyProviderTest.java
b/geode-core/src/test/java/org/apache/geode/internal/cache/PRHARedundancyProviderTest.java
index febf589..e650cbc 100644
---
a/geode-core/src/test/java/org/apache/geode/internal/cache/PRHARedundancyProviderTest.java
+++
b/geode-core/src/test/java/org/apache/geode/internal/cache/PRHARedundancyProviderTest.java
@@ -14,9 +14,7 @@
*/
package org.apache.geode.internal.cache;
-import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
-import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
@@ -26,12 +24,9 @@ import java.util.concurrent.CountDownLatch;
import org.junit.Before;
import org.junit.Test;
-import org.apache.geode.cache.CacheClosedException;
public class PRHARedundancyProviderTest {
private PRHARedundancyProvider provider;
- private final int numberOfBuckets = 113;
- private CacheClosedException expected;
@Before
public void setup() {
@@ -40,29 +35,6 @@ public class PRHARedundancyProviderTest {
}
@Test
- public void
waitForPersistentBucketRecoveryProceedsIfStartRedundancyLoggerThrows()
- throws Exception {
- provider.allBucketsRecoveredFromDisk = new CountDownLatch(numberOfBuckets);
- doThrow(new
CacheClosedException()).when(provider).createRedundancyLogger();
-
- Thread thread = new Thread(() -> startRedundancyLogger());
- thread.start();
-
- provider.waitForPersistentBucketRecovery();
- thread.join();
-
- assertThat(expected).isNotNull();
- }
-
- private void startRedundancyLogger() {
- try {
- provider.startRedundancyLogger(numberOfBuckets);
- } catch (CacheClosedException e) {
- expected = e;
- }
- }
-
- @Test
public void
waitForPersistentBucketRecoveryProceedsWhenAllBucketsRecoveredFromDiskLatchIsNull()
{
provider.waitForPersistentBucketRecovery();
}