diff --git a/pom.xml b/pom.xml
index 417d1c9f1..6fba65c2b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -400,6 +400,10 @@
ch.qos.logback
logback-classic
+
+ ch.qos.logback
+ logback-core
+
@@ -940,7 +944,7 @@
org.apache.maven.plugins
maven-surefire-plugin
- 2.22.1
+ 2.22.2
diff --git a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/keeper/impl/DefaultKeeperContainerUsedInfoAnalyzer.java b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/keeper/impl/DefaultKeeperContainerUsedInfoAnalyzer.java
index bc72e014e..3db889d48 100644
--- a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/keeper/impl/DefaultKeeperContainerUsedInfoAnalyzer.java
+++ b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/keeper/impl/DefaultKeeperContainerUsedInfoAnalyzer.java
@@ -115,12 +115,11 @@ private void removeExpireData(Date currentTime) {
Iterator> iterator = checkerIndexes.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry entry = iterator.next();
- logger.warn("[removeExpireData] remove expire index:{} time:{}, expire time:{}", entry.getValue(), entry.getKey(), config.getKeeperCheckerIntervalMilli());
if (currentTime.getTime() - entry.getKey().getTime() > config.getKeeperCheckerIntervalMilli()) {
+ logger.info("[removeExpireData] remove expire index:{} time:{}, expire time:{}", entry.getValue(), entry.getKey(), config.getKeeperCheckerIntervalMilli());
allKeeperContainerUsedInfoModels.remove(entry.getValue());
iterator.remove();
- }
- break;
+ } else break;
}
}
diff --git a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/impl/DefaultDelayService.java b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/impl/DefaultDelayService.java
index a5443f958..7528ae36c 100644
--- a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/impl/DefaultDelayService.java
+++ b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/impl/DefaultDelayService.java
@@ -1,5 +1,6 @@
package com.ctrip.xpipe.redis.console.service.impl;
+import com.ctrip.xpipe.api.command.CommandFuture;
import com.ctrip.xpipe.api.foundation.FoundationService;
import com.ctrip.xpipe.cluster.ClusterType;
import com.ctrip.xpipe.command.AbstractCommand;
@@ -231,20 +232,23 @@ public UnhealthyInfoModel getAllUnhealthyInstance() {
UnhealthyInfoModel infoAggregation = new UnhealthyInfoModel();
ParallelCommandChain commandChain = new ParallelCommandChain(executors);
+ Map> results = new HashMap<>();
for (String dcId : xpipeMeta.getDcs().keySet()) {
FetchDcUnhealthyInstanceCmd cmd = new FetchDcUnhealthyInstanceCmd(dcId);
commandChain.add(cmd);
- cmd.future().addListener(commandFuture -> {
+ results.put(dcId, cmd.future());
+ }
+
+ try {
+ commandChain.execute().sync();
+ for (Map.Entry> result: results.entrySet()) {
+ CommandFuture commandFuture = result.getValue();
if (commandFuture.isSuccess() && null != commandFuture.get()) {
infoAggregation.merge(commandFuture.get());
} else {
- infoAggregation.getAttachFailDc().add(dcId);
+ infoAggregation.getAttachFailDc().add(result.getKey());
}
- });
- }
-
- try {
- commandChain.execute().get();
+ }
} catch (Throwable th) {
logger.info("[getAllUnhealthyInstance][fail] {}", th.getMessage());
}
diff --git a/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/keeper/impl/DefaultKeeperContainerUsedInfoAnalyzerTest.java b/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/keeper/impl/DefaultKeeperContainerUsedInfoAnalyzerTest.java
index 512d4520b..95fe231b8 100644
--- a/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/keeper/impl/DefaultKeeperContainerUsedInfoAnalyzerTest.java
+++ b/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/keeper/impl/DefaultKeeperContainerUsedInfoAnalyzerTest.java
@@ -1,5 +1,6 @@
package com.ctrip.xpipe.redis.console.keeper.impl;
+import com.ctrip.xpipe.AbstractTest;
import com.ctrip.xpipe.api.foundation.FoundationService;
import com.ctrip.xpipe.redis.checker.model.DcClusterShard;
import com.ctrip.xpipe.redis.checker.model.KeeperContainerUsedInfoModel;
@@ -28,7 +29,7 @@
* 2023/9/20
*/
@RunWith(org.mockito.junit.MockitoJUnitRunner.class)
-public class DefaultKeeperContainerUsedInfoAnalyzerTest {
+public class DefaultKeeperContainerUsedInfoAnalyzerTest extends AbstractTest {
@InjectMocks
private DefaultKeeperContainerUsedInfoAnalyzer analyzer;
@@ -80,6 +81,8 @@ public void testUpdateKeeperContainerUsedInfo() {
model3.setDetailInfo(detailInfo3);
models2.add(model3);
+ // avoid calling updateKeeperContainerUsedInfo in the same milliSecond and fail case
+ sleep(1);
analyzer.updateKeeperContainerUsedInfo(1, models2);
Assert.assertEquals(0, analyzer.getCheckerIndexes().size());
Assert.assertEquals(0, analyzer.getAllKeeperContainerUsedInfoModels().size());
diff --git a/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/migration/status/migration/MigrationPartialSuccessStateTest.java b/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/migration/status/migration/MigrationPartialSuccessStateTest.java
index acfa1ce9b..774baacdd 100644
--- a/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/migration/status/migration/MigrationPartialSuccessStateTest.java
+++ b/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/migration/status/migration/MigrationPartialSuccessStateTest.java
@@ -8,6 +8,7 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import java.util.LinkedList;
@@ -82,8 +83,8 @@ public void testSingleThreadProcess() throws Exception {
partialSuccessState.getStateActionState().tryAction();
waitConditionUntilTimeOut(() -> retryCnt.get() >= failCnt);
- verify(migrationCluster).updateStat(isA(MigrationPublishState.class));
- verify(migrationCluster).process();
+ verify(migrationCluster, Mockito.timeout(3000).times(1)).updateStat(isA(MigrationPublishState.class));
+ verify(migrationCluster, Mockito.timeout(3000).times(1)).process();
}
@Test
diff --git a/redis/redis-keeper/src/test/java/com/ctrip/xpipe/redis/keeper/ratelimit/AllTests.java b/redis/redis-keeper/src/test/java/com/ctrip/xpipe/redis/keeper/ratelimit/AllRateLimitTests.java
similarity index 92%
rename from redis/redis-keeper/src/test/java/com/ctrip/xpipe/redis/keeper/ratelimit/AllTests.java
rename to redis/redis-keeper/src/test/java/com/ctrip/xpipe/redis/keeper/ratelimit/AllRateLimitTests.java
index 287715be1..046382fac 100644
--- a/redis/redis-keeper/src/test/java/com/ctrip/xpipe/redis/keeper/ratelimit/AllTests.java
+++ b/redis/redis-keeper/src/test/java/com/ctrip/xpipe/redis/keeper/ratelimit/AllRateLimitTests.java
@@ -15,6 +15,6 @@
FakeRedisRdbDumpLong.class,
RateLimitTest.class,
})
-public class AllTests {
+public class AllRateLimitTests {
}
diff --git a/redis/redis-keeper/src/test/java/com/ctrip/xpipe/redis/keeper/ratelimit/RateLimitTest.java b/redis/redis-keeper/src/test/java/com/ctrip/xpipe/redis/keeper/ratelimit/RateLimitTest.java
index 01884b2bc..0c4c58967 100644
--- a/redis/redis-keeper/src/test/java/com/ctrip/xpipe/redis/keeper/ratelimit/RateLimitTest.java
+++ b/redis/redis-keeper/src/test/java/com/ctrip/xpipe/redis/keeper/ratelimit/RateLimitTest.java
@@ -84,10 +84,8 @@ public void testBackupDcActiveKeeper_DrMigration_ShouldLimit() throws Exception
redisKeeperServer1.getRedisKeeperServerState().becomeActive(new DefaultEndPoint("127.0.0.1", redisKeeperServer2.getListeningPort()));
waitRedisKeeperServerConnected(redisKeeperServer1);
- waitConditionUntilTimeOut(()->assertSuccess(()->{
- verify(leakyBucket, times(1)).tryAcquire();
- verify(leakyBucket, times(1)).release();
- }));
+ verify(leakyBucket, timeout(5000).times(1)).tryAcquire();
+ verify(leakyBucket, timeout(5000).times(1)).release();
}
diff --git a/services/ctrip-service/pom.xml b/services/ctrip-service/pom.xml
index 170e37cda..a3796c6b9 100644
--- a/services/ctrip-service/pom.xml
+++ b/services/ctrip-service/pom.xml
@@ -13,7 +13,7 @@
2.7.8
1.2.83
1.3.9
- 2.0.16
+ 2.0.24