2

I am trying to transfer changed data to FTP server using SymmetricDS. And, i am able to transfer it successfully. The CSV file thus generated contains changed ROW_DATA i.e In case of 'UPDATE' event, a row with updated values is there and for an 'INSERT' event, there is a row with all new values. Here are few points which I am wondering about:-

  1. How to distinguish between an 'UPDATED' row and 'INSERTED' row in CSV file?
  2. Also, for a 'DELETE' event, there was no corresponding row in the CSV file. So, how to fetch the rows which are deleted?

Can anyone please help me out on this one.

Boris Pavlović
  • 63,078
  • 28
  • 122
  • 148
Hemant
  • 179
  • 4

1 Answers1

0
  1. If there's a row OLD_DATA then the operation is update, otherwise the operation is insert. Do not forget that on the target side symmetricDs could fallback to an update if there's already a row with the same primary key even though the OLD_DATA is empty, i.e on the source node there was an insert and vice versa.

  2. Are the ON_DELETE triggers declare at all? The easiest is to check a list of defined triggers in the db and find out if ON_DELETE are present. The other way is to delete a row, commit and then select * from sym_data order by data_id desc verifying that delete data has been captured on delete.

Boris Pavlović
  • 63,078
  • 28
  • 122
  • 148
  • Hi Boris, Thanks for the response. I agree with you on above points. However, we will need to manually fire a query in the DB to infer that. But my requirement is to identify through CSV entries itself. So, Is there a way by which we can configure SymmetricDS to send a flag in CSV file with every row, where we can identify which one is the 'UPDATED' or 'INSERTED' row?. – Hemant May 12 '15 at 10:35
  • Also, for 'DELETE' event I am able to perform online synchronization of data. By this I mean that, If I delete a row in the source node, it does get deleted in the target node also. I think from this I can deduce that 'ON_DELETE' triggers are declared and are working fine. But for a 'DELETE' event, I am not able to see any row in the CSV file. So Is there a way we can configure SymmetricDS to send 'DELETED' row in CSV file with a flag indicating it as a 'DELETED' row? – Hemant May 12 '15 at 10:36
  • There must be an information related to the `DELETE` event in the CSV file sent from the source to the target. Take a look at the `sym_data` table and there you'll find what has been captured by the `on_delete` trigger. This data is then routed and pair of rows of `sym_data_event` and `sym_outgoing_batch` are inserted per source that is synced. – Boris Pavlović May 12 '15 at 14:19