You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by he...@apache.org on 2021/05/04 18:29:02 UTC

[geode] branch revert-6419-GEODE-9155-passive-expiration created (now 7a90ff4)

This is an automated email from the ASF dual-hosted git repository.

heybales pushed a change to branch revert-6419-GEODE-9155-passive-expiration
in repository https://gitbox.apache.org/repos/asf/geode.git.


      at 7a90ff4  Revert "GEODE-9155: Change frequency of passive expiration (#6419)"

This branch includes the following new commits:

     new 7a90ff4  Revert "GEODE-9155: Change frequency of passive expiration (#6419)"

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[geode] 01/01: Revert "GEODE-9155: Change frequency of passive expiration (#6419)"

Posted by he...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

heybales pushed a commit to branch revert-6419-GEODE-9155-passive-expiration
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 7a90ff4f4749066e79cad3ad0712bf416cc6a23c
Author: Hale Bales <hb...@pivotal.io>
AuthorDate: Tue May 4 11:26:37 2021 -0700

    Revert "GEODE-9155: Change frequency of passive expiration (#6419)"
    
    This reverts commit 113aa7d487e2cf717cfbeb986114f28f6d988932.
---
 .../resources/0001-configure-redis-tests.patch     | 34 ++++++----------------
 .../geode/redis/internal/GeodeServerRunTest.java   |  3 +-
 .../server/AbstractHitsMissesIntegrationTest.java  |  4 +--
 .../redis/internal/PassiveExpirationManager.java   |  9 +++---
 4 files changed, 15 insertions(+), 35 deletions(-)

diff --git a/geode-apis-compatible-with-redis/src/acceptanceTest/resources/0001-configure-redis-tests.patch b/geode-apis-compatible-with-redis/src/acceptanceTest/resources/0001-configure-redis-tests.patch
index e83bf1d..9bf0bf9 100644
--- a/geode-apis-compatible-with-redis/src/acceptanceTest/resources/0001-configure-redis-tests.patch
+++ b/geode-apis-compatible-with-redis/src/acceptanceTest/resources/0001-configure-redis-tests.patch
@@ -162,33 +162,17 @@ index de24eabed..aeeb1da7f 100644
  
      test {PERSIST returns 0 against non existing or non volatile keys} {
          r set x foo
-@@ -149,44 +149,44 @@ start_server {tags {"expire"}} {
--    test {Redis should actively expire keys incrementally} {
--        r flushdb
--        r psetex key1 500 a
--        r psetex key2 500 a
--        r psetex key3 500 a
--        set size1 [r dbsize]
--        # Redis expires random keys ten times every second so we are
--        # fairly sure that all the three keys should be evicted after
+@@ -154,39 +154,39 @@ start_server {tags {"expire"}} {
+         set size1 [r dbsize]
+         # Redis expires random keys ten times every second so we are
+         # fairly sure that all the three keys should be evicted after
 -        # one second.
 -        after 1000
--        set size2 [r dbsize]
--        list $size1 $size2
--    } {3 0}
-+#    test {Redis should actively expire keys incrementally} {
-+#        r flushdb
-+#        r psetex key1 500 a
-+#        r psetex key2 500 a
-+#        r psetex key3 500 a
-+#        set size1 [r dbsize]
-+#        # Redis expires random keys ten times every second so we are
-+#        # fairly sure that all the three keys should be evicted after
-+#        # one second.
-+#        after 1000
-+#        set size2 [r dbsize]
-+#        list $size1 $size2
-+#    } {3 0}
++        # two seconds.
++        after 2000
+         set size2 [r dbsize]
+         list $size1 $size2
+     } {3 0}
  
 -    test {Redis should lazy expire keys} {
 -        r flushdb
diff --git a/geode-apis-compatible-with-redis/src/integrationTest/java/org/apache/geode/redis/internal/GeodeServerRunTest.java b/geode-apis-compatible-with-redis/src/integrationTest/java/org/apache/geode/redis/internal/GeodeServerRunTest.java
index 639c8f3..1ba35a1 100755
--- a/geode-apis-compatible-with-redis/src/integrationTest/java/org/apache/geode/redis/internal/GeodeServerRunTest.java
+++ b/geode-apis-compatible-with-redis/src/integrationTest/java/org/apache/geode/redis/internal/GeodeServerRunTest.java
@@ -30,10 +30,9 @@ public class GeodeServerRunTest {
 
   @Test
   @Ignore("This is a no-op test to conveniently run redis api for geode server for local development/testing purposes")
-  public void runGeodeServer() throws InterruptedException {
+  public void runGeodeServer() {
     LogService.getLogger().warn("Server running on port: " + server.getPort());
     while (true) {
-      Thread.sleep(1000);
     }
   }
 }
diff --git a/geode-apis-compatible-with-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/server/AbstractHitsMissesIntegrationTest.java b/geode-apis-compatible-with-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/server/AbstractHitsMissesIntegrationTest.java
index eead406..1e9a29f 100644
--- a/geode-apis-compatible-with-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/server/AbstractHitsMissesIntegrationTest.java
+++ b/geode-apis-compatible-with-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/server/AbstractHitsMissesIntegrationTest.java
@@ -31,7 +31,6 @@ import org.junit.Test;
 import redis.clients.jedis.BitOP;
 import redis.clients.jedis.Jedis;
 
-import org.apache.geode.redis.internal.PassiveExpirationManager;
 import org.apache.geode.test.awaitility.GeodeAwaitility;
 import org.apache.geode.test.dunit.rules.RedisPortSupplier;
 
@@ -170,8 +169,7 @@ public abstract class AbstractHitsMissesIntegrationTest implements RedisPortSupp
   public void testPassiveExpiration() {
     runCommandAndAssertNoStatUpdates("hash", (k) -> {
       jedis.expire(k, 1);
-      GeodeAwaitility.await().atMost(Duration.ofMinutes(PassiveExpirationManager.INTERVAL * 2))
-          .until(() -> jedis.keys("hash").isEmpty());
+      GeodeAwaitility.await().during(Duration.ofSeconds(3)).until(() -> true);
     });
   }
 
diff --git a/geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/PassiveExpirationManager.java b/geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/PassiveExpirationManager.java
index 37a0ef3..c5edd81 100644
--- a/geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/PassiveExpirationManager.java
+++ b/geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/PassiveExpirationManager.java
@@ -16,7 +16,7 @@
 
 package org.apache.geode.redis.internal;
 
-import static java.util.concurrent.TimeUnit.MINUTES;
+import static java.util.concurrent.TimeUnit.SECONDS;
 import static org.apache.geode.logging.internal.executors.LoggingExecutors.newSingleThreadScheduledExecutor;
 
 import java.util.Map;
@@ -24,7 +24,6 @@ import java.util.concurrent.ScheduledExecutorService;
 
 import org.apache.logging.log4j.Logger;
 
-import org.apache.geode.annotations.VisibleForTesting;
 import org.apache.geode.cache.CacheClosedException;
 import org.apache.geode.cache.EntryDestroyedException;
 import org.apache.geode.cache.Region;
@@ -43,15 +42,15 @@ public class PassiveExpirationManager {
   private final ScheduledExecutorService expirationExecutor;
   private final RedisStats redisStats;
 
-  @VisibleForTesting
-  public static final int INTERVAL = 3;
 
   public PassiveExpirationManager(Region<RedisKey, RedisData> dataRegion, RedisStats redisStats) {
     this.dataRegion = dataRegion;
     this.redisStats = redisStats;
     expirationExecutor = newSingleThreadScheduledExecutor("GemFireRedis-PassiveExpiration-");
+    int INTERVAL = 1;
     expirationExecutor.scheduleWithFixedDelay(() -> doDataExpiration(dataRegion), INTERVAL,
-        INTERVAL, MINUTES);
+        INTERVAL,
+        SECONDS);
   }
 
   public void stop() {