OpenLogReplicator – Delete row piece (OP 11.3) and Truncate table (OP 24.1)

The OpenLogReplicator has been a new release 0.0.8 with new functionality:

  • Added rowid field to JSON (Kafka target)
  • Support for OP code 11.3 – Delete Row Piece
  • Support for OP code 24.1 – DDL: Truncate table (only Kafka target)

Here is an example of usage. Let’s create a table:

CREATE TABLE SYSTEM.ADAM3(
  A NUMERIC
);

Next add to the CFG file in the tables section:

{"table": "SYSTEM.ADAM3"}

Next run OpenLogReplicator and execute some SQL:

INSERT INTO SYSTEM.ADAM3 VALUES(100);
COMMIT;
TRUNCATE TABLE SYSTEM.ADAM3;
INSERT INTO SYSTEM.ADAM3 VALUES(200);
COMMIT;
DELETE FROM SYSTEM.ADAM3;
COMMIT;

The following JSON message is sent to Kafka:

{"scn": "8849551", dml: [{"operation":"insert", "table": "SYSTEM.ADAM3", "rowid": "AAAIDRAAFAAAACFAAA", "after": {"A": "100"}}]}
 {"scn": "8849568", dml: [{"operation":"truncate", "table": "SYSTEM.ADAM3"}]}
 {"scn": "8849573", dml: [{"operation":"insert", "table": "SYSTEM.ADAM3", "rowid": "AAAIDSAAFAAAACFAAA", "after": {"A": "200"}}]}
 {"scn": "8849580", dml: [{"operation":"delete", "table": "SYSTEM.ADAM3", "rowid": "AAAIDSAAFAAAACFAAA", "before": {"A": "200"}}]}

I have just adjusted the formatting to make the JSON more readable. This is exactly what is expected. This functionality is available with the latest build (0.0.8). Stay tuned for next OP codes to be implemented too.

PS. I know, that the JSON attribute is named dml even though truncate is actually a ddl operation in Oracle, but it’s actually a matter of naming fields. Maybe it should be changed to something more generic…

PS2. You can notice that after running truncate table newly inserted rows contain a different Data Object ID in the rowid.

Leave a Comment

Your email address will not be published. Required fields are marked *