debezium은 before/after 데이터 변경에 대해  row의 변화에 대한 정보를 json으로 출력한다. 

 

gtid가 두가지 정보가 온다. : 이후에 sequence number가 오는데 debezium이 주는걸까? mysql일까?
“gtid”:{“string”:“9a227629-491c-11e9-ae9d-fa163ea8d9a7:128519”}
“gtid”:{“string”:“9a227629-491c-11e9-ae9d-fa163ea8d9a7:128520"}



(내생각) 이 정보를 배경으로 (아마도 kafka) at once를 구현하는 것처럼 보인다..

로그를 보면. 그런식으로 먼가 계산하는 것처럼 보인다.
INFO Connected to MySQL binlog at cdc-test.mydb.daumkakao.io:3306, starting at GTIDs 9a227629-491c-11e9-ae9d-fa163ea8d9a7:1-129873 and binlog file ‘mysql-bin.000015’, pos=60032311, skipping 0 events plus 1 rows (io.debezium.connector.mysql.BinlogReader:970) (edited) 

 


Debezium 로그를 보면, shyiko 바이너리 클라이언트는 어디까지 읽었는지.. 알린다.

 


 com.github.shyiko.mysql.binlog.BinaryLogClient connect
INFO: Connected to cdc-test.mydb.daumkakao.io:3306 at 9a227629-491c-11e9-ae9d-fa163ea8d9a7:1-129869 (sid:18405, cid:628)
INFO Connected to MySQL binlog at cdc-test.mydb.daumkakao.io:3306, starting at GTIDs 9a227629-491c-11e9-ae9d-fa163ea8d9a7:1-129869 and binlog file ‘mysql-

bin.000015’, pos=60030849, skipping 0 events plus 1 rows (io.debezium.connector.mysql.BinlogReader:970)

 

그리고  jpa와 같은 delete 쿼리에 transaction이 같이 날아다는 데. 이 때문에 null이 출력한다.(사실은 debezium이 처리하고 싶지 않은 데이터는 모두 null로 출력된다, debezium은 insert, update, delete 정보를 출력한다.

debezimum 소스를 보면, delete event일 때 두 메시지를 보낸다. 한다. null이 바로 tombstone message이다.

{“id”:49615}  {“before…“op”:“d”,“ts_ms”:{“long”:1554456897149}}
{“id”:49615}    null

 




https://github.com/debezium/debezium/blob/master/debezium-core/src/main/java/io/debezium/transforms/UnwrapFromEnvelope.java#L34
when delete event is emitted by database then Debezium emits two messages: a delete message and a tombstone message that serves as a signal to Kafka compaction process.

 

 

debezium 설정에 “tombstones.on.delete”: “false”, 로 설정하니 delete 이벤트가 날아갈 때 null이 더 이상 나오지 않는다.
{“id”:49615}  {“before…“op”:“d”,“ts_ms”:{“long”:1554456897149}}

 

https://github.com/debezium/debezium/blob/master/debezium-core/src/main/java/io/debezium/config/CommonConnectorConfig.java#L32

https://github.com/debezium/debezium/blob/master/debezium-connector-mysql/src/main/java/io/debezium/connector/mysql/RecordMakers.java

 

debezium/debezium

Change data capture for a variety of databases. https://debezium.io Please log issues in our JIRA at https://issues.jboss.org/projects/DBZ/issues - debezium/debezium

github.com

 

 

 

 

 

 

Posted by '김용환'
,