DonalEvans commented on a change in pull request #7115: URL: https://github.com/apache/geode/pull/7115#discussion_r751452877
########## File path: geode-for-redis/src/distributedTest/java/org/apache/geode/redis/internal/executor/string/StringsKillMultipleServersDUnitTest.java ########## @@ -0,0 +1,111 @@ +/* + * 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.redis.internal.executor.string; + +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; +import static org.apache.geode.test.dunit.rules.RedisClusterStartupRule.BIND_ADDRESS; + +import java.util.Random; +import java.util.concurrent.Future; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import redis.clients.jedis.HostAndPort; +import redis.clients.jedis.JedisCluster; + +import org.apache.geode.test.dunit.rules.MemberVM; +import org.apache.geode.test.dunit.rules.RedisClusterStartupRule; +import org.apache.geode.test.junit.rules.ExecutorServiceRule; + +public class StringsKillMultipleServersDUnitTest { + + @ClassRule + public static RedisClusterStartupRule cluster = new RedisClusterStartupRule(5); + + @Rule + public ExecutorServiceRule executor = new ExecutorServiceRule(); + + private static JedisCluster jedisCluster; + + @BeforeClass + public static void classSetup() { + MemberVM locator = cluster.startLocatorVM(0); + cluster.startRedisVM(1, locator.getPort()); + cluster.startRedisVM(2, locator.getPort()); + cluster.startRedisVM(3, locator.getPort()); + cluster.startRedisVM(4, locator.getPort()); + + int redisServerPort1 = cluster.getRedisPort(1); + jedisCluster = + new JedisCluster(new HostAndPort(BIND_ADDRESS, redisServerPort1), 10_000); + } + + @After + public void after() { + cluster.flushAll(); + } + + @AfterClass + public static void tearDown() { + jedisCluster.close(); + } + + @Test + public void operationsShouldContinueAfterMultipleServerFailures() throws Exception { + AtomicBoolean running = new AtomicBoolean(true); + AtomicInteger counter = new AtomicInteger(0); + + Future<Void> future1 = executor.submit(() -> doSetOps(running, counter)); + Future<Void> future2 = executor.submit(() -> doGetOps(running, counter)); + await().until(() -> counter.get() > 100); + + cluster.crashVM(3); + cluster.crashVM(4); Review comment: There is a possibility that buckets are distributed in such a way that server1 and server2 have all the secondary copies for the primary buckets hosted on server3 and server4, in which case, we wouldn't actually end up in a situation where we lose all copies of a bucket. Would it be possible to add in a check to ensure that we are definitely losing both primary and secondary buckets, which is what this test is ultimately trying to test? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
