This is an automated email from the ASF dual-hosted git repository.
xyuanlu pushed a commit to branch helix-gateway-service
in repository https://gitbox.apache.org/repos/asf/helix.git
The following commit(s) were added to refs/heads/helix-gateway-service by this
push:
new 5d05e9268 Add log and refine code style for Gateway service (#2950)
5d05e9268 is described below
commit 5d05e9268b1ec8f26d99bd44275c3de98870b38b
Author: xyuanlu <[email protected]>
AuthorDate: Fri Oct 18 11:49:49 2024 -0700
Add log and refine code style for Gateway service (#2950)
---
.../constant/GatewayServiceManagerConstant.java | 25 ++++++++++++++++++++++
.../constant/gatewayServiceManagerConstant.java | 6 ------
.../participant/HelixGatewayParticipant.java | 2 ++
.../gateway/service/GatewayServiceManager.java | 6 +++---
4 files changed, 30 insertions(+), 9 deletions(-)
diff --git
a/helix-gateway/src/main/java/org/apache/helix/gateway/api/constant/GatewayServiceManagerConstant.java
b/helix-gateway/src/main/java/org/apache/helix/gateway/api/constant/GatewayServiceManagerConstant.java
new file mode 100644
index 000000000..d8fdfec06
--- /dev/null
+++
b/helix-gateway/src/main/java/org/apache/helix/gateway/api/constant/GatewayServiceManagerConstant.java
@@ -0,0 +1,25 @@
+package org.apache.helix.gateway.api.constant;
+
+/*
+ * 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.
+ */
+
+public class GatewayServiceManagerConstant {
+ public static final String TARGET_STATE_ASSIGNMENT_KEY_NAME = "Assignment";
+ public static final String TIMESTAMP_KEY = "Timestamp";
+}
diff --git
a/helix-gateway/src/main/java/org/apache/helix/gateway/api/constant/gatewayServiceManagerConstant.java
b/helix-gateway/src/main/java/org/apache/helix/gateway/api/constant/gatewayServiceManagerConstant.java
deleted file mode 100644
index c4fc420e1..000000000
---
a/helix-gateway/src/main/java/org/apache/helix/gateway/api/constant/gatewayServiceManagerConstant.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package org.apache.helix.gateway.api.constant;
-
-public class gatewayServiceManagerConstant {
- public static final String TARGET_STATE_ASSIGNMENT_KEY_NAME = "Assignment";
- public static final String TIMESTAMP_KEY = "Timestamp";
-}
diff --git
a/helix-gateway/src/main/java/org/apache/helix/gateway/participant/HelixGatewayParticipant.java
b/helix-gateway/src/main/java/org/apache/helix/gateway/participant/HelixGatewayParticipant.java
index 4d3b975c0..eeb042c1c 100644
---
a/helix-gateway/src/main/java/org/apache/helix/gateway/participant/HelixGatewayParticipant.java
+++
b/helix-gateway/src/main/java/org/apache/helix/gateway/participant/HelixGatewayParticipant.java
@@ -88,6 +88,7 @@ public class HelixGatewayParticipant implements
HelixManagerStateListener {
throw new Exception("Failed to transition to state " + toState);
}
} finally {
+ logger.info("State transition finished for shard: {}{}", resourceId,
shardId);
_stateTransitionResultMap.remove(concatenatedShardName);
}
}
@@ -167,6 +168,7 @@ public class HelixGatewayParticipant implements
HelixManagerStateListener {
}
public void disconnect() {
+ logger.info("Disconnecting from HelixManager {}",
_helixManager.getInstanceName() );
if (_helixManager.isConnected()) {
_helixManager.disconnect();
}
diff --git
a/helix-gateway/src/main/java/org/apache/helix/gateway/service/GatewayServiceManager.java
b/helix-gateway/src/main/java/org/apache/helix/gateway/service/GatewayServiceManager.java
index 0809ac6e2..d53ee5134 100644
---
a/helix-gateway/src/main/java/org/apache/helix/gateway/service/GatewayServiceManager.java
+++
b/helix-gateway/src/main/java/org/apache/helix/gateway/service/GatewayServiceManager.java
@@ -19,7 +19,6 @@ package org.apache.helix.gateway.service;
* under the License.
*/
-import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.collect.ImmutableSet;
@@ -37,11 +36,10 @@ import
org.apache.helix.gateway.channel.HelixGatewayServiceChannelFactory;
import org.apache.helix.gateway.participant.HelixGatewayParticipant;
import org.apache.helix.gateway.util.GatewayCurrentStateCache;
import org.apache.helix.gateway.util.PerKeyBlockingExecutor;
-import org.apache.helix.gateway.util.PollChannelUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static
org.apache.helix.gateway.api.constant.gatewayServiceManagerConstant.*;
+import static
org.apache.helix.gateway.api.constant.GatewayServiceManagerConstant.*;
/**
@@ -115,6 +113,7 @@ public class GatewayServiceManager {
}
public void resetTargetStateCache(String clusterName, String instanceName) {
+ logger.info("Resetting target state cache for cluster: {}, instance: {}",
clusterName, instanceName);
getOrCreateCache(clusterName).resetTargetStateCache(instanceName);
}
@@ -244,6 +243,7 @@ public class GatewayServiceManager {
}
private void removeHelixGatewayParticipant(String clusterName, String
instanceName) {
+ logger.info("Removing participant: {} from cluster: {}", instanceName,
clusterName);
// Disconnect and remove the participant from the participant map
HelixGatewayParticipant participant =
getHelixGatewayParticipant(clusterName, instanceName);
if (participant != null) {