Skip to content

Commit

Permalink
0001191: Add heartbeat.update.node.with.batch.status property to cont…
Browse files Browse the repository at this point in the history
…rol if batch stats are updated in sym_node. Default: false.

Contains some file sync parameters as well.
  • Loading branch information
chenson42 committed Apr 26, 2013
1 parent 20eac4a commit 2d6f7bb
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
Expand Up @@ -195,6 +195,7 @@ private ParameterConstants() {
public final static String OFFLINE_NODE_DETECTION_PERIOD_MINUTES = "offline.node.detection.period.minutes";
public final static String HEARTBEAT_SYNC_ON_PUSH_PERIOD_SEC = "heartbeat.sync.on.push.period.sec";
public final static String HEARTBEAT_SYNC_ON_STARTUP = "heartbeat.sync.on.startup";
public final static String HEARTBEAT_UPDATE_NODE_WITH_BATCH_STATUS = "heartbeat.update.node.with.batch.status";

public final static String HEARTBEAT_ENABLED = "heartbeat.sync.on.push.enabled";

Expand All @@ -216,6 +217,8 @@ private ParameterConstants() {

public final static String SYNCHRONIZE_ALL_JOBS = "jobs.synchronized.enable";

public final static String FILE_SYNC_ENABLE = "file.sync.enable";

public static Map<String, ParameterMetaData> getParameterMetaData() {
return parameterMetaData;
}
Expand Down
Expand Up @@ -48,9 +48,13 @@ public void heartbeat(Node me) {
IParameterService parameterService = engine.getParameterService();
if (parameterService.is(ParameterConstants.HEARTBEAT_ENABLED)) {
ISymmetricDialect symmetricDialect = engine.getSymmetricDialect();
int outgoingErrorCount = engine.getOutgoingBatchService().countOutgoingBatchesInError();
int outgoingUnsentCount = 0;
outgoingUnsentCount = engine.getOutgoingBatchService().countOutgoingBatchesUnsent();
boolean updateWithBatchStatus = parameterService.is(ParameterConstants.HEARTBEAT_UPDATE_NODE_WITH_BATCH_STATUS, false);
int outgoingErrorCount = -1;
int outgoingUnsentCount = -1;
if (updateWithBatchStatus) {
outgoingUnsentCount = engine.getOutgoingBatchService().countOutgoingBatchesUnsent();
outgoingErrorCount = engine.getOutgoingBatchService().countOutgoingBatchesInError();
}
if (!parameterService.getExternalId().equals(me.getExternalId())
|| !parameterService.getNodeGroupId().equals(me.getNodeGroupId())
|| (parameterService.getSyncUrl() != null && !parameterService.getSyncUrl().equals(me.getSyncUrl()))
Expand Down
16 changes: 15 additions & 1 deletion symmetric-core/src/main/resources/symmetric-default.properties
Expand Up @@ -896,8 +896,16 @@ heartbeat.sync.on.push.period.sec=0
# the heartbeat always happened at startup.
# DatabaseOverridable: true
# Tags: other
# Type: boolean
heartbeat.sync.on.startup=false

# When this is set to true, SymmetricDS will update fields in the sym_node table that indicate the
# number of outstanding errors and/or batches it has pending
# DatabaseOverridable: true
# Tags: other
# Type: boolean
heartbeat.update.node.with.batch.status=false

# This is the number of minutes that a node has been offline before taking action
# A value of -1 (or any negative value) disables the feature.
# DatabaseOverridable: true
Expand Down Expand Up @@ -972,4 +980,10 @@ server.log.file=../logs/symmetric.log
# DatabaseOverridable: true
# Tags: general
# Type: boolean
rest.api.enable=false
rest.api.enable=false

# Enables File Synchronization capabilities
#
# Tags: filesync
# Type: boolean
file.sync.enable=true

0 comments on commit 2d6f7bb

Please sign in to comment.