Skip to content

Commit

Permalink
[apache/helix] -- Removed/Transformed SOUT statements
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshukandwal committed Dec 12, 2023
1 parent b0ff25e commit 45bab89
Show file tree
Hide file tree
Showing 213 changed files with 450 additions and 1,458 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/Helix-Manual-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ on:
required: true
default: -fae test

permissions: write-all

jobs:
MANUAL_CI:

Expand All @@ -24,16 +26,20 @@ jobs:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.buildRef }}
- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11
- name: Delete frontend-maven-plugin dir
run: rm -rf .m2\repository\com\github\eirslett
- name: Build with Maven
run: mvn clean install -Dmaven.test.skip.exec=true -DretryFailedDeploymentCount=5
- name: Run All Tests
run: mvn -B -V -e -ntp "-Dstyle.color=always" ${{ github.event.inputs.mvnOpts }} ${{ github.event.inputs.goals }}
- name: Print Tests Results
run: .github/scripts/printTestResult.sh
if: ${{ success() || failure() }}
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Tests Results
path: './**/target/surefire-reports/TEST-TestSuite.xml'
reporter: java-junit
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@
import org.apache.helix.participant.statemachine.StateModelFactory;
import org.apache.helix.participant.statemachine.StateModelInfo;
import org.apache.helix.participant.statemachine.Transition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class BootstrapHandler extends StateModelFactory<StateModel> {

private static final Logger LOG = LoggerFactory.getLogger(BootstrapHandler.class);

@Override
public StateModel createNewStateModel(String resourceName, String stateUnitKey) {
return new BootstrapStateModel(stateUnitKey);
Expand All @@ -58,7 +62,6 @@ public void masterToSlave(Message message, NotificationContext context) {

@Transition(from = "OFFLINE", to = "SLAVE")
public void offlineToSlave(Message message, NotificationContext context) {
System.out.println("BootstrapProcess.BootstrapStateModel.offlineToSlave()");
HelixManager manager = context.getManager();
ClusterMessagingService messagingService = manager.getMessagingService();
Message requestBackupUriRequest =
Expand All @@ -81,8 +84,8 @@ public void offlineToSlave(Message message, NotificationContext context) {
if (sentMessageCount == 0) {
// could not find any other node hosting the partition
} else if (responseHandler.getBootstrapUrl() != null) {
System.out.println("Got bootstrap url:" + responseHandler.getBootstrapUrl());
System.out.println("Got backup time:" + responseHandler.getBootstrapTime());
LOG.info("Got bootstrap url:" + responseHandler.getBootstrapUrl());
LOG.info("Got backup time:" + responseHandler.getBootstrapTime());
// Got the url fetch it
} else {
// Either go to error state
Expand All @@ -93,12 +96,12 @@ public void offlineToSlave(Message message, NotificationContext context) {

@Transition(from = "SLAVE", to = "OFFLINE")
public void slaveToOffline(Message message, NotificationContext context) {
System.out.println("BootstrapProcess.BootstrapStateModel.slaveToOffline()");
LOG.info("BootstrapProcess.BootstrapStateModel.slaveToOffline()");
}

@Transition(from = "SLAVE", to = "MASTER")
public void slaveToMaster(Message message, NotificationContext context) {
System.out.println("BootstrapProcess.BootstrapStateModel.slaveToMaster()");
LOG.info("BootstrapProcess.BootstrapStateModel.slaveToMaster()");
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@
import org.apache.helix.participant.statemachine.StateModelFactory;
import org.apache.helix.participant.statemachine.StateModelInfo;
import org.apache.helix.participant.statemachine.Transition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DummyParticipant {

private static final Logger LOG = LoggerFactory.getLogger(DummyParticipant.class);

// dummy master-slave state model
@StateModelInfo(initialState = "OFFLINE", states = {
"MASTER", "SLAVE", "ERROR"
Expand All @@ -40,47 +45,47 @@ public static class DummyMSStateModel extends StateModel {
public void onBecomeSlaveFromOffline(Message message, NotificationContext context) {
String partitionName = message.getPartitionName();
String instanceName = message.getTgtName();
System.out.println(instanceName + " becomes SLAVE from OFFLINE for " + partitionName);
LOG.info(instanceName + " becomes SLAVE from OFFLINE for " + partitionName);
}

@Transition(to = "MASTER", from = "SLAVE")
public void onBecomeMasterFromSlave(Message message, NotificationContext context) {
String partitionName = message.getPartitionName();
String instanceName = message.getTgtName();
System.out.println(instanceName + " becomes MASTER from SLAVE for " + partitionName);
LOG.info(instanceName + " becomes MASTER from SLAVE for " + partitionName);
}

@Transition(to = "SLAVE", from = "MASTER")
public void onBecomeSlaveFromMaster(Message message, NotificationContext context) {
String partitionName = message.getPartitionName();
String instanceName = message.getTgtName();
System.out.println(instanceName + " becomes SLAVE from MASTER for " + partitionName);
LOG.info(instanceName + " becomes SLAVE from MASTER for " + partitionName);
}

@Transition(to = "OFFLINE", from = "SLAVE")
public void onBecomeOfflineFromSlave(Message message, NotificationContext context) {
String partitionName = message.getPartitionName();
String instanceName = message.getTgtName();
System.out.println(instanceName + " becomes OFFLINE from SLAVE for " + partitionName);
LOG.info(instanceName + " becomes OFFLINE from SLAVE for " + partitionName);
}

@Transition(to = "DROPPED", from = "OFFLINE")
public void onBecomeDroppedFromOffline(Message message, NotificationContext context) {
String partitionName = message.getPartitionName();
String instanceName = message.getTgtName();
System.out.println(instanceName + " becomes DROPPED from OFFLINE for " + partitionName);
LOG.info(instanceName + " becomes DROPPED from OFFLINE for " + partitionName);
}

@Transition(to = "OFFLINE", from = "ERROR")
public void onBecomeOfflineFromError(Message message, NotificationContext context) {
String partitionName = message.getPartitionName();
String instanceName = message.getTgtName();
System.out.println(instanceName + " becomes OFFLINE from ERROR for " + partitionName);
LOG.info(instanceName + " becomes OFFLINE from ERROR for " + partitionName);
}

@Override
public void reset() {
System.out.println("Default MockMSStateModel.reset() invoked");
LOG.info("Default MockMSStateModel.reset() invoked");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,22 @@
import org.apache.helix.zookeeper.zkclient.IDefaultNameSpace;
import org.apache.helix.zookeeper.zkclient.ZkClient;
import org.apache.helix.zookeeper.zkclient.ZkServer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ExampleHelper {

public static ZkServer startZkServer(String zkAddr) {
System.out.println("Start zookeeper at " + zkAddr + " in thread "
+ Thread.currentThread().getName());
private static final Logger LOG = LoggerFactory.getLogger(ExampleHelper.class);

public static ZkServer startZkServer(String zkAddr) {
String zkDir = zkAddr.replace(':', '_');
final String logDir = "/tmp/" + zkDir + "/logs";
final String dataDir = "/tmp/" + zkDir + "/dataDir";
try {
FileUtils.deleteDirectory(new File(dataDir));
FileUtils.deleteDirectory(new File(logDir));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
LOG.error("error while starting the ZK server", e);
}

IDefaultNameSpace defaultNameSpace = new IDefaultNameSpace() {
Expand All @@ -62,7 +61,7 @@ public void createDefaultNameSpace(ZkClient zkClient) {
public static void stopZkServer(ZkServer zkServer) {
if (zkServer != null) {
zkServer.shutdown();
System.out.println("Shut down zookeeper at port " + zkServer.getPort() + " in thread "
LOG.info("Shut down zookeeper at port " + zkServer.getPort() + " in thread "
+ Thread.currentThread().getName());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import org.apache.helix.model.Message;
import org.apache.helix.participant.statemachine.StateModel;
import org.apache.helix.participant.statemachine.StateModelFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class LeaderStandbyStateModelFactory extends StateModelFactory<StateModel> {
int _delay;
Expand Down Expand Up @@ -59,6 +61,9 @@ public void setInstanceName(String instanceName) {
}

public static class LeaderStandbyStateModel extends StateModel {

private static final Logger LOG = LoggerFactory.getLogger(LeaderStandbyStateModel.class);

int _transDelay = 0;
String partitionName;
String _instanceName = "";
Expand All @@ -81,35 +86,35 @@ public void setDelay(int delay) {
}

public void onBecomeLeaderFromStandby(Message message, NotificationContext context) {
System.out.println("LeaderStandbyStateModel.onBecomeLeaderFromStandby():" + _instanceName
LOG.info("LeaderStandbyStateModel.onBecomeLeaderFromStandby():" + _instanceName
+ " transitioning from " + message.getFromState() + " to " + message.getToState()
+ " for " + message.getResourceName() + " " + message.getPartitionName());
sleep();
}

public void onBecomeStandbyFromLeader(Message message, NotificationContext context) {
System.out.println("LeaderStandbyStateModel.onBecomeStandbyFromLeader():" + _instanceName
LOG.info("LeaderStandbyStateModel.onBecomeStandbyFromLeader():" + _instanceName
+ " transitioning from " + message.getFromState() + " to " + message.getToState()
+ " for " + message.getResourceName() + " " + message.getPartitionName());
sleep();
}

public void onBecomeStandbyFromOffline(Message message, NotificationContext context) {
System.out.println("LeaderStandbyStateModel.onBecomeStandbyFromOffline():" + _instanceName
LOG.info("LeaderStandbyStateModel.onBecomeStandbyFromOffline():" + _instanceName
+ " transitioning from " + message.getFromState() + " to " + message.getToState()
+ " for " + message.getResourceName() + " " + message.getPartitionName());
sleep();
}

public void onBecomeOfflineFromStandby(Message message, NotificationContext context) {
System.out.println("LeaderStandbyStateModel.onBecomeOfflineFromStandby():" + _instanceName
LOG.info("LeaderStandbyStateModel.onBecomeOfflineFromStandby():" + _instanceName
+ " transitioning from " + message.getFromState() + " to " + message.getToState()
+ " for " + message.getResourceName() + " " + message.getPartitionName());
sleep();
}

public void onBecomeDroppedFromOffline(Message message, NotificationContext context) {
System.out.println("LeaderStandbyStateModel.onBecomeDroppedFromOffline():" + _instanceName
LOG.info("LeaderStandbyStateModel.onBecomeDroppedFromOffline():" + _instanceName
+ " transitioning from " + message.getFromState() + " to " + message.getToState()
+ " for " + message.getResourceName() + " " + message.getPartitionName());
sleep();
Expand All @@ -120,7 +125,7 @@ private void sleep() {
try {
Thread.sleep(_transDelay);
} catch (Exception e) {
e.printStackTrace();
LOG.error("Interrupted while Thread.sleep", e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import org.apache.helix.model.Message;
import org.apache.helix.participant.statemachine.StateModel;
import org.apache.helix.participant.statemachine.StateModelFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings("rawtypes")
public class MasterSlaveStateModelFactory extends StateModelFactory<StateModel> {
Expand Down Expand Up @@ -57,6 +59,9 @@ public StateModel createNewStateModel(String resourceName, String partitionName)
}

public static class MasterSlaveStateModel extends StateModel {

private static final Logger LOG = LoggerFactory.getLogger(MasterSlaveStateModel.class);

int _transDelay = 0;
String partitionName;
String _instanceName = "";
Expand All @@ -78,7 +83,7 @@ public void setInstanceName(String instanceName) {
}

public void onBecomeSlaveFromOffline(Message message, NotificationContext context) {
System.out.println(_instanceName + " transitioning from " + message.getFromState() + " to "
LOG.info(_instanceName + " transitioning from " + message.getFromState() + " to "
+ message.getToState() + " for " + partitionName);
sleep();
}
Expand All @@ -87,35 +92,31 @@ private void sleep() {
try {
Thread.sleep(_transDelay);
} catch (Exception e) {
e.printStackTrace();
LOG.error("Interrupted while Thread.sleep", e);
}
}

public void onBecomeSlaveFromMaster(Message message, NotificationContext context) {
System.out.println(_instanceName + " transitioning from " + message.getFromState() + " to "
LOG.info(_instanceName + " transitioning from " + message.getFromState() + " to "
+ message.getToState() + " for " + partitionName);
sleep();

}

public void onBecomeMasterFromSlave(Message message, NotificationContext context) {
System.out.println(_instanceName + " transitioning from " + message.getFromState() + " to "
LOG.info(_instanceName + " transitioning from " + message.getFromState() + " to "
+ message.getToState() + " for " + partitionName);
sleep();

}

public void onBecomeOfflineFromSlave(Message message, NotificationContext context) {
System.out.println(_instanceName + " transitioning from " + message.getFromState() + " to "
LOG.info(_instanceName + " transitioning from " + message.getFromState() + " to "
+ message.getToState() + " for " + partitionName);
sleep();

}

public void onBecomeDroppedFromOffline(Message message, NotificationContext context) {
System.out.println(_instanceName + " Dropping partition " + partitionName);
LOG.info(_instanceName + " Dropping partition " + partitionName);
sleep();

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import org.apache.helix.model.Message;
import org.apache.helix.participant.statemachine.StateModel;
import org.apache.helix.participant.statemachine.StateModelFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class OnlineOfflineStateModelFactory extends StateModelFactory<StateModel> {
int _delay;
Expand Down Expand Up @@ -55,6 +57,9 @@ public StateModel createNewStateModel(String resourceName, String stateUnitKey)
}

public static class OnlineOfflineStateModel extends StateModel {

private static final Logger LOG = LoggerFactory.getLogger(OnlineOfflineStateModel.class);

int _transDelay = 0;
String _instanceName = "";

Expand All @@ -67,23 +72,23 @@ public void setInstanceName(String instanceName) {
}

public void onBecomeOnlineFromOffline(Message message, NotificationContext context) {
System.out.println(
LOG.info(
"OnlineOfflineStateModelFactory.onBecomeOnlineFromOffline():" + _instanceName
+ " transitioning from " + message.getFromState() + " to " + message.getToState()
+ " for " + message.getResourceName() + " " + message.getPartitionName());
sleep();
}

public void onBecomeOfflineFromOnline(Message message, NotificationContext context) {
System.out.println(
LOG.info(
"OnlineOfflineStateModelFactory.onBecomeOfflineFromOnline():" + _instanceName
+ " transitioning from " + message.getFromState() + " to " + message.getToState()
+ " for " + message.getResourceName() + " " + message.getPartitionName());
sleep();
}

public void onBecomeDroppedFromOffline(Message message, NotificationContext context) {
System.out.println(
LOG.info(
"OnlineOfflineStateModelFactory.onBecomeDroppedFromOffline():" + _instanceName
+ " transitioning from " + message.getFromState() + " to " + message.getToState()
+ " for " + message.getResourceName() + " " + message.getPartitionName());
Expand All @@ -94,7 +99,7 @@ private void sleep() {
try {
Thread.sleep(_transDelay);
} catch (Exception e) {
e.printStackTrace();
LOG.error("Interrupted while Thread.sleep", e);
}
}
}
Expand Down
Loading

0 comments on commit 45bab89

Please sign in to comment.