You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2022/12/22 02:32:42 UTC
[GitHub] [skywalking] wankai123 opened a new pull request, #10192: The cluster coordinator support watch mechanism for notifying `RemoteClientManager` and `ServerStatusService`.
wankai123 opened a new pull request, #10192:
URL: https://github.com/apache/skywalking/pull/10192
- [ ] If this is non-trivial feature, paste the links/URLs to the design doc.
- [ ] Update the documentation to include this new feature.
- [X] Tests(including UT, IT, E2E) are added to verify the new feature.
- [ ] If it's UI related, attach the screenshots below.
- [ ] If this pull request closes/resolves/fixes an existing issue, replace the issue number. Closes #10076.
- [X] Update the [`CHANGES` log](https://github.com/apache/skywalking/blob/master/docs/en/changes/changes.md).
also relate to #9814
I reserve the query timer mechanism and extended the interval, just in case the notification from the third-party client fails due to network or other issues.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking] wu-sheng commented on a diff in pull request #10192: The cluster coordinator support watch mechanism for notifying `RemoteClientManager` and `ServerStatusService`.
Posted by GitBox <gi...@apache.org>.
wu-sheng commented on code in PR #10192:
URL: https://github.com/apache/skywalking/pull/10192#discussion_r1055055980
##########
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/remote/client/RemoteClientManager.java:
##########
@@ -93,14 +94,26 @@ public RemoteClientManager(final ModuleDefineHolder moduleDefineHolder, final in
public void start() {
Optional.ofNullable(sslContext).ifPresent(DynamicSslContext::start);
- Executors.newSingleThreadScheduledExecutor().scheduleWithFixedDelay(this::refresh, 1, 5, TimeUnit.SECONDS);
+ Executors.newSingleThreadScheduledExecutor()
+ .scheduleWithFixedDelay(new RunnableWithExceptionProtection(this::refresh, t -> log.error(
+ "Scheduled refresh Remote Clients failure.", t)), 1, 10, TimeUnit.SECONDS);
+ }
+
+ void refresh() {
+ if (Objects.isNull(clusterNodesQuery)) {
+ this.clusterNodesQuery = moduleDefineHolder.find(ClusterModule.NAME)
+ .provider()
+ .getService(ClusterNodesQuery.class);
+ }
+
+ this.refresh(clusterNodesQuery.queryRemoteNodes());
}
/**
* Query OAP server list from the cluster module and create a new connection for the new node. Make the OAP server
Review Comment:
Comments should be updated accordingly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking] wankai123 merged pull request #10192: The cluster coordinator support watch mechanism for notifying `RemoteClientManager` and `ServerStatusService`.
Posted by GitBox <gi...@apache.org>.
wankai123 merged PR #10192:
URL: https://github.com/apache/skywalking/pull/10192
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking] wankai123 commented on a diff in pull request #10192: The cluster coordinator support watch mechanism for notifying `RemoteClientManager` and `ServerStatusService`.
Posted by GitBox <gi...@apache.org>.
wankai123 commented on code in PR #10192:
URL: https://github.com/apache/skywalking/pull/10192#discussion_r1055038441
##########
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java:
##########
@@ -355,18 +355,20 @@ public void start() throws ModuleStartException {
Address gRPCServerInstanceAddress = new Address(moduleConfig.getGRPCHost(), moduleConfig.getGRPCPort(), true);
TelemetryRelatedContext.INSTANCE.setId(gRPCServerInstanceAddress.toString());
+ ClusterCoordinator coordinator = this.getManager()
+ .find(ClusterModule.NAME)
+ .provider()
+ .getService(ClusterCoordinator.class);
+ coordinator.startCoordinator();
+ coordinator.registerWatcher(remoteClientManager);
Review Comment:
Not necessary, but do register first more clearly. I'll fix it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking] wu-sheng commented on a diff in pull request #10192: The cluster coordinator support watch mechanism for notifying `RemoteClientManager` and `ServerStatusService`.
Posted by GitBox <gi...@apache.org>.
wu-sheng commented on code in PR #10192:
URL: https://github.com/apache/skywalking/pull/10192#discussion_r1055030840
##########
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java:
##########
@@ -355,18 +355,20 @@ public void start() throws ModuleStartException {
Address gRPCServerInstanceAddress = new Address(moduleConfig.getGRPCHost(), moduleConfig.getGRPCPort(), true);
TelemetryRelatedContext.INSTANCE.setId(gRPCServerInstanceAddress.toString());
+ ClusterCoordinator coordinator = this.getManager()
+ .find(ClusterModule.NAME)
+ .provider()
+ .getService(ClusterCoordinator.class);
+ coordinator.startCoordinator();
+ coordinator.registerWatcher(remoteClientManager);
Review Comment:
Should we do register first before start coodinator?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking] wu-sheng commented on a diff in pull request #10192: The cluster coordinator support watch mechanism for notifying `RemoteClientManager` and `ServerStatusService`.
Posted by GitBox <gi...@apache.org>.
wu-sheng commented on code in PR #10192:
URL: https://github.com/apache/skywalking/pull/10192#discussion_r1055031996
##########
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/cluster/ClusterModule.java:
##########
@@ -32,7 +32,9 @@ public ClusterModule() {
public Class[] services() {
return new Class[] {
ClusterRegister.class,
- ClusterNodesQuery.class
+ ClusterNodesQuery.class,
+ ClusterWatcherRegister.class,
+ ClusterCoordinator.class
Review Comment:
As `ClusterCoordinator` inherits `ClusterWatcherRegister`, do we need to expose both?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking] kezhenxu94 commented on a diff in pull request #10192: The cluster coordinator support watch mechanism for notifying `RemoteClientManager` and `ServerStatusService`.
Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on code in PR #10192:
URL: https://github.com/apache/skywalking/pull/10192#discussion_r1055066987
##########
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/cluster/ClusterCoordinator.java:
##########
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.server.core.cluster;
+
+import java.util.ArrayList;
+import java.util.List;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.skywalking.oap.server.library.module.ModuleStartException;
+
+@Slf4j
+public abstract class ClusterCoordinator implements ClusterRegister, ClusterNodesQuery, ClusterWatcherRegister {
+ private boolean started = false;
+ private final List<ClusterWatcher> clusterWatchers = new ArrayList<>();
+
+ public void startCoordinator() throws ModuleStartException {
+ if (!started) {
+ start();
+ started = true;
+ } else {
+ throw new ModuleStartException("Cluster coordinator has been started, should not start again.");
+ }
Review Comment:
I doubt we really need to check this, this will never happen actually and we never do this kind of check in all other components
##########
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/cluster/ClusterCoordinator.java:
##########
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.server.core.cluster;
+
+import java.util.ArrayList;
+import java.util.List;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.skywalking.oap.server.library.module.ModuleStartException;
+
+@Slf4j
+public abstract class ClusterCoordinator implements ClusterRegister, ClusterNodesQuery, ClusterWatcherRegister {
+ private boolean started = false;
+ private final List<ClusterWatcher> clusterWatchers = new ArrayList<>();
+
+ public void startCoordinator() throws ModuleStartException {
Review Comment:
Let's use the consistent method name (`start`) with other components and rename the `protected` `start` to something else.
##########
oap-server/server-cluster-plugin/cluster-zookeeper-plugin/src/main/java/org/apache/skywalking/oap/server/cluster/plugin/zookeeper/ZookeeperCoordinator.java:
##########
@@ -128,4 +134,30 @@ private void initHealthChecker() {
healthChecker = metricCreator.createHealthCheckerGauge("cluster_zookeeper", MetricsTag.EMPTY_KEY, MetricsTag.EMPTY_VALUE);
}
}
+
+ @Override
+ protected void start() {
+ initHealthChecker();
+ serviceCache.addListener(new ZookeeperEventListener());
Review Comment:
Maybe move the line 64 (`this.serviceCache.start();`) here and move this line to the constructor?
##########
oap-server/server-cluster-plugin/cluster-zookeeper-plugin/src/main/java/org/apache/skywalking/oap/server/cluster/plugin/zookeeper/ZookeeperCoordinator.java:
##########
@@ -115,6 +117,10 @@ public List<RemoteInstance> queryRemoteNodes() {
this.healthChecker.unHealth(e);
throw new ServiceQueryException(e.getMessage());
}
+
+ if (log.isDebugEnabled()) {
+ remoteInstances.forEach(instance -> log.debug("Zookeeper cluster instance: {}", instance.toString()));
Review Comment:
```suggestion
remoteInstances.forEach(instance -> log.debug("Zookeeper cluster instance: {}", instance));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org