Skip to content

Commit

Permalink
Added better logging to help debug a misconfigured system.
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Apr 23, 2008
1 parent 53fbce4 commit 5fca130
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 13 deletions.
Expand Up @@ -249,8 +249,10 @@ public void register() {
}
}
}
} else {
} else if (runtimeConfiguration.getExternalId().equals(node.getExternalId()) && runtimeConfiguration.getNodeGroupId().equals(node.getNodeGroupId())) {
heartbeat();
} else {
throw new IllegalStateException("The configured state does not match recorded database state. The recorded external id is " + node.getExternalId() + " while the configured external id is " + runtimeConfiguration.getExternalId() + ". The recorded node group id is " + node.getNodeGroupId() + " while the configured node group id is " + runtimeConfiguration.getNodeGroupId());
}
}

Expand Down
Expand Up @@ -46,14 +46,15 @@ public class PullService implements IPullService {

public void pullData() {
List<Node> nodes = nodeService.findNodesToPull();
if (nodes != null && nodes.size() > 0) {
logger.info("Pull requested");
if (nodes != null && nodes.size() > 0) {
for (Node node : nodes) {
String nodeName = " for " + node.getNodeGroupId() + "." + node.getNodeId();
try {
logger.info("Pull requested" + nodeName);
if (dataLoaderService.loadData(node, nodeService.findIdentity())) {
logger.info("Pull data received");
logger.info("Pull data received" + nodeName);
}
logger.info("Pull completed");
logger.info("Pull completed" + nodeName);
} catch (ConnectException ex) {
logger.warn(ErrorConstants.COULD_NOT_CONNECT_TO_TRANSPORT + " url=" + node.getSyncURL());
} catch (ConnectionRejectedException ex) {
Expand Down
Expand Up @@ -30,19 +30,40 @@
public class IncomingManagementService {

IStatisticManager statisticManager;


// INCOMING_TRANSPORT_ERROR_COUNT,
// INCOMING_TRANSPORT_CONNECT_ERROR_COUNT,
// INCOMING_TRANSPORT_REJECTED_COUNT,
// INCOMING_DATABASE_ERROR_COUNT,
// INCOMING_OTHER_ERROR_COUNT,
// INCOMING_MS_PER_ROW,
// INCOMING_BATCH_COUNT,
// INCOMING_SKIP_BATCH_COUNT,

public void setStatisticManager(IStatisticManager statisticManager) {
this.statisticManager = statisticManager;
}

@ManagedAttribute(description = "Get the number of milliseconds the system is currently taking to commit a data row coming in from another node since the last time statistics were flushed")
public BigDecimal getDatabaseMsPerRowSinceLastFlush() {
return this.statisticManager.getStatistic(StatisticName.INCOMING_MS_PER_ROW).getAverageValue();
}

@ManagedAttribute(description = "Get the number of milliseconds the system is currently taking to commit a data row coming in from another node for the lifetime of the server")
public BigDecimal getDatabaseMsPerRowForLifetime() {
return this.statisticManager.getStatistic(StatisticName.INCOMING_MS_PER_ROW).getLifetimeAverageValue();
}

public BigDecimal getDatabaseMsPerRowForServerLifetime() {
return this.statisticManager.getStatistic(StatisticName.INCOMING_MS_PER_ROW)
.getLifetimeAverageValue();
}

@ManagedAttribute(description = "Get the number of errors that occurred during transport since the last flush")
public BigDecimal getTransportErrorCountSinceLastFlush() {
return this.statisticManager.getStatistic(StatisticName.INCOMING_TRANSPORT_ERROR_COUNT).getTotal();
}

@ManagedAttribute(description = "Get the number of errors that occurred during transport for the lifetime of the server")
public BigDecimal getTransportErrorCountForServerLifetime() {
return this.statisticManager.getStatistic(StatisticName.INCOMING_TRANSPORT_ERROR_COUNT)
.getLifetimeTotal();
}

}
Expand Up @@ -38,6 +38,7 @@
import org.jumpmind.symmetric.config.IRuntimeConfig;
import org.jumpmind.symmetric.model.Node;
import org.jumpmind.symmetric.model.IncomingBatchHistory;
import org.jumpmind.symmetric.model.NodeSecurity;
import org.jumpmind.symmetric.service.INodeService;
import org.jumpmind.symmetric.transport.AbstractTransportManager;
import org.jumpmind.symmetric.transport.IIncomingTransport;
Expand Down Expand Up @@ -173,7 +174,11 @@ private String addSecurityToken(String base, String connector) {
sb.append(connector);
sb.append(WebConstants.SECURITY_TOKEN);
sb.append("=");
String securityToken = nodeService.findNodeSecurity(nodeId).getPassword();
NodeSecurity security = nodeService.findNodeSecurity(nodeId);
String securityToken = "none";
if (security != null) {
securityToken = security.getPassword();
}
sb.append(securityToken);
return sb.toString();
}
Expand Down

0 comments on commit 5fca130

Please sign in to comment.