Skip to content

Commit

Permalink
add log and refine code style
Browse files Browse the repository at this point in the history
  • Loading branch information
xyuanlu committed Oct 17, 2024
1 parent f602ca2 commit 3e8e55a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -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";
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public void processStateTransitionMessage(Message message) throws Exception {
throw new Exception("Failed to transition to state " + toState);
}
} finally {
logger.info("State transition finished for shard: {}{}", resourceId, shardId);
_stateTransitionResultMap.remove(concatenatedShardName);
}
}
Expand Down Expand Up @@ -167,6 +168,7 @@ public void onDisconnected(HelixManager helixManager, Throwable error) throws Ex
}

public void disconnect() {
logger.info("Disconnecting from HelixManager {}", _helixManager.getInstanceName() );
if (_helixManager.isConnected()) {
_helixManager.disconnect();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
* 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;
Expand All @@ -37,11 +36,10 @@
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.*;


/**
Expand Down Expand Up @@ -115,6 +113,7 @@ public void onGatewayServiceEvent(GatewayServiceEvent event) {
}

public void resetTargetStateCache(String clusterName, String instanceName) {
logger.info("Resetting target state cache for cluster: {}, instance: {}", clusterName, instanceName);
getOrCreateCache(clusterName).resetTargetStateCache(instanceName);
}

Expand Down Expand Up @@ -244,6 +243,7 @@ private void createHelixGatewayParticipant(String clusterName, String instanceNa
}

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) {
Expand Down

0 comments on commit 3e8e55a

Please sign in to comment.