From f5ccf3b25ecd3b74b6123366c9d3d93c7cd074e2 Mon Sep 17 00:00:00 2001
From: Hale Bales
Date: Mon, 25 Oct 2021 15:53:26 -0700
Subject: [PATCH] GEODE-9562: add system property for redis region name (#6960)
Adds a system property (geode-for-redis-region-name) that can be set to
any non-null, non-empty string. By default the data region for geode for
redis is GEODE_FOR_REDIS. If the system property value is not valid, the
default will quietly be used. The region name will be used in the RegionProvider
and in authentication. Supports both geode. and gemfire. prefixes for the
system property name
other changes:
- remove comments that say Geode for Redis is experimental (it isn't)
---
ci/scripts/execute_redis_tests.sh | 4 +-
.../distributed/ConfigurationProperties.java | 16 -----
.../AuthNativeRedisAcceptanceTest.java | 5 ++
.../dunit/rules/RedisClusterStartupRule.java | 4 +-
.../RedisPartitionResolverDUnitTest.java | 2 +-
.../redis/internal/data/DeltaDUnitTest.java | 2 +-
.../sortedset/ZAddIncrOptionDUnitTest.java | 2 +-
.../executor/sortedset/ZRemDUnitTest.java | 2 +-
.../sortedset/ZRemRangeByLexDUnitTest.java | 2 +-
.../sortedset/ZRemRangeByRankDUnitTest.java | 2 +-
.../sortedset/ZRemRangeByScoreDUnitTest.java | 2 +-
.../session/SessionExpirationDUnitTest.java | 2 +-
.../AbstractAuthIntegrationTest.java | 10 +++
.../connection/AuthIntegrationTest.java | 49 +++++++++-----
.../hash/MemoryOverheadIntegrationTest.java | 2 +-
.../geode/redis/internal/RedisProperties.java | 14 ++++
.../geode/redis/internal/RegionProvider.java | 15 ++++-
.../netty/ExecutionHandlerContext.java | 22 +++++--
.../internal/netty/NettyRedisServer.java | 1 -
.../internal/data/RedisPropertiesTest.java | 65 ++++++++++++++++++-
20 files changed, 167 insertions(+), 56 deletions(-)
diff --git a/ci/scripts/execute_redis_tests.sh b/ci/scripts/execute_redis_tests.sh
index 44563b5e5231..911c783ad3ce 100755
--- a/ci/scripts/execute_redis_tests.sh
+++ b/ci/scripts/execute_redis_tests.sh
@@ -44,7 +44,7 @@ export JAVA_HOME=${JAVA_TEST_PATH}
# This will cause all buckets to be created
../geode-assembly/build/install/apache-geode/bin/gfsh -e "connect --jmx-manager=localhost[1099]" \
- -e "query --query='select count(*) from /REDIS_DATA'"
+ -e "query --query='select count(*) from /GEODE_FOR_REDIS'"
failCount=0
@@ -66,7 +66,7 @@ failCount=0
# This will cause all buckets to be created
../geode-assembly/build/install/apache-geode/bin/gfsh -e "connect --jmx-manager=localhost[1099]" \
- -e "query --query='select count(*) from /REDIS_DATA'"
+ -e "query --query='select count(*) from /GEODE_FOR_REDIS'"
./runtest --host 127.0.0.1 --port 6379 \
--single unit/type/set \
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/ConfigurationProperties.java b/geode-core/src/main/java/org/apache/geode/distributed/ConfigurationProperties.java
index f1c1297740f6..07b0b401f45d 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/ConfigurationProperties.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/ConfigurationProperties.java
@@ -1929,10 +1929,6 @@ public interface ConfigurationProperties {
* all local addresses.
*
* Default: ""
- *
- *
- * Experimental: Geode API compatible with Redis is subject to change in future releases
- *
*/
String REDIS_BIND_ADDRESS = "geode-for-redis-bind-address";
@@ -1948,10 +1944,6 @@ public interface ConfigurationProperties {
* When the default value of false, Geode for Redis is not available.
* Set to true to enable Geode for Redis.
*
- *
- *
- * Experimental: Geode API compatible with Redis is subject to change in future releases
- *
*/
String REDIS_ENABLED = "geode-for-redis-enabled";
/**
@@ -1962,10 +1954,6 @@ public interface ConfigurationProperties {
* to authenticate using only a password. This requires a SecurityManager to be configured.
*
* Default: default
- *
- *
- * Experimental: Geode API compatible with Redis is subject to change in future releases
- *
*/
String REDIS_USERNAME = "geode-for-redis-username";
/**
@@ -1978,10 +1966,6 @@ public interface ConfigurationProperties {
* Default: 6379
*
* Allowed values: 0..65535
- *
- *
- * Experimental: Geode API compatible with Redis is subject to change in future releases
- *
*/
String REDIS_PORT = "geode-for-redis-port";
/**
diff --git a/geode-for-redis/src/acceptanceTest/java/org/apache/geode/redis/internal/executor/connection/AuthNativeRedisAcceptanceTest.java b/geode-for-redis/src/acceptanceTest/java/org/apache/geode/redis/internal/executor/connection/AuthNativeRedisAcceptanceTest.java
index c6fa83dd15aa..61d818ccc5ab 100644
--- a/geode-for-redis/src/acceptanceTest/java/org/apache/geode/redis/internal/executor/connection/AuthNativeRedisAcceptanceTest.java
+++ b/geode-for-redis/src/acceptanceTest/java/org/apache/geode/redis/internal/executor/connection/AuthNativeRedisAcceptanceTest.java
@@ -52,6 +52,11 @@ public String getPassword() {
return "default";
}
+ @Override
+ protected void setupCacheWithSecurityAndRegionName(String regionName) {
+ setupCacheWithSecurity();
+ }
+
@Override
public void setupCacheWithSecurity() {
redisContainer =
diff --git a/geode-for-redis/src/commonTest/java/org/apache/geode/test/dunit/rules/RedisClusterStartupRule.java b/geode-for-redis/src/commonTest/java/org/apache/geode/test/dunit/rules/RedisClusterStartupRule.java
index cf58f95bfc0f..53aa035316de 100644
--- a/geode-for-redis/src/commonTest/java/org/apache/geode/test/dunit/rules/RedisClusterStartupRule.java
+++ b/geode-for-redis/src/commonTest/java/org/apache/geode/test/dunit/rules/RedisClusterStartupRule.java
@@ -177,7 +177,7 @@ public DistributedMember moveBucketForKey(String key, String targetServerName) {
return getMember(1).invoke("moveBucketForKey: " + key + " -> " + targetServerName,
() -> {
Region r = RedisClusterStartupRule.getCache()
- .getRegion(RegionProvider.REDIS_DATA_REGION);
+ .getRegion(RegionProvider.DEFAULT_REDIS_REGION_NAME);
RedisKey redisKey = new RedisKey(key.getBytes());
DistributedMember primaryMember =
@@ -222,7 +222,7 @@ public DistributedMember moveBucketForKey(String key, String targetServerName) {
public String getKeyOnServer(String keyPrefix, int vmId) {
return getMember(1).invoke("getKeyOnServer", () -> {
Region r = RedisClusterStartupRule.getCache()
- .getRegion(RegionProvider.REDIS_DATA_REGION);
+ .getRegion(RegionProvider.DEFAULT_REDIS_REGION_NAME);
String server = "server-" + vmId;
String key;
diff --git a/geode-for-redis/src/distributedTest/java/org/apache/geode/redis/internal/cluster/RedisPartitionResolverDUnitTest.java b/geode-for-redis/src/distributedTest/java/org/apache/geode/redis/internal/cluster/RedisPartitionResolverDUnitTest.java
index 8ac58b9cadbd..7fe0b9e326c7 100644
--- a/geode-for-redis/src/distributedTest/java/org/apache/geode/redis/internal/cluster/RedisPartitionResolverDUnitTest.java
+++ b/geode-for-redis/src/distributedTest/java/org/apache/geode/redis/internal/cluster/RedisPartitionResolverDUnitTest.java
@@ -112,7 +112,7 @@ private void validateBucketMapping(Map bucketMap) {
private Map getKeyToBucketMap(MemberVM vm) {
return vm.invoke((SerializableCallableIF