geode git commit: Revert "GEODE-2879: LonerDistributionManager shutdown called from close"
Repository: geode Updated Branches: refs/heads/develop 9e089c5eb -> 288676dfe Revert "GEODE-2879: LonerDistributionManager shutdown called from close" This reverts commit 149e06d53a33fa7363da15bf3f9cb248d94fabf5. Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/288676df Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/288676df Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/288676df Branch: refs/heads/develop Commit: 288676dfed0d6d4e0b20e81b2392854fa1204cb6 Parents: 9e089c5 Author: nabarun Authored: Fri May 5 16:13:33 2017 -0700 Committer: nabarun Committed: Fri May 5 16:13:33 2017 -0700 -- .../geode/distributed/internal/LonerDistributionManager.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/geode/blob/288676df/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java -- diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java index d700175..fdb6a13 100644 --- a/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java +++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java @@ -284,9 +284,7 @@ public class LonerDistributionManager implements DM { return null; } - public void close() { -shutdown(); - } + public void close() {} public void restartCommunications() {
geode git commit: GEODE-2881: Wait for waitForFlushBeforeExecuteTextSearch to complete
Repository: geode Updated Branches: refs/heads/develop 3f1482b68 -> 7030dcdec GEODE-2881: Wait for waitForFlushBeforeExecuteTextSearch to complete * Test now waits for waitForFlushBeforeExecuteTextSearch initiated by the test hook. * The test hook gets called when GII is requested. * This task may hit CacheClosedException if the test get completed before the flush operations of GII Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/7030dcde Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/7030dcde Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/7030dcde Branch: refs/heads/develop Commit: 7030dcdec5be21e2ae3bb1500020e2ec6700a35b Parents: 3f1482b Author: nabarun Authored: Fri May 5 17:13:20 2017 -0700 Committer: nabarun Committed: Mon May 8 10:50:20 2017 -0700 -- .../cache/lucene/RebalanceWithRedundancyDUnitTest.java | 12 1 file changed, 12 insertions(+) -- http://git-wip-us.apache.org/repos/asf/geode/blob/7030dcde/geode-lucene/src/test/java/org/apache/geode/cache/lucene/RebalanceWithRedundancyDUnitTest.java -- diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/RebalanceWithRedundancyDUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/RebalanceWithRedundancyDUnitTest.java index f866e51..0cb7b43 100644 --- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/RebalanceWithRedundancyDUnitTest.java +++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/RebalanceWithRedundancyDUnitTest.java @@ -31,6 +31,7 @@ import org.apache.geode.distributed.DistributedMember; import org.apache.geode.internal.cache.InitialImageOperation; import org.apache.geode.internal.cache.InitialImageOperation.GIITestHook; import org.apache.geode.internal.cache.InitialImageOperation.GIITestHookType; +import org.apache.geode.internal.cache.PartitionedRegion; import org.apache.geode.test.dunit.SerializableRunnableIF; import org.apache.geode.test.junit.categories.DistributedTest; @@ -150,9 +151,20 @@ public class RebalanceWithRedundancyDUnitTest extends LuceneQueriesAccessorBase }); }); + dataStore2.invoke(() -> initDataStore(createIndex, regionTestType)); assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore1, 3)); + +dataStore2.invoke(() -> { + PartitionedRegion region = (PartitionedRegion) getCache().getRegion(REGION_NAME); + Awaitility.await().atMost(1, TimeUnit.MINUTES) + .until(() -> assertEquals(0, region.getPrStats().getLowRedundancyBucketCount())); +}); + +dataStore1.invoke(() -> getCache().close()); + +assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore2, 3)); executeTextSearch(accessor, "world", "text", NUM_BUCKETS); }
geode git commit: GEODE-2879: Shutdown() called from close() in LonerDistributionManager
Repository: geode Updated Branches: refs/heads/develop 24076f15d -> 6f9fb4cda GEODE-2879: Shutdown() called from close() in LonerDistributionManager * LonerDistributionManager shutdown was not being called from close() method call. * This resulted in the thread pool's threads to wait for 1 minute of inactivity for them to be killed. * This resulted in an extra delay while test executions. * shutdown called from close method This closes #499 Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/6f9fb4cd Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/6f9fb4cd Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/6f9fb4cd Branch: refs/heads/develop Commit: 6f9fb4cdabd9c59536acf6c5654da840de7394a0 Parents: 24076f1 Author: nabarun Authored: Fri May 5 16:28:17 2017 -0700 Committer: nabarun Committed: Mon May 8 16:53:58 2017 -0700 -- .../geode/distributed/internal/LonerDistributionManager.java | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/geode/blob/6f9fb4cd/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java -- diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java index fdb6a13..3df0196 100644 --- a/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java +++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java @@ -101,7 +101,7 @@ public class LonerDistributionManager implements DM { private ConcurrentMap canonicalIds = new ConcurrentHashMap(); static private final DummyDMStats stats = new DummyDMStats(); - static private final ExecutorService executor = Executors.newCachedThreadPool(); + private final ExecutorService executor = Executors.newCachedThreadPool(); @Override public long cacheTimeMillis() { @@ -284,7 +284,9 @@ public class LonerDistributionManager implements DM { return null; } - public void close() {} + public void close() { +shutdown(); + } public void restartCommunications() {
geode git commit: GEODE-2754: Changed the name of unknown host
Repository: geode Updated Branches: refs/heads/develop 6f9fb4cda -> d0d43f908 GEODE-2754: Changed the name of unknown host * Assert failures occured if the network contained machines named "unknown" as the test function also named the unknown host as "unknown" * This led to test to find multiple machines named "unknown" rather than one. * Changed the name of the unknown host set by the test to be "unknownGeodeHostWanAutoDiscoveryDUnitTest" Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/d0d43f90 Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/d0d43f90 Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/d0d43f90 Branch: refs/heads/develop Commit: d0d43f908d235736df3efab202d4a46657da99cd Parents: 6f9fb4c Author: nabarun Authored: Wed May 3 17:45:45 2017 -0700 Committer: nabarun Committed: Mon May 8 16:55:38 2017 -0700 -- .../geode/internal/cache/wan/misc/WanAutoDiscoveryDUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/geode/blob/d0d43f90/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WanAutoDiscoveryDUnitTest.java -- diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WanAutoDiscoveryDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WanAutoDiscoveryDUnitTest.java index 42ddc48..6d75064 100644 --- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WanAutoDiscoveryDUnitTest.java +++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WanAutoDiscoveryDUnitTest.java @@ -625,7 +625,7 @@ public class WanAutoDiscoveryDUnitTest extends WANTestBase { } private void addUnknownHost(Set remoteLocators) { -String unknownHostName = "unknown"; +String unknownHostName = "unknownGeodeHostWanAutoDiscoveryDUnitTest"; boolean unknownHostFound = false; int numTries = 10; for (int i = 0; i < numTries; i++) {
geode git commit: GEODE-2896: Changing the test category to IntegrationTest
Repository: geode Updated Branches: refs/heads/develop 23eb2326f -> d58be4fa2 GEODE-2896: Changing the test category to IntegrationTest * Changed the test category to IntegrationTest from being an UnitTest * This creates a separate VM for these tests which are not affected by residual instances created by other tests. Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/d58be4fa Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/d58be4fa Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/d58be4fa Branch: refs/heads/develop Commit: d58be4fa272135c8688e7e244d4198b73f6e113c Parents: 23eb232 Author: nabarun Authored: Mon May 8 17:58:58 2017 -0700 Committer: nabarun Committed: Tue May 9 10:31:43 2017 -0700 -- .../membership/gms/mgr/GMSMembershipManagerJUnitTest.java| 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/geode/blob/d58be4fa/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/mgr/GMSMembershipManagerJUnitTest.java -- diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/mgr/GMSMembershipManagerJUnitTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/mgr/GMSMembershipManagerJUnitTest.java index 8c82a6f..3f81bcd 100644 --- a/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/mgr/GMSMembershipManagerJUnitTest.java +++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/mgr/GMSMembershipManagerJUnitTest.java @@ -33,8 +33,8 @@ import org.apache.geode.distributed.internal.membership.gms.mgr.GMSMembershipMan import org.apache.geode.internal.admin.remote.AlertListenerMessage; import org.apache.geode.internal.admin.remote.RemoteTransportConfig; import org.apache.geode.internal.tcp.ConnectExceptions; +import org.apache.geode.test.junit.categories.IntegrationTest; import org.apache.geode.test.junit.categories.MembershipTest; -import org.apache.geode.test.junit.categories.UnitTest; import org.assertj.core.api.Assertions; import org.jgroups.util.UUID; import org.junit.After; @@ -51,7 +51,7 @@ import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.isA; import static org.mockito.Mockito.*; -@Category({UnitTest.class, MembershipTest.class}) +@Category({IntegrationTest.class, MembershipTest.class}) public class GMSMembershipManagerJUnitTest { private static final long WAIT_FOR_REPLIES_MILLIS = 2000;
geode git commit: GEODE-2907: Removed @Experimental tag from the Lucene module
Repository: geode Updated Branches: refs/heads/develop c270756f7 -> e98606d43 GEODE-2907: Removed @Experimental tag from the Lucene module * Removed the @experimental tag fromt the files in Lucene module. * Improve on the javadocs for the interfaces present in the Lucene module. This closes #503 Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/e98606d4 Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/e98606d4 Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/e98606d4 Branch: refs/heads/develop Commit: e98606d43b69fa0e9aa6ea89fcdfdac9133222a4 Parents: c270756 Author: nabarun Authored: Tue May 9 15:15:59 2017 -0700 Committer: nabarun Committed: Thu May 11 10:17:25 2017 -0700 -- .../apache/geode/cache/lucene/LuceneIndex.java | 45 - .../geode/cache/lucene/LuceneIndexFactory.java | 2 - .../apache/geode/cache/lucene/LuceneQuery.java | 51 +--- .../geode/cache/lucene/LuceneQueryFactory.java | 4 -- .../geode/cache/lucene/LuceneQueryProvider.java | 3 -- .../geode/cache/lucene/LuceneResultStruct.java | 12 +++-- .../geode/cache/lucene/LuceneService.java | 4 -- .../cache/lucene/LuceneServiceProvider.java | 9 ++-- .../lucene/PageableLuceneQueryResults.java | 13 +++-- .../internal/distributed/CollectorManager.java | 10 ++-- .../repository/IndexResultCollector.java| 24 ++--- 11 files changed, 123 insertions(+), 54 deletions(-) -- http://git-wip-us.apache.org/repos/asf/geode/blob/e98606d4/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneIndex.java -- diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneIndex.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneIndex.java index f13c8b3..07b5c89 100644 --- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneIndex.java +++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneIndex.java @@ -19,39 +19,62 @@ import java.util.Map; import org.apache.lucene.analysis.Analyzer; -import org.apache.geode.annotations.Experimental; - /** * - * An Lucene index is built over the data stored in a GemFire Region. + * LuceneIndex represents the Lucene index created over the data stored in Apache Geode regions. The + * Lucene indexes are maintained automatically by Apache Geode whenever the entries are updated in + * the associated regions. Lucene Indexes are created using {@link LuceneService#createIndexFactory} + * by specifying the Lucene index name, the region associated with the Lucene index and the fields + * on which the Lucene index is to be created. * + * + * + * Every Lucene index is uniquely identified by the index name and the name of the region associated + * with it. To obtain the LuceneIndex created over a region use + * {@link LuceneService#getIndex(String, String)} + * + * * - * An index is specified using a index name, field names, region name. + * LuceneIndexes are created using gfsh, xml, or the Java API using LuceneService + * {@link LuceneService#createIndexFactory}. More information about LuceneIndex can be found at + * {@link LuceneService} * - * The index name and region name together uniquely identifies the Lucene index. - * */ -@Experimental public interface LuceneIndex { /** - * @return the name of this index + * Returns the name of the LuceneIndex object. This name is provided while creating the + * LuceneIndex using {@link LuceneService#createIndexFactory()} create method + * + * @return Name of the LuceneIndex */ public String getName(); /** - * @return the name of the region that is being indexed + * Returns the path of the region on which the LuceneIndex was created. The region name is + * provided while creating the LuceneIndex using {@link LuceneService#createIndexFactory()} + * + * @return Path of the region */ public String getRegionPath(); /** - * @return the indexed field names + * Returns a string array containing the fields on which the LuceneIndex was created. These fields + * are assigned using the addField method while creating the LuceneIndex using + * {@link LuceneService#createIndexFactory()} + * + * @return String array containing the field names */ public String[] getFieldNames(); /** - * @return a map of what {@link Analyzer} is being used for each indexed field. + * Returns a map containing the field name and the {@link Analyzer} used to tokenize the field. + * The analyzer to be used on a particular field is set in the addField method while creating the + * LuceneIndex using {@link LuceneService#createIndexFactory()} + * + * @return a map
geode git commit: GEODE-2637: Refactored LuceneQueryFactory.setResultLimit()
Repository: geode Updated Branches: refs/heads/develop 0c5011ec7 -> efbe53cba GEODE-2637: Refactored LuceneQueryFactory.setResultLimit() * Renamed LuceneQueryFactory.getResult to setLimit() * This is done to match the cwiki documents Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/efbe53cb Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/efbe53cb Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/efbe53cb Branch: refs/heads/develop Commit: efbe53cbafe30c5fb17681e22a3c83f3042e08ae Parents: 0c5011e Author: nabarunnag Authored: Fri May 12 06:01:01 2017 -0700 Committer: nabarunnag Committed: Fri May 12 06:01:01 2017 -0700 -- .../geode/cache/lucene/LuceneQueryFactory.java | 2 +- .../lucene/internal/LuceneQueryFactoryImpl.java | 2 +- .../functions/LuceneSearchIndexFunction.java| 5 + .../geode/cache/lucene/EvictionDUnitTest.java | 2 +- .../geode/cache/lucene/ExpirationDUnitTest.java | 3 +-- .../lucene/LuceneIndexDestroyDUnitTest.java | 2 +- .../cache/lucene/LuceneQueriesAccessorBase.java | 4 ++-- .../cache/lucene/MixedObjectIndexDUnitTest.java | 20 ++-- .../geode/cache/lucene/PaginationDUnitTest.java | 5 ++--- .../LuceneQueryFactoryImplJUnitTest.java| 2 +- .../LuceneSearchIndexFunctionJUnitTest.java | 2 +- 11 files changed, 22 insertions(+), 27 deletions(-) -- http://git-wip-us.apache.org/repos/asf/geode/blob/efbe53cb/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQueryFactory.java -- diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQueryFactory.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQueryFactory.java index 5cf794a..6236d12 100644 --- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQueryFactory.java +++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQueryFactory.java @@ -57,7 +57,7 @@ public interface LuceneQueryFactory { * @return itself * @throws IllegalArgumentException if the value is less than or equal to zero. */ - LuceneQueryFactory setResultLimit(int limit); + LuceneQueryFactory setLimit(int limit); /** * Creates a query based on a query string which is parsed by Lucene's http://git-wip-us.apache.org/repos/asf/geode/blob/efbe53cb/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryFactoryImpl.java -- diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryFactoryImpl.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryFactoryImpl.java index 5c088dc..f3e4f10 100644 --- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryFactoryImpl.java +++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryFactoryImpl.java @@ -41,7 +41,7 @@ public class LuceneQueryFactoryImpl implements LuceneQueryFactory { } @Override - public LuceneQueryFactory setResultLimit(int limit) { + public LuceneQueryFactory setLimit(int limit) { if (limit <= 0) { throw new IllegalArgumentException("Limit is <= 0: " + limit); } http://git-wip-us.apache.org/repos/asf/geode/blob/efbe53cb/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneSearchIndexFunction.java -- diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneSearchIndexFunction.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneSearchIndexFunction.java index d9dfbec..06df285 100755 --- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneSearchIndexFunction.java +++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneSearchIndexFunction.java @@ -15,11 +15,9 @@ package org.apache.geode.cache.lucene.internal.cli.functions; -import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; -import java.util.stream.Collectors; import org.apache.geode.cache.Cache; import org.apache.geode.cache.CacheFactory; @@ -35,7 +33,6 @@ import org.apache.geode.cache.lucene.internal.cli.LuceneIndexDetails; import org.apache.geode.cache.lucene.internal.cli.LuceneIndexInfo; import org.apache.geode.cache.lucene.internal.cli.LuceneQueryInfo; import org.apache.geode.cache.lucene.internal.cli.LuceneSearchResults; -import org.apache.geode.cache.query.RegionNotFoundException; import org.apache.geode.internal.InternalEntity; /** @@ -74,7 +71,7 @@ p
geode git commit: GEODE-2828: AEQ created before the Lucene user regions
Repository: geode Updated Branches: refs/heads/develop a6832ee2c -> 480a1e05c GEODE-2828: AEQ created before the Lucene user regions * AEQ is being created before the Lucene user region * A countdown latch prevents the index repository computation until the user regions are ready * Integration tests do not use a Dummy executor because we need a thread pool for afterPrimary call. This closes #481 Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/480a1e05 Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/480a1e05 Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/480a1e05 Branch: refs/heads/develop Commit: 480a1e05cd5bc332c1e5e2593c3468f640ded1c0 Parents: a6832ee Author: nabarun Authored: Tue May 2 15:02:23 2017 -0700 Committer: nabarun Committed: Tue May 2 21:53:46 2017 -0700 -- .../internal/LonerDistributionManager.java | 11 - .../internal/offheap/OffHeapRegionBase.java | 31 -- .../AbstractPartitionedRepositoryManager.java | 18 +++- .../lucene/internal/LuceneBucketListener.java | 4 +- .../lucene/internal/LuceneEventListener.java| 4 -- .../LuceneIndexForPartitionedRegion.java| 18 .../cache/lucene/internal/LuceneIndexImpl.java | 44 .../cache/lucene/internal/LuceneRawIndex.java | 10 - .../lucene/internal/LuceneRegionListener.java | 14 ++- .../lucene/internal/LuceneServiceImpl.java | 34 +++ .../internal/LuceneEventListenerJUnitTest.java | 4 -- .../lucene/internal/LuceneIndexFactorySpy.java | 18 .../LuceneIndexForPartitionedRegionTest.java| 22 ++ .../PartitionedRepositoryManagerJUnitTest.java | 2 + .../RawLuceneRepositoryManagerJUnitTest.java| 2 + 15 files changed, 143 insertions(+), 93 deletions(-) -- http://git-wip-us.apache.org/repos/asf/geode/blob/480a1e05/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java -- diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java index e9068e6..fdb6a13 100644 --- a/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java +++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java @@ -71,7 +71,14 @@ public class LonerDistributionManager implements DM { // no threads needed } - protected void shutdown() {} + protected void shutdown() { +executor.shutdown(); +try { + executor.awaitTermination(20, TimeUnit.SECONDS); +} catch (InterruptedException e) { + throw new InternalGemFireError("Interrupted while waiting for DM shutdown"); +} + } private final InternalDistributedMember id; @@ -94,7 +101,7 @@ public class LonerDistributionManager implements DM { private ConcurrentMap canonicalIds = new ConcurrentHashMap(); static private final DummyDMStats stats = new DummyDMStats(); - static private final DummyExecutor executor = new DummyExecutor(); + static private final ExecutorService executor = Executors.newCachedThreadPool(); @Override public long cacheTimeMillis() { http://git-wip-us.apache.org/repos/asf/geode/blob/480a1e05/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapRegionBase.java -- diff --git a/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapRegionBase.java b/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapRegionBase.java index 62766cc..c0c6085 100644 --- a/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapRegionBase.java +++ b/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapRegionBase.java @@ -31,12 +31,17 @@ import org.apache.geode.pdx.PdxReader; import org.apache.geode.pdx.PdxSerializable; import org.apache.geode.pdx.PdxWriter; import org.apache.geode.test.dunit.WaitCriterion; +import org.awaitility.Awaitility; +import org.junit.After; import org.junit.Test; +import java.io.File; +import java.io.FilenameFilter; import java.io.Serializable; import java.util.Arrays; import java.util.List; import java.util.Properties; +import java.util.concurrent.TimeUnit; import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT; @@ -72,6 +77,22 @@ public abstract class OffHeapRegionBase { return result; } + @After + public void cleanUp() { +File dir = new File("."); +File[] files = dir.listF
geode git commit: GEODE-2879: LonerDistributionManager shutdown called from close
Repository: geode Updated Branches: refs/heads/develop 21d4ab2cf -> 149e06d53 GEODE-2879: LonerDistributionManager shutdown called from close * LonerDistributionManager shutdown was not being called from close() method call. * This resulted in the thread pool's threads to wait for 1 minute of inactivity for them to be killed. * This resulted in an extra delay while test executions. * shutdown called from close method Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/149e06d5 Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/149e06d5 Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/149e06d5 Branch: refs/heads/develop Commit: 149e06d53a33fa7363da15bf3f9cb248d94fabf5 Parents: 21d4ab2 Author: nabarun Authored: Thu May 4 17:17:52 2017 -0700 Committer: nabarun Committed: Thu May 4 17:17:52 2017 -0700 -- .../geode/distributed/internal/LonerDistributionManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/geode/blob/149e06d5/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java -- diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java index fdb6a13..d700175 100644 --- a/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java +++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java @@ -284,7 +284,9 @@ public class LonerDistributionManager implements DM { return null; } - public void close() {} + public void close() { +shutdown(); + } public void restartCommunications() {
[geode] branch support/1.13 updated: GEODE-8287: Added another condition to cause the indexed value to be used
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.13 by this push: new 133229a GEODE-8287: Added another condition to cause the indexed value to be used 133229a is described below commit 133229a4c98d6e64b138d5cd73e3ac7905797b3d Author: Barry Oglesby AuthorDate: Thu Jun 25 05:58:46 2020 -1000 GEODE-8287: Added another condition to cause the indexed value to be used (cherry picked from commit 827f8651b02d90a8ad7dfa3dca62af3c06ca6b6c) --- .../IndexUsageInJoinQueryDistributedTest.java | 215 + .../geode/cache/query/internal/QueryUtils.java | 3 + 2 files changed, 218 insertions(+) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/cache/query/dunit/IndexUsageInJoinQueryDistributedTest.java b/geode-core/src/distributedTest/java/org/apache/geode/cache/query/dunit/IndexUsageInJoinQueryDistributedTest.java new file mode 100644 index 000..113a532 --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/cache/query/dunit/IndexUsageInJoinQueryDistributedTest.java @@ -0,0 +1,215 @@ +/* + * 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.cache.query.dunit; + +import static org.apache.geode.cache.RegionShortcut.REPLICATE; +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.Serializable; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import org.apache.geode.cache.Cache; +import org.apache.geode.cache.Region; +import org.apache.geode.cache.client.ClientCache; +import org.apache.geode.cache.client.ClientRegionShortcut; +import org.apache.geode.cache.query.IndexExistsException; +import org.apache.geode.cache.query.IndexNameConflictException; +import org.apache.geode.cache.query.Query; +import org.apache.geode.cache.query.QueryService; +import org.apache.geode.cache.query.RegionNotFoundException; +import org.apache.geode.distributed.internal.DistributionStats; +import org.apache.geode.distributed.internal.InternalDistributedSystem; +import org.apache.geode.pdx.PdxReader; +import org.apache.geode.pdx.PdxSerializable; +import org.apache.geode.pdx.PdxWriter; +import org.apache.geode.test.dunit.rules.ClientVM; +import org.apache.geode.test.dunit.rules.ClusterStartupRule; +import org.apache.geode.test.dunit.rules.MemberVM; +import org.apache.geode.test.junit.categories.OQLIndexTest; +import org.apache.geode.test.junit.rules.serializable.SerializableTestName; + +@Category({OQLIndexTest.class}) +public class IndexUsageInJoinQueryDistributedTest implements Serializable { + + private MemberVM locator; + + private MemberVM server; + + private ClientVM client; + + private static final String PRODUCT_REGION_NAME = "product"; + + private static final String INSTRUMENT_REGION_NAME = "instrument"; + + @Rule + public ClusterStartupRule clusterRule = new ClusterStartupRule(); + + @Rule + public SerializableTestName testName = new SerializableTestName(); + + @Test + public void testSecondIndexUsedWhenExecutingJoinQuery() throws Exception { +// Start Locator +locator = clusterRule.startLocatorVM(0); + +// Start server +server = clusterRule.startServerVM(1, locator.getPort()); + +// Create server regions +server.invoke(() -> createServerRegionsAndIndexes()); + +// Start client +client = clusterRule.startClientVM(2, c -> c.withLocatorConnection(locator.getPort())); + +// Create client regions +client.invoke(() -> createClientRegions()); + +// Load regions +int numProducts = 1000; +int numInstruments = 100; +client.invoke(() -> loadRegions(numProducts, numInstruments)); + +// Get number of deserializations before query +long deserializationsBeforeQuery = server.invoke(() -> getDeserializations()); + +// Execute query +client.invoke(() -> executeQuery(numInstruments)); + +// Get number of deseria
[geode] 02/13: GEODE-7682: add PR.clear API (#4755)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 6174f70637eec6ea8a4894d8773a83f7e3443b31 Author: Xiaojian Zhou AuthorDate: Thu Mar 5 23:46:36 2020 -0800 GEODE-7682: add PR.clear API (#4755) * GEODE-7683: introduce BR.cmnClearRegion Co-authored-by: Xiaojian Zhou --- .../cache/PartitionedRegionClearDUnitTest.java | 218 + .../PartitionedRegionPersistentClearDUnitTest.java | 26 +++ ...itionedRegionSingleNodeOperationsJUnitTest.java | 66 --- .../codeAnalysis/sanctionedDataSerializables.txt | 4 +- .../org/apache/geode/internal/DSFIDFactory.java| 3 + .../geode/internal/cache/DistributedRegion.java| 9 - .../apache/geode/internal/cache/LocalRegion.java | 10 + .../geode/internal/cache/PartitionedRegion.java| 214 ++-- .../geode/internal/cache/RegionEventImpl.java | 5 + .../internal/cache/partitioned/ClearPRMessage.java | 166 +--- .../cache/partitioned/ClearPRMessageTest.java | 50 ++--- 11 files changed, 522 insertions(+), 249 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java new file mode 100644 index 000..fb2a81b --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java @@ -0,0 +1,218 @@ +/* + * 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.apache.geode.internal.Assert.fail; +import static org.apache.geode.test.dunit.rules.ClusterStartupRule.getCache; +import static org.apache.geode.test.dunit.rules.ClusterStartupRule.getClientCache; +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.Serializable; +import java.util.Properties; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.IntStream; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import org.apache.geode.cache.InterestResultPolicy; +import org.apache.geode.cache.PartitionAttributesFactory; +import org.apache.geode.cache.Region; +import org.apache.geode.cache.RegionEvent; +import org.apache.geode.cache.RegionShortcut; +import org.apache.geode.cache.client.ClientRegionShortcut; +import org.apache.geode.cache.util.CacheListenerAdapter; +import org.apache.geode.test.dunit.SerializableCallableIF; +import org.apache.geode.test.dunit.rules.ClientVM; +import org.apache.geode.test.dunit.rules.ClusterStartupRule; +import org.apache.geode.test.dunit.rules.MemberVM; + +public class PartitionedRegionClearDUnitTest implements Serializable { + protected static final String REGION_NAME = "testPR"; + protected static final int NUM_ENTRIES = 1000; + + protected int locatorPort; + protected MemberVM locator; + protected MemberVM dataStore1, dataStore2, dataStore3, accessor; + protected ClientVM client1, client2; + + private static final Logger logger = LogManager.getLogger(); + + @Rule + public ClusterStartupRule cluster = new ClusterStartupRule(7); + + @Before + public void setUp() throws Exception { +locator = cluster.startLocatorVM(0); +locatorPort = locator.getPort(); +dataStore1 = cluster.startServerVM(1, getProperties(), locatorPort); +dataStore2 = cluster.startServerVM(2, getProperties(), locatorPort); +dataStore3 = cluster.startServerVM(3, getProperties(), locatorPort); +accessor = cluster.startServerVM(4, getProperties(), locatorPort); +client1 = cluster.startClientVM(5, +c -> c.withPoolSubscription(true).withLocatorConnection((locatorPort))); +client2 = cluster.startClientVM(6, +c -> c.withPoolSubscription(true).withLocatorConnection((locatorPort))); +dataStore1.invoke(this::initDataStore); +dataStore2.invoke(this::initDataStore); +dataStore3.invoke(this::initD
[geode] 03/13: PR.clear's event id should be created and used in BR (#4805)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 23954beddacb0fd883360739ae48fba6fa2c84f8 Author: Xiaojian Zhou AuthorDate: Mon Mar 16 17:35:35 2020 -0700 PR.clear's event id should be created and used in BR (#4805) * GEODE-7857: PR.clear's event id should be created and used in BR --- .../PartitionedRegionPersistentClearDUnitTest.java | 2 +- .../codeAnalysis/sanctionedDataSerializables.txt | 4 +- .../geode/internal/cache/PartitionedRegion.java| 8 +-- .../internal/cache/partitioned/ClearPRMessage.java | 12 ++-- .../internal/cache/PartitionedRegionTest.java | 65 ++ 5 files changed, 80 insertions(+), 11 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionPersistentClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionPersistentClearDUnitTest.java index 847699b..c758446 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionPersistentClearDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionPersistentClearDUnitTest.java @@ -21,6 +21,6 @@ import org.apache.geode.cache.RegionShortcut; public class PartitionedRegionPersistentClearDUnitTest extends PartitionedRegionClearDUnitTest { protected RegionShortcut getRegionShortCut() { -return RegionShortcut.PARTITION_REDUNDANT_PERSISTENT_OVERFLOW; +return RegionShortcut.PARTITION_REDUNDANT_PERSISTENT; } } diff --git a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt index bdeaf11..6dd3a34 100644 --- a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt +++ b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt @@ -1369,8 +1369,8 @@ fromData,27 toData,27 org/apache/geode/internal/cache/partitioned/ClearPRMessage,2 -fromData,19 -toData,36 +fromData,30 +toData,44 org/apache/geode/internal/cache/partitioned/ClearPRMessage$ClearReplyMessage,2 fromData,17 diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java index 1a1df20..312e951 100755 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java @@ -2189,7 +2189,7 @@ public class PartitionedRegion extends LocalRegion } // create ClearPRMessage per bucket -List clearMsgList = createClearPRMessages(); +List clearMsgList = createClearPRMessages(regionEvent.getEventId()); for (ClearPRMessage clearPRMessage : clearMsgList) { int bucketId = clearPRMessage.getBucketId(); checkReadiness(); @@ -2361,10 +2361,10 @@ public class PartitionedRegion extends LocalRegion } } - List createClearPRMessages() { + List createClearPRMessages(EventID eventID) { ArrayList clearMsgList = new ArrayList<>(); -for (int bucketId = 0; bucketId < this.totalNumberOfBuckets; bucketId++) { - ClearPRMessage clearPRMessage = new ClearPRMessage(bucketId); +for (int bucketId = 0; bucketId < getTotalNumberOfBuckets(); bucketId++) { + ClearPRMessage clearPRMessage = new ClearPRMessage(bucketId, eventID); clearMsgList.add(clearPRMessage); } return clearMsgList; diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ClearPRMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ClearPRMessage.java index 9fa8057..cc01920 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ClearPRMessage.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ClearPRMessage.java @@ -56,6 +56,8 @@ public class ClearPRMessage extends PartitionMessageWithDirectReply { private Integer bucketId; + private EventID eventID; + public static final String BUCKET_NON_PRIMARY_MESSAGE = "The bucket region on target member is no longer primary"; public static final String EXCEPTION_THROWN_DURING_CLEAR_OPERATION = @@ -71,8 +73,9 @@ public class ClearPRMessage extends PartitionMessageWithDirectReply { */ public ClearPRMessage() {} - public ClearPRMessage(int bucketId) { + public ClearPRMessage(int bucketId, EventID eventID) { this.bucketId = bucketId; +this.eventID = eventID; } public void initMessage(PartitionedRegion region, Set recipients, @@ -119,6 +122,7 @@ pub
[geode] 07/13: GEODE-7667: Add a 'clear' gfsh command for PR and RR clear (#4818)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 9bf176cc7822f7328fef80e9f0797293d6f4e98e Author: BenjaminPerryRoss <39068135+benjaminperryr...@users.noreply.github.com> AuthorDate: Tue May 5 11:40:34 2020 -0700 GEODE-7667: Add a 'clear' gfsh command for PR and RR clear (#4818) * Added clear command and modified remove functionality to clear PR Authored-by: Benjamin Ross --- .../geode/management/internal/i18n/CliStrings.java | 14 ++- .../cli/commands/ClearCommandDUnitTest.java| 120 + .../cli/commands/RemoveCommandDUnitTest.java | 13 ++- .../{RemoveCommand.java => ClearCommand.java} | 53 - .../cli/commands/CommandAvailabilityIndicator.java | 1 + .../internal/cli/commands/RemoveCommand.java | 9 +- .../internal/cli/domain/DataCommandResult.java | 12 +++ .../cli/functions/DataCommandFunction.java | 23 ++-- .../internal/cli/commands/ClearCommandTest.java| 115 9 files changed, 309 insertions(+), 51 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/i18n/CliStrings.java b/geode-core/src/main/java/org/apache/geode/management/internal/i18n/CliStrings.java index c354d030..6df013e 100644 --- a/geode-core/src/main/java/org/apache/geode/management/internal/i18n/CliStrings.java +++ b/geode-core/src/main/java/org/apache/geode/management/internal/i18n/CliStrings.java @@ -811,6 +811,14 @@ public class CliStrings { public static final String CLEAR_DEFINED_INDEX__SUCCESS__MSG = "Index definitions successfully cleared"; + /* clear region */ + public static final String CLEAR_REGION = "clear region"; + public static final String CLEAR_REGION_HELP = + "Clears/Removes all keys from the specified region."; + public static final String CLEAR_REGION_REGION_NAME = "name"; + public static final String CLEAR_REGION_REGION_NAME_HELP = "Region to clear keys from."; + public static final String CLEAR_REGION_CLEARED_ALL_KEYS = "Cleared all keys in the region"; + /* create region */ public static final String CREATE_REGION = "create region"; public static final String CREATE_REGION__HELP = @@ -1930,9 +1938,9 @@ public class CliStrings { public static final String REMOVE__MSG__KEY_EMPTY = "Key is Null"; public static final String REMOVE__MSG__REGION_NOT_FOUND = "Region <{0}> Not Found"; public static final String REMOVE__MSG__KEY_NOT_FOUND_REGION = "Key is not present in the region"; - public static final String REMOVE__MSG__CLEARED_ALL_CLEARS = "Cleared all keys in the region"; - public static final String REMOVE__MSG__CLEARALL_NOT_SUPPORTED_FOR_PARTITIONREGION = - "Option --" + REMOVE__ALL + " is not supported on partitioned region"; + public static final String REMOVE__MSG__CLEARALL_DEPRECATION_WARNING = + "Warning: The --all option for the 'remove' command is deprecated. Please" + + " use the 'clear' command instead."; /* resume gateway-sender */ public static final String RESUME_GATEWAYSENDER = "resume gateway-sender"; diff --git a/geode-gfsh/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ClearCommandDUnitTest.java b/geode-gfsh/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ClearCommandDUnitTest.java new file mode 100644 index 000..e51fc0f --- /dev/null +++ b/geode-gfsh/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ClearCommandDUnitTest.java @@ -0,0 +1,120 @@ +/* + * 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.management.internal.cli.commands; + +import static org.apache.geode.management.internal.cli.commands.RemoveCommand.REGION_NOT_FOUND; +import static org.apache.geode.management.internal.i18n.CliStrings.CLEAR_REGION_CLEARED_ALL_KEYS; +import static org.asser
[geode] 04/13: GEODE-7912: cacheWriter should be triggered when PR.clear (#4882)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 2840a19ce2fc35796a3197f215bee7b62da36c2f Author: Xiaojian Zhou AuthorDate: Mon Mar 30 19:34:35 2020 -0700 GEODE-7912: cacheWriter should be triggered when PR.clear (#4882) Co-authored-by: Anil Co-authored-by: Xiaojian Zhou --- .../cache/PartitionedRegionClearDUnitTest.java | 228 + .../apache/geode/internal/cache/LocalRegion.java | 4 +- .../geode/internal/cache/PartitionedRegion.java| 56 +++-- 3 files changed, 223 insertions(+), 65 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java index fb2a81b..a5a22b9 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java @@ -20,6 +20,7 @@ import static org.apache.geode.test.dunit.rules.ClusterStartupRule.getClientCach import static org.assertj.core.api.Assertions.assertThat; import java.io.Serializable; +import java.util.HashMap; import java.util.Properties; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.IntStream; @@ -30,13 +31,15 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; +import org.apache.geode.cache.CacheWriterException; import org.apache.geode.cache.InterestResultPolicy; import org.apache.geode.cache.PartitionAttributesFactory; import org.apache.geode.cache.Region; import org.apache.geode.cache.RegionEvent; +import org.apache.geode.cache.RegionFactory; import org.apache.geode.cache.RegionShortcut; import org.apache.geode.cache.client.ClientRegionShortcut; -import org.apache.geode.cache.util.CacheListenerAdapter; +import org.apache.geode.cache.util.CacheWriterAdapter; import org.apache.geode.test.dunit.SerializableCallableIF; import org.apache.geode.test.dunit.rules.ClientVM; import org.apache.geode.test.dunit.rules.ClusterStartupRule; @@ -68,12 +71,6 @@ public class PartitionedRegionClearDUnitTest implements Serializable { c -> c.withPoolSubscription(true).withLocatorConnection((locatorPort))); client2 = cluster.startClientVM(6, c -> c.withPoolSubscription(true).withLocatorConnection((locatorPort))); -dataStore1.invoke(this::initDataStore); -dataStore2.invoke(this::initDataStore); -dataStore3.invoke(this::initDataStore); -accessor.invoke(this::initAccessor); -client1.invoke(this::initClientCache); -client2.invoke(this::initClientCache); } protected RegionShortcut getRegionShortCut() { @@ -104,14 +101,18 @@ public class PartitionedRegionClearDUnitTest implements Serializable { region.registerInterestForAllKeys(InterestResultPolicy.KEYS); } - private void initDataStore() { -getCache().createRegionFactory(getRegionShortCut()) -.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()) -.addCacheListener(new CountingCacheListener()) -.create(REGION_NAME); + private void initDataStore(boolean withWriter) { +RegionFactory factory = getCache().createRegionFactory(getRegionShortCut()) +.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()); +if (withWriter) { + factory.setCacheWriter(new CountingCacheWriter()); +} +factory.create(REGION_NAME); +clearsByRegion = new HashMap<>(); +destroysByRegion = new HashMap<>(); } - private void initAccessor() { + private void initAccessor(boolean withWriter) { RegionShortcut shortcut = getRegionShortCut(); if (shortcut.isPersistent()) { if (shortcut == RegionShortcut.PARTITION_PERSISTENT) { @@ -126,12 +127,16 @@ public class PartitionedRegionClearDUnitTest implements Serializable { fail("Wrong region type:" + shortcut); } } -getCache().createRegionFactory(shortcut) +RegionFactory factory = getCache().createRegionFactory(shortcut) .setPartitionAttributes( new PartitionAttributesFactory().setTotalNumBuckets(10).setLocalMaxMemory(0).create()) -.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()) -.addCacheListener(new CountingCacheListener()) -.create(REGION_NAME); +.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()); +if (withWriter) { + factory.setCacheWriter(new CountingCacheWriter()); +} +factory.create(REGION_NAME); +clearsByRegion = new HashMap<>(); +destroysByRegion = new HashMap<>
[geode] branch feature/GEODE-7665 updated (4cd3917 -> af4b35a)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a change to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git. omit 4cd3917 GEODE-8173: Add unit test (coverage) for PartitionedRegionClear class. (#5208) omit cdcdc51 GEODE-7669 Test coverage for Partitioned Region clear with Overflow enabled (#5189) omit 93ff5f4 GEODE-7678 (2nd PR) - Support for cache-listener and client-notification for Partitioned Region Clear operation (#5124) omit 86ef373 GEODE-7667: Fixing test to include PR clear help text. omit edc4162 GEODE-7894: Moving expiry tasks to AbstractRegion. omit 19b9316 GEODE-7676: Conversion of duration to seconds. omit ef0c7ae GEODE-7667: Add a 'clear' gfsh command for PR and RR clear (#4818) omit 8930e7e GEODE-7676: Add PR clear with expiration tests (#4970) omit bdfd611 GEODE-7983: Clear region writer callbacks should not be invoked for bucket regions (#4954) omit be614cc GEODE-7912: cacheWriter should be triggered when PR.clear (#4882) omit 19a6079 PR.clear's event id should be created and used in BR (#4805) omit 41efe40 GEODE-7682: add PR.clear API (#4755) omit d757db8 GEODE-7683: introduce BR.cmnClearRegion add d82e30d GEODE-8243: Use java.exe on Windows in Launcher tests (#5241) add cb5990c GEODE-8221: Refactor tests to run in appropriate projects. (#5244) add 4477013 GEODE-8179: gfsh query cmd returns incorrect results if '=' sign is missing (#5187) add dd6a002 GEODE-8244: enable ignored redis tests (#5245) add e5426f7 change more string commands to have CommandFunction support (#5184) add 0f763ea GEODE-8099: add dlock around cms create/delete operations. (#5188) add 4789e8c GEODE-8242: Add HSTRLEN redis command (#5240) add 9e52198 GEODE-8253: Add additional concurrency tests for redis DEL (#5252) add b1107d2 GEODE-8144: setting SNI server name is not needed if endpoint verification is disabled (#5250) add 70fe060 GEODE-7896 Update tomcat support add bcbc53b Merge pull request #5110 from metatype/develop add a5c8164 GEODE-8260: add toString to RedisData classes (#5255) add d405e4b GEODE-8176: Move test to ClientServerMiscDUnitTest (#5238) add 7609cfa GEODE-8261: Added a null check for the proxyID. (#5251) add 8d5e3d4 GEODE-7864: Overriding hashCode when equals in overridden (#4866) add e159238 GEODE-8268: clean up ExecutionHandlerContext (#5237) add 86778ec GEODE-7591: Fix for hang in ClusterDistributionManager (#5182) add d1e857d GEODE-8270: Reorganize test packages to match main package structure (#5263) add 9fdd3d0 GEODE-8263: change SET command to reject KEEPTTL (#5258) add c93773f GEODE-8274: Improve readability of Version comparison. (#5266) add e955968 GEODE-8264: add serialization tests for RedisData classes (#5260) add 87a2f10 GEODE-8237: Add note about 'alter region' & cluster conf service (#5231) add a6640d7 GEODE-8277: acceptance test certificates expired in Dockerized SNI acceptance tests (#5274) add 9ea7a7c GEODE-8276: fix KEYS command to handle non-ASCII keys (#5272) add 3e7f2df GEODE-8269: Improve test coverage for redis (#5262) add 215643b GEODE-8216: Refactoring the test - moving the location of pausing senders. (#5259) add 720a4ca GEODE-8241: Locator observes locator-wait-time (#5236) add 84ab66b GEODE-8272 Refactor Restore Redundancy Command (#5249) add 18e5817 GEODE-8269: Improve test coverage (#5275) add 4a825a8 GEODE-8251: make sure Configuration can be deserialized post 1.12. (#5257) add 16e2c7b GEODE-8280: Return correct Redis AUTH errors (#5276) add 9939cc0 GEODE-8221: Commits session data prior to sending output to browser (#5246) add 3c52713 Add Mass Test Run pipeline. (#5271) add cd4477a GEODE-8284: Break up StringsIntegration test class (#5277) add 9f1bf04 GEODE-8273: Cleanup GfshExecution and GfshScript (#5267) add 91fd5f5 GEODE-8289: Add gradle task chaining for geode-old-versions:clean (#5283) add ca5d961 GEODE-8275: Improvements to mass-test-run after first pass deployment (#5287) add 210dc4f GEODE-8250: Geode Logging doc changes (#5294) add 5256fde GEODE-8288: Match Native Redis's glob-style pattern (#5282) add d740a70 GEODE-8239 - Add gradle config to add 'Class-Path' and 'Dependent-Modules' attirbutes to manifest file. (#5297) add ba6e44c GEODE-8250: Create new custom log config acceptance tests (#5268) add eed47f4 Fix metric-tools image python requirements. (#5298) add ab83b61 GEODE-8285: Change location of generated test file to build dir and fix error message path for sanctioned text file (#5280) add 5732a1c GEODE-8095 Further rework of the RestoreRedundancy data objects f
[geode] 08/13: GEODE-7676: Conversion of duration to seconds.
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit c78064a23c9897b39056a78ffdcec53bb5b80266 Author: Nabarun Nag AuthorDate: Mon May 11 12:24:16 2020 -0700 GEODE-7676: Conversion of duration to seconds. --- .../internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java index 33301f4..7f3dff9 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java @@ -298,7 +298,7 @@ public class PartitionedRegionClearWithExpirationDUnitTest implements Serializab public void clearShouldRemoveRegisteredExpirationTasks(TestVM coordinatorVM, RegionShortcut regionShortcut) { final int entries = 500; -int expirationTime = (int) GeodeAwaitility.getTimeout().getValueInMS() / 1000; +int expirationTime = (int) GeodeAwaitility.getTimeout().getSeconds(); parametrizedSetup(regionShortcut, new ExpirationAttributes(expirationTime, DESTROY)); populateRegion(accessor, entries, asList(accessor, server1, server2));
[geode] 10/13: GEODE-7667: Fixing test to include PR clear help text.
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 2e8c7a8ccbb8c7d60c69e0a70b3ca9205a529eb8 Author: Nabarun Nag AuthorDate: Mon May 11 16:52:50 2020 -0700 GEODE-7667: Fixing test to include PR clear help text. --- .../internal/cli/GfshParserAutoCompletionIntegrationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionIntegrationTest.java b/geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionIntegrationTest.java index 4c29427..3bc6a03 100644 --- a/geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionIntegrationTest.java +++ b/geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionIntegrationTest.java @@ -381,7 +381,7 @@ public class GfshParserAutoCompletionIntegrationTest { String hintArgument = "data"; String hintsProvided = gfshParserRule.getCommandManager().obtainHint(hintArgument); String[] hintsProvidedArray = hintsProvided.split(lineSeparator()); -assertThat(hintsProvidedArray.length).isEqualTo(17); +assertThat(hintsProvidedArray.length).isEqualTo(18); assertThat(hintsProvidedArray[0]) .isEqualTo("User data as stored in regions of the Geode distributed system."); }
[geode] 06/13: GEODE-7676: Add PR clear with expiration tests (#4970)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 75ae5912f83a9cd12516726532574d70b7774c45 Author: Juan José Ramos AuthorDate: Wed Apr 22 14:18:07 2020 +0100 GEODE-7676: Add PR clear with expiration tests (#4970) Added distributed tests to verify the clear operation on Partitioned Regions works as expected when expiration is configured. - Added unit and distributed tests. - Fixed LocalRegion class to clear the entryExpiryTasks Map whenever the cancelAllEntryExpiryTasks method is invoked. --- ...titionedRegionClearWithExpirationDUnitTest.java | 516 + .../apache/geode/internal/cache/LocalRegion.java | 11 +- .../geode/internal/cache/LocalRegionTest.java | 22 + 3 files changed, 548 insertions(+), 1 deletion(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java new file mode 100644 index 000..33301f4 --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java @@ -0,0 +1,516 @@ +/* + * 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.apache.geode.cache.ExpirationAction.DESTROY; +import static org.apache.geode.cache.RegionShortcut.PARTITION; +import static org.apache.geode.cache.RegionShortcut.PARTITION_OVERFLOW; +import static org.apache.geode.cache.RegionShortcut.PARTITION_PERSISTENT; +import static org.apache.geode.cache.RegionShortcut.PARTITION_PERSISTENT_OVERFLOW; +import static org.apache.geode.cache.RegionShortcut.PARTITION_REDUNDANT; +import static org.apache.geode.cache.RegionShortcut.PARTITION_REDUNDANT_OVERFLOW; +import static org.apache.geode.cache.RegionShortcut.PARTITION_REDUNDANT_PERSISTENT; +import static org.apache.geode.cache.RegionShortcut.PARTITION_REDUNDANT_PERSISTENT_OVERFLOW; +import static org.apache.geode.internal.util.ArrayUtils.asList; +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.IntStream; + +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; +import junitparams.naming.TestCaseName; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.apache.geode.ForcedDisconnectException; +import org.apache.geode.cache.Cache; +import org.apache.geode.cache.CacheWriter; +import org.apache.geode.cache.CacheWriterException; +import org.apache.geode.cache.ExpirationAttributes; +import org.apache.geode.cache.PartitionAttributes; +import org.apache.geode.cache.PartitionAttributesFactory; +import org.apache.geode.cache.Region; +import org.apache.geode.cache.RegionEvent; +import org.apache.geode.cache.RegionShortcut; +import org.apache.geode.cache.partition.PartitionRegionHelper; +import org.apache.geode.cache.util.CacheWriterAdapter; +import org.apache.geode.distributed.DistributedSystemDisconnectedException; +import org.apache.geode.distributed.internal.DMStats; +import org.apache.geode.distributed.internal.InternalDistributedSystem; +import org.apache.geode.distributed.internal.membership.api.MembershipManagerHelper; +import org.apache.geode.test.awaitility.GeodeAwaitility; +import org.apache.geode.test.dunit.VM; +import org.apache.geode.test.dunit.rules.CacheRule; +import org.apache.geode.test.dunit.rules.DistributedDiskDirRule; +import org.apache.geode.test.dunit.rules.DistributedRule; + +/** + * Tests to verify that {@link PartitionedRegion#clear()} cancels all
[geode] 05/13: GEODE-7983: Clear region writer callbacks should not be invoked for bucket regions (#4954)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 32f59fc78357aa5fdd28358c716cc4d7e6f5f1b7 Author: Xiaojian Zhou AuthorDate: Tue Apr 14 10:50:21 2020 -0700 GEODE-7983: Clear region writer callbacks should not be invoked for bucket regions (#4954) --- .../cache/PartitionedRegionClearDUnitTest.java | 44 +- .../internal/cache/partitioned/ClearPRMessage.java | 2 +- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java index a5a22b9..e2e04eb 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java @@ -47,6 +47,7 @@ import org.apache.geode.test.dunit.rules.MemberVM; public class PartitionedRegionClearDUnitTest implements Serializable { protected static final String REGION_NAME = "testPR"; + protected static final int TOTAL_BUCKET_NUM = 10; protected static final int NUM_ENTRIES = 1000; protected int locatorPort; @@ -103,7 +104,8 @@ public class PartitionedRegionClearDUnitTest implements Serializable { private void initDataStore(boolean withWriter) { RegionFactory factory = getCache().createRegionFactory(getRegionShortCut()) -.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()); +.setPartitionAttributes( +new PartitionAttributesFactory().setTotalNumBuckets(TOTAL_BUCKET_NUM).create()); if (withWriter) { factory.setCacheWriter(new CountingCacheWriter()); } @@ -169,6 +171,26 @@ public class PartitionedRegionClearDUnitTest implements Serializable { return destroys; }; + SerializableCallableIF getBucketRegionWriterClears = () -> { +int clears = 0; +for (int i = 0; i < TOTAL_BUCKET_NUM; i++) { + String bucketRegionName = "_B__" + REGION_NAME + "_" + i; + clears += clearsByRegion.get(bucketRegionName) == null ? 0 + : clearsByRegion.get(bucketRegionName).get(); +} +return clears; + }; + + SerializableCallableIF getBucketRegionWriterDestroys = () -> { +int destroys = 0; +for (int i = 0; i < TOTAL_BUCKET_NUM; i++) { + String bucketRegionName = "_B__" + REGION_NAME + "_" + i; + destroys += destroysByRegion.get(bucketRegionName) == null ? 0 + : destroysByRegion.get(bucketRegionName).get(); +} +return destroys; + }; + void configureServers(boolean dataStoreWithWriter, boolean accessorWithWriter) { dataStore1.invoke(() -> initDataStore(dataStoreWithWriter)); dataStore2.invoke(() -> initDataStore(dataStoreWithWriter)); @@ -210,6 +232,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(1); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(0); + +assertThat(dataStore3.invoke(getBucketRegionWriterDestroys)) +.isEqualTo(dataStore3.invoke(getBucketRegionWriterClears)) +.isEqualTo(0); } @Test @@ -237,6 +263,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(0); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(1); + +assertThat(accessor.invoke(getBucketRegionWriterDestroys)) +.isEqualTo(accessor.invoke(getBucketRegionWriterClears)) +.isEqualTo(0); } @Test @@ -264,6 +294,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(0); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(1); + +assertThat(accessor.invoke(getBucketRegionWriterDestroys)) +.isEqualTo(accessor.invoke(getBucketRegionWriterClears)) +.isEqualTo(0); } @Test @@ -291,6 +325,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(1); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(0); + +assertThat(dataStore3.invoke(getBucketRegionWriterDestroys)) +.isEqualTo(dataStore3.invoke(getBucketRegionWriterClears)) +.isEqualTo(0); } @Test @@ -321,6 +359,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(1); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(0); + +assertThat(d
[geode] 12/13: GEODE-7669 Test coverage for Partitioned Region clear with Overflow enabled (#5189)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit b49e67cb9dee328221d7052d4b8c8f70c9210929 Author: Jianxia Chen <11181423+jche...@users.noreply.github.com> AuthorDate: Thu Jun 4 11:39:04 2020 -0700 GEODE-7669 Test coverage for Partitioned Region clear with Overflow enabled (#5189) Authored-by: Jianxia Chen --- .../PartitionedRegionOverflowClearDUnitTest.java | 380 + 1 file changed, 380 insertions(+) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionOverflowClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionOverflowClearDUnitTest.java new file mode 100644 index 000..c10d1db --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionOverflowClearDUnitTest.java @@ -0,0 +1,380 @@ +/* + * 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.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT; +import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER; +import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT; +import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE; +import static org.apache.geode.distributed.ConfigurationProperties.MAX_WAIT_TIME_RECONNECT; +import static org.apache.geode.distributed.ConfigurationProperties.MEMBER_TIMEOUT; +import static org.apache.geode.distributed.ConfigurationProperties.USE_CLUSTER_CONFIGURATION; +import static org.apache.geode.internal.AvailablePortHelper.getRandomAvailableTCPPorts; +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.apache.geode.test.dunit.VM.getVMId; +import static org.apache.geode.test.dunit.VM.toArray; +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.File; +import java.io.Serializable; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.IntStream; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import org.apache.geode.cache.DiskStoreFactory; +import org.apache.geode.cache.EvictionAction; +import org.apache.geode.cache.EvictionAttributes; +import org.apache.geode.cache.PartitionAttributesFactory; +import org.apache.geode.cache.Region; +import org.apache.geode.cache.RegionShortcut; +import org.apache.geode.cache.client.ClientCache; +import org.apache.geode.cache.client.ClientCacheFactory; +import org.apache.geode.cache.client.ClientRegionShortcut; +import org.apache.geode.distributed.LocatorLauncher; +import org.apache.geode.distributed.ServerLauncher; +import org.apache.geode.distributed.internal.InternalLocator; +import org.apache.geode.management.internal.cli.util.CommandStringBuilder; +import org.apache.geode.test.dunit.AsyncInvocation; +import org.apache.geode.test.dunit.VM; +import org.apache.geode.test.dunit.rules.DistributedRule; +import org.apache.geode.test.junit.rules.GfshCommandRule; +import org.apache.geode.test.junit.rules.serializable.SerializableTemporaryFolder; + +public class PartitionedRegionOverflowClearDUnitTest implements Serializable { + + @Rule + public DistributedRule distributedRule = new DistributedRule(5); + + @Rule + public SerializableTemporaryFolder temporaryFolder = new SerializableTemporaryFolder(); + + @Rule + public transient GfshCommandRule gfsh = new GfshCommandRule(); + + private VM locator; + private VM server1; + private VM server2; + private VM accessor; + private VM client; + + private static final String LOCATOR_NAME = "locator"; + private static final String SERVER1_NAME = "
[geode] 11/13: GEODE-7678 (2nd PR) - Support for cache-listener and client-notification for Partitioned Region Clear operation (#5124)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 8eeaac4b53a4a4dd3e91722855de6bcc6da04883 Author: agingade AuthorDate: Wed May 20 16:08:07 2020 -0700 GEODE-7678 (2nd PR) - Support for cache-listener and client-notification for Partitioned Region Clear operation (#5124) * GEODE-7678: Add support for cache listener and client notification for PR clear The changes are made to PR clear messaging and locking mechanism to preserve cache-listener and client-events ordering during concurrent cache operation while clear in progress. --- .../integrationTest/resources/assembly_content.txt | 1 + .../cache/PRCacheListenerDistributedTest.java | 250 +++- .../ReplicateCacheListenerDistributedTest.java | 111 +- ...ionedRegionAfterClearNotificationDUnitTest.java | 372 ++ .../cache/PartitionedRegionClearDUnitTest.java | 1 - ...titionedRegionClearWithExpirationDUnitTest.java | 69 ++-- ...itionedRegionClearWithExpirationDUnitTest.java} | 58 +-- .../cache/PartitionedRegionIntegrationTest.java| 45 +++ .../codeAnalysis/sanctionedDataSerializables.txt | 8 + .../PartitionedRegionPartialClearException.java| 37 ++ .../main/java/org/apache/geode/cache/Region.java | 4 +- .../org/apache/geode/internal/DSFIDFactory.java| 5 + .../apache/geode/internal/cache/BucketAdvisor.java | 2 +- .../apache/geode/internal/cache/BucketRegion.java | 17 +- .../internal/cache/DistributedClearOperation.java | 10 +- .../geode/internal/cache/DistributedRegion.java| 9 +- .../geode/internal/cache/InternalRegion.java | 3 + .../apache/geode/internal/cache/LocalRegion.java | 3 +- .../geode/internal/cache/PartitionedRegion.java| 217 ++- .../internal/cache/PartitionedRegionClear.java | 419 + .../cache/PartitionedRegionClearMessage.java | 287 ++ .../internal/cache/PartitionedRegionDataStore.java | 8 + .../internal/cache/partitioned/RegionAdvisor.java | 11 + .../sanctioned-geode-core-serializables.txt| 2 + .../internal/cache/BucketRegionJUnitTest.java | 4 +- .../internal/cache/PartitionedRegionTest.java | 39 -- .../serialization/DataSerializableFixedID.java | 2 + 27 files changed, 1679 insertions(+), 315 deletions(-) diff --git a/geode-assembly/src/integrationTest/resources/assembly_content.txt b/geode-assembly/src/integrationTest/resources/assembly_content.txt index 7173275..387cd4b 100644 --- a/geode-assembly/src/integrationTest/resources/assembly_content.txt +++ b/geode-assembly/src/integrationTest/resources/assembly_content.txt @@ -221,6 +221,7 @@ javadoc/org/apache/geode/cache/PartitionAttributes.html javadoc/org/apache/geode/cache/PartitionAttributesFactory.html javadoc/org/apache/geode/cache/PartitionResolver.html javadoc/org/apache/geode/cache/PartitionedRegionDistributionException.html +javadoc/org/apache/geode/cache/PartitionedRegionPartialClearException.html javadoc/org/apache/geode/cache/PartitionedRegionStorageException.html javadoc/org/apache/geode/cache/Region.Entry.html javadoc/org/apache/geode/cache/Region.html diff --git a/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java b/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java index 559def7..f4a9ac9 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java @@ -14,14 +14,21 @@ */ package org.apache.geode.cache; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.apache.geode.test.dunit.VM.getVMCount; +import static org.assertj.core.api.Assertions.assertThat; + import java.util.Arrays; +import java.util.Collection; +import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameter; import org.junit.runners.Parameterized.Parameters; import org.junit.runners.Parameterized.UseParametersRunnerFactory; +import org.apache.geode.logging.internal.log4j.api.LogService; import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactory; /** @@ -38,28 +45,60 @@ import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactor @SuppressWarnings("serial") public class PRCacheListenerDistributedTest extends ReplicateCacheListenerDistributedTest { - @Parameters(name = "{index}: redundancy={0}") - public static Iterable data() { -return Arrays.asList(0, 3); + @Parameters + public static Collection data() { +return Arrays.asList(new Object[][] { +{1, Boolean.FALSE}, +{3, Boolean.TRUE}, +});
[geode] 09/13: GEODE-7894: Moving expiry tasks to AbstractRegion.
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 43192d27213b458db38cdbf14f4cec7f484c717b Author: Nabarun Nag AuthorDate: Mon May 11 13:44:56 2020 -0700 GEODE-7894: Moving expiry tasks to AbstractRegion. --- .../src/main/java/org/apache/geode/internal/cache/AbstractRegion.java | 1 + .../src/main/java/org/apache/geode/internal/cache/LocalRegion.java | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java index 0364e17..ca75bf2 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java @@ -113,6 +113,7 @@ public abstract class AbstractRegion implements InternalRegion, AttributesMutato private static final Logger logger = LogService.getLogger(); private final ReentrantReadWriteLock readWriteLockForCacheLoader = new ReentrantReadWriteLock(); private final ReentrantReadWriteLock readWriteLockForCacheWriter = new ReentrantReadWriteLock(); + @VisibleForTesting protected final ConcurrentHashMap entryExpiryTasks = new ConcurrentHashMap<>(); /** diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java index dcf35fa..f43fa24 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java @@ -325,9 +325,6 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory, */ private int txRefCount; - @VisibleForTesting - final ConcurrentHashMap entryExpiryTasks = - new ConcurrentHashMap<>(); private volatile boolean regionInvalid;
[geode] 01/13: GEODE-7683: introduce BR.cmnClearRegion
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 3e8304cfa9df6645cb3082931ad4ff1ddd390dc1 Author: zhouxh AuthorDate: Mon Jan 27 17:02:48 2020 -0800 GEODE-7683: introduce BR.cmnClearRegion Co-authored-by: Xiaojian Zhou GEODE-7684: Create messaging class for PR Clear (#4689) * Added new message class and test Co-authored-by: Benjamin Ross Co-authored-by: Donal Evans --- .../codeAnalysis/sanctionedDataSerializables.txt | 8 + .../apache/geode/internal/cache/BucketRegion.java | 38 +- .../geode/internal/cache/DistributedRegion.java| 23 +- .../internal/cache/partitioned/ClearPRMessage.java | 388 + .../internal/cache/BucketRegionJUnitTest.java | 77 .../internal/cache/DistributedRegionJUnitTest.java | 18 + .../cache/partitioned/ClearPRMessageTest.java | 288 +++ .../serialization/DataSerializableFixedID.java | 3 + 8 files changed, 832 insertions(+), 11 deletions(-) diff --git a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt index 733737e..6dd3a34 100644 --- a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt +++ b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt @@ -1368,6 +1368,14 @@ org/apache/geode/internal/cache/partitioned/BucketSizeMessage$BucketSizeReplyMes fromData,27 toData,27 +org/apache/geode/internal/cache/partitioned/ClearPRMessage,2 +fromData,30 +toData,44 + +org/apache/geode/internal/cache/partitioned/ClearPRMessage$ClearReplyMessage,2 +fromData,17 +toData,17 + org/apache/geode/internal/cache/partitioned/ColocatedRegionDetails,2 fromData,81 toData,133 diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java index d91786f..e4fa7ef 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java @@ -557,6 +557,36 @@ public class BucketRegion extends DistributedRegion implements Bucket { } } + @Override + public void cmnClearRegion(RegionEventImpl regionEvent, boolean cacheWrite, boolean useRVV) { +if (!getBucketAdvisor().isPrimary()) { + if (logger.isDebugEnabled()) { +logger.debug("Not primary bucket when doing clear, do nothing"); + } + return; +} + +boolean enableRVV = useRVV && getConcurrencyChecksEnabled(); +RegionVersionVector rvv = null; +if (enableRVV) { + rvv = getVersionVector().getCloneForTransmission(); +} + +// get rvvLock +Set participants = +getCacheDistributionAdvisor().adviseInvalidateRegion(); +try { + obtainWriteLocksForClear(regionEvent, participants); + // no need to dominate my own rvv. + // Clear is on going here, there won't be GII for this member + clearRegionLocally(regionEvent, cacheWrite, null); + distributeClearOperation(regionEvent, rvv, participants); + + // TODO: call reindexUserDataRegion if there're lucene indexes +} finally { + releaseWriteLocksForClear(regionEvent, participants); +} + } long generateTailKey() { long key = eventSeqNum.addAndGet(partitionedRegion.getTotalNumberOfBuckets()); @@ -2093,11 +2123,9 @@ public class BucketRegion extends DistributedRegion implements Bucket { // if GII has failed, because there is not primary. So it's safe to set these // counters to 0. oldMemValue = bytesInMemory.getAndSet(0); -} - -else { - throw new InternalGemFireError( - "Trying to clear a bucket region that was not destroyed or in initialization."); +} else { + // BucketRegion's clear is supported now + oldMemValue = bytesInMemory.getAndSet(0); } if (oldMemValue != BUCKET_DESTROYED) { partitionedRegion.getPrStats().incDataStoreEntryCount(-sizeBeforeClear); diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java index b822dde..489d85a 100755 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java @@ -2013,6 +2013,10 @@ public class DistributedRegion extends LocalRegion implements InternalDistribute super.basicClear(regionEvent, cacheWrite); } + void distributeClearOperation(RegionEventImpl regionEvent,
[geode] 05/13: GEODE-7983: Clear region writer callbacks should not be invoked for bucket regions (#4954)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 32f59fc78357aa5fdd28358c716cc4d7e6f5f1b7 Author: Xiaojian Zhou AuthorDate: Tue Apr 14 10:50:21 2020 -0700 GEODE-7983: Clear region writer callbacks should not be invoked for bucket regions (#4954) --- .../cache/PartitionedRegionClearDUnitTest.java | 44 +- .../internal/cache/partitioned/ClearPRMessage.java | 2 +- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java index a5a22b9..e2e04eb 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java @@ -47,6 +47,7 @@ import org.apache.geode.test.dunit.rules.MemberVM; public class PartitionedRegionClearDUnitTest implements Serializable { protected static final String REGION_NAME = "testPR"; + protected static final int TOTAL_BUCKET_NUM = 10; protected static final int NUM_ENTRIES = 1000; protected int locatorPort; @@ -103,7 +104,8 @@ public class PartitionedRegionClearDUnitTest implements Serializable { private void initDataStore(boolean withWriter) { RegionFactory factory = getCache().createRegionFactory(getRegionShortCut()) -.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()); +.setPartitionAttributes( +new PartitionAttributesFactory().setTotalNumBuckets(TOTAL_BUCKET_NUM).create()); if (withWriter) { factory.setCacheWriter(new CountingCacheWriter()); } @@ -169,6 +171,26 @@ public class PartitionedRegionClearDUnitTest implements Serializable { return destroys; }; + SerializableCallableIF getBucketRegionWriterClears = () -> { +int clears = 0; +for (int i = 0; i < TOTAL_BUCKET_NUM; i++) { + String bucketRegionName = "_B__" + REGION_NAME + "_" + i; + clears += clearsByRegion.get(bucketRegionName) == null ? 0 + : clearsByRegion.get(bucketRegionName).get(); +} +return clears; + }; + + SerializableCallableIF getBucketRegionWriterDestroys = () -> { +int destroys = 0; +for (int i = 0; i < TOTAL_BUCKET_NUM; i++) { + String bucketRegionName = "_B__" + REGION_NAME + "_" + i; + destroys += destroysByRegion.get(bucketRegionName) == null ? 0 + : destroysByRegion.get(bucketRegionName).get(); +} +return destroys; + }; + void configureServers(boolean dataStoreWithWriter, boolean accessorWithWriter) { dataStore1.invoke(() -> initDataStore(dataStoreWithWriter)); dataStore2.invoke(() -> initDataStore(dataStoreWithWriter)); @@ -210,6 +232,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(1); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(0); + +assertThat(dataStore3.invoke(getBucketRegionWriterDestroys)) +.isEqualTo(dataStore3.invoke(getBucketRegionWriterClears)) +.isEqualTo(0); } @Test @@ -237,6 +263,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(0); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(1); + +assertThat(accessor.invoke(getBucketRegionWriterDestroys)) +.isEqualTo(accessor.invoke(getBucketRegionWriterClears)) +.isEqualTo(0); } @Test @@ -264,6 +294,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(0); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(1); + +assertThat(accessor.invoke(getBucketRegionWriterDestroys)) +.isEqualTo(accessor.invoke(getBucketRegionWriterClears)) +.isEqualTo(0); } @Test @@ -291,6 +325,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(1); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(0); + +assertThat(dataStore3.invoke(getBucketRegionWriterDestroys)) +.isEqualTo(dataStore3.invoke(getBucketRegionWriterClears)) +.isEqualTo(0); } @Test @@ -321,6 +359,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(1); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(0); + +assertThat(d
[geode] 09/13: GEODE-7894: Moving expiry tasks to AbstractRegion.
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 43192d27213b458db38cdbf14f4cec7f484c717b Author: Nabarun Nag AuthorDate: Mon May 11 13:44:56 2020 -0700 GEODE-7894: Moving expiry tasks to AbstractRegion. --- .../src/main/java/org/apache/geode/internal/cache/AbstractRegion.java | 1 + .../src/main/java/org/apache/geode/internal/cache/LocalRegion.java | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java index 0364e17..ca75bf2 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java @@ -113,6 +113,7 @@ public abstract class AbstractRegion implements InternalRegion, AttributesMutato private static final Logger logger = LogService.getLogger(); private final ReentrantReadWriteLock readWriteLockForCacheLoader = new ReentrantReadWriteLock(); private final ReentrantReadWriteLock readWriteLockForCacheWriter = new ReentrantReadWriteLock(); + @VisibleForTesting protected final ConcurrentHashMap entryExpiryTasks = new ConcurrentHashMap<>(); /** diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java index dcf35fa..f43fa24 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java @@ -325,9 +325,6 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory, */ private int txRefCount; - @VisibleForTesting - final ConcurrentHashMap entryExpiryTasks = - new ConcurrentHashMap<>(); private volatile boolean regionInvalid;
[geode] 10/13: GEODE-7667: Fixing test to include PR clear help text.
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 2e8c7a8ccbb8c7d60c69e0a70b3ca9205a529eb8 Author: Nabarun Nag AuthorDate: Mon May 11 16:52:50 2020 -0700 GEODE-7667: Fixing test to include PR clear help text. --- .../internal/cli/GfshParserAutoCompletionIntegrationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionIntegrationTest.java b/geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionIntegrationTest.java index 4c29427..3bc6a03 100644 --- a/geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionIntegrationTest.java +++ b/geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionIntegrationTest.java @@ -381,7 +381,7 @@ public class GfshParserAutoCompletionIntegrationTest { String hintArgument = "data"; String hintsProvided = gfshParserRule.getCommandManager().obtainHint(hintArgument); String[] hintsProvidedArray = hintsProvided.split(lineSeparator()); -assertThat(hintsProvidedArray.length).isEqualTo(17); +assertThat(hintsProvidedArray.length).isEqualTo(18); assertThat(hintsProvidedArray[0]) .isEqualTo("User data as stored in regions of the Geode distributed system."); }
[geode] 07/13: GEODE-7667: Add a 'clear' gfsh command for PR and RR clear (#4818)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 9bf176cc7822f7328fef80e9f0797293d6f4e98e Author: BenjaminPerryRoss <39068135+benjaminperryr...@users.noreply.github.com> AuthorDate: Tue May 5 11:40:34 2020 -0700 GEODE-7667: Add a 'clear' gfsh command for PR and RR clear (#4818) * Added clear command and modified remove functionality to clear PR Authored-by: Benjamin Ross --- .../geode/management/internal/i18n/CliStrings.java | 14 ++- .../cli/commands/ClearCommandDUnitTest.java| 120 + .../cli/commands/RemoveCommandDUnitTest.java | 13 ++- .../{RemoveCommand.java => ClearCommand.java} | 53 - .../cli/commands/CommandAvailabilityIndicator.java | 1 + .../internal/cli/commands/RemoveCommand.java | 9 +- .../internal/cli/domain/DataCommandResult.java | 12 +++ .../cli/functions/DataCommandFunction.java | 23 ++-- .../internal/cli/commands/ClearCommandTest.java| 115 9 files changed, 309 insertions(+), 51 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/i18n/CliStrings.java b/geode-core/src/main/java/org/apache/geode/management/internal/i18n/CliStrings.java index c354d030..6df013e 100644 --- a/geode-core/src/main/java/org/apache/geode/management/internal/i18n/CliStrings.java +++ b/geode-core/src/main/java/org/apache/geode/management/internal/i18n/CliStrings.java @@ -811,6 +811,14 @@ public class CliStrings { public static final String CLEAR_DEFINED_INDEX__SUCCESS__MSG = "Index definitions successfully cleared"; + /* clear region */ + public static final String CLEAR_REGION = "clear region"; + public static final String CLEAR_REGION_HELP = + "Clears/Removes all keys from the specified region."; + public static final String CLEAR_REGION_REGION_NAME = "name"; + public static final String CLEAR_REGION_REGION_NAME_HELP = "Region to clear keys from."; + public static final String CLEAR_REGION_CLEARED_ALL_KEYS = "Cleared all keys in the region"; + /* create region */ public static final String CREATE_REGION = "create region"; public static final String CREATE_REGION__HELP = @@ -1930,9 +1938,9 @@ public class CliStrings { public static final String REMOVE__MSG__KEY_EMPTY = "Key is Null"; public static final String REMOVE__MSG__REGION_NOT_FOUND = "Region <{0}> Not Found"; public static final String REMOVE__MSG__KEY_NOT_FOUND_REGION = "Key is not present in the region"; - public static final String REMOVE__MSG__CLEARED_ALL_CLEARS = "Cleared all keys in the region"; - public static final String REMOVE__MSG__CLEARALL_NOT_SUPPORTED_FOR_PARTITIONREGION = - "Option --" + REMOVE__ALL + " is not supported on partitioned region"; + public static final String REMOVE__MSG__CLEARALL_DEPRECATION_WARNING = + "Warning: The --all option for the 'remove' command is deprecated. Please" + + " use the 'clear' command instead."; /* resume gateway-sender */ public static final String RESUME_GATEWAYSENDER = "resume gateway-sender"; diff --git a/geode-gfsh/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ClearCommandDUnitTest.java b/geode-gfsh/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ClearCommandDUnitTest.java new file mode 100644 index 000..e51fc0f --- /dev/null +++ b/geode-gfsh/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ClearCommandDUnitTest.java @@ -0,0 +1,120 @@ +/* + * 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.management.internal.cli.commands; + +import static org.apache.geode.management.internal.cli.commands.RemoveCommand.REGION_NOT_FOUND; +import static org.apache.geode.management.internal.i18n.CliStrings.CLEAR_REGION_CLEARED_ALL_KEYS; +import static org.asser
[geode] 13/13: GEODE-8173: Add unit test (coverage) for PartitionedRegionClear class. (#5208)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit af4b35ae46fc63b178eb41f908c5f678d75068fa Author: agingade AuthorDate: Mon Jun 8 10:23:50 2020 -0700 GEODE-8173: Add unit test (coverage) for PartitionedRegionClear class. (#5208) * GEODE-8173: Add unit test (coverage) for PartitionedRegionClear class. Co-authored-by: anilkumar gingade --- .../cache/PRCacheListenerDistributedTest.java | 337 +++- .../ReplicateCacheListenerDistributedTest.java | 4 +- .../geode/internal/cache/PartitionedRegion.java| 2 +- .../internal/cache/PartitionedRegionClear.java | 83 ++- .../internal/cache/PartitionedRegionClearTest.java | 611 + 5 files changed, 999 insertions(+), 38 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java b/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java index f4a9ac9..7d95473 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java @@ -17,10 +17,18 @@ package org.apache.geode.cache; import static org.apache.geode.test.dunit.VM.getVM; import static org.apache.geode.test.dunit.VM.getVMCount; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.hamcrest.Matchers.anyOf; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.nullValue; +import java.io.Serializable; import java.util.Arrays; import java.util.Collection; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -28,7 +36,13 @@ import org.junit.runners.Parameterized.Parameter; import org.junit.runners.Parameterized.Parameters; import org.junit.runners.Parameterized.UseParametersRunnerFactory; +import org.apache.geode.cache.util.CacheListenerAdapter; import org.apache.geode.logging.internal.log4j.api.LogService; +import org.apache.geode.test.dunit.rules.CacheRule; +import org.apache.geode.test.dunit.rules.DistributedRule; +import org.apache.geode.test.dunit.rules.SharedCountersRule; +import org.apache.geode.test.dunit.rules.SharedErrorCollector; +import org.apache.geode.test.junit.rules.serializable.SerializableTestName; import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactory; /** @@ -43,7 +57,28 @@ import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactor @RunWith(Parameterized.class) @UseParametersRunnerFactory(CategoryWithParameterizedRunnerFactory.class) @SuppressWarnings("serial") -public class PRCacheListenerDistributedTest extends ReplicateCacheListenerDistributedTest { +public class PRCacheListenerDistributedTest implements Serializable { + + protected static final String CLEAR = "CLEAR"; + protected static final String REGION_DESTROY = "REGION_DESTROY"; + private static final String CREATES = "CREATES"; + private static final String UPDATES = "UPDATES"; + private static final String INVALIDATES = "INVALIDATES"; + private static final String DESTROYS = "DESTROYS"; + private static final int ENTRY_VALUE = 0; + private static final int UPDATED_ENTRY_VALUE = 1; + private static final String KEY = "key-1"; + @Rule + public DistributedRule distributedRule = new DistributedRule(); + @Rule + public CacheRule cacheRule = CacheRule.builder().createCacheInAll().build(); + @Rule + public SerializableTestName testName = new SerializableTestName(); + @Rule + public SharedCountersRule sharedCountersRule = new SharedCountersRule(); + @Rule + public SharedErrorCollector errorCollector = new SharedErrorCollector(); + protected String regionName; @Parameters public static Collection data() { @@ -59,7 +94,6 @@ public class PRCacheListenerDistributedTest extends ReplicateCacheListenerDistri @Parameter(1) public Boolean withData; - @Override protected Region createRegion(final String name, final CacheListener listener) { return createPartitionedRegion(name, listener, false); @@ -99,22 +133,18 @@ public class PRCacheListenerDistributedTest extends ReplicateCacheListenerDistri } } - @Override protected int expectedCreates() { return 1; } - @Override protected int expectedUpdates() { return 1; } - @Override protected int expectedInvalidates() { return 1; } - @Override protected int expectedDestroys() { return 1; } @@ -132,7 +162,8 @@ public class PRCacheListenerDistributedTest extends
[geode] branch feature/GEODE-7665 updated (4cd3917 -> af4b35a)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a change to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git. omit 4cd3917 GEODE-8173: Add unit test (coverage) for PartitionedRegionClear class. (#5208) omit cdcdc51 GEODE-7669 Test coverage for Partitioned Region clear with Overflow enabled (#5189) omit 93ff5f4 GEODE-7678 (2nd PR) - Support for cache-listener and client-notification for Partitioned Region Clear operation (#5124) omit 86ef373 GEODE-7667: Fixing test to include PR clear help text. omit edc4162 GEODE-7894: Moving expiry tasks to AbstractRegion. omit 19b9316 GEODE-7676: Conversion of duration to seconds. omit ef0c7ae GEODE-7667: Add a 'clear' gfsh command for PR and RR clear (#4818) omit 8930e7e GEODE-7676: Add PR clear with expiration tests (#4970) omit bdfd611 GEODE-7983: Clear region writer callbacks should not be invoked for bucket regions (#4954) omit be614cc GEODE-7912: cacheWriter should be triggered when PR.clear (#4882) omit 19a6079 PR.clear's event id should be created and used in BR (#4805) omit 41efe40 GEODE-7682: add PR.clear API (#4755) omit d757db8 GEODE-7683: introduce BR.cmnClearRegion add d82e30d GEODE-8243: Use java.exe on Windows in Launcher tests (#5241) add cb5990c GEODE-8221: Refactor tests to run in appropriate projects. (#5244) add 4477013 GEODE-8179: gfsh query cmd returns incorrect results if '=' sign is missing (#5187) add dd6a002 GEODE-8244: enable ignored redis tests (#5245) add e5426f7 change more string commands to have CommandFunction support (#5184) add 0f763ea GEODE-8099: add dlock around cms create/delete operations. (#5188) add 4789e8c GEODE-8242: Add HSTRLEN redis command (#5240) add 9e52198 GEODE-8253: Add additional concurrency tests for redis DEL (#5252) add b1107d2 GEODE-8144: setting SNI server name is not needed if endpoint verification is disabled (#5250) add 70fe060 GEODE-7896 Update tomcat support add bcbc53b Merge pull request #5110 from metatype/develop add a5c8164 GEODE-8260: add toString to RedisData classes (#5255) add d405e4b GEODE-8176: Move test to ClientServerMiscDUnitTest (#5238) add 7609cfa GEODE-8261: Added a null check for the proxyID. (#5251) add 8d5e3d4 GEODE-7864: Overriding hashCode when equals in overridden (#4866) add e159238 GEODE-8268: clean up ExecutionHandlerContext (#5237) add 86778ec GEODE-7591: Fix for hang in ClusterDistributionManager (#5182) add d1e857d GEODE-8270: Reorganize test packages to match main package structure (#5263) add 9fdd3d0 GEODE-8263: change SET command to reject KEEPTTL (#5258) add c93773f GEODE-8274: Improve readability of Version comparison. (#5266) add e955968 GEODE-8264: add serialization tests for RedisData classes (#5260) add 87a2f10 GEODE-8237: Add note about 'alter region' & cluster conf service (#5231) add a6640d7 GEODE-8277: acceptance test certificates expired in Dockerized SNI acceptance tests (#5274) add 9ea7a7c GEODE-8276: fix KEYS command to handle non-ASCII keys (#5272) add 3e7f2df GEODE-8269: Improve test coverage for redis (#5262) add 215643b GEODE-8216: Refactoring the test - moving the location of pausing senders. (#5259) add 720a4ca GEODE-8241: Locator observes locator-wait-time (#5236) add 84ab66b GEODE-8272 Refactor Restore Redundancy Command (#5249) add 18e5817 GEODE-8269: Improve test coverage (#5275) add 4a825a8 GEODE-8251: make sure Configuration can be deserialized post 1.12. (#5257) add 16e2c7b GEODE-8280: Return correct Redis AUTH errors (#5276) add 9939cc0 GEODE-8221: Commits session data prior to sending output to browser (#5246) add 3c52713 Add Mass Test Run pipeline. (#5271) add cd4477a GEODE-8284: Break up StringsIntegration test class (#5277) add 9f1bf04 GEODE-8273: Cleanup GfshExecution and GfshScript (#5267) add 91fd5f5 GEODE-8289: Add gradle task chaining for geode-old-versions:clean (#5283) add ca5d961 GEODE-8275: Improvements to mass-test-run after first pass deployment (#5287) add 210dc4f GEODE-8250: Geode Logging doc changes (#5294) add 5256fde GEODE-8288: Match Native Redis's glob-style pattern (#5282) add d740a70 GEODE-8239 - Add gradle config to add 'Class-Path' and 'Dependent-Modules' attirbutes to manifest file. (#5297) add ba6e44c GEODE-8250: Create new custom log config acceptance tests (#5268) add eed47f4 Fix metric-tools image python requirements. (#5298) add ab83b61 GEODE-8285: Change location of generated test file to build dir and fix error message path for sanctioned text file (#5280) add 5732a1c GEODE-8095 Further rework of the RestoreRedundancy data objects f
[geode] 06/13: GEODE-7676: Add PR clear with expiration tests (#4970)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 75ae5912f83a9cd12516726532574d70b7774c45 Author: Juan José Ramos AuthorDate: Wed Apr 22 14:18:07 2020 +0100 GEODE-7676: Add PR clear with expiration tests (#4970) Added distributed tests to verify the clear operation on Partitioned Regions works as expected when expiration is configured. - Added unit and distributed tests. - Fixed LocalRegion class to clear the entryExpiryTasks Map whenever the cancelAllEntryExpiryTasks method is invoked. --- ...titionedRegionClearWithExpirationDUnitTest.java | 516 + .../apache/geode/internal/cache/LocalRegion.java | 11 +- .../geode/internal/cache/LocalRegionTest.java | 22 + 3 files changed, 548 insertions(+), 1 deletion(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java new file mode 100644 index 000..33301f4 --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java @@ -0,0 +1,516 @@ +/* + * 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.apache.geode.cache.ExpirationAction.DESTROY; +import static org.apache.geode.cache.RegionShortcut.PARTITION; +import static org.apache.geode.cache.RegionShortcut.PARTITION_OVERFLOW; +import static org.apache.geode.cache.RegionShortcut.PARTITION_PERSISTENT; +import static org.apache.geode.cache.RegionShortcut.PARTITION_PERSISTENT_OVERFLOW; +import static org.apache.geode.cache.RegionShortcut.PARTITION_REDUNDANT; +import static org.apache.geode.cache.RegionShortcut.PARTITION_REDUNDANT_OVERFLOW; +import static org.apache.geode.cache.RegionShortcut.PARTITION_REDUNDANT_PERSISTENT; +import static org.apache.geode.cache.RegionShortcut.PARTITION_REDUNDANT_PERSISTENT_OVERFLOW; +import static org.apache.geode.internal.util.ArrayUtils.asList; +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.IntStream; + +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; +import junitparams.naming.TestCaseName; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.apache.geode.ForcedDisconnectException; +import org.apache.geode.cache.Cache; +import org.apache.geode.cache.CacheWriter; +import org.apache.geode.cache.CacheWriterException; +import org.apache.geode.cache.ExpirationAttributes; +import org.apache.geode.cache.PartitionAttributes; +import org.apache.geode.cache.PartitionAttributesFactory; +import org.apache.geode.cache.Region; +import org.apache.geode.cache.RegionEvent; +import org.apache.geode.cache.RegionShortcut; +import org.apache.geode.cache.partition.PartitionRegionHelper; +import org.apache.geode.cache.util.CacheWriterAdapter; +import org.apache.geode.distributed.DistributedSystemDisconnectedException; +import org.apache.geode.distributed.internal.DMStats; +import org.apache.geode.distributed.internal.InternalDistributedSystem; +import org.apache.geode.distributed.internal.membership.api.MembershipManagerHelper; +import org.apache.geode.test.awaitility.GeodeAwaitility; +import org.apache.geode.test.dunit.VM; +import org.apache.geode.test.dunit.rules.CacheRule; +import org.apache.geode.test.dunit.rules.DistributedDiskDirRule; +import org.apache.geode.test.dunit.rules.DistributedRule; + +/** + * Tests to verify that {@link PartitionedRegion#clear()} cancels all
[geode] 03/13: PR.clear's event id should be created and used in BR (#4805)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 23954beddacb0fd883360739ae48fba6fa2c84f8 Author: Xiaojian Zhou AuthorDate: Mon Mar 16 17:35:35 2020 -0700 PR.clear's event id should be created and used in BR (#4805) * GEODE-7857: PR.clear's event id should be created and used in BR --- .../PartitionedRegionPersistentClearDUnitTest.java | 2 +- .../codeAnalysis/sanctionedDataSerializables.txt | 4 +- .../geode/internal/cache/PartitionedRegion.java| 8 +-- .../internal/cache/partitioned/ClearPRMessage.java | 12 ++-- .../internal/cache/PartitionedRegionTest.java | 65 ++ 5 files changed, 80 insertions(+), 11 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionPersistentClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionPersistentClearDUnitTest.java index 847699b..c758446 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionPersistentClearDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionPersistentClearDUnitTest.java @@ -21,6 +21,6 @@ import org.apache.geode.cache.RegionShortcut; public class PartitionedRegionPersistentClearDUnitTest extends PartitionedRegionClearDUnitTest { protected RegionShortcut getRegionShortCut() { -return RegionShortcut.PARTITION_REDUNDANT_PERSISTENT_OVERFLOW; +return RegionShortcut.PARTITION_REDUNDANT_PERSISTENT; } } diff --git a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt index bdeaf11..6dd3a34 100644 --- a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt +++ b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt @@ -1369,8 +1369,8 @@ fromData,27 toData,27 org/apache/geode/internal/cache/partitioned/ClearPRMessage,2 -fromData,19 -toData,36 +fromData,30 +toData,44 org/apache/geode/internal/cache/partitioned/ClearPRMessage$ClearReplyMessage,2 fromData,17 diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java index 1a1df20..312e951 100755 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java @@ -2189,7 +2189,7 @@ public class PartitionedRegion extends LocalRegion } // create ClearPRMessage per bucket -List clearMsgList = createClearPRMessages(); +List clearMsgList = createClearPRMessages(regionEvent.getEventId()); for (ClearPRMessage clearPRMessage : clearMsgList) { int bucketId = clearPRMessage.getBucketId(); checkReadiness(); @@ -2361,10 +2361,10 @@ public class PartitionedRegion extends LocalRegion } } - List createClearPRMessages() { + List createClearPRMessages(EventID eventID) { ArrayList clearMsgList = new ArrayList<>(); -for (int bucketId = 0; bucketId < this.totalNumberOfBuckets; bucketId++) { - ClearPRMessage clearPRMessage = new ClearPRMessage(bucketId); +for (int bucketId = 0; bucketId < getTotalNumberOfBuckets(); bucketId++) { + ClearPRMessage clearPRMessage = new ClearPRMessage(bucketId, eventID); clearMsgList.add(clearPRMessage); } return clearMsgList; diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ClearPRMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ClearPRMessage.java index 9fa8057..cc01920 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ClearPRMessage.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ClearPRMessage.java @@ -56,6 +56,8 @@ public class ClearPRMessage extends PartitionMessageWithDirectReply { private Integer bucketId; + private EventID eventID; + public static final String BUCKET_NON_PRIMARY_MESSAGE = "The bucket region on target member is no longer primary"; public static final String EXCEPTION_THROWN_DURING_CLEAR_OPERATION = @@ -71,8 +73,9 @@ public class ClearPRMessage extends PartitionMessageWithDirectReply { */ public ClearPRMessage() {} - public ClearPRMessage(int bucketId) { + public ClearPRMessage(int bucketId, EventID eventID) { this.bucketId = bucketId; +this.eventID = eventID; } public void initMessage(PartitionedRegion region, Set recipients, @@ -119,6 +122,7 @@ pub
[geode] 13/13: GEODE-8173: Add unit test (coverage) for PartitionedRegionClear class. (#5208)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit af4b35ae46fc63b178eb41f908c5f678d75068fa Author: agingade AuthorDate: Mon Jun 8 10:23:50 2020 -0700 GEODE-8173: Add unit test (coverage) for PartitionedRegionClear class. (#5208) * GEODE-8173: Add unit test (coverage) for PartitionedRegionClear class. Co-authored-by: anilkumar gingade --- .../cache/PRCacheListenerDistributedTest.java | 337 +++- .../ReplicateCacheListenerDistributedTest.java | 4 +- .../geode/internal/cache/PartitionedRegion.java| 2 +- .../internal/cache/PartitionedRegionClear.java | 83 ++- .../internal/cache/PartitionedRegionClearTest.java | 611 + 5 files changed, 999 insertions(+), 38 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java b/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java index f4a9ac9..7d95473 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java @@ -17,10 +17,18 @@ package org.apache.geode.cache; import static org.apache.geode.test.dunit.VM.getVM; import static org.apache.geode.test.dunit.VM.getVMCount; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.hamcrest.Matchers.anyOf; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.nullValue; +import java.io.Serializable; import java.util.Arrays; import java.util.Collection; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -28,7 +36,13 @@ import org.junit.runners.Parameterized.Parameter; import org.junit.runners.Parameterized.Parameters; import org.junit.runners.Parameterized.UseParametersRunnerFactory; +import org.apache.geode.cache.util.CacheListenerAdapter; import org.apache.geode.logging.internal.log4j.api.LogService; +import org.apache.geode.test.dunit.rules.CacheRule; +import org.apache.geode.test.dunit.rules.DistributedRule; +import org.apache.geode.test.dunit.rules.SharedCountersRule; +import org.apache.geode.test.dunit.rules.SharedErrorCollector; +import org.apache.geode.test.junit.rules.serializable.SerializableTestName; import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactory; /** @@ -43,7 +57,28 @@ import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactor @RunWith(Parameterized.class) @UseParametersRunnerFactory(CategoryWithParameterizedRunnerFactory.class) @SuppressWarnings("serial") -public class PRCacheListenerDistributedTest extends ReplicateCacheListenerDistributedTest { +public class PRCacheListenerDistributedTest implements Serializable { + + protected static final String CLEAR = "CLEAR"; + protected static final String REGION_DESTROY = "REGION_DESTROY"; + private static final String CREATES = "CREATES"; + private static final String UPDATES = "UPDATES"; + private static final String INVALIDATES = "INVALIDATES"; + private static final String DESTROYS = "DESTROYS"; + private static final int ENTRY_VALUE = 0; + private static final int UPDATED_ENTRY_VALUE = 1; + private static final String KEY = "key-1"; + @Rule + public DistributedRule distributedRule = new DistributedRule(); + @Rule + public CacheRule cacheRule = CacheRule.builder().createCacheInAll().build(); + @Rule + public SerializableTestName testName = new SerializableTestName(); + @Rule + public SharedCountersRule sharedCountersRule = new SharedCountersRule(); + @Rule + public SharedErrorCollector errorCollector = new SharedErrorCollector(); + protected String regionName; @Parameters public static Collection data() { @@ -59,7 +94,6 @@ public class PRCacheListenerDistributedTest extends ReplicateCacheListenerDistri @Parameter(1) public Boolean withData; - @Override protected Region createRegion(final String name, final CacheListener listener) { return createPartitionedRegion(name, listener, false); @@ -99,22 +133,18 @@ public class PRCacheListenerDistributedTest extends ReplicateCacheListenerDistri } } - @Override protected int expectedCreates() { return 1; } - @Override protected int expectedUpdates() { return 1; } - @Override protected int expectedInvalidates() { return 1; } - @Override protected int expectedDestroys() { return 1; } @@ -132,7 +162,8 @@ public class PRCacheListenerDistributedTest extends
[geode] 12/13: GEODE-7669 Test coverage for Partitioned Region clear with Overflow enabled (#5189)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit b49e67cb9dee328221d7052d4b8c8f70c9210929 Author: Jianxia Chen <11181423+jche...@users.noreply.github.com> AuthorDate: Thu Jun 4 11:39:04 2020 -0700 GEODE-7669 Test coverage for Partitioned Region clear with Overflow enabled (#5189) Authored-by: Jianxia Chen --- .../PartitionedRegionOverflowClearDUnitTest.java | 380 + 1 file changed, 380 insertions(+) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionOverflowClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionOverflowClearDUnitTest.java new file mode 100644 index 000..c10d1db --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionOverflowClearDUnitTest.java @@ -0,0 +1,380 @@ +/* + * 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.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT; +import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER; +import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT; +import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE; +import static org.apache.geode.distributed.ConfigurationProperties.MAX_WAIT_TIME_RECONNECT; +import static org.apache.geode.distributed.ConfigurationProperties.MEMBER_TIMEOUT; +import static org.apache.geode.distributed.ConfigurationProperties.USE_CLUSTER_CONFIGURATION; +import static org.apache.geode.internal.AvailablePortHelper.getRandomAvailableTCPPorts; +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.apache.geode.test.dunit.VM.getVMId; +import static org.apache.geode.test.dunit.VM.toArray; +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.File; +import java.io.Serializable; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.IntStream; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import org.apache.geode.cache.DiskStoreFactory; +import org.apache.geode.cache.EvictionAction; +import org.apache.geode.cache.EvictionAttributes; +import org.apache.geode.cache.PartitionAttributesFactory; +import org.apache.geode.cache.Region; +import org.apache.geode.cache.RegionShortcut; +import org.apache.geode.cache.client.ClientCache; +import org.apache.geode.cache.client.ClientCacheFactory; +import org.apache.geode.cache.client.ClientRegionShortcut; +import org.apache.geode.distributed.LocatorLauncher; +import org.apache.geode.distributed.ServerLauncher; +import org.apache.geode.distributed.internal.InternalLocator; +import org.apache.geode.management.internal.cli.util.CommandStringBuilder; +import org.apache.geode.test.dunit.AsyncInvocation; +import org.apache.geode.test.dunit.VM; +import org.apache.geode.test.dunit.rules.DistributedRule; +import org.apache.geode.test.junit.rules.GfshCommandRule; +import org.apache.geode.test.junit.rules.serializable.SerializableTemporaryFolder; + +public class PartitionedRegionOverflowClearDUnitTest implements Serializable { + + @Rule + public DistributedRule distributedRule = new DistributedRule(5); + + @Rule + public SerializableTemporaryFolder temporaryFolder = new SerializableTemporaryFolder(); + + @Rule + public transient GfshCommandRule gfsh = new GfshCommandRule(); + + private VM locator; + private VM server1; + private VM server2; + private VM accessor; + private VM client; + + private static final String LOCATOR_NAME = "locator"; + private static final String SERVER1_NAME = "
[geode] 04/13: GEODE-7912: cacheWriter should be triggered when PR.clear (#4882)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 2840a19ce2fc35796a3197f215bee7b62da36c2f Author: Xiaojian Zhou AuthorDate: Mon Mar 30 19:34:35 2020 -0700 GEODE-7912: cacheWriter should be triggered when PR.clear (#4882) Co-authored-by: Anil Co-authored-by: Xiaojian Zhou --- .../cache/PartitionedRegionClearDUnitTest.java | 228 + .../apache/geode/internal/cache/LocalRegion.java | 4 +- .../geode/internal/cache/PartitionedRegion.java| 56 +++-- 3 files changed, 223 insertions(+), 65 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java index fb2a81b..a5a22b9 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java @@ -20,6 +20,7 @@ import static org.apache.geode.test.dunit.rules.ClusterStartupRule.getClientCach import static org.assertj.core.api.Assertions.assertThat; import java.io.Serializable; +import java.util.HashMap; import java.util.Properties; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.IntStream; @@ -30,13 +31,15 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; +import org.apache.geode.cache.CacheWriterException; import org.apache.geode.cache.InterestResultPolicy; import org.apache.geode.cache.PartitionAttributesFactory; import org.apache.geode.cache.Region; import org.apache.geode.cache.RegionEvent; +import org.apache.geode.cache.RegionFactory; import org.apache.geode.cache.RegionShortcut; import org.apache.geode.cache.client.ClientRegionShortcut; -import org.apache.geode.cache.util.CacheListenerAdapter; +import org.apache.geode.cache.util.CacheWriterAdapter; import org.apache.geode.test.dunit.SerializableCallableIF; import org.apache.geode.test.dunit.rules.ClientVM; import org.apache.geode.test.dunit.rules.ClusterStartupRule; @@ -68,12 +71,6 @@ public class PartitionedRegionClearDUnitTest implements Serializable { c -> c.withPoolSubscription(true).withLocatorConnection((locatorPort))); client2 = cluster.startClientVM(6, c -> c.withPoolSubscription(true).withLocatorConnection((locatorPort))); -dataStore1.invoke(this::initDataStore); -dataStore2.invoke(this::initDataStore); -dataStore3.invoke(this::initDataStore); -accessor.invoke(this::initAccessor); -client1.invoke(this::initClientCache); -client2.invoke(this::initClientCache); } protected RegionShortcut getRegionShortCut() { @@ -104,14 +101,18 @@ public class PartitionedRegionClearDUnitTest implements Serializable { region.registerInterestForAllKeys(InterestResultPolicy.KEYS); } - private void initDataStore() { -getCache().createRegionFactory(getRegionShortCut()) -.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()) -.addCacheListener(new CountingCacheListener()) -.create(REGION_NAME); + private void initDataStore(boolean withWriter) { +RegionFactory factory = getCache().createRegionFactory(getRegionShortCut()) +.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()); +if (withWriter) { + factory.setCacheWriter(new CountingCacheWriter()); +} +factory.create(REGION_NAME); +clearsByRegion = new HashMap<>(); +destroysByRegion = new HashMap<>(); } - private void initAccessor() { + private void initAccessor(boolean withWriter) { RegionShortcut shortcut = getRegionShortCut(); if (shortcut.isPersistent()) { if (shortcut == RegionShortcut.PARTITION_PERSISTENT) { @@ -126,12 +127,16 @@ public class PartitionedRegionClearDUnitTest implements Serializable { fail("Wrong region type:" + shortcut); } } -getCache().createRegionFactory(shortcut) +RegionFactory factory = getCache().createRegionFactory(shortcut) .setPartitionAttributes( new PartitionAttributesFactory().setTotalNumBuckets(10).setLocalMaxMemory(0).create()) -.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()) -.addCacheListener(new CountingCacheListener()) -.create(REGION_NAME); +.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()); +if (withWriter) { + factory.setCacheWriter(new CountingCacheWriter()); +} +factory.create(REGION_NAME); +clearsByRegion = new HashMap<>(); +destroysByRegion = new HashMap<>
[geode] 01/13: GEODE-7683: introduce BR.cmnClearRegion
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 3e8304cfa9df6645cb3082931ad4ff1ddd390dc1 Author: zhouxh AuthorDate: Mon Jan 27 17:02:48 2020 -0800 GEODE-7683: introduce BR.cmnClearRegion Co-authored-by: Xiaojian Zhou GEODE-7684: Create messaging class for PR Clear (#4689) * Added new message class and test Co-authored-by: Benjamin Ross Co-authored-by: Donal Evans --- .../codeAnalysis/sanctionedDataSerializables.txt | 8 + .../apache/geode/internal/cache/BucketRegion.java | 38 +- .../geode/internal/cache/DistributedRegion.java| 23 +- .../internal/cache/partitioned/ClearPRMessage.java | 388 + .../internal/cache/BucketRegionJUnitTest.java | 77 .../internal/cache/DistributedRegionJUnitTest.java | 18 + .../cache/partitioned/ClearPRMessageTest.java | 288 +++ .../serialization/DataSerializableFixedID.java | 3 + 8 files changed, 832 insertions(+), 11 deletions(-) diff --git a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt index 733737e..6dd3a34 100644 --- a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt +++ b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt @@ -1368,6 +1368,14 @@ org/apache/geode/internal/cache/partitioned/BucketSizeMessage$BucketSizeReplyMes fromData,27 toData,27 +org/apache/geode/internal/cache/partitioned/ClearPRMessage,2 +fromData,30 +toData,44 + +org/apache/geode/internal/cache/partitioned/ClearPRMessage$ClearReplyMessage,2 +fromData,17 +toData,17 + org/apache/geode/internal/cache/partitioned/ColocatedRegionDetails,2 fromData,81 toData,133 diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java index d91786f..e4fa7ef 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java @@ -557,6 +557,36 @@ public class BucketRegion extends DistributedRegion implements Bucket { } } + @Override + public void cmnClearRegion(RegionEventImpl regionEvent, boolean cacheWrite, boolean useRVV) { +if (!getBucketAdvisor().isPrimary()) { + if (logger.isDebugEnabled()) { +logger.debug("Not primary bucket when doing clear, do nothing"); + } + return; +} + +boolean enableRVV = useRVV && getConcurrencyChecksEnabled(); +RegionVersionVector rvv = null; +if (enableRVV) { + rvv = getVersionVector().getCloneForTransmission(); +} + +// get rvvLock +Set participants = +getCacheDistributionAdvisor().adviseInvalidateRegion(); +try { + obtainWriteLocksForClear(regionEvent, participants); + // no need to dominate my own rvv. + // Clear is on going here, there won't be GII for this member + clearRegionLocally(regionEvent, cacheWrite, null); + distributeClearOperation(regionEvent, rvv, participants); + + // TODO: call reindexUserDataRegion if there're lucene indexes +} finally { + releaseWriteLocksForClear(regionEvent, participants); +} + } long generateTailKey() { long key = eventSeqNum.addAndGet(partitionedRegion.getTotalNumberOfBuckets()); @@ -2093,11 +2123,9 @@ public class BucketRegion extends DistributedRegion implements Bucket { // if GII has failed, because there is not primary. So it's safe to set these // counters to 0. oldMemValue = bytesInMemory.getAndSet(0); -} - -else { - throw new InternalGemFireError( - "Trying to clear a bucket region that was not destroyed or in initialization."); +} else { + // BucketRegion's clear is supported now + oldMemValue = bytesInMemory.getAndSet(0); } if (oldMemValue != BUCKET_DESTROYED) { partitionedRegion.getPrStats().incDataStoreEntryCount(-sizeBeforeClear); diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java index b822dde..489d85a 100755 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java @@ -2013,6 +2013,10 @@ public class DistributedRegion extends LocalRegion implements InternalDistribute super.basicClear(regionEvent, cacheWrite); } + void distributeClearOperation(RegionEventImpl regionEvent,
[geode] 11/13: GEODE-7678 (2nd PR) - Support for cache-listener and client-notification for Partitioned Region Clear operation (#5124)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 8eeaac4b53a4a4dd3e91722855de6bcc6da04883 Author: agingade AuthorDate: Wed May 20 16:08:07 2020 -0700 GEODE-7678 (2nd PR) - Support for cache-listener and client-notification for Partitioned Region Clear operation (#5124) * GEODE-7678: Add support for cache listener and client notification for PR clear The changes are made to PR clear messaging and locking mechanism to preserve cache-listener and client-events ordering during concurrent cache operation while clear in progress. --- .../integrationTest/resources/assembly_content.txt | 1 + .../cache/PRCacheListenerDistributedTest.java | 250 +++- .../ReplicateCacheListenerDistributedTest.java | 111 +- ...ionedRegionAfterClearNotificationDUnitTest.java | 372 ++ .../cache/PartitionedRegionClearDUnitTest.java | 1 - ...titionedRegionClearWithExpirationDUnitTest.java | 69 ++-- ...itionedRegionClearWithExpirationDUnitTest.java} | 58 +-- .../cache/PartitionedRegionIntegrationTest.java| 45 +++ .../codeAnalysis/sanctionedDataSerializables.txt | 8 + .../PartitionedRegionPartialClearException.java| 37 ++ .../main/java/org/apache/geode/cache/Region.java | 4 +- .../org/apache/geode/internal/DSFIDFactory.java| 5 + .../apache/geode/internal/cache/BucketAdvisor.java | 2 +- .../apache/geode/internal/cache/BucketRegion.java | 17 +- .../internal/cache/DistributedClearOperation.java | 10 +- .../geode/internal/cache/DistributedRegion.java| 9 +- .../geode/internal/cache/InternalRegion.java | 3 + .../apache/geode/internal/cache/LocalRegion.java | 3 +- .../geode/internal/cache/PartitionedRegion.java| 217 ++- .../internal/cache/PartitionedRegionClear.java | 419 + .../cache/PartitionedRegionClearMessage.java | 287 ++ .../internal/cache/PartitionedRegionDataStore.java | 8 + .../internal/cache/partitioned/RegionAdvisor.java | 11 + .../sanctioned-geode-core-serializables.txt| 2 + .../internal/cache/BucketRegionJUnitTest.java | 4 +- .../internal/cache/PartitionedRegionTest.java | 39 -- .../serialization/DataSerializableFixedID.java | 2 + 27 files changed, 1679 insertions(+), 315 deletions(-) diff --git a/geode-assembly/src/integrationTest/resources/assembly_content.txt b/geode-assembly/src/integrationTest/resources/assembly_content.txt index 7173275..387cd4b 100644 --- a/geode-assembly/src/integrationTest/resources/assembly_content.txt +++ b/geode-assembly/src/integrationTest/resources/assembly_content.txt @@ -221,6 +221,7 @@ javadoc/org/apache/geode/cache/PartitionAttributes.html javadoc/org/apache/geode/cache/PartitionAttributesFactory.html javadoc/org/apache/geode/cache/PartitionResolver.html javadoc/org/apache/geode/cache/PartitionedRegionDistributionException.html +javadoc/org/apache/geode/cache/PartitionedRegionPartialClearException.html javadoc/org/apache/geode/cache/PartitionedRegionStorageException.html javadoc/org/apache/geode/cache/Region.Entry.html javadoc/org/apache/geode/cache/Region.html diff --git a/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java b/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java index 559def7..f4a9ac9 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java @@ -14,14 +14,21 @@ */ package org.apache.geode.cache; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.apache.geode.test.dunit.VM.getVMCount; +import static org.assertj.core.api.Assertions.assertThat; + import java.util.Arrays; +import java.util.Collection; +import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameter; import org.junit.runners.Parameterized.Parameters; import org.junit.runners.Parameterized.UseParametersRunnerFactory; +import org.apache.geode.logging.internal.log4j.api.LogService; import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactory; /** @@ -38,28 +45,60 @@ import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactor @SuppressWarnings("serial") public class PRCacheListenerDistributedTest extends ReplicateCacheListenerDistributedTest { - @Parameters(name = "{index}: redundancy={0}") - public static Iterable data() { -return Arrays.asList(0, 3); + @Parameters + public static Collection data() { +return Arrays.asList(new Object[][] { +{1, Boolean.FALSE}, +{3, Boolean.TRUE}, +});
[geode] 08/13: GEODE-7676: Conversion of duration to seconds.
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit c78064a23c9897b39056a78ffdcec53bb5b80266 Author: Nabarun Nag AuthorDate: Mon May 11 12:24:16 2020 -0700 GEODE-7676: Conversion of duration to seconds. --- .../internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java index 33301f4..7f3dff9 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java @@ -298,7 +298,7 @@ public class PartitionedRegionClearWithExpirationDUnitTest implements Serializab public void clearShouldRemoveRegisteredExpirationTasks(TestVM coordinatorVM, RegionShortcut regionShortcut) { final int entries = 500; -int expirationTime = (int) GeodeAwaitility.getTimeout().getValueInMS() / 1000; +int expirationTime = (int) GeodeAwaitility.getTimeout().getSeconds(); parametrizedSetup(regionShortcut, new ExpirationAttributes(expirationTime, DESTROY)); populateRegion(accessor, entries, asList(accessor, server1, server2));
[geode] 02/13: GEODE-7682: add PR.clear API (#4755)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 6174f70637eec6ea8a4894d8773a83f7e3443b31 Author: Xiaojian Zhou AuthorDate: Thu Mar 5 23:46:36 2020 -0800 GEODE-7682: add PR.clear API (#4755) * GEODE-7683: introduce BR.cmnClearRegion Co-authored-by: Xiaojian Zhou --- .../cache/PartitionedRegionClearDUnitTest.java | 218 + .../PartitionedRegionPersistentClearDUnitTest.java | 26 +++ ...itionedRegionSingleNodeOperationsJUnitTest.java | 66 --- .../codeAnalysis/sanctionedDataSerializables.txt | 4 +- .../org/apache/geode/internal/DSFIDFactory.java| 3 + .../geode/internal/cache/DistributedRegion.java| 9 - .../apache/geode/internal/cache/LocalRegion.java | 10 + .../geode/internal/cache/PartitionedRegion.java| 214 ++-- .../geode/internal/cache/RegionEventImpl.java | 5 + .../internal/cache/partitioned/ClearPRMessage.java | 166 +--- .../cache/partitioned/ClearPRMessageTest.java | 50 ++--- 11 files changed, 522 insertions(+), 249 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java new file mode 100644 index 000..fb2a81b --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java @@ -0,0 +1,218 @@ +/* + * 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.apache.geode.internal.Assert.fail; +import static org.apache.geode.test.dunit.rules.ClusterStartupRule.getCache; +import static org.apache.geode.test.dunit.rules.ClusterStartupRule.getClientCache; +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.Serializable; +import java.util.Properties; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.IntStream; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import org.apache.geode.cache.InterestResultPolicy; +import org.apache.geode.cache.PartitionAttributesFactory; +import org.apache.geode.cache.Region; +import org.apache.geode.cache.RegionEvent; +import org.apache.geode.cache.RegionShortcut; +import org.apache.geode.cache.client.ClientRegionShortcut; +import org.apache.geode.cache.util.CacheListenerAdapter; +import org.apache.geode.test.dunit.SerializableCallableIF; +import org.apache.geode.test.dunit.rules.ClientVM; +import org.apache.geode.test.dunit.rules.ClusterStartupRule; +import org.apache.geode.test.dunit.rules.MemberVM; + +public class PartitionedRegionClearDUnitTest implements Serializable { + protected static final String REGION_NAME = "testPR"; + protected static final int NUM_ENTRIES = 1000; + + protected int locatorPort; + protected MemberVM locator; + protected MemberVM dataStore1, dataStore2, dataStore3, accessor; + protected ClientVM client1, client2; + + private static final Logger logger = LogManager.getLogger(); + + @Rule + public ClusterStartupRule cluster = new ClusterStartupRule(7); + + @Before + public void setUp() throws Exception { +locator = cluster.startLocatorVM(0); +locatorPort = locator.getPort(); +dataStore1 = cluster.startServerVM(1, getProperties(), locatorPort); +dataStore2 = cluster.startServerVM(2, getProperties(), locatorPort); +dataStore3 = cluster.startServerVM(3, getProperties(), locatorPort); +accessor = cluster.startServerVM(4, getProperties(), locatorPort); +client1 = cluster.startClientVM(5, +c -> c.withPoolSubscription(true).withLocatorConnection((locatorPort))); +client2 = cluster.startClientVM(6, +c -> c.withPoolSubscription(true).withLocatorConnection((locatorPort))); +dataStore1.invoke(this::initDataStore); +dataStore2.invoke(this::initDataStore); +dataStore3.invoke(this::initD
[geode] 09/13: GEODE-7894: Moving expiry tasks to AbstractRegion.
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 43192d27213b458db38cdbf14f4cec7f484c717b Author: Nabarun Nag AuthorDate: Mon May 11 13:44:56 2020 -0700 GEODE-7894: Moving expiry tasks to AbstractRegion. --- .../src/main/java/org/apache/geode/internal/cache/AbstractRegion.java | 1 + .../src/main/java/org/apache/geode/internal/cache/LocalRegion.java | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java index 0364e17..ca75bf2 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java @@ -113,6 +113,7 @@ public abstract class AbstractRegion implements InternalRegion, AttributesMutato private static final Logger logger = LogService.getLogger(); private final ReentrantReadWriteLock readWriteLockForCacheLoader = new ReentrantReadWriteLock(); private final ReentrantReadWriteLock readWriteLockForCacheWriter = new ReentrantReadWriteLock(); + @VisibleForTesting protected final ConcurrentHashMap entryExpiryTasks = new ConcurrentHashMap<>(); /** diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java index dcf35fa..f43fa24 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java @@ -325,9 +325,6 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory, */ private int txRefCount; - @VisibleForTesting - final ConcurrentHashMap entryExpiryTasks = - new ConcurrentHashMap<>(); private volatile boolean regionInvalid;
[geode] 11/13: GEODE-7678 (2nd PR) - Support for cache-listener and client-notification for Partitioned Region Clear operation (#5124)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 8eeaac4b53a4a4dd3e91722855de6bcc6da04883 Author: agingade AuthorDate: Wed May 20 16:08:07 2020 -0700 GEODE-7678 (2nd PR) - Support for cache-listener and client-notification for Partitioned Region Clear operation (#5124) * GEODE-7678: Add support for cache listener and client notification for PR clear The changes are made to PR clear messaging and locking mechanism to preserve cache-listener and client-events ordering during concurrent cache operation while clear in progress. --- .../integrationTest/resources/assembly_content.txt | 1 + .../cache/PRCacheListenerDistributedTest.java | 250 +++- .../ReplicateCacheListenerDistributedTest.java | 111 +- ...ionedRegionAfterClearNotificationDUnitTest.java | 372 ++ .../cache/PartitionedRegionClearDUnitTest.java | 1 - ...titionedRegionClearWithExpirationDUnitTest.java | 69 ++-- ...itionedRegionClearWithExpirationDUnitTest.java} | 58 +-- .../cache/PartitionedRegionIntegrationTest.java| 45 +++ .../codeAnalysis/sanctionedDataSerializables.txt | 8 + .../PartitionedRegionPartialClearException.java| 37 ++ .../main/java/org/apache/geode/cache/Region.java | 4 +- .../org/apache/geode/internal/DSFIDFactory.java| 5 + .../apache/geode/internal/cache/BucketAdvisor.java | 2 +- .../apache/geode/internal/cache/BucketRegion.java | 17 +- .../internal/cache/DistributedClearOperation.java | 10 +- .../geode/internal/cache/DistributedRegion.java| 9 +- .../geode/internal/cache/InternalRegion.java | 3 + .../apache/geode/internal/cache/LocalRegion.java | 3 +- .../geode/internal/cache/PartitionedRegion.java| 217 ++- .../internal/cache/PartitionedRegionClear.java | 419 + .../cache/PartitionedRegionClearMessage.java | 287 ++ .../internal/cache/PartitionedRegionDataStore.java | 8 + .../internal/cache/partitioned/RegionAdvisor.java | 11 + .../sanctioned-geode-core-serializables.txt| 2 + .../internal/cache/BucketRegionJUnitTest.java | 4 +- .../internal/cache/PartitionedRegionTest.java | 39 -- .../serialization/DataSerializableFixedID.java | 2 + 27 files changed, 1679 insertions(+), 315 deletions(-) diff --git a/geode-assembly/src/integrationTest/resources/assembly_content.txt b/geode-assembly/src/integrationTest/resources/assembly_content.txt index 7173275..387cd4b 100644 --- a/geode-assembly/src/integrationTest/resources/assembly_content.txt +++ b/geode-assembly/src/integrationTest/resources/assembly_content.txt @@ -221,6 +221,7 @@ javadoc/org/apache/geode/cache/PartitionAttributes.html javadoc/org/apache/geode/cache/PartitionAttributesFactory.html javadoc/org/apache/geode/cache/PartitionResolver.html javadoc/org/apache/geode/cache/PartitionedRegionDistributionException.html +javadoc/org/apache/geode/cache/PartitionedRegionPartialClearException.html javadoc/org/apache/geode/cache/PartitionedRegionStorageException.html javadoc/org/apache/geode/cache/Region.Entry.html javadoc/org/apache/geode/cache/Region.html diff --git a/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java b/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java index 559def7..f4a9ac9 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java @@ -14,14 +14,21 @@ */ package org.apache.geode.cache; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.apache.geode.test.dunit.VM.getVMCount; +import static org.assertj.core.api.Assertions.assertThat; + import java.util.Arrays; +import java.util.Collection; +import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameter; import org.junit.runners.Parameterized.Parameters; import org.junit.runners.Parameterized.UseParametersRunnerFactory; +import org.apache.geode.logging.internal.log4j.api.LogService; import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactory; /** @@ -38,28 +45,60 @@ import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactor @SuppressWarnings("serial") public class PRCacheListenerDistributedTest extends ReplicateCacheListenerDistributedTest { - @Parameters(name = "{index}: redundancy={0}") - public static Iterable data() { -return Arrays.asList(0, 3); + @Parameters + public static Collection data() { +return Arrays.asList(new Object[][] { +{1, Boolean.FALSE}, +{3, Boolean.TRUE}, +});
[geode] branch feature/GEODE-7665 updated (4cd3917 -> af4b35a)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a change to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git. omit 4cd3917 GEODE-8173: Add unit test (coverage) for PartitionedRegionClear class. (#5208) omit cdcdc51 GEODE-7669 Test coverage for Partitioned Region clear with Overflow enabled (#5189) omit 93ff5f4 GEODE-7678 (2nd PR) - Support for cache-listener and client-notification for Partitioned Region Clear operation (#5124) omit 86ef373 GEODE-7667: Fixing test to include PR clear help text. omit edc4162 GEODE-7894: Moving expiry tasks to AbstractRegion. omit 19b9316 GEODE-7676: Conversion of duration to seconds. omit ef0c7ae GEODE-7667: Add a 'clear' gfsh command for PR and RR clear (#4818) omit 8930e7e GEODE-7676: Add PR clear with expiration tests (#4970) omit bdfd611 GEODE-7983: Clear region writer callbacks should not be invoked for bucket regions (#4954) omit be614cc GEODE-7912: cacheWriter should be triggered when PR.clear (#4882) omit 19a6079 PR.clear's event id should be created and used in BR (#4805) omit 41efe40 GEODE-7682: add PR.clear API (#4755) omit d757db8 GEODE-7683: introduce BR.cmnClearRegion add d82e30d GEODE-8243: Use java.exe on Windows in Launcher tests (#5241) add cb5990c GEODE-8221: Refactor tests to run in appropriate projects. (#5244) add 4477013 GEODE-8179: gfsh query cmd returns incorrect results if '=' sign is missing (#5187) add dd6a002 GEODE-8244: enable ignored redis tests (#5245) add e5426f7 change more string commands to have CommandFunction support (#5184) add 0f763ea GEODE-8099: add dlock around cms create/delete operations. (#5188) add 4789e8c GEODE-8242: Add HSTRLEN redis command (#5240) add 9e52198 GEODE-8253: Add additional concurrency tests for redis DEL (#5252) add b1107d2 GEODE-8144: setting SNI server name is not needed if endpoint verification is disabled (#5250) add 70fe060 GEODE-7896 Update tomcat support add bcbc53b Merge pull request #5110 from metatype/develop add a5c8164 GEODE-8260: add toString to RedisData classes (#5255) add d405e4b GEODE-8176: Move test to ClientServerMiscDUnitTest (#5238) add 7609cfa GEODE-8261: Added a null check for the proxyID. (#5251) add 8d5e3d4 GEODE-7864: Overriding hashCode when equals in overridden (#4866) add e159238 GEODE-8268: clean up ExecutionHandlerContext (#5237) add 86778ec GEODE-7591: Fix for hang in ClusterDistributionManager (#5182) add d1e857d GEODE-8270: Reorganize test packages to match main package structure (#5263) add 9fdd3d0 GEODE-8263: change SET command to reject KEEPTTL (#5258) add c93773f GEODE-8274: Improve readability of Version comparison. (#5266) add e955968 GEODE-8264: add serialization tests for RedisData classes (#5260) add 87a2f10 GEODE-8237: Add note about 'alter region' & cluster conf service (#5231) add a6640d7 GEODE-8277: acceptance test certificates expired in Dockerized SNI acceptance tests (#5274) add 9ea7a7c GEODE-8276: fix KEYS command to handle non-ASCII keys (#5272) add 3e7f2df GEODE-8269: Improve test coverage for redis (#5262) add 215643b GEODE-8216: Refactoring the test - moving the location of pausing senders. (#5259) add 720a4ca GEODE-8241: Locator observes locator-wait-time (#5236) add 84ab66b GEODE-8272 Refactor Restore Redundancy Command (#5249) add 18e5817 GEODE-8269: Improve test coverage (#5275) add 4a825a8 GEODE-8251: make sure Configuration can be deserialized post 1.12. (#5257) add 16e2c7b GEODE-8280: Return correct Redis AUTH errors (#5276) add 9939cc0 GEODE-8221: Commits session data prior to sending output to browser (#5246) add 3c52713 Add Mass Test Run pipeline. (#5271) add cd4477a GEODE-8284: Break up StringsIntegration test class (#5277) add 9f1bf04 GEODE-8273: Cleanup GfshExecution and GfshScript (#5267) add 91fd5f5 GEODE-8289: Add gradle task chaining for geode-old-versions:clean (#5283) add ca5d961 GEODE-8275: Improvements to mass-test-run after first pass deployment (#5287) add 210dc4f GEODE-8250: Geode Logging doc changes (#5294) add 5256fde GEODE-8288: Match Native Redis's glob-style pattern (#5282) add d740a70 GEODE-8239 - Add gradle config to add 'Class-Path' and 'Dependent-Modules' attirbutes to manifest file. (#5297) add ba6e44c GEODE-8250: Create new custom log config acceptance tests (#5268) add eed47f4 Fix metric-tools image python requirements. (#5298) add ab83b61 GEODE-8285: Change location of generated test file to build dir and fix error message path for sanctioned text file (#5280) add 5732a1c GEODE-8095 Further rework of the RestoreRedundancy data objects f
[geode] 08/13: GEODE-7676: Conversion of duration to seconds.
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit c78064a23c9897b39056a78ffdcec53bb5b80266 Author: Nabarun Nag AuthorDate: Mon May 11 12:24:16 2020 -0700 GEODE-7676: Conversion of duration to seconds. --- .../internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java index 33301f4..7f3dff9 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java @@ -298,7 +298,7 @@ public class PartitionedRegionClearWithExpirationDUnitTest implements Serializab public void clearShouldRemoveRegisteredExpirationTasks(TestVM coordinatorVM, RegionShortcut regionShortcut) { final int entries = 500; -int expirationTime = (int) GeodeAwaitility.getTimeout().getValueInMS() / 1000; +int expirationTime = (int) GeodeAwaitility.getTimeout().getSeconds(); parametrizedSetup(regionShortcut, new ExpirationAttributes(expirationTime, DESTROY)); populateRegion(accessor, entries, asList(accessor, server1, server2));
[geode] 04/13: GEODE-7912: cacheWriter should be triggered when PR.clear (#4882)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 2840a19ce2fc35796a3197f215bee7b62da36c2f Author: Xiaojian Zhou AuthorDate: Mon Mar 30 19:34:35 2020 -0700 GEODE-7912: cacheWriter should be triggered when PR.clear (#4882) Co-authored-by: Anil Co-authored-by: Xiaojian Zhou --- .../cache/PartitionedRegionClearDUnitTest.java | 228 + .../apache/geode/internal/cache/LocalRegion.java | 4 +- .../geode/internal/cache/PartitionedRegion.java| 56 +++-- 3 files changed, 223 insertions(+), 65 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java index fb2a81b..a5a22b9 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java @@ -20,6 +20,7 @@ import static org.apache.geode.test.dunit.rules.ClusterStartupRule.getClientCach import static org.assertj.core.api.Assertions.assertThat; import java.io.Serializable; +import java.util.HashMap; import java.util.Properties; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.IntStream; @@ -30,13 +31,15 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; +import org.apache.geode.cache.CacheWriterException; import org.apache.geode.cache.InterestResultPolicy; import org.apache.geode.cache.PartitionAttributesFactory; import org.apache.geode.cache.Region; import org.apache.geode.cache.RegionEvent; +import org.apache.geode.cache.RegionFactory; import org.apache.geode.cache.RegionShortcut; import org.apache.geode.cache.client.ClientRegionShortcut; -import org.apache.geode.cache.util.CacheListenerAdapter; +import org.apache.geode.cache.util.CacheWriterAdapter; import org.apache.geode.test.dunit.SerializableCallableIF; import org.apache.geode.test.dunit.rules.ClientVM; import org.apache.geode.test.dunit.rules.ClusterStartupRule; @@ -68,12 +71,6 @@ public class PartitionedRegionClearDUnitTest implements Serializable { c -> c.withPoolSubscription(true).withLocatorConnection((locatorPort))); client2 = cluster.startClientVM(6, c -> c.withPoolSubscription(true).withLocatorConnection((locatorPort))); -dataStore1.invoke(this::initDataStore); -dataStore2.invoke(this::initDataStore); -dataStore3.invoke(this::initDataStore); -accessor.invoke(this::initAccessor); -client1.invoke(this::initClientCache); -client2.invoke(this::initClientCache); } protected RegionShortcut getRegionShortCut() { @@ -104,14 +101,18 @@ public class PartitionedRegionClearDUnitTest implements Serializable { region.registerInterestForAllKeys(InterestResultPolicy.KEYS); } - private void initDataStore() { -getCache().createRegionFactory(getRegionShortCut()) -.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()) -.addCacheListener(new CountingCacheListener()) -.create(REGION_NAME); + private void initDataStore(boolean withWriter) { +RegionFactory factory = getCache().createRegionFactory(getRegionShortCut()) +.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()); +if (withWriter) { + factory.setCacheWriter(new CountingCacheWriter()); +} +factory.create(REGION_NAME); +clearsByRegion = new HashMap<>(); +destroysByRegion = new HashMap<>(); } - private void initAccessor() { + private void initAccessor(boolean withWriter) { RegionShortcut shortcut = getRegionShortCut(); if (shortcut.isPersistent()) { if (shortcut == RegionShortcut.PARTITION_PERSISTENT) { @@ -126,12 +127,16 @@ public class PartitionedRegionClearDUnitTest implements Serializable { fail("Wrong region type:" + shortcut); } } -getCache().createRegionFactory(shortcut) +RegionFactory factory = getCache().createRegionFactory(shortcut) .setPartitionAttributes( new PartitionAttributesFactory().setTotalNumBuckets(10).setLocalMaxMemory(0).create()) -.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()) -.addCacheListener(new CountingCacheListener()) -.create(REGION_NAME); +.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()); +if (withWriter) { + factory.setCacheWriter(new CountingCacheWriter()); +} +factory.create(REGION_NAME); +clearsByRegion = new HashMap<>(); +destroysByRegion = new HashMap<>
[geode] 06/13: GEODE-7676: Add PR clear with expiration tests (#4970)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 75ae5912f83a9cd12516726532574d70b7774c45 Author: Juan José Ramos AuthorDate: Wed Apr 22 14:18:07 2020 +0100 GEODE-7676: Add PR clear with expiration tests (#4970) Added distributed tests to verify the clear operation on Partitioned Regions works as expected when expiration is configured. - Added unit and distributed tests. - Fixed LocalRegion class to clear the entryExpiryTasks Map whenever the cancelAllEntryExpiryTasks method is invoked. --- ...titionedRegionClearWithExpirationDUnitTest.java | 516 + .../apache/geode/internal/cache/LocalRegion.java | 11 +- .../geode/internal/cache/LocalRegionTest.java | 22 + 3 files changed, 548 insertions(+), 1 deletion(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java new file mode 100644 index 000..33301f4 --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java @@ -0,0 +1,516 @@ +/* + * 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.apache.geode.cache.ExpirationAction.DESTROY; +import static org.apache.geode.cache.RegionShortcut.PARTITION; +import static org.apache.geode.cache.RegionShortcut.PARTITION_OVERFLOW; +import static org.apache.geode.cache.RegionShortcut.PARTITION_PERSISTENT; +import static org.apache.geode.cache.RegionShortcut.PARTITION_PERSISTENT_OVERFLOW; +import static org.apache.geode.cache.RegionShortcut.PARTITION_REDUNDANT; +import static org.apache.geode.cache.RegionShortcut.PARTITION_REDUNDANT_OVERFLOW; +import static org.apache.geode.cache.RegionShortcut.PARTITION_REDUNDANT_PERSISTENT; +import static org.apache.geode.cache.RegionShortcut.PARTITION_REDUNDANT_PERSISTENT_OVERFLOW; +import static org.apache.geode.internal.util.ArrayUtils.asList; +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.IntStream; + +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; +import junitparams.naming.TestCaseName; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.apache.geode.ForcedDisconnectException; +import org.apache.geode.cache.Cache; +import org.apache.geode.cache.CacheWriter; +import org.apache.geode.cache.CacheWriterException; +import org.apache.geode.cache.ExpirationAttributes; +import org.apache.geode.cache.PartitionAttributes; +import org.apache.geode.cache.PartitionAttributesFactory; +import org.apache.geode.cache.Region; +import org.apache.geode.cache.RegionEvent; +import org.apache.geode.cache.RegionShortcut; +import org.apache.geode.cache.partition.PartitionRegionHelper; +import org.apache.geode.cache.util.CacheWriterAdapter; +import org.apache.geode.distributed.DistributedSystemDisconnectedException; +import org.apache.geode.distributed.internal.DMStats; +import org.apache.geode.distributed.internal.InternalDistributedSystem; +import org.apache.geode.distributed.internal.membership.api.MembershipManagerHelper; +import org.apache.geode.test.awaitility.GeodeAwaitility; +import org.apache.geode.test.dunit.VM; +import org.apache.geode.test.dunit.rules.CacheRule; +import org.apache.geode.test.dunit.rules.DistributedDiskDirRule; +import org.apache.geode.test.dunit.rules.DistributedRule; + +/** + * Tests to verify that {@link PartitionedRegion#clear()} cancels all
[geode] 01/13: GEODE-7683: introduce BR.cmnClearRegion
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 3e8304cfa9df6645cb3082931ad4ff1ddd390dc1 Author: zhouxh AuthorDate: Mon Jan 27 17:02:48 2020 -0800 GEODE-7683: introduce BR.cmnClearRegion Co-authored-by: Xiaojian Zhou GEODE-7684: Create messaging class for PR Clear (#4689) * Added new message class and test Co-authored-by: Benjamin Ross Co-authored-by: Donal Evans --- .../codeAnalysis/sanctionedDataSerializables.txt | 8 + .../apache/geode/internal/cache/BucketRegion.java | 38 +- .../geode/internal/cache/DistributedRegion.java| 23 +- .../internal/cache/partitioned/ClearPRMessage.java | 388 + .../internal/cache/BucketRegionJUnitTest.java | 77 .../internal/cache/DistributedRegionJUnitTest.java | 18 + .../cache/partitioned/ClearPRMessageTest.java | 288 +++ .../serialization/DataSerializableFixedID.java | 3 + 8 files changed, 832 insertions(+), 11 deletions(-) diff --git a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt index 733737e..6dd3a34 100644 --- a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt +++ b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt @@ -1368,6 +1368,14 @@ org/apache/geode/internal/cache/partitioned/BucketSizeMessage$BucketSizeReplyMes fromData,27 toData,27 +org/apache/geode/internal/cache/partitioned/ClearPRMessage,2 +fromData,30 +toData,44 + +org/apache/geode/internal/cache/partitioned/ClearPRMessage$ClearReplyMessage,2 +fromData,17 +toData,17 + org/apache/geode/internal/cache/partitioned/ColocatedRegionDetails,2 fromData,81 toData,133 diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java index d91786f..e4fa7ef 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java @@ -557,6 +557,36 @@ public class BucketRegion extends DistributedRegion implements Bucket { } } + @Override + public void cmnClearRegion(RegionEventImpl regionEvent, boolean cacheWrite, boolean useRVV) { +if (!getBucketAdvisor().isPrimary()) { + if (logger.isDebugEnabled()) { +logger.debug("Not primary bucket when doing clear, do nothing"); + } + return; +} + +boolean enableRVV = useRVV && getConcurrencyChecksEnabled(); +RegionVersionVector rvv = null; +if (enableRVV) { + rvv = getVersionVector().getCloneForTransmission(); +} + +// get rvvLock +Set participants = +getCacheDistributionAdvisor().adviseInvalidateRegion(); +try { + obtainWriteLocksForClear(regionEvent, participants); + // no need to dominate my own rvv. + // Clear is on going here, there won't be GII for this member + clearRegionLocally(regionEvent, cacheWrite, null); + distributeClearOperation(regionEvent, rvv, participants); + + // TODO: call reindexUserDataRegion if there're lucene indexes +} finally { + releaseWriteLocksForClear(regionEvent, participants); +} + } long generateTailKey() { long key = eventSeqNum.addAndGet(partitionedRegion.getTotalNumberOfBuckets()); @@ -2093,11 +2123,9 @@ public class BucketRegion extends DistributedRegion implements Bucket { // if GII has failed, because there is not primary. So it's safe to set these // counters to 0. oldMemValue = bytesInMemory.getAndSet(0); -} - -else { - throw new InternalGemFireError( - "Trying to clear a bucket region that was not destroyed or in initialization."); +} else { + // BucketRegion's clear is supported now + oldMemValue = bytesInMemory.getAndSet(0); } if (oldMemValue != BUCKET_DESTROYED) { partitionedRegion.getPrStats().incDataStoreEntryCount(-sizeBeforeClear); diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java index b822dde..489d85a 100755 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java @@ -2013,6 +2013,10 @@ public class DistributedRegion extends LocalRegion implements InternalDistribute super.basicClear(regionEvent, cacheWrite); } + void distributeClearOperation(RegionEventImpl regionEvent,
[geode] 02/13: GEODE-7682: add PR.clear API (#4755)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 6174f70637eec6ea8a4894d8773a83f7e3443b31 Author: Xiaojian Zhou AuthorDate: Thu Mar 5 23:46:36 2020 -0800 GEODE-7682: add PR.clear API (#4755) * GEODE-7683: introduce BR.cmnClearRegion Co-authored-by: Xiaojian Zhou --- .../cache/PartitionedRegionClearDUnitTest.java | 218 + .../PartitionedRegionPersistentClearDUnitTest.java | 26 +++ ...itionedRegionSingleNodeOperationsJUnitTest.java | 66 --- .../codeAnalysis/sanctionedDataSerializables.txt | 4 +- .../org/apache/geode/internal/DSFIDFactory.java| 3 + .../geode/internal/cache/DistributedRegion.java| 9 - .../apache/geode/internal/cache/LocalRegion.java | 10 + .../geode/internal/cache/PartitionedRegion.java| 214 ++-- .../geode/internal/cache/RegionEventImpl.java | 5 + .../internal/cache/partitioned/ClearPRMessage.java | 166 +--- .../cache/partitioned/ClearPRMessageTest.java | 50 ++--- 11 files changed, 522 insertions(+), 249 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java new file mode 100644 index 000..fb2a81b --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java @@ -0,0 +1,218 @@ +/* + * 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.apache.geode.internal.Assert.fail; +import static org.apache.geode.test.dunit.rules.ClusterStartupRule.getCache; +import static org.apache.geode.test.dunit.rules.ClusterStartupRule.getClientCache; +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.Serializable; +import java.util.Properties; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.IntStream; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import org.apache.geode.cache.InterestResultPolicy; +import org.apache.geode.cache.PartitionAttributesFactory; +import org.apache.geode.cache.Region; +import org.apache.geode.cache.RegionEvent; +import org.apache.geode.cache.RegionShortcut; +import org.apache.geode.cache.client.ClientRegionShortcut; +import org.apache.geode.cache.util.CacheListenerAdapter; +import org.apache.geode.test.dunit.SerializableCallableIF; +import org.apache.geode.test.dunit.rules.ClientVM; +import org.apache.geode.test.dunit.rules.ClusterStartupRule; +import org.apache.geode.test.dunit.rules.MemberVM; + +public class PartitionedRegionClearDUnitTest implements Serializable { + protected static final String REGION_NAME = "testPR"; + protected static final int NUM_ENTRIES = 1000; + + protected int locatorPort; + protected MemberVM locator; + protected MemberVM dataStore1, dataStore2, dataStore3, accessor; + protected ClientVM client1, client2; + + private static final Logger logger = LogManager.getLogger(); + + @Rule + public ClusterStartupRule cluster = new ClusterStartupRule(7); + + @Before + public void setUp() throws Exception { +locator = cluster.startLocatorVM(0); +locatorPort = locator.getPort(); +dataStore1 = cluster.startServerVM(1, getProperties(), locatorPort); +dataStore2 = cluster.startServerVM(2, getProperties(), locatorPort); +dataStore3 = cluster.startServerVM(3, getProperties(), locatorPort); +accessor = cluster.startServerVM(4, getProperties(), locatorPort); +client1 = cluster.startClientVM(5, +c -> c.withPoolSubscription(true).withLocatorConnection((locatorPort))); +client2 = cluster.startClientVM(6, +c -> c.withPoolSubscription(true).withLocatorConnection((locatorPort))); +dataStore1.invoke(this::initDataStore); +dataStore2.invoke(this::initDataStore); +dataStore3.invoke(this::initD
[geode] 10/13: GEODE-7667: Fixing test to include PR clear help text.
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 2e8c7a8ccbb8c7d60c69e0a70b3ca9205a529eb8 Author: Nabarun Nag AuthorDate: Mon May 11 16:52:50 2020 -0700 GEODE-7667: Fixing test to include PR clear help text. --- .../internal/cli/GfshParserAutoCompletionIntegrationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionIntegrationTest.java b/geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionIntegrationTest.java index 4c29427..3bc6a03 100644 --- a/geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionIntegrationTest.java +++ b/geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionIntegrationTest.java @@ -381,7 +381,7 @@ public class GfshParserAutoCompletionIntegrationTest { String hintArgument = "data"; String hintsProvided = gfshParserRule.getCommandManager().obtainHint(hintArgument); String[] hintsProvidedArray = hintsProvided.split(lineSeparator()); -assertThat(hintsProvidedArray.length).isEqualTo(17); +assertThat(hintsProvidedArray.length).isEqualTo(18); assertThat(hintsProvidedArray[0]) .isEqualTo("User data as stored in regions of the Geode distributed system."); }
[geode] 07/13: GEODE-7667: Add a 'clear' gfsh command for PR and RR clear (#4818)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 9bf176cc7822f7328fef80e9f0797293d6f4e98e Author: BenjaminPerryRoss <39068135+benjaminperryr...@users.noreply.github.com> AuthorDate: Tue May 5 11:40:34 2020 -0700 GEODE-7667: Add a 'clear' gfsh command for PR and RR clear (#4818) * Added clear command and modified remove functionality to clear PR Authored-by: Benjamin Ross --- .../geode/management/internal/i18n/CliStrings.java | 14 ++- .../cli/commands/ClearCommandDUnitTest.java| 120 + .../cli/commands/RemoveCommandDUnitTest.java | 13 ++- .../{RemoveCommand.java => ClearCommand.java} | 53 - .../cli/commands/CommandAvailabilityIndicator.java | 1 + .../internal/cli/commands/RemoveCommand.java | 9 +- .../internal/cli/domain/DataCommandResult.java | 12 +++ .../cli/functions/DataCommandFunction.java | 23 ++-- .../internal/cli/commands/ClearCommandTest.java| 115 9 files changed, 309 insertions(+), 51 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/i18n/CliStrings.java b/geode-core/src/main/java/org/apache/geode/management/internal/i18n/CliStrings.java index c354d030..6df013e 100644 --- a/geode-core/src/main/java/org/apache/geode/management/internal/i18n/CliStrings.java +++ b/geode-core/src/main/java/org/apache/geode/management/internal/i18n/CliStrings.java @@ -811,6 +811,14 @@ public class CliStrings { public static final String CLEAR_DEFINED_INDEX__SUCCESS__MSG = "Index definitions successfully cleared"; + /* clear region */ + public static final String CLEAR_REGION = "clear region"; + public static final String CLEAR_REGION_HELP = + "Clears/Removes all keys from the specified region."; + public static final String CLEAR_REGION_REGION_NAME = "name"; + public static final String CLEAR_REGION_REGION_NAME_HELP = "Region to clear keys from."; + public static final String CLEAR_REGION_CLEARED_ALL_KEYS = "Cleared all keys in the region"; + /* create region */ public static final String CREATE_REGION = "create region"; public static final String CREATE_REGION__HELP = @@ -1930,9 +1938,9 @@ public class CliStrings { public static final String REMOVE__MSG__KEY_EMPTY = "Key is Null"; public static final String REMOVE__MSG__REGION_NOT_FOUND = "Region <{0}> Not Found"; public static final String REMOVE__MSG__KEY_NOT_FOUND_REGION = "Key is not present in the region"; - public static final String REMOVE__MSG__CLEARED_ALL_CLEARS = "Cleared all keys in the region"; - public static final String REMOVE__MSG__CLEARALL_NOT_SUPPORTED_FOR_PARTITIONREGION = - "Option --" + REMOVE__ALL + " is not supported on partitioned region"; + public static final String REMOVE__MSG__CLEARALL_DEPRECATION_WARNING = + "Warning: The --all option for the 'remove' command is deprecated. Please" + + " use the 'clear' command instead."; /* resume gateway-sender */ public static final String RESUME_GATEWAYSENDER = "resume gateway-sender"; diff --git a/geode-gfsh/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ClearCommandDUnitTest.java b/geode-gfsh/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ClearCommandDUnitTest.java new file mode 100644 index 000..e51fc0f --- /dev/null +++ b/geode-gfsh/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ClearCommandDUnitTest.java @@ -0,0 +1,120 @@ +/* + * 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.management.internal.cli.commands; + +import static org.apache.geode.management.internal.cli.commands.RemoveCommand.REGION_NOT_FOUND; +import static org.apache.geode.management.internal.i18n.CliStrings.CLEAR_REGION_CLEARED_ALL_KEYS; +import static org.asser
[geode] 03/13: PR.clear's event id should be created and used in BR (#4805)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 23954beddacb0fd883360739ae48fba6fa2c84f8 Author: Xiaojian Zhou AuthorDate: Mon Mar 16 17:35:35 2020 -0700 PR.clear's event id should be created and used in BR (#4805) * GEODE-7857: PR.clear's event id should be created and used in BR --- .../PartitionedRegionPersistentClearDUnitTest.java | 2 +- .../codeAnalysis/sanctionedDataSerializables.txt | 4 +- .../geode/internal/cache/PartitionedRegion.java| 8 +-- .../internal/cache/partitioned/ClearPRMessage.java | 12 ++-- .../internal/cache/PartitionedRegionTest.java | 65 ++ 5 files changed, 80 insertions(+), 11 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionPersistentClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionPersistentClearDUnitTest.java index 847699b..c758446 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionPersistentClearDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionPersistentClearDUnitTest.java @@ -21,6 +21,6 @@ import org.apache.geode.cache.RegionShortcut; public class PartitionedRegionPersistentClearDUnitTest extends PartitionedRegionClearDUnitTest { protected RegionShortcut getRegionShortCut() { -return RegionShortcut.PARTITION_REDUNDANT_PERSISTENT_OVERFLOW; +return RegionShortcut.PARTITION_REDUNDANT_PERSISTENT; } } diff --git a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt index bdeaf11..6dd3a34 100644 --- a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt +++ b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt @@ -1369,8 +1369,8 @@ fromData,27 toData,27 org/apache/geode/internal/cache/partitioned/ClearPRMessage,2 -fromData,19 -toData,36 +fromData,30 +toData,44 org/apache/geode/internal/cache/partitioned/ClearPRMessage$ClearReplyMessage,2 fromData,17 diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java index 1a1df20..312e951 100755 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java @@ -2189,7 +2189,7 @@ public class PartitionedRegion extends LocalRegion } // create ClearPRMessage per bucket -List clearMsgList = createClearPRMessages(); +List clearMsgList = createClearPRMessages(regionEvent.getEventId()); for (ClearPRMessage clearPRMessage : clearMsgList) { int bucketId = clearPRMessage.getBucketId(); checkReadiness(); @@ -2361,10 +2361,10 @@ public class PartitionedRegion extends LocalRegion } } - List createClearPRMessages() { + List createClearPRMessages(EventID eventID) { ArrayList clearMsgList = new ArrayList<>(); -for (int bucketId = 0; bucketId < this.totalNumberOfBuckets; bucketId++) { - ClearPRMessage clearPRMessage = new ClearPRMessage(bucketId); +for (int bucketId = 0; bucketId < getTotalNumberOfBuckets(); bucketId++) { + ClearPRMessage clearPRMessage = new ClearPRMessage(bucketId, eventID); clearMsgList.add(clearPRMessage); } return clearMsgList; diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ClearPRMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ClearPRMessage.java index 9fa8057..cc01920 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ClearPRMessage.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ClearPRMessage.java @@ -56,6 +56,8 @@ public class ClearPRMessage extends PartitionMessageWithDirectReply { private Integer bucketId; + private EventID eventID; + public static final String BUCKET_NON_PRIMARY_MESSAGE = "The bucket region on target member is no longer primary"; public static final String EXCEPTION_THROWN_DURING_CLEAR_OPERATION = @@ -71,8 +73,9 @@ public class ClearPRMessage extends PartitionMessageWithDirectReply { */ public ClearPRMessage() {} - public ClearPRMessage(int bucketId) { + public ClearPRMessage(int bucketId, EventID eventID) { this.bucketId = bucketId; +this.eventID = eventID; } public void initMessage(PartitionedRegion region, Set recipients, @@ -119,6 +122,7 @@ pub
[geode] 12/13: GEODE-7669 Test coverage for Partitioned Region clear with Overflow enabled (#5189)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit b49e67cb9dee328221d7052d4b8c8f70c9210929 Author: Jianxia Chen <11181423+jche...@users.noreply.github.com> AuthorDate: Thu Jun 4 11:39:04 2020 -0700 GEODE-7669 Test coverage for Partitioned Region clear with Overflow enabled (#5189) Authored-by: Jianxia Chen --- .../PartitionedRegionOverflowClearDUnitTest.java | 380 + 1 file changed, 380 insertions(+) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionOverflowClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionOverflowClearDUnitTest.java new file mode 100644 index 000..c10d1db --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionOverflowClearDUnitTest.java @@ -0,0 +1,380 @@ +/* + * 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.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT; +import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER; +import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT; +import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE; +import static org.apache.geode.distributed.ConfigurationProperties.MAX_WAIT_TIME_RECONNECT; +import static org.apache.geode.distributed.ConfigurationProperties.MEMBER_TIMEOUT; +import static org.apache.geode.distributed.ConfigurationProperties.USE_CLUSTER_CONFIGURATION; +import static org.apache.geode.internal.AvailablePortHelper.getRandomAvailableTCPPorts; +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.apache.geode.test.dunit.VM.getVMId; +import static org.apache.geode.test.dunit.VM.toArray; +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.File; +import java.io.Serializable; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.IntStream; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import org.apache.geode.cache.DiskStoreFactory; +import org.apache.geode.cache.EvictionAction; +import org.apache.geode.cache.EvictionAttributes; +import org.apache.geode.cache.PartitionAttributesFactory; +import org.apache.geode.cache.Region; +import org.apache.geode.cache.RegionShortcut; +import org.apache.geode.cache.client.ClientCache; +import org.apache.geode.cache.client.ClientCacheFactory; +import org.apache.geode.cache.client.ClientRegionShortcut; +import org.apache.geode.distributed.LocatorLauncher; +import org.apache.geode.distributed.ServerLauncher; +import org.apache.geode.distributed.internal.InternalLocator; +import org.apache.geode.management.internal.cli.util.CommandStringBuilder; +import org.apache.geode.test.dunit.AsyncInvocation; +import org.apache.geode.test.dunit.VM; +import org.apache.geode.test.dunit.rules.DistributedRule; +import org.apache.geode.test.junit.rules.GfshCommandRule; +import org.apache.geode.test.junit.rules.serializable.SerializableTemporaryFolder; + +public class PartitionedRegionOverflowClearDUnitTest implements Serializable { + + @Rule + public DistributedRule distributedRule = new DistributedRule(5); + + @Rule + public SerializableTemporaryFolder temporaryFolder = new SerializableTemporaryFolder(); + + @Rule + public transient GfshCommandRule gfsh = new GfshCommandRule(); + + private VM locator; + private VM server1; + private VM server2; + private VM accessor; + private VM client; + + private static final String LOCATOR_NAME = "locator"; + private static final String SERVER1_NAME = "
[geode] 13/13: GEODE-8173: Add unit test (coverage) for PartitionedRegionClear class. (#5208)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit af4b35ae46fc63b178eb41f908c5f678d75068fa Author: agingade AuthorDate: Mon Jun 8 10:23:50 2020 -0700 GEODE-8173: Add unit test (coverage) for PartitionedRegionClear class. (#5208) * GEODE-8173: Add unit test (coverage) for PartitionedRegionClear class. Co-authored-by: anilkumar gingade --- .../cache/PRCacheListenerDistributedTest.java | 337 +++- .../ReplicateCacheListenerDistributedTest.java | 4 +- .../geode/internal/cache/PartitionedRegion.java| 2 +- .../internal/cache/PartitionedRegionClear.java | 83 ++- .../internal/cache/PartitionedRegionClearTest.java | 611 + 5 files changed, 999 insertions(+), 38 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java b/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java index f4a9ac9..7d95473 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java @@ -17,10 +17,18 @@ package org.apache.geode.cache; import static org.apache.geode.test.dunit.VM.getVM; import static org.apache.geode.test.dunit.VM.getVMCount; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.hamcrest.Matchers.anyOf; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.nullValue; +import java.io.Serializable; import java.util.Arrays; import java.util.Collection; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -28,7 +36,13 @@ import org.junit.runners.Parameterized.Parameter; import org.junit.runners.Parameterized.Parameters; import org.junit.runners.Parameterized.UseParametersRunnerFactory; +import org.apache.geode.cache.util.CacheListenerAdapter; import org.apache.geode.logging.internal.log4j.api.LogService; +import org.apache.geode.test.dunit.rules.CacheRule; +import org.apache.geode.test.dunit.rules.DistributedRule; +import org.apache.geode.test.dunit.rules.SharedCountersRule; +import org.apache.geode.test.dunit.rules.SharedErrorCollector; +import org.apache.geode.test.junit.rules.serializable.SerializableTestName; import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactory; /** @@ -43,7 +57,28 @@ import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactor @RunWith(Parameterized.class) @UseParametersRunnerFactory(CategoryWithParameterizedRunnerFactory.class) @SuppressWarnings("serial") -public class PRCacheListenerDistributedTest extends ReplicateCacheListenerDistributedTest { +public class PRCacheListenerDistributedTest implements Serializable { + + protected static final String CLEAR = "CLEAR"; + protected static final String REGION_DESTROY = "REGION_DESTROY"; + private static final String CREATES = "CREATES"; + private static final String UPDATES = "UPDATES"; + private static final String INVALIDATES = "INVALIDATES"; + private static final String DESTROYS = "DESTROYS"; + private static final int ENTRY_VALUE = 0; + private static final int UPDATED_ENTRY_VALUE = 1; + private static final String KEY = "key-1"; + @Rule + public DistributedRule distributedRule = new DistributedRule(); + @Rule + public CacheRule cacheRule = CacheRule.builder().createCacheInAll().build(); + @Rule + public SerializableTestName testName = new SerializableTestName(); + @Rule + public SharedCountersRule sharedCountersRule = new SharedCountersRule(); + @Rule + public SharedErrorCollector errorCollector = new SharedErrorCollector(); + protected String regionName; @Parameters public static Collection data() { @@ -59,7 +94,6 @@ public class PRCacheListenerDistributedTest extends ReplicateCacheListenerDistri @Parameter(1) public Boolean withData; - @Override protected Region createRegion(final String name, final CacheListener listener) { return createPartitionedRegion(name, listener, false); @@ -99,22 +133,18 @@ public class PRCacheListenerDistributedTest extends ReplicateCacheListenerDistri } } - @Override protected int expectedCreates() { return 1; } - @Override protected int expectedUpdates() { return 1; } - @Override protected int expectedInvalidates() { return 1; } - @Override protected int expectedDestroys() { return 1; } @@ -132,7 +162,8 @@ public class PRCacheListenerDistributedTest extends
[geode] 05/13: GEODE-7983: Clear region writer callbacks should not be invoked for bucket regions (#4954)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 32f59fc78357aa5fdd28358c716cc4d7e6f5f1b7 Author: Xiaojian Zhou AuthorDate: Tue Apr 14 10:50:21 2020 -0700 GEODE-7983: Clear region writer callbacks should not be invoked for bucket regions (#4954) --- .../cache/PartitionedRegionClearDUnitTest.java | 44 +- .../internal/cache/partitioned/ClearPRMessage.java | 2 +- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java index a5a22b9..e2e04eb 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java @@ -47,6 +47,7 @@ import org.apache.geode.test.dunit.rules.MemberVM; public class PartitionedRegionClearDUnitTest implements Serializable { protected static final String REGION_NAME = "testPR"; + protected static final int TOTAL_BUCKET_NUM = 10; protected static final int NUM_ENTRIES = 1000; protected int locatorPort; @@ -103,7 +104,8 @@ public class PartitionedRegionClearDUnitTest implements Serializable { private void initDataStore(boolean withWriter) { RegionFactory factory = getCache().createRegionFactory(getRegionShortCut()) -.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()); +.setPartitionAttributes( +new PartitionAttributesFactory().setTotalNumBuckets(TOTAL_BUCKET_NUM).create()); if (withWriter) { factory.setCacheWriter(new CountingCacheWriter()); } @@ -169,6 +171,26 @@ public class PartitionedRegionClearDUnitTest implements Serializable { return destroys; }; + SerializableCallableIF getBucketRegionWriterClears = () -> { +int clears = 0; +for (int i = 0; i < TOTAL_BUCKET_NUM; i++) { + String bucketRegionName = "_B__" + REGION_NAME + "_" + i; + clears += clearsByRegion.get(bucketRegionName) == null ? 0 + : clearsByRegion.get(bucketRegionName).get(); +} +return clears; + }; + + SerializableCallableIF getBucketRegionWriterDestroys = () -> { +int destroys = 0; +for (int i = 0; i < TOTAL_BUCKET_NUM; i++) { + String bucketRegionName = "_B__" + REGION_NAME + "_" + i; + destroys += destroysByRegion.get(bucketRegionName) == null ? 0 + : destroysByRegion.get(bucketRegionName).get(); +} +return destroys; + }; + void configureServers(boolean dataStoreWithWriter, boolean accessorWithWriter) { dataStore1.invoke(() -> initDataStore(dataStoreWithWriter)); dataStore2.invoke(() -> initDataStore(dataStoreWithWriter)); @@ -210,6 +232,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(1); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(0); + +assertThat(dataStore3.invoke(getBucketRegionWriterDestroys)) +.isEqualTo(dataStore3.invoke(getBucketRegionWriterClears)) +.isEqualTo(0); } @Test @@ -237,6 +263,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(0); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(1); + +assertThat(accessor.invoke(getBucketRegionWriterDestroys)) +.isEqualTo(accessor.invoke(getBucketRegionWriterClears)) +.isEqualTo(0); } @Test @@ -264,6 +294,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(0); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(1); + +assertThat(accessor.invoke(getBucketRegionWriterDestroys)) +.isEqualTo(accessor.invoke(getBucketRegionWriterClears)) +.isEqualTo(0); } @Test @@ -291,6 +325,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(1); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(0); + +assertThat(dataStore3.invoke(getBucketRegionWriterDestroys)) +.isEqualTo(dataStore3.invoke(getBucketRegionWriterClears)) +.isEqualTo(0); } @Test @@ -321,6 +359,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(1); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(0); + +assertThat(d
[geode] 04/13: GEODE-7912: cacheWriter should be triggered when PR.clear (#4882)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 2840a19ce2fc35796a3197f215bee7b62da36c2f Author: Xiaojian Zhou AuthorDate: Mon Mar 30 19:34:35 2020 -0700 GEODE-7912: cacheWriter should be triggered when PR.clear (#4882) Co-authored-by: Anil Co-authored-by: Xiaojian Zhou --- .../cache/PartitionedRegionClearDUnitTest.java | 228 + .../apache/geode/internal/cache/LocalRegion.java | 4 +- .../geode/internal/cache/PartitionedRegion.java| 56 +++-- 3 files changed, 223 insertions(+), 65 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java index fb2a81b..a5a22b9 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java @@ -20,6 +20,7 @@ import static org.apache.geode.test.dunit.rules.ClusterStartupRule.getClientCach import static org.assertj.core.api.Assertions.assertThat; import java.io.Serializable; +import java.util.HashMap; import java.util.Properties; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.IntStream; @@ -30,13 +31,15 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; +import org.apache.geode.cache.CacheWriterException; import org.apache.geode.cache.InterestResultPolicy; import org.apache.geode.cache.PartitionAttributesFactory; import org.apache.geode.cache.Region; import org.apache.geode.cache.RegionEvent; +import org.apache.geode.cache.RegionFactory; import org.apache.geode.cache.RegionShortcut; import org.apache.geode.cache.client.ClientRegionShortcut; -import org.apache.geode.cache.util.CacheListenerAdapter; +import org.apache.geode.cache.util.CacheWriterAdapter; import org.apache.geode.test.dunit.SerializableCallableIF; import org.apache.geode.test.dunit.rules.ClientVM; import org.apache.geode.test.dunit.rules.ClusterStartupRule; @@ -68,12 +71,6 @@ public class PartitionedRegionClearDUnitTest implements Serializable { c -> c.withPoolSubscription(true).withLocatorConnection((locatorPort))); client2 = cluster.startClientVM(6, c -> c.withPoolSubscription(true).withLocatorConnection((locatorPort))); -dataStore1.invoke(this::initDataStore); -dataStore2.invoke(this::initDataStore); -dataStore3.invoke(this::initDataStore); -accessor.invoke(this::initAccessor); -client1.invoke(this::initClientCache); -client2.invoke(this::initClientCache); } protected RegionShortcut getRegionShortCut() { @@ -104,14 +101,18 @@ public class PartitionedRegionClearDUnitTest implements Serializable { region.registerInterestForAllKeys(InterestResultPolicy.KEYS); } - private void initDataStore() { -getCache().createRegionFactory(getRegionShortCut()) -.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()) -.addCacheListener(new CountingCacheListener()) -.create(REGION_NAME); + private void initDataStore(boolean withWriter) { +RegionFactory factory = getCache().createRegionFactory(getRegionShortCut()) +.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()); +if (withWriter) { + factory.setCacheWriter(new CountingCacheWriter()); +} +factory.create(REGION_NAME); +clearsByRegion = new HashMap<>(); +destroysByRegion = new HashMap<>(); } - private void initAccessor() { + private void initAccessor(boolean withWriter) { RegionShortcut shortcut = getRegionShortCut(); if (shortcut.isPersistent()) { if (shortcut == RegionShortcut.PARTITION_PERSISTENT) { @@ -126,12 +127,16 @@ public class PartitionedRegionClearDUnitTest implements Serializable { fail("Wrong region type:" + shortcut); } } -getCache().createRegionFactory(shortcut) +RegionFactory factory = getCache().createRegionFactory(shortcut) .setPartitionAttributes( new PartitionAttributesFactory().setTotalNumBuckets(10).setLocalMaxMemory(0).create()) -.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()) -.addCacheListener(new CountingCacheListener()) -.create(REGION_NAME); +.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()); +if (withWriter) { + factory.setCacheWriter(new CountingCacheWriter()); +} +factory.create(REGION_NAME); +clearsByRegion = new HashMap<>(); +destroysByRegion = new HashMap<>
[geode] 09/13: GEODE-7894: Moving expiry tasks to AbstractRegion.
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 43192d27213b458db38cdbf14f4cec7f484c717b Author: Nabarun Nag AuthorDate: Mon May 11 13:44:56 2020 -0700 GEODE-7894: Moving expiry tasks to AbstractRegion. --- .../src/main/java/org/apache/geode/internal/cache/AbstractRegion.java | 1 + .../src/main/java/org/apache/geode/internal/cache/LocalRegion.java | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java index 0364e17..ca75bf2 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java @@ -113,6 +113,7 @@ public abstract class AbstractRegion implements InternalRegion, AttributesMutato private static final Logger logger = LogService.getLogger(); private final ReentrantReadWriteLock readWriteLockForCacheLoader = new ReentrantReadWriteLock(); private final ReentrantReadWriteLock readWriteLockForCacheWriter = new ReentrantReadWriteLock(); + @VisibleForTesting protected final ConcurrentHashMap entryExpiryTasks = new ConcurrentHashMap<>(); /** diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java index dcf35fa..f43fa24 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java @@ -325,9 +325,6 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory, */ private int txRefCount; - @VisibleForTesting - final ConcurrentHashMap entryExpiryTasks = - new ConcurrentHashMap<>(); private volatile boolean regionInvalid;
[geode] 11/13: GEODE-7678 (2nd PR) - Support for cache-listener and client-notification for Partitioned Region Clear operation (#5124)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 8eeaac4b53a4a4dd3e91722855de6bcc6da04883 Author: agingade AuthorDate: Wed May 20 16:08:07 2020 -0700 GEODE-7678 (2nd PR) - Support for cache-listener and client-notification for Partitioned Region Clear operation (#5124) * GEODE-7678: Add support for cache listener and client notification for PR clear The changes are made to PR clear messaging and locking mechanism to preserve cache-listener and client-events ordering during concurrent cache operation while clear in progress. --- .../integrationTest/resources/assembly_content.txt | 1 + .../cache/PRCacheListenerDistributedTest.java | 250 +++- .../ReplicateCacheListenerDistributedTest.java | 111 +- ...ionedRegionAfterClearNotificationDUnitTest.java | 372 ++ .../cache/PartitionedRegionClearDUnitTest.java | 1 - ...titionedRegionClearWithExpirationDUnitTest.java | 69 ++-- ...itionedRegionClearWithExpirationDUnitTest.java} | 58 +-- .../cache/PartitionedRegionIntegrationTest.java| 45 +++ .../codeAnalysis/sanctionedDataSerializables.txt | 8 + .../PartitionedRegionPartialClearException.java| 37 ++ .../main/java/org/apache/geode/cache/Region.java | 4 +- .../org/apache/geode/internal/DSFIDFactory.java| 5 + .../apache/geode/internal/cache/BucketAdvisor.java | 2 +- .../apache/geode/internal/cache/BucketRegion.java | 17 +- .../internal/cache/DistributedClearOperation.java | 10 +- .../geode/internal/cache/DistributedRegion.java| 9 +- .../geode/internal/cache/InternalRegion.java | 3 + .../apache/geode/internal/cache/LocalRegion.java | 3 +- .../geode/internal/cache/PartitionedRegion.java| 217 ++- .../internal/cache/PartitionedRegionClear.java | 419 + .../cache/PartitionedRegionClearMessage.java | 287 ++ .../internal/cache/PartitionedRegionDataStore.java | 8 + .../internal/cache/partitioned/RegionAdvisor.java | 11 + .../sanctioned-geode-core-serializables.txt| 2 + .../internal/cache/BucketRegionJUnitTest.java | 4 +- .../internal/cache/PartitionedRegionTest.java | 39 -- .../serialization/DataSerializableFixedID.java | 2 + 27 files changed, 1679 insertions(+), 315 deletions(-) diff --git a/geode-assembly/src/integrationTest/resources/assembly_content.txt b/geode-assembly/src/integrationTest/resources/assembly_content.txt index 7173275..387cd4b 100644 --- a/geode-assembly/src/integrationTest/resources/assembly_content.txt +++ b/geode-assembly/src/integrationTest/resources/assembly_content.txt @@ -221,6 +221,7 @@ javadoc/org/apache/geode/cache/PartitionAttributes.html javadoc/org/apache/geode/cache/PartitionAttributesFactory.html javadoc/org/apache/geode/cache/PartitionResolver.html javadoc/org/apache/geode/cache/PartitionedRegionDistributionException.html +javadoc/org/apache/geode/cache/PartitionedRegionPartialClearException.html javadoc/org/apache/geode/cache/PartitionedRegionStorageException.html javadoc/org/apache/geode/cache/Region.Entry.html javadoc/org/apache/geode/cache/Region.html diff --git a/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java b/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java index 559def7..f4a9ac9 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java @@ -14,14 +14,21 @@ */ package org.apache.geode.cache; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.apache.geode.test.dunit.VM.getVMCount; +import static org.assertj.core.api.Assertions.assertThat; + import java.util.Arrays; +import java.util.Collection; +import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameter; import org.junit.runners.Parameterized.Parameters; import org.junit.runners.Parameterized.UseParametersRunnerFactory; +import org.apache.geode.logging.internal.log4j.api.LogService; import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactory; /** @@ -38,28 +45,60 @@ import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactor @SuppressWarnings("serial") public class PRCacheListenerDistributedTest extends ReplicateCacheListenerDistributedTest { - @Parameters(name = "{index}: redundancy={0}") - public static Iterable data() { -return Arrays.asList(0, 3); + @Parameters + public static Collection data() { +return Arrays.asList(new Object[][] { +{1, Boolean.FALSE}, +{3, Boolean.TRUE}, +});
[geode] 10/13: GEODE-7667: Fixing test to include PR clear help text.
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 2e8c7a8ccbb8c7d60c69e0a70b3ca9205a529eb8 Author: Nabarun Nag AuthorDate: Mon May 11 16:52:50 2020 -0700 GEODE-7667: Fixing test to include PR clear help text. --- .../internal/cli/GfshParserAutoCompletionIntegrationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionIntegrationTest.java b/geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionIntegrationTest.java index 4c29427..3bc6a03 100644 --- a/geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionIntegrationTest.java +++ b/geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionIntegrationTest.java @@ -381,7 +381,7 @@ public class GfshParserAutoCompletionIntegrationTest { String hintArgument = "data"; String hintsProvided = gfshParserRule.getCommandManager().obtainHint(hintArgument); String[] hintsProvidedArray = hintsProvided.split(lineSeparator()); -assertThat(hintsProvidedArray.length).isEqualTo(17); +assertThat(hintsProvidedArray.length).isEqualTo(18); assertThat(hintsProvidedArray[0]) .isEqualTo("User data as stored in regions of the Geode distributed system."); }
[geode] 12/13: GEODE-7669 Test coverage for Partitioned Region clear with Overflow enabled (#5189)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit b49e67cb9dee328221d7052d4b8c8f70c9210929 Author: Jianxia Chen <11181423+jche...@users.noreply.github.com> AuthorDate: Thu Jun 4 11:39:04 2020 -0700 GEODE-7669 Test coverage for Partitioned Region clear with Overflow enabled (#5189) Authored-by: Jianxia Chen --- .../PartitionedRegionOverflowClearDUnitTest.java | 380 + 1 file changed, 380 insertions(+) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionOverflowClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionOverflowClearDUnitTest.java new file mode 100644 index 000..c10d1db --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionOverflowClearDUnitTest.java @@ -0,0 +1,380 @@ +/* + * 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.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT; +import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER; +import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT; +import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE; +import static org.apache.geode.distributed.ConfigurationProperties.MAX_WAIT_TIME_RECONNECT; +import static org.apache.geode.distributed.ConfigurationProperties.MEMBER_TIMEOUT; +import static org.apache.geode.distributed.ConfigurationProperties.USE_CLUSTER_CONFIGURATION; +import static org.apache.geode.internal.AvailablePortHelper.getRandomAvailableTCPPorts; +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.apache.geode.test.dunit.VM.getVMId; +import static org.apache.geode.test.dunit.VM.toArray; +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.File; +import java.io.Serializable; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.IntStream; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import org.apache.geode.cache.DiskStoreFactory; +import org.apache.geode.cache.EvictionAction; +import org.apache.geode.cache.EvictionAttributes; +import org.apache.geode.cache.PartitionAttributesFactory; +import org.apache.geode.cache.Region; +import org.apache.geode.cache.RegionShortcut; +import org.apache.geode.cache.client.ClientCache; +import org.apache.geode.cache.client.ClientCacheFactory; +import org.apache.geode.cache.client.ClientRegionShortcut; +import org.apache.geode.distributed.LocatorLauncher; +import org.apache.geode.distributed.ServerLauncher; +import org.apache.geode.distributed.internal.InternalLocator; +import org.apache.geode.management.internal.cli.util.CommandStringBuilder; +import org.apache.geode.test.dunit.AsyncInvocation; +import org.apache.geode.test.dunit.VM; +import org.apache.geode.test.dunit.rules.DistributedRule; +import org.apache.geode.test.junit.rules.GfshCommandRule; +import org.apache.geode.test.junit.rules.serializable.SerializableTemporaryFolder; + +public class PartitionedRegionOverflowClearDUnitTest implements Serializable { + + @Rule + public DistributedRule distributedRule = new DistributedRule(5); + + @Rule + public SerializableTemporaryFolder temporaryFolder = new SerializableTemporaryFolder(); + + @Rule + public transient GfshCommandRule gfsh = new GfshCommandRule(); + + private VM locator; + private VM server1; + private VM server2; + private VM accessor; + private VM client; + + private static final String LOCATOR_NAME = "locator"; + private static final String SERVER1_NAME = "
[geode] 07/13: GEODE-7667: Add a 'clear' gfsh command for PR and RR clear (#4818)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 9bf176cc7822f7328fef80e9f0797293d6f4e98e Author: BenjaminPerryRoss <39068135+benjaminperryr...@users.noreply.github.com> AuthorDate: Tue May 5 11:40:34 2020 -0700 GEODE-7667: Add a 'clear' gfsh command for PR and RR clear (#4818) * Added clear command and modified remove functionality to clear PR Authored-by: Benjamin Ross --- .../geode/management/internal/i18n/CliStrings.java | 14 ++- .../cli/commands/ClearCommandDUnitTest.java| 120 + .../cli/commands/RemoveCommandDUnitTest.java | 13 ++- .../{RemoveCommand.java => ClearCommand.java} | 53 - .../cli/commands/CommandAvailabilityIndicator.java | 1 + .../internal/cli/commands/RemoveCommand.java | 9 +- .../internal/cli/domain/DataCommandResult.java | 12 +++ .../cli/functions/DataCommandFunction.java | 23 ++-- .../internal/cli/commands/ClearCommandTest.java| 115 9 files changed, 309 insertions(+), 51 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/i18n/CliStrings.java b/geode-core/src/main/java/org/apache/geode/management/internal/i18n/CliStrings.java index c354d030..6df013e 100644 --- a/geode-core/src/main/java/org/apache/geode/management/internal/i18n/CliStrings.java +++ b/geode-core/src/main/java/org/apache/geode/management/internal/i18n/CliStrings.java @@ -811,6 +811,14 @@ public class CliStrings { public static final String CLEAR_DEFINED_INDEX__SUCCESS__MSG = "Index definitions successfully cleared"; + /* clear region */ + public static final String CLEAR_REGION = "clear region"; + public static final String CLEAR_REGION_HELP = + "Clears/Removes all keys from the specified region."; + public static final String CLEAR_REGION_REGION_NAME = "name"; + public static final String CLEAR_REGION_REGION_NAME_HELP = "Region to clear keys from."; + public static final String CLEAR_REGION_CLEARED_ALL_KEYS = "Cleared all keys in the region"; + /* create region */ public static final String CREATE_REGION = "create region"; public static final String CREATE_REGION__HELP = @@ -1930,9 +1938,9 @@ public class CliStrings { public static final String REMOVE__MSG__KEY_EMPTY = "Key is Null"; public static final String REMOVE__MSG__REGION_NOT_FOUND = "Region <{0}> Not Found"; public static final String REMOVE__MSG__KEY_NOT_FOUND_REGION = "Key is not present in the region"; - public static final String REMOVE__MSG__CLEARED_ALL_CLEARS = "Cleared all keys in the region"; - public static final String REMOVE__MSG__CLEARALL_NOT_SUPPORTED_FOR_PARTITIONREGION = - "Option --" + REMOVE__ALL + " is not supported on partitioned region"; + public static final String REMOVE__MSG__CLEARALL_DEPRECATION_WARNING = + "Warning: The --all option for the 'remove' command is deprecated. Please" + + " use the 'clear' command instead."; /* resume gateway-sender */ public static final String RESUME_GATEWAYSENDER = "resume gateway-sender"; diff --git a/geode-gfsh/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ClearCommandDUnitTest.java b/geode-gfsh/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ClearCommandDUnitTest.java new file mode 100644 index 000..e51fc0f --- /dev/null +++ b/geode-gfsh/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ClearCommandDUnitTest.java @@ -0,0 +1,120 @@ +/* + * 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.management.internal.cli.commands; + +import static org.apache.geode.management.internal.cli.commands.RemoveCommand.REGION_NOT_FOUND; +import static org.apache.geode.management.internal.i18n.CliStrings.CLEAR_REGION_CLEARED_ALL_KEYS; +import static org.asser
[geode] 05/13: GEODE-7983: Clear region writer callbacks should not be invoked for bucket regions (#4954)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 32f59fc78357aa5fdd28358c716cc4d7e6f5f1b7 Author: Xiaojian Zhou AuthorDate: Tue Apr 14 10:50:21 2020 -0700 GEODE-7983: Clear region writer callbacks should not be invoked for bucket regions (#4954) --- .../cache/PartitionedRegionClearDUnitTest.java | 44 +- .../internal/cache/partitioned/ClearPRMessage.java | 2 +- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java index a5a22b9..e2e04eb 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java @@ -47,6 +47,7 @@ import org.apache.geode.test.dunit.rules.MemberVM; public class PartitionedRegionClearDUnitTest implements Serializable { protected static final String REGION_NAME = "testPR"; + protected static final int TOTAL_BUCKET_NUM = 10; protected static final int NUM_ENTRIES = 1000; protected int locatorPort; @@ -103,7 +104,8 @@ public class PartitionedRegionClearDUnitTest implements Serializable { private void initDataStore(boolean withWriter) { RegionFactory factory = getCache().createRegionFactory(getRegionShortCut()) -.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()); +.setPartitionAttributes( +new PartitionAttributesFactory().setTotalNumBuckets(TOTAL_BUCKET_NUM).create()); if (withWriter) { factory.setCacheWriter(new CountingCacheWriter()); } @@ -169,6 +171,26 @@ public class PartitionedRegionClearDUnitTest implements Serializable { return destroys; }; + SerializableCallableIF getBucketRegionWriterClears = () -> { +int clears = 0; +for (int i = 0; i < TOTAL_BUCKET_NUM; i++) { + String bucketRegionName = "_B__" + REGION_NAME + "_" + i; + clears += clearsByRegion.get(bucketRegionName) == null ? 0 + : clearsByRegion.get(bucketRegionName).get(); +} +return clears; + }; + + SerializableCallableIF getBucketRegionWriterDestroys = () -> { +int destroys = 0; +for (int i = 0; i < TOTAL_BUCKET_NUM; i++) { + String bucketRegionName = "_B__" + REGION_NAME + "_" + i; + destroys += destroysByRegion.get(bucketRegionName) == null ? 0 + : destroysByRegion.get(bucketRegionName).get(); +} +return destroys; + }; + void configureServers(boolean dataStoreWithWriter, boolean accessorWithWriter) { dataStore1.invoke(() -> initDataStore(dataStoreWithWriter)); dataStore2.invoke(() -> initDataStore(dataStoreWithWriter)); @@ -210,6 +232,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(1); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(0); + +assertThat(dataStore3.invoke(getBucketRegionWriterDestroys)) +.isEqualTo(dataStore3.invoke(getBucketRegionWriterClears)) +.isEqualTo(0); } @Test @@ -237,6 +263,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(0); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(1); + +assertThat(accessor.invoke(getBucketRegionWriterDestroys)) +.isEqualTo(accessor.invoke(getBucketRegionWriterClears)) +.isEqualTo(0); } @Test @@ -264,6 +294,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(0); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(1); + +assertThat(accessor.invoke(getBucketRegionWriterDestroys)) +.isEqualTo(accessor.invoke(getBucketRegionWriterClears)) +.isEqualTo(0); } @Test @@ -291,6 +325,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(1); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(0); + +assertThat(dataStore3.invoke(getBucketRegionWriterDestroys)) +.isEqualTo(dataStore3.invoke(getBucketRegionWriterClears)) +.isEqualTo(0); } @Test @@ -321,6 +359,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(1); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(0); + +assertThat(d
[geode] branch feature/GEODE-7665 updated (4cd3917 -> af4b35a)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a change to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git. omit 4cd3917 GEODE-8173: Add unit test (coverage) for PartitionedRegionClear class. (#5208) omit cdcdc51 GEODE-7669 Test coverage for Partitioned Region clear with Overflow enabled (#5189) omit 93ff5f4 GEODE-7678 (2nd PR) - Support for cache-listener and client-notification for Partitioned Region Clear operation (#5124) omit 86ef373 GEODE-7667: Fixing test to include PR clear help text. omit edc4162 GEODE-7894: Moving expiry tasks to AbstractRegion. omit 19b9316 GEODE-7676: Conversion of duration to seconds. omit ef0c7ae GEODE-7667: Add a 'clear' gfsh command for PR and RR clear (#4818) omit 8930e7e GEODE-7676: Add PR clear with expiration tests (#4970) omit bdfd611 GEODE-7983: Clear region writer callbacks should not be invoked for bucket regions (#4954) omit be614cc GEODE-7912: cacheWriter should be triggered when PR.clear (#4882) omit 19a6079 PR.clear's event id should be created and used in BR (#4805) omit 41efe40 GEODE-7682: add PR.clear API (#4755) omit d757db8 GEODE-7683: introduce BR.cmnClearRegion add d82e30d GEODE-8243: Use java.exe on Windows in Launcher tests (#5241) add cb5990c GEODE-8221: Refactor tests to run in appropriate projects. (#5244) add 4477013 GEODE-8179: gfsh query cmd returns incorrect results if '=' sign is missing (#5187) add dd6a002 GEODE-8244: enable ignored redis tests (#5245) add e5426f7 change more string commands to have CommandFunction support (#5184) add 0f763ea GEODE-8099: add dlock around cms create/delete operations. (#5188) add 4789e8c GEODE-8242: Add HSTRLEN redis command (#5240) add 9e52198 GEODE-8253: Add additional concurrency tests for redis DEL (#5252) add b1107d2 GEODE-8144: setting SNI server name is not needed if endpoint verification is disabled (#5250) add 70fe060 GEODE-7896 Update tomcat support add bcbc53b Merge pull request #5110 from metatype/develop add a5c8164 GEODE-8260: add toString to RedisData classes (#5255) add d405e4b GEODE-8176: Move test to ClientServerMiscDUnitTest (#5238) add 7609cfa GEODE-8261: Added a null check for the proxyID. (#5251) add 8d5e3d4 GEODE-7864: Overriding hashCode when equals in overridden (#4866) add e159238 GEODE-8268: clean up ExecutionHandlerContext (#5237) add 86778ec GEODE-7591: Fix for hang in ClusterDistributionManager (#5182) add d1e857d GEODE-8270: Reorganize test packages to match main package structure (#5263) add 9fdd3d0 GEODE-8263: change SET command to reject KEEPTTL (#5258) add c93773f GEODE-8274: Improve readability of Version comparison. (#5266) add e955968 GEODE-8264: add serialization tests for RedisData classes (#5260) add 87a2f10 GEODE-8237: Add note about 'alter region' & cluster conf service (#5231) add a6640d7 GEODE-8277: acceptance test certificates expired in Dockerized SNI acceptance tests (#5274) add 9ea7a7c GEODE-8276: fix KEYS command to handle non-ASCII keys (#5272) add 3e7f2df GEODE-8269: Improve test coverage for redis (#5262) add 215643b GEODE-8216: Refactoring the test - moving the location of pausing senders. (#5259) add 720a4ca GEODE-8241: Locator observes locator-wait-time (#5236) add 84ab66b GEODE-8272 Refactor Restore Redundancy Command (#5249) add 18e5817 GEODE-8269: Improve test coverage (#5275) add 4a825a8 GEODE-8251: make sure Configuration can be deserialized post 1.12. (#5257) add 16e2c7b GEODE-8280: Return correct Redis AUTH errors (#5276) add 9939cc0 GEODE-8221: Commits session data prior to sending output to browser (#5246) add 3c52713 Add Mass Test Run pipeline. (#5271) add cd4477a GEODE-8284: Break up StringsIntegration test class (#5277) add 9f1bf04 GEODE-8273: Cleanup GfshExecution and GfshScript (#5267) add 91fd5f5 GEODE-8289: Add gradle task chaining for geode-old-versions:clean (#5283) add ca5d961 GEODE-8275: Improvements to mass-test-run after first pass deployment (#5287) add 210dc4f GEODE-8250: Geode Logging doc changes (#5294) add 5256fde GEODE-8288: Match Native Redis's glob-style pattern (#5282) add d740a70 GEODE-8239 - Add gradle config to add 'Class-Path' and 'Dependent-Modules' attirbutes to manifest file. (#5297) add ba6e44c GEODE-8250: Create new custom log config acceptance tests (#5268) add eed47f4 Fix metric-tools image python requirements. (#5298) add ab83b61 GEODE-8285: Change location of generated test file to build dir and fix error message path for sanctioned text file (#5280) add 5732a1c GEODE-8095 Further rework of the RestoreRedundancy data objects f
[geode] 01/13: GEODE-7683: introduce BR.cmnClearRegion
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 3e8304cfa9df6645cb3082931ad4ff1ddd390dc1 Author: zhouxh AuthorDate: Mon Jan 27 17:02:48 2020 -0800 GEODE-7683: introduce BR.cmnClearRegion Co-authored-by: Xiaojian Zhou GEODE-7684: Create messaging class for PR Clear (#4689) * Added new message class and test Co-authored-by: Benjamin Ross Co-authored-by: Donal Evans --- .../codeAnalysis/sanctionedDataSerializables.txt | 8 + .../apache/geode/internal/cache/BucketRegion.java | 38 +- .../geode/internal/cache/DistributedRegion.java| 23 +- .../internal/cache/partitioned/ClearPRMessage.java | 388 + .../internal/cache/BucketRegionJUnitTest.java | 77 .../internal/cache/DistributedRegionJUnitTest.java | 18 + .../cache/partitioned/ClearPRMessageTest.java | 288 +++ .../serialization/DataSerializableFixedID.java | 3 + 8 files changed, 832 insertions(+), 11 deletions(-) diff --git a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt index 733737e..6dd3a34 100644 --- a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt +++ b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt @@ -1368,6 +1368,14 @@ org/apache/geode/internal/cache/partitioned/BucketSizeMessage$BucketSizeReplyMes fromData,27 toData,27 +org/apache/geode/internal/cache/partitioned/ClearPRMessage,2 +fromData,30 +toData,44 + +org/apache/geode/internal/cache/partitioned/ClearPRMessage$ClearReplyMessage,2 +fromData,17 +toData,17 + org/apache/geode/internal/cache/partitioned/ColocatedRegionDetails,2 fromData,81 toData,133 diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java index d91786f..e4fa7ef 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java @@ -557,6 +557,36 @@ public class BucketRegion extends DistributedRegion implements Bucket { } } + @Override + public void cmnClearRegion(RegionEventImpl regionEvent, boolean cacheWrite, boolean useRVV) { +if (!getBucketAdvisor().isPrimary()) { + if (logger.isDebugEnabled()) { +logger.debug("Not primary bucket when doing clear, do nothing"); + } + return; +} + +boolean enableRVV = useRVV && getConcurrencyChecksEnabled(); +RegionVersionVector rvv = null; +if (enableRVV) { + rvv = getVersionVector().getCloneForTransmission(); +} + +// get rvvLock +Set participants = +getCacheDistributionAdvisor().adviseInvalidateRegion(); +try { + obtainWriteLocksForClear(regionEvent, participants); + // no need to dominate my own rvv. + // Clear is on going here, there won't be GII for this member + clearRegionLocally(regionEvent, cacheWrite, null); + distributeClearOperation(regionEvent, rvv, participants); + + // TODO: call reindexUserDataRegion if there're lucene indexes +} finally { + releaseWriteLocksForClear(regionEvent, participants); +} + } long generateTailKey() { long key = eventSeqNum.addAndGet(partitionedRegion.getTotalNumberOfBuckets()); @@ -2093,11 +2123,9 @@ public class BucketRegion extends DistributedRegion implements Bucket { // if GII has failed, because there is not primary. So it's safe to set these // counters to 0. oldMemValue = bytesInMemory.getAndSet(0); -} - -else { - throw new InternalGemFireError( - "Trying to clear a bucket region that was not destroyed or in initialization."); +} else { + // BucketRegion's clear is supported now + oldMemValue = bytesInMemory.getAndSet(0); } if (oldMemValue != BUCKET_DESTROYED) { partitionedRegion.getPrStats().incDataStoreEntryCount(-sizeBeforeClear); diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java index b822dde..489d85a 100755 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java @@ -2013,6 +2013,10 @@ public class DistributedRegion extends LocalRegion implements InternalDistribute super.basicClear(regionEvent, cacheWrite); } + void distributeClearOperation(RegionEventImpl regionEvent,
[geode] 03/13: PR.clear's event id should be created and used in BR (#4805)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 23954beddacb0fd883360739ae48fba6fa2c84f8 Author: Xiaojian Zhou AuthorDate: Mon Mar 16 17:35:35 2020 -0700 PR.clear's event id should be created and used in BR (#4805) * GEODE-7857: PR.clear's event id should be created and used in BR --- .../PartitionedRegionPersistentClearDUnitTest.java | 2 +- .../codeAnalysis/sanctionedDataSerializables.txt | 4 +- .../geode/internal/cache/PartitionedRegion.java| 8 +-- .../internal/cache/partitioned/ClearPRMessage.java | 12 ++-- .../internal/cache/PartitionedRegionTest.java | 65 ++ 5 files changed, 80 insertions(+), 11 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionPersistentClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionPersistentClearDUnitTest.java index 847699b..c758446 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionPersistentClearDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionPersistentClearDUnitTest.java @@ -21,6 +21,6 @@ import org.apache.geode.cache.RegionShortcut; public class PartitionedRegionPersistentClearDUnitTest extends PartitionedRegionClearDUnitTest { protected RegionShortcut getRegionShortCut() { -return RegionShortcut.PARTITION_REDUNDANT_PERSISTENT_OVERFLOW; +return RegionShortcut.PARTITION_REDUNDANT_PERSISTENT; } } diff --git a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt index bdeaf11..6dd3a34 100644 --- a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt +++ b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt @@ -1369,8 +1369,8 @@ fromData,27 toData,27 org/apache/geode/internal/cache/partitioned/ClearPRMessage,2 -fromData,19 -toData,36 +fromData,30 +toData,44 org/apache/geode/internal/cache/partitioned/ClearPRMessage$ClearReplyMessage,2 fromData,17 diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java index 1a1df20..312e951 100755 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java @@ -2189,7 +2189,7 @@ public class PartitionedRegion extends LocalRegion } // create ClearPRMessage per bucket -List clearMsgList = createClearPRMessages(); +List clearMsgList = createClearPRMessages(regionEvent.getEventId()); for (ClearPRMessage clearPRMessage : clearMsgList) { int bucketId = clearPRMessage.getBucketId(); checkReadiness(); @@ -2361,10 +2361,10 @@ public class PartitionedRegion extends LocalRegion } } - List createClearPRMessages() { + List createClearPRMessages(EventID eventID) { ArrayList clearMsgList = new ArrayList<>(); -for (int bucketId = 0; bucketId < this.totalNumberOfBuckets; bucketId++) { - ClearPRMessage clearPRMessage = new ClearPRMessage(bucketId); +for (int bucketId = 0; bucketId < getTotalNumberOfBuckets(); bucketId++) { + ClearPRMessage clearPRMessage = new ClearPRMessage(bucketId, eventID); clearMsgList.add(clearPRMessage); } return clearMsgList; diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ClearPRMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ClearPRMessage.java index 9fa8057..cc01920 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ClearPRMessage.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ClearPRMessage.java @@ -56,6 +56,8 @@ public class ClearPRMessage extends PartitionMessageWithDirectReply { private Integer bucketId; + private EventID eventID; + public static final String BUCKET_NON_PRIMARY_MESSAGE = "The bucket region on target member is no longer primary"; public static final String EXCEPTION_THROWN_DURING_CLEAR_OPERATION = @@ -71,8 +73,9 @@ public class ClearPRMessage extends PartitionMessageWithDirectReply { */ public ClearPRMessage() {} - public ClearPRMessage(int bucketId) { + public ClearPRMessage(int bucketId, EventID eventID) { this.bucketId = bucketId; +this.eventID = eventID; } public void initMessage(PartitionedRegion region, Set recipients, @@ -119,6 +122,7 @@ pub
[geode] 08/13: GEODE-7676: Conversion of duration to seconds.
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit c78064a23c9897b39056a78ffdcec53bb5b80266 Author: Nabarun Nag AuthorDate: Mon May 11 12:24:16 2020 -0700 GEODE-7676: Conversion of duration to seconds. --- .../internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java index 33301f4..7f3dff9 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java @@ -298,7 +298,7 @@ public class PartitionedRegionClearWithExpirationDUnitTest implements Serializab public void clearShouldRemoveRegisteredExpirationTasks(TestVM coordinatorVM, RegionShortcut regionShortcut) { final int entries = 500; -int expirationTime = (int) GeodeAwaitility.getTimeout().getValueInMS() / 1000; +int expirationTime = (int) GeodeAwaitility.getTimeout().getSeconds(); parametrizedSetup(regionShortcut, new ExpirationAttributes(expirationTime, DESTROY)); populateRegion(accessor, entries, asList(accessor, server1, server2));
[geode] 13/13: GEODE-8173: Add unit test (coverage) for PartitionedRegionClear class. (#5208)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit af4b35ae46fc63b178eb41f908c5f678d75068fa Author: agingade AuthorDate: Mon Jun 8 10:23:50 2020 -0700 GEODE-8173: Add unit test (coverage) for PartitionedRegionClear class. (#5208) * GEODE-8173: Add unit test (coverage) for PartitionedRegionClear class. Co-authored-by: anilkumar gingade --- .../cache/PRCacheListenerDistributedTest.java | 337 +++- .../ReplicateCacheListenerDistributedTest.java | 4 +- .../geode/internal/cache/PartitionedRegion.java| 2 +- .../internal/cache/PartitionedRegionClear.java | 83 ++- .../internal/cache/PartitionedRegionClearTest.java | 611 + 5 files changed, 999 insertions(+), 38 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java b/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java index f4a9ac9..7d95473 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java @@ -17,10 +17,18 @@ package org.apache.geode.cache; import static org.apache.geode.test.dunit.VM.getVM; import static org.apache.geode.test.dunit.VM.getVMCount; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.hamcrest.Matchers.anyOf; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.nullValue; +import java.io.Serializable; import java.util.Arrays; import java.util.Collection; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -28,7 +36,13 @@ import org.junit.runners.Parameterized.Parameter; import org.junit.runners.Parameterized.Parameters; import org.junit.runners.Parameterized.UseParametersRunnerFactory; +import org.apache.geode.cache.util.CacheListenerAdapter; import org.apache.geode.logging.internal.log4j.api.LogService; +import org.apache.geode.test.dunit.rules.CacheRule; +import org.apache.geode.test.dunit.rules.DistributedRule; +import org.apache.geode.test.dunit.rules.SharedCountersRule; +import org.apache.geode.test.dunit.rules.SharedErrorCollector; +import org.apache.geode.test.junit.rules.serializable.SerializableTestName; import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactory; /** @@ -43,7 +57,28 @@ import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactor @RunWith(Parameterized.class) @UseParametersRunnerFactory(CategoryWithParameterizedRunnerFactory.class) @SuppressWarnings("serial") -public class PRCacheListenerDistributedTest extends ReplicateCacheListenerDistributedTest { +public class PRCacheListenerDistributedTest implements Serializable { + + protected static final String CLEAR = "CLEAR"; + protected static final String REGION_DESTROY = "REGION_DESTROY"; + private static final String CREATES = "CREATES"; + private static final String UPDATES = "UPDATES"; + private static final String INVALIDATES = "INVALIDATES"; + private static final String DESTROYS = "DESTROYS"; + private static final int ENTRY_VALUE = 0; + private static final int UPDATED_ENTRY_VALUE = 1; + private static final String KEY = "key-1"; + @Rule + public DistributedRule distributedRule = new DistributedRule(); + @Rule + public CacheRule cacheRule = CacheRule.builder().createCacheInAll().build(); + @Rule + public SerializableTestName testName = new SerializableTestName(); + @Rule + public SharedCountersRule sharedCountersRule = new SharedCountersRule(); + @Rule + public SharedErrorCollector errorCollector = new SharedErrorCollector(); + protected String regionName; @Parameters public static Collection data() { @@ -59,7 +94,6 @@ public class PRCacheListenerDistributedTest extends ReplicateCacheListenerDistri @Parameter(1) public Boolean withData; - @Override protected Region createRegion(final String name, final CacheListener listener) { return createPartitionedRegion(name, listener, false); @@ -99,22 +133,18 @@ public class PRCacheListenerDistributedTest extends ReplicateCacheListenerDistri } } - @Override protected int expectedCreates() { return 1; } - @Override protected int expectedUpdates() { return 1; } - @Override protected int expectedInvalidates() { return 1; } - @Override protected int expectedDestroys() { return 1; } @@ -132,7 +162,8 @@ public class PRCacheListenerDistributedTest extends
[geode] 02/13: GEODE-7682: add PR.clear API (#4755)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 6174f70637eec6ea8a4894d8773a83f7e3443b31 Author: Xiaojian Zhou AuthorDate: Thu Mar 5 23:46:36 2020 -0800 GEODE-7682: add PR.clear API (#4755) * GEODE-7683: introduce BR.cmnClearRegion Co-authored-by: Xiaojian Zhou --- .../cache/PartitionedRegionClearDUnitTest.java | 218 + .../PartitionedRegionPersistentClearDUnitTest.java | 26 +++ ...itionedRegionSingleNodeOperationsJUnitTest.java | 66 --- .../codeAnalysis/sanctionedDataSerializables.txt | 4 +- .../org/apache/geode/internal/DSFIDFactory.java| 3 + .../geode/internal/cache/DistributedRegion.java| 9 - .../apache/geode/internal/cache/LocalRegion.java | 10 + .../geode/internal/cache/PartitionedRegion.java| 214 ++-- .../geode/internal/cache/RegionEventImpl.java | 5 + .../internal/cache/partitioned/ClearPRMessage.java | 166 +--- .../cache/partitioned/ClearPRMessageTest.java | 50 ++--- 11 files changed, 522 insertions(+), 249 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java new file mode 100644 index 000..fb2a81b --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java @@ -0,0 +1,218 @@ +/* + * 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.apache.geode.internal.Assert.fail; +import static org.apache.geode.test.dunit.rules.ClusterStartupRule.getCache; +import static org.apache.geode.test.dunit.rules.ClusterStartupRule.getClientCache; +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.Serializable; +import java.util.Properties; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.IntStream; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import org.apache.geode.cache.InterestResultPolicy; +import org.apache.geode.cache.PartitionAttributesFactory; +import org.apache.geode.cache.Region; +import org.apache.geode.cache.RegionEvent; +import org.apache.geode.cache.RegionShortcut; +import org.apache.geode.cache.client.ClientRegionShortcut; +import org.apache.geode.cache.util.CacheListenerAdapter; +import org.apache.geode.test.dunit.SerializableCallableIF; +import org.apache.geode.test.dunit.rules.ClientVM; +import org.apache.geode.test.dunit.rules.ClusterStartupRule; +import org.apache.geode.test.dunit.rules.MemberVM; + +public class PartitionedRegionClearDUnitTest implements Serializable { + protected static final String REGION_NAME = "testPR"; + protected static final int NUM_ENTRIES = 1000; + + protected int locatorPort; + protected MemberVM locator; + protected MemberVM dataStore1, dataStore2, dataStore3, accessor; + protected ClientVM client1, client2; + + private static final Logger logger = LogManager.getLogger(); + + @Rule + public ClusterStartupRule cluster = new ClusterStartupRule(7); + + @Before + public void setUp() throws Exception { +locator = cluster.startLocatorVM(0); +locatorPort = locator.getPort(); +dataStore1 = cluster.startServerVM(1, getProperties(), locatorPort); +dataStore2 = cluster.startServerVM(2, getProperties(), locatorPort); +dataStore3 = cluster.startServerVM(3, getProperties(), locatorPort); +accessor = cluster.startServerVM(4, getProperties(), locatorPort); +client1 = cluster.startClientVM(5, +c -> c.withPoolSubscription(true).withLocatorConnection((locatorPort))); +client2 = cluster.startClientVM(6, +c -> c.withPoolSubscription(true).withLocatorConnection((locatorPort))); +dataStore1.invoke(this::initDataStore); +dataStore2.invoke(this::initDataStore); +dataStore3.invoke(this::initD
[geode] 06/13: GEODE-7676: Add PR clear with expiration tests (#4970)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 75ae5912f83a9cd12516726532574d70b7774c45 Author: Juan José Ramos AuthorDate: Wed Apr 22 14:18:07 2020 +0100 GEODE-7676: Add PR clear with expiration tests (#4970) Added distributed tests to verify the clear operation on Partitioned Regions works as expected when expiration is configured. - Added unit and distributed tests. - Fixed LocalRegion class to clear the entryExpiryTasks Map whenever the cancelAllEntryExpiryTasks method is invoked. --- ...titionedRegionClearWithExpirationDUnitTest.java | 516 + .../apache/geode/internal/cache/LocalRegion.java | 11 +- .../geode/internal/cache/LocalRegionTest.java | 22 + 3 files changed, 548 insertions(+), 1 deletion(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java new file mode 100644 index 000..33301f4 --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java @@ -0,0 +1,516 @@ +/* + * 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.apache.geode.cache.ExpirationAction.DESTROY; +import static org.apache.geode.cache.RegionShortcut.PARTITION; +import static org.apache.geode.cache.RegionShortcut.PARTITION_OVERFLOW; +import static org.apache.geode.cache.RegionShortcut.PARTITION_PERSISTENT; +import static org.apache.geode.cache.RegionShortcut.PARTITION_PERSISTENT_OVERFLOW; +import static org.apache.geode.cache.RegionShortcut.PARTITION_REDUNDANT; +import static org.apache.geode.cache.RegionShortcut.PARTITION_REDUNDANT_OVERFLOW; +import static org.apache.geode.cache.RegionShortcut.PARTITION_REDUNDANT_PERSISTENT; +import static org.apache.geode.cache.RegionShortcut.PARTITION_REDUNDANT_PERSISTENT_OVERFLOW; +import static org.apache.geode.internal.util.ArrayUtils.asList; +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.IntStream; + +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; +import junitparams.naming.TestCaseName; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.apache.geode.ForcedDisconnectException; +import org.apache.geode.cache.Cache; +import org.apache.geode.cache.CacheWriter; +import org.apache.geode.cache.CacheWriterException; +import org.apache.geode.cache.ExpirationAttributes; +import org.apache.geode.cache.PartitionAttributes; +import org.apache.geode.cache.PartitionAttributesFactory; +import org.apache.geode.cache.Region; +import org.apache.geode.cache.RegionEvent; +import org.apache.geode.cache.RegionShortcut; +import org.apache.geode.cache.partition.PartitionRegionHelper; +import org.apache.geode.cache.util.CacheWriterAdapter; +import org.apache.geode.distributed.DistributedSystemDisconnectedException; +import org.apache.geode.distributed.internal.DMStats; +import org.apache.geode.distributed.internal.InternalDistributedSystem; +import org.apache.geode.distributed.internal.membership.api.MembershipManagerHelper; +import org.apache.geode.test.awaitility.GeodeAwaitility; +import org.apache.geode.test.dunit.VM; +import org.apache.geode.test.dunit.rules.CacheRule; +import org.apache.geode.test.dunit.rules.DistributedDiskDirRule; +import org.apache.geode.test.dunit.rules.DistributedRule; + +/** + * Tests to verify that {@link PartitionedRegion#clear()} cancels all
[geode] 06/13: GEODE-7676: Add PR clear with expiration tests (#4970)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 75ae5912f83a9cd12516726532574d70b7774c45 Author: Juan José Ramos AuthorDate: Wed Apr 22 14:18:07 2020 +0100 GEODE-7676: Add PR clear with expiration tests (#4970) Added distributed tests to verify the clear operation on Partitioned Regions works as expected when expiration is configured. - Added unit and distributed tests. - Fixed LocalRegion class to clear the entryExpiryTasks Map whenever the cancelAllEntryExpiryTasks method is invoked. --- ...titionedRegionClearWithExpirationDUnitTest.java | 516 + .../apache/geode/internal/cache/LocalRegion.java | 11 +- .../geode/internal/cache/LocalRegionTest.java | 22 + 3 files changed, 548 insertions(+), 1 deletion(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java new file mode 100644 index 000..33301f4 --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java @@ -0,0 +1,516 @@ +/* + * 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.apache.geode.cache.ExpirationAction.DESTROY; +import static org.apache.geode.cache.RegionShortcut.PARTITION; +import static org.apache.geode.cache.RegionShortcut.PARTITION_OVERFLOW; +import static org.apache.geode.cache.RegionShortcut.PARTITION_PERSISTENT; +import static org.apache.geode.cache.RegionShortcut.PARTITION_PERSISTENT_OVERFLOW; +import static org.apache.geode.cache.RegionShortcut.PARTITION_REDUNDANT; +import static org.apache.geode.cache.RegionShortcut.PARTITION_REDUNDANT_OVERFLOW; +import static org.apache.geode.cache.RegionShortcut.PARTITION_REDUNDANT_PERSISTENT; +import static org.apache.geode.cache.RegionShortcut.PARTITION_REDUNDANT_PERSISTENT_OVERFLOW; +import static org.apache.geode.internal.util.ArrayUtils.asList; +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.IntStream; + +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; +import junitparams.naming.TestCaseName; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.apache.geode.ForcedDisconnectException; +import org.apache.geode.cache.Cache; +import org.apache.geode.cache.CacheWriter; +import org.apache.geode.cache.CacheWriterException; +import org.apache.geode.cache.ExpirationAttributes; +import org.apache.geode.cache.PartitionAttributes; +import org.apache.geode.cache.PartitionAttributesFactory; +import org.apache.geode.cache.Region; +import org.apache.geode.cache.RegionEvent; +import org.apache.geode.cache.RegionShortcut; +import org.apache.geode.cache.partition.PartitionRegionHelper; +import org.apache.geode.cache.util.CacheWriterAdapter; +import org.apache.geode.distributed.DistributedSystemDisconnectedException; +import org.apache.geode.distributed.internal.DMStats; +import org.apache.geode.distributed.internal.InternalDistributedSystem; +import org.apache.geode.distributed.internal.membership.api.MembershipManagerHelper; +import org.apache.geode.test.awaitility.GeodeAwaitility; +import org.apache.geode.test.dunit.VM; +import org.apache.geode.test.dunit.rules.CacheRule; +import org.apache.geode.test.dunit.rules.DistributedDiskDirRule; +import org.apache.geode.test.dunit.rules.DistributedRule; + +/** + * Tests to verify that {@link PartitionedRegion#clear()} cancels all
[geode] 04/13: GEODE-7912: cacheWriter should be triggered when PR.clear (#4882)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 2840a19ce2fc35796a3197f215bee7b62da36c2f Author: Xiaojian Zhou AuthorDate: Mon Mar 30 19:34:35 2020 -0700 GEODE-7912: cacheWriter should be triggered when PR.clear (#4882) Co-authored-by: Anil Co-authored-by: Xiaojian Zhou --- .../cache/PartitionedRegionClearDUnitTest.java | 228 + .../apache/geode/internal/cache/LocalRegion.java | 4 +- .../geode/internal/cache/PartitionedRegion.java| 56 +++-- 3 files changed, 223 insertions(+), 65 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java index fb2a81b..a5a22b9 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java @@ -20,6 +20,7 @@ import static org.apache.geode.test.dunit.rules.ClusterStartupRule.getClientCach import static org.assertj.core.api.Assertions.assertThat; import java.io.Serializable; +import java.util.HashMap; import java.util.Properties; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.IntStream; @@ -30,13 +31,15 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; +import org.apache.geode.cache.CacheWriterException; import org.apache.geode.cache.InterestResultPolicy; import org.apache.geode.cache.PartitionAttributesFactory; import org.apache.geode.cache.Region; import org.apache.geode.cache.RegionEvent; +import org.apache.geode.cache.RegionFactory; import org.apache.geode.cache.RegionShortcut; import org.apache.geode.cache.client.ClientRegionShortcut; -import org.apache.geode.cache.util.CacheListenerAdapter; +import org.apache.geode.cache.util.CacheWriterAdapter; import org.apache.geode.test.dunit.SerializableCallableIF; import org.apache.geode.test.dunit.rules.ClientVM; import org.apache.geode.test.dunit.rules.ClusterStartupRule; @@ -68,12 +71,6 @@ public class PartitionedRegionClearDUnitTest implements Serializable { c -> c.withPoolSubscription(true).withLocatorConnection((locatorPort))); client2 = cluster.startClientVM(6, c -> c.withPoolSubscription(true).withLocatorConnection((locatorPort))); -dataStore1.invoke(this::initDataStore); -dataStore2.invoke(this::initDataStore); -dataStore3.invoke(this::initDataStore); -accessor.invoke(this::initAccessor); -client1.invoke(this::initClientCache); -client2.invoke(this::initClientCache); } protected RegionShortcut getRegionShortCut() { @@ -104,14 +101,18 @@ public class PartitionedRegionClearDUnitTest implements Serializable { region.registerInterestForAllKeys(InterestResultPolicy.KEYS); } - private void initDataStore() { -getCache().createRegionFactory(getRegionShortCut()) -.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()) -.addCacheListener(new CountingCacheListener()) -.create(REGION_NAME); + private void initDataStore(boolean withWriter) { +RegionFactory factory = getCache().createRegionFactory(getRegionShortCut()) +.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()); +if (withWriter) { + factory.setCacheWriter(new CountingCacheWriter()); +} +factory.create(REGION_NAME); +clearsByRegion = new HashMap<>(); +destroysByRegion = new HashMap<>(); } - private void initAccessor() { + private void initAccessor(boolean withWriter) { RegionShortcut shortcut = getRegionShortCut(); if (shortcut.isPersistent()) { if (shortcut == RegionShortcut.PARTITION_PERSISTENT) { @@ -126,12 +127,16 @@ public class PartitionedRegionClearDUnitTest implements Serializable { fail("Wrong region type:" + shortcut); } } -getCache().createRegionFactory(shortcut) +RegionFactory factory = getCache().createRegionFactory(shortcut) .setPartitionAttributes( new PartitionAttributesFactory().setTotalNumBuckets(10).setLocalMaxMemory(0).create()) -.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()) -.addCacheListener(new CountingCacheListener()) -.create(REGION_NAME); +.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()); +if (withWriter) { + factory.setCacheWriter(new CountingCacheWriter()); +} +factory.create(REGION_NAME); +clearsByRegion = new HashMap<>(); +destroysByRegion = new HashMap<>
[geode] 03/13: PR.clear's event id should be created and used in BR (#4805)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 23954beddacb0fd883360739ae48fba6fa2c84f8 Author: Xiaojian Zhou AuthorDate: Mon Mar 16 17:35:35 2020 -0700 PR.clear's event id should be created and used in BR (#4805) * GEODE-7857: PR.clear's event id should be created and used in BR --- .../PartitionedRegionPersistentClearDUnitTest.java | 2 +- .../codeAnalysis/sanctionedDataSerializables.txt | 4 +- .../geode/internal/cache/PartitionedRegion.java| 8 +-- .../internal/cache/partitioned/ClearPRMessage.java | 12 ++-- .../internal/cache/PartitionedRegionTest.java | 65 ++ 5 files changed, 80 insertions(+), 11 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionPersistentClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionPersistentClearDUnitTest.java index 847699b..c758446 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionPersistentClearDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionPersistentClearDUnitTest.java @@ -21,6 +21,6 @@ import org.apache.geode.cache.RegionShortcut; public class PartitionedRegionPersistentClearDUnitTest extends PartitionedRegionClearDUnitTest { protected RegionShortcut getRegionShortCut() { -return RegionShortcut.PARTITION_REDUNDANT_PERSISTENT_OVERFLOW; +return RegionShortcut.PARTITION_REDUNDANT_PERSISTENT; } } diff --git a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt index bdeaf11..6dd3a34 100644 --- a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt +++ b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt @@ -1369,8 +1369,8 @@ fromData,27 toData,27 org/apache/geode/internal/cache/partitioned/ClearPRMessage,2 -fromData,19 -toData,36 +fromData,30 +toData,44 org/apache/geode/internal/cache/partitioned/ClearPRMessage$ClearReplyMessage,2 fromData,17 diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java index 1a1df20..312e951 100755 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java @@ -2189,7 +2189,7 @@ public class PartitionedRegion extends LocalRegion } // create ClearPRMessage per bucket -List clearMsgList = createClearPRMessages(); +List clearMsgList = createClearPRMessages(regionEvent.getEventId()); for (ClearPRMessage clearPRMessage : clearMsgList) { int bucketId = clearPRMessage.getBucketId(); checkReadiness(); @@ -2361,10 +2361,10 @@ public class PartitionedRegion extends LocalRegion } } - List createClearPRMessages() { + List createClearPRMessages(EventID eventID) { ArrayList clearMsgList = new ArrayList<>(); -for (int bucketId = 0; bucketId < this.totalNumberOfBuckets; bucketId++) { - ClearPRMessage clearPRMessage = new ClearPRMessage(bucketId); +for (int bucketId = 0; bucketId < getTotalNumberOfBuckets(); bucketId++) { + ClearPRMessage clearPRMessage = new ClearPRMessage(bucketId, eventID); clearMsgList.add(clearPRMessage); } return clearMsgList; diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ClearPRMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ClearPRMessage.java index 9fa8057..cc01920 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ClearPRMessage.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ClearPRMessage.java @@ -56,6 +56,8 @@ public class ClearPRMessage extends PartitionMessageWithDirectReply { private Integer bucketId; + private EventID eventID; + public static final String BUCKET_NON_PRIMARY_MESSAGE = "The bucket region on target member is no longer primary"; public static final String EXCEPTION_THROWN_DURING_CLEAR_OPERATION = @@ -71,8 +73,9 @@ public class ClearPRMessage extends PartitionMessageWithDirectReply { */ public ClearPRMessage() {} - public ClearPRMessage(int bucketId) { + public ClearPRMessage(int bucketId, EventID eventID) { this.bucketId = bucketId; +this.eventID = eventID; } public void initMessage(PartitionedRegion region, Set recipients, @@ -119,6 +122,7 @@ pub
[geode] 07/13: GEODE-7667: Add a 'clear' gfsh command for PR and RR clear (#4818)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 9bf176cc7822f7328fef80e9f0797293d6f4e98e Author: BenjaminPerryRoss <39068135+benjaminperryr...@users.noreply.github.com> AuthorDate: Tue May 5 11:40:34 2020 -0700 GEODE-7667: Add a 'clear' gfsh command for PR and RR clear (#4818) * Added clear command and modified remove functionality to clear PR Authored-by: Benjamin Ross --- .../geode/management/internal/i18n/CliStrings.java | 14 ++- .../cli/commands/ClearCommandDUnitTest.java| 120 + .../cli/commands/RemoveCommandDUnitTest.java | 13 ++- .../{RemoveCommand.java => ClearCommand.java} | 53 - .../cli/commands/CommandAvailabilityIndicator.java | 1 + .../internal/cli/commands/RemoveCommand.java | 9 +- .../internal/cli/domain/DataCommandResult.java | 12 +++ .../cli/functions/DataCommandFunction.java | 23 ++-- .../internal/cli/commands/ClearCommandTest.java| 115 9 files changed, 309 insertions(+), 51 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/i18n/CliStrings.java b/geode-core/src/main/java/org/apache/geode/management/internal/i18n/CliStrings.java index c354d030..6df013e 100644 --- a/geode-core/src/main/java/org/apache/geode/management/internal/i18n/CliStrings.java +++ b/geode-core/src/main/java/org/apache/geode/management/internal/i18n/CliStrings.java @@ -811,6 +811,14 @@ public class CliStrings { public static final String CLEAR_DEFINED_INDEX__SUCCESS__MSG = "Index definitions successfully cleared"; + /* clear region */ + public static final String CLEAR_REGION = "clear region"; + public static final String CLEAR_REGION_HELP = + "Clears/Removes all keys from the specified region."; + public static final String CLEAR_REGION_REGION_NAME = "name"; + public static final String CLEAR_REGION_REGION_NAME_HELP = "Region to clear keys from."; + public static final String CLEAR_REGION_CLEARED_ALL_KEYS = "Cleared all keys in the region"; + /* create region */ public static final String CREATE_REGION = "create region"; public static final String CREATE_REGION__HELP = @@ -1930,9 +1938,9 @@ public class CliStrings { public static final String REMOVE__MSG__KEY_EMPTY = "Key is Null"; public static final String REMOVE__MSG__REGION_NOT_FOUND = "Region <{0}> Not Found"; public static final String REMOVE__MSG__KEY_NOT_FOUND_REGION = "Key is not present in the region"; - public static final String REMOVE__MSG__CLEARED_ALL_CLEARS = "Cleared all keys in the region"; - public static final String REMOVE__MSG__CLEARALL_NOT_SUPPORTED_FOR_PARTITIONREGION = - "Option --" + REMOVE__ALL + " is not supported on partitioned region"; + public static final String REMOVE__MSG__CLEARALL_DEPRECATION_WARNING = + "Warning: The --all option for the 'remove' command is deprecated. Please" + + " use the 'clear' command instead."; /* resume gateway-sender */ public static final String RESUME_GATEWAYSENDER = "resume gateway-sender"; diff --git a/geode-gfsh/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ClearCommandDUnitTest.java b/geode-gfsh/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ClearCommandDUnitTest.java new file mode 100644 index 000..e51fc0f --- /dev/null +++ b/geode-gfsh/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ClearCommandDUnitTest.java @@ -0,0 +1,120 @@ +/* + * 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.management.internal.cli.commands; + +import static org.apache.geode.management.internal.cli.commands.RemoveCommand.REGION_NOT_FOUND; +import static org.apache.geode.management.internal.i18n.CliStrings.CLEAR_REGION_CLEARED_ALL_KEYS; +import static org.asser
[geode] 09/13: GEODE-7894: Moving expiry tasks to AbstractRegion.
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 43192d27213b458db38cdbf14f4cec7f484c717b Author: Nabarun Nag AuthorDate: Mon May 11 13:44:56 2020 -0700 GEODE-7894: Moving expiry tasks to AbstractRegion. --- .../src/main/java/org/apache/geode/internal/cache/AbstractRegion.java | 1 + .../src/main/java/org/apache/geode/internal/cache/LocalRegion.java | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java index 0364e17..ca75bf2 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java @@ -113,6 +113,7 @@ public abstract class AbstractRegion implements InternalRegion, AttributesMutato private static final Logger logger = LogService.getLogger(); private final ReentrantReadWriteLock readWriteLockForCacheLoader = new ReentrantReadWriteLock(); private final ReentrantReadWriteLock readWriteLockForCacheWriter = new ReentrantReadWriteLock(); + @VisibleForTesting protected final ConcurrentHashMap entryExpiryTasks = new ConcurrentHashMap<>(); /** diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java index dcf35fa..f43fa24 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java @@ -325,9 +325,6 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory, */ private int txRefCount; - @VisibleForTesting - final ConcurrentHashMap entryExpiryTasks = - new ConcurrentHashMap<>(); private volatile boolean regionInvalid;
[geode] 02/13: GEODE-7682: add PR.clear API (#4755)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 6174f70637eec6ea8a4894d8773a83f7e3443b31 Author: Xiaojian Zhou AuthorDate: Thu Mar 5 23:46:36 2020 -0800 GEODE-7682: add PR.clear API (#4755) * GEODE-7683: introduce BR.cmnClearRegion Co-authored-by: Xiaojian Zhou --- .../cache/PartitionedRegionClearDUnitTest.java | 218 + .../PartitionedRegionPersistentClearDUnitTest.java | 26 +++ ...itionedRegionSingleNodeOperationsJUnitTest.java | 66 --- .../codeAnalysis/sanctionedDataSerializables.txt | 4 +- .../org/apache/geode/internal/DSFIDFactory.java| 3 + .../geode/internal/cache/DistributedRegion.java| 9 - .../apache/geode/internal/cache/LocalRegion.java | 10 + .../geode/internal/cache/PartitionedRegion.java| 214 ++-- .../geode/internal/cache/RegionEventImpl.java | 5 + .../internal/cache/partitioned/ClearPRMessage.java | 166 +--- .../cache/partitioned/ClearPRMessageTest.java | 50 ++--- 11 files changed, 522 insertions(+), 249 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java new file mode 100644 index 000..fb2a81b --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java @@ -0,0 +1,218 @@ +/* + * 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.apache.geode.internal.Assert.fail; +import static org.apache.geode.test.dunit.rules.ClusterStartupRule.getCache; +import static org.apache.geode.test.dunit.rules.ClusterStartupRule.getClientCache; +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.Serializable; +import java.util.Properties; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.IntStream; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import org.apache.geode.cache.InterestResultPolicy; +import org.apache.geode.cache.PartitionAttributesFactory; +import org.apache.geode.cache.Region; +import org.apache.geode.cache.RegionEvent; +import org.apache.geode.cache.RegionShortcut; +import org.apache.geode.cache.client.ClientRegionShortcut; +import org.apache.geode.cache.util.CacheListenerAdapter; +import org.apache.geode.test.dunit.SerializableCallableIF; +import org.apache.geode.test.dunit.rules.ClientVM; +import org.apache.geode.test.dunit.rules.ClusterStartupRule; +import org.apache.geode.test.dunit.rules.MemberVM; + +public class PartitionedRegionClearDUnitTest implements Serializable { + protected static final String REGION_NAME = "testPR"; + protected static final int NUM_ENTRIES = 1000; + + protected int locatorPort; + protected MemberVM locator; + protected MemberVM dataStore1, dataStore2, dataStore3, accessor; + protected ClientVM client1, client2; + + private static final Logger logger = LogManager.getLogger(); + + @Rule + public ClusterStartupRule cluster = new ClusterStartupRule(7); + + @Before + public void setUp() throws Exception { +locator = cluster.startLocatorVM(0); +locatorPort = locator.getPort(); +dataStore1 = cluster.startServerVM(1, getProperties(), locatorPort); +dataStore2 = cluster.startServerVM(2, getProperties(), locatorPort); +dataStore3 = cluster.startServerVM(3, getProperties(), locatorPort); +accessor = cluster.startServerVM(4, getProperties(), locatorPort); +client1 = cluster.startClientVM(5, +c -> c.withPoolSubscription(true).withLocatorConnection((locatorPort))); +client2 = cluster.startClientVM(6, +c -> c.withPoolSubscription(true).withLocatorConnection((locatorPort))); +dataStore1.invoke(this::initDataStore); +dataStore2.invoke(this::initDataStore); +dataStore3.invoke(this::initD
[geode] 05/13: GEODE-7983: Clear region writer callbacks should not be invoked for bucket regions (#4954)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 32f59fc78357aa5fdd28358c716cc4d7e6f5f1b7 Author: Xiaojian Zhou AuthorDate: Tue Apr 14 10:50:21 2020 -0700 GEODE-7983: Clear region writer callbacks should not be invoked for bucket regions (#4954) --- .../cache/PartitionedRegionClearDUnitTest.java | 44 +- .../internal/cache/partitioned/ClearPRMessage.java | 2 +- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java index a5a22b9..e2e04eb 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearDUnitTest.java @@ -47,6 +47,7 @@ import org.apache.geode.test.dunit.rules.MemberVM; public class PartitionedRegionClearDUnitTest implements Serializable { protected static final String REGION_NAME = "testPR"; + protected static final int TOTAL_BUCKET_NUM = 10; protected static final int NUM_ENTRIES = 1000; protected int locatorPort; @@ -103,7 +104,8 @@ public class PartitionedRegionClearDUnitTest implements Serializable { private void initDataStore(boolean withWriter) { RegionFactory factory = getCache().createRegionFactory(getRegionShortCut()) -.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(10).create()); +.setPartitionAttributes( +new PartitionAttributesFactory().setTotalNumBuckets(TOTAL_BUCKET_NUM).create()); if (withWriter) { factory.setCacheWriter(new CountingCacheWriter()); } @@ -169,6 +171,26 @@ public class PartitionedRegionClearDUnitTest implements Serializable { return destroys; }; + SerializableCallableIF getBucketRegionWriterClears = () -> { +int clears = 0; +for (int i = 0; i < TOTAL_BUCKET_NUM; i++) { + String bucketRegionName = "_B__" + REGION_NAME + "_" + i; + clears += clearsByRegion.get(bucketRegionName) == null ? 0 + : clearsByRegion.get(bucketRegionName).get(); +} +return clears; + }; + + SerializableCallableIF getBucketRegionWriterDestroys = () -> { +int destroys = 0; +for (int i = 0; i < TOTAL_BUCKET_NUM; i++) { + String bucketRegionName = "_B__" + REGION_NAME + "_" + i; + destroys += destroysByRegion.get(bucketRegionName) == null ? 0 + : destroysByRegion.get(bucketRegionName).get(); +} +return destroys; + }; + void configureServers(boolean dataStoreWithWriter, boolean accessorWithWriter) { dataStore1.invoke(() -> initDataStore(dataStoreWithWriter)); dataStore2.invoke(() -> initDataStore(dataStoreWithWriter)); @@ -210,6 +232,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(1); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(0); + +assertThat(dataStore3.invoke(getBucketRegionWriterDestroys)) +.isEqualTo(dataStore3.invoke(getBucketRegionWriterClears)) +.isEqualTo(0); } @Test @@ -237,6 +263,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(0); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(1); + +assertThat(accessor.invoke(getBucketRegionWriterDestroys)) +.isEqualTo(accessor.invoke(getBucketRegionWriterClears)) +.isEqualTo(0); } @Test @@ -264,6 +294,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(0); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(1); + +assertThat(accessor.invoke(getBucketRegionWriterDestroys)) +.isEqualTo(accessor.invoke(getBucketRegionWriterClears)) +.isEqualTo(0); } @Test @@ -291,6 +325,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(1); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(0); + +assertThat(dataStore3.invoke(getBucketRegionWriterDestroys)) +.isEqualTo(dataStore3.invoke(getBucketRegionWriterClears)) +.isEqualTo(0); } @Test @@ -321,6 +359,10 @@ public class PartitionedRegionClearDUnitTest implements Serializable { .isEqualTo(1); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(0); + +assertThat(d
[geode] 10/13: GEODE-7667: Fixing test to include PR clear help text.
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 2e8c7a8ccbb8c7d60c69e0a70b3ca9205a529eb8 Author: Nabarun Nag AuthorDate: Mon May 11 16:52:50 2020 -0700 GEODE-7667: Fixing test to include PR clear help text. --- .../internal/cli/GfshParserAutoCompletionIntegrationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionIntegrationTest.java b/geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionIntegrationTest.java index 4c29427..3bc6a03 100644 --- a/geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionIntegrationTest.java +++ b/geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionIntegrationTest.java @@ -381,7 +381,7 @@ public class GfshParserAutoCompletionIntegrationTest { String hintArgument = "data"; String hintsProvided = gfshParserRule.getCommandManager().obtainHint(hintArgument); String[] hintsProvidedArray = hintsProvided.split(lineSeparator()); -assertThat(hintsProvidedArray.length).isEqualTo(17); +assertThat(hintsProvidedArray.length).isEqualTo(18); assertThat(hintsProvidedArray[0]) .isEqualTo("User data as stored in regions of the Geode distributed system."); }
[geode] 13/13: GEODE-8173: Add unit test (coverage) for PartitionedRegionClear class. (#5208)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit af4b35ae46fc63b178eb41f908c5f678d75068fa Author: agingade AuthorDate: Mon Jun 8 10:23:50 2020 -0700 GEODE-8173: Add unit test (coverage) for PartitionedRegionClear class. (#5208) * GEODE-8173: Add unit test (coverage) for PartitionedRegionClear class. Co-authored-by: anilkumar gingade --- .../cache/PRCacheListenerDistributedTest.java | 337 +++- .../ReplicateCacheListenerDistributedTest.java | 4 +- .../geode/internal/cache/PartitionedRegion.java| 2 +- .../internal/cache/PartitionedRegionClear.java | 83 ++- .../internal/cache/PartitionedRegionClearTest.java | 611 + 5 files changed, 999 insertions(+), 38 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java b/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java index f4a9ac9..7d95473 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java @@ -17,10 +17,18 @@ package org.apache.geode.cache; import static org.apache.geode.test.dunit.VM.getVM; import static org.apache.geode.test.dunit.VM.getVMCount; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.hamcrest.Matchers.anyOf; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.nullValue; +import java.io.Serializable; import java.util.Arrays; import java.util.Collection; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -28,7 +36,13 @@ import org.junit.runners.Parameterized.Parameter; import org.junit.runners.Parameterized.Parameters; import org.junit.runners.Parameterized.UseParametersRunnerFactory; +import org.apache.geode.cache.util.CacheListenerAdapter; import org.apache.geode.logging.internal.log4j.api.LogService; +import org.apache.geode.test.dunit.rules.CacheRule; +import org.apache.geode.test.dunit.rules.DistributedRule; +import org.apache.geode.test.dunit.rules.SharedCountersRule; +import org.apache.geode.test.dunit.rules.SharedErrorCollector; +import org.apache.geode.test.junit.rules.serializable.SerializableTestName; import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactory; /** @@ -43,7 +57,28 @@ import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactor @RunWith(Parameterized.class) @UseParametersRunnerFactory(CategoryWithParameterizedRunnerFactory.class) @SuppressWarnings("serial") -public class PRCacheListenerDistributedTest extends ReplicateCacheListenerDistributedTest { +public class PRCacheListenerDistributedTest implements Serializable { + + protected static final String CLEAR = "CLEAR"; + protected static final String REGION_DESTROY = "REGION_DESTROY"; + private static final String CREATES = "CREATES"; + private static final String UPDATES = "UPDATES"; + private static final String INVALIDATES = "INVALIDATES"; + private static final String DESTROYS = "DESTROYS"; + private static final int ENTRY_VALUE = 0; + private static final int UPDATED_ENTRY_VALUE = 1; + private static final String KEY = "key-1"; + @Rule + public DistributedRule distributedRule = new DistributedRule(); + @Rule + public CacheRule cacheRule = CacheRule.builder().createCacheInAll().build(); + @Rule + public SerializableTestName testName = new SerializableTestName(); + @Rule + public SharedCountersRule sharedCountersRule = new SharedCountersRule(); + @Rule + public SharedErrorCollector errorCollector = new SharedErrorCollector(); + protected String regionName; @Parameters public static Collection data() { @@ -59,7 +94,6 @@ public class PRCacheListenerDistributedTest extends ReplicateCacheListenerDistri @Parameter(1) public Boolean withData; - @Override protected Region createRegion(final String name, final CacheListener listener) { return createPartitionedRegion(name, listener, false); @@ -99,22 +133,18 @@ public class PRCacheListenerDistributedTest extends ReplicateCacheListenerDistri } } - @Override protected int expectedCreates() { return 1; } - @Override protected int expectedUpdates() { return 1; } - @Override protected int expectedInvalidates() { return 1; } - @Override protected int expectedDestroys() { return 1; } @@ -132,7 +162,8 @@ public class PRCacheListenerDistributedTest extends
[geode] 01/13: GEODE-7683: introduce BR.cmnClearRegion
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 3e8304cfa9df6645cb3082931ad4ff1ddd390dc1 Author: zhouxh AuthorDate: Mon Jan 27 17:02:48 2020 -0800 GEODE-7683: introduce BR.cmnClearRegion Co-authored-by: Xiaojian Zhou GEODE-7684: Create messaging class for PR Clear (#4689) * Added new message class and test Co-authored-by: Benjamin Ross Co-authored-by: Donal Evans --- .../codeAnalysis/sanctionedDataSerializables.txt | 8 + .../apache/geode/internal/cache/BucketRegion.java | 38 +- .../geode/internal/cache/DistributedRegion.java| 23 +- .../internal/cache/partitioned/ClearPRMessage.java | 388 + .../internal/cache/BucketRegionJUnitTest.java | 77 .../internal/cache/DistributedRegionJUnitTest.java | 18 + .../cache/partitioned/ClearPRMessageTest.java | 288 +++ .../serialization/DataSerializableFixedID.java | 3 + 8 files changed, 832 insertions(+), 11 deletions(-) diff --git a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt index 733737e..6dd3a34 100644 --- a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt +++ b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt @@ -1368,6 +1368,14 @@ org/apache/geode/internal/cache/partitioned/BucketSizeMessage$BucketSizeReplyMes fromData,27 toData,27 +org/apache/geode/internal/cache/partitioned/ClearPRMessage,2 +fromData,30 +toData,44 + +org/apache/geode/internal/cache/partitioned/ClearPRMessage$ClearReplyMessage,2 +fromData,17 +toData,17 + org/apache/geode/internal/cache/partitioned/ColocatedRegionDetails,2 fromData,81 toData,133 diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java index d91786f..e4fa7ef 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java @@ -557,6 +557,36 @@ public class BucketRegion extends DistributedRegion implements Bucket { } } + @Override + public void cmnClearRegion(RegionEventImpl regionEvent, boolean cacheWrite, boolean useRVV) { +if (!getBucketAdvisor().isPrimary()) { + if (logger.isDebugEnabled()) { +logger.debug("Not primary bucket when doing clear, do nothing"); + } + return; +} + +boolean enableRVV = useRVV && getConcurrencyChecksEnabled(); +RegionVersionVector rvv = null; +if (enableRVV) { + rvv = getVersionVector().getCloneForTransmission(); +} + +// get rvvLock +Set participants = +getCacheDistributionAdvisor().adviseInvalidateRegion(); +try { + obtainWriteLocksForClear(regionEvent, participants); + // no need to dominate my own rvv. + // Clear is on going here, there won't be GII for this member + clearRegionLocally(regionEvent, cacheWrite, null); + distributeClearOperation(regionEvent, rvv, participants); + + // TODO: call reindexUserDataRegion if there're lucene indexes +} finally { + releaseWriteLocksForClear(regionEvent, participants); +} + } long generateTailKey() { long key = eventSeqNum.addAndGet(partitionedRegion.getTotalNumberOfBuckets()); @@ -2093,11 +2123,9 @@ public class BucketRegion extends DistributedRegion implements Bucket { // if GII has failed, because there is not primary. So it's safe to set these // counters to 0. oldMemValue = bytesInMemory.getAndSet(0); -} - -else { - throw new InternalGemFireError( - "Trying to clear a bucket region that was not destroyed or in initialization."); +} else { + // BucketRegion's clear is supported now + oldMemValue = bytesInMemory.getAndSet(0); } if (oldMemValue != BUCKET_DESTROYED) { partitionedRegion.getPrStats().incDataStoreEntryCount(-sizeBeforeClear); diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java index b822dde..489d85a 100755 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java @@ -2013,6 +2013,10 @@ public class DistributedRegion extends LocalRegion implements InternalDistribute super.basicClear(regionEvent, cacheWrite); } + void distributeClearOperation(RegionEventImpl regionEvent,
[geode] branch feature/GEODE-7665 updated (4cd3917 -> af4b35a)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a change to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git. omit 4cd3917 GEODE-8173: Add unit test (coverage) for PartitionedRegionClear class. (#5208) omit cdcdc51 GEODE-7669 Test coverage for Partitioned Region clear with Overflow enabled (#5189) omit 93ff5f4 GEODE-7678 (2nd PR) - Support for cache-listener and client-notification for Partitioned Region Clear operation (#5124) omit 86ef373 GEODE-7667: Fixing test to include PR clear help text. omit edc4162 GEODE-7894: Moving expiry tasks to AbstractRegion. omit 19b9316 GEODE-7676: Conversion of duration to seconds. omit ef0c7ae GEODE-7667: Add a 'clear' gfsh command for PR and RR clear (#4818) omit 8930e7e GEODE-7676: Add PR clear with expiration tests (#4970) omit bdfd611 GEODE-7983: Clear region writer callbacks should not be invoked for bucket regions (#4954) omit be614cc GEODE-7912: cacheWriter should be triggered when PR.clear (#4882) omit 19a6079 PR.clear's event id should be created and used in BR (#4805) omit 41efe40 GEODE-7682: add PR.clear API (#4755) omit d757db8 GEODE-7683: introduce BR.cmnClearRegion add d82e30d GEODE-8243: Use java.exe on Windows in Launcher tests (#5241) add cb5990c GEODE-8221: Refactor tests to run in appropriate projects. (#5244) add 4477013 GEODE-8179: gfsh query cmd returns incorrect results if '=' sign is missing (#5187) add dd6a002 GEODE-8244: enable ignored redis tests (#5245) add e5426f7 change more string commands to have CommandFunction support (#5184) add 0f763ea GEODE-8099: add dlock around cms create/delete operations. (#5188) add 4789e8c GEODE-8242: Add HSTRLEN redis command (#5240) add 9e52198 GEODE-8253: Add additional concurrency tests for redis DEL (#5252) add b1107d2 GEODE-8144: setting SNI server name is not needed if endpoint verification is disabled (#5250) add 70fe060 GEODE-7896 Update tomcat support add bcbc53b Merge pull request #5110 from metatype/develop add a5c8164 GEODE-8260: add toString to RedisData classes (#5255) add d405e4b GEODE-8176: Move test to ClientServerMiscDUnitTest (#5238) add 7609cfa GEODE-8261: Added a null check for the proxyID. (#5251) add 8d5e3d4 GEODE-7864: Overriding hashCode when equals in overridden (#4866) add e159238 GEODE-8268: clean up ExecutionHandlerContext (#5237) add 86778ec GEODE-7591: Fix for hang in ClusterDistributionManager (#5182) add d1e857d GEODE-8270: Reorganize test packages to match main package structure (#5263) add 9fdd3d0 GEODE-8263: change SET command to reject KEEPTTL (#5258) add c93773f GEODE-8274: Improve readability of Version comparison. (#5266) add e955968 GEODE-8264: add serialization tests for RedisData classes (#5260) add 87a2f10 GEODE-8237: Add note about 'alter region' & cluster conf service (#5231) add a6640d7 GEODE-8277: acceptance test certificates expired in Dockerized SNI acceptance tests (#5274) add 9ea7a7c GEODE-8276: fix KEYS command to handle non-ASCII keys (#5272) add 3e7f2df GEODE-8269: Improve test coverage for redis (#5262) add 215643b GEODE-8216: Refactoring the test - moving the location of pausing senders. (#5259) add 720a4ca GEODE-8241: Locator observes locator-wait-time (#5236) add 84ab66b GEODE-8272 Refactor Restore Redundancy Command (#5249) add 18e5817 GEODE-8269: Improve test coverage (#5275) add 4a825a8 GEODE-8251: make sure Configuration can be deserialized post 1.12. (#5257) add 16e2c7b GEODE-8280: Return correct Redis AUTH errors (#5276) add 9939cc0 GEODE-8221: Commits session data prior to sending output to browser (#5246) add 3c52713 Add Mass Test Run pipeline. (#5271) add cd4477a GEODE-8284: Break up StringsIntegration test class (#5277) add 9f1bf04 GEODE-8273: Cleanup GfshExecution and GfshScript (#5267) add 91fd5f5 GEODE-8289: Add gradle task chaining for geode-old-versions:clean (#5283) add ca5d961 GEODE-8275: Improvements to mass-test-run after first pass deployment (#5287) add 210dc4f GEODE-8250: Geode Logging doc changes (#5294) add 5256fde GEODE-8288: Match Native Redis's glob-style pattern (#5282) add d740a70 GEODE-8239 - Add gradle config to add 'Class-Path' and 'Dependent-Modules' attirbutes to manifest file. (#5297) add ba6e44c GEODE-8250: Create new custom log config acceptance tests (#5268) add eed47f4 Fix metric-tools image python requirements. (#5298) add ab83b61 GEODE-8285: Change location of generated test file to build dir and fix error message path for sanctioned text file (#5280) add 5732a1c GEODE-8095 Further rework of the RestoreRedundancy data objects f
[geode] 11/13: GEODE-7678 (2nd PR) - Support for cache-listener and client-notification for Partitioned Region Clear operation (#5124)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit 8eeaac4b53a4a4dd3e91722855de6bcc6da04883 Author: agingade AuthorDate: Wed May 20 16:08:07 2020 -0700 GEODE-7678 (2nd PR) - Support for cache-listener and client-notification for Partitioned Region Clear operation (#5124) * GEODE-7678: Add support for cache listener and client notification for PR clear The changes are made to PR clear messaging and locking mechanism to preserve cache-listener and client-events ordering during concurrent cache operation while clear in progress. --- .../integrationTest/resources/assembly_content.txt | 1 + .../cache/PRCacheListenerDistributedTest.java | 250 +++- .../ReplicateCacheListenerDistributedTest.java | 111 +- ...ionedRegionAfterClearNotificationDUnitTest.java | 372 ++ .../cache/PartitionedRegionClearDUnitTest.java | 1 - ...titionedRegionClearWithExpirationDUnitTest.java | 69 ++-- ...itionedRegionClearWithExpirationDUnitTest.java} | 58 +-- .../cache/PartitionedRegionIntegrationTest.java| 45 +++ .../codeAnalysis/sanctionedDataSerializables.txt | 8 + .../PartitionedRegionPartialClearException.java| 37 ++ .../main/java/org/apache/geode/cache/Region.java | 4 +- .../org/apache/geode/internal/DSFIDFactory.java| 5 + .../apache/geode/internal/cache/BucketAdvisor.java | 2 +- .../apache/geode/internal/cache/BucketRegion.java | 17 +- .../internal/cache/DistributedClearOperation.java | 10 +- .../geode/internal/cache/DistributedRegion.java| 9 +- .../geode/internal/cache/InternalRegion.java | 3 + .../apache/geode/internal/cache/LocalRegion.java | 3 +- .../geode/internal/cache/PartitionedRegion.java| 217 ++- .../internal/cache/PartitionedRegionClear.java | 419 + .../cache/PartitionedRegionClearMessage.java | 287 ++ .../internal/cache/PartitionedRegionDataStore.java | 8 + .../internal/cache/partitioned/RegionAdvisor.java | 11 + .../sanctioned-geode-core-serializables.txt| 2 + .../internal/cache/BucketRegionJUnitTest.java | 4 +- .../internal/cache/PartitionedRegionTest.java | 39 -- .../serialization/DataSerializableFixedID.java | 2 + 27 files changed, 1679 insertions(+), 315 deletions(-) diff --git a/geode-assembly/src/integrationTest/resources/assembly_content.txt b/geode-assembly/src/integrationTest/resources/assembly_content.txt index 7173275..387cd4b 100644 --- a/geode-assembly/src/integrationTest/resources/assembly_content.txt +++ b/geode-assembly/src/integrationTest/resources/assembly_content.txt @@ -221,6 +221,7 @@ javadoc/org/apache/geode/cache/PartitionAttributes.html javadoc/org/apache/geode/cache/PartitionAttributesFactory.html javadoc/org/apache/geode/cache/PartitionResolver.html javadoc/org/apache/geode/cache/PartitionedRegionDistributionException.html +javadoc/org/apache/geode/cache/PartitionedRegionPartialClearException.html javadoc/org/apache/geode/cache/PartitionedRegionStorageException.html javadoc/org/apache/geode/cache/Region.Entry.html javadoc/org/apache/geode/cache/Region.html diff --git a/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java b/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java index 559def7..f4a9ac9 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/cache/PRCacheListenerDistributedTest.java @@ -14,14 +14,21 @@ */ package org.apache.geode.cache; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.apache.geode.test.dunit.VM.getVMCount; +import static org.assertj.core.api.Assertions.assertThat; + import java.util.Arrays; +import java.util.Collection; +import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameter; import org.junit.runners.Parameterized.Parameters; import org.junit.runners.Parameterized.UseParametersRunnerFactory; +import org.apache.geode.logging.internal.log4j.api.LogService; import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactory; /** @@ -38,28 +45,60 @@ import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactor @SuppressWarnings("serial") public class PRCacheListenerDistributedTest extends ReplicateCacheListenerDistributedTest { - @Parameters(name = "{index}: redundancy={0}") - public static Iterable data() { -return Arrays.asList(0, 3); + @Parameters + public static Collection data() { +return Arrays.asList(new Object[][] { +{1, Boolean.FALSE}, +{3, Boolean.TRUE}, +});
[geode] 12/13: GEODE-7669 Test coverage for Partitioned Region clear with Overflow enabled (#5189)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit b49e67cb9dee328221d7052d4b8c8f70c9210929 Author: Jianxia Chen <11181423+jche...@users.noreply.github.com> AuthorDate: Thu Jun 4 11:39:04 2020 -0700 GEODE-7669 Test coverage for Partitioned Region clear with Overflow enabled (#5189) Authored-by: Jianxia Chen --- .../PartitionedRegionOverflowClearDUnitTest.java | 380 + 1 file changed, 380 insertions(+) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionOverflowClearDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionOverflowClearDUnitTest.java new file mode 100644 index 000..c10d1db --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionOverflowClearDUnitTest.java @@ -0,0 +1,380 @@ +/* + * 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.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT; +import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER; +import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT; +import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE; +import static org.apache.geode.distributed.ConfigurationProperties.MAX_WAIT_TIME_RECONNECT; +import static org.apache.geode.distributed.ConfigurationProperties.MEMBER_TIMEOUT; +import static org.apache.geode.distributed.ConfigurationProperties.USE_CLUSTER_CONFIGURATION; +import static org.apache.geode.internal.AvailablePortHelper.getRandomAvailableTCPPorts; +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.apache.geode.test.dunit.VM.getVMId; +import static org.apache.geode.test.dunit.VM.toArray; +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.File; +import java.io.Serializable; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.IntStream; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import org.apache.geode.cache.DiskStoreFactory; +import org.apache.geode.cache.EvictionAction; +import org.apache.geode.cache.EvictionAttributes; +import org.apache.geode.cache.PartitionAttributesFactory; +import org.apache.geode.cache.Region; +import org.apache.geode.cache.RegionShortcut; +import org.apache.geode.cache.client.ClientCache; +import org.apache.geode.cache.client.ClientCacheFactory; +import org.apache.geode.cache.client.ClientRegionShortcut; +import org.apache.geode.distributed.LocatorLauncher; +import org.apache.geode.distributed.ServerLauncher; +import org.apache.geode.distributed.internal.InternalLocator; +import org.apache.geode.management.internal.cli.util.CommandStringBuilder; +import org.apache.geode.test.dunit.AsyncInvocation; +import org.apache.geode.test.dunit.VM; +import org.apache.geode.test.dunit.rules.DistributedRule; +import org.apache.geode.test.junit.rules.GfshCommandRule; +import org.apache.geode.test.junit.rules.serializable.SerializableTemporaryFolder; + +public class PartitionedRegionOverflowClearDUnitTest implements Serializable { + + @Rule + public DistributedRule distributedRule = new DistributedRule(5); + + @Rule + public SerializableTemporaryFolder temporaryFolder = new SerializableTemporaryFolder(); + + @Rule + public transient GfshCommandRule gfsh = new GfshCommandRule(); + + private VM locator; + private VM server1; + private VM server2; + private VM accessor; + private VM client; + + private static final String LOCATOR_NAME = "locator"; + private static final String SERVER1_NAME = "
[geode] 08/13: GEODE-7676: Conversion of duration to seconds.
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch feature/GEODE-7665 in repository https://gitbox.apache.org/repos/asf/geode.git commit c78064a23c9897b39056a78ffdcec53bb5b80266 Author: Nabarun Nag AuthorDate: Mon May 11 12:24:16 2020 -0700 GEODE-7676: Conversion of duration to seconds. --- .../internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java index 33301f4..7f3dff9 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearWithExpirationDUnitTest.java @@ -298,7 +298,7 @@ public class PartitionedRegionClearWithExpirationDUnitTest implements Serializab public void clearShouldRemoveRegisteredExpirationTasks(TestVM coordinatorVM, RegionShortcut regionShortcut) { final int entries = 500; -int expirationTime = (int) GeodeAwaitility.getTimeout().getValueInMS() / 1000; +int expirationTime = (int) GeodeAwaitility.getTimeout().getSeconds(); parametrizedSetup(regionShortcut, new ExpirationAttributes(expirationTime, DESTROY)); populateRegion(accessor, entries, asList(accessor, server1, server2));
[geode] branch develop updated (16a3d1e -> 1904a71)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from 16a3d1e GEODE-8516: Add Redis tests for multiple subscriptions for the same client (#5535) add 1904a71 GEODE-8523: Session state document update (#5546) No new revisions were added by this update. Summary of changes: .../http_session_mgmt/tomcat_installing_the_module.html.md.erb | 2 ++ .../weblogic_setting_up_the_module.html.md.erb | 10 -- 2 files changed, 10 insertions(+), 2 deletions(-)
[geode] branch develop updated (16a3d1e -> 1904a71)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from 16a3d1e GEODE-8516: Add Redis tests for multiple subscriptions for the same client (#5535) add 1904a71 GEODE-8523: Session state document update (#5546) No new revisions were added by this update. Summary of changes: .../http_session_mgmt/tomcat_installing_the_module.html.md.erb | 2 ++ .../weblogic_setting_up_the_module.html.md.erb | 10 -- 2 files changed, 10 insertions(+), 2 deletions(-)
[geode-kafka-connector] 02/02: Preparing for the 1.0.0 release.
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch support/1.0 in repository https://gitbox.apache.org/repos/asf/geode-kafka-connector.git commit 54593d2d0135f7058116daefe6d1bec6309e44ff Author: Nabarun Nag AuthorDate: Wed Oct 14 16:46:40 2020 -0700 Preparing for the 1.0.0 release. * This build has been sent to Confluent to be hosted in the HUB. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1b3a3a2..a91c77e 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ HEAD -1.0-SNAPSHOT +1.0.0 1.9.0
[geode-kafka-connector] branch support/1.0 created (now 54593d2)
This is an automated email from the ASF dual-hosted git repository. nnag pushed a change to branch support/1.0 in repository https://gitbox.apache.org/repos/asf/geode-kafka-connector.git. at 54593d2 Preparing for the 1.0.0 release. This branch includes the following new commits: new dd31ea3 Fixed spotless errors new 54593d2 Preparing for the 1.0.0 release. The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[geode-kafka-connector] 01/02: Fixed spotless errors
This is an automated email from the ASF dual-hosted git repository. nnag pushed a commit to branch support/1.0 in repository https://gitbox.apache.org/repos/asf/geode-kafka-connector.git commit dd31ea3d1416933c40adc6edcbb817fa7c77e710 Author: Nabarun Nag AuthorDate: Wed Oct 14 14:19:33 2020 -0700 Fixed spotless errors --- src/main/java/org/apache/geode/kafka/GeodeContext.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/geode/kafka/GeodeContext.java b/src/main/java/org/apache/geode/kafka/GeodeContext.java index 2fabceb..595e3c8 100644 --- a/src/main/java/org/apache/geode/kafka/GeodeContext.java +++ b/src/main/java/org/apache/geode/kafka/GeodeContext.java @@ -21,6 +21,8 @@ import static org.apache.geode.kafka.utils.GeodeConfigurationConstants.SECURITY_ import java.util.List; import org.apache.kafka.connect.errors.ConnectException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.geode.cache.client.ClientCache; import org.apache.geode.cache.client.ClientCacheFactory; @@ -30,8 +32,6 @@ import org.apache.geode.cache.query.CqExistsException; import org.apache.geode.cache.query.CqQuery; import org.apache.geode.cache.query.CqResults; import org.apache.geode.cache.query.RegionNotFoundException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class GeodeContext {
geode git commit: GEODE-2530: Added DUnit tests to test Lucene pagination in persistent PR.
Repository: geode Updated Branches: refs/heads/develop 42f733fc3 -> c35f442c2 GEODE-2530: Added DUnit tests to test Lucene pagination in persistent PR. * when the only dataStore goes offline while paginating results * when one dataStore goes offline while one is still operating while paginating * alternatively shutting and starting dataStores while paginating results Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/c35f442c Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/c35f442c Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/c35f442c Branch: refs/heads/develop Commit: c35f442c217eb867f8550890b6809dfb90a92344 Parents: 42f733f Author: nabarun Authored: Thu Feb 23 14:10:37 2017 -0800 Committer: nabarun Committed: Thu Feb 23 16:35:11 2017 -0800 -- .../geode/cache/lucene/LuceneDUnitTest.java | 2 + .../geode/cache/lucene/PaginationDUnitTest.java | 207 +++ 2 files changed, 209 insertions(+) -- http://git-wip-us.apache.org/repos/asf/geode/blob/c35f442c/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneDUnitTest.java -- diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneDUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneDUnitTest.java index 6d8278e..db48294 100644 --- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneDUnitTest.java +++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneDUnitTest.java @@ -75,6 +75,8 @@ public abstract class LuceneDUnitTest extends JUnit4CacheTestCase { public enum RegionTestableType { PARTITION(RegionShortcut.PARTITION_PROXY, RegionShortcut.PARTITION), +PARTITION_REDUNDANT_PERSISTENT(RegionShortcut.PARTITION_PROXY_REDUNDANT, +RegionShortcut.PARTITION_REDUNDANT_PERSISTENT), PARTITION_PERSISTENT(RegionShortcut.PARTITION_PROXY, RegionShortcut.PARTITION_PERSISTENT), PARTITION_REDUNDANT(RegionShortcut.PARTITION_PROXY_REDUNDANT, RegionShortcut.PARTITION_REDUNDANT), http://git-wip-us.apache.org/repos/asf/geode/blob/c35f442c/geode-lucene/src/test/java/org/apache/geode/cache/lucene/PaginationDUnitTest.java -- diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/PaginationDUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/PaginationDUnitTest.java new file mode 100644 index 000..cfde4f2 --- /dev/null +++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/PaginationDUnitTest.java @@ -0,0 +1,207 @@ +/* + * 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.cache.lucene; + +import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.INDEX_NAME; +import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.REGION_NAME; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.apache.geode.cache.Cache; +import org.apache.geode.cache.Region; +import org.apache.geode.test.dunit.Assert; +import org.apache.geode.test.dunit.SerializableRunnableIF; +import org.apache.geode.test.junit.categories.DistributedTest; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.runner.RunWith; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; + +@Category(DistributedTest.class) +@RunWith(JUnitParamsRunner.class) +public class PaginationDUnitTest extends LuceneQueriesAccessorBase { + protected final static int PAGE_SIZE = 2; + protected final static int FLUSH_WAIT_TIME_MS = 6; + + @Override + protected RegionTestableType[] getListOfRegionTestTypes() { +return new RegionTestableType[] {RegionTestableType.PARTITION_REDUNDANT
geode git commit: GEODE-2572: getCache method implemented for LuceneService
Repository: geode Updated Branches: refs/heads/develop 812765920 -> ab5650672 GEODE-2572: getCache method implemented for LuceneService * getCache method implemented for LuceneService * simple integration test to validate the result of LuceneService.getCache Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/ab565067 Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/ab565067 Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/ab565067 Branch: refs/heads/develop Commit: ab5650672077bd52109e2687ab9d91384a3fe12b Parents: 8127659 Author: nabarunnag Authored: Wed Mar 1 22:44:55 2017 -0800 Committer: nabarunnag Committed: Wed Mar 1 22:44:55 2017 -0800 -- .../java/org/apache/geode/cache/lucene/LuceneService.java | 9 + .../geode/cache/lucene/internal/LuceneServiceImpl.java | 5 + .../lucene/internal/LuceneServiceImplIntegrationTest.java | 9 + 3 files changed, 23 insertions(+) -- http://git-wip-us.apache.org/repos/asf/geode/blob/ab565067/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneService.java -- diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneService.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneService.java index 5cfae59..704abcd 100644 --- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneService.java +++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneService.java @@ -18,6 +18,7 @@ import java.util.Collection; import java.util.Map; import java.util.concurrent.TimeUnit; +import org.apache.geode.cache.Cache; import org.apache.lucene.analysis.Analyzer; import org.apache.geode.annotations.Experimental; @@ -138,6 +139,14 @@ public interface LuceneService { public LuceneQueryFactory createLuceneQueryFactory(); /** + * returns the cache to which the LuceneService belongs + * + * @return Cache + */ + public Cache getCache(); + + + /** * wait until the current entries in cache are indexed * * @param indexName index name http://git-wip-us.apache.org/repos/asf/geode/blob/ab565067/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneServiceImpl.java -- diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneServiceImpl.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneServiceImpl.java index a1a6ef3..5c908f5 100644 --- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneServiceImpl.java +++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneServiceImpl.java @@ -81,6 +81,11 @@ public class LuceneServiceImpl implements InternalLuceneService { } + @Override + public Cache getCache() { +return this.cache; + } + public void init(final Cache cache) { if (cache == null) { throw new IllegalStateException(LocalizedStrings.CqService_CACHE_IS_NULL.toLocalizedString()); http://git-wip-us.apache.org/repos/asf/geode/blob/ab565067/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneServiceImplIntegrationTest.java -- diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneServiceImplIntegrationTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneServiceImplIntegrationTest.java index 9b382e6..80d9324 100644 --- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneServiceImplIntegrationTest.java +++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneServiceImplIntegrationTest.java @@ -34,6 +34,7 @@ import org.junit.rules.ExpectedException; import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; @Category(IntegrationTest.class) public class LuceneServiceImplIntegrationTest { @@ -52,6 +53,14 @@ public class LuceneServiceImplIntegrationTest { assertNotNull(luceneService); } + @Test + public void getCacheShouldReturnTheCorrectCache() { +cache = getCache(); +new LuceneServiceImpl().init(cache); +LuceneService service = LuceneServiceProvider.get(cache); +assertTrue(service.getCache().equals(cache)); + } + // lucene service will register query execution function on initialization @Test public void shouldRegisterQueryFunction() {
geode git commit: GEODE-2596: Lucene metrics moved to public API
Repository: geode Updated Branches: refs/heads/develop eb59268bc -> 946ff6ee4 GEODE-2596: Lucene metrics moved to public API * LuceneIndexMetrics and LuceneServiceMXBean were moved to org.apache.geode.cache.lucene.management * They are now public API This closes #414 Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/946ff6ee Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/946ff6ee Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/946ff6ee Branch: refs/heads/develop Commit: 946ff6ee49f8061dc7f3c11b43bf823b4314b109 Parents: eb59268 Author: nabarun Authored: Mon Mar 6 11:59:33 2017 -0800 Committer: nabarun Committed: Mon Mar 6 16:25:24 2017 -0800 -- .../internal/management/LuceneIndexMetrics.java | 190 --- .../management/LuceneIndexStatsMonitor.java | 2 +- .../management/LuceneServiceBridge.java | 2 +- .../internal/management/LuceneServiceMBean.java | 2 + .../management/LuceneServiceMXBean.java | 58 -- .../lucene/management/LuceneIndexMetrics.java | 190 +++ .../lucene/management/LuceneServiceMXBean.java | 58 ++ .../management/LuceneManagementDUnitTest.java | 2 + 8 files changed, 254 insertions(+), 250 deletions(-) -- http://git-wip-us.apache.org/repos/asf/geode/blob/946ff6ee/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneIndexMetrics.java -- diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneIndexMetrics.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneIndexMetrics.java deleted file mode 100644 index 999d8b3..000 --- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneIndexMetrics.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * 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.cache.lucene.internal.management; - -import java.beans.ConstructorProperties; - -public class LuceneIndexMetrics { - - private final String regionPath; - - private final String indexName; - - private final int queryExecutions; - - private final long queryExecutionTime; - - private final float queryRate; - - private final long queryRateAverageLatency; - - private final int queryExecutionsInProgress; - - private final long queryExecutionTotalHits; - - private final int updates; - - private final long updateTime; - - private final float updateRate; - - private final long updateRateAverageLatency; - - private final int updatesInProgress; - - private final int commits; - - private final long commitTime; - - private final float commitRate; - - private final long commitRateAverageLatency; - - private final int commitsInProgress; - - private final int documents; - - /** - * This constructor is to be used by internal JMX framework only. A user should not try to create - * an instance of this class. - */ - @ConstructorProperties({"regionPath", "indexName", "queryExecutions", "queryExecutionTime", - "queryRate", "queryRateAverageLatency", "queryExecutionsInProgress", - "queryExecutionTotalHits", "updates", "updateTime", "updateRate", "updateRateAverageLatency", - "updatesInProgress", "commits", "commitTime", "commitRate", "commitRateAverageLatency", - "commitsInProgress", "documents"}) - public LuceneIndexMetrics(String regionPath, String indexName, int queryExecutions, - long queryExecutionTime, float queryRate, long queryRateAverageLatency, - int queryExecutionsInProgress, long queryExecutionTotalHits, int updates, long updateTime, - float updateRate, long updateRateAverageLatency, int updatesInProgress, int commits, - long commitTime, float commitRate, long commitRateAverageLatency, int commitsInProgress, - int documents) { -this.regionPath = regionPath; -this.indexName = indexName; -this.queryExecutions = queryExecutions; -th
[1/2] geode git commit: GEODE-2604: Added javadoc comments to LuceneIndexMetrics.java
Repository: geode Updated Branches: refs/heads/develop 946ff6ee4 -> 9321c0ea4 GEODE-2604: Added javadoc comments to LuceneIndexMetrics.java Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/9d597dce Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/9d597dce Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/9d597dce Branch: refs/heads/develop Commit: 9d597dce47c3f9edc52cab0b70d9ca912a0c94d2 Parents: 946ff6e Author: nabarun Authored: Mon Mar 6 16:51:01 2017 -0800 Committer: nabarun Committed: Mon Mar 6 16:51:01 2017 -0800 -- .../lucene/management/LuceneIndexMetrics.java | 102 +++ 1 file changed, 102 insertions(+) -- http://git-wip-us.apache.org/repos/asf/geode/blob/9d597dce/geode-lucene/src/main/java/org/apache/geode/cache/lucene/management/LuceneIndexMetrics.java -- diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/management/LuceneIndexMetrics.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/management/LuceneIndexMetrics.java index de89758..8b69ed5 100644 --- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/management/LuceneIndexMetrics.java +++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/management/LuceneIndexMetrics.java @@ -14,6 +14,8 @@ */ package org.apache.geode.cache.lucene.management; +import org.apache.geode.cache.lucene.LuceneIndex; + import java.beans.ConstructorProperties; public class LuceneIndexMetrics { @@ -92,82 +94,182 @@ public class LuceneIndexMetrics { this.documents = documents; } + /** + * Returns the {@link String} path for the region on which the {@link LuceneIndex} is created + * + * @return String value of the region path on the Lucene Index is created + */ public String getRegionPath() { return this.regionPath; } + /** + * Returns the {@link String} name of the {@link LuceneIndex} created + * + * @return String value of the index name + */ public String getIndexName() { return this.indexName; } + /** + * Returns the number of query executions using the {@link LuceneIndex} + * + * @return Number of queries executed using this Lucene index + */ public int getQueryExecutions() { return this.queryExecutions; } + /** + * Returns the time duration for execution of queries using the {@link LuceneIndex} + * + * @return long value for the time consumed in the execution of queries using this Lucene Index + */ public long getQueryExecutionTime() { return this.queryExecutionTime; } + /** + * Returns the rate of query execution using the {@link LuceneIndex} + * + * @return the rate of query execution using the Lucene Index + */ public float getQueryRate() { return this.queryRate; } + /** + * Returns the average latency for query executions using the {@link LuceneIndex} + * + * @return the average latency for query executions using the Lucene Index + */ public long getQueryRateAverageLatency() { return this.queryRateAverageLatency; } + /** + * Returns the number of query executions in progress which are using the {@link LuceneIndex} + * + * @return the number of query executions in progress which are using the Lucene Index + */ public int getQueryExecutionsInProgress() { return this.queryExecutionsInProgress; } + /** + * Returns the number of hits for the query execution using the {@link LuceneIndex} + * + * @return the number of hit for the query execution using the Lucene Index + */ public long getQueryExecutionTotalHits() { return this.queryExecutionTotalHits; } + /** + * Returns the number of update operations on the {@link LuceneIndex} + * + * @return the number of update operations on the Lucene Index + */ public int getUpdates() { return this.updates; } + /** + * Returns the time consumed for the update operations on the {@link LuceneIndex} + * + * @return the time consumed for the update operations on the Lucene Index + */ public long getUpdateTime() { return this.updateTime; } + /** + * Returns the rate at which update operations are executed on the {@link LuceneIndex} + * + * @return rate at which update operations are executed on the {@link LuceneIndex} + */ public float getUpdateRate() { return this.updateRate; } + /** + * Returns the average latency for the update operations on the {@link LuceneIndex} + * + * @return the average latency for the update operations on the Lucene Index + */ public long getUpdateRateAverageLatency() { return this.updateRateAverageLatency; } + /** + * Returns the number of update operati
[2/2] geode git commit: GEODE-2604: Added measurement units to the javadoc comments
GEODE-2604: Added measurement units to the javadoc comments This closes #415 Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/9321c0ea Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/9321c0ea Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/9321c0ea Branch: refs/heads/develop Commit: 9321c0ea46a4e023edebd6c0e14355fda4ec4313 Parents: 9d597dc Author: nabarun Authored: Mon Mar 6 17:30:07 2017 -0800 Committer: nabarun Committed: Mon Mar 6 17:36:04 2017 -0800 -- .../lucene/management/LuceneIndexMetrics.java | 22 +++- 1 file changed, 12 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/geode/blob/9321c0ea/geode-lucene/src/main/java/org/apache/geode/cache/lucene/management/LuceneIndexMetrics.java -- diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/management/LuceneIndexMetrics.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/management/LuceneIndexMetrics.java index 8b69ed5..24d14c1 100644 --- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/management/LuceneIndexMetrics.java +++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/management/LuceneIndexMetrics.java @@ -124,7 +124,8 @@ public class LuceneIndexMetrics { /** * Returns the time duration for execution of queries using the {@link LuceneIndex} * - * @return long value for the time consumed in the execution of queries using this Lucene Index + * @return long value for the time in nanoseconds consumed in the execution of queries using this + * Lucene Index */ public long getQueryExecutionTime() { return this.queryExecutionTime; @@ -142,7 +143,7 @@ public class LuceneIndexMetrics { /** * Returns the average latency for query executions using the {@link LuceneIndex} * - * @return the average latency for query executions using the Lucene Index + * @return the average latency for query executions in nanoseconds using the Lucene Index */ public long getQueryRateAverageLatency() { return this.queryRateAverageLatency; @@ -160,7 +161,7 @@ public class LuceneIndexMetrics { /** * Returns the number of hits for the query execution using the {@link LuceneIndex} * - * @return the number of hit for the query execution using the Lucene Index + * @return the number of hits for the query execution using the Lucene Index */ public long getQueryExecutionTotalHits() { return this.queryExecutionTotalHits; @@ -178,7 +179,7 @@ public class LuceneIndexMetrics { /** * Returns the time consumed for the update operations on the {@link LuceneIndex} * - * @return the time consumed for the update operations on the Lucene Index + * @return the time consumed in nanoseconds for the update operations on the Lucene Index */ public long getUpdateTime() { return this.updateTime; @@ -196,7 +197,7 @@ public class LuceneIndexMetrics { /** * Returns the average latency for the update operations on the {@link LuceneIndex} * - * @return the average latency for the update operations on the Lucene Index + * @return the average latency for the update operations in nanoseconds on the Lucene Index */ public long getUpdateRateAverageLatency() { return this.updateRateAverageLatency; @@ -212,9 +213,9 @@ public class LuceneIndexMetrics { } /** - * Returns the number of commit operation executed on the {@link LuceneIndex} + * Returns the number of commit operations executed on the {@link LuceneIndex} * - * @return the number of commit operation executed on the Lucene Index + * @return the number of commit operations executed on the Lucene Index */ public int getCommits() { return this.commits; @@ -223,7 +224,7 @@ public class LuceneIndexMetrics { /** * Returns the time consumed by the commit operations on the {@link LuceneIndex} * - * @return the time consumed by the commit operations on the Lucene Index + * @return the time consumed in nanoseconds by the commit operations on the Lucene Index */ public long getCommitTime() { return this.commitTime; @@ -241,7 +242,8 @@ public class LuceneIndexMetrics { /** * Returns the average latency for the commit operations using the {@link LuceneIndex} * - * @return Returns the average latency for the commit operations using the Lucene Index + * @return Returns the average latency for the commit operations in nanoseconds using the Lucene + * Index */ public long getCommitRateAverageLatency() { return this.commitRateAverageLatency; @@ -268,7 +270,7 @@ public class LuceneIndexMetrics { /** * Outputs the string mess
geode git commit: GEODE-2618: PrimaryBucketExceptions handled in LuceneQueryFunction.execute
Repository: geode Updated Branches: refs/heads/develop 27995d6cc -> cd45e5062 GEODE-2618: PrimaryBucketExceptions handled in LuceneQueryFunction.execute * PrimaryBucketException while executing a LuceneQuery will now be caught and wrapped as a InternalFunctionInvocationTargetException * This will trigger a re-execution of the LuceneQuery on the member which will have the primary bucket. This closes #416 Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/cd45e506 Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/cd45e506 Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/cd45e506 Branch: refs/heads/develop Commit: cd45e50621da4aa0d664d375c28ab081220d77f7 Parents: 27995d6 Author: nabarun Authored: Tue Mar 7 14:55:54 2017 -0800 Committer: nabarun Committed: Fri Mar 10 13:49:26 2017 -0800 -- .../cache/lucene/internal/distributed/LuceneQueryFunction.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/geode/blob/cd45e506/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunction.java -- diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunction.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunction.java index e3b5297..428301f 100644 --- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunction.java +++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunction.java @@ -23,6 +23,7 @@ import org.apache.geode.cache.CacheClosedException; import org.apache.geode.cache.execute.Function; import org.apache.geode.cache.lucene.internal.LuceneIndexImpl; import org.apache.geode.cache.lucene.internal.LuceneIndexStats; +import org.apache.geode.internal.cache.PrimaryBucketException; import org.apache.geode.internal.cache.execute.InternalFunctionInvocationTargetException; import org.apache.logging.log4j.Logger; import org.apache.lucene.search.Query; @@ -112,7 +113,8 @@ public class LuceneQueryFunction implements Function, InternalEntity { } stats.incNumberOfQueryExecuted(); resultSender.lastResult(mergedResult); -} catch (IOException | BucketNotFoundException | CacheClosedException e) { +} catch (IOException | BucketNotFoundException | CacheClosedException +| PrimaryBucketException e) { logger.debug("Exception during lucene query function", e); throw new InternalFunctionInvocationTargetException(e); }
geode git commit: GEODE-2618: Fixing spotlessApply errors
Repository: geode Updated Branches: refs/heads/develop cd45e5062 -> f69d86c98 GEODE-2618: Fixing spotlessApply errors Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/f69d86c9 Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/f69d86c9 Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/f69d86c9 Branch: refs/heads/develop Commit: f69d86c981fbc180f001e555cb2d475c7d25aac5 Parents: cd45e50 Author: nabarun Authored: Fri Mar 10 13:55:19 2017 -0800 Committer: nabarun Committed: Fri Mar 10 13:55:19 2017 -0800 -- .../geode/cache/client/internal/ConnectionPoolImplJUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/geode/blob/f69d86c9/geode-core/src/test/java/org/apache/geode/cache/client/internal/ConnectionPoolImplJUnitTest.java -- diff --git a/geode-core/src/test/java/org/apache/geode/cache/client/internal/ConnectionPoolImplJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/client/internal/ConnectionPoolImplJUnitTest.java index 45a4494..d99b31a 100644 --- a/geode-core/src/test/java/org/apache/geode/cache/client/internal/ConnectionPoolImplJUnitTest.java +++ b/geode-core/src/test/java/org/apache/geode/cache/client/internal/ConnectionPoolImplJUnitTest.java @@ -150,7 +150,7 @@ public class ConnectionPoolImplJUnitTest { } LiveServerPinger lsp = new LiveServerPinger(pool); long NANOS_PER_MS = 100L; -assertEquals(((pool.getPingInterval() + 1)/ 2) * NANOS_PER_MS, lsp.pingIntervalNanos ); +assertEquals(((pool.getPingInterval() + 1) / 2) * NANOS_PER_MS, lsp.pingIntervalNanos); } @Test
geode git commit: GEODE-2620: Rate stats removed from LuceneIndexMetrics
Repository: geode Updated Branches: refs/heads/develop f69d86c98 -> 0f48fa3f7 GEODE-2620: Rate stats removed from LuceneIndexMetrics * Commit Rate, update rate and query rate removed from LuceneIndexMetrics * They can be added back again when the getRate method in StatsRate.java is fixed This closes #418 Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/0f48fa3f Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/0f48fa3f Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/0f48fa3f Branch: refs/heads/develop Commit: 0f48fa3f7117064601a68975e04571ab804684c6 Parents: f69d86c Author: nabarun Authored: Tue Mar 7 15:05:47 2017 -0800 Committer: nabarun Committed: Fri Mar 10 13:58:49 2017 -0800 -- .../management/LuceneIndexStatsMonitor.java | 22 ++- .../lucene/management/LuceneIndexMetrics.java | 66 2 files changed, 17 insertions(+), 71 deletions(-) -- http://git-wip-us.apache.org/repos/asf/geode/blob/0f48fa3f/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneIndexStatsMonitor.java -- diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneIndexStatsMonitor.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneIndexStatsMonitor.java index 8d7d7ca..26eeff6 100644 --- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneIndexStatsMonitor.java +++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneIndexStatsMonitor.java @@ -24,16 +24,10 @@ import org.apache.geode.management.internal.beans.stats.StatsRate; public class LuceneIndexStatsMonitor extends MBeanStatsMonitor { - private StatsRate updateRate; - private StatsAverageLatency updateRateAverageLatency; - private StatsRate commitRate; - private StatsAverageLatency commitRateAverageLatency; - private StatsRate queryRate; - private StatsAverageLatency queryRateAverageLatency; public static final String LUCENE_SERVICE_MXBEAN_MONITOR_PREFIX = "LuceneServiceMXBeanMonitor_"; @@ -45,11 +39,6 @@ public class LuceneIndexStatsMonitor extends MBeanStatsMonitor { } private void configureMetrics() { -this.queryRate = new StatsRate(StatsKey.QUERIES, StatType.INT_TYPE, this); - -this.updateRate = new StatsRate(StatsKey.UPDATES, StatType.INT_TYPE, this); - -this.commitRate = new StatsRate(StatsKey.COMMITS, StatType.INT_TYPE, this); this.queryRateAverageLatency = new StatsAverageLatency(StatsKey.QUERIES, StatType.INT_TYPE, StatsKey.QUERY_TIME, this); @@ -64,29 +53,26 @@ public class LuceneIndexStatsMonitor extends MBeanStatsMonitor { protected LuceneIndexMetrics getIndexMetrics(LuceneIndex index) { int queryExecutions = getStatistic(StatsKey.QUERIES).intValue(); long queryExecutionTime = getStatistic(StatsKey.QUERY_TIME).longValue(); -float queryRateValue = this.queryRate.getRate(); long queryRateAverageLatencyValue = this.queryRateAverageLatency.getAverageLatency(); int queryExecutionsInProgress = getStatistic(StatsKey.QUERIES_IN_PROGRESS).intValue(); long queryExecutionTotalHits = getStatistic(StatsKey.QUERIES_TOTAL_HITS).longValue(); int updates = getStatistic(StatsKey.UPDATES).intValue(); long updateTime = getStatistic(StatsKey.UPDATE_TIME).longValue(); -float updateRateValue = this.updateRate.getRate(); long updateRateAverageLatencyValue = this.updateRateAverageLatency.getAverageLatency(); int updatesInProgress = getStatistic(StatsKey.UPDATES_IN_PROGRESS).intValue(); int commits = getStatistic(StatsKey.COMMITS).intValue(); long commitTime = getStatistic(StatsKey.COMMIT_TIME).longValue(); -float commitRateValue = this.commitRate.getRate(); long commitRateAverageLatencyValue = this.commitRateAverageLatency.getAverageLatency(); int commitsInProgress = getStatistic(StatsKey.COMMITS_IN_PROGRESS).intValue(); int documents = getStatistic(StatsKey.DOCUMENTS).intValue(); return new LuceneIndexMetrics(index.getRegionPath(), index.getName(), queryExecutions, -queryExecutionTime, queryRateValue, queryRateAverageLatencyValue, queryExecutionsInProgress, -queryExecutionTotalHits, updates, updateTime, updateRateValue, -updateRateAverageLatencyValue, updatesInProgress, commits, commitTime, commitRateValue, -commitRateAverageLatencyValue, commitsInProgress, documents); +queryExecutionTime, queryRateAverageLatencyValue, queryExecutionsInProgress, +queryExecutionTotalHits, updates, updateTime, updateRateAverageLatencyValue, +updatesInProgress
geode git commit: GEODE-2635: Creating DUnit tests to test eviction in lucene
Repository: geode Updated Branches: refs/heads/develop 3708968a1 -> 0b8855b3e GEODE-2635: Creating DUnit tests to test eviction in lucene * DUnit tests for eviction with local destroy and overflow * Refactored the integration tests for eviction This closes #420 Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/0b8855b3 Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/0b8855b3 Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/0b8855b3 Branch: refs/heads/develop Commit: 0b8855b3edcace4c684076170adc1b6471f0060e Parents: 3708968 Author: nabarunnag Authored: Wed Mar 8 16:16:52 2017 -0800 Committer: nabarun Committed: Fri Mar 10 16:37:08 2017 -0800 -- .../geode/cache/lucene/EvictionDUnitTest.java | 152 +++ .../geode/cache/lucene/LuceneDUnitTest.java | 22 ++- .../LuceneIndexCreationIntegrationTest.java | 18 ++- 3 files changed, 189 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/geode/blob/0b8855b3/geode-lucene/src/test/java/org/apache/geode/cache/lucene/EvictionDUnitTest.java -- diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/EvictionDUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/EvictionDUnitTest.java new file mode 100644 index 000..0fb0d9d --- /dev/null +++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/EvictionDUnitTest.java @@ -0,0 +1,152 @@ +/* + * 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.cache.lucene; + +import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.INDEX_NAME; +import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.REGION_NAME; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import org.apache.geode.cache.Cache; +import org.apache.geode.cache.Region; +import org.apache.geode.distributed.internal.DistributionConfig; +import org.apache.geode.internal.cache.GemFireCacheImpl; +import org.apache.geode.internal.cache.PartitionedRegion; +import org.apache.geode.internal.cache.control.HeapMemoryMonitor; +import org.apache.geode.test.dunit.SerializableRunnableIF; +import org.apache.geode.test.junit.categories.DistributedTest; +import org.awaitility.Awaitility; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.runner.RunWith; + +import java.util.List; +import java.util.concurrent.TimeUnit; +import java.util.stream.IntStream; +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; + + +@Category(DistributedTest.class) +@RunWith(JUnitParamsRunner.class) +public class EvictionDUnitTest extends LuceneQueriesAccessorBase { + + protected final static float INITIAL_EVICTION_HEAP_PERCENTAGE = 50.9f; + protected final static float EVICTION_HEAP_PERCENTAGE_FAKE_NOTIFICATION = 85.0f; + protected final static int TEST_MAX_MEMORY = 100; + protected final static int MEMORY_USED_FAKE_NOTIFICATION = 90; + + protected RegionTestableType[] getPartitionRedundantOverflowEvictionRegionType() { +return new RegionTestableType[] { +RegionTestableType.PARTITION_PERSISTENT_REDUNDANT_EVICTION_OVERFLOW}; + } + + protected RegionTestableType[] getPartitionRedundantLocalDestroyEvictionRegionType() { +return new RegionTestableType[] {RegionTestableType.PARTITION_REDUNDANT_EVICTION_LOCAL_DESTROY, + RegionTestableType.PARTITION_REDUNDANT_PERSISTENT_EVICTION_LOCAL_DESTROY, +RegionTestableType.PARTITION_EVICTION_LOCAL_DESTROY, +RegionTestableType.PARTITION_PERSISTENT_EVICTION_LOCAL_DESTROY}; + } + + @Test + @Parameters(method = "getPartitionRedundantLocalDestroyEvictionRegionType") + public void regionWithEvictionWithLocalDestroyMustNotbeAbleToCreateLuceneIndexes( + RegionTestableType regionTestType) { +SerializableRunnableIF createIndex = getSerializableRunnableIFCreateIndex(); + +dat
geode git commit: GEODE-2639: Added DUnit tests for expiration on Lucene
Repository: geode Updated Branches: refs/heads/develop 0b8855b3e -> c09a856f8 GEODE-2639: Added DUnit tests for expiration on Lucene * Tests added to validate the effect of the expiration of Lucene Index entries. * Once the entries expire, the lucene index entries must be updated. This closes #422 Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/c09a856f Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/c09a856f Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/c09a856f Branch: refs/heads/develop Commit: c09a856f804c3eba37d39a74eb680fe7968c14bc Parents: 0b8855b Author: nabarun Authored: Fri Mar 10 11:00:09 2017 -0800 Committer: nabarun Committed: Sun Mar 12 23:01:24 2017 -0700 -- .../geode/cache/lucene/ExpirationDUnitTest.java | 89 .../geode/cache/lucene/LuceneDUnitTest.java | 34 ++-- 2 files changed, 116 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/geode/blob/c09a856f/geode-lucene/src/test/java/org/apache/geode/cache/lucene/ExpirationDUnitTest.java -- diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/ExpirationDUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/ExpirationDUnitTest.java new file mode 100644 index 000..92c7370 --- /dev/null +++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/ExpirationDUnitTest.java @@ -0,0 +1,89 @@ +/* + * 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.cache.lucene; + +import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.INDEX_NAME; +import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.REGION_NAME; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.apache.geode.cache.Cache; +import org.apache.geode.cache.Region; +import org.apache.geode.test.dunit.SerializableRunnableIF; +import org.apache.geode.test.junit.categories.DistributedTest; +import org.awaitility.Awaitility; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.runner.RunWith; + +import java.util.Collection; +import java.util.List; +import java.util.concurrent.TimeUnit; +import java.util.stream.IntStream; +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; + +@Category(DistributedTest.class) +@RunWith(JUnitParamsRunner.class) +public class ExpirationDUnitTest extends LuceneQueriesAccessorBase { + + protected final static int EXTRA_WAIT_TIME_SEC = 15; + + protected RegionTestableType[] getPartitionRegionsWithExpirationSet() { +return new RegionTestableType[] {RegionTestableType.PARTITION_WITH_EXPIRATION_DESTROY, +RegionTestableType.PARTITION_REDUNDANT_WITH_EXPIRATION_DESTROY, + RegionTestableType.PARTITION_REDUNDANT_PERSISTENT_WITH_EXPIRATION_DESTROY}; + } + + @Test + @Parameters(method = "getPartitionRegionsWithExpirationSet") + public void regionWithExpirationSetMustAlsoRemoveLuceneIndexEntries( + RegionTestableType regionTestType) { +SerializableRunnableIF createIndex = () -> { + LuceneService luceneService = LuceneServiceProvider.get(getCache()); + luceneService.createIndexFactory().setFields("text").create(INDEX_NAME, REGION_NAME); +}; + +dataStore1.invoke(() -> initDataStore(createIndex, regionTestType)); +dataStore2.invoke(() -> initDataStore(createIndex, regionTestType)); +accessor.invoke(() -> initDataStore(createIndex, regionTestType)); + +accessor.invoke(() -> { + Cache cache = getCache(); + Region region = cache.getRegion(REGION_NAME); + IntStream.range(0, NUM_BUCKETS).forEach(i -> region.put(i, new TestObject("hello world"))); +}); + +assertTrue(waitForFlushBeforeExecuteTextSearch(accessor, 6)); + +accessor.invoke(() -> Awaitility.await() +.atMost(EXPIRATION_TIMEOUT_SEC + EXTRA_WAIT_TIME_SEC, TimeUnit.SECONDS).u
geode git commit: GEODE-2548: Removing the test alternativelyCloseDataStoresAfterGettingAPageAndThenValidateTheContentsOfTheResults
Repository: geode Updated Branches: refs/heads/develop 02ffd528f -> ebc1642fc GEODE-2548: Removing the test alternativelyCloseDataStoresAfterGettingAPageAndThenValidateTheContentsOfTheResults * Removed the test as it was shutting down one datastore before the other datastore could recover from it. * The second datastore just keeps waiting (hang) to recover but the other datastore was shut down Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/ebc1642f Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/ebc1642f Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/ebc1642f Branch: refs/heads/develop Commit: ebc1642fc6914024e0091e156f65b53f19dbe7e8 Parents: 02ffd52 Author: nabarun Authored: Mon Mar 13 12:03:07 2017 -0700 Committer: nabarun Committed: Mon Mar 13 12:03:07 2017 -0700 -- .../geode/cache/lucene/PaginationDUnitTest.java | 54 1 file changed, 54 deletions(-) -- http://git-wip-us.apache.org/repos/asf/geode/blob/ebc1642f/geode-lucene/src/test/java/org/apache/geode/cache/lucene/PaginationDUnitTest.java -- diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/PaginationDUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/PaginationDUnitTest.java index ad6727e..11d5cd0 100644 --- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/PaginationDUnitTest.java +++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/PaginationDUnitTest.java @@ -138,60 +138,6 @@ public class PaginationDUnitTest extends LuceneQueriesAccessorBase { }); } - @Test - @Ignore - @Parameters(method = "getListOfRegionTestTypes") - public void alternativelyCloseDataStoresAfterGettingAPageAndThenValidateTheContentsOfTheResults( - RegionTestableType regionTestType) { -SerializableRunnableIF createIndex = () -> { - LuceneService luceneService = LuceneServiceProvider.get(getCache()); - luceneService.createIndexFactory().setFields("text").create(INDEX_NAME, REGION_NAME); -}; - -dataStore1.invoke(() -> initDataStore(createIndex, regionTestType)); -dataStore2.invoke(() -> initDataStore(createIndex, regionTestType)); -accessor.invoke(() -> initAccessor(createIndex, regionTestType)); - -putEntryInEachBucket(); - -assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore1, FLUSH_WAIT_TIME_MS)); - -accessor.invoke(() -> { - List> combinedResult = - new ArrayList>(); - Cache cache = getCache(); - LuceneService service = LuceneServiceProvider.get(cache); - LuceneQuery query; - query = service.createLuceneQueryFactory().setResultLimit(1000).setPageSize(PAGE_SIZE) - .create(INDEX_NAME, REGION_NAME, "world", "text"); - PageableLuceneQueryResults pages = query.findPages(); - assertTrue(pages.hasNext()); - - dataStore1.invoke(() -> closeCache()); - dataStore2.invoke(() -> closeCache()); - - for (int i = 0; i < (NUM_BUCKETS / PAGE_SIZE); i++) { -List> page; -if (i % 2 == 0) { - // Bring up dataStore2 and shutdown dataStore1 - dataStore2.invoke(() -> initDataStore(createIndex, regionTestType)); - assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore2, FLUSH_WAIT_TIME_MS)); - dataStore1.invoke(() -> closeCache()); - page = pages.next(); -} else { - // Bring up dataStore1 and shutdown dataStore2 - dataStore1.invoke(() -> initDataStore(createIndex, regionTestType)); - assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore1, FLUSH_WAIT_TIME_MS)); - dataStore2.invoke(() -> closeCache()); - page = pages.next(); -} -assertEquals(PAGE_SIZE, page.size()); -combinedResult.addAll(page); - } - validateTheCombinedResult(combinedResult); -}); - } - private void validateTheCombinedResult( final List> combinedResult) { Map resultMap = combinedResult.stream()
geode git commit: GEODE-2655: Added DUnit tests for lucene indexes on mixed objects.
Repository: geode Updated Branches: refs/heads/develop 41e14b528 -> 426c2fcd3 GEODE-2655: Added DUnit tests for lucene indexes on mixed objects. * Lucene must be able to index on the common field name of mixed objects * Lucene indexes must also work when there are mixed objects with no common field names. * Lucene indexes work with different objects, different data type, but same field name. This closes #424 Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/426c2fcd Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/426c2fcd Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/426c2fcd Branch: refs/heads/develop Commit: 426c2fcd3f27800d41ab0dfdd596fe5d1cfaf74f Parents: 41e14b5 Author: nabarun Authored: Tue Mar 14 00:02:51 2017 -0700 Committer: nabarun Committed: Thu Mar 16 14:13:25 2017 -0700 -- .../lucene/LuceneQueriesIntegrationTest.java| 56 --- .../cache/lucene/MixedObjectIndexDUnitTest.java | 458 +++ .../cache/lucene/test/LuceneTestUtilities.java | 51 +++ 3 files changed, 509 insertions(+), 56 deletions(-) -- http://git-wip-us.apache.org/repos/asf/geode/blob/426c2fcd/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesIntegrationTest.java -- diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesIntegrationTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesIntegrationTest.java index 5b85c19..9db0a5e 100644 --- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesIntegrationTest.java +++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesIntegrationTest.java @@ -17,9 +17,6 @@ package org.apache.geode.cache.lucene; import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.*; import static org.junit.Assert.*; -import java.io.DataInput; -import java.io.DataOutput; -import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -39,20 +36,15 @@ import org.apache.lucene.analysis.core.KeywordAnalyzer; import org.apache.lucene.analysis.core.LowerCaseFilter; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.analysis.util.CharTokenizer; -import org.apache.lucene.document.IntPoint; -import org.apache.lucene.search.Query; import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.rules.ExpectedException; -import org.apache.geode.DataSerializer; import org.apache.geode.cache.Region; import org.apache.geode.cache.RegionShortcut; import org.apache.geode.cache.lucene.test.TestObject; -import org.apache.geode.internal.DataSerializableFixedID; -import org.apache.geode.internal.Version; import org.apache.geode.pdx.JSONFormatter; import org.apache.geode.pdx.PdxInstance; import org.apache.geode.test.junit.categories.IntegrationTest; @@ -515,52 +507,4 @@ public class LuceneQueriesIntegrationTest extends LuceneIntegrationTest { return new TokenStreamComponents(tokenizer, filter); } } - - public static class IntRangeQueryProvider - implements LuceneQueryProvider, DataSerializableFixedID { -public static final short LUCENE_INT_RANGE_QUERY_PROVIDER = 2177; -String fieldName; -int lowerValue; -int upperValue; - -private transient Query luceneQuery; - -public IntRangeQueryProvider(String fieldName, int lowerValue, int upperValue) { - this.fieldName = fieldName; - this.lowerValue = lowerValue; - this.upperValue = upperValue; -} - -@Override -public Version[] getSerializationVersions() { - return null; -} - -@Override -public int getDSFID() { - return LUCENE_INT_RANGE_QUERY_PROVIDER; -} - -@Override -public void toData(DataOutput out) throws IOException { - DataSerializer.writeString(fieldName, out); - out.writeInt(lowerValue); - out.writeInt(upperValue); -} - -@Override -public void fromData(DataInput in) throws IOException, ClassNotFoundException { - fieldName = DataSerializer.readString(in); - lowerValue = in.readInt(); - upperValue = in.readInt(); -} - -@Override -public Query getQuery(LuceneIndex index) throws LuceneQueryException { - if (luceneQuery == null) { -luceneQuery = IntPoint.newRangeQuery(fieldName, lowerValue, upperValue); - } - return luceneQuery; -} - } } http://git-wip-us.apache.org/repos/asf/geode/blob/426c2fcd/geode-lucene/src/test/java/org/apache/geode/cache/lucene/MixedObjectIndexDUnitTest.java --
geode git commit: GEODE-3025: Lucene queries are not allowed withing a transaction.
Repository: geode Updated Branches: refs/heads/develop 2579a0db0 -> 1ff5ccfe3 GEODE-3025: Lucene queries are not allowed withing a transaction. This closes #562 Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/1ff5ccfe Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/1ff5ccfe Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/1ff5ccfe Branch: refs/heads/develop Commit: 1ff5ccfe3816ae475b62f2ed76189252afb26832 Parents: 2579a0d Author: nabarun Authored: Thu Jun 8 10:33:04 2017 -0700 Committer: nabarun Committed: Fri Jun 9 13:46:59 2017 -0700 -- .../cache/lucene/internal/LuceneQueryImpl.java | 3 ++ .../distributed/LuceneQueryFunction.java| 1 - .../LuceneIndexMaintenanceIntegrationTest.java | 26 -- .../lucene/LuceneQueriesClientDUnitTest.java| 38 .../internal/LuceneQueryImplJUnitTest.java | 12 ++- 5 files changed, 14 insertions(+), 66 deletions(-) -- http://git-wip-us.apache.org/repos/asf/geode/blob/1ff5ccfe/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java -- diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java index 328eb3f..e84b27e 100644 --- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java +++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java @@ -108,6 +108,9 @@ public class LuceneQueryImpl implements LuceneQuery { TopEntriesCollectorManager manager = new TopEntriesCollectorManager(null, limit); LuceneFunctionContext context = new LuceneFunctionContext<>(query, indexName, manager, limit); +if (region.getCache().getCacheTransactionManager().exists()) { + throw new LuceneQueryException(LUCENE_QUERY_CANNOT_BE_EXECUTED_WITHIN_A_TRANSACTION); +} // TODO provide a timeout to the user? TopEntries entries = null; http://git-wip-us.apache.org/repos/asf/geode/blob/1ff5ccfe/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunction.java -- diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunction.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunction.java index b60652f..c40b3a4 100644 --- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunction.java +++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunction.java @@ -21,7 +21,6 @@ import java.util.Collection; import org.apache.geode.cache.CacheClosedException; import org.apache.geode.cache.execute.Function; -import org.apache.geode.cache.lucene.LuceneIndexDestroyedException; import org.apache.geode.cache.lucene.LuceneIndexNotFoundException; import org.apache.geode.cache.lucene.internal.LuceneIndexImpl; import org.apache.geode.cache.lucene.internal.LuceneIndexStats; http://git-wip-us.apache.org/repos/asf/geode/blob/1ff5ccfe/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexMaintenanceIntegrationTest.java -- diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexMaintenanceIntegrationTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexMaintenanceIntegrationTest.java index f9273c1..2f39d78 100644 --- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexMaintenanceIntegrationTest.java +++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexMaintenanceIntegrationTest.java @@ -46,32 +46,6 @@ public class LuceneIndexMaintenanceIntegrationTest extends LuceneIntegrationTest private static int WAIT_FOR_FLUSH_TIME = 1; - @Test - public void indexIsNotUpdatedIfTransactionHasNotCommittedYet() throws Exception { -luceneService.createIndexFactory().setFields("title", "description").create(INDEX_NAME, -REGION_NAME); - -Region region = createRegion(REGION_NAME, RegionShortcut.PARTITION); -region.put("object-1", new TestObject("title 1", "hello world")); -region.put("object-2", new TestObject("title 2", "this will not match")); -region.put("object-3", new TestObject("title 3", "hello world")); -region.put("object-4", new TestObject("hello world", "hello world")); - -LuceneIndex index = luceneService.getIndex(INDEX_NAME, REGION_NAME); -luceneService.waitUntilFlushed(INDEX_NAME, REGION_NA
geode git commit: GEODE-3025: Lucene queries are not allowed withing a transaction.
Repository: geode Updated Branches: refs/heads/release/1.2.0 c5dbfd295 -> 5853cc2fb GEODE-3025: Lucene queries are not allowed withing a transaction. This closes #562 Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/5853cc2f Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/5853cc2f Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/5853cc2f Branch: refs/heads/release/1.2.0 Commit: 5853cc2fb816dda7874277101abda22c79caeb9a Parents: c5dbfd2 Author: nabarun Authored: Thu Jun 8 10:33:04 2017 -0700 Committer: nabarun Committed: Fri Jun 9 14:21:05 2017 -0700 -- .../cache/lucene/internal/LuceneQueryImpl.java | 3 ++ .../distributed/LuceneQueryFunction.java| 1 - .../LuceneIndexMaintenanceIntegrationTest.java | 26 -- .../lucene/LuceneQueriesClientDUnitTest.java| 38 .../internal/LuceneQueryImplJUnitTest.java | 12 ++- 5 files changed, 14 insertions(+), 66 deletions(-) -- http://git-wip-us.apache.org/repos/asf/geode/blob/5853cc2f/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java -- diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java index 328eb3f..e84b27e 100644 --- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java +++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java @@ -108,6 +108,9 @@ public class LuceneQueryImpl implements LuceneQuery { TopEntriesCollectorManager manager = new TopEntriesCollectorManager(null, limit); LuceneFunctionContext context = new LuceneFunctionContext<>(query, indexName, manager, limit); +if (region.getCache().getCacheTransactionManager().exists()) { + throw new LuceneQueryException(LUCENE_QUERY_CANNOT_BE_EXECUTED_WITHIN_A_TRANSACTION); +} // TODO provide a timeout to the user? TopEntries entries = null; http://git-wip-us.apache.org/repos/asf/geode/blob/5853cc2f/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunction.java -- diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunction.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunction.java index b60652f..c40b3a4 100644 --- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunction.java +++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunction.java @@ -21,7 +21,6 @@ import java.util.Collection; import org.apache.geode.cache.CacheClosedException; import org.apache.geode.cache.execute.Function; -import org.apache.geode.cache.lucene.LuceneIndexDestroyedException; import org.apache.geode.cache.lucene.LuceneIndexNotFoundException; import org.apache.geode.cache.lucene.internal.LuceneIndexImpl; import org.apache.geode.cache.lucene.internal.LuceneIndexStats; http://git-wip-us.apache.org/repos/asf/geode/blob/5853cc2f/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexMaintenanceIntegrationTest.java -- diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexMaintenanceIntegrationTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexMaintenanceIntegrationTest.java index f9273c1..2f39d78 100644 --- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexMaintenanceIntegrationTest.java +++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexMaintenanceIntegrationTest.java @@ -46,32 +46,6 @@ public class LuceneIndexMaintenanceIntegrationTest extends LuceneIntegrationTest private static int WAIT_FOR_FLUSH_TIME = 1; - @Test - public void indexIsNotUpdatedIfTransactionHasNotCommittedYet() throws Exception { -luceneService.createIndexFactory().setFields("title", "description").create(INDEX_NAME, -REGION_NAME); - -Region region = createRegion(REGION_NAME, RegionShortcut.PARTITION); -region.put("object-1", new TestObject("title 1", "hello world")); -region.put("object-2", new TestObject("title 2", "this will not match")); -region.put("object-3", new TestObject("title 3", "hello world")); -region.put("object-4", new TestObject("hello world", "hello world")); - -LuceneIndex index = luceneService.getIndex(INDEX_NAME, REGION_NAME); -luceneService.waitUntilFlushed(INDEX_NAM
geode git commit: GEODE-3066: Test tweaks to stabilize it.
Repository: geode Updated Branches: refs/heads/develop 8cd03e87f -> eb3312aed GEODE-3066: Test tweaks to stabilize it. * Regions created before senders and receivers are started. * Added a listener to slow down the puts so that when the remote region is destroyed, the put operation is still ongoing. This closes #574 Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/eb3312ae Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/eb3312ae Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/eb3312ae Branch: refs/heads/develop Commit: eb3312aed9767eb2fc08599a372c8dbcbeddf237 Parents: 8cd03e8 Author: nabarun Authored: Mon Jun 12 11:33:37 2017 -0700 Committer: nabarun Committed: Mon Jun 12 14:18:19 2017 -0700 -- .../serial/SerialWANPropagationDUnitTest.java | 25 1 file changed, 15 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/geode/blob/eb3312ae/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPropagationDUnitTest.java -- diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPropagationDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPropagationDUnitTest.java index a60614c..5f69f69 100644 --- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPropagationDUnitTest.java +++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPropagationDUnitTest.java @@ -360,14 +360,6 @@ public class SerialWANPropagationDUnitTest extends WANTestBase { // these are part of remote site createCacheInVMs(nyPort, vm2, vm3); -createReceiverInVMs(vm2, vm3); - -// these are part of local site -createCacheInVMs(lnPort, vm4, vm5, vm6, vm7); - -// senders are created on local site -vm4.invoke(() -> WANTestBase.createSender("ln", 2, false, 100, 500, false, false, null, true)); -vm5.invoke(() -> WANTestBase.createSender("ln", 2, false, 100, 500, false, false, null, true)); // create one RR (RR_1) on remote site vm2.invoke( @@ -375,8 +367,13 @@ public class SerialWANPropagationDUnitTest extends WANTestBase { vm3.invoke( () -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_1", null, isOffHeap())); -// start the senders on local site -startSenderInVMs("ln", vm4, vm5); +createReceiverInVMs(vm2, vm3); + +vm2.invoke(() -> addListenerToSleepAfterCreateEvent(1000, getTestMethodName() + "_RR_1")); +vm3.invoke(() -> addListenerToSleepAfterCreateEvent(1000, getTestMethodName() + "_RR_1")); + +// these are part of local site +createCacheInVMs(lnPort, vm4, vm5, vm6, vm7); // create one RR (RR_1) on local site vm4.invoke( @@ -388,6 +385,14 @@ public class SerialWANPropagationDUnitTest extends WANTestBase { vm7.invoke( () -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_1", "ln", isOffHeap())); +// senders are created on local site +vm4.invoke(() -> WANTestBase.createSender("ln", 2, false, 100, 500, false, false, null, true)); +vm5.invoke(() -> WANTestBase.createSender("ln", 2, false, 100, 500, false, false, null, true)); + + +// start the senders on local site +startSenderInVMs("ln", vm4, vm5); + IgnoredException.addIgnoredException(BatchException70.class.getName()); IgnoredException.addIgnoredException(ServerOperationException.class.getName());