View source | Discuss this page | Page history | Printable version   
Toolbox
Main Page
Upload file
What links here
Recent changes
Help

PDF Books
Add page
Show collection (0 pages)
Collections help

Search

How the Purge Job Works

Introduction

SymmetricDS uses several tables to manage the synchronization between the Main and the Store Servers. Some of these tables are bound to grow indefinitely, that's why SymmetricDS provides a purge process to delete rows from these tables when possible.

Four of these tables (sym_data, sym_data_event, sym_outgoing_batch and sym_extract_request) are related to outgoing data, and sym_incoming_batch is related to incoming data.

How the Purge Job Works

There are two jobs in charge of the purge: OutgoingPurgeJob and IncomingPurgeJob. Both jobs makes use of the PurgeService to purge outgoing and incoming data respectively.

These jobs will only be invoked if the start.purge.job property is set to true. How often these jobs are invoked is determined by the job.purge.incoming.cron and job.purge.outgoing.cron properties. These properties are defined using chron expressions, so for instance if defined like this the purge incoming job and purge outgoing job would be executed every minute and every five minutes respectively:

job.purge.incoming.cron=0 * * * * *
job.purge.outgoing.cron=0 0/5 * * * *

The amount of purged records depend on several factors:

It is very important to note that SymmetricDS has logic in place to ensure that only the records that are no longer needed are purged. For instance, the only records from sym_outgoing_batch that are purged are those whose status is OK, that is, that have been synchronized in all target nodes. Only the rows from sym_data that belong to outgoing batches whose status is OK will be purged, etc.

Functional Test

This test was performed to ensure that the purge job works as expected:

  1. The purge properties were configured
  2. A Main Server and a Store Server were started, its synchronization working properly.
  3. A new unit of measure is created in the Main Server. Two rows are inserted in sym_data (the unit of measure and its translation), one row is inserted in sym_outgoing_batch.
  4. The synchronization takes place properyl and the sym_outgoing_batch state is set to OK. After a couple of minutes, as specified in the configuration, all three rows were deleted from the database.
  5. The Store Server was turned down.
  6. A new unit of measure is created in the Main Server
  7. The synchronization can't take place, so the entry in sym_outgoing_batch stays with the status NEW.
  8. The purge job is invoked several times but not the sym_outgoing_batch nor its related sym_data entries are deleted.
  9. The Store Server is started again.
  10. The synchronization takes place properyl and the sym_outgoing_batch state is set to OK. After a couple of minutes, as specified in the configuration, all three rows were deleted from the database.

Retrieved from "http://wiki.openbravo.com/wiki/How_the_Purge_Job_Works"

This page has been accessed 395 times. This page was last modified on 1 August 2016, at 13:21. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.