Skip to content

Commit

Permalink
Revert "GEODE-9155: Change frequency of passive expiration (apache#6419
Browse files Browse the repository at this point in the history
…) (apache#6432)"

This reverts commit fb00b27.
  • Loading branch information
luissson committed May 21, 2021
1 parent 3f8f9f9 commit 272b5f3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 35 deletions.
Expand Up @@ -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
Expand Down
Expand Up @@ -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);
}
}
}
Expand Up @@ -31,7 +31,6 @@
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;

Expand Down Expand Up @@ -170,8 +169,7 @@ public void testExpire() {
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);
});
}

Expand Down
Expand Up @@ -16,15 +16,14 @@

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;
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;
Expand All @@ -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() {
Expand Down

0 comments on commit 272b5f3

Please sign in to comment.