Skip to content

Commit

Permalink
fix: downgrade migration testing tool errors to warnings (#10556)
Browse files Browse the repository at this point in the history
Signed-off-by: Cody Littley <cody@swirldslabs.com>
  • Loading branch information
cody-littley committed Dec 19, 2023
1 parent 7a58a17 commit e2ef0f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.swirlds.demo.migration;

import static com.swirlds.base.units.UnitConstants.NANOSECONDS_TO_SECONDS;
import static com.swirlds.logging.legacy.LogMarker.STARTUP;

import com.swirlds.common.platform.NodeId;
import com.swirlds.fcqueue.FCQueueStatistics;
Expand All @@ -31,8 +32,6 @@
import java.security.SignatureException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.Marker;
import org.apache.logging.log4j.MarkerManager;

/**
* An application designed for testing migration from version to version.
Expand All @@ -43,8 +42,6 @@ public class MigrationTestingToolMain implements SwirldMain {

private static final Logger logger = LogManager.getLogger(MigrationTestingToolMain.class);

static final Marker MARKER = MarkerManager.getMarker("MIGRATION");

private long seed;
private int maximumTransactionsPerNode;
private int transactionsCreated;
Expand All @@ -71,7 +68,7 @@ public void init(final Platform platform, final NodeId selfId) {
this.platform = platform;

final String[] parameters = ParameterProvider.getInstance().getParameters();
logger.info(MARKER, "Parsing arguments {}", (Object) parameters);
logger.info(STARTUP.getMarker(), "Parsing arguments {}", (Object) parameters);
seed = Long.parseLong(parameters[0]) + selfId.id();
maximumTransactionsPerNode = Integer.parseInt(parameters[1]);

Expand All @@ -89,7 +86,7 @@ public void init(final Platform platform, final NodeId selfId) {
public void run() {
try {
logger.info(
MARKER,
STARTUP.getMarker(),
"MigrationTestingApp started handling {} transactions with seed {}",
maximumTransactionsPerNode,
seed);
Expand All @@ -107,7 +104,8 @@ public void run() {
}

logger.info(
MARKER, () -> new ApplicationFinishedPayload("MigrationTestingApp finished handling transactions"));
STARTUP.getMarker(),
() -> new ApplicationFinishedPayload("MigrationTestingApp finished handling transactions"));
} catch (final Exception ex) {
throw new RuntimeException(ex);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@

package com.swirlds.demo.migration;

import static com.swirlds.demo.migration.MigrationTestingToolMain.MARKER;
import static com.swirlds.demo.migration.MigrationTestingToolMain.PREVIOUS_SOFTWARE_VERSION;
import static com.swirlds.logging.legacy.LogMarker.EXCEPTION;
import static com.swirlds.logging.legacy.LogMarker.STARTUP;

import com.swirlds.common.crypto.DigestType;
import com.swirlds.common.io.streams.SerializableDataInputStream;
Expand Down Expand Up @@ -231,28 +230,28 @@ public void init(

final MerkleMap<AccountID, MapValue> merkleMap = getMerkleMap();
if (merkleMap != null) {
logger.info(MARKER, "MerkleMap initialized with {} values", merkleMap.size());
logger.info(STARTUP.getMarker(), "MerkleMap initialized with {} values", merkleMap.size());
}
final VirtualMap<?, ?> virtualMap = getVirtualMap();
if (virtualMap != null) {
logger.info(MARKER, "VirtualMap initialized with {} values", virtualMap.size());
logger.info(STARTUP.getMarker(), "VirtualMap initialized with {} values", virtualMap.size());
}
selfId = platform.getSelfId();

if (trigger == InitTrigger.GENESIS) {
logger.error(EXCEPTION.getMarker(), "InitTrigger was {} when expecting RESTART or RECONNECT", trigger);
logger.warn(STARTUP.getMarker(), "InitTrigger was {} when expecting RESTART or RECONNECT", trigger);
}

if (previousSoftwareVersion == null || previousSoftwareVersion.compareTo(PREVIOUS_SOFTWARE_VERSION) != 0) {
logger.error(
EXCEPTION.getMarker(),
logger.warn(
STARTUP.getMarker(),
"previousSoftwareVersion was {} when expecting it to be {}",
previousSoftwareVersion,
PREVIOUS_SOFTWARE_VERSION);
}

if (trigger == InitTrigger.GENESIS) {
logger.info(MARKER, "Doing genesis initialization");
logger.info(STARTUP.getMarker(), "Doing genesis initialization");
genesisInit(platform);
}
}
Expand Down

0 comments on commit e2ef0f6

Please sign in to comment.