From f208554e4b1a5a2ee4e3b589c1d66abfc18227c9 Mon Sep 17 00:00:00 2001 From: bjxiaojian Date: Fri, 16 Sep 2022 15:22:02 +0800 Subject: [PATCH] 1.fix revision heartbeat; 2.rename git.properties (#268) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 昱恒 --- VERSION | 2 +- client/all/pom.xml | 2 +- client/api/pom.xml | 2 +- client/impl/pom.xml | 2 +- client/log/pom.xml | 2 +- client/pom.xml | 2 +- core/pom.xml | 2 +- pom.xml | 4 ++-- server/common/model/pom.xml | 2 +- server/common/pom.xml | 2 +- server/common/util/pom.xml | 2 +- server/distribution/all/pom.xml | 2 +- server/distribution/pom.xml | 2 +- server/pom.xml | 2 +- server/remoting/api/pom.xml | 2 +- server/remoting/bolt/pom.xml | 2 +- server/remoting/http/pom.xml | 2 +- server/remoting/pom.xml | 2 +- server/server/data/pom.xml | 2 +- server/server/integration/pom.xml | 2 +- server/server/meta/pom.xml | 2 +- .../server/meta/cleaner/AppRevisionCleaner.java | 2 +- .../server/meta/cleaner/AppRevisionCleanerTest.java | 2 +- server/server/pom.xml | 2 +- server/server/session/pom.xml | 2 +- .../server/session/AbstractSessionServerTestBase.java | 5 +++++ server/server/shared/pom.xml | 2 +- .../sofa/registry/server/shared/env/ServerEnv.java | 2 +- .../server/shared/resource/VersionResource.java | 2 +- server/store/api/pom.xml | 2 +- .../store/api/repository/AppRevisionRepository.java | 2 ++ server/store/jdbc/pom.xml | 2 +- .../repository/impl/AppRevisionJdbcRepository.java | 11 +++++++++++ server/store/jraft/pom.xml | 2 +- .../repository/impl/AppRevisionRaftRepository.java | 5 +++++ server/store/pom.xml | 2 +- test/pom.xml | 2 +- 37 files changed, 57 insertions(+), 34 deletions(-) diff --git a/VERSION b/VERSION index 3af67b5cb..1dd8be08f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.1.6 \ No newline at end of file +6.1.8 diff --git a/client/all/pom.xml b/client/all/pom.xml index caa5702f3..3365e8eda 100644 --- a/client/all/pom.xml +++ b/client/all/pom.xml @@ -6,7 +6,7 @@ com.alipay.sofa registry-client-all - 6.1.7 + 6.1.8 ${project.groupId}:${project.artifactId} http://github.com/alipay/sofa-registry diff --git a/client/api/pom.xml b/client/api/pom.xml index 7d1b5a0de..568f4f7f5 100644 --- a/client/api/pom.xml +++ b/client/api/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-client-parent - 6.1.7 + 6.1.8 ../pom.xml 4.0.0 diff --git a/client/impl/pom.xml b/client/impl/pom.xml index 49b91f8a3..dbea3a627 100644 --- a/client/impl/pom.xml +++ b/client/impl/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-client-parent - 6.1.7 + 6.1.8 ../pom.xml 4.0.0 diff --git a/client/log/pom.xml b/client/log/pom.xml index a64cb4664..ec291986f 100644 --- a/client/log/pom.xml +++ b/client/log/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-client-parent - 6.1.7 + 6.1.8 ../pom.xml 4.0.0 diff --git a/client/pom.xml b/client/pom.xml index 5a92c4bbf..69bcd69ee 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -7,7 +7,7 @@ com.alipay.sofa registry-parent - 6.1.7 + 6.1.8 ../pom.xml diff --git a/core/pom.xml b/core/pom.xml index 9fd172d1e..91b68b9af 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-parent - 6.1.7 + 6.1.8 ../pom.xml 4.0.0 diff --git a/pom.xml b/pom.xml index 406bab963..f1880c48c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 4.0.0 com.alipay.sofa registry-parent - 6.1.7 + 6.1.8 pom ${project.groupId}:${project.artifactId} @@ -525,7 +525,7 @@ true - ${project.build.outputDirectory}/git.properties + ${project.build.outputDirectory}/sofaregistry.git.properties ^git.build.(time|version)$ ^git.commit.id.(abbrev|full)$ diff --git a/server/common/model/pom.xml b/server/common/model/pom.xml index 032cf5419..324b161db 100644 --- a/server/common/model/pom.xml +++ b/server/common/model/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-common - 6.1.7 + 6.1.8 ../pom.xml 4.0.0 diff --git a/server/common/pom.xml b/server/common/pom.xml index b986e8d17..315969598 100644 --- a/server/common/pom.xml +++ b/server/common/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-server-parent - 6.1.7 + 6.1.8 ../pom.xml 4.0.0 diff --git a/server/common/util/pom.xml b/server/common/util/pom.xml index 52b35b146..97640bf4a 100644 --- a/server/common/util/pom.xml +++ b/server/common/util/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-common - 6.1.7 + 6.1.8 ../pom.xml 4.0.0 diff --git a/server/distribution/all/pom.xml b/server/distribution/all/pom.xml index 1078fde46..ef943630b 100644 --- a/server/distribution/all/pom.xml +++ b/server/distribution/all/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-distribution - 6.1.7 + 6.1.8 ../pom.xml 4.0.0 diff --git a/server/distribution/pom.xml b/server/distribution/pom.xml index d1b45a9e8..05b5f01e2 100644 --- a/server/distribution/pom.xml +++ b/server/distribution/pom.xml @@ -6,7 +6,7 @@ com.alipay.sofa registry-server-parent - 6.1.7 + 6.1.8 ../pom.xml 4.0.0 diff --git a/server/pom.xml b/server/pom.xml index 500c5e252..60f6695c8 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -7,7 +7,7 @@ com.alipay.sofa registry-parent - 6.1.7 + 6.1.8 ../pom.xml diff --git a/server/remoting/api/pom.xml b/server/remoting/api/pom.xml index e142f3bac..a569c2b27 100644 --- a/server/remoting/api/pom.xml +++ b/server/remoting/api/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-remoting - 6.1.7 + 6.1.8 ../pom.xml 4.0.0 diff --git a/server/remoting/bolt/pom.xml b/server/remoting/bolt/pom.xml index f259b34ea..66cacd611 100644 --- a/server/remoting/bolt/pom.xml +++ b/server/remoting/bolt/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-remoting - 6.1.7 + 6.1.8 ../pom.xml 4.0.0 diff --git a/server/remoting/http/pom.xml b/server/remoting/http/pom.xml index 7ca2e377d..f2e5cd39f 100644 --- a/server/remoting/http/pom.xml +++ b/server/remoting/http/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-remoting - 6.1.7 + 6.1.8 ../pom.xml 4.0.0 diff --git a/server/remoting/pom.xml b/server/remoting/pom.xml index 0e5ad18cc..faf893233 100644 --- a/server/remoting/pom.xml +++ b/server/remoting/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-server-parent - 6.1.7 + 6.1.8 ../pom.xml 4.0.0 diff --git a/server/server/data/pom.xml b/server/server/data/pom.xml index 2f199b8a7..ea9e66720 100644 --- a/server/server/data/pom.xml +++ b/server/server/data/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-server - 6.1.7 + 6.1.8 ../pom.xml 4.0.0 diff --git a/server/server/integration/pom.xml b/server/server/integration/pom.xml index f3e24e125..b20f3ab6c 100644 --- a/server/server/integration/pom.xml +++ b/server/server/integration/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-server - 6.1.7 + 6.1.8 ../pom.xml 4.0.0 diff --git a/server/server/meta/pom.xml b/server/server/meta/pom.xml index 9deed378b..fb853beae 100644 --- a/server/server/meta/pom.xml +++ b/server/server/meta/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-server - 6.1.7 + 6.1.8 ../pom.xml 4.0.0 diff --git a/server/server/meta/src/main/java/com/alipay/sofa/registry/server/meta/cleaner/AppRevisionCleaner.java b/server/server/meta/src/main/java/com/alipay/sofa/registry/server/meta/cleaner/AppRevisionCleaner.java index 4279733fd..1de6f29ad 100644 --- a/server/server/meta/src/main/java/com/alipay/sofa/registry/server/meta/cleaner/AppRevisionCleaner.java +++ b/server/server/meta/src/main/java/com/alipay/sofa/registry/server/meta/cleaner/AppRevisionCleaner.java @@ -115,7 +115,7 @@ void renew() { slices.add((AppRevisionSlice) result); } for (String revision : AppRevisionSlice.merge(slices).getRevisions()) { - appRevisionRepository.heartbeat(revision); + appRevisionRepository.heartbeatDB(revision); ConcurrentUtils.sleepUninterruptibly(10, TimeUnit.MILLISECONDS); } consecutiveSuccess.success(); diff --git a/server/server/meta/src/test/java/com/alipay/sofa/registry/server/meta/cleaner/AppRevisionCleanerTest.java b/server/server/meta/src/test/java/com/alipay/sofa/registry/server/meta/cleaner/AppRevisionCleanerTest.java index 6b8a440ca..47db73b7b 100644 --- a/server/server/meta/src/test/java/com/alipay/sofa/registry/server/meta/cleaner/AppRevisionCleanerTest.java +++ b/server/server/meta/src/test/java/com/alipay/sofa/registry/server/meta/cleaner/AppRevisionCleanerTest.java @@ -94,7 +94,7 @@ public void testRenew() throws Exception { mocked.renewer.getWaitingMillis(); mocked.renew(); mocked.renewer.runUnthrowable(); - verify(mocked.appRevisionRepository, times(6)).heartbeat(anyString()); + verify(mocked.appRevisionRepository, times(6)).heartbeatDB(anyString()); mocked.init(); mocked.start(); mocked.renewer.close(); diff --git a/server/server/pom.xml b/server/server/pom.xml index f7d26769e..e39c0abb5 100644 --- a/server/server/pom.xml +++ b/server/server/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-server-parent - 6.1.7 + 6.1.8 ../pom.xml 4.0.0 diff --git a/server/server/session/pom.xml b/server/server/session/pom.xml index 89a5e32cb..5a772a1ab 100644 --- a/server/server/session/pom.xml +++ b/server/server/session/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-server - 6.1.7 + 6.1.8 ../pom.xml 4.0.0 diff --git a/server/server/session/src/test/java/com/alipay/sofa/registry/server/session/AbstractSessionServerTestBase.java b/server/server/session/src/test/java/com/alipay/sofa/registry/server/session/AbstractSessionServerTestBase.java index 9fd383872..90c1c03a8 100644 --- a/server/server/session/src/test/java/com/alipay/sofa/registry/server/session/AbstractSessionServerTestBase.java +++ b/server/server/session/src/test/java/com/alipay/sofa/registry/server/session/AbstractSessionServerTestBase.java @@ -753,6 +753,11 @@ public boolean heartbeat(String revision) { return true; } + @Override + public boolean heartbeatDB(String revision) { + return false; + } + @Override public Collection availableRevisions() { return revisions.keySet(); diff --git a/server/server/shared/pom.xml b/server/server/shared/pom.xml index e900db2c5..b12f18c26 100644 --- a/server/server/shared/pom.xml +++ b/server/server/shared/pom.xml @@ -5,7 +5,7 @@ registry-server com.alipay.sofa - 6.1.7 + 6.1.8 4.0.0 diff --git a/server/server/shared/src/main/java/com/alipay/sofa/registry/server/shared/env/ServerEnv.java b/server/server/shared/src/main/java/com/alipay/sofa/registry/server/shared/env/ServerEnv.java index 0649c5473..eb443f43c 100644 --- a/server/server/shared/src/main/java/com/alipay/sofa/registry/server/shared/env/ServerEnv.java +++ b/server/server/shared/src/main/java/com/alipay/sofa/registry/server/shared/env/ServerEnv.java @@ -35,7 +35,7 @@ public final class ServerEnv { private ServerEnv() {} - private static final String GIT_PROPS_FILE = "git.properties"; + public static final String GIT_PROPS_FILE = "sofaregistry.git.properties"; public static final String IP = NetUtil.getLocalAddress().getHostAddress(); public static final int PID = getPID(); public static final ProcessId PROCESS_ID = createProcessId(); diff --git a/server/server/shared/src/main/java/com/alipay/sofa/registry/server/shared/resource/VersionResource.java b/server/server/shared/src/main/java/com/alipay/sofa/registry/server/shared/resource/VersionResource.java index e250adf33..59dc4b379 100644 --- a/server/server/shared/src/main/java/com/alipay/sofa/registry/server/shared/resource/VersionResource.java +++ b/server/server/shared/src/main/java/com/alipay/sofa/registry/server/shared/resource/VersionResource.java @@ -27,6 +27,6 @@ public class VersionResource { @Path("version") public String version() { return StringFormatter.format( - "release properties: \t\t {}", ServerEnv.getReleaseProps("git.properties")); + "release properties: \t\t {}", ServerEnv.getReleaseProps(ServerEnv.GIT_PROPS_FILE)); } } diff --git a/server/store/api/pom.xml b/server/store/api/pom.xml index 02753aaa0..1a215c299 100644 --- a/server/store/api/pom.xml +++ b/server/store/api/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-store - 6.1.7 + 6.1.8 ../pom.xml 4.0.0 diff --git a/server/store/api/src/main/java/com/alipay/sofa/registry/store/api/repository/AppRevisionRepository.java b/server/store/api/src/main/java/com/alipay/sofa/registry/store/api/repository/AppRevisionRepository.java index ff3f3472a..c2b4ac257 100644 --- a/server/store/api/src/main/java/com/alipay/sofa/registry/store/api/repository/AppRevisionRepository.java +++ b/server/store/api/src/main/java/com/alipay/sofa/registry/store/api/repository/AppRevisionRepository.java @@ -52,6 +52,8 @@ public interface AppRevisionRepository { boolean heartbeat(String revision); + boolean heartbeatDB(String revision); + Collection availableRevisions(); List listFromStorage(long start, int limit); diff --git a/server/store/jdbc/pom.xml b/server/store/jdbc/pom.xml index a6844719b..425a03683 100644 --- a/server/store/jdbc/pom.xml +++ b/server/store/jdbc/pom.xml @@ -6,7 +6,7 @@ com.alipay.sofa registry-store - 6.1.7 + 6.1.8 ../pom.xml diff --git a/server/store/jdbc/src/main/java/com/alipay/sofa/registry/jdbc/repository/impl/AppRevisionJdbcRepository.java b/server/store/jdbc/src/main/java/com/alipay/sofa/registry/jdbc/repository/impl/AppRevisionJdbcRepository.java index 989323f44..6cc16070a 100644 --- a/server/store/jdbc/src/main/java/com/alipay/sofa/registry/jdbc/repository/impl/AppRevisionJdbcRepository.java +++ b/server/store/jdbc/src/main/java/com/alipay/sofa/registry/jdbc/repository/impl/AppRevisionJdbcRepository.java @@ -141,6 +141,7 @@ public void register(AppRevision appRevision) throws Exception { /** * check if revisionId exist + * * @param revisionId * @return */ @@ -176,6 +177,16 @@ public boolean heartbeat(String revision) { return informer.getContainer().containsRevisionId(revision); } + @Override + public boolean heartbeatDB(String revision) { + int effect = + appRevisionMapper.heartbeat(defaultCommonConfig.getClusterId(tableName()), revision); + if (effect == 0) { + LOG.error("revision: {} heartbeat fail.", revision); + } + return effect > 0; + } + @VisibleForTesting LoadingCache getRevisions() { return registry; diff --git a/server/store/jraft/pom.xml b/server/store/jraft/pom.xml index a540d5166..b859684dd 100644 --- a/server/store/jraft/pom.xml +++ b/server/store/jraft/pom.xml @@ -6,7 +6,7 @@ com.alipay.sofa registry-store - 6.1.7 + 6.1.8 ../pom.xml diff --git a/server/store/jraft/src/main/java/com/alipay/sofa/registry/jraft/repository/impl/AppRevisionRaftRepository.java b/server/store/jraft/src/main/java/com/alipay/sofa/registry/jraft/repository/impl/AppRevisionRaftRepository.java index bf8d3f760..c9a30ec68 100644 --- a/server/store/jraft/src/main/java/com/alipay/sofa/registry/jraft/repository/impl/AppRevisionRaftRepository.java +++ b/server/store/jraft/src/main/java/com/alipay/sofa/registry/jraft/repository/impl/AppRevisionRaftRepository.java @@ -62,6 +62,11 @@ public boolean heartbeat(String revision) { return false; } + @Override + public boolean heartbeatDB(String revision) { + return false; + } + @Override public void waitSynced() {} diff --git a/server/store/pom.xml b/server/store/pom.xml index 74136532e..0ceb73355 100644 --- a/server/store/pom.xml +++ b/server/store/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-server-parent - 6.1.7 + 6.1.8 ../pom.xml 4.0.0 diff --git a/test/pom.xml b/test/pom.xml index 527b20690..78402973e 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-parent - 6.1.7 + 6.1.8 ../pom.xml 4.0.0