diff --git a/hugegraph-pd/.DS_Store b/hugegraph-pd/.DS_Store deleted file mode 100644 index 1b1b3b8c07..0000000000 Binary files a/hugegraph-pd/.DS_Store and /dev/null differ diff --git a/hugegraph-pd/build-pre.sh b/hugegraph-pd/build-pre.sh index 9350c36122..f92d104eea 100644 --- a/hugegraph-pd/build-pre.sh +++ b/hugegraph-pd/build-pre.sh @@ -21,7 +21,7 @@ touch output/1 export JAVA_HOME=$ORACLEJDK_1_8_0_HOME readonly VER=3.6.3 -readonly REPO_URL=http://10.14.139.8:8081/artifactory/star-local +readonly REPO_URL=http://127.0.0.1:8081/artifactory/star-local $MAVEN_3_5_3_BIN/mvn -DremoveSnapshot=true -DprocessAllModules=true -DgenerateBackupPoms=true versions:set $MAVEN_3_5_3_BIN/mvn --settings ./settings.xml -Dmaven.test.skip=true -DaltDeploymentRepository=star-local::default::${REPO_URL} clean deploy @@ -30,7 +30,7 @@ $MAVEN_3_5_3_BIN/mvn versions:revert #------------------repo----------------------- readonly FILE_NAME=hugegraph-pd-3.6.3.tar.gz -readonly REPO_URL_FILE=http://10.14.139.8:8081/artifactory/star-file +readonly REPO_URL_FILE=http://127.0.0.1:8081/artifactory/star-file localFilePath=dist/${FILE_NAME} targetFolder="${REPO_URL_FILE}/dist/$(date '+%Y-%m-%d')/" diff --git a/hugegraph-pd/deploy-release.sh b/hugegraph-pd/deploy-release.sh index e9421724aa..118a214d7f 100644 --- a/hugegraph-pd/deploy-release.sh +++ b/hugegraph-pd/deploy-release.sh @@ -17,7 +17,7 @@ # readonly VER=3.6.3 -readonly REPO_URL=http://10.14.139.8:8081/artifactory/star-local +readonly REPO_URL=http://127.0.0.1:8081/artifactory/star-local #mvn -DnewVersion=${VER}-SNAPSHOT -DprocessAllModules=true -DgenerateBackupPoms=false versions:set ./mvnw -DremoveSnapshot=true -DprocessAllModules=true -DgenerateBackupPoms=true versions:set diff --git a/hugegraph-pd/deploy-snapshot.sh b/hugegraph-pd/deploy-snapshot.sh index e9421724aa..118a214d7f 100644 --- a/hugegraph-pd/deploy-snapshot.sh +++ b/hugegraph-pd/deploy-snapshot.sh @@ -17,7 +17,7 @@ # readonly VER=3.6.3 -readonly REPO_URL=http://10.14.139.8:8081/artifactory/star-local +readonly REPO_URL=http://127.0.0.1:8081/artifactory/star-local #mvn -DnewVersion=${VER}-SNAPSHOT -DprocessAllModules=true -DgenerateBackupPoms=false versions:set ./mvnw -DremoveSnapshot=true -DprocessAllModules=true -DgenerateBackupPoms=true versions:set diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/AbstractClientStubProxy.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/AbstractClientStubProxy.java index 8c8bf38152..150633ba24 100644 --- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/AbstractClientStubProxy.java +++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/AbstractClientStubProxy.java @@ -22,9 +22,6 @@ import io.grpc.stub.AbstractBlockingStub; import io.grpc.stub.AbstractStub; -/** - * @date 2022/6/20 - **/ public class AbstractClientStubProxy { private final LinkedList hostList = new LinkedList<>(); diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/Discoverable.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/Discoverable.java index 3dac3478d1..4222bfbe50 100644 --- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/Discoverable.java +++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/Discoverable.java @@ -20,9 +20,6 @@ import org.apache.hugegraph.pd.grpc.discovery.NodeInfos; import org.apache.hugegraph.pd.grpc.discovery.Query; -/** - * @date 2021/12/20 - **/ public interface Discoverable { NodeInfos getNodeInfos(Query query); diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClient.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClient.java index 8d38b23fe7..aa80ec606f 100644 --- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClient.java +++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClient.java @@ -38,9 +38,6 @@ import io.grpc.ManagedChannelBuilder; import lombok.extern.slf4j.Slf4j; -/** - * @date 2021/12/20 - **/ @Slf4j public abstract class DiscoveryClient implements Closeable, Discoverable { @@ -127,20 +124,20 @@ private void resetChannel(String singleAddress) throws PDException { try { if (requireResetStub.get()) { while (channel != null && !channel.shutdownNow().awaitTermination( - 100, TimeUnit.MILLISECONDS)) { + 100, TimeUnit.MILLISECONDS)) { continue; } channel = ManagedChannelBuilder.forTarget( - singleAddress).usePlaintext().build(); + singleAddress).usePlaintext().build(); this.registerStub = DiscoveryServiceGrpc.newBlockingStub( - channel); + channel); this.blockingStub = DiscoveryServiceGrpc.newBlockingStub( - channel); + channel); requireResetStub.set(false); } } catch (Exception e) { throw new PDException(-1, String.format( - "Reset channel with error : %s.", e.getMessage())); + "Reset channel with error : %s.", e.getMessage())); } finally { readWriteLock.writeLock().unlock(); } @@ -212,7 +209,7 @@ public void close() { readWriteLock.writeLock().lock(); try { while (channel != null && !channel.shutdownNow().awaitTermination( - 100, TimeUnit.MILLISECONDS)) { + 100, TimeUnit.MILLISECONDS)) { continue; } } catch (Exception e) { diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClientImpl.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClientImpl.java index c65053cc9f..77ec9a36b2 100644 --- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClientImpl.java +++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClientImpl.java @@ -23,9 +23,6 @@ import org.apache.hugegraph.pd.grpc.discovery.NodeInfo; import org.apache.hugegraph.pd.grpc.discovery.RegisterType; -/** - * @date 2021/12/20 - **/ public class DiscoveryClientImpl extends DiscoveryClient { private final String id; diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/LicenseClient.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/LicenseClient.java index d21741b194..b86d6b3946 100644 --- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/LicenseClient.java +++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/LicenseClient.java @@ -27,9 +27,6 @@ import io.grpc.stub.AbstractStub; import lombok.extern.slf4j.Slf4j; -/** - * @date 2022/8/3 - **/ @Slf4j public class LicenseClient extends AbstractClient { diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDPulse.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDPulse.java index 542311280c..025d6f7ae8 100644 --- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDPulse.java +++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDPulse.java @@ -26,8 +26,6 @@ /** * Bidirectional communication interface of pd-client and pd-server - * - * @author lynn.bond@hotmail.com created on 2021/11/9 */ public interface PDPulse { @@ -151,4 +149,4 @@ interface Notifier extends Closeable { void crash(String error); } -} \ No newline at end of file +} diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDPulseImpl.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDPulseImpl.java index 0e473a9c78..2d1ccb743e 100644 --- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDPulseImpl.java +++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDPulseImpl.java @@ -38,9 +38,6 @@ import io.grpc.stub.StreamObserver; import lombok.extern.slf4j.Slf4j; -/** - * @author lynn.bond@hotmail.com created on 2021/11/9 - */ @Slf4j public final class PDPulseImpl implements PDPulse { diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDWatch.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDWatch.java index a16d7b1b02..3da255a825 100644 --- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDWatch.java +++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDWatch.java @@ -24,9 +24,6 @@ import org.apache.hugegraph.pd.watch.NodeEvent; import org.apache.hugegraph.pd.watch.PartitionEvent; -/** - * @author lynn.bond@hotmail.com created on 2021/11/4 - */ public interface PDWatch { /** diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDWatchImpl.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDWatchImpl.java index c723eb9479..73796b53fb 100644 --- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDWatchImpl.java +++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDWatchImpl.java @@ -17,7 +17,6 @@ package org.apache.hugegraph.pd.client; -import java.util.concurrent.ConcurrentHashMap; import java.util.function.Supplier; import org.apache.hugegraph.pd.grpc.watch.HgPdWatchGrpc; @@ -31,17 +30,14 @@ import org.apache.hugegraph.pd.watch.PartitionEvent; import io.grpc.ManagedChannel; -import io.grpc.ManagedChannelBuilder; import io.grpc.stub.StreamObserver; -/** - * @author lynn.bond@hotmail.com created on 2021/11/4 - */ final class PDWatchImpl implements PDWatch { - private HgPdWatchGrpc.HgPdWatchStub stub; + private final HgPdWatchGrpc.HgPdWatchStub stub; + + private final String pdServerAddress; - private String pdServerAddress; // TODO: support several servers. PDWatchImpl(String pdServerAddress) { this.pdServerAddress = pdServerAddress; @@ -55,7 +51,7 @@ public String getCurrentHost() { @Override public boolean checkChannel() { - return stub != null && ! ((ManagedChannel) stub.getChannel()).isShutdown(); + return stub != null && !((ManagedChannel) stub.getChannel()).isShutdown(); } /** @@ -95,9 +91,9 @@ private class GraphWatcher extends AbstractWatcher { private GraphWatcher(Listener listener) { super(listener, () -> WatchCreateRequest - .newBuilder() - .setWatchType(WatchType.WATCH_TYPE_GRAPH_CHANGE) - .build() + .newBuilder() + .setWatchType(WatchType.WATCH_TYPE_GRAPH_CHANGE) + .build() ); } @@ -112,9 +108,9 @@ private class ShardGroupWatcher extends AbstractWatcher { private ShardGroupWatcher(Listener listener) { super(listener, () -> WatchCreateRequest - .newBuilder() - .setWatchType(WatchType.WATCH_TYPE_SHARD_GROUP_CHANGE) - .build() + .newBuilder() + .setWatchType(WatchType.WATCH_TYPE_SHARD_GROUP_CHANGE) + .build() ); } @@ -129,9 +125,9 @@ private class PartitionWatcher extends AbstractWatcher { private PartitionWatcher(Listener listener) { super(listener, () -> WatchCreateRequest - .newBuilder() - .setWatchType(WatchType.WATCH_TYPE_PARTITION_CHANGE) - .build() + .newBuilder() + .setWatchType(WatchType.WATCH_TYPE_PARTITION_CHANGE) + .build() ); } @@ -140,7 +136,7 @@ public void onNext(WatchResponse watchResponse) { WatchPartitionResponse res = watchResponse.getPartitionResponse(); PartitionEvent event = new PartitionEvent(res.getGraph(), res.getPartitionId(), PartitionEvent.ChangeType.grpcTypeOf( - res.getChangeType())); + res.getChangeType())); this.listener.onNext(event); } } @@ -149,9 +145,9 @@ private class NodeWatcher extends AbstractWatcher { private NodeWatcher(Listener listener) { super(listener, () -> WatchCreateRequest - .newBuilder() - .setWatchType(WatchType.WATCH_TYPE_STORE_NODE_CHANGE) - .build() + .newBuilder() + .setWatchType(WatchType.WATCH_TYPE_STORE_NODE_CHANGE) + .build() ); } @@ -179,7 +175,7 @@ private AbstractWatcher(Listener listener, void init() { this.reqStream = PDWatchImpl.this.stub.watch(this); this.reqStream.onNext(WatchRequest.newBuilder().setCreateRequest( - this.requestSupplier.get() + this.requestSupplier.get() ).build()); } diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/pulse/PulseServerNotice.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/pulse/PulseServerNotice.java index 468553714f..251bab07f9 100644 --- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/pulse/PulseServerNotice.java +++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/pulse/PulseServerNotice.java @@ -17,9 +17,6 @@ package org.apache.hugegraph.pd.pulse; -/** - * @author lynn.bond@hotmail.com created on 2022/2/13 - */ public interface PulseServerNotice { /** * @throws RuntimeException when failed to send ack-message to pd-server diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/PDWatcher.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/PDWatcher.java index 8a2a406904..c4ff91b107 100644 --- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/PDWatcher.java +++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/PDWatcher.java @@ -17,9 +17,6 @@ package org.apache.hugegraph.pd.watch; -/** - * @author lynn.bond@hotmail.com created on 2021/11/4 - */ public class PDWatcher { } diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/PartitionEvent.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/PartitionEvent.java index 237a35bfad..76a4fdc7d9 100644 --- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/PartitionEvent.java +++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/PartitionEvent.java @@ -21,9 +21,6 @@ import org.apache.hugegraph.pd.grpc.watch.WatchChangeType; -/** - * @author lynn.bond@hotmail.com created on 2021/11/4 - */ public class PartitionEvent { private final String graph; private final int partitionId; diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/WatchType.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/WatchType.java index 493f93c4eb..e14bfafdc1 100644 --- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/WatchType.java +++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/WatchType.java @@ -17,9 +17,6 @@ package org.apache.hugegraph.pd.watch; -/** - * @author lynn.bond@hotmail.com created on 2021/11/4 - */ enum WatchType { PARTITION_CHANGE(10); diff --git a/hugegraph-pd/hg-pd-client/src/test/java/org/apache/hugegraph/pd/client/DiscoveryClientImplTest.java b/hugegraph-pd/hg-pd-client/src/test/java/org/apache/hugegraph/pd/client/DiscoveryClientImplTest.java index f2b8139740..8952cc1162 100644 --- a/hugegraph-pd/hg-pd-client/src/test/java/org/apache/hugegraph/pd/client/DiscoveryClientImplTest.java +++ b/hugegraph-pd/hg-pd-client/src/test/java/org/apache/hugegraph/pd/client/DiscoveryClientImplTest.java @@ -27,9 +27,6 @@ import org.apache.hugegraph.pd.grpc.discovery.Query; import org.junit.Assert; -/** - * @date 2021/12/21 - **/ public class DiscoveryClientImplTest { private static final AtomicLong label = new AtomicLong(); diff --git a/hugegraph-pd/hg-pd-client/src/test/java/org/apache/hugegraph/pd/client/LicenseClientImplTest.java b/hugegraph-pd/hg-pd-client/src/test/java/org/apache/hugegraph/pd/client/LicenseClientImplTest.java index 6fc2518b0d..390821662e 100644 --- a/hugegraph-pd/hg-pd-client/src/test/java/org/apache/hugegraph/pd/client/LicenseClientImplTest.java +++ b/hugegraph-pd/hg-pd-client/src/test/java/org/apache/hugegraph/pd/client/LicenseClientImplTest.java @@ -30,9 +30,6 @@ import lombok.extern.slf4j.Slf4j; -/** - * @date 2021/12/21 - **/ @Slf4j public class LicenseClientImplTest { @@ -49,7 +46,7 @@ public void putLicense() { log.info(error.getMessage()); assert error.getType().equals(Pdpb.ErrorType.OK); } catch (Exception e) { - log.error("put license with error: {}", e); + log.error("put license with error: ", e); } } @@ -66,13 +63,13 @@ public void getKv() { Object property = ymlConfig.get("rocksdb.write_buffer_size"); assert property.toString().equals("32000000"); } catch (Exception e) { - log.error("put license with error: {}", e); + log.error("put license with error: ", e); } } // @Test public void putKv() { - PDConfig pdConfig = PDConfig.of("10.14.139.70:8688"); + PDConfig pdConfig = PDConfig.of("127.0.0.1.70:8688"); pdConfig.setEnableCache(true); try (KvClient c = new KvClient(pdConfig)) { long l = System.currentTimeMillis(); @@ -81,7 +78,7 @@ public void putKv() { log.info(error.getMessage()); assert error.getType().equals(Pdpb.ErrorType.OK); } catch (Exception e) { - log.error("put license with error: {}", e); + log.error("put license with error: ", e); } } @@ -96,14 +93,14 @@ public void putKvLocal() { log.info(error.getMessage()); assert error.getType().equals(Pdpb.ErrorType.OK); } catch (Exception e) { - log.error("put license with error: {}", e); + log.error("put license with error: ", e); } } private Properties getYmlConfig(String yml) { Yaml yaml = new Yaml(); - Iterable load = yaml.loadAll(yml); - Iterator iterator = load.iterator(); + Iterable load = yaml.loadAll(yml); + Iterator iterator = load.iterator(); Properties properties = new Properties(); while (iterator.hasNext()) { Map next = (Map) iterator.next(); @@ -127,4 +124,4 @@ private void map2Properties(Map map, String prefix, Properties p } } -} \ No newline at end of file +} diff --git a/hugegraph-pd/hg-pd-client/src/test/java/org/apache/hugegraph/pd/client/PDPulseTest.java b/hugegraph-pd/hg-pd-client/src/test/java/org/apache/hugegraph/pd/client/PDPulseTest.java index 27d247a369..dfdc63cf36 100644 --- a/hugegraph-pd/hg-pd-client/src/test/java/org/apache/hugegraph/pd/client/PDPulseTest.java +++ b/hugegraph-pd/hg-pd-client/src/test/java/org/apache/hugegraph/pd/client/PDPulseTest.java @@ -25,9 +25,6 @@ import org.apache.hugegraph.pd.pulse.PulseServerNotice; import org.junit.BeforeClass; -/** - * @author lynn.bond@hotmail.com created on 2021/11/8 - */ public class PDPulseTest { private static PDClient pdClient; diff --git a/hugegraph-pd/hg-pd-client/src/test/java/org/apache/hugegraph/pd/client/test/HgPDTestUtil.java b/hugegraph-pd/hg-pd-client/src/test/java/org/apache/hugegraph/pd/client/test/HgPDTestUtil.java index 51152b74f4..99e5f83360 100644 --- a/hugegraph-pd/hg-pd-client/src/test/java/org/apache/hugegraph/pd/client/test/HgPDTestUtil.java +++ b/hugegraph-pd/hg-pd-client/src/test/java/org/apache/hugegraph/pd/client/test/HgPDTestUtil.java @@ -22,9 +22,6 @@ import java.util.Iterator; import java.util.List; -/** - * @author lynn.bond@hotmail.com created on 2021/11/8 - */ public class HgPDTestUtil { public static void println(Object str) { diff --git a/hugegraph-pd/hg-pd-common/src/main/java/org/apache/hugegraph/pd/common/HgAssert.java b/hugegraph-pd/hg-pd-common/src/main/java/org/apache/hugegraph/pd/common/HgAssert.java index 3e43ef2adf..bb1fccd025 100644 --- a/hugegraph-pd/hg-pd-common/src/main/java/org/apache/hugegraph/pd/common/HgAssert.java +++ b/hugegraph-pd/hg-pd-common/src/main/java/org/apache/hugegraph/pd/common/HgAssert.java @@ -20,9 +20,6 @@ import java.util.Collection; import java.util.Map; -/** - * @author lynn.bond@hotmail.com - */ public final class HgAssert { public static void isTrue(boolean expression, String message) { diff --git a/hugegraph-pd/hg-pd-common/src/main/java/org/apache/hugegraph/pd/common/PDRuntimeException.java b/hugegraph-pd/hg-pd-common/src/main/java/org/apache/hugegraph/pd/common/PDRuntimeException.java index 3865639aea..c7efb84031 100644 --- a/hugegraph-pd/hg-pd-common/src/main/java/org/apache/hugegraph/pd/common/PDRuntimeException.java +++ b/hugegraph-pd/hg-pd-common/src/main/java/org/apache/hugegraph/pd/common/PDRuntimeException.java @@ -17,9 +17,6 @@ package org.apache.hugegraph.pd.common; -/** - * @date 2022/8/1 - **/ public class PDRuntimeException extends RuntimeException { // public static final int LICENSE_ERROR = -11; diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/LogService.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/LogService.java index ecb69e82d4..664b6b8dec 100644 --- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/LogService.java +++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/LogService.java @@ -31,9 +31,6 @@ import lombok.extern.slf4j.Slf4j; -/** - * @date 2022/3/29 - **/ @Slf4j @Service public class LogService { diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/RegistryService.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/RegistryService.java index 724281a349..4a0f3fef66 100644 --- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/RegistryService.java +++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/RegistryService.java @@ -25,9 +25,6 @@ import org.apache.hugegraph.pd.meta.DiscoveryMetaStore; import org.apache.hugegraph.pd.meta.MetadataFactory; -/** - * @date 2022/1/14 - **/ public class RegistryService { private final PDConfig pdConfig; private final DiscoveryMetaStore meta; diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/config/PDConfig.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/config/PDConfig.java index 6d085f5051..84e8581673 100644 --- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/config/PDConfig.java +++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/config/PDConfig.java @@ -35,9 +35,6 @@ /** * PD配置文件 - * - * @author: yanjinbing - * @date: 2021/10/20 */ @Data @Component @@ -65,28 +62,14 @@ public class PDConfig { private String licensePath; @Autowired private ThreadPoolGrpc threadPoolGrpc; - - @Data - @Configuration - public class ThreadPoolGrpc { - @Value("${thread.pool.grpc.core:600}") - private int core; - @Value("${thread.pool.grpc.max:1000}") - private int max; - @Value("${thread.pool.grpc.queue:" + Integer.MAX_VALUE + "}") - private int queue; - } - @Autowired private Raft raft; - @Autowired private Store store; @Autowired private Partition partition; @Autowired private Discovery discovery; - private Map initialStoreMap = null; private ConfigService configService; private IdService idService; @@ -128,6 +111,17 @@ public void setIdService(IdService idService) { this.idService = idService; } + @Data + @Configuration + public class ThreadPoolGrpc { + @Value("${thread.pool.grpc.core:600}") + private int core; + @Value("${thread.pool.grpc.max:1000}") + private int max; + @Value("${thread.pool.grpc.queue:" + Integer.MAX_VALUE + "}") + private int queue; + } + @Data @Configuration public class Raft { @@ -207,7 +201,7 @@ public Long getRetentionPeriod() { private Long parseTimeExpression(String exp) { if (exp != null) { Pattern pattern = Pattern.compile( - "(?(\\d+)*)(\\s)*(?(second|minute|hour|day|month|year)$)"); + "(?(\\d+)*)(\\s)*(?(second|minute|hour|day|month|year)$)"); Matcher matcher = pattern.matcher(exp.trim()); if (matcher.find()) { String n = matcher.group("n"); diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/DiscoveryMetaStore.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/DiscoveryMetaStore.java index 81da5e3030..c95185363d 100644 --- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/DiscoveryMetaStore.java +++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/DiscoveryMetaStore.java @@ -30,9 +30,6 @@ import lombok.extern.slf4j.Slf4j; -/** - * @date 2022/1/14 - **/ @Slf4j public class DiscoveryMetaStore extends MetadataRocksDBStore { diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/LogMeta.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/LogMeta.java index dd5a3be16a..ab3660034d 100644 --- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/LogMeta.java +++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/LogMeta.java @@ -23,9 +23,6 @@ import org.apache.hugegraph.pd.config.PDConfig; import org.apache.hugegraph.pd.grpc.Metapb; -/** - * @date 2022/3/29 - **/ public class LogMeta extends MetadataRocksDBStore { private final PDConfig pdConfig; diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/MetadataRocksDBStore.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/MetadataRocksDBStore.java index c591c116d9..05aa938f07 100644 --- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/MetadataRocksDBStore.java +++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/MetadataRocksDBStore.java @@ -30,9 +30,6 @@ import com.google.protobuf.Parser; -/** - * @date 2022/1/9 - **/ public class MetadataRocksDBStore extends MetadataStoreBase { HgKVStore store; diff --git a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/QueueStore.java b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/QueueStore.java index 979f5fcc25..ce850e5b90 100644 --- a/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/QueueStore.java +++ b/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/QueueStore.java @@ -26,9 +26,6 @@ import org.apache.hugegraph.pd.raft.RaftEngine; import org.apache.hugegraph.pd.store.RaftKVStore; -/** - * @author lynn.bond@hotmail.com on 2022/2/10 - */ public class QueueStore extends MetadataRocksDBStore { QueueStore(PDConfig pdConfig) { super(pdConfig); diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/metrics/MetricsConfig.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/metrics/MetricsConfig.java index 2a2ec10750..d051bfbdba 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/metrics/MetricsConfig.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/metrics/MetricsConfig.java @@ -24,9 +24,6 @@ import io.micrometer.core.instrument.MeterRegistry; -/** - * @author lynn.bond@hotmail.com on 2022/01/05 - */ @Configuration public class MetricsConfig { @Autowired diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/metrics/PDMetrics.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/metrics/PDMetrics.java index 31d9a7c28a..bb230e8d09 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/metrics/PDMetrics.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/metrics/PDMetrics.java @@ -31,9 +31,6 @@ import io.micrometer.core.instrument.MeterRegistry; import lombok.extern.slf4j.Slf4j; -/** - * @author lynn.bond@hotmail.com on 2022/1/5 - */ @Component @Slf4j public final class PDMetrics { diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/DemoModel.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/DemoModel.java index 3f28e5027c..72d9599c86 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/DemoModel.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/DemoModel.java @@ -19,9 +19,6 @@ import java.util.Objects; -/** - * @author lynn.bond@hotmail.com created on 2021/11/1 - */ public class DemoModel { private int status; private String text; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/PromTargetsModel.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/PromTargetsModel.java index 47ff3ab83a..57e15f74a2 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/PromTargetsModel.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/PromTargetsModel.java @@ -22,9 +22,6 @@ import java.util.Map; import java.util.Set; -/** - * @author lynn.bond@hotmail.com on 2022/2/14 - */ public class PromTargetsModel { private static final String LABEL_METRICS_PATH = "__metrics_path__"; private static final String LABEL_SCHEME = "__scheme__"; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/RegistryQueryRestRequest.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/RegistryQueryRestRequest.java index a076c93b8e..5833d99ca2 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/RegistryQueryRestRequest.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/RegistryQueryRestRequest.java @@ -21,9 +21,6 @@ import lombok.Data; -/** - * @date 2022/2/8 - **/ @Data public class RegistryQueryRestRequest { diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/RegistryRestRequest.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/RegistryRestRequest.java index 10ab054758..666a8661c3 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/RegistryRestRequest.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/RegistryRestRequest.java @@ -21,9 +21,6 @@ import lombok.Data; -/** - * @date 2022/2/8 - **/ @Data public class RegistryRestRequest { diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/RegistryRestResponse.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/RegistryRestResponse.java index 8cd00b5825..93ab584e22 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/RegistryRestResponse.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/RegistryRestResponse.java @@ -23,9 +23,6 @@ import lombok.Data; -/** - * @date 2022/2/8 - **/ @Data public class RegistryRestResponse { diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/RestApiResponse.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/RestApiResponse.java index 5136bc5fe0..54f6c60bd5 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/RestApiResponse.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/RestApiResponse.java @@ -23,10 +23,6 @@ import lombok.Data; -/** - * @author tianxiaohui - * @date 2022-07-21 - */ @Data public class RestApiResponse { String message; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/TimeRangeRequest.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/TimeRangeRequest.java index 25b9ed51c0..cc25cedd36 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/TimeRangeRequest.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/model/TimeRangeRequest.java @@ -19,9 +19,6 @@ import lombok.Data; -/** - * @date 2022/3/23 - **/ @Data public class TimeRangeRequest { String startTime; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/notice/NoticeBroadcaster.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/notice/NoticeBroadcaster.java index 53bcfee357..ec3976b8bf 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/notice/NoticeBroadcaster.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/notice/NoticeBroadcaster.java @@ -24,9 +24,6 @@ import lombok.extern.slf4j.Slf4j; -/** - * @author lynn.bond@hotmail.com on 2022/2/10 - */ @Slf4j public class NoticeBroadcaster { private final Supplier noticeSupplier; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/pulse/AbstractObserverSubject.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/pulse/AbstractObserverSubject.java index 503bd2d688..64472f5625 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/pulse/AbstractObserverSubject.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/pulse/AbstractObserverSubject.java @@ -34,9 +34,6 @@ import io.grpc.stub.StreamObserver; import lombok.extern.slf4j.Slf4j; -/** - * @author lynn.bond@hotmail.com created on 2021/11/9 - */ @ThreadSafe @Slf4j abstract class AbstractObserverSubject { diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/pulse/PDPulseSubject.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/pulse/PDPulseSubject.java index 36891803bc..ca5cfe7096 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/pulse/PDPulseSubject.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/pulse/PDPulseSubject.java @@ -57,24 +57,20 @@ import io.grpc.stub.StreamObserver; import lombok.extern.slf4j.Slf4j; -/** - * @author lynn.bond@hotmail.com created on 2021/11/8 - * @version 1.1.0 added ack on 2020/02/11 - */ @Slf4j @ThreadSafe public class PDPulseSubject { private final static long NOTICE_EXPIRATION_TIME = 30 * 60 * 1000; private final static int RETRYING_PERIOD_SECONDS = 60; private final static Map subjectHolder = - new ConcurrentHashMap<>(); + new ConcurrentHashMap<>(); private final static ConcurrentLinkedQueue broadcasterQueue = - new ConcurrentLinkedQueue<>(); + new ConcurrentLinkedQueue<>(); private final static ScheduledExecutorService scheduledExecutor = - Executors.newScheduledThreadPool(1); + Executors.newScheduledThreadPool(1); private static Supplier> queueRetrieveFunction = - () -> Collections.emptyList(); + () -> Collections.emptyList(); private static Function queueDurableFunction = (e) -> true; private static Function queueRemoveFunction = (e) -> true; @@ -104,15 +100,15 @@ private static void doSchedule() { private static void appendQueue() { broadcasterQueue.addAll( - getQueueItems() - .parallelStream() - .filter(e -> !broadcasterQueue - .stream() - .anyMatch(b -> e.getItemId().equals(b.getDurableId())) - ).map(e -> createBroadcaster(e)) - .peek(e -> log.info("Appending notice: {}", e)) - .filter(e -> e != null) - .collect(Collectors.toList()) + getQueueItems() + .parallelStream() + .filter(e -> !broadcasterQueue + .stream() + .anyMatch(b -> e.getItemId().equals(b.getDurableId())) + ).map(e -> createBroadcaster(e)) + .peek(e -> log.info("Appending notice: {}", e)) + .filter(e -> e != null) + .collect(Collectors.toList()) ); } @@ -138,13 +134,13 @@ private static List getQueueItems() { } public static void setQueueRetrieveFunction( - Supplier> queueRetrieveFunction) { + Supplier> queueRetrieveFunction) { HgAssert.isArgumentNotNull(queueRetrieveFunction, "queueRetrieveFunction"); PDPulseSubject.queueRetrieveFunction = queueRetrieveFunction; } public static void setQueueDurableFunction( - Function queueDurableFunction) { + Function queueDurableFunction) { HgAssert.isArgumentNotNull(queueDurableFunction, "queueDurableFunction"); PDPulseSubject.queueDurableFunction = queueDurableFunction; } @@ -161,7 +157,7 @@ public static void setQueueRemoveFunction(Function queueRemoveF * @return */ public static StreamObserver addObserver( - StreamObserver responseObserver) { + StreamObserver responseObserver) { isArgumentNotNull(responseObserver, "responseObserver"); return new PDPulseStreamObserver(responseObserver); } @@ -223,7 +219,7 @@ private static NoticeBroadcaster createBroadcaster(PdInstructionResponse notice) // } public static Supplier getNoticeSupplier( - T notice) { + T notice) { PulseType type; if (notice instanceof PdInstructionResponse) { type = PulseType.PULSE_TYPE_PD_INSTRUCTION; @@ -237,7 +233,7 @@ public static Supplier private static Supplier getDurableSupplier( - com.google.protobuf.GeneratedMessageV3 notice) { + com.google.protobuf.GeneratedMessageV3 notice) { return () -> { Metapb.QueueItem queueItem = toQueueItem(notice); String res = null; @@ -247,9 +243,9 @@ private static Supplier getDurableSupplier( res = queueItem.getItemId(); } else { log.error( - "Failed to persist queue-item that contained " + - "PartitionHeartbeatResponse: {}" - , notice); + "Failed to persist queue-item that contained " + + "PartitionHeartbeatResponse: {}" + , notice); } } catch (Throwable t) { log.error("Failed to invoke queueDurableFunction, cause by:", t); @@ -333,7 +329,7 @@ private void cancelObserver() { if (this.subject == null) { this.responseObserver.onError( - new Exception("Invoke cancel-observer before create-observer.")); + new Exception("Invoke cancel-observer before create-observer.")); return; } @@ -378,7 +374,7 @@ private AbstractObserverSubject getSubject(PulseType pulseType) { if (subject == null) { responseObserver.onError( - new Exception("Unsupported pulse-type: " + pulseType.name())); + new Exception("Unsupported pulse-type: " + pulseType.name())); return null; } @@ -396,7 +392,7 @@ private void handleNotice(PulseNoticeRequest noticeRequest) { log.info("send change leader command to watch, due to ERROR-100", pde); notifyClient(PdInstructionResponse.newBuilder() .setInstructionType( - PdInstructionType.CHANGE_TO_FOLLOWER) + PdInstructionType.CHANGE_TO_FOLLOWER) .setLeaderIp(RaftEngine.getInstance() .getLeaderGrpcAddress()) .build()); @@ -429,7 +425,7 @@ public void onNext(PulseRequest pulseRequest) { if (pulseRequest.hasAckRequest()) { this.ackNotice(pulseRequest.getAckRequest().getNoticeId() - , pulseRequest.getAckRequest().getObserverId()); + , pulseRequest.getAckRequest().getObserverId()); } } diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/pulse/PartitionHeartbeatSubject.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/pulse/PartitionHeartbeatSubject.java index a08f2c826d..a42ffce1e5 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/pulse/PartitionHeartbeatSubject.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/pulse/PartitionHeartbeatSubject.java @@ -27,9 +27,6 @@ import com.google.protobuf.GeneratedMessageV3; -/** - * @author lynn.bond@hotmail.com created on 2021/11/9 - */ public class PartitionHeartbeatSubject extends AbstractObserverSubject { PartitionHeartbeatSubject() { diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/PromTargetsAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/PromTargetsAPI.java index 8c94cb4a5f..f2432b093f 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/PromTargetsAPI.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/PromTargetsAPI.java @@ -34,7 +34,7 @@ import lombok.extern.slf4j.Slf4j; /** - * @author lynn.bond@hotmail.com on 2022/2/14 + * TODO: ensure if we need this class & method (delete) */ @RestController @Slf4j @@ -45,8 +45,9 @@ public class PromTargetsAPI { private PromTargetsService service; @GetMapping(value = "/targets/{appName}", produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity> getPromTargets( - @PathVariable(value = "appName", required = true) String appName) { + public ResponseEntity> getPromTargets(@PathVariable(value = "appName", + required = true) + String appName) { return ResponseEntity.of(Optional.ofNullable(this.service.getTargets(appName))); } @@ -56,9 +57,9 @@ public ResponseEntity> getPromAllTargets() { } @GetMapping(value = "/demo/targets/{appName}", produces = MediaType.APPLICATION_JSON_VALUE) - public List getDemoTargets( - @PathVariable(value = "appName", required = true) String targetType) { - + public List getDemoTargets(@PathVariable(value = "appName", + required = true) String targetType) { + // TODO: ensure the IP addr is correct & useful PromTargetsModel model = null; switch (targetType) { case "node": @@ -86,7 +87,6 @@ public List getDemoTargets( default: } - return Collections.singletonList(model); } } diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/RegistryAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/RegistryAPI.java index d18608bdda..2aedd5f305 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/RegistryAPI.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/RegistryAPI.java @@ -50,9 +50,6 @@ import lombok.extern.slf4j.Slf4j; -/** - * @date 2022/2/8 - **/ @RestController @Slf4j @RequestMapping("/v1") diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/TestAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/TestAPI.java index 75c90f16bf..1ab6326112 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/TestAPI.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/TestAPI.java @@ -46,9 +46,6 @@ import lombok.extern.slf4j.Slf4j; -/** - * @author lynn.bond@hotmail.com on 2022/2/9 - */ @RestController @Slf4j @RequestMapping("/test") diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDPulseService.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDPulseService.java index d73a0873ac..2f21cfbacd 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDPulseService.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDPulseService.java @@ -37,16 +37,12 @@ import io.grpc.stub.StreamObserver; import lombok.extern.slf4j.Slf4j; -/** - * @author lynn.bond@hotmail.com created on 2021/11/4 - */ - @Slf4j @GRpcService public class PDPulseService extends HgPdPulseGrpc.HgPdPulseImplBase { private static final Supplier> QUEUE_RETRIEVE_FUNCTION = - () -> Collections.emptyList(); + () -> Collections.emptyList(); private static final Function QUEUE_ITEM_BOOLEAN_FUNCTION = (e) -> true; private static final Function QUEUE_REMOVE_FUNCTION = (e) -> true; @Autowired diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDWatchService.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDWatchService.java index 1ddda6de12..d4b9481e9d 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDWatchService.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDWatchService.java @@ -26,9 +26,6 @@ import io.grpc.stub.StreamObserver; import lombok.extern.slf4j.Slf4j; -/** - * @author lynn.bond@hotmail.com created on 2021/11/4 - */ @Slf4j @GRpcService public class PDWatchService extends HgPdWatchGrpc.HgPdWatchImplBase { diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PromTargetsService.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PromTargetsService.java index 1f797bef4e..7683e58073 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PromTargetsService.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PromTargetsService.java @@ -44,9 +44,6 @@ import lombok.extern.slf4j.Slf4j; -/** - * @author lynn.bond@hotmail.com on 2022/2/24 - */ @Service @Slf4j public class PromTargetsService { diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/ServiceGrpc.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/ServiceGrpc.java index 5035e453b5..5aa67f93bf 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/ServiceGrpc.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/ServiceGrpc.java @@ -30,9 +30,6 @@ import io.grpc.ManagedChannelBuilder; import io.grpc.MethodDescriptor; -/** - * @date 2022/6/21 - **/ public interface ServiceGrpc extends RaftStateListener { ConcurrentHashMap channels = new ConcurrentHashMap(); diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/DateUtil.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/DateUtil.java index 5435b5b902..f26be26dd9 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/DateUtil.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/DateUtil.java @@ -24,9 +24,6 @@ import org.apache.hugegraph.pd.common.PDException; import org.apache.hugegraph.pd.grpc.Pdpb; -/** - * @date 2022/3/23 - **/ public class DateUtil { private static final String DATE = "yyyy-MM-dd"; private static final String DATETIME = "yyyy-MM-dd HH:mm:ss"; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/HgMapCache.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/HgMapCache.java index 496dfee0ff..8b6a4a4dcb 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/HgMapCache.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/HgMapCache.java @@ -24,7 +24,6 @@ /** * @param * @param - * @author lynn.bond@hotmail.com on 2022/3/10 */ public class HgMapCache { private final Map cache = new ConcurrentHashMap(); diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/IdUtil.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/IdUtil.java index 3c5f7a82da..75e4287178 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/IdUtil.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/IdUtil.java @@ -19,9 +19,6 @@ import lombok.extern.slf4j.Slf4j; -/** - * @author lynn.bond@hotmail.com on 2022/2/8 - */ @Slf4j public final class IdUtil { private static final byte[] LOCK = new byte[0]; diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/AbstractWatchSubject.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/AbstractWatchSubject.java index c3f94821e2..79905511f2 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/AbstractWatchSubject.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/AbstractWatchSubject.java @@ -33,9 +33,6 @@ import io.grpc.stub.StreamObserver; import lombok.extern.slf4j.Slf4j; -/** - * @author lynn.bond@hotmail.com created on 2021/11/5 - */ @ThreadSafe @Slf4j abstract class AbstractWatchSubject { diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/KvWatchSubject.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/KvWatchSubject.java index 9130651d6c..0a2dbd84b5 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/KvWatchSubject.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/KvWatchSubject.java @@ -42,8 +42,6 @@ /** * watch订阅、响应处理类 - * - * @date 2022/6/21 **/ @Slf4j public class KvWatchSubject { @@ -53,7 +51,7 @@ public class KvWatchSubject { public static final String ALL_PREFIX = "W"; public static final long WATCH_TTL = 20000L; private static final ConcurrentMap> clients = - new ConcurrentHashMap<>(); + new ConcurrentHashMap<>(); private final KvService kvService; BiPredicate equal = String::equals; BiPredicate startWith = String::startsWith; @@ -76,7 +74,7 @@ private void addWatchKey(String key, String delimiter, long clientId) throws PDE String watchKey = KvService.getKeyWithoutPrefix(ALL_PREFIX, delimiter, key, clientId); kvService.put(watchKey, "", WATCH_TTL); String clientFirstKey = - KvService.getKeyWithoutPrefix(ALL_PREFIX, clientId, delimiter, key, clientId); + KvService.getKeyWithoutPrefix(ALL_PREFIX, clientId, delimiter, key, clientId); kvService.put(clientFirstKey, "", WATCH_TTL); } @@ -99,7 +97,7 @@ private void removeWatchKey(String key, String delimiter, long clientId) throws public void addObserver(String key, long clientId, StreamObserver observer, String delimiter) throws PDException { String keyWithoutPrefix = - KvService.getKeyWithoutPrefix(ALL_PREFIX, delimiter, key, clientId); + KvService.getKeyWithoutPrefix(ALL_PREFIX, delimiter, key, clientId); clients.putIfAbsent(keyWithoutPrefix, observer); addWatchKey(key, delimiter, clientId); log.info("client:{},start to watch key:{}", clientId, key); @@ -108,7 +106,7 @@ public void addObserver(String key, long clientId, StreamObserver public void removeObserver(String key, long clientId, String delimiter) throws PDException { removeWatchKey(key, delimiter, clientId); String keyWithoutPrefix = - KvService.getKeyWithoutPrefix(ALL_PREFIX, delimiter, key, clientId); + KvService.getKeyWithoutPrefix(ALL_PREFIX, delimiter, key, clientId); clients.remove(keyWithoutPrefix); } @@ -145,15 +143,15 @@ public void notifyObserver(String key, WatchType watchType, continue; } WatchKv watchKv = - WatchKv.newBuilder().setKey(kvKey).setValue(kv.getValue()).build(); + WatchKv.newBuilder().setKey(kvKey).setValue(kv.getValue()).build(); WatchEvent event = - WatchEvent.newBuilder().setCurrent(watchKv).setType(watchType).build(); + WatchEvent.newBuilder().setCurrent(watchKv).setType(watchType).build(); watchEvents.add(event); } StreamObserver observer = clients.get(keyAndClient); watchResponse = - WatchResponse.newBuilder().setState(WatchState.Started).setClientId(clientId) - .addAllEvents(watchEvents).build(); + WatchResponse.newBuilder().setState(WatchState.Started).setClientId(clientId) + .addAllEvents(watchEvents).build(); try { if (observer != null) { @@ -188,7 +186,7 @@ public void keepClientAlive() { WatchResponse testAlive = WatchResponse.newBuilder().setState(WatchState.Alive).build(); Set>> entries = clients.entrySet(); Map.Entry>[] array = - entries.toArray(new Map.Entry[0]); + entries.toArray(new Map.Entry[0]); Arrays.stream(array).parallel().forEach(entry -> { StreamObserver value = entry.getValue(); String key = entry.getKey(); @@ -262,7 +260,7 @@ private void removeClient(StreamObserver value, String key, Strin */ public void notifyClientChangeLeader() { WatchResponse response = - WatchResponse.newBuilder().setState(WatchState.Leader_Changed).build(); + WatchResponse.newBuilder().setState(WatchState.Leader_Changed).build(); for (Map.Entry> entry : clients.entrySet()) { StreamObserver value = entry.getValue(); String key = entry.getKey(); @@ -287,4 +285,4 @@ public void notifyClientChangeLeader() { } } } -} \ No newline at end of file +} diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/NodeChangeSubject.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/NodeChangeSubject.java index 4e8b50fd13..0e7c26dde5 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/NodeChangeSubject.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/NodeChangeSubject.java @@ -27,8 +27,6 @@ /** * The subject of partition change. - * - * @author lynn.bond@hotmail.com created on 2021/11/26 */ @ThreadSafe final class NodeChangeSubject extends AbstractWatchSubject { @@ -50,11 +48,11 @@ public void notifyWatcher(NodeEventType nodeEventType, String graph, long nodeId super.notifyWatcher(builder -> { builder.setNodeResponse( - builder.getNodeResponseBuilder().clear() - .setGraph(graph) - .setNodeId(nodeId) - .setNodeEventType(nodeEventType) - .build() + builder.getNodeResponseBuilder().clear() + .setGraph(graph) + .setNodeId(nodeId) + .setNodeEventType(nodeEventType) + .build() ); }); diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/PDWatchSubject.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/PDWatchSubject.java index cf3e6df06e..92ef98e8e6 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/PDWatchSubject.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/PDWatchSubject.java @@ -35,9 +35,6 @@ import io.grpc.stub.StreamObserver; import lombok.extern.slf4j.Slf4j; -/** - * @author lynn.bond@hotmail.com created on 2021/11/4 - */ @Slf4j @ThreadSafe public class PDWatchSubject implements StreamObserver { diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/PartitionChangeSubject.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/PartitionChangeSubject.java index 2e664b98f0..85f5e8b7f0 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/PartitionChangeSubject.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/watch/PartitionChangeSubject.java @@ -28,8 +28,6 @@ /** * The subject of partition change. - * - * @author lynn.bond@hotmail.com created on 2021/11/5 */ @ThreadSafe final class PartitionChangeSubject extends AbstractWatchSubject { @@ -40,11 +38,10 @@ final class PartitionChangeSubject extends AbstractWatchSubject { @Override String toNoticeString(WatchResponse res) { - StringBuilder sb = new StringBuilder(); - return sb.append("graph:").append(res.getPartitionResponse().getGraph()) - .append(",") - .append("partitionId:").append(res.getPartitionResponse().getPartitionId()) - .toString(); + String sb = "graph:" + res.getPartitionResponse().getGraph() + + "," + + "partitionId:" + res.getPartitionResponse().getPartitionId(); + return sb; } public void notifyWatcher(WatchChangeType changeType, String graph, int partitionId) { @@ -53,14 +50,14 @@ public void notifyWatcher(WatchChangeType changeType, String graph, int partitio super.notifyWatcher(builder -> { builder.setPartitionResponse( - builder.getPartitionResponseBuilder().clear() - .setGraph(graph) - .setPartitionId(partitionId) - .setChangeType(changeType) - .build() + builder.getPartitionResponseBuilder().clear() + .setGraph(graph) + .setPartitionId(partitionId) + .setChangeType(changeType) + .build() ); }); } -} \ No newline at end of file +} diff --git a/hugegraph-pd/hg-pd-service/src/main/resources/private-keys.store b/hugegraph-pd/hg-pd-service/src/main/resources/private-keys.store deleted file mode 100644 index 258075b0d7..0000000000 Binary files a/hugegraph-pd/hg-pd-service/src/main/resources/private-keys.store and /dev/null differ diff --git a/hugegraph-pd/hg-pd-service/src/main/resources/public-certs.store b/hugegraph-pd/hg-pd-service/src/main/resources/public-certs.store deleted file mode 100644 index 0da6d22699..0000000000 Binary files a/hugegraph-pd/hg-pd-service/src/main/resources/public-certs.store and /dev/null differ diff --git a/hugegraph-pd/hg-pd-service/src/test/java/live/PDServer0.java b/hugegraph-pd/hg-pd-service/src/test/java/live/PDServer0.java index ccb9724892..c28c098aef 100644 --- a/hugegraph-pd/hg-pd-service/src/test/java/live/PDServer0.java +++ b/hugegraph-pd/hg-pd-service/src/test/java/live/PDServer0.java @@ -24,9 +24,6 @@ import org.apache.hugegraph.pd.boot.HugePDServer; import org.springframework.boot.SpringApplication; -/** - * @date 2022/1/9 - **/ public class PDServer0 { static String SERVER_NAME = "server0"; diff --git a/hugegraph-pd/hg-pd-service/src/test/java/live/PDServer1.java b/hugegraph-pd/hg-pd-service/src/test/java/live/PDServer1.java index 88f722523f..75ee0f3cd5 100644 --- a/hugegraph-pd/hg-pd-service/src/test/java/live/PDServer1.java +++ b/hugegraph-pd/hg-pd-service/src/test/java/live/PDServer1.java @@ -24,9 +24,6 @@ import org.apache.hugegraph.pd.boot.HugePDServer; import org.springframework.boot.SpringApplication; -/** - * @date 2022/1/9 - **/ public class PDServer1 { static String SERVER_NAME = "server1"; diff --git a/hugegraph-pd/hg-pd-service/src/test/java/live/PDServer2.java b/hugegraph-pd/hg-pd-service/src/test/java/live/PDServer2.java index bc6c67e87c..9c9096e3c9 100644 --- a/hugegraph-pd/hg-pd-service/src/test/java/live/PDServer2.java +++ b/hugegraph-pd/hg-pd-service/src/test/java/live/PDServer2.java @@ -24,9 +24,6 @@ import org.apache.hugegraph.pd.boot.HugePDServer; import org.springframework.boot.SpringApplication; -/** - * @date 2022/1/9 - **/ public class PDServer2 { static String SERVER_NAME = "server2"; diff --git a/hugegraph-pd/hg-pd-service/src/test/java/live/PDServer3.java b/hugegraph-pd/hg-pd-service/src/test/java/live/PDServer3.java index 4603d59295..258f677ae7 100644 --- a/hugegraph-pd/hg-pd-service/src/test/java/live/PDServer3.java +++ b/hugegraph-pd/hg-pd-service/src/test/java/live/PDServer3.java @@ -24,9 +24,6 @@ import org.apache.hugegraph.pd.boot.HugePDServer; import org.springframework.boot.SpringApplication; -/** - * @date 2022/1/9 - **/ public class PDServer3 { static String SERVER_NAME = "server3"; diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/PDClientTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/PDClientTest.java index 552abfcfc3..868c8d2aec 100644 --- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/PDClientTest.java +++ b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/PDClientTest.java @@ -28,10 +28,6 @@ import org.junit.Test; import org.mockito.Mockito; -/** - * @author zhengfuquan - * @date 2022/11/28 - **/ public class PDClientTest extends BaseClientTest { @Test public void testDbCompaction() { @@ -419,4 +415,4 @@ public void testdelGraph() { e.printStackTrace(); } } -} \ No newline at end of file +} diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/service/RestApiTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/service/RestApiTest.java index 4719c22f8a..dc7af4253f 100644 --- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/service/RestApiTest.java +++ b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/service/RestApiTest.java @@ -27,10 +27,6 @@ import org.json.JSONObject; import org.junit.Test; -/** - * @author tianxiaohui - * @date 20221220 - **/ public class RestApiTest extends BaseServerTest { @Test public void testQueryClusterInfo() throws URISyntaxException, IOException, InterruptedException, diff --git a/hugegraph-pd/settings.xml b/hugegraph-pd/settings.xml index 9b26803442..ce0fa7ae9a 100644 --- a/hugegraph-pd/settings.xml +++ b/hugegraph-pd/settings.xml @@ -65,7 +65,7 @@ star - http://10.14.139.8:8082/artifactory/star + http://127.0.0.1:8082/artifactory/star true always