[geode] branch develop updated (c826d63 -> c058bb2)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from c826d63 During CI, copy attach_sha_to_branch to tmpdir before execution add c058bb2 Revert "GEODE-6867: Updating Tomcat Session State Module docs (#3886)" No new revisions were added by this update. Summary of changes: .../apache/geode/session/tests/TomcatInstall.java | 6 -- .../Tomcat8ClientServerRollingUpgradeTest.java | 81 ++ .../tomcat_installing_the_module.html.md.erb | 3 - .../tomcat_setting_up_the_module.html.md.erb | 17 ++--- .../weblogic_setting_up_the_module.html.md.erb | 7 -- 5 files changed, 14 insertions(+), 100 deletions(-)
[geode] branch develop updated (245f285 -> 57f1cc7)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from 245f285 GEODE-6916: Add Aggregate Functions Tests (#3953) add 57f1cc7 GEODE-7158: Adding singleton cleanup before and after tests No new revisions were added by this update. Summary of changes: .../cache/tier/sockets/CacheClientNotifierTest.java | 20 1 file changed, 20 insertions(+)
[geode] branch develop updated (174af1d -> 5bb753a)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from 174af1d GEODE-7088: Using ConcurrentSets for interested clients add 5bb753a GEODE-7088: Fixing test build issue No new revisions were added by this update. Summary of changes: .../internal/cache/tier/sockets/ClientUpdateMessageImplTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
[geode] branch develop updated (9368e09 -> 174af1d)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from 9368e09 GEODE-6915: Improve CompiledGroupBySelect Tests (#3954) add 174af1d GEODE-7088: Using ConcurrentSets for interested clients No new revisions were added by this update. Summary of changes: .../codeAnalysis/sanctionedDataSerializables.txt | 4 +- .../cache/tier/sockets/CacheClientNotifier.java| 14 ++- .../tier/sockets/ClientUpdateMessageImpl.java | 106 .../tier/sockets/ClientUpdateMessageImplTest.java | 110 + 4 files changed, 160 insertions(+), 74 deletions(-) create mode 100644 geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ClientUpdateMessageImplTest.java
[geode] branch develop updated (7d6e08a -> 5d0153a)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from 7d6e08a GEODE-6945: expand the type to related xml attributes (#3936) add 5d0153a GEODE-7089: Each client registration thread uses its own queue No new revisions were added by this update. Summary of changes: .../cache/ha/HARegionQueueIntegrationTest.java | 4 +- .../internal/cache/tier/sockets/AcceptorImpl.java | 3 +- .../cache/tier/sockets/CacheClientNotifier.java| 51 +-- .../ClientRegistrationEventQueueManager.java | 357 ++--- .../tier/sockets/ClientUpdateMessageImpl.java | 4 - .../geode/internal/cache/BucketRegionTest.java | 7 +- .../geode/internal/cache/CacheServerImplTest.java | 16 +- .../internal/cache/LocalRegionPartialMockTest.java | 7 +- .../cache/tier/sockets/AcceptorImplTest.java | 4 +- .../tier/sockets/CacheClientNotifierTest.java | 62 +++- .../ClientRegistrationEventQueueManagerTest.java | 271 ++-- 11 files changed, 462 insertions(+), 324 deletions(-)
[geode] branch develop updated (c2e1fab -> 97aa017)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from c2e1fab GEODE-7091: Add Micrometer binders to meter registry add 97aa017 GEODE-7092: increase flaky test MEMBER_TIMEOUT No new revisions were added by this update. Summary of changes: .../java/org/apache/geode/cache30/ReconnectDUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[geode] branch develop updated: GEODE-7015: Fixing redundant copies in test
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 08bd776 GEODE-7015: Fixing redundant copies in test 08bd776 is described below commit 08bd776f8ceaa127b40523a49a294f3c115d0aa6 Author: Ryan McMahon AuthorDate: Tue Aug 6 20:40:45 2019 -0700 GEODE-7015: Fixing redundant copies in test --- .../internal/cache/control/RebalanceOperationDistributedTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/control/RebalanceOperationDistributedTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/control/RebalanceOperationDistributedTest.java index fa02901..656b4a5 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/control/RebalanceOperationDistributedTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/control/RebalanceOperationDistributedTest.java @@ -2238,7 +2238,7 @@ public class RebalanceOperationDistributedTest extends CacheTestCase { RebalanceResults results = doRebalance(false, manager); // The rebalance should have done some work since the buckets were imbalanced - assertThat(results.getTotalPrimaryTransfersCompleted() > 0).isTrue(); + assertThat(results.getTotalBucketTransfersCompleted() > 0).isTrue(); }); } @@ -2314,7 +2314,7 @@ public class RebalanceOperationDistributedTest extends CacheTestCase { RebalanceResults results = doRebalance(false, getCache().getInternalResourceManager()); // The rebalance should have done some work since the buckets were imbalanced - assertThat(results.getTotalPrimaryTransfersCompleted() > 0).isTrue(); + assertThat(results.getTotalBucketTransfersCompleted() > 0).isTrue(); }); } @@ -2435,7 +2435,7 @@ public class RebalanceOperationDistributedTest extends CacheTestCase { diskStoreFactory.setDiskDirs(diskDirs).create(diskStoreName); PartitionAttributesFactory partitionAttributesFactory = new PartitionAttributesFactory(); -partitionAttributesFactory.setRedundantCopies(1); +partitionAttributesFactory.setRedundantCopies(redundantCopies); partitionAttributesFactory.setRecoveryDelay(-1); partitionAttributesFactory.setStartupRecoveryDelay(-1);
[geode] branch release/1.10.0 updated: Revert "GEODE-6973: Use cachelistener to synchronize typeToId with IdToType r… (#3853)"
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch release/1.10.0 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/release/1.10.0 by this push: new 1067733 Revert "GEODE-6973: Use cachelistener to synchronize typeToId with IdToType r… (#3853)" 1067733 is described below commit 10677330666d6bbc45ac535268db026d1351872e Author: Naburun Nag AuthorDate: Tue Aug 6 14:17:48 2019 -0700 Revert "GEODE-6973: Use cachelistener to synchronize typeToId with IdToType r… (#3853)" This reverts commit 181e3a4a465aa9f5e06f39cd1285c94f9bc78600. --- .../geode/pdx/PdxTypeGenerationDUnitTest.java | 320 - .../org/apache/geode/pdx/jsonStrings/testJSON.txt | 43 --- .../apache/geode/pdx/JSONFormatterJUnitTest.java | 247 +--- .../PeerTypeRegistrationIntegrationTest.java | 92 -- .../geode/internal/pdx/jsonStrings/testJSON.txt| 43 --- .../geode/pdx/internal/PeerTypeRegistration.java | 47 ++- 6 files changed, 30 insertions(+), 762 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/pdx/PdxTypeGenerationDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/pdx/PdxTypeGenerationDUnitTest.java deleted file mode 100644 index d0fc78a..000 --- a/geode-core/src/distributedTest/java/org/apache/geode/pdx/PdxTypeGenerationDUnitTest.java +++ /dev/null @@ -1,320 +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.pdx; - -import static org.apache.geode.test.util.ResourceUtils.createTempFileFromResource; -import static org.assertj.core.api.Assertions.assertThat; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import util.TestException; - -import org.apache.geode.cache.DataPolicy; -import org.apache.geode.cache.Region; -import org.apache.geode.cache.client.ClientCache; -import org.apache.geode.cache.client.ClientRegionShortcut; -import org.apache.geode.internal.cache.InternalCache; -import org.apache.geode.pdx.internal.PeerTypeRegistration; -import org.apache.geode.test.dunit.AsyncInvocation; -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 PdxTypeGenerationDUnitTest { - - private static final float TARGET_CONSISTENCY_FACTOR = 2f; - - private static final String FIELD_NAME_TO_REPLACE = "maxUrlLength"; - - private MemberVM locator, server1, server2; - - @Rule - public ClusterStartupRule cluster = new ClusterStartupRule(); - - @Before - public void before() { -Properties props = new Properties(); -props.setProperty("log-level", "WARN"); - -locator = cluster.startLocatorVM(0, props); - -int locatorPort1 = locator.getPort(); -server1 = cluster.startServerVM(1, -x -> x.withProperties(props).withConnectionToLocator(locatorPort1)); - -int locatorPort2 = locator.getPort(); -server2 = cluster.startServerVM(2, -x -> x.withProperties(props).withConnectionToLocator(locatorPort2)); - } - - @Test - public void testSortJSONFieldNamesDoesNotImpactPerformance() { -final String fileName = "/org/apache/geode/pdx/jsonStrings/testJSON.txt"; -String jsonString = loadJSONFileAsString(fileName); - -server1.invoke(() -> { - int repeats = 1000; - long totalUnsortedTime = 0; - long totalSortedTime = 0; - - // The first JSON document used to create a PdxInstance takes significantly longer than - // successive ones, so a dummy document is used to trigger this first, longer creation process - JSONFormatter.fromJSON("{\"testFieldName\": \"test\"}"); - for (int i = 0; i < repeats; ++i) { -System.setProperty(JSONFormatter.SORT_JSON_FIELD_NAMES_PROPERTY, "false"); - -
[geode] branch develop updated (2419ffb -> 2047c40)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from 2419ffb GEODE-6747 CI failure: GMSJoinLeaveJUnitTest fails intermittently, possibly due to incorrect use of Mockito spy from multiple threads add 2047c40 Revert "GEODE-6973: Use cachelistener to synchronize typeToId with IdToType r… (#3853)" No new revisions were added by this update. Summary of changes: .../geode/pdx/PdxTypeGenerationDUnitTest.java | 320 - .../org/apache/geode/pdx/jsonStrings/testJSON.txt | 43 --- .../apache/geode/pdx/JSONFormatterJUnitTest.java | 247 +--- .../PeerTypeRegistrationIntegrationTest.java | 92 -- .../geode/internal/pdx/jsonStrings/testJSON.txt| 43 --- .../geode/pdx/internal/PeerTypeRegistration.java | 47 ++- 6 files changed, 30 insertions(+), 762 deletions(-) delete mode 100644 geode-core/src/distributedTest/java/org/apache/geode/pdx/PdxTypeGenerationDUnitTest.java delete mode 100644 geode-core/src/distributedTest/resources/org/apache/geode/pdx/jsonStrings/testJSON.txt delete mode 100644 geode-core/src/integrationTest/java/org/apache/geode/pdx/internal/PeerTypeRegistrationIntegrationTest.java delete mode 100644 geode-core/src/integrationTest/resources/org/apache/geode/internal/pdx/jsonStrings/testJSON.txt
[geode] branch develop updated (35986d8 -> 78923e1)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from 35986d8 Fixing new version and ordinal (#3885) add 78923e1 GEODE-7015: Resetting static state after tests No new revisions were added by this update. Summary of changes: .../geode/internal/cache/PersistentRegionRecoveryDUnitTest.java | 9 + .../cache/control/RebalanceOperationDistributedTest.java | 9 - .../partitioned/PersistentPartitionedRegionDistributedTest.java | 5 - 3 files changed, 17 insertions(+), 6 deletions(-)
[geode] branch develop updated (d7c11d3 -> a429325)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from d7c11d3 Remove unattended-upgrades and autoremove unnecessary stuff. (#3881) add a429325 GEODE-7015: Check region persistent ID before close to avoid hang No new revisions were added by this update. Summary of changes: .../CacheClosingDistributionMessageObserver.java | 7 +- .../cache/OnRequestImageMessageObserver.java | 44 ++ .../cache/PersistentRegionRecoveryDUnitTest.java | 51 +-- .../SignalBounceOnRequestImageMessageObserver.java | 37 +++-- .../control/RebalanceOperationDistributedTest.java | 163 - ...PersistentPartitionedRegionDistributedTest.java | 61 .../apache/geode/internal/cache/DiskRegion.java| 33 - .../cache/persistence/PersistenceAdvisorImpl.java | 37 - 8 files changed, 345 insertions(+), 88 deletions(-) copy geode-junit/src/main/java/org/apache/geode/internal/cache/MockCacheService.java => geode-core/src/distributedTest/java/org/apache/geode/internal/cache/CacheClosingDistributionMessageObserver.java (80%) create mode 100644 geode-core/src/distributedTest/java/org/apache/geode/internal/cache/OnRequestImageMessageObserver.java copy geode-junit/src/main/java/org/apache/geode/internal/cache/MockCacheServiceImpl.java => geode-core/src/distributedTest/java/org/apache/geode/internal/cache/SignalBounceOnRequestImageMessageObserver.java (50%)
[geode] branch develop updated (3b3f971 -> 6359494)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from 3b3f971 GEODE-6804: Tab completion does not work when specifying path for --jar argument in gfsh (#3870) add 6359494 GEODE-7030: Handling expected exception when scheduling async write No new revisions were added by this update. Summary of changes: ...PersistentPartitionedRegionDistributedTest.java | 41 ++ 1 file changed, 35 insertions(+), 6 deletions(-)
[geode] branch develop updated (5e9f8cc -> 13b235e)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from 5e9f8cc GEODE-6828: check for debug/trace early(#3684) add 13b235e GEODE-6845: Consistent logging when incrementing putInProgress (#3686) No new revisions were added by this update. Summary of changes: .../internal/cache/ha/HARegionQueueIntegrationTest.java| 14 +++--- .../geode/internal/cache/ha/HARegionQueueJUnitTest.java| 2 +- .../org/apache/geode/internal/cache/ha/HARegionQueue.java | 9 + .../internal/cache/tier/sockets/CacheClientNotifier.java | 9 + .../tier/sockets/ClientRegistrationEventQueueManager.java | 2 +- .../geode/internal/cache/tier/sockets/HAEventWrapper.java | 12 ++-- 6 files changed, 21 insertions(+), 27 deletions(-)
[geode] branch develop updated: GEODE-6842: Making serialization of CqNameToOpHashMap thread safe (#3680)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 610992a GEODE-6842: Making serialization of CqNameToOpHashMap thread safe (#3680) 610992a is described below commit 610992ae8ba1c8d26756606bb62e871ea846544f Author: Ryan McMahon AuthorDate: Thu Jun 6 16:54:30 2019 -0700 GEODE-6842: Making serialization of CqNameToOpHashMap thread safe (#3680) By making the CqNameToOpHashMap derive from ConcurrentHashMap and taking a snapshot prior to serialization, we avoid a race where this map could be mutated by a client registration thread while a queue GII which includes this map is occuring in another thread. --- .../sockets/CqNameToOpHashMapIntegrationTest.java | 110 + .../tier/sockets/ClientUpdateMessageImpl.java | 8 +- 2 files changed, 115 insertions(+), 3 deletions(-) diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/tier/sockets/CqNameToOpHashMapIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/tier/sockets/CqNameToOpHashMapIntegrationTest.java new file mode 100644 index 000..d8628b2 --- /dev/null +++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/tier/sockets/CqNameToOpHashMapIntegrationTest.java @@ -0,0 +1,110 @@ +/* + * 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.tier.sockets; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +import com.google.common.collect.MapDifference; +import com.google.common.collect.Maps; +import org.junit.Test; + +import org.apache.geode.DataSerializer; +import org.apache.geode.internal.InternalDataSerializer; + +public class CqNameToOpHashMapIntegrationTest { + /** + * This test ensures that we can safely mutate the CqNameToOpHashMap while it is being + * serialized in another thread. The use case for this is that we repopulate this map + * during client registration, which can happen concurrently with a GII which causes + * serialization to occur if this map is referenced by any of the client subscription + * queues. This integration test does not exercise this full system level interaction, + * but rather does the minimum necessary to prove that map mutation and serialization + * can occur concurrently without any issues such as size mismatches or + * ConcurrentModificationExceptions. + */ + @Test + public void testSendToWhileConcurrentlyModifyingMapContentsAndVerifyProperSerialization() + throws IOException, ClassNotFoundException, InterruptedException, ExecutionException, + TimeoutException { +final int numEntries = 100; + +ClientUpdateMessageImpl.CqNameToOpHashMap originalCqNameToOpHashMap = +new ClientUpdateMessageImpl.CqNameToOpHashMap(numEntries); +ClientUpdateMessageImpl.CqNameToOpHashMap modifiedCqNameToOpHashMap = +new ClientUpdateMessageImpl.CqNameToOpHashMap(numEntries); + +for (int i = 0; i < numEntries; ++i) { + originalCqNameToOpHashMap.add(String.valueOf(i), i); + modifiedCqNameToOpHashMap.add(String.valueOf(i), i); +} + +CompletableFuture removeFromHashMapTask = CompletableFuture.runAsync(() -> { + for (int i = 0; i < numEntries; ++i) { +modifiedCqNameToOpHashMap.remove(String.valueOf(i), i); + } +}); + +CompletableFuture serializeReconstructHashMapTask = CompletableFuture.runAsync(() -> { + try { +ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); +DataOutputStream outputStream = new DataOutputStream(byteArrayOutputStream); + +modifiedCqNam
[geode] branch develop updated (5d300cf -> 29f6419)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from 5d300cf GEODE-6802: Execute region synchronization on newly joined member. (#3623) add 29f6419 GEODE-6797: Use better packaging techniques to avoid missing dependency (#3673) No new revisions were added by this update. Summary of changes: extensions/geode-modules-assembly/build.gradle | 71 +++--- 1 file changed, 29 insertions(+), 42 deletions(-)
[geode] branch develop updated (29cc2ce0 -> cc0b37a)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from 29cc2ce0 GEODE-6760: Refactor JDBC connector package structure (#3575) add cc0b37a GEODE-6327: Add method overload to avoid breaking API in JSONFormatter (#3586) No new revisions were added by this update. Summary of changes: .../geode/pdx/JSONFormatterBasicJUnitTest.java | 28 ++ .../java/org/apache/geode/pdx/JSONFormatter.java | 22 + 2 files changed, 50 insertions(+)
[geode] branch develop updated (ab6de19 -> 9b696c5)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from ab6de19 GEODE-6745: Add status to list members output for REST v2 (#3558) add 9b696c5 GEODE-6741: Copy off-heap to heap for client registration queue (#3553) No new revisions were added by this update. Summary of changes: .../ClientRegistrationEventQueueManager.java | 19 + .../tier/sockets/CacheClientNotifierTest.java | 2 ++ .../ClientRegistrationEventQueueManagerTest.java | 31 ++ 3 files changed, 52 insertions(+)
[geode] branch develop updated (d315756 -> ddef7b7)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from d315756 GEODE-6742: Rename and move ExceptionsDUnitTest to integrationTest new 8557957 GEODE-6327: Ability to specify identity fields on JSON documents new 987cfb4 Using RestoreSystemProperties rule in tests new ddef7b7 Merge pull request #3545 from mcmellawatt/feature/GEODE-6327 The 7759 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. Summary of changes: .../geode/pdx/JSONFormatterBasicJUnitTest.java | 52 ++- .../java/org/apache/geode/pdx/JSONFormatter.java | 76 +- .../geode/pdx/internal/json/PdxInstanceHelper.java | 31 - .../pdx/internal/json/PdxInstanceSortedHelper.java | 21 +- 4 files changed, 145 insertions(+), 35 deletions(-)
[geode] branch develop updated: GEODE-6708: Ensuring single drainer and preventing NPE
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new bc2a2fa GEODE-6708: Ensuring single drainer and preventing NPE bc2a2fa is described below commit bc2a2fa5af374cfedfba4dc1abe6cbc2a7b719c8 Author: Ryan McMahon AuthorDate: Thu Apr 25 17:19:31 2019 -0700 GEODE-6708: Ensuring single drainer and preventing NPE --- .../cache/tier/sockets/CacheClientNotifier.java| 19 - .../ClientRegistrationEventQueueManager.java | 99 ++ .../ClientRegistrationEventQueueManagerTest.java | 59 - 3 files changed, 136 insertions(+), 41 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifier.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifier.java index a7dc8a4..da141d2 100755 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifier.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifier.java @@ -40,6 +40,7 @@ import java.util.concurrent.ConcurrentMap; import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; +import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantReadWriteLock; import org.apache.logging.log4j.Logger; @@ -171,15 +172,15 @@ public class CacheClientNotifier { try { if (isClientPermitted(clientRegistrationMetadata, clientProxyMembershipID)) { registrationQueueManager.create(clientProxyMembershipID, new ConcurrentLinkedQueue<>(), -new ReentrantReadWriteLock()); +new ReentrantReadWriteLock(), new ReentrantLock()); try { registerClientInternal(clientRegistrationMetadata, socket, isPrimary, acceptorId, notifyBySubscription); } finally { - registrationQueueManager.drain( - clientProxyMembershipID, - this); + if (isProxyInitialized(clientProxyMembershipID)) { +registrationQueueManager.drain(clientProxyMembershipID, this); + } } } } catch (final AuthenticationRequiredException ex) { @@ -1220,6 +1221,16 @@ public class CacheClientNotifier { } /** + * Determines whether a client proxy has been initialized + * + * @param clientProxyMembershipID The client proxy membership ID + * @return Whether the client proxy is initialized + */ + private boolean isProxyInitialized(final ClientProxyMembershipID clientProxyMembershipID) { +return getClientProxy(clientProxyMembershipID) != null; + } + + /** * Returns the CacheClientProxy associated to the membershipID * * * @return the CacheClientProxy associated to the membershipID diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientRegistrationEventQueueManager.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientRegistrationEventQueueManager.java index 122a192..23d8ef5 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientRegistrationEventQueueManager.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientRegistrationEventQueueManager.java @@ -20,6 +20,7 @@ import java.util.Queue; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantLock; import org.apache.logging.log4j.Logger; @@ -95,39 +96,58 @@ class ClientRegistrationEventQueueManager { void drain(final ClientProxyMembershipID clientProxyMembershipID, final CacheClientNotifier cacheClientNotifier) { -// As an optimization, we drain as many events from the queue as we can -// before taking out a lock to drain the remaining events -if (logger.isDebugEnabled()) { - logger.debug("Draining events from registration queue for client proxy " - + clientProxyMembershipID - + " without synchronization"); -} - -drainEventsReceivedWhileRegisteringClient(clientProxyMembershipID, cacheClientNotifier); - ClientRegistrationEventQueue registrationEventQueue = registeringProxyEventQueues.get(clientProxyMembershipID); -registrationEventQueue.lockForDraining(); -try { - if (logger.isDebugEnabled()) { -logger.debug("Draining remaining events from registration queue for client proxy " -+ clientProxyMembershipID + " with synchronization"); - } +if (registrationEventQueue != null) { + // It is possible that several client registration threads are active
[geode] branch develop updated: GEODE-6607: Moving client registration queue to CacheClientNotifier
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new afc311c GEODE-6607: Moving client registration queue to CacheClientNotifier afc311c is described below commit afc311c04f6908a8f725834cdf2c49ce6e902b3f Author: Ryan McMahon AuthorDate: Thu Apr 18 10:30:29 2019 -0700 GEODE-6607: Moving client registration queue to CacheClientNotifier To avoid client subscription data inconsistencies, we need to ensure that we minimize the chance that an event is processed while a client is registering but before it has fully registered. There are two major phases in registration - one is to request filter info from a peer already hosting the queue for the client, and the other is doing a GII of the queue from a peer. If an event which a client would be interested in is processed concurrently during registration, but before the filter info has been fully received and processed, the event will be missed by the client. To reduce this window, we will start queueing events for the registering client as soon as possible (deserialization of the client proxy membership ID). After registration is complete, we drain the queued events and put them into the clients subscription queue. To make this code unit testable, it was necessary to extract the logic reading data off the socket/deserializing that data into a separate class which can be injected, the ClientRegistrationMetadata class. This allows us to mock a ClientRegistrationMetadata without actually doing any IO. The CacheClientNotifier could be futher broken up to allow for even more unit testability, but this was a first step in the right direction. Co-authored-by: Ryan McMahon Co-authored-by: Murtuza Boxwala Co-authored-by: Ernie Burghardt --- .../CacheClientNotifierIntegrationTest.java| 301 -- .../internal/cache/tier/sockets/AcceptorImpl.java | 12 +- .../cache/tier/sockets/CacheClientNotifier.java| 619 + .../cache/tier/sockets/CacheClientProxy.java | 88 +-- .../ClientRegistrationEventQueueManager.java | 279 ++ .../tier/sockets/ClientRegistrationMetadata.java | 193 +++ .../cache/tier/sockets/SocketMessageWriter.java| 102 .../tier/sockets/CacheClientNotifierTest.java | 176 ++ .../ClientRegistrationEventQueueManagerTest.java | 199 +++ .../java/org/apache/geode/test/fake/Fakes.java | 9 +- 10 files changed, 1239 insertions(+), 739 deletions(-) diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifierIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifierIntegrationTest.java deleted file mode 100644 index 774ba05..000 --- a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifierIntegrationTest.java +++ /dev/null @@ -1,301 +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.internal.cache.tier.sockets; - -import static org.apache.geode.test.awaitility.GeodeAwaitility.await; -import static org.apache.geode.test.awaitility.GeodeAwaitility.getTimeout; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - -import java.io.IOException; -import java.net.InetAddress; -import java.net.Socket; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.Callable; -import java.util.concurrent.Cou
[geode] branch develop updated: GEODE-5724: Fixed typo with link in javadoc
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 574eb7c GEODE-5724: Fixed typo with link in javadoc 574eb7c is described below commit 574eb7c35a0d1bb133df52d1d806aea3ddbcecd3 Author: Jason Huynh AuthorDate: Thu Apr 11 11:24:57 2019 -0700 GEODE-5724: Fixed typo with link in javadoc --- geode-core/src/main/java/org/apache/geode/cache/util/ObjectSizer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geode-core/src/main/java/org/apache/geode/cache/util/ObjectSizer.java b/geode-core/src/main/java/org/apache/geode/cache/util/ObjectSizer.java index 7d688f6..0a11275 100755 --- a/geode-core/src/main/java/org/apache/geode/cache/util/ObjectSizer.java +++ b/geode-core/src/main/java/org/apache/geode/cache/util/ObjectSizer.java @@ -26,7 +26,7 @@ import org.apache.geode.internal.size.SizeClassOnceObjectSizer; * * You should use a sizer with a {@link EvictionAttributes#createLRUHeapAttributes(ObjectSizer)} or * {@link EvictionAttributes#createLRUMemoryAttributes(ObjectSizer)} if you want to use a faster or - * more accurate method of sizing than provided by the default object sizer, which is {#link + * more accurate method of sizing than provided by the default object sizer, which is * {@link #SIZE_CLASS_ONCE} * *
[geode] branch develop updated: GEODE-6488: Migrating cancellation state to execution context (#3322)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 3ffbc41 GEODE-6488: Migrating cancellation state to execution context (#3322) 3ffbc41 is described below commit 3ffbc4183de59aa0603bea2e25f91a6e80a1d079 Author: Ryan McMahon AuthorDate: Wed Mar 20 08:38:04 2019 -0700 GEODE-6488: Migrating cancellation state to execution context (#3322) This work solves two problems. One is that the query cancellation task reference in DefaultQuery could be overwritten and thus never removed from monitoring upon successful completion of a query. Second is that once a query execution timed out once, the query object was in an unusable state which is undesirable. The solution is to attach the cancellation state to the execution context rather than the query object, so that cancellation is associated with each independent execution of a query rather than having cancellation state that applies to the entire query object. --- .../dunit/QueryUsingFunctionContextDUnitTest.java | 11 ++- .../ResourceManagerWithQueryMonitorDUnitTest.java | 10 ++- .../cache/query/partitioned/PRQueryDUnitTest.java | 14 +++- .../internal/cache/PRQueryDistributedTest.java | 4 +- .../execute/LocalDataSetIndexingDUnitTest.java | 7 +- .../apache/geode/cache/query/QueryJUnitTest.java | 4 +- .../cache/query/QueryServiceRegressionTest.java| 11 ++- .../QueryWithBucketParameterIntegrationTest.java | 16 +++- .../internal/QueryMonitorIntegrationTest.java | 73 ++--- .../internal/index/CompactRangeIndexJUnitTest.java | 7 +- ...itionedRegionQueryEvaluatorIntegrationTest.java | 12 +-- .../codeAnalysis/sanctionedDataSerializables.txt | 2 +- .../MonitorQueryUnderContentionBenchmark.java | 10 +-- .../geode/cache/query/internal/DefaultQuery.java | 95 +- .../cache/query/internal/ExecutionContext.java | 54 +++- .../query/internal/QueryExecutionContext.java | 6 +- .../geode/cache/query/internal/QueryExecutor.java | 5 +- .../geode/cache/query/internal/QueryMonitor.java | 71 .../cache/query/internal/index/HashIndex.java | 2 +- .../query/internal/index/MemoryIndexStore.java | 27 +++--- .../internal/streaming/StreamingOperation.java | 4 +- .../apache/geode/internal/cache/LocalDataSet.java | 11 ++- .../geode/internal/cache/PRQueryProcessor.java | 5 +- .../geode/internal/cache/PartitionedRegion.java| 14 +++- .../cache/PartitionedRegionQueryEvaluator.java | 45 +- .../internal/cache/partitioned/QueryMessage.java | 12 ++- .../cache/tier/sockets/BaseCommandQuery.java | 40 ++--- .../internal/beans/QueryDataFunction.java | 5 +- .../internal/CompiledIteratorDefJUnitTest.java | 2 +- .../cache/query/internal/QueryMonitorTest.java | 22 ++--- .../cache/PartitionedRegionQueryEvaluatorTest.java | 30 --- .../cache/query/dunit/QueryMonitorDUnitTest.java | 90 .../cache/query/cq/internal/command/ExecuteCQ.java | 5 +- .../query/cq/internal/command/ExecuteCQ61.java | 5 +- .../geode/test/junit/rules/LocatorStarterRule.java | 2 +- .../geode/test/junit/rules/ServerStarterRule.java | 2 +- 36 files changed, 467 insertions(+), 268 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java index b540c44..53b218d 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java @@ -52,10 +52,13 @@ import org.apache.geode.cache.query.SelectResults; import org.apache.geode.cache.query.data.Portfolio; import org.apache.geode.cache.query.functional.StructSetOrResultsSet; import org.apache.geode.cache.query.internal.DefaultQuery; +import org.apache.geode.cache.query.internal.ExecutionContext; import org.apache.geode.cache.query.internal.IndexTrackingQueryObserver; +import org.apache.geode.cache.query.internal.QueryExecutionContext; import org.apache.geode.cache.query.internal.QueryObserverHolder; import org.apache.geode.cache30.CacheSerializableRunnable; import org.apache.geode.distributed.ConfigurationProperties; +import org.apache.geode.internal.cache.InternalCache; import org.apache.geode.internal.cache.LocalDataSet; import org.apache.geode.internal.cache.PartitionedRegion; import org.apache.geode.internal.cache.execute.PRClientServerTestBase; @@ -673,9 +676,11 @@ public class QueryUsingFunctionContextDUnitTest extends
[geode] branch develop updated: GEODE-6380: Making pmd.gradle more portable (#3194)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new c7f2983 GEODE-6380: Making pmd.gradle more portable (#3194) c7f2983 is described below commit c7f2983312bb5929242dacbbb7862a247125e5f5 Author: Ryan McMahon AuthorDate: Thu Feb 14 12:07:47 2019 -0800 GEODE-6380: Making pmd.gradle more portable (#3194) --- gradle/pmd.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/pmd.gradle b/gradle/pmd.gradle index a20ddf9..a368dc2 100644 --- a/gradle/pmd.gradle +++ b/gradle/pmd.gradle @@ -17,7 +17,7 @@ apply plugin: 'pmd' pmd { sourceSets = [sourceSets.main] - ruleSetFiles = files("${rootDir}/static-analysis/pmd/src/main/resources/geodepmd.xml") + ruleSetFiles = files("${project.projectDir}/../static-analysis/pmd/src/main/resources/geodepmd.xml") ruleSets = [] } dependencies {
[geode] branch develop updated: GEODE-6277: use await() instead of hard-coded sleep(3000) in the test (#3086)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new bfc0449 GEODE-6277: use await() instead of hard-coded sleep(3000) in the test (#3086) bfc0449 is described below commit bfc0449e81b7ac5429f7473b216762c22c10f95b Author: Xiaojian Zhou AuthorDate: Wed Feb 6 17:14:34 2019 -0800 GEODE-6277: use await() instead of hard-coded sleep(3000) in the test (#3086) --- .../java/org/apache/geode/cache30/MultiVMRegionTestCase.java | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/geode-dunit/src/main/java/org/apache/geode/cache30/MultiVMRegionTestCase.java b/geode-dunit/src/main/java/org/apache/geode/cache30/MultiVMRegionTestCase.java index de400e0..ff4747c 100644 --- a/geode-dunit/src/main/java/org/apache/geode/cache30/MultiVMRegionTestCase.java +++ b/geode-dunit/src/main/java/org/apache/geode/cache30/MultiVMRegionTestCase.java @@ -4971,13 +4971,9 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase { // reset slow org.apache.geode.internal.cache.InitialImageOperation.slowImageProcessing = 0; // if global scope, the region doesn't get destroyed until after region creation - try { -Thread.sleep(3000); - } catch (InterruptedException ie) { -fail("interrupted"); - } - assertThat(getRootRegion().getSubregion(name) == null - || getRegionAttributes().getScope().isGlobal()).isTrue(); + await().until( + () -> getRootRegion().getSubregion(name) == null || getRegionAttributes() + .getScope().isGlobal()); } }); if (getRegionAttributes().getScope().isGlobal()) {
[geode] branch develop updated (590150f -> 5be5d54)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. omit 590150f Trigger CI omit c258adc Searching for answers This update removed existing revisions from the reference, leaving the reference pointing at a previous point in the repository history. * -- * -- N refs/heads/develop (5be5d54) \ O -- O -- O (590150f) Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. No new revisions were added by this update. Summary of changes: .../geode/internal/cache/GemFireCacheImpl.java | 26 -- .../internal/cache/control/HeapMemoryMonitor.java | 10 - 2 files changed, 4 insertions(+), 32 deletions(-)
[geode] branch develop updated: Trigger CI
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 590150f Trigger CI 590150f is described below commit 590150f25498abde5eae8a395fd5471cf5ebeb21 Author: Ryan McMahon AuthorDate: Wed Feb 6 16:49:41 2019 -0800 Trigger CI
[geode] branch develop updated: Searching for answers
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new c258adc Searching for answers c258adc is described below commit c258adcae0704b5a72727ec821be33037a492619 Author: Ryan McMahon AuthorDate: Wed Feb 6 16:40:33 2019 -0800 Searching for answers --- .../geode/internal/cache/GemFireCacheImpl.java | 26 ++ .../internal/cache/control/HeapMemoryMonitor.java | 10 + 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java index fa6fc2a..b4a41ba 100755 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java @@ -175,6 +175,7 @@ import org.apache.geode.internal.DSCODE; import org.apache.geode.internal.SystemTimer; import org.apache.geode.internal.Version; import org.apache.geode.internal.cache.backup.BackupService; +import org.apache.geode.internal.cache.control.HeapMemoryMonitor; import org.apache.geode.internal.cache.control.InternalResourceManager; import org.apache.geode.internal.cache.control.InternalResourceManager.ResourceType; import org.apache.geode.internal.cache.control.ResourceAdvisor; @@ -1200,13 +1201,21 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has * references to this instance in this method (vs. the constructor). */ private void initialize() { +HeapMemoryMonitor heapMemoryMonitor = new HeapMemoryMonitor(); + +System.out.println("RYGUY Usage 1: " + heapMemoryMonitor.getBytesUsed()); + for (CacheLifecycleListener listener : cacheLifecycleListeners) { listener.cacheCreated(this); } +System.out.println("RYGUY Usage 2: " + heapMemoryMonitor.getBytesUsed()); + // set ClassPathLoader and then deploy cluster config jars ClassPathLoader.setLatestToDefault(this.system.getConfig().getDeployWorkingDir()); +System.out.println("RYGUY Usage 3: " + heapMemoryMonitor.getBytesUsed()); + try { ccLoader.deployJarsReceivedFromClusterConfiguration(this.configurationResponse); } catch (IOException | ClassNotFoundException e) { @@ -1215,12 +1224,18 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has e); } +System.out.println("RYGUY Usage 4: " + heapMemoryMonitor.getBytesUsed()); + SystemMemberCacheEventProcessor.send(this, Operation.CACHE_CREATE); this.resourceAdvisor.initializationGate(); +System.out.println("RYGUY Usage 5: " + heapMemoryMonitor.getBytesUsed()); + // Register function that we need to execute to fetch available REST service endpoints in DS FunctionService.registerFunction(new FindRestEnabledServersFunction()); +System.out.println("RYGUY Usage 6: " + heapMemoryMonitor.getBytesUsed()); + // moved this after initializeDeclarativeCache because in the future // distributed system creation will not happen until we have read // cache.xml file. @@ -1230,17 +1245,28 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has // This call may need to be moved inside initializeDeclarativeCache. this.jmxAdvisor.initializationGate(); // Entry to GemFire Management service +System.out.println("RYGUY Usage 7: " + heapMemoryMonitor.getBytesUsed()); + // this starts up the ManagementService, register and federate the internal beans this.system.handleResourceEvent(ResourceEvent.CACHE_CREATE, this); +System.out.println("RYGUY Usage 8: " + heapMemoryMonitor.getBytesUsed()); + initializeServices(); +System.out.println("RYGUY Usage 9: " + heapMemoryMonitor.getBytesUsed()); + boolean completedCacheXml = false; try { if (!isClient) { applyJarAndXmlFromClusterConfig(); } + System.out.println("RYGUY Usage 10: " + heapMemoryMonitor.getBytesUsed()); + initializeDeclarativeCache(); + + System.out.println("RYGUY Usage 11: " + heapMemoryMonitor.getBytesUsed()); + completedCacheXml = true; } catch (RuntimeException e) { logger.error("Cache initialization for {} failed because: {}", this, e); // fix GEODE-3038 diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/control/HeapMemoryMonitor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/control/HeapMemoryMonitor.java index 0922b94..2107554 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/control/HeapMemoryMonitor.java +++ b/ge
[geode] branch develop updated: GEODE-6347: Setting tolerance to 1 for Cache XML tests (#3163)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 5b7347d GEODE-6347: Setting tolerance to 1 for Cache XML tests (#3163) 5b7347d is described below commit 5b7347d9ec98227462c09b8187ec21f1679f9637 Author: Ryan McMahon AuthorDate: Tue Feb 5 14:33:09 2019 -0800 GEODE-6347: Setting tolerance to 1 for Cache XML tests (#3163) --- .../src/main/java/org/apache/geode/cache30/CacheXmlTestCase.java | 9 + 1 file changed, 9 insertions(+) diff --git a/geode-dunit/src/main/java/org/apache/geode/cache30/CacheXmlTestCase.java b/geode-dunit/src/main/java/org/apache/geode/cache30/CacheXmlTestCase.java index b1aa608..77b147f 100644 --- a/geode-dunit/src/main/java/org/apache/geode/cache30/CacheXmlTestCase.java +++ b/geode-dunit/src/main/java/org/apache/geode/cache30/CacheXmlTestCase.java @@ -32,6 +32,7 @@ import org.apache.commons.io.FileUtils; import org.junit.Rule; import org.apache.geode.cache.Cache; +import org.apache.geode.distributed.internal.DistributionConfig; import org.apache.geode.internal.cache.GemFireCacheImpl; import org.apache.geode.internal.cache.xmlcache.CacheCreation; import org.apache.geode.internal.cache.xmlcache.CacheXml; @@ -50,6 +51,7 @@ public class CacheXmlTestCase extends JUnit4CacheTestCase { /** set this to false if a test needs a non-loner distributed system */ static boolean lonerDistributedSystem = true; + private static String previousMemoryEventTolerance; @Rule public DistributedRestoreSystemProperties restoreSystemProperties = @@ -63,6 +65,8 @@ public class CacheXmlTestCase extends JUnit4CacheTestCase { @Override public final void postSetUp() throws Exception { +previousMemoryEventTolerance = +System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "memoryEventTolerance", "1"); disconnectAllFromDS(); } @@ -74,6 +78,11 @@ public class CacheXmlTestCase extends JUnit4CacheTestCase { waitForNoRebalancing(); Invoke.invokeInEveryVM(CacheXmlTestCase::waitForNoRebalancing); +if (previousMemoryEventTolerance != null) { + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "memoryEventTolerance", + previousMemoryEventTolerance); +} + super.preTearDownCacheTestCase(); }
[geode] branch develop updated: GEODE-6347: Adding better logging around critical threshold state change (#3146)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 5ee6fdc GEODE-6347: Adding better logging around critical threshold state change (#3146) 5ee6fdc is described below commit 5ee6fdc9172f8700aaa65f32bce70b24c2340b1c Author: Ryan McMahon AuthorDate: Thu Jan 31 17:57:33 2019 -0800 GEODE-6347: Adding better logging around critical threshold state change (#3146) --- .../geode/internal/cache/control/HeapMemoryMonitor.java | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/control/HeapMemoryMonitor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/control/HeapMemoryMonitor.java index 3047670..0922b94 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/control/HeapMemoryMonitor.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/control/HeapMemoryMonitor.java @@ -597,16 +597,14 @@ public class HeapMemoryMonitor implements NotificationListener, MemoryMonitor { if (event.getState().isCritical() && !event.getPreviousState().isCritical()) { this.cache.getLogger().error( - String.format("Member: %s above %s critical threshold. Event generated via %s.", - event.getMember(), "heap", eventOrigin)); + createCriticalThresholdLogMessage(event, eventOrigin, true)); if (!this.cache.isQueryMonitorDisabledForLowMemory()) { this.cache.getQueryMonitor().setLowMemory(true, event.getBytesUsed()); } } else if (!event.getState().isCritical() && event.getPreviousState().isCritical()) { this.cache.getLogger().error( - String.format("Member: %s below %s critical threshold. Event generated via %s.", - event.getMember(), "heap", eventOrigin)); + createCriticalThresholdLogMessage(event, eventOrigin, false)); if (!this.cache.isQueryMonitorDisabledForLowMemory()) { this.cache.getQueryMonitor().setLowMemory(false, event.getBytesUsed()); } @@ -844,4 +842,13 @@ public class HeapMemoryMonitor implements NotificationListener, MemoryMonitor { public static void setTestBytesUsedForThresholdSet(final long newTestBytesUsedForThresholdSet) { testBytesUsedForThresholdSet = newTestBytesUsedForThresholdSet; } + + private String createCriticalThresholdLogMessage(MemoryEvent event, String eventOrigin, + boolean above) { +return "Member: " + event.getMember() + " " + (above ? "above" : "below") ++ " heap critical threshold." ++ " Event generated via " + eventOrigin + "." ++ " Used bytes: " + event.getBytesUsed() + "." ++ " Memory thresholds: " + thresholds; + } }
[geode] branch develop updated: GEODE-6304: Refactor memory monitor to properly reset tolerance counter (#3102)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 546abdd GEODE-6304: Refactor memory monitor to properly reset tolerance counter (#3102) 546abdd is described below commit 546abdd173afe13c01e148900c2b9114dc5bc4cc Author: Ryan McMahon AuthorDate: Wed Jan 30 10:47:03 2019 -0800 GEODE-6304: Refactor memory monitor to properly reset tolerance counter (#3102) The tolerance counter was not properly being reset between non-consecutive EVICTION and CRITICAL events. To fix this and make it more understandable, the threshold logic was combined with the logic to compute the next state in the MemoryThreshold state machine. The counter is now reset between non-consecutive EVICTION and CRITICAL events. --- .../management/MemoryThresholdsDUnitTest.java | 136 +++--- .../ResourceManagerWithQueryMonitorDUnitTest.java | 10 +- .../cache/PartitionedRegionEvictionDUnitTest.java | 5 +- .../internal/cache/eviction/EvictionDUnitTest.java | 2 +- .../cache/control/MemoryMonitorJUnitTest.java | 128 ++--- .../internal/cache/control/HeapMemoryMonitor.java | 120 - .../internal/cache/control/MemoryThresholds.java | 42 - .../cache/control/HeapMemoryMonitorTest.java | 197 - .../java/org/apache/geode/test/fake/Fakes.java | 4 + .../geode/cache/lucene/EvictionDUnitTest.java | 5 +- 10 files changed, 414 insertions(+), 235 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/cache/management/MemoryThresholdsDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/cache/management/MemoryThresholdsDUnitTest.java index c11b575..c186b24 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/cache/management/MemoryThresholdsDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/cache/management/MemoryThresholdsDUnitTest.java @@ -471,7 +471,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase { public Object call() throws Exception { InternalCache gfCache = getCache(); getCache().getLogger().fine(addExpectedExString); - gfCache.getInternalResourceManager().getHeapMonitor().updateStateAndSendEvent(950); + gfCache.getInternalResourceManager().getHeapMonitor().updateStateAndSendEvent(950, "test"); getCache().getLogger().fine(removeExpectedExString); return null; } @@ -491,7 +491,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase { public Object call() throws Exception { InternalCache gfCache = getCache(); getCache().getLogger().fine(addExpectedBelow); - gfCache.getInternalResourceManager().getHeapMonitor().updateStateAndSendEvent(850); + gfCache.getInternalResourceManager().getHeapMonitor().updateStateAndSendEvent(850, "test"); getCache().getLogger().fine(removeExpectedBelow); return null; } @@ -508,7 +508,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase { @Override public Object call() throws Exception { InternalCache gfCache = getCache(); - gfCache.getInternalResourceManager().getHeapMonitor().updateStateAndSendEvent(840); + gfCache.getInternalResourceManager().getHeapMonitor().updateStateAndSendEvent(840, "test"); return null; } }); @@ -524,7 +524,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase { @Override public Object call() throws Exception { InternalCache gfCache = getCache(); - gfCache.getInternalResourceManager().getHeapMonitor().updateStateAndSendEvent(750); + gfCache.getInternalResourceManager().getHeapMonitor().updateStateAndSendEvent(750, "test"); return null; } }); @@ -541,7 +541,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase { @Override public Object call() throws Exception { InternalCache gfCache = getCache(); - gfCache.getInternalResourceManager().getHeapMonitor().updateStateAndSendEvent(950); + gfCache.getInternalResourceManager().getHeapMonitor().updateStateAndSendEvent(950, "test"); return null; } }); @@ -557,7 +557,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase { @Override public Object call() throws Exception { InternalCache gfCache = getCache(); - gfCache.getInternalResourceManager().getHeapMonitor().updateStateAndSendEvent(750); + gfCache.getInternalResourceManager().getHeapMonitor().updateStateAndSendEvent(750, "test"); ret
[geode-examples] branch develop updated: GEODE-5806: Adding example for durable messaging in client subscriptions (#69)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode-examples.git The following commit(s) were added to refs/heads/develop by this push: new a2b7afa GEODE-5806: Adding example for durable messaging in client subscriptions (#69) a2b7afa is described below commit a2b7afada61030e3d05f76be90687e673c0c8e03 Author: Ryan McMahon AuthorDate: Mon Jan 14 10:09:24 2019 -0800 GEODE-5806: Adding example for durable messaging in client subscriptions (#69) --- README.md | 4 +- durableMessaging/README.md | 51 ++ durableMessaging/scripts/start.gfsh| 24 + durableMessaging/scripts/stop.gfsh | 18 .../geode_examples/durableMessaging/Example.java | 113 + gradle/rat.gradle | 1 + settings.gradle| 1 + 7 files changed, 210 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 804c3d1..9cbee7a 100644 --- a/README.md +++ b/README.md @@ -86,8 +86,8 @@ tutorial. ### Advanced * [Lucene Spatial Indexing](luceneSpatial/README.md) -* WAN Gateway -* Durable subscriptions +* [WAN Gateway](wan/README.md) +* [Durable Messaging for Subscriptions](durableMessaging/README.md) * Delta propagation * Network partition detection * D-lock diff --git a/durableMessaging/README.md b/durableMessaging/README.md new file mode 100644 index 000..f80a13d --- /dev/null +++ b/durableMessaging/README.md @@ -0,0 +1,51 @@ + + +# Geode Durable Messaging Example + +This example demonstrates Apache Geode's Durable Messaging feature. +Use durable messaging for subscriptions that you need maintained for your clients even when your clients are down or disconnected. +You can configure any of your event subscriptions as durable. Events for durable queries and subscriptions are saved in a queue when the client +is disconnected and played back when the client reconnects. Other queries and subscriptions are removed from the queue. + +The example performs the following tasks to demonstrate durable messaging: + +1. Create a client cache with durable messaging enabled +2. Register interest in all keys in the example region with durable messaging enabled +3. Close the client cache, simulating a disconnection +4. Start a second client, and do puts while the first client is down +5. Restart the first client, and observe that the create events in the durable queue are delivered. A simple cache listener is used to print output to the terminal as create events are received. If interested, see [Cache Listeners](listener/README.md) for more details on how cache listeners work. + +This example assumes you have installed Java and Geode. + +## Steps + +1. From the `geode-examples/durableMessaging` directory, build the example. + +$ ../gradlew build + +2. Next start a locator, start a server, and create a region. + +$ gfsh run --file=scripts/start.gfsh + +3. Run the example to demonstrate durable messaging. + +$ ../gradlew run + +4. Shut down the server. + +$ gfsh run --file=scripts/stop.gfsh diff --git a/durableMessaging/scripts/start.gfsh b/durableMessaging/scripts/start.gfsh new file mode 100644 index 000..4c845bc --- /dev/null +++ b/durableMessaging/scripts/start.gfsh @@ -0,0 +1,24 @@ +# +# 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. +# +start locator --name=locator --bind-address=127.0.0.1 + +start server --name=server --locators=127.0.0.1[10334] --server-port=0 + +list members + +create region --name=example-region --type=REPLICATE +describe region --name=example-region diff --git a/durableMessaging/scripts/stop.gfsh b/durableMessaging/scripts/stop.gfsh new file mode 100644 index 000..7672d87 --- /dev/null +++ b/durableMessaging/scripts/stop.gfsh @@ -0,0 +1,18 @@ +# +# 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 licen
[geode-examples] branch develop updated: GEODE-6060: Properly registering example cache listener
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode-examples.git The following commit(s) were added to refs/heads/develop by this push: new 15f5264 GEODE-6060: Properly registering example cache listener 15f5264 is described below commit 15f5264a11a9c89c53e5c0d6410e532b6168733e Author: Ryan McMahon AuthorDate: Mon Jan 14 10:08:46 2019 -0800 GEODE-6060: Properly registering example cache listener --- listener/src/main/java/org/apache/geode_examples/listener/Example.java | 1 + 1 file changed, 1 insertion(+) diff --git a/listener/src/main/java/org/apache/geode_examples/listener/Example.java b/listener/src/main/java/org/apache/geode_examples/listener/Example.java index 95f35e4..c10a161 100644 --- a/listener/src/main/java/org/apache/geode_examples/listener/Example.java +++ b/listener/src/main/java/org/apache/geode_examples/listener/Example.java @@ -44,6 +44,7 @@ public class Example { // create a local region that matches the server region ClientRegionFactory clientRegionFactory = cache.createClientRegionFactory(ClientRegionShortcut.PROXY); +clientRegionFactory.addCacheListener(new ExampleCacheListener()); Region region = clientRegionFactory.create("example-region"); example.putEntries(region);
[geode] branch develop updated: GEODE-6143: remove PowerMock from VMStatsMonitorTest (#2984)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 82dd208 GEODE-6143: remove PowerMock from VMStatsMonitorTest (#2984) 82dd208 is described below commit 82dd2089d042122c432700b1838c84aa2b733def Author: Xiaojian Zhou AuthorDate: Wed Dec 12 13:22:02 2018 -0800 GEODE-6143: remove PowerMock from VMStatsMonitorTest (#2984) --- .../internal/beans/stats/VMStatsMonitor.java | 11 ++ .../internal/beans/stats/VMStatsMonitorTest.java | 25 +++--- 2 files changed, 10 insertions(+), 26 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/beans/stats/VMStatsMonitor.java b/geode-core/src/main/java/org/apache/geode/management/internal/beans/stats/VMStatsMonitor.java index 431996d..6830448 100644 --- a/geode-core/src/main/java/org/apache/geode/management/internal/beans/stats/VMStatsMonitor.java +++ b/geode-core/src/main/java/org/apache/geode/management/internal/beans/stats/VMStatsMonitor.java @@ -60,21 +60,24 @@ public class VMStatsMonitor extends MBeanStatsMonitor { return lastProcessCpuTime; } - public VMStatsMonitor(String name) { + public VMStatsMonitor(String name, boolean processCPUTimeAvailable) { super(name); -processCPUTimeAvailable = MBeanJMXAdapter.isAttributeAvailable(PROCESS_CPU_TIME_ATTRIBUTE, -ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME); +this.processCPUTimeAvailable = processCPUTimeAvailable; if (!processCPUTimeAvailable) { cpuUsage = VALUE_NOT_AVAILABLE; } } + public VMStatsMonitor(String name) { +this(name, MBeanJMXAdapter.isAttributeAvailable(PROCESS_CPU_TIME_ATTRIBUTE, +ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME)); + } + long currentTimeMillis() { return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); } /** - * * @param systemTime Current system time. * @param cpuTime Last gathered cpu time. * @return The time (as a percentage) that this member's process time with respect to Statistics diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/beans/stats/VMStatsMonitorTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/beans/stats/VMStatsMonitorTest.java index 5180971..6284ff7 100644 --- a/geode-core/src/test/java/org/apache/geode/management/internal/beans/stats/VMStatsMonitorTest.java +++ b/geode-core/src/test/java/org/apache/geode/management/internal/beans/stats/VMStatsMonitorTest.java @@ -16,7 +16,6 @@ package org.apache.geode.management.internal.beans.stats; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.within; -import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -26,47 +25,30 @@ import java.time.Instant; import java.time.ZonedDateTime; import java.time.temporal.ChronoUnit; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.rules.TestName; -import org.junit.runner.RunWith; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; -import org.apache.geode.management.internal.MBeanJMXAdapter; import org.apache.geode.test.junit.categories.StatisticsTest; @Category(StatisticsTest.class) -@RunWith(PowerMockRunner.class) -@PowerMockIgnore("*.UnitTest") -@PrepareForTest(MBeanJMXAdapter.class) public class VMStatsMonitorTest { @Rule public TestName testName = new TestName(); private VMStatsMonitor vmStatsMonitor; - @Before - public void setUp() { -PowerMockito.mockStatic(MBeanJMXAdapter.class); - } - @Test public void statisticInitialValueShouldBeZeroWhenTheProcessCpuTimeJmxAttributeIsAvailable() { -when(MBeanJMXAdapter.isAttributeAvailable(anyString(), anyString())).thenReturn(true); -vmStatsMonitor = new VMStatsMonitor(testName.getMethodName()); +vmStatsMonitor = new VMStatsMonitor(testName.getMethodName(), true); assertThat(vmStatsMonitor).isNotNull(); assertThat(vmStatsMonitor.getCpuUsage()).isEqualTo(0); } @Test public void statisticInitialValueShouldBeUndefinedWhenTheProcessCpuTimeJmxAttributeIsNotAvailable() { -when(MBeanJMXAdapter.isAttributeAvailable(anyString(), anyString())).thenReturn(false); -vmStatsMonitor = new VMStatsMonitor(testName.getMethodName()); +vmStatsMonitor = new VMStatsMonitor(testName.getMethodName(), false); assertThat(vmStatsMonitor).isNotNull(); assertThat(vmStatsMonitor.g
[geode] branch feature/GEODE-6143-3 deleted (was 058cd83)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a change to branch feature/GEODE-6143-3 in repository https://gitbox.apache.org/repos/asf/geode.git. was 058cd83 GEODE-6143: remove PowerMock from VMStatsMonitorTest The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
[geode] branch develop updated: GEODE-6143: Removing PowerMock from MBeanProxyFactoryTest (#2975)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new d7e7e87 GEODE-6143: Removing PowerMock from MBeanProxyFactoryTest (#2975) d7e7e87 is described below commit d7e7e87b32a6a6c0e0891dc9704db7d66e7deaf9 Author: Ryan McMahon AuthorDate: Tue Dec 11 12:26:11 2018 -0800 GEODE-6143: Removing PowerMock from MBeanProxyFactoryTest (#2975) --- .../management/internal/MBeanProxyFactory.java | 8 ++-- .../management/internal/MBeanProxyFactoryTest.java | 24 -- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/MBeanProxyFactory.java b/geode-core/src/main/java/org/apache/geode/management/internal/MBeanProxyFactory.java index cbbd516..e54ce8a 100644 --- a/geode-core/src/main/java/org/apache/geode/management/internal/MBeanProxyFactory.java +++ b/geode-core/src/main/java/org/apache/geode/management/internal/MBeanProxyFactory.java @@ -166,8 +166,7 @@ public class MBeanProxyFactory { removeProxy(member, mbeanName, val); } catch (EntryNotFoundException entryNotFoundException) { // Entry has already been removed by another thread, so no need to remove it -logger.warn("Proxy for entry {} and member {} has already been removed", entry, -member.getId()); +logProxyAlreadyRemoved(member, entry); } catch (Exception e) { if (!(e.getCause() instanceof InstanceNotFoundException)) { logger.warn("Remove Proxy failed for {} due to {}", key, e.getMessage(), e); @@ -269,4 +268,9 @@ public class MBeanProxyFactory { } + void logProxyAlreadyRemoved(DistributedMember member, Entry entry) { +logger.warn("Proxy for entry {} and member {} has already been removed", entry, +member.getId()); + } + } diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/MBeanProxyFactoryTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/MBeanProxyFactoryTest.java index c719fbd..73fc15d 100644 --- a/geode-core/src/test/java/org/apache/geode/management/internal/MBeanProxyFactoryTest.java +++ b/geode-core/src/test/java/org/apache/geode/management/internal/MBeanProxyFactoryTest.java @@ -16,45 +16,29 @@ package org.apache.geode.management.internal; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.powermock.api.mockito.PowerMockito.mockStatic; -import static org.powermock.api.mockito.PowerMockito.when; import java.util.HashSet; import java.util.Map; import java.util.Set; -import org.apache.logging.log4j.Logger; import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; import org.apache.geode.cache.EntryNotFoundException; import org.apache.geode.cache.Region; import org.apache.geode.distributed.DistributedMember; -import org.apache.geode.internal.logging.LogService; -@RunWith(PowerMockRunner.class) -@PrepareForTest(LogService.class) -@PowerMockIgnore("javax.script.*") public class MBeanProxyFactoryTest { @Test public void removeAllProxiesEntryNotFoundLogged() { -mockStatic(LogService.class); -Logger mockLogger = PowerMockito.mock(Logger.class); -when(mockLogger.isDebugEnabled()).thenReturn(true); -when(LogService.getLogger()).thenReturn(mockLogger); - MBeanProxyFactory mBeanProxyFactory = -new MBeanProxyFactory(mock(MBeanJMXAdapter.class), mock(SystemManagementService.class)); +spy(new MBeanProxyFactory(mock(MBeanJMXAdapter.class), +mock(SystemManagementService.class))); Region mockRegion = mock(Region.class); Set entrySet = new HashSet>(); @@ -68,6 +52,6 @@ public class MBeanProxyFactoryTest { // EntryNotFoundException should just result in a warning as it implies // the proxy has already been removed and the entry has already been destroyed -verify(mockLogger, times(1)).warn(anyString(), any(), any()); +verify(mBeanProxyFactory, times(1)).logProxyAlreadyRemoved(any(), any()); } }
[geode] branch develop updated: GEODE-6143: Adding test category back to CacheClientNotifierIntegrationTest (#2981)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 9c145bf GEODE-6143: Adding test category back to CacheClientNotifierIntegrationTest (#2981) 9c145bf is described below commit 9c145bf181b70b7f99cbac2587388d3a52e17e54 Author: Ryan McMahon AuthorDate: Tue Dec 11 12:25:32 2018 -0800 GEODE-6143: Adding test category back to CacheClientNotifierIntegrationTest (#2981) --- .../cache/tier/sockets/CacheClientNotifierIntegrationTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifierIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifierIntegrationTest.java index 845f115..0f871f71 100644 --- a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifierIntegrationTest.java +++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifierIntegrationTest.java @@ -43,6 +43,7 @@ import java.util.concurrent.Future; import org.apache.shiro.subject.Subject; import org.junit.Assert; import org.junit.Test; +import org.junit.experimental.categories.Category; import org.mockito.stubbing.Answer; import org.apache.geode.CancelCriterion; @@ -69,7 +70,9 @@ import org.apache.geode.internal.cache.InternalCache; import org.apache.geode.internal.cache.InternalRegionArguments; import org.apache.geode.internal.cache.LocalRegion; import org.apache.geode.internal.security.SecurityService; +import org.apache.geode.test.junit.categories.ClientSubscriptionTest; +@Category({ClientSubscriptionTest.class}) public class CacheClientNotifierIntegrationTest { @Test public void testCacheClientNotifier_NotifyClients_QRMCausesPrematureRemovalFromHAContainer()
[geode] branch develop updated: GEODE-6143: Remove PowerMock and improve LuceneEventListenerJUnitTest
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 88e1305 GEODE-6143: Remove PowerMock and improve LuceneEventListenerJUnitTest 88e1305 is described below commit 88e13056decaa5d2d4d1664408c0989876e3413c Author: Xiaojian Zhou AuthorDate: Mon Dec 10 16:51:50 2018 -0800 GEODE-6143: Remove PowerMock and improve LuceneEventListenerJUnitTest --- .../cache/lucene/internal/LuceneEventListener.java | 10 +++-- .../internal/LuceneEventListenerJUnitTest.java | 52 +++--- 2 files changed, 42 insertions(+), 20 deletions(-) diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneEventListener.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneEventListener.java index db44981..b28f021 100644 --- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneEventListener.java +++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneEventListener.java @@ -59,6 +59,10 @@ public class LuceneEventListener implements AsyncEventListener { @Override public void close() {} + void logDebugMessage(String msg, Exception e) { +logger.debug(msg, e); + } + @Override public boolean processEvents(List events) { try { @@ -103,13 +107,13 @@ public class LuceneEventListener implements AsyncEventListener { } return true; } catch (BucketNotFoundException | RegionDestroyedException | PrimaryBucketException e) { - logger.debug("Bucket not found while saving to lucene index: " + e.getMessage(), e); + logDebugMessage("Bucket not found while saving to lucene index: " + e.getMessage(), e); return false; } catch (CacheClosedException e) { - logger.debug("Unable to save to lucene index, cache has been closed", e); + logDebugMessage("Unable to save to lucene index, cache has been closed", e); return false; } catch (AlreadyClosedException e) { - logger.debug("Unable to commit, the lucene index is already closed", e); + logDebugMessage("Unable to commit, the lucene index is already closed", e); return false; } catch (IOException e) { throw new InternalGemFireError("Unable to save to lucene index", e); diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneEventListenerJUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneEventListenerJUnitTest.java index 8255859..5fa489f 100644 --- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneEventListenerJUnitTest.java +++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneEventListenerJUnitTest.java @@ -17,14 +17,15 @@ package org.apache.geode.cache.lucene.internal; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.fail; +import static org.mockito.ArgumentMatchers.contains; +import static org.mockito.ArgumentMatchers.startsWith; import static org.mockito.Mockito.any; -import static org.mockito.Mockito.anyString; import static org.mockito.Mockito.atLeast; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.eq; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; +import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -36,20 +37,16 @@ import java.util.LinkedList; import java.util.List; import java.util.concurrent.atomic.AtomicReference; -import org.apache.logging.log4j.Logger; +import org.apache.lucene.store.AlreadyClosedException; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; -import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; import org.apache.geode.InternalGemFireError; +import org.apache.geode.cache.CacheClosedException; import org.apache.geode.cache.Region; import org.apache.geode.cache.asyncqueue.AsyncEvent; import org.apache.geode.cache.lucene.internal.repository.IndexRepository; @@ -58,17 +55,13 @@ import org.apache.geode.internal.Assert; import org.apache.geode.internal.cache.BucketNotFoundException; import org.apache.geode.internal.cache.EntrySnapshot; import org.apache.geode.internal.cache.Intern
[geode] branch develop updated: GEODE-6167: move the test to the integration test module since it starts a cache (#2973)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new e55c68c GEODE-6167: move the test to the integration test module since it starts a cache (#2973) e55c68c is described below commit e55c68c28745d53c112d43b7fdf976c8ec077742 Author: jinmeiliao AuthorDate: Fri Dec 7 13:25:08 2018 -0800 GEODE-6167: move the test to the integration test module since it starts a cache (#2973) --- .../java/org/apache/geode/internal/cache/snapshot/ClientExporterTest.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/snapshot/ClientExporterTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/snapshot/ClientExporterTest.java similarity index 100% rename from geode-core/src/test/java/org/apache/geode/internal/cache/snapshot/ClientExporterTest.java rename to geode-core/src/integrationTest/java/org/apache/geode/internal/cache/snapshot/ClientExporterTest.java
[geode] branch develop updated: GEODE-6143: Remove PowerMock from CacheClientNotifierIntegrationTest (#2959)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new ace1884 GEODE-6143: Remove PowerMock from CacheClientNotifierIntegrationTest (#2959) ace1884 is described below commit ace188422355639e90bccd59aad2ee1699c9ac78 Author: Ryan McMahon AuthorDate: Thu Dec 6 13:26:34 2018 -0800 GEODE-6143: Remove PowerMock from CacheClientNotifierIntegrationTest (#2959) --- .../CacheClientNotifierIntegrationTest.java| 104 ++--- .../cache/tier/sockets/CacheClientProxy.java | 6 +- 2 files changed, 36 insertions(+), 74 deletions(-) diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifierIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifierIntegrationTest.java index b0e149d..845f115 100644 --- a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifierIntegrationTest.java +++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifierIntegrationTest.java @@ -17,10 +17,12 @@ package org.apache.geode.internal.cache.tier.sockets; import static org.apache.geode.test.awaitility.GeodeAwaitility.await; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; import java.io.IOException; import java.net.InetAddress; @@ -41,16 +43,9 @@ import java.util.concurrent.Future; import org.apache.shiro.subject.Subject; import org.junit.Assert; import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.junit.runner.RunWith; -import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; import org.apache.geode.CancelCriterion; -import org.apache.geode.DataSerializer; import org.apache.geode.Statistics; import org.apache.geode.StatisticsType; import org.apache.geode.cache.AttributesMutator; @@ -62,7 +57,6 @@ import org.apache.geode.distributed.internal.DistributionConfig; import org.apache.geode.distributed.internal.DistributionManager; import org.apache.geode.distributed.internal.InternalDistributedSystem; import org.apache.geode.distributed.internal.membership.InternalDistributedMember; -import org.apache.geode.internal.InternalDataSerializer; import org.apache.geode.internal.SystemTimer; import org.apache.geode.internal.Version; import org.apache.geode.internal.cache.EntryEventImpl; @@ -75,11 +69,7 @@ import org.apache.geode.internal.cache.InternalCache; import org.apache.geode.internal.cache.InternalRegionArguments; import org.apache.geode.internal.cache.LocalRegion; import org.apache.geode.internal.security.SecurityService; -import org.apache.geode.test.junit.categories.ClientSubscriptionTest; -@Category({ClientSubscriptionTest.class}) -@RunWith(PowerMockRunner.class) -@PrepareForTest({CacheClientProxy.class, DataSerializer.class}) public class CacheClientNotifierIntegrationTest { @Test public void testCacheClientNotifier_NotifyClients_QRMCausesPrematureRemovalFromHAContainer() @@ -87,8 +77,6 @@ public class CacheClientNotifierIntegrationTest { final CountDownLatch messageDispatcherInitLatch = new CountDownLatch(1); final CountDownLatch notifyClientLatch = new CountDownLatch(1); -setupMockMessageDispatcher(messageDispatcherInitLatch, notifyClientLatch); - InternalCache mockInternalCache = createMockInternalCache(); CacheClientNotifier cacheClientNotifier = @@ -100,22 +88,29 @@ public class CacheClientNotifierIntegrationTest { CacheClientProxy cacheClientProxyOne = createMockCacheClientProxy(cacheClientNotifier, mockRegionNameProxyOne); + CacheClientProxy cacheClientProxyTwo = createMockCacheClientProxy(cacheClientNotifier, mockRegionNameProxyTwo); +doAnswer(invocation -> { + messageDispatcherInitLatch.countDown(); + notifyClientLatch.await(); + return invocation.callRealMethod(); +}).when(cacheClientProxyTwo).createMessageDispatcher(anyString()); + createMockHARegion(mockInternalCache, cacheClientProxyOne, mockRegionNameProxyOne, true); createMockHARegion(mockInternalCache, cacheClientProxyTwo, mockRegionNameProxyTwo, false); ExecutorService executorService = Executors.newFixedThreadPool(2); -Collection> initAndNotifyTasks = new ArrayList<>(); +
[geode] branch develop updated: GEODE-6143: Removing PowerMock from BackupFileCopierIntegrationTest (#2955)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 2c3fd5b GEODE-6143: Removing PowerMock from BackupFileCopierIntegrationTest (#2955) 2c3fd5b is described below commit 2c3fd5b05137e9be1f83ffc2c4ed876c5c60ce46 Author: Ryan McMahon AuthorDate: Thu Dec 6 09:28:42 2018 -0800 GEODE-6143: Removing PowerMock from BackupFileCopierIntegrationTest (#2955) --- .../backup/BackupFileCopierIntegrationTest.java| 25 +++--- .../internal/cache/backup/BackupFileCopier.java| 12 +-- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/backup/BackupFileCopierIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/backup/BackupFileCopierIntegrationTest.java index 2679dcf..38b44fd 100644 --- a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/backup/BackupFileCopierIntegrationTest.java +++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/backup/BackupFileCopierIntegrationTest.java @@ -19,12 +19,14 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.assertj.core.api.Assertions.entry; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; import java.io.File; import java.io.IOException; +import java.net.MalformedURLException; import java.net.URISyntaxException; import java.net.URL; import java.nio.file.Files; @@ -38,11 +40,6 @@ import org.junit.Rule; import org.junit.Test; import org.junit.contrib.java.lang.system.RestoreSystemProperties; import org.junit.rules.TemporaryFolder; -import org.junit.runner.RunWith; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; import org.apache.geode.cache.DiskStore; import org.apache.geode.distributed.DistributedSystem; @@ -54,9 +51,6 @@ import org.apache.geode.internal.cache.DiskStoreImpl; import org.apache.geode.internal.cache.InternalCache; import org.apache.geode.internal.cache.Oplog; -@PowerMockIgnore("*.IntegrationTest") -@PrepareForTest({BackupFileCopier.class, URL.class}) -@RunWith(PowerMockRunner.class) public class BackupFileCopierIntegrationTest { private static final String CONFIG_DIRECTORY = "config"; private static final String USER_FILES = "user"; @@ -80,7 +74,7 @@ public class BackupFileCopierIntegrationTest { tempFiles = mock(TemporaryBackupFiles.class); tempFilesLocation = tempFolder.newFolder("temporaryBackupFiles").toPath(); when(tempFiles.getDirectory()).thenReturn(tempFilesLocation); -fileCopier = new BackupFileCopier(cache, tempFiles); +fileCopier = spy(new BackupFileCopier(cache, tempFiles)); } @Test @@ -97,11 +91,10 @@ public class BackupFileCopierIntegrationTest { } @Test - public void throwsIOExceptionIfConfigFileLocationInvalid() throws URISyntaxException { -URL badUrl = PowerMockito.mock(URL.class); -PowerMockito.doThrow(new URISyntaxException("", "")).when(badUrl).toURI(); -when(cache.getCacheXmlURL()).thenReturn(badUrl); - + public void throwsIOExceptionIfConfigFileLocationInvalid() + throws URISyntaxException, MalformedURLException { +doReturn(new URL("http://www.test.com;)).when(cache).getCacheXmlURL(); +doThrow(new URISyntaxException("test", "test")).when(fileCopier).getSource(any()); assertThatThrownBy(() -> fileCopier.copyConfigFiles()).isInstanceOf(IOException.class); } @@ -257,9 +250,7 @@ public class BackupFileCopierIntegrationTest { Path diskStoreDir = tempFolder.newFolder("diskstores").toPath(); when(tempFiles.getDiskStoreDirectory(any(), any())).thenReturn(diskStoreDir); -PowerMockito.mockStatic(Files.class); -PowerMockito.doThrow(new IOException()).when(Files.class); -Files.createLink(any(), any()); +doThrow(new IOException()).when(fileCopier).createLink(any(), any()); fileCopier.copyOplog(diskStore, oplog); diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupFileCopier.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupFileCopier.java index d536bc8..c3999ff 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupFileCopier.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/Backu
[geode] branch develop updated: GEODE-6052: Use constructor DI to avoid PowerMock in JMX tests (#2891)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 8aba8b9 GEODE-6052: Use constructor DI to avoid PowerMock in JMX tests (#2891) 8aba8b9 is described below commit 8aba8b9f8f0301370cf55fcd8824b2a80e21f3d1 Author: Ryan McMahon AuthorDate: Mon Nov 26 16:13:31 2018 -0800 GEODE-6052: Use constructor DI to avoid PowerMock in JMX tests (#2891) --- .../internal/security/MBeanSecurityJUnitTest.java | 3 +- .../geode/management/internal/MBeanJMXAdapter.java | 20 + .../internal/SystemManagementService.java | 19 - .../management/internal/MBeanJMXAdapterTest.java | 47 ++ 4 files changed, 37 insertions(+), 52 deletions(-) diff --git a/geode-core/src/integrationTest/java/org/apache/geode/management/internal/security/MBeanSecurityJUnitTest.java b/geode-core/src/integrationTest/java/org/apache/geode/management/internal/security/MBeanSecurityJUnitTest.java index e573a0e..c1130fb 100644 --- a/geode-core/src/integrationTest/java/org/apache/geode/management/internal/security/MBeanSecurityJUnitTest.java +++ b/geode-core/src/integrationTest/java/org/apache/geode/management/internal/security/MBeanSecurityJUnitTest.java @@ -35,6 +35,7 @@ import org.junit.Rule; import org.junit.Test; import org.junit.experimental.categories.Category; +import org.apache.geode.distributed.DistributedMember; import org.apache.geode.management.ManagementException; import org.apache.geode.management.ManagementService; import org.apache.geode.management.MemberMXBean; @@ -106,7 +107,7 @@ public class MBeanSecurityJUnitTest { () -> server.createMBean("FakeClassName", new ObjectName("GemFire", "name", "foo"))) .isInstanceOf(ReflectionException.class); -MBeanJMXAdapter adapter = new MBeanJMXAdapter(); +MBeanJMXAdapter adapter = new MBeanJMXAdapter(mock(DistributedMember.class)); assertThatThrownBy(() -> adapter.registerMBean(mock(DynamicMBean.class), new ObjectName("MockDomain", "name", "mock"), false)) .isInstanceOf(ManagementException.class); diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/MBeanJMXAdapter.java b/geode-core/src/main/java/org/apache/geode/management/internal/MBeanJMXAdapter.java index 3a13c11..a76a85c 100644 --- a/geode-core/src/main/java/org/apache/geode/management/internal/MBeanJMXAdapter.java +++ b/geode-core/src/main/java/org/apache/geode/management/internal/MBeanJMXAdapter.java @@ -63,22 +63,21 @@ import org.apache.geode.management.RegionMXBean; * */ public class MBeanJMXAdapter implements ManagementConstants { - /** The MBeanServer for this application */ public static MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer(); - private Map localGemFireMBean; + private final Map localGemFireMBean; - private DistributedMember distMember; + private final DistributedMember distMember; - private Logger logger = LogService.getLogger(); + private static final Logger logger = LogService.getLogger(); /** * public constructor */ - public MBeanJMXAdapter() { + public MBeanJMXAdapter(DistributedMember distMember) { this.localGemFireMBean = new ConcurrentHashMap<>(); -this.distMember = InternalDistributedSystem.getConnectedInstance().getDistributedMember(); +this.distMember = distMember; } /** @@ -165,7 +164,7 @@ public class MBeanJMXAdapter implements ManagementConstants { } catch (InstanceAlreadyExistsException instanceAlreadyExistsException) { // An InstanceAlreadyExistsException in this context means that the MBean // has already been registered, so just log a warning message. - logger.warn("MBean with ObjectName " + objectName + " has already been registered."); + logRegistrationWarning(objectName, true); } catch (NullPointerException | NotCompliantMBeanException | MBeanRegistrationException e) { throw new ManagementException(e); @@ -194,7 +193,7 @@ public class MBeanJMXAdapter implements ManagementConstants { // has already been unregistered, so just log a debug message as it is // essentially a no-op. // has already been unregistered, so just log a warning message. - logger.warn("MBean with ObjectName " + objectName + " has already been unregistered."); + logRegistrationWarning(objectName, false); } catch (NullPointerException | MBeanRegistrationException e) { throw new ManagementException(e); } @@ -561,4 +560,9 @@ public class MBeanJMXAdapter implements ManagementConstants { return true; } + + void logRegistrationWarning(ObjectName objectName, boolean register
[geode] branch release/1.8.0 updated: GEODE-6065: Continue event processing when hostname lookup fails (#2883)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch release/1.8.0 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/release/1.8.0 by this push: new 671671b GEODE-6065: Continue event processing when hostname lookup fails (#2883) 671671b is described below commit 671671b5e81acde2684df3331aedf176cc927e6e Author: Ryan McMahon AuthorDate: Tue Nov 20 18:49:51 2018 -0800 GEODE-6065: Continue event processing when hostname lookup fails (#2883) Co-authored-by: Ryan McMahon Co-authored-by: Bill Burcham --- .../client/internal/pooling/PooledConnection.java | 2 +- .../membership/InternalDistributedMember.java | 22 ++- ...SenderEventRemoteDispatcherIntegrationTest.java | 189 + 3 files changed, 208 insertions(+), 5 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/pooling/PooledConnection.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/pooling/PooledConnection.java index cb155e6..3cfbb31 100644 --- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/pooling/PooledConnection.java +++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/pooling/PooledConnection.java @@ -37,7 +37,7 @@ import org.apache.geode.internal.cache.tier.sockets.ServerQueueStatus; * @since GemFire 5.7 * */ -class PooledConnection implements Connection { +public class PooledConnection implements Connection { /* * connection is volatile because we may asynchronously destroy the pooled connection while diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/InternalDistributedMember.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/InternalDistributedMember.java index 5aaf5c6..cb86b02 100755 --- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/InternalDistributedMember.java +++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/InternalDistributedMember.java @@ -30,9 +30,9 @@ import java.util.List; import java.util.Set; import org.apache.geode.DataSerializer; -import org.apache.geode.GemFireConfigException; import org.apache.geode.InternalGemFireError; import org.apache.geode.cache.UnsupportedVersionException; +import org.apache.geode.cache.client.ServerConnectivityException; import org.apache.geode.distributed.DistributedMember; import org.apache.geode.distributed.DurableClientAttributes; import org.apache.geode.distributed.Role; @@ -94,6 +94,19 @@ public class InternalDistributedMember implements DistributedMember, Externaliza /** product version bit flag */ private static final int VERSION_BIT = 0x8; + @FunctionalInterface + public interface HostnameResolver { +InetAddress getInetAddress(ServerLocation location) throws UnknownHostException; + } + + public static void setHostnameResolver(final HostnameResolver hostnameResolver) { +InternalDistributedMember.hostnameResolver = hostnameResolver; + } + + /** Retrieves an InetAddress given the provided hostname */ + private static HostnameResolver hostnameResolver = + (location) -> InetAddress.getByName(location.getHostName()); + /** * Representing the host name of this member. */ @@ -213,12 +226,13 @@ public class InternalDistributedMember implements DistributedMember, Externaliza public InternalDistributedMember(ServerLocation location) { this.hostName = location.getHostName(); -InetAddress addr = null; +final InetAddress addr; try { - addr = InetAddress.getByName(this.hostName); + addr = hostnameResolver.getInetAddress(location); } catch (UnknownHostException e) { - throw new GemFireConfigException("Unable to resolve server location " + location, e); + throw new ServerConnectivityException("Unable to resolve server location " + location, e); } + netMbr = MemberFactory.newNetMember(addr, location.getPort()); netMbr.setVmKind(ClusterDistributionManager.NORMAL_DM_TYPE); versionObj = Version.CURRENT; diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/GatewaySenderEventRemoteDispatcherIntegrationTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/GatewaySenderEventRemoteDispatcherIntegrationTest.java new file mode 100644 index 000..a48c401 --- /dev/null +++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/GatewaySenderEventRemoteDispatcherIntegrationTest.java @@ -0,0 +1,189 @@ +/* + * 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");
[geode] branch develop updated: GEODE-6065: Continue event processing when hostname lookup fails (#2883)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 7cd2f0c GEODE-6065: Continue event processing when hostname lookup fails (#2883) 7cd2f0c is described below commit 7cd2f0c5dfc982148352acbfbb303afaa1358c2a Author: Ryan McMahon AuthorDate: Tue Nov 20 18:49:51 2018 -0800 GEODE-6065: Continue event processing when hostname lookup fails (#2883) Co-authored-by: Ryan McMahon Co-authored-by: Bill Burcham --- .../client/internal/pooling/PooledConnection.java | 2 +- .../membership/InternalDistributedMember.java | 22 ++- ...SenderEventRemoteDispatcherIntegrationTest.java | 189 + 3 files changed, 208 insertions(+), 5 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/pooling/PooledConnection.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/pooling/PooledConnection.java index cb155e6..3cfbb31 100644 --- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/pooling/PooledConnection.java +++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/pooling/PooledConnection.java @@ -37,7 +37,7 @@ import org.apache.geode.internal.cache.tier.sockets.ServerQueueStatus; * @since GemFire 5.7 * */ -class PooledConnection implements Connection { +public class PooledConnection implements Connection { /* * connection is volatile because we may asynchronously destroy the pooled connection while diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/InternalDistributedMember.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/InternalDistributedMember.java index 5aaf5c6..cb86b02 100755 --- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/InternalDistributedMember.java +++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/InternalDistributedMember.java @@ -30,9 +30,9 @@ import java.util.List; import java.util.Set; import org.apache.geode.DataSerializer; -import org.apache.geode.GemFireConfigException; import org.apache.geode.InternalGemFireError; import org.apache.geode.cache.UnsupportedVersionException; +import org.apache.geode.cache.client.ServerConnectivityException; import org.apache.geode.distributed.DistributedMember; import org.apache.geode.distributed.DurableClientAttributes; import org.apache.geode.distributed.Role; @@ -94,6 +94,19 @@ public class InternalDistributedMember implements DistributedMember, Externaliza /** product version bit flag */ private static final int VERSION_BIT = 0x8; + @FunctionalInterface + public interface HostnameResolver { +InetAddress getInetAddress(ServerLocation location) throws UnknownHostException; + } + + public static void setHostnameResolver(final HostnameResolver hostnameResolver) { +InternalDistributedMember.hostnameResolver = hostnameResolver; + } + + /** Retrieves an InetAddress given the provided hostname */ + private static HostnameResolver hostnameResolver = + (location) -> InetAddress.getByName(location.getHostName()); + /** * Representing the host name of this member. */ @@ -213,12 +226,13 @@ public class InternalDistributedMember implements DistributedMember, Externaliza public InternalDistributedMember(ServerLocation location) { this.hostName = location.getHostName(); -InetAddress addr = null; +final InetAddress addr; try { - addr = InetAddress.getByName(this.hostName); + addr = hostnameResolver.getInetAddress(location); } catch (UnknownHostException e) { - throw new GemFireConfigException("Unable to resolve server location " + location, e); + throw new ServerConnectivityException("Unable to resolve server location " + location, e); } + netMbr = MemberFactory.newNetMember(addr, location.getPort()); netMbr.setVmKind(ClusterDistributionManager.NORMAL_DM_TYPE); versionObj = Version.CURRENT; diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/GatewaySenderEventRemoteDispatcherIntegrationTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/GatewaySenderEventRemoteDispatcherIntegrationTest.java new file mode 100644 index 000..a48c401 --- /dev/null +++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/GatewaySenderEventRemoteDispatcherIntegrationTest.java @@ -0,0 +1,189 @@ +/* + * 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 u
[geode] branch develop updated: GEODE-6073: All files have lf endings (#2873)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new be99d7b GEODE-6073: All files have lf endings (#2873) be99d7b is described below commit be99d7be0dd92159fc69856b8d26a046c3989e37 Author: M. Oleske AuthorDate: Tue Nov 20 12:41:41 2018 -0800 GEODE-6073: All files have lf endings (#2873) - Spotless no longer uses line endings check as it is not recommened - https://github.com/diffplug/spotless/tree/master/plugin-gradle#line-endings-and-encodings-invisible-stuff --- .gitattributes | 2 +- ci/scripts/windows/test-run.sh | 2 +- gradle/spotless.gradle | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitattributes b/.gitattributes index 36dd437..fcadb2c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1 @@ -*.java text=auto eol=lf +* text eol=lf diff --git a/ci/scripts/windows/test-run.sh b/ci/scripts/windows/test-run.sh index 43c6cf3..99c6255 100755 --- a/ci/scripts/windows/test-run.sh +++ b/ci/scripts/windows/test-run.sh @@ -40,7 +40,7 @@ directories_file=${DEST_DIR}/artifact_directories echo "GRADLE_TASK = ${GRADLE_TASK}" echo "BASE_FILENAME = ${BASE_FILENAME}" -DEFAULT_GRADLE_TASK_OPTIONS="--no-daemon -x javadoc -x spotlessCheck" +DEFAULT_GRADLE_TASK_OPTIONS="--no-daemon -x javadoc" if [[ -n "${GRADLE_TEST_CATEGORY}" ]]; then GRADLE_TASK_OPTIONS="-PtestCategory=${GRADLE_TEST_CATEGORY}" diff --git a/gradle/spotless.gradle b/gradle/spotless.gradle index 9b40405..9910aaa 100644 --- a/gradle/spotless.gradle +++ b/gradle/spotless.gradle @@ -18,7 +18,6 @@ subprojects { apply plugin: "com.diffplug.gradle.spotless" spotless { -lineEndings = 'unix' java { target project.fileTree(project.projectDir) { include '**/*.java'
[geode] branch develop updated: GEODE-6072: Clean up thread local between tests (#2871)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 9fbed0f GEODE-6072: Clean up thread local between tests (#2871) 9fbed0f is described below commit 9fbed0fd4e9e801818edcb73150d4d3dddfa3ecd Author: Ryan McMahon AuthorDate: Mon Nov 19 09:45:52 2018 -0800 GEODE-6072: Clean up thread local between tests (#2871) --- .../apache/geode/cache/query/internal/DefaultQuery.java| 10 +- .../geode/cache/query/internal/QueryMonitorTest.java | 14 -- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/DefaultQuery.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/DefaultQuery.java index e0259c9..8bd602e 100644 --- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/DefaultQuery.java +++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/DefaultQuery.java @@ -79,7 +79,7 @@ public class DefaultQuery implements Query { private final QueryStatistics stats; - private Optional expirationTask; + private Optional cancelationTask; private boolean traceOn = false; @@ -160,11 +160,11 @@ public class DefaultQuery implements Query { } public Optional getCancelationTask() { -return expirationTask; +return cancelationTask; } - public void setCancelationTask(final ScheduledFuture expirationTask) { -this.expirationTask = Optional.of(expirationTask); + public void setCancelationTask(final ScheduledFuture cancelationTask) { +this.cancelationTask = Optional.of(cancelationTask); } /** @@ -188,7 +188,7 @@ public class DefaultQuery implements Query { this.traceOn = compiler.isTraceRequested() || QUERY_VERBOSE; this.cache = cache; this.stats = new DefaultQueryStatistics(); -this.expirationTask = Optional.empty(); +this.cancelationTask = Optional.empty(); } /** diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/internal/QueryMonitorTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/internal/QueryMonitorTest.java index 36716b9..bf5ea42 100644 --- a/geode-core/src/test/java/org/apache/geode/cache/query/internal/QueryMonitorTest.java +++ b/geode-core/src/test/java/org/apache/geode/cache/query/internal/QueryMonitorTest.java @@ -17,13 +17,11 @@ package org.apache.geode.cache.query.internal; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.isA; -import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.when; -import java.util.Optional; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; @@ -62,10 +60,14 @@ public class QueryMonitorTest { @After public void afterClass() { -// cleanup the thread local of the queryCancelled status -DefaultQuery query = mock(DefaultQuery.class); -doReturn(Optional.empty()).when(query).getCancelationTask(); -monitor.stopMonitoringQueryThread(query); +/* + * If the query cancelation task is run, it will set the queryCanceled + * thread local on the query to true. + * + * We need to clean up that state between tests because they can run on this same thread. + * In production, this cleanup is done in DefaultQuery after the query executes. + */ +DefaultQuery.queryCanceled.get().set(false); monitor.setLowMemory(false, 100); }
[geode] 01/02: GEODE-5884: Added new command and restored pre 1.8 region function behavior (#2829)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch release/1.8.0 in repository https://gitbox.apache.org/repos/asf/geode.git commit e54e33d19135af64177145d96799d9974812d45d Author: Jason Huynh AuthorDate: Tue Nov 13 15:16:48 2018 -0800 GEODE-5884: Added new command and restored pre 1.8 region function behavior (#2829) * Due to the refactor that caused us to lose wrapping of exceptions, the fix to GEODE-5884 cannot be applied to GEODE 1.0-1.7 clients * Adding new command class will allow clients to identify which function class it is expecting to execute and what behavior to expect --- .../cache/tier/sockets/CommandInitializer.java | 7 +- .../sockets/command/ExecuteRegionFunction66.java | 7 +- .../command/ExecuteRegionFunctionGeode18.java | 62 + .../command/ExecuteRegionFunction66Test.java | 22 ++- java => ExecuteRegionFunctionGeode18Test.java} | 42 +++--- .../RollingUpgradeNonHAFunction.java | 150 + 6 files changed, 250 insertions(+), 40 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CommandInitializer.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CommandInitializer.java index 70857c7..f0cdd55 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CommandInitializer.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CommandInitializer.java @@ -43,6 +43,7 @@ import org.apache.geode.internal.cache.tier.sockets.command.ExecuteFunction70; import org.apache.geode.internal.cache.tier.sockets.command.ExecuteRegionFunction; import org.apache.geode.internal.cache.tier.sockets.command.ExecuteRegionFunction65; import org.apache.geode.internal.cache.tier.sockets.command.ExecuteRegionFunction66; +import org.apache.geode.internal.cache.tier.sockets.command.ExecuteRegionFunctionGeode18; import org.apache.geode.internal.cache.tier.sockets.command.ExecuteRegionFunctionSingleHop; import org.apache.geode.internal.cache.tier.sockets.command.GatewayReceiverCommand; import org.apache.geode.internal.cache.tier.sockets.command.Get70; @@ -329,8 +330,12 @@ public class CommandInitializer { ALL_COMMANDS.put(Version.GEODE_150, commands); ALL_COMMANDS.put(Version.GEODE_160, commands); ALL_COMMANDS.put(Version.GEODE_170, commands); -ALL_COMMANDS.put(Version.GEODE_180, commands); +Map geode18Commands = new HashMap(); +geode18Commands.putAll(ALL_COMMANDS.get(Version.GEODE_170)); +geode18Commands.put(MessageType.EXECUTE_REGION_FUNCTION, +ExecuteRegionFunctionGeode18.getCommand()); +ALL_COMMANDS.put(Version.GEODE_180, geode18Commands); } public static Map getCommands(Version version) { diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction66.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction66.java index 166d470..d6c701f 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction66.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction66.java @@ -60,7 +60,7 @@ public class ExecuteRegionFunction66 extends BaseCommand { return singleton; } - private ExecuteRegionFunction66() {} + ExecuteRegionFunction66() {} @Override public void cmdExecute(final Message clientMessage, final ServerConnection serverConnection, @@ -396,7 +396,6 @@ public class ExecuteRegionFunction66 extends BaseCommand { if (function instanceof String) { switch (functionState) { case AbstractExecution.NO_HA_HASRESULT_NO_OPTIMIZEFORWRITE: - execution.setWaitOnExceptionFlag(true); execution.execute((String) function).getResult(); break; case AbstractExecution.HA_HASRESULT_NO_OPTIMIZEFORWRITE: @@ -406,14 +405,10 @@ public class ExecuteRegionFunction66 extends BaseCommand { execution.execute((String) function).getResult(); break; case AbstractExecution.NO_HA_HASRESULT_OPTIMIZEFORWRITE: - execution.setWaitOnExceptionFlag(true); execution.execute((String) function).getResult(); break; } } else { - if (!functionObject.isHA()) { -execution.setWaitOnExceptionFlag(true); - } execution.execute(functionObject).getResult(); } } diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunctionGeode18.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunctionGeode18.java new file mode 100644 index 000..386cd55 --- /dev/null +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/comm
[geode] branch release/1.8.0 updated (411ff86 -> 35f7a43)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a change to branch release/1.8.0 in repository https://gitbox.apache.org/repos/asf/geode.git. from 411ff86 GEODE-5993: Eliminate race in monitorQueryThread() (#2818) new e54e33d GEODE-5884: Added new command and restored pre 1.8 region function behavior (#2829) new 35f7a43 GEODE-5884: Adding to function exception list if cause is FunctionInvocationTargetException (#2809) 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. Summary of changes: .../client/internal/ExecuteRegionFunctionOp.java | 31 -- .../cache/tier/sockets/CommandInitializer.java | 7 ++- .../sockets/command/ExecuteRegionFunction66.java | 7 +-- .../command/ExecuteRegionFunctionGeode18.java | 62 .../internal/ExecuteRegionFunctionOpTest.java | 63 + .../command/ExecuteRegionFunction66Test.java | 22 java => ExecuteRegionFunctionGeode18Test.java} | 42 +++--- ...Query.java => RollingUpgradeNonHAFunction.java} | 66 -- 8 files changed, 250 insertions(+), 50 deletions(-) create mode 100644 geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunctionGeode18.java create mode 100644 geode-core/src/test/java/org/apache/geode/cache/client/internal/ExecuteRegionFunctionOpTest.java copy geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/command/{ExecuteRegionFunction66Test.java => ExecuteRegionFunctionGeode18Test.java} (84%) copy geode-core/src/upgradeTest/java/org/apache/geode/internal/cache/rollingupgrade/{RollingUpgradeTracePRQuery.java => RollingUpgradeNonHAFunction.java} (61%)
[geode] branch release/1.8.0 updated (4192d05 -> 411ff86)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a change to branch release/1.8.0 in repository https://gitbox.apache.org/repos/asf/geode.git. from 4192d05 GEODE-6048 build should work on release branches (#2847) add 70902b0 Revert "GEODE-5729: when DistributedCacheOperation needs 2 messages, should let (#2458)" (#2801) add 411ff86 GEODE-5993: Eliminate race in monitorQueryThread() (#2818) No new revisions were added by this update. Summary of changes: .../internal/QueryMonitorIntegrationTest.java | 10 +- .../apache/geode/codeAnalysis/excludedClasses.txt | 5 +- .../MonitorQueryUnderContentionBenchmark.java | 2 +- .../cache/query/internal/DefaultQueryService.java | 2 +- .../geode/cache/query/internal/QueryMonitor.java | 349 + .../internal/cache/DistributedCacheOperation.java | 28 +- .../geode/internal/cache/GemFireCacheImpl.java | 2 +- .../internal/cache/partitioned/QueryMessage.java | 6 +- .../cache/query/internal/QueryMonitorTest.java | 8 +- .../internal/cache/CacheOperationMessageTest.java | 50 --- 10 files changed, 238 insertions(+), 224 deletions(-)
[geode] branch develop updated: GEODE-5993: Eliminate race in monitorQueryThread() (#2818)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new aab0198 GEODE-5993: Eliminate race in monitorQueryThread() (#2818) aab0198 is described below commit aab0198e8478d4246042b2eb889c8ce7e28bb52e Author: Bill Burcham AuthorDate: Fri Nov 9 15:12:03 2018 -0800 GEODE-5993: Eliminate race in monitorQueryThread() (#2818) A race existed between setting low memory in the heap monitor thread, and checking the low memory state in query monitoring thread. The cancelation executor was shut down and no longer accepting new tasks when this race occurred, causing a RejectedExecutionException. This commit solves that problem by encapsulating the scheduling behavior using the state design pattern. Co-authored-by: Ryan McMahon Co-authored-by: Bill Burcham --- .../internal/QueryMonitorIntegrationTest.java | 10 +- .../apache/geode/codeAnalysis/excludedClasses.txt | 5 +- .../MonitorQueryUnderContentionBenchmark.java | 2 +- .../cache/query/internal/DefaultQueryService.java | 2 +- .../geode/cache/query/internal/QueryMonitor.java | 349 + .../geode/internal/cache/GemFireCacheImpl.java | 2 +- .../internal/cache/partitioned/QueryMessage.java | 6 +- .../cache/query/internal/QueryMonitorTest.java | 8 +- 8 files changed, 234 insertions(+), 150 deletions(-) diff --git a/geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/QueryMonitorIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/QueryMonitorIntegrationTest.java index ff7035a..41add0e 100644 --- a/geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/QueryMonitorIntegrationTest.java +++ b/geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/QueryMonitorIntegrationTest.java @@ -19,6 +19,8 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; import java.util.concurrent.ScheduledThreadPoolExecutor; @@ -27,6 +29,7 @@ import org.junit.Test; import org.mockito.stubbing.Answer; import org.apache.geode.cache.CacheRuntimeException; +import org.apache.geode.cache.query.QueryExecutionLowMemoryException; import org.apache.geode.internal.cache.InternalCache; import org.apache.geode.test.awaitility.GeodeAwaitility; @@ -66,7 +69,7 @@ public class QueryMonitorIntegrationTest { try { queryMonitor = new QueryMonitor( - () -> scheduledThreadPoolExecutor, + scheduledThreadPoolExecutor, cache, NEVER_EXPIRE_MILLIS); @@ -74,6 +77,9 @@ public class QueryMonitorIntegrationTest { queryMonitor.setLowMemory(true, 1); + verify(query, times(1)) + .setQueryCanceledException(any(QueryExecutionLowMemoryException.class)); + assertThatThrownBy(QueryMonitor::throwExceptionIfQueryOnCurrentThreadIsCanceled, "Expected setLowMemory(true,_) to cancel query immediately, but it didn't.", QueryExecutionCanceledException.class); @@ -95,7 +101,7 @@ public class QueryMonitorIntegrationTest { public void monitorQueryThreadCancelsLongRunningQueriesAndSetsExceptionAndThrowsException() { QueryMonitor queryMonitor = new QueryMonitor( -() -> new ScheduledThreadPoolExecutor(1), +new ScheduledThreadPoolExecutor(1), cache, EXPIRE_QUICK_MILLIS); diff --git a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt index f3c3476..f67da94 100644 --- a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt +++ b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt @@ -85,6 +85,10 @@ org/apache/geode/distributed/internal/RuntimeDistributionConfigImpl org/apache/geode/pdx/internal/PdxInstanceEnum org/apache/geode/pdx/internal/PdxInstanceImpl org/apache/geode/pdx/internal/WritablePdxInstanceImpl +org/apache/geode/cache/query/internal/QueryMonitor$MemoryStateImpl +org/apache/geode/cache/query/internal/QueryMonitor$MemoryStateImpl$1 +org/apache/geode/cache/query/internal/QueryMonitor$MemoryStateImpl$2 +org/apache/geode/cache/query/internal/parse/ASTArithmeticOp org/apache/geode/cache/query/internal/types/TypeUtils$ComparisonStrategy org/apache/geode/cache/query/internal/types/TypeUtils$ComparisonStrategy$1 org/apache/geode/cache/query/internal/types/TypeUtils$ComparisonStrategy$
[geode] branch develop updated: Revert "GEODE-5729: when DistributedCacheOperation needs 2 messages, should let (#2458)" (#2801)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new e9ea18e Revert "GEODE-5729: when DistributedCacheOperation needs 2 messages, should let (#2458)" (#2801) e9ea18e is described below commit e9ea18e18c85b977b91192d4edbb9a4e18b2643e Author: Ryan McMahon AuthorDate: Wed Nov 7 13:11:05 2018 -0800 Revert "GEODE-5729: when DistributedCacheOperation needs 2 messages, should let (#2458)" (#2801) This reverts commit 49eb1c5fd13aefff0995d76ec7864c82d5730dd8. --- .../internal/cache/DistributedCacheOperation.java | 28 ++-- .../internal/cache/CacheOperationMessageTest.java | 50 -- 2 files changed, 4 insertions(+), 74 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java index 1238fae..27490c0 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java @@ -355,11 +355,6 @@ public abstract class DistributedCacheOperation { logger.debug("Computed this filter routing: {}", filterRouting); } } -// if there's one secondary bucket holder needs two messages, then send two messages to all -// the secondary bcukets -if (!twoMessages.isEmpty()) { - twoMessages = recipients; -} } // some members need PR notification of the change for client/wan @@ -510,20 +505,7 @@ public abstract class DistributedCacheOperation { } Set failures = null; -boolean inhibitAllNotifications = false; -if (event instanceof EntryEventImpl) { - inhibitAllNotifications = ((EntryEventImpl) event).inhibitAllNotifications(); -} CacheOperationMessage msg = createMessage(); -if (!twoMessages.isEmpty() && event instanceof EntryEventImpl) { - // If it's message for PR and needs 2 messages, let the distribution message not to - // trigger callback - ((EntryEventImpl) event).setInhibitAllNotifications(true); - logger.info( - "after setInhibitAllNotifications:recipients for {}: {} with adjunct messages to: {}", - event, recipients, - adjunctRecipients); -} initMessage(msg, this.processor); if (DistributedCacheOperation.internalBeforePutOutgoing != null) { @@ -540,8 +522,7 @@ public abstract class DistributedCacheOperation { if (r.isUsedForPartitionedRegionBucket() && event.getOperation().isEntry()) { PartitionMessage pm = ((EntryEventImpl) event).getPartitionMessage(); if (pm != null && pm.getSender() != null -&& !pm.getSender() - .equals(r.getDistributionManager().getDistributionManagerId())) { +&& !pm.getSender().equals(r.getDistributionManager().getDistributionManagerId())) { // PR message sent by another member ReplyProcessor21.setShortSevereAlertProcessing(true); } @@ -648,10 +629,6 @@ public abstract class DistributedCacheOperation { .getCacheDistributionAdvisor().adviseCacheServers(); adjunctRecipientsWithNoCacheServer.removeAll(adviseCacheServers); - // set to its original status - if (event instanceof EntryEventImpl) { -((EntryEventImpl) event).setInhibitAllNotifications(inhibitAllNotifications); - } if (isPutAll) { ((BucketRegion) region).performPutAllAdjunctMessaging((DistributedPutAllOperation) this, recipients, adjunctRecipients, filterRouting, this.processor); @@ -1486,6 +1463,9 @@ public abstract class DistributedCacheOperation { if (this.versionTag instanceof DiskVersionTag) { bits |= PERSISTENT_TAG_MASK; } + if (inhibitAllNotifications) { +bits |= INHIBIT_NOTIFICATIONS_MASK; + } return bits; } diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/CacheOperationMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/CacheOperationMessageTest.java index 811cf5c..7beced8 100644 --- a/geode-core/src/test/java/org/apache/geode/internal/cache/CacheOperationMessageTest.java +++ b/geode-core/src/test/java/org/apache/geode/internal/cache/CacheOperationMessageTest.java @@ -15,27 +15,15 @@ package org.apache.geode.internal.cache; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertFalse; -import sta
[geode] branch develop updated: GEODE-5881: simplify DefaultQuery.TestHook (#2755)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new b040508 GEODE-5881: simplify DefaultQuery.TestHook (#2755) b040508 is described below commit b040508b61839467e9bb737e1780920d4d2fe5c1 Author: Bill Burcham AuthorDate: Wed Oct 31 16:33:36 2018 -0700 GEODE-5881: simplify DefaultQuery.TestHook (#2755) Consolidate three interface methods into one that takes an enum to identify the "spot" in the query processing logic. Co-authored-by: Bill Burcham Co-authored-by: Dale Emery Co-authored-by: Galen O'Sullivan --- .../ResourceManagerWithQueryMonitorDUnitTest.java | 210 - .../internal/cache/PRQueryDistributedTest.java | 184 ++ .../apache/geode/cache/query/QueryJUnitTest.java | 21 ++- .../internal/index/CompactRangeIndexJUnitTest.java | 91 - .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../codeAnalysis/sanctionedDataSerializables.txt | 2 +- .../geode/cache/query/internal/DefaultQuery.java | 61 +- .../cache/query/internal/index/HashIndex.java | 4 +- .../query/internal/index/MemoryIndexStore.java | 42 +++-- .../internal/streaming/StreamingOperation.java | 10 +- .../geode/internal/cache/PRQueryProcessor.java | 153 +-- .../cache/PartitionedRegionQueryEvaluator.java | 16 +- .../internal/cache/partitioned/QueryMessage.java | 7 +- .../cache/query/dunit/QueryMonitorDUnitTest.java | 41 ++-- 14 files changed, 428 insertions(+), 415 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java index 9e9b8c7..49a5b0d 100755 --- a/geode-core/src/distributedTest/java/org/apache/geode/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java @@ -75,7 +75,6 @@ import org.apache.geode.internal.cache.control.TestMemoryThresholdListener; import org.apache.geode.internal.logging.LogService; import org.apache.geode.test.dunit.AsyncInvocation; import org.apache.geode.test.dunit.DistributedTestUtils; -import org.apache.geode.test.dunit.Host; import org.apache.geode.test.dunit.IgnoredException; import org.apache.geode.test.dunit.Invoke; import org.apache.geode.test.dunit.NetworkUtils; @@ -299,12 +298,13 @@ public class ResourceManagerWithQueryMonitorDUnitTest extends ClientServerTestCa } private void doCriticalMemoryHitTest(final String regionName, boolean createPR, - final int criticalThreshold, final boolean disabledQueryMonitorForLowMem, - final int queryTimeout, final boolean hitCriticalThreshold) throws Exception { + final int criticalThreshold, + final boolean disabledQueryMonitorForLowMem, + final int queryTimeout, final boolean hitCriticalThreshold) + throws Exception { // create region on the server -final Host host = Host.getHost(0); -final VM server = host.getVM(0); -final VM client = host.getVM(1); +final VM server = VM.getVM(0); +final VM client = VM.getVM(1); final int numObjects = 200; try { final int port = AvailablePortHelper.getRandomAvailableTCPPort(); @@ -363,14 +363,16 @@ public class ResourceManagerWithQueryMonitorDUnitTest extends ClientServerTestCa // test to verify what happens during index creation if memory threshold is hit private void doCriticalMemoryHitWithIndexTest(final String regionName, boolean createPR, - final int criticalThreshold, final boolean disabledQueryMonitorForLowMem, - final int queryTimeout, final boolean hitCriticalThreshold, final String indexType) + final int criticalThreshold, + final boolean disabledQueryMonitorForLowMem, + final int queryTimeout, + final boolean hitCriticalThreshold, + final String indexType) throws Exception { // create region on the server -final Host host = Host.getHost(0); -final VM server1 = host.getVM(0); -final VM server2 = host.getVM(2); -final VM client = host.getVM(1); +final VM server1 = VM.getVM(0); +final VM server2 = VM.getVM(2); +final VM client = VM.getVM(1); final int numObjects = 200; try { final int[] port = AvailablePortHelper.getRandomAvailableTCPPorts(2); @@ -419,13 +421,16 @@ public class ResourceManagerWithQueryMonitorDUnitTest extends ClientServerTestCa } private void doCriticalMemoryHitAddResultsTestWithMultipleServers(final String regionName, - boolean createPR, final int criticalThreshold, fin
[geode] branch develop updated: GEODE-5568: Rewrite QueryMonitor to use ScheduledThreadPoolExecutor (#2744)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 8061497 GEODE-5568: Rewrite QueryMonitor to use ScheduledThreadPoolExecutor (#2744) 8061497 is described below commit 80614978deefe7528c2135810129a7ad780521fb Author: Ryan McMahon AuthorDate: Tue Oct 30 19:06:49 2018 -0700 GEODE-5568: Rewrite QueryMonitor to use ScheduledThreadPoolExecutor (#2744) * GEODE-5568: Rewrite QueryMonitor to use ScheduledThreadPoolExecutor Eliminate notify/wait bugs and improve hot-path performance. Co-authored-by: Bill Burcham Co-authored-by: Ryan McMahon --- .../ResourceManagerWithQueryMonitorDUnitTest.java | 4 +- .../internal/QueryMonitorIntegrationTest.java | 148 .../MonitorQueryUnderContentionBenchmark.java | 189 ++ .../cache/query/internal/CompiledIteratorDef.java | 3 - .../geode/cache/query/internal/CompiledSelect.java | 4 +- .../geode/cache/query/internal/DefaultQuery.java | 92 ++--- .../internal/QueryExecutionCanceledException.java | 3 +- .../geode/cache/query/internal/QueryMonitor.java | 405 ++--- .../geode/cache/query/internal/QueryUtils.java | 8 +- .../cache/query/internal/SortedStructBag.java | 2 +- .../geode/cache/query/internal/StructBag.java | 2 +- .../cache/query/internal/index/AbstractIndex.java | 4 +- .../query/internal/index/CompactRangeIndex.java| 2 +- .../cache/query/internal/index/HashIndex.java | 2 +- .../query/internal/index/PrimaryKeyIndex.java | 2 +- .../geode/internal/cache/GemFireCacheImpl.java | 19 +- .../geode/internal/cache/PRQueryProcessor.java | 4 +- .../cache/PartitionedRegionQueryEvaluator.java | 6 +- .../internal/cache/control/HeapMemoryMonitor.java | 1 - .../cache/tier/sockets/BaseCommandQuery.java | 3 +- .../cache/query/internal/QueryMonitorTest.java | 130 --- .../cache/query/dunit/QueryMonitorDUnitTest.java | 49 ++- 22 files changed, 722 insertions(+), 360 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java index a3d5150..9e9b8c7 100755 --- a/geode-core/src/distributedTest/java/org/apache/geode/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java @@ -1224,9 +1224,9 @@ public class ResourceManagerWithQueryMonitorDUnitTest extends ClientServerTestCa // -1 needs to be matched due to client/server set up, BaseCommand uses the // MAX_QUERY_EXECUTION_TIME and not the testMaxQueryExecutionTime return (message.contains("The QueryMonitor thread may be sleeping longer than") -|| message.contains("Query execution cancelled after exceeding max execution time") +|| message.contains("Query execution canceled after exceeding max execution time") || message.contains( -String.format("Query execution cancelled after exceeding max execution time %sms.", +String.format("Query execution canceled after exceeding max execution time %sms.", -1))); } diff --git a/geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/QueryMonitorIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/QueryMonitorIntegrationTest.java new file mode 100644 index 000..ff7035a --- /dev/null +++ b/geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/QueryMonitorIntegrationTest.java @@ -0,0 +1,148 @@ +/* + * 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.internal; + +import static org.assertj.core.api.Assertions.assertThat; +import sta
[geode] branch develop updated: GEODE-5857: Handle JMX race conditions during registration and cleanup
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 76420dc GEODE-5857: Handle JMX race conditions during registration and cleanup 76420dc is described below commit 76420dcd93e17f009aa73ca8188d135158358323 Author: Ryan McMahon AuthorDate: Wed Oct 17 10:21:03 2018 -0700 GEODE-5857: Handle JMX race conditions during registration and cleanup --- .../geode/management/internal/MBeanJMXAdapter.java | 28 -- .../management/internal/MBeanProxyFactory.java | 10 +- .../management/internal/MBeanJMXAdapterTest.java | 110 + .../management/internal/MBeanProxyFactoryTest.java | 73 ++ 4 files changed, 208 insertions(+), 13 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/MBeanJMXAdapter.java b/geode-core/src/main/java/org/apache/geode/management/internal/MBeanJMXAdapter.java index 42a1050..3a13c11 100644 --- a/geode-core/src/main/java/org/apache/geode/management/internal/MBeanJMXAdapter.java +++ b/geode-core/src/main/java/org/apache/geode/management/internal/MBeanJMXAdapter.java @@ -35,10 +35,13 @@ import javax.management.ObjectInstance; import javax.management.ObjectName; import javax.management.ReflectionException; +import org.apache.logging.log4j.Logger; + import org.apache.geode.distributed.DistributedMember; import org.apache.geode.distributed.internal.InternalDistributedSystem; import org.apache.geode.distributed.internal.membership.InternalDistributedMember; import org.apache.geode.internal.ClassLoadUtil; +import org.apache.geode.internal.logging.LogService; import org.apache.geode.management.AsyncEventQueueMXBean; import org.apache.geode.management.CacheServerMXBean; import org.apache.geode.management.DiskStoreMXBean; @@ -68,10 +71,11 @@ public class MBeanJMXAdapter implements ManagementConstants { private DistributedMember distMember; + private Logger logger = LogService.getLogger(); + /** * public constructor */ - public MBeanJMXAdapter() { this.localGemFireMBean = new ConcurrentHashMap<>(); this.distMember = InternalDistributedSystem.getConnectedInstance().getDistributedMember(); @@ -152,19 +156,20 @@ public class MBeanJMXAdapter implements ManagementConstants { * */ public void registerMBeanProxy(Object object, ObjectName objectName) { - try { if (isRegistered(objectName)) { return; } mbeanServer.registerMBean(object, objectName); - -} catch (InstanceAlreadyExistsException | NullPointerException | NotCompliantMBeanException +} catch (InstanceAlreadyExistsException instanceAlreadyExistsException) { + // An InstanceAlreadyExistsException in this context means that the MBean + // has already been registered, so just log a warning message. + logger.warn("MBean with ObjectName " + objectName + " has already been registered."); +} catch (NullPointerException | NotCompliantMBeanException | MBeanRegistrationException e) { throw new ManagementException(e); } - } /** @@ -173,21 +178,26 @@ public class MBeanJMXAdapter implements ManagementConstants { * */ public void unregisterMBean(ObjectName objectName) { - try { if (!isRegistered(objectName)) { return; } + mbeanServer.unregisterMBean(objectName); - // For Local GemFire MBeans + // For Local GemFire MBeans if (localGemFireMBean.get(objectName) != null) { localGemFireMBean.remove(objectName); } -} catch (NullPointerException | MBeanRegistrationException | InstanceNotFoundException e) { +} catch (InstanceNotFoundException instanceNotFoundException) { + // An InstanceNotFoundException in this context means that the MBean + // has already been unregistered, so just log a debug message as it is + // essentially a no-op. + // has already been unregistered, so just log a warning message. + logger.warn("MBean with ObjectName " + objectName + " has already been unregistered."); +} catch (NullPointerException | MBeanRegistrationException e) { throw new ManagementException(e); } - } public Object getMBeanObject(ObjectName objectName) { diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/MBeanProxyFactory.java b/geode-core/src/main/java/org/apache/geode/management/internal/MBeanProxyFactory.java index 212ac65..cbbd516 100644 --- a/geode-core/src/main/java/org/apache/geode/management/internal/MBeanProxyFactory.java +++ b/geode-core/src/main/java/org/apache/geode/management/internal/MBeanProxyFactory.java @@ -15,7 +15,6 @@ package org.apache.geode.management.internal; import java.beans.IntrospectionException; -im
[geode] branch develop updated: GEODE-5844: Make log format match args
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 567569b GEODE-5844: Make log format match args 567569b is described below commit 567569bb129d1d8acc0a709edf8b0f4e73be7c92 Author: Bill Burcham AuthorDate: Tue Oct 16 15:41:14 2018 -0700 GEODE-5844: Make log format match args --- .../internal/cache/PartitionedRegionDataStore.java | 52 +- 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java index a9c9104..8810d0c 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java @@ -1230,40 +1230,32 @@ public class PartitionedRegionDataStore implements HasCachePerfStats { return UPDATE_ACCESS_TIME_ON_INTEREST && this.keysOfInterest.containsKey(event.getKey()); } - - protected void updateMemoryStats(final long memoryDelta) { -// Update stats this.partitionedRegion.getPrStats().incBytesInUse(memoryDelta); - final long locBytes = this.bytesInUse.addAndGet(memoryDelta); -if (!this.partitionedRegion.isEntryEvictionPossible()) { - String logStr = null; - // only check for exceeding local max memory if we're not evicting entries. - // TODO, investigate precision issues with cast to long - if (!this.exceededLocalMaxMemoryLimit) { // previously OK -if (locBytes > this.maximumLocalBytes) { // not OK now - this.exceededLocalMaxMemoryLimit = true; - logStr = - "Partitioned Region %s has exceeded local maximum memory configuration %s Mb, current size is %s Mb"; -} - } else { -if (locBytes <= this.maximumLocalBytes) { - this.exceededLocalMaxMemoryLimit = false; - logStr = - "Partitioned Region %s is at or below local maximum memory configuration %s Mb, current size is %s Mb"; -} - } - if (logStr != null) { -Object[] logArgs = new Object[] {this.partitionedRegion.getFullPath(), logStr, -Long.valueOf(this.partitionedRegion.getLocalMaxMemory()), -Long.valueOf(locBytes / PartitionedRegionHelper.BYTES_PER_MB)}; -if (this.exceededLocalMaxMemoryLimit) { - logger.warn(String.format(logStr, logArgs)); -} else { - logger.info(String.format(logStr, logArgs)); -} +// only check for exceeding local max memory if we're not evicting entries. +if (this.partitionedRegion.isEntryEvictionPossible()) { + return; +} + +if (this.exceededLocalMaxMemoryLimit) { // previously over limit + if (locBytes <= this.maximumLocalBytes) { // not over limit now +this.exceededLocalMaxMemoryLimit = false; +logger.info( +"Partitioned Region {} is at or below local maximum memory configuration {} Mb, current size is {} Mb", +this.partitionedRegion.getFullPath(), +this.partitionedRegion.getLocalMaxMemory(), +locBytes / PartitionedRegionHelper.BYTES_PER_MB); + } +} else { // previously not over limit + if (locBytes > this.maximumLocalBytes) { // over limit now +this.exceededLocalMaxMemoryLimit = true; +logger.warn( +"Partitioned Region {} has exceeded local maximum memory configuration {} Mb, current size is {} Mb", +this.partitionedRegion.getFullPath(), +this.partitionedRegion.getLocalMaxMemory(), +locBytes / PartitionedRegionHelper.BYTES_PER_MB); } } }
[geode] branch develop updated: GEODE-5844: Eliminate String.Format() calls from initHelpMap() (#2587)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new f9f538a GEODE-5844: Eliminate String.Format() calls from initHelpMap() (#2587) f9f538a is described below commit f9f538a67d0bb98a7b8388ee32812b782148a89e Author: Ryan McMahon AuthorDate: Wed Oct 10 09:50:28 2018 -0700 GEODE-5844: Eliminate String.Format() calls from initHelpMap() (#2587) --- .../org/apache/geode/internal/SystemAdmin.java | 141 +++-- 1 file changed, 75 insertions(+), 66 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/SystemAdmin.java b/geode-core/src/main/java/org/apache/geode/internal/SystemAdmin.java index 81d2e44..446bca4 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/SystemAdmin.java +++ b/geode-core/src/main/java/org/apache/geode/internal/SystemAdmin.java @@ -1491,52 +1491,69 @@ public class SystemAdmin { protected final Map helpMap = new HashMap(); protected void initHelpMap() { -helpMap.put("gemfire", String.format( -"gemfire requires one of the following command strings:%sFor additional help on a command specify it along with the %s option.The %s option causes gemfire to print out extra information when it fails.The %s and %s are synonyms that cause gemfire to print out help information instead of performing a task.The %s option quiets gemfire down by suppressing extra messages.The %s option passes to the java vm's command line.", -join(validCommands), "-h", "-debug", "-help", "-q", "-J")); +helpMap.put("gemfire", +"GemFire requires one of the following command strings: " + join(validCommands) ++ ". For additional help on a command specify it along with the '-h' option. " ++ "The '-debug' option causes gemfire to print out extra information when it fails. " ++ "The '-h' and '-help' are synonyms that cause gemfire to print out help information instead of performing a task. " ++ "The '-q' option quiets GemFire down by suppressing extra messages. The '-J' option passes to the Java VM's command line."); helpMap.put("version", "Prints GemFire product version information."); helpMap.put("help", -"Prints information on how to use this executable.If an optional help topic is specified then more detailed help is printed."); +"Prints information on how to use this executable. If an optional help topic is specified then more detailed help is printed."); helpMap.put("stats", -String.format( -"Prints statistic values from a statistic archiveBy default all statistics are printed.The statSpec arguments can be used to print individual resources or a specific statistic.The format of a statSpec is: an optional combine operator, followed by an optional instanceId, followed by an optional typeId, followed by an optional statId.A combine operator can be %s to combine all matches in the same file, or %s to combine all matches across all files.An instanceId must be the name [...] -"+", "++", ":", ".", -"-details", "-nofilter", "-archive=", "-persec", "-persample", "-prunezeros") + "\n" -+ String.format( -"The %s option, in conjunction with %s, causes statistics samples taken before this time to be ignored. The argument format must match %s.The %s option, in conjunction with %s, causes statistics samples taken after this time to be ignored. The argument format must match %s.The %s option causes the data to come from an archive file.", -"-starttime", -"-archive=", DateFormatter.FORMAT_STRING, "-endtime")); +"Prints statistic values from a statistic archive. By default all statistics are printed.\n" ++ "The 'statSpec' arguments can be used to print individual resources or a specific statistic.\n" ++ "The format of a 'statSpec' is: an optional combine operator, followed by an optional instanceId, followed by an optional typeId, followed by an optional statId.\n" ++ "The '+' operator combines all matches in the same file. The '++' operator combines all matches across all files.\n" ++ "An instanceId must be the name or id of a resource. A typeId is a ':' followed by the name of a resource type.\n" ++ "A statId is a '.' followed by the name of a statisti
[geode] branch develop updated: GEODE-5747: Handling SocketException consistently (#2504)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 41dbe2e GEODE-5747: Handling SocketException consistently (#2504) 41dbe2e is described below commit 41dbe2e5804939df0b33ae47e57da50f6c7d9152 Author: Ryan McMahon AuthorDate: Tue Oct 2 12:48:11 2018 -0700 GEODE-5747: Handling SocketException consistently (#2504) --- .../internal/tcpserver/TcpServerJUnitTest.java | 73 -- .../distributed/internal/tcpserver/TcpServer.java | 3 +- .../geode/internal/InternalDataSerializer.java | 44 - .../internal/InternalDataSerializerJUnitTest.java | 31 + 4 files changed, 111 insertions(+), 40 deletions(-) diff --git a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/tcpserver/TcpServerJUnitTest.java b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/tcpserver/TcpServerJUnitTest.java index 71a1eba..4f83560 100644 --- a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/tcpserver/TcpServerJUnitTest.java +++ b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/tcpserver/TcpServerJUnitTest.java @@ -18,12 +18,18 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; import java.io.DataInput; import java.io.DataOutput; +import java.io.EOFException; import java.io.IOException; import java.net.ConnectException; import java.net.InetAddress; +import java.net.SocketException; import java.util.Properties; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -34,6 +40,8 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; import org.apache.geode.DataSerializable; import org.apache.geode.cache.GemFireCache; @@ -79,18 +87,20 @@ public class TcpServerJUnitTest { EchoHandler handler = new EchoHandler(); start(handler); +TcpClient tcpClient = new TcpClient(); + TestObject test = new TestObject(); test.id = 5; TestObject result = -(TestObject) new TcpClient().requestToServer(localhost, port, test, 60 * 1000); +(TestObject) tcpClient.requestToServer(localhost, port, test, 60 * 1000); assertEquals(test.id, result.id); -String[] info = new TcpClient().getInfo(localhost, port); +String[] info = tcpClient.getInfo(localhost, port); assertNotNull(info); assertTrue(info.length > 1); try { - new TcpClient().stop(localhost, port); + tcpClient.stop(localhost, port); } catch (ConnectException ignore) { // must not be running } @@ -109,12 +119,14 @@ public class TcpServerJUnitTest { DelayHandler handler = new DelayHandler(latch); start(handler); +TcpClient tcpClient = new TcpClient(); + final AtomicBoolean done = new AtomicBoolean(); Thread delayedThread = new Thread() { public void run() { Boolean delay = Boolean.valueOf(true); try { - new TcpClient().requestToServer(localhost, port, delay, 60 * 1000); + tcpClient.requestToServer(localhost, port, delay, 60 * 1000); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { @@ -127,7 +139,7 @@ public class TcpServerJUnitTest { try { Thread.sleep(500); assertFalse(done.get()); - new TcpClient().requestToServer(localhost, port, Boolean.valueOf(false), 60 * 1000); + tcpClient.requestToServer(localhost, port, Boolean.valueOf(false), 60 * 1000); assertFalse(done.get()); latch.countDown(); @@ -138,7 +150,7 @@ public class TcpServerJUnitTest { delayedThread.join(60 * 1000); assertTrue(!delayedThread.isAlive()); // GemStoneAddition try { -new TcpClient().stop(localhost, port); +tcpClient.stop(localhost, port); } catch (ConnectException ignore) { // must not be running } @@ -146,6 +158,55 @@ public class TcpServerJUnitTest { } } + @Test + public void testNewConnectionsAcceptedAfterSocketException() throws IOException, + ClassNotFoundException, InterruptedException { +// Initially mock the handler to throw a SocketException. We want to verify that the server +// can recover and serve new client requests after a SocketException is thrown. +TcpHandler mockTcpHandler = m
[geode] branch develop updated: Fixing typo in TESTING.md
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new dee93f4 Fixing typo in TESTING.md dee93f4 is described below commit dee93f40faa82e97aa05fe34bbc7ee2adac79cbc Author: Ryan McMahon AuthorDate: Sat Sep 22 16:40:22 2018 -0700 Fixing typo in TESTING.md --- TESTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TESTING.md b/TESTING.md index f103bfa..fdaece3 100644 --- a/TESTING.md +++ b/TESTING.md @@ -19,7 +19,7 @@ Tests are broken up into five types - unit, integration, distributed, acceptance ## Running Individual Tests To run an individual test, you can either 1. Run the test in your [IDE](https://github.com/apache/geode/blob/develop/BUILDING.md#setting-up-intellij) -2. Run the from terminal by specifying the sub-project and test type: +2. Run from terminal by specifying the sub-project and test type: `./gradlew project:testType --tests testName` For example: `./gradlew geode-core:test --tests ArrayUtilsTest` @@ -35,4 +35,4 @@ Available categories can be found in the `geode-junit/src/main/java/org/apache/g ## Viewing Test Results Test results can be viewed by navigating to -`build/reports/combined` in the Geode repository, then opening the `index.html` file in your browser. \ No newline at end of file +`build/reports/combined` in the Geode repository, then opening the `index.html` file in your browser.
[geode] branch develop updated: GEODE-5747: Handling SocketException in InternalDataSerializer (#2484)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 6006ec3 GEODE-5747: Handling SocketException in InternalDataSerializer (#2484) 6006ec3 is described below commit 6006ec34cf79808622b3d8d08bf6d0e0a3aaee2d Author: Ryan McMahon AuthorDate: Fri Sep 21 14:17:45 2018 -0700 GEODE-5747: Handling SocketException in InternalDataSerializer (#2484) --- .../apache/geode/internal/InternalDataSerializer.java | 3 ++- .../internal/InternalDataSerializerJUnitTest.java | 19 +++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java b/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java index 22c1282..90921b9 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java +++ b/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java @@ -39,6 +39,7 @@ import java.lang.reflect.Proxy; import java.math.BigDecimal; import java.math.BigInteger; import java.net.InetAddress; +import java.net.SocketException; import java.net.URL; import java.sql.Timestamp; import java.util.ArrayList; @@ -2480,7 +2481,7 @@ public abstract class InternalDataSerializer extends DataSerializer { ((DataSerializable) ds).fromData(in); } } -} catch (EOFException | ClassNotFoundException | CacheClosedException ex) { +} catch (EOFException | ClassNotFoundException | CacheClosedException | SocketException ex) { // client went away - ignore throw ex; } catch (Exception ex) { diff --git a/geode-core/src/test/java/org/apache/geode/internal/InternalDataSerializerJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/InternalDataSerializerJUnitTest.java index 6d0f1c9..2ef8e73 100755 --- a/geode-core/src/test/java/org/apache/geode/internal/InternalDataSerializerJUnitTest.java +++ b/geode-core/src/test/java/org/apache/geode/internal/InternalDataSerializerJUnitTest.java @@ -14,9 +14,15 @@ */ package org.apache.geode.internal; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import java.io.DataInput; +import java.io.IOException; +import java.net.SocketException; import java.util.Properties; import org.apache.logging.log4j.Level; @@ -25,6 +31,7 @@ import org.apache.logging.log4j.util.PropertiesUtil; import org.junit.Test; import org.junit.experimental.categories.Category; +import org.apache.geode.DataSerializable; import org.apache.geode.InternalGemFireException; import org.apache.geode.cache.execute.Function; import org.apache.geode.cache.execute.FunctionContext; @@ -51,6 +58,18 @@ public class InternalDataSerializerJUnitTest { InternalDataSerializer.isGemfireObject(new ExampleSecurityManager())); } + @Test + public void testInvokeFromData_SocketExceptionRethrown() + throws IOException, ClassNotFoundException { +DataInput in = mock(DataInput.class); +DataSerializable ds = mock(DataSerializable.class); + +doThrow(SocketException.class).when(ds).fromData(in); + +assertThatThrownBy(() -> InternalDataSerializer.invokeFromData(ds, in)) +.isInstanceOf(SocketException.class); + } + class TestFunction implements Function { @Override public void execute(FunctionContext context) {
[geode] branch develop updated: Adding TESTING.md (#2490)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new b99cfda Adding TESTING.md (#2490) b99cfda is described below commit b99cfdae982f14bdd3e95688e9fe0a74e8dbb34d Author: Ryan McMahon AuthorDate: Wed Sep 19 15:56:03 2018 -0700 Adding TESTING.md (#2490) --- README.md | 4 TESTING.md | 38 ++ 2 files changed, 42 insertions(+) diff --git a/README.md b/README.md index 54b9686..e4988e8 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,10 @@ Apache Geode includes the following features: See [BUILDING.md](https://github.com/apache/geode/blob/develop/BUILDING.md) for instructions on how to build the project. +## Running Tests +See [TESTING.md](https://github.com/apache/geode/blob/develop/TESTING.md) for +instructions on how to run tests. + ## Geode in 5 minutes Geode requires installation of JDK version 1.8. After installing Apache Geode, diff --git a/TESTING.md b/TESTING.md new file mode 100644 index 000..f103bfa --- /dev/null +++ b/TESTING.md @@ -0,0 +1,38 @@ +# Running Tests + +## Prerequisites +Before running tests, ensure all steps in the [BUILDING.md](https://github.com/apache/geode/blob/develop/BUILDING.md) have been performed. + +## Running Tests By Type +Tests are broken up into five types - unit, integration, distributed, acceptance, and upgrade. They can be executed using the following commands from the Geode repository root directory: +* Unit tests: generally test a single class and run quickly + `./gradlew test` +* Integration tests: involve inter-operation of components or subsystems + `./gradlew integrationTest` +* Distributed tests: involve multiple members of a distributed system. + `./gradlew distributedTest` +* Acceptance tests: test Geode from end user perspective + `./gradlew acceptanceTest` +* Upgrade tests: test compatibility between versions of Geode and rolling upgrades + `./gradlew upgradeTest` + +## Running Individual Tests +To run an individual test, you can either +1. Run the test in your [IDE](https://github.com/apache/geode/blob/develop/BUILDING.md#setting-up-intellij) +2. Run the from terminal by specifying the sub-project and test type: +`./gradlew project:testType --tests testName` +For example: +`./gradlew geode-core:test --tests ArrayUtilsTest` +`./gradlew geode-core:distributedTest --tests ConnectionPoolDUnitTest` + +## Running Tests By Category +To run a specific category of tests (eg: GfshTest): +`./gradlew project:testType -PtestCategory=fullyQualifiedTestClassName` +For example: +`./gradlew geode-core:distributedTest -PtestCategory=org.apache.geode.test.junit.categories.GfshTest` + +Available categories can be found in the `geode-junit/src/main/java/org/apache/geode/test/junit/categories` in the Geode repository. + +## Viewing Test Results +Test results can be viewed by navigating to +`build/reports/combined` in the Geode repository, then opening the `index.html` file in your browser. \ No newline at end of file
[geode] branch develop updated (b7df388 -> e9ca513)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from b7df388 GEODE-5094: Replace flaky expiration with prexisting better one add e9ca513 GEODE-5725: Use values large enough (> 8 bytes) to force off-heap storage (#2459) No new revisions were added by this update. Summary of changes: .../java/org/apache/geode/internal/cache/wan/WANTestBase.java | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-)
[geode] branch develop updated: Adding IntelliJ setup instructions to BUILDING.md (#2456)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new bafaeff Adding IntelliJ setup instructions to BUILDING.md (#2456) bafaeff is described below commit bafaeffe701a45bdf032a08763ea4fe437f885ab Author: Ryan McMahon AuthorDate: Wed Sep 12 14:37:48 2018 -0700 Adding IntelliJ setup instructions to BUILDING.md (#2456) Adding IntelliJ setup instructions to BUILDING.md --- BUILDING.md | 57 + 1 file changed, 57 insertions(+) diff --git a/BUILDING.md b/BUILDING.md index 1086bdd..b9d396e 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -30,3 +30,60 @@ v1.1.0 ``` Note: on Windows invoke the `gfsh.bat` script to print the version string. + +## Setting up IntelliJ + +The following steps have been tested with: + +* **IntelliJ IDEA 2018.2.2** + +1. Run `./gradlew --parallel devBuild` from Geode repository root to create compiler generated source + +2. Import project into IntelliJ IDEA + + From the **Welcome to IntelliJ IDEA** window: + + 1. **Import Project ->** select *build.gradle* file from Geode repository root and press **Open**. + 2. Enable **Use auto-import** + 3. Enable **Create separate module per source set** + 4. Select **Use Project JDK 1.8.0_*nnn*** where *nnn* is latest build required for Geode + +3. Change Code Style Scheme to GeodeStyle + + Navigate to **IntelliJ IDEA -> Preferences... -> Editor -> Code Style**. Select *GeodeStyle* in Scheme drop-down box if it already exists. + + To define the *GeodeStyle* in **Scheme**, select the gear icon next to the drop-down box, click **Import Scheme ->** and select **IntelliJ IDEA code style XML**. Select *etc/intellij-java-modified-google-style.xml* from Geode repository root, enter **To:** *GeodeStyle*, check **Current scheme** and press **OK**. + +4. Make Apache the default Copyright + + Navigate to **IntelliJ IDEA -> Preferences... -> Editor -> Copyright**. Select *Apache* in drop-down box **Default project copyright**. + + To define *Apache* in **Copyright**, navigate to **IntelliJ IDEA -> Preferences... -> Editor -> Copyright -> Copyright Profiles**. Click **+** to add a new project. Enter *Apache* as the **Name** and enter the following block without asterisks or leading spaces: + + ```text + 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. + ``` + + ...then return to **Copyright** and select *Apache* in drop-down box **Default project copyright**. + + Navigate to **IntelliJ IDEA -> Preferences... -> Editor -> Copyright -> Formatting**. Uncheck **Add blank line after** and press **OK**. + +5. Rebuild Project + + Navigate to **Build -> Rebuild Project** and the full project should compile without errors. + + Some optional sanity tests to make sure things are working properly: + * Try looking up classes using **Navigate -> Class...** + * Open and run a distributed test such as BasicDistributedTest in geode-core. + * Create a new java class and ensure the Apache license is automatically added to the top of the file with no blank line before the package line.
[geode] branch develop updated: GEODE-5628: Getting two random ports at once and fixing formatting (#2441)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new e586c84 GEODE-5628: Getting two random ports at once and fixing formatting (#2441) e586c84 is described below commit e586c841c98e4f7f27217ede42e6059771f673cf Author: Ryan McMahon AuthorDate: Mon Sep 10 14:21:52 2018 -0700 GEODE-5628: Getting two random ports at once and fixing formatting (#2441) * GEODE-5628: Getting two random ports at once and fixing formatting Co-authored-by: Ryan McMahon Co-authored-by: Sai Boorlagadda --- .../apache/geode/internal/net/SocketCreator.java | 3 +- .../geode/internal/net/SocketCreatorJUnitTest.java | 34 -- ...gradeEventProcessingMixedSiteOneOldSiteTwo.java | 7 +++-- 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/net/SocketCreator.java b/geode-core/src/main/java/org/apache/geode/internal/net/SocketCreator.java index 7fd1efa..9d75013 100755 --- a/geode-core/src/main/java/org/apache/geode/internal/net/SocketCreator.java +++ b/geode-core/src/main/java/org/apache/geode/internal/net/SocketCreator.java @@ -750,7 +750,8 @@ public class SocketCreator { } catch (BindException e) { BindException throwMe = new BindException(LocalizedStrings.SocketCreator_FAILED_TO_CREATE_SERVER_SOCKET_ON_0_1 -.toLocalizedString(bindAddr, Integer.valueOf(nport))); +.toLocalizedString(bindAddr == null ? InetAddress.getLocalHost() : bindAddr, +String.valueOf(nport))); throwMe.initCause(e); throw throwMe; } diff --git a/geode-core/src/test/java/org/apache/geode/internal/net/SocketCreatorJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/net/SocketCreatorJUnitTest.java index df7cd47..c3eac28 100644 --- a/geode-core/src/test/java/org/apache/geode/internal/net/SocketCreatorJUnitTest.java +++ b/geode-core/src/test/java/org/apache/geode/internal/net/SocketCreatorJUnitTest.java @@ -14,11 +14,15 @@ */ package org.apache.geode.internal.net; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import java.net.BindException; +import java.net.InetAddress; +import java.net.ServerSocket; import java.net.Socket; import java.security.cert.Certificate; import java.security.cert.X509Certificate; @@ -76,10 +80,36 @@ public class SocketCreatorJUnitTest { verify(socket, never()).setSoTimeout(timeout); } - private String getSingleKeyKeystore() { -return TestUtil.getResourcePath(getClass(), "/ssl/trusted.keystore"); + @Test + public void testBindExceptionMessageFormattingWithBindAddr() throws Exception { +testBindExceptionMessageFormatting(InetAddress.getLocalHost()); + } + + @Test + public void testBindExceptionMessageFormattingNullBindAddr() throws Exception { +testBindExceptionMessageFormatting(null); } + private void testBindExceptionMessageFormatting(InetAddress inetAddress) throws Exception { +final SocketCreator socketCreator = new SocketCreator(mock(SSLConfig.class)); +final Socket socket = mock(Socket.class); +ServerSocket serverSocket = null; +try { + serverSocket = socketCreator.createServerSocket(11234, 10, inetAddress); + assertThatExceptionOfType(BindException.class).isThrownBy(() -> { +// call twice on the same port to trigger exception +socketCreator.createServerSocket(11234, 10, inetAddress); + }).withMessageContaining("11234") + .withMessageContaining(InetAddress.getLocalHost().getHostAddress()); +} finally { + if (serverSocket != null) { +serverSocket.close(); + } +} + } + private String getSingleKeyKeystore() { +return TestUtil.getResourcePath(getClass(), "/ssl/trusted.keystore"); + } } diff --git a/geode-wan/src/upgradeTest/java/org/apache/geode/cache/wan/WANRollingUpgradeEventProcessingMixedSiteOneOldSiteTwo.java b/geode-wan/src/upgradeTest/java/org/apache/geode/cache/wan/WANRollingUpgradeEventProcessingMixedSiteOneOldSiteTwo.java index 2e4dd07..51b6003 100644 --- a/geode-wan/src/upgradeTest/java/org/apache/geode/cache/wan/WANRollingUpgradeEventProcessingMixedSiteOneOldSiteTwo.java +++ b/geode-wan/src/upgradeTest/java/org/apache/geode/cache/wan/WANRollingUpgradeEventProcessingMixedSiteOneOldSiteTwo.java @@ -22,7 +22,7 @@ import org.awaitility.Awaitility; import org.junit.Test; import org.apache.geode.distributed.internal.InternalLocator; -import org.apache.geode.internal.AvailablePort; +import org.apache.geode.inte