Skip to content

Commit

Permalink
Merge branch '3.9' of https://github.com/JumpMind/symmetric-ds.git in…
Browse files Browse the repository at this point in the history
…to 3.9
  • Loading branch information
chenson42 committed Dec 12, 2017
2 parents e11f851 + 6b1c3f9 commit b3ef963
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
Expand Up @@ -128,7 +128,8 @@ protected void checkSymDbOwnership() {
if (!isClusteringEnabled()) {
List<NodeHost> nodeHosts = nodeService.findNodeHosts(nodeService.findIdentityNodeId());
for (NodeHost nodeHost : nodeHosts) {
if (!StringUtils.equals(instanceId, nodeHost.getInstanceId())) {
if (nodeHost.getInstanceId() != null
&& !StringUtils.equals(instanceId, nodeHost.getInstanceId())) {
String msg = String.format("*** Node '%s' failed to claim exclusive ownership of the SymmetricDS database. *** "
+ "This is instance id '%s' but instance id '%s' is already present in sym_node_host. This is caused when 2 copies of SymmetricDS "
+ "are pointed at the same database, but not clustered. If you are configuring a cluster, set cluster.lock.enabled=true and restart. "
Expand Down
Expand Up @@ -192,11 +192,11 @@ public void deleteNodeHost(String nodeId) {

public void updateNodeHost(NodeHost nodeHost) {

Object[] params = new Object[] { nodeHost.getIpAddress(), nodeHost.getHostName(), nodeHost.getOsUser(), nodeHost.getOsName(), nodeHost.getOsArch(),
Object[] params = new Object[] { nodeHost.getIpAddress(), nodeHost.getInstanceId(), nodeHost.getOsUser(), nodeHost.getOsName(), nodeHost.getOsArch(),
nodeHost.getOsVersion(), nodeHost.getAvailableProcessors(), nodeHost.getFreeMemoryBytes(), nodeHost.getTotalMemoryBytes(),
nodeHost.getMaxMemoryBytes(), nodeHost.getJavaVersion(), nodeHost.getJavaVendor(), nodeHost.getJdbcVersion(),
nodeHost.getSymmetricVersion(), nodeHost.getTimezoneOffset(), nodeHost.getHeartbeatTime(), nodeHost.getLastRestartTime(),
nodeHost.getNodeId(), nodeHost.getInstanceId()};
nodeHost.getNodeId(), nodeHost.getHostName()};

if (sqlTemplate.update(getSql("updateNodeHostSql"), params) <= 0) {
sqlTemplate.update(getSql("insertNodeHostSql"), params);
Expand Down
Expand Up @@ -169,15 +169,15 @@ public NodeServiceSqlMap(IDatabasePlatform platform, Map<String, String> replace

putSql("insertNodeHostSql",
"insert into $(node_host) "
+ " (ip_address, host_name, os_user, os_name, os_arch, os_version, available_processors, free_memory_bytes, total_memory_bytes, max_memory_bytes, java_version, java_vendor, jdbc_version, symmetric_version, timezone_offset, heartbeat_time, last_restart_time, create_time, node_id, instance_id)"
+ " (ip_address, instance_id, os_user, os_name, os_arch, os_version, available_processors, free_memory_bytes, total_memory_bytes, max_memory_bytes, java_version, java_vendor, jdbc_version, symmetric_version, timezone_offset, heartbeat_time, last_restart_time, create_time, node_id, host_name)"
+ " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, current_timestamp,?,?)");

putSql("updateNodeHostSql",
""
+ "update $(node_host) set "
+ " ip_address=?, host_name=?, os_user=?, os_name=?, os_arch=?, os_version=?, available_processors=?, free_memory_bytes=?, "
+ " ip_address=?, instance_id=?, os_user=?, os_name=?, os_arch=?, os_version=?, available_processors=?, free_memory_bytes=?, "
+ " total_memory_bytes=?, max_memory_bytes=?, java_version=?, java_vendor=?, jdbc_version=?, symmetric_version=?, timezone_offset=?, heartbeat_time=?, "
+ " last_restart_time=? where node_id=? and instance_id=? ");
+ " last_restart_time=? where node_id=? and host_name=? ");

putSql("findNodeHeartbeatsSql",
"select h.node_id, h.heartbeat_time, h.timezone_offset from $(node_host) h inner join $(node) n on h.node_id=n.node_id"
Expand Down
5 changes: 3 additions & 2 deletions symmetric-core/src/main/resources/symmetric-schema.xml
Expand Up @@ -356,19 +356,20 @@
<column name="node_id" type="VARCHAR" size="50" required="true" primaryKey="true" description="A unique identifier for a node." />
<column name="node_group_id" type="VARCHAR" size="50" required="true" description="The node group that this node belongs to, such as 'store'." />
<column name="external_id" type="VARCHAR" size="255" required="true" description="A domain-specific identifier for context within the local system. For example, the retail store number. "/>
<column name="heartbeat_time" type="TIMESTAMP" description="Deprecated. Use node_host.heartbeat_time instead." />
<column name="timezone_offset" type="VARCHAR" size="6" description="Deprecated. Use node_host.timezone_offset instead." />
<column name="sync_enabled" type="BOOLEANINT" size="1" default="0" description="Indicates whether this node should be sent synchronization. Disabled nodes are ignored by the triggers, so no entries are made in data_event for the node."/>
<column name="sync_url" type="VARCHAR" size="255" description="The URL to contact the node for synchronization." />
<column name="schema_version" type="VARCHAR" size="50" description="The version of the database schema this node manages. Useful for specifying synchronization by version. "/>
<column name="symmetric_version" type="VARCHAR" size="50" description="The version of SymmetricDS running at this node." />
<column name="config_version" type="VARCHAR" size="50" description="The version of configuration running at this node." />
<column name="database_type" type="VARCHAR" size="50" description="The database product name at this node as reported by JDBC." />
<column name="database_version" type="VARCHAR" size="50" description="The database product version at this node as reported by JDBC." />
<column name="heartbeat_time" type="TIMESTAMP" description="Deprecated. Use node_host.heartbeat_time instead." />
<column name="timezone_offset" type="VARCHAR" size="6" description="Deprecated. Use node_host.timezone_offset instead." />
<column name="batch_to_send_count" type="INTEGER" default="0" description="The number of outgoing batches that have not yet been sent. This field is updated as part of the heartbeat job if the heartbeat.update.node.with.batch.status property is set to true." />
<column name="batch_in_error_count" type="INTEGER" default="0" description="The number of outgoing batches that are in error at this node. This field is updated as part of the heartbeat job if the heartbeat.update.node.with.batch.status property is set to true." />
<column name="created_at_node_id" type="VARCHAR" size="50" description="The node_id of the node where this node was created. This is typically filled automatically with the node_id found in node_identity where registration was opened for the node. " />
<column name="deployment_type" type="VARCHAR" size="50" description="An indicator as to the type of SymmetricDS software that is running. Possible values are, but not limited to: engine, standalone, war, professional, mobile" />
<column name="deployment_sub_type" type="VARCHAR" size="50" description="An indicator as to the deployment sub type of the node. Possible values are, but not limited to: load-only" />
</table>

<table name="node_communication" description="This table is used to coordinate communication with other nodes.">
Expand Down
Expand Up @@ -310,7 +310,7 @@ public SymmetricWebServer start(int httpPort, int securePort, int httpJmxPort, M

protected void printAsciiArt() {
try {
log.info("\n{}", IOUtils.toString(Thread.currentThread().getContextClassLoader().getResource("symmetricds.asciiart")));
log.info("SymmetricWebServer START\r\n{}", IOUtils.toString(Thread.currentThread().getContextClassLoader().getResource("symmetricds.asciiart")));
} catch (Exception ex) {
// ignored.
}
Expand Down

0 comments on commit b3ef963

Please sign in to comment.