Monitoring and Managing Synchronization Errors
In an synchronized multi-tier architecture that allows database modifications on all ends, synchronization errors are bound to happen.
This document describes the tools available to monitor the synchronization errors, as well as the processes available to manage them.
Managing Errors When a Store Server Is Registered
The first time a store server is started, it will try to register itself in the central server. Data will not be synchronized between the central and the store server until the store server is registered.
There are two ways to know if the a store server has been registered:
- In the Registered Server window in the central server, or
- Running this query in the central server
SELECT node_id FROM sym_node;
If the store server is registered, then its mobile server key will be included in the list returned by the query.
These are the most common causes of a store server not registering properly:
The store server has not been explicitely given registration access
In order to be allowed registration, the Can Be Registered flag of the store server must be checked in the Mobile Server window of the Central Server. If it is not checked, the store server will not be allowed registration and the following messages will be shown in its log:
50151 [main] INFO org.jumpmind.symmetric.service.impl.RegistrationService - This node is unregistered. It will attempt to register using the registration.url 50155 [main] INFO org.jumpmind.symmetric.service.impl.DataLoaderService - Using registration URL of http://localhost:8070/openbravo/org.openbravo.replication.symmetricds/sync/registration?nodeGroupId=StoreServer&externalId=Store1&syncURL=http%3A%2F%2Flocalhost%3A8090%2Fopenbravo-store%2Forg.openbravo.replication.symmetricds%2Fsync&schemaVersion=%3F&databaseType=PostgreSQL&databaseVersion=9.4&symmetricVersion=development&hostName=por0942&ipAddress=192.168.1.104 50167 [main] WARN org.jumpmind.symmetric.service.impl.DataLoaderService - Registration attempt failed. Registration was not open
These messages would be shown in the log of the central server:
123066 [http-8070-2] WARN org.jumpmind.symmetric.service.impl.RegistrationService - Registration not allowed for StoreServer:Store1:? because The server with search key Store1 was not allowed to register, its registration has not been opened in the Mobile Servers window 123067 [http-8070-2] WARN org.jumpmind.symmetric.web.RegistrationUriHandler - StoreServer:Store1:? was not allowed to register.
To fix it, just open the ERP in the central server, open the Mobile Server window, select the entry that belongs to the store server that is trying to register and check the Can Be Registered flag. The next time the store server tries to register (for instance when its tomcat is restarted), it will be allowed to register.
The url of the servers are not properly set
If the URLs of the servers are not properly set in the Mobile Server window, the store server will not be able to register in the store servers. For instance, if the URL of the central server were not properly defined, an error like this would be shown in the log of the store server when it tries to register:
19511 [main] INFO org.jumpmind.symmetric.service.impl.RegistrationService - This node is unregistered. It will attempt to register using the registration.url 19526 [main] INFO org.jumpmind.symmetric.service.impl.DataLoaderService - Using registration URL of WRONG_URL/org.openbravo.replication.symmetricds/sync/registration?nodeGroupId=StoreServer&externalId=Store1&syncURL=http%3A%2F%2Flocalhost%3A8090%2Fopenbravo-store%2Forg.openbravo.replication.symmetricds%2Fsync&schemaVersion=%3F&databaseType=PostgreSQL&databaseVersion=9.4&symmetricVersion=development&hostName=por0942&ipAddress=192.168.1.104 22671 [main] WARN org.jumpmind.symmetric.service.impl.DataLoaderService - Could not connect to the transport because the host was unknown: WRONG_URL
If the URLs where not properly defined only in the store server, fix them and restart tomcat in the store server. If they where not properly defined in the central server, the current recommendation is to uninstall symmetricds from both the servers, fix the URLs, and start from scratch.
The Synchronization Error window
The Synchronization Error window lists all the current outgoing batches that have not been properly imported in the store servers due to synchronization errors.
The following information is shown per synchronization error:
- Node ID: The mobile.server.key of the store server that could not import the batch
- Channel: The channel used to synchronize the data
- DB Table Name: The table where the data couldn't be imported
- Event Type: The event type that triggered the synchronization
- SQL Error Message: The SQL error message obtained when trying to import the data in the store server
- New Data: The data that could not be imported in the store server
- Old Data: The contents of the inserted/updated/deleted row before the modification that triggered the synchronization event.
The window contains a subtab called Data Entries in Batch that lists all the data entries included in the outgoing batch that could not be imported. This information contained in this tab can be useful to decide how to manage the synchronization error.
How to Manage Synchronization Errors
The Synchronization Error message offers two process to manage synchronization errors:
Ignore Whole Batch
This process flags the outgoing batch as 'Completed' in the central server, so it will no longer be sent to the store server. Note that none of the data entries contained in the batch (shown in the Data Entries in Batch subtab) will be synchronized in the store server. If the whole batch can't be ignored, the following process may be useful:
Ignore Data in Batch
This process will ignore only the data entry that caused the synchronized error. The outgoing batch will be rebuilt with the remaining data entries and sent to the store server.
Usually ignoring the problem (may it be the whole batch or just part of it) does not address its root cause. Most of the times the synchronization errors are caused by problems in the configuration of the segmentation. Try to understand what happened, see why the given record could not be synchronized in the target database (the table name and the error message should come in handy). If the problem is caused by a segmentation error, fix it and then uninstall SymmetricDS from both servers and start from scratch.