Reputation: 3843
I need to implement database synchronisation in a Javaapplication and I started to use SymmetricDS which is a mature tool and allows to synchronise differents DBMS.
I played a little with SymmetricDS but I can't achieve my needs, so I have a few questions about this tool.
First I will expose the context of the application :
I developed a desktop application written in Java (JavaFX 2.0 + H2 database + Hibernate), I'm fairly new with Java but I managed to build a MVC architecture and finally finish a stand alone version of my application.
Now, I have to synchronize between multiple instances of the application installed on different computers.
I have a "master" MySQL database running on an external server, which also run SymmetricDS as "master" engine.
The applications uses H2 Database and ClientSymmetricEngine.
And I need to synchronize all the data between clients.
I managed to set up a more or less functional system using SymmetricDS but there are some sticking points:
Is there a way to simply implement the "last update wins" strategy instead of the "last sync wins" used by default ?
Is there a more complete documentation or step-by-step guide to embed SymmetricDS in an existing application ?
How I can extend symmetrics pull and push jobs without using Spring Framework (i need to freeze the application during synchronisation) ?
What happens if I purge by myself the tables :
DATA
DATA_EVENT
OUTGOING_BATCH
INCOMING_BATCH
DATA_GAP
NODE_HOST_STATS
NODE_HOST_CHANNEL_STATS
NODE_HOST_JOB_STATS
after each a success push/pull ? This table grows quickly after a few minutes even if there is no changes to sync and this makes my application slow.
Thx for reading.
JBRTRND
Upvotes: 4
Views: 1185
Reputation: 64632
Is there a way to simply implement the "last update wins" strategy instead of the "last sync wins" used by default?
Yes, there is:
NEWER_WINS: Indicates that when a conflict is detected by USE_TIMESTAMP or USE_VERSION that the either the source or the target will win based on the which side has the newer timestamp or higher version number. The resolve_row_only column controls whether the entire batch should be ignore or just the row in conflict.
You'll have to use USE_TIMESTAMP or USE_VERSION conflict detection and then NEWER_WINS conflict resolution strategy.
Is there a more complete documentation or step-by-step guide to embed SymmetricDS in an existing application?
No, there is not. You'll have to figure it on your own or even better use the standalone server. Not only that you wont need to waste time integrating it within your app but future updates will be trivial. Just download the new version and replace the old.
How I can extend symmetrics pull and push jobs without using Spring Framework (i need to freeze the application during synchronisation)?
SymmetricDS is written using Spring so it will be quite hard extending using something else without a big rewrite. If you use the standalone server then there's no need to extend it avoiding Spring.
What happens if I purge by myself the tables: DATA DATA_EVENT OUTGOING_BATCH INCOMING_BATCH DATA_GAP NODE_HOST_STATS NODE_HOST_CHANNEL_STATS NODE_HOST_JOB_STATS after each a success push/pull ? This table grows quickly after a few minutes even if there is no changes to sync and this makes my application slow.
Don't purge on your own, just decrease the period of the purging job and decrease the period of survival of successfully synced code as explained here: http://www.symmetricds.org/doc/3.6/user-guide/html-single/user-guide.html#purge-job
Upvotes: 5