diff --git a/VERSION b/VERSION
index 19b860c18..f22d756da 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-6.4.0
+6.5.0
diff --git a/client/all/pom.xml b/client/all/pom.xml
index 9fe1ac90a..f9a2ece1c 100644
--- a/client/all/pom.xml
+++ b/client/all/pom.xml
@@ -6,7 +6,7 @@
com.alipay.sofa
registry-client-all
- 6.4.0
+ 6.5.0
${project.groupId}:${project.artifactId}
http://github.com/alipay/sofa-registry
diff --git a/client/api/pom.xml b/client/api/pom.xml
index 9ad4b1665..d7e771d81 100644
--- a/client/api/pom.xml
+++ b/client/api/pom.xml
@@ -5,7 +5,7 @@
com.alipay.sofa
registry-client-parent
- 6.4.0
+ 6.5.0
../pom.xml
4.0.0
diff --git a/client/impl/pom.xml b/client/impl/pom.xml
index 0ed77e6df..3956a1d8c 100644
--- a/client/impl/pom.xml
+++ b/client/impl/pom.xml
@@ -5,7 +5,7 @@
com.alipay.sofa
registry-client-parent
- 6.4.0
+ 6.5.0
../pom.xml
4.0.0
diff --git a/client/impl/src/main/java/com/alipay/sofa/registry/client/remoting/ClientConnection.java b/client/impl/src/main/java/com/alipay/sofa/registry/client/remoting/ClientConnection.java
index 176135932..87dca00c7 100644
--- a/client/impl/src/main/java/com/alipay/sofa/registry/client/remoting/ClientConnection.java
+++ b/client/impl/src/main/java/com/alipay/sofa/registry/client/remoting/ClientConnection.java
@@ -129,8 +129,8 @@ private boolean connect() {
for (int i = 0; i < serverNodes.size(); i++) {
try {
// Power of Two Choices
- if(serverNodes.size() > 1){
- choosed = serverNodes.get(i).getWeight() > serverNodes.get(i+1).getWeight() ? i + 1 : i;
+ if (serverNodes.size() > 1) {
+ choosed = serverNodes.get(i).getWeight() > serverNodes.get(i + 1).getWeight() ? i + 1 : i;
}
connection = connect(serverNodes.get(choosed));
if (null != connection && connection.isFine()) {
diff --git a/client/log/pom.xml b/client/log/pom.xml
index 9d4e7ecfe..fc014d75f 100644
--- a/client/log/pom.xml
+++ b/client/log/pom.xml
@@ -5,7 +5,7 @@
com.alipay.sofa
registry-client-parent
- 6.4.0
+ 6.5.0
../pom.xml
4.0.0
diff --git a/client/pom.xml b/client/pom.xml
index 3603baeee..dc1ce9490 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -7,7 +7,7 @@
com.alipay.sofa
registry-parent
- 6.4.0
+ 6.5.0
../pom.xml
diff --git a/core/pom.xml b/core/pom.xml
index 0b65bf7de..9214f6626 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -5,7 +5,7 @@
com.alipay.sofa
registry-parent
- 6.4.0
+ 6.5.0
../pom.xml
4.0.0
diff --git a/pom.xml b/pom.xml
index 5475a4250..8415e0ff2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
4.0.0
com.alipay.sofa
registry-parent
- 6.4.0
+ 6.5.0
pom
diff --git a/server/common/model/pom.xml b/server/common/model/pom.xml
index 37d009f36..2d099f31e 100644
--- a/server/common/model/pom.xml
+++ b/server/common/model/pom.xml
@@ -5,7 +5,7 @@
com.alipay.sofa
registry-common
- 6.4.0
+ 6.5.0
../pom.xml
4.0.0
diff --git a/server/common/pom.xml b/server/common/pom.xml
index 8eb18249e..2a2bd2b77 100644
--- a/server/common/pom.xml
+++ b/server/common/pom.xml
@@ -5,7 +5,7 @@
com.alipay.sofa
registry-server-parent
- 6.4.0
+ 6.5.0
../pom.xml
4.0.0
diff --git a/server/common/util/pom.xml b/server/common/util/pom.xml
index e4a24c30f..a2c884259 100644
--- a/server/common/util/pom.xml
+++ b/server/common/util/pom.xml
@@ -5,7 +5,7 @@
com.alipay.sofa
registry-common
- 6.4.0
+ 6.5.0
../pom.xml
4.0.0
diff --git a/server/distribution/all/pom.xml b/server/distribution/all/pom.xml
index e82ceef53..267603003 100644
--- a/server/distribution/all/pom.xml
+++ b/server/distribution/all/pom.xml
@@ -5,7 +5,7 @@
com.alipay.sofa
registry-distribution
- 6.4.0
+ 6.5.0
../pom.xml
4.0.0
diff --git a/server/distribution/pom.xml b/server/distribution/pom.xml
index d39cbf7f3..4de1aabcc 100644
--- a/server/distribution/pom.xml
+++ b/server/distribution/pom.xml
@@ -6,7 +6,7 @@
com.alipay.sofa
registry-server-parent
- 6.4.0
+ 6.5.0
../pom.xml
4.0.0
diff --git a/server/pom.xml b/server/pom.xml
index df4297d44..a35e904de 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -7,7 +7,7 @@
com.alipay.sofa
registry-parent
- 6.4.0
+ 6.5.0
../pom.xml
diff --git a/server/remoting/api/pom.xml b/server/remoting/api/pom.xml
index 15144170f..0b6f31edd 100644
--- a/server/remoting/api/pom.xml
+++ b/server/remoting/api/pom.xml
@@ -5,7 +5,7 @@
com.alipay.sofa
registry-remoting
- 6.4.0
+ 6.5.0
../pom.xml
4.0.0
diff --git a/server/remoting/bolt/pom.xml b/server/remoting/bolt/pom.xml
index fa651f1cf..054bc2ae7 100644
--- a/server/remoting/bolt/pom.xml
+++ b/server/remoting/bolt/pom.xml
@@ -5,7 +5,7 @@
com.alipay.sofa
registry-remoting
- 6.4.0
+ 6.5.0
../pom.xml
4.0.0
diff --git a/server/remoting/http/pom.xml b/server/remoting/http/pom.xml
index ef6b5401a..bedf27125 100644
--- a/server/remoting/http/pom.xml
+++ b/server/remoting/http/pom.xml
@@ -5,7 +5,7 @@
com.alipay.sofa
registry-remoting
- 6.4.0
+ 6.5.0
../pom.xml
4.0.0
diff --git a/server/remoting/pom.xml b/server/remoting/pom.xml
index 00002d834..cbfb36739 100644
--- a/server/remoting/pom.xml
+++ b/server/remoting/pom.xml
@@ -5,7 +5,7 @@
com.alipay.sofa
registry-server-parent
- 6.4.0
+ 6.5.0
../pom.xml
4.0.0
diff --git a/server/server/data/pom.xml b/server/server/data/pom.xml
index 2e0144410..18064afe9 100644
--- a/server/server/data/pom.xml
+++ b/server/server/data/pom.xml
@@ -5,7 +5,7 @@
com.alipay.sofa
registry-server
- 6.4.0
+ 6.5.0
../pom.xml
4.0.0
diff --git a/server/server/integration/pom.xml b/server/server/integration/pom.xml
index 0cd3ac0b5..612f2a4c2 100644
--- a/server/server/integration/pom.xml
+++ b/server/server/integration/pom.xml
@@ -5,7 +5,7 @@
com.alipay.sofa
registry-server
- 6.4.0
+ 6.5.0
../pom.xml
4.0.0
diff --git a/server/server/meta/pom.xml b/server/server/meta/pom.xml
index c3f15d62b..90d0797aa 100644
--- a/server/server/meta/pom.xml
+++ b/server/server/meta/pom.xml
@@ -5,7 +5,7 @@
com.alipay.sofa
registry-server
- 6.4.0
+ 6.5.0
../pom.xml
4.0.0
diff --git a/server/server/meta/src/main/java/com/alipay/sofa/registry/server/meta/cleaner/InterfaceAppsIndexCleaner.java b/server/server/meta/src/main/java/com/alipay/sofa/registry/server/meta/cleaner/InterfaceAppsIndexCleaner.java
index f687569f6..f2701e7b6 100644
--- a/server/server/meta/src/main/java/com/alipay/sofa/registry/server/meta/cleaner/InterfaceAppsIndexCleaner.java
+++ b/server/server/meta/src/main/java/com/alipay/sofa/registry/server/meta/cleaner/InterfaceAppsIndexCleaner.java
@@ -101,6 +101,10 @@ public void start() {
LOG.info("InterfaceAppsIndexCleaner started");
}
+ protected AppRevision revisionConvert(AppRevision revision) {
+ return revision;
+ }
+
public void renew() {
if (!metaLeaderService.amILeader()) {
return;
@@ -134,7 +138,9 @@ public void renew() {
}
}
LOG.info("renew interface apps index succeed");
+ consecutiveSuccess.success();
} catch (Throwable e) {
+ consecutiveSuccess.fail();
LOG.error("renew interface apps index failed:", e);
}
}
@@ -165,10 +171,10 @@ void cleanup() {
}
int count =
interfaceAppsRepository.cleanDeleted(
- dateBeforeNow(metadataConfig.getRevisionRenewIntervalMinutes() * 15),
+ dateBeforeNow(metadataConfig.getInterfaceAppsIndexRenewIntervalMinutes() * 15),
metaServerConfig.getInterfaceMaxRemove());
if (count > 0) {
- LOG.info("clean up {} revisions", count);
+ LOG.info("clean up {} interface app", count);
}
}
@@ -214,7 +220,7 @@ public void runUnthrowable() {
final class Cleaner extends WakeUpLoopRunnable {
@Override
public int getWaitingMillis() {
- int base = metadataConfig.getRevisionRenewIntervalMinutes() * 1000 * 60;
+ int base = metadataConfig.getInterfaceAppsIndexRenewIntervalMinutes() * 1000 * 60;
return (int) (base + Math.random() * base);
}
diff --git a/server/server/meta/src/test/java/com/alipay/sofa/registry/server/meta/cleaner/InterfaceAppsIndexCleanerTest.java b/server/server/meta/src/test/java/com/alipay/sofa/registry/server/meta/cleaner/InterfaceAppsIndexCleanerTest.java
index af1958fda..71a377446 100644
--- a/server/server/meta/src/test/java/com/alipay/sofa/registry/server/meta/cleaner/InterfaceAppsIndexCleanerTest.java
+++ b/server/server/meta/src/test/java/com/alipay/sofa/registry/server/meta/cleaner/InterfaceAppsIndexCleanerTest.java
@@ -18,13 +18,23 @@
import static org.mockito.Mockito.*;
+import com.alipay.sofa.registry.cache.ConsecutiveSuccess;
+import com.alipay.sofa.registry.common.model.console.PersistenceDataBuilder;
+import com.alipay.sofa.registry.common.model.constants.ValueConstants;
import com.alipay.sofa.registry.jdbc.config.MetadataConfig;
import com.alipay.sofa.registry.jdbc.domain.AppRevisionDomain;
import com.alipay.sofa.registry.jdbc.domain.InterfaceAppsIndexDomain;
+import com.alipay.sofa.registry.jdbc.repository.impl.DateNowJdbcRepository;
import com.alipay.sofa.registry.server.meta.AbstractMetaServerTestBase;
+import com.alipay.sofa.registry.server.meta.bootstrap.config.MetaServerConfigBean;
+import com.alipay.sofa.registry.server.meta.provide.data.DefaultProvideDataService;
+import com.alipay.sofa.registry.store.api.DBResponse;
+import com.alipay.sofa.registry.store.api.OperationStatus;
import com.alipay.sofa.registry.store.api.repository.AppRevisionRepository;
import com.alipay.sofa.registry.store.api.repository.InterfaceAppsRepository;
+import java.util.Date;
import org.assertj.core.util.Lists;
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -35,11 +45,32 @@ public class InterfaceAppsIndexCleanerTest extends AbstractMetaServerTestBase {
public void beforeTest() throws Exception {
makeMetaLeader();
interfaceAppsIndexCleaner = new InterfaceAppsIndexCleaner(metaLeaderService);
+ interfaceAppsIndexCleaner.dateNowRepository = mock(DateNowJdbcRepository.class);
interfaceAppsIndexCleaner.appRevisionRepository = mock(AppRevisionRepository.class);
interfaceAppsIndexCleaner.interfaceAppsRepository = mock(InterfaceAppsRepository.class);
interfaceAppsIndexCleaner.metadataConfig = mock(MetadataConfig.class);
+ interfaceAppsIndexCleaner.consecutiveSuccess = new ConsecutiveSuccess(2, 10000);
+ interfaceAppsIndexCleaner.provideDataService = mock(DefaultProvideDataService.class);
+
when(interfaceAppsIndexCleaner.metadataConfig.getInterfaceAppsIndexRenewIntervalMinutes())
.thenReturn(10000);
+ interfaceAppsIndexCleaner.metaServerConfig = new MetaServerConfigBean(commonConfig);
+
+ doReturn(
+ new DBResponse<>(
+ PersistenceDataBuilder.createPersistenceData(
+ ValueConstants.INTERFACE_APP_CLEANER_ENABLED_DATA_ID, "true"),
+ OperationStatus.SUCCESS))
+ .when(interfaceAppsIndexCleaner.provideDataService)
+ .queryProvideData(anyString());
+
+ doReturn(true).when(interfaceAppsIndexCleaner.provideDataService).saveProvideData(any());
+ }
+
+ @After
+ public void afterTest() {
+ interfaceAppsIndexCleaner.cleaner.close();
+ interfaceAppsIndexCleaner.renewer.close();
}
@Test
@@ -72,4 +103,26 @@ public void testClean() {
mocked.renew();
mocked.renew();
}
+
+ @Test
+ public void testCleanInterface() throws Exception {
+ InterfaceAppsIndexCleaner mocked = spy(interfaceAppsIndexCleaner);
+ doReturn(1).when(mocked.interfaceAppsRepository).cleanDeleted(any(), anyInt());
+ doReturn(new Date()).when(mocked.dateNowRepository).getNow();
+ mocked.renew();
+ mocked.renew();
+ mocked.cleanup();
+ makeMetaNonLeader();
+ mocked.cleanup();
+ }
+
+ @Test
+ public void testEnable() throws Exception {
+ InterfaceAppsIndexCleaner mocked = spy(interfaceAppsIndexCleaner);
+ doReturn(1).when(mocked.interfaceAppsRepository).cleanDeleted(any(), anyInt());
+ doReturn(new Date()).when(mocked.dateNowRepository).getNow();
+ mocked.setEnabled(true);
+ mocked.cleaner.getWaitingMillis();
+ mocked.cleaner.runUnthrowable();
+ }
}
diff --git a/server/server/pom.xml b/server/server/pom.xml
index 4fd7f419e..f6ce3f1a6 100644
--- a/server/server/pom.xml
+++ b/server/server/pom.xml
@@ -5,7 +5,7 @@
com.alipay.sofa
registry-server-parent
- 6.4.0
+ 6.5.0
../pom.xml
4.0.0
diff --git a/server/server/session/pom.xml b/server/server/session/pom.xml
index 3329609a8..fb9ea2b74 100644
--- a/server/server/session/pom.xml
+++ b/server/server/session/pom.xml
@@ -5,7 +5,7 @@
com.alipay.sofa
registry-server
- 6.4.0
+ 6.5.0
../pom.xml
4.0.0
diff --git a/server/server/shared/pom.xml b/server/server/shared/pom.xml
index e54583827..9bcb96eb6 100644
--- a/server/server/shared/pom.xml
+++ b/server/server/shared/pom.xml
@@ -5,7 +5,7 @@
registry-server
com.alipay.sofa
- 6.4.0
+ 6.5.0
4.0.0
diff --git a/server/server/shared/src/test/java/com/alipay/sofa/registry/server/shared/meta/MetaServerServiceTest.java b/server/server/shared/src/test/java/com/alipay/sofa/registry/server/shared/meta/MetaServerServiceTest.java
index 7891d877f..20baf09d8 100644
--- a/server/server/shared/src/test/java/com/alipay/sofa/registry/server/shared/meta/MetaServerServiceTest.java
+++ b/server/server/shared/src/test/java/com/alipay/sofa/registry/server/shared/meta/MetaServerServiceTest.java
@@ -152,6 +152,9 @@ public void testHandleHeartbeatResp() {
Assert.assertTrue(zones.contains("192.168.1.2"));
Assert.assertTrue(zones.contains("192.168.1.3"));
+ List nodes = mockServerService.getSessionNodeWithConnNumList("");
+ Assert.assertEquals(nodes.size(), 2);
+
Assert.assertEquals(2, mockServerService.getSessionProcessIds().size());
Assert.assertTrue(mockServerService.getSessionProcessIds().contains(ServerEnv.PROCESS_ID));
zones = mockServerService.getSessionServerList("zoneC");
diff --git a/server/store/api/pom.xml b/server/store/api/pom.xml
index 37009f207..bc181552d 100644
--- a/server/store/api/pom.xml
+++ b/server/store/api/pom.xml
@@ -5,7 +5,7 @@
com.alipay.sofa
registry-store
- 6.4.0
+ 6.5.0
../pom.xml
4.0.0
diff --git a/server/store/jdbc/pom.xml b/server/store/jdbc/pom.xml
index 6eb600e15..3509beadc 100644
--- a/server/store/jdbc/pom.xml
+++ b/server/store/jdbc/pom.xml
@@ -6,7 +6,7 @@
com.alipay.sofa
registry-store
- 6.4.0
+ 6.5.0
../pom.xml
diff --git a/server/store/jdbc/src/main/resources/h2-mapper/interface_apps_index.xml b/server/store/jdbc/src/main/resources/h2-mapper/interface_apps_index.xml
index 662c1ff66..5a7842657 100644
--- a/server/store/jdbc/src/main/resources/h2-mapper/interface_apps_index.xml
+++ b/server/store/jdbc/src/main/resources/h2-mapper/interface_apps_index.xml
@@ -45,4 +45,12 @@
order by id limit #{limitCount}
+
+
+
+
+
diff --git a/server/store/jraft/pom.xml b/server/store/jraft/pom.xml
index 1ffbb8f36..01c4b8a69 100644
--- a/server/store/jraft/pom.xml
+++ b/server/store/jraft/pom.xml
@@ -6,7 +6,7 @@
com.alipay.sofa
registry-store
- 6.4.0
+ 6.5.0
../pom.xml
diff --git a/server/store/pom.xml b/server/store/pom.xml
index f491cf621..d2d978622 100644
--- a/server/store/pom.xml
+++ b/server/store/pom.xml
@@ -5,7 +5,7 @@
com.alipay.sofa
registry-server-parent
- 6.4.0
+ 6.5.0
../pom.xml
4.0.0
diff --git a/test/pom.xml b/test/pom.xml
index 2f9d3153d..96473665e 100644
--- a/test/pom.xml
+++ b/test/pom.xml
@@ -5,7 +5,7 @@
com.alipay.sofa
registry-parent
- 6.4.0
+ 6.5.0
../pom.xml
4.0.0
diff --git a/test/src/test/java/com/alipay/sofa/registry/test/metadata/InterfaceAppsJdbcRepositoryTest.java b/test/src/test/java/com/alipay/sofa/registry/test/metadata/InterfaceAppsJdbcRepositoryTest.java
index d491b92b4..61b6db2d3 100644
--- a/test/src/test/java/com/alipay/sofa/registry/test/metadata/InterfaceAppsJdbcRepositoryTest.java
+++ b/test/src/test/java/com/alipay/sofa/registry/test/metadata/InterfaceAppsJdbcRepositoryTest.java
@@ -20,10 +20,7 @@
import com.alipay.sofa.registry.server.session.metadata.MetadataCacheRegistry;
import com.alipay.sofa.registry.store.api.repository.InterfaceAppsRepository;
import com.alipay.sofa.registry.test.BaseIntegrationTest;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
+import java.util.*;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -82,5 +79,6 @@ public void batchSaveTest() throws InterruptedException {
Assert.assertEquals(1, appNames.getApps().size());
Assert.assertTrue(appNames.getApps().contains(app));
}
+ interfaceAppsJdbcRepository.cleanDeleted(new Date(), 1);
}
}