Skip to content

Commit

Permalink
0006126: Made it possible to tell a load-only node apart from an extr…
Browse files Browse the repository at this point in the history
…act-only node
  • Loading branch information
evan-miller-jumpmind committed Nov 27, 2023
1 parent d0e3cac commit 734aabf
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
import org.jumpmind.properties.TypedProperties;
import org.jumpmind.security.SecurityServiceFactory;
import org.jumpmind.security.SecurityServiceFactory.SecurityServiceType;
import org.jumpmind.symmetric.common.Constants;
import org.jumpmind.symmetric.common.ParameterConstants;
import org.jumpmind.symmetric.common.SystemConstants;
import org.jumpmind.symmetric.db.ISymmetricDialect;
Expand Down Expand Up @@ -158,13 +157,9 @@ public ClientSymmetricEngine(Properties properties, boolean registerEngine) {
}

protected final void setDeploymentSubTypeByProperties(Properties properties) {
if (properties != null) {
String loadOnly = properties.getProperty(ParameterConstants.NODE_LOAD_ONLY);
setDeploymentSubType(loadOnly != null && loadOnly.equals("true") ? Constants.DEPLOYMENT_SUB_TYPE_LOAD_ONLY : null);
boolean isLogBased = Boolean.valueOf(properties.getProperty(ParameterConstants.START_LOG_MINER_JOB, "false"));
if (isLogBased) {
setDeploymentSubType(Constants.DEPLOYMENT_SUB_TYPE_LOG_BASED);
}
String deploymentSubType = SymmetricUtils.getDeploymentSubType(properties);
if (deploymentSubType != null) {
setDeploymentSubType(deploymentSubType);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ private Constants() {
public static final String DEPLOYMENT_TYPE_CCLIENT = "cclient";
public static final String DEPLOYMENT_TYPE_REST = "rest";
public static final String DEPLOYMENT_SUB_TYPE_LOAD_ONLY = "load-only";
public static final String DEPLOYMENT_SUB_TYPE_EXTRACT_ONLY = "extract-only";
public static final String DEPLOYMENT_SUB_TYPE_LOG_BASED = "log-based";
/**
* Use this value for the router_id in {@link DataEvent} if the router is unknown.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public void heartbeat(Node me) {
|| (parameterService.getSyncUrl() != null && !parameterService.getSyncUrl().equalsIgnoreCase(me.getSyncUrl()))
|| !parameterService.getString(ParameterConstants.SCHEMA_VERSION, "").equals(me.getSchemaVersion())
|| (engine.getDeploymentType() != null && !engine.getDeploymentType().equals(me.getDeploymentType()))
|| (engine.getDeploymentSubType() != null && !engine.getDeploymentSubType().equals(me.getDeploymentSubType()))
|| !Version.version().equals(me.getSymmetricVersion())
|| (engine.getParameterService().isRegistrationServer() && !Version.version().equals(me.getConfigVersion()))
|| !symmetricDialect.getName().equals(me.getDatabaseType())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@

import org.apache.commons.lang3.StringUtils;
import org.jumpmind.symmetric.Version;
import org.jumpmind.symmetric.common.Constants;
import org.jumpmind.symmetric.common.ParameterConstants;
import org.jumpmind.symmetric.db.ISymmetricDialect;
import org.jumpmind.symmetric.service.IParameterService;
import org.jumpmind.symmetric.util.SymmetricUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -96,16 +96,7 @@ public Node(Properties properties) {
setExternalId(properties.getProperty(ParameterConstants.EXTERNAL_ID));
setSyncUrl(properties.getProperty(ParameterConstants.SYNC_URL));
setSchemaVersion(properties.getProperty(ParameterConstants.SCHEMA_VERSION));
String loadOnly = properties.getProperty(ParameterConstants.NODE_LOAD_ONLY);
String logBased = properties.getProperty(ParameterConstants.START_LOG_MINER_JOB);
String deploymentSubType = null;
if (loadOnly != null && loadOnly.equals("true")) {
deploymentSubType = Constants.DEPLOYMENT_SUB_TYPE_LOAD_ONLY;
}
if (logBased != null && logBased.equals("true")) {
deploymentSubType = Constants.DEPLOYMENT_SUB_TYPE_LOG_BASED;
}
this.deploymentSubType = deploymentSubType;
this.deploymentSubType = SymmetricUtils.getDeploymentSubType(properties);
}

public Node(IParameterService parameterService, ISymmetricDialect symmetricDialect, String databaseName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.apache.commons.lang3.StringUtils;
import org.jumpmind.db.model.Transaction;
import org.jumpmind.symmetric.Version;
import org.jumpmind.symmetric.common.Constants;
import org.jumpmind.symmetric.common.ParameterConstants;
import org.jumpmind.symmetric.db.ISymmetricDialect;
import org.jumpmind.symmetric.model.Node;
Expand Down Expand Up @@ -205,4 +206,23 @@ && filterTransactions(blockingTransaction, transactionMap, filteredTransactions,
}
return false;
}

public static String getDeploymentSubType(Properties properties) {
if (properties != null) {
boolean isLoadOnly = Boolean.valueOf(properties.getProperty(ParameterConstants.NODE_LOAD_ONLY, "false"));
if (isLoadOnly) {
String dbUrl = properties.getProperty("db.url");
if (dbUrl != null && dbUrl.startsWith("jdbc:h2:file:") && dbUrl.contains("extract-only")) {
return Constants.DEPLOYMENT_SUB_TYPE_EXTRACT_ONLY;
} else {
return Constants.DEPLOYMENT_SUB_TYPE_LOAD_ONLY;
}
}
boolean isLogBased = Boolean.valueOf(properties.getProperty(ParameterConstants.START_LOG_MINER_JOB, "false"));
if (isLogBased) {
return Constants.DEPLOYMENT_SUB_TYPE_LOG_BASED;
}
}
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -346,16 +346,7 @@ public ISymmetricEngine create(String propertiesFile) {
validateRequiredProperties(properties);
engine = new ServerSymmetricEngine(file, springContext, this);
engine.setDeploymentType(deploymentType);
String loadOnly = properties.getProperty(ParameterConstants.NODE_LOAD_ONLY);
String logBased = properties.getProperty(ParameterConstants.START_LOG_MINER_JOB, "false");
String deploymentSubType = null;
if (loadOnly != null && loadOnly.equals("true")) {
deploymentSubType = Constants.DEPLOYMENT_SUB_TYPE_LOAD_ONLY;
}
if (logBased != null && logBased.equals("true")) {
deploymentSubType = Constants.DEPLOYMENT_SUB_TYPE_LOG_BASED;
}
engine.setDeploymentSubType(deploymentSubType);
engine.setDeploymentSubType(SymmetricUtils.getDeploymentSubType(properties));
synchronized (this) {
if (!engines.containsKey(engine.getEngineName())) {
engines.put(engine.getEngineName(), engine);
Expand Down

0 comments on commit 734aabf

Please sign in to comment.