Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update events are missing the "before" in payload #70

Closed
flexwende opened this issue Sep 25, 2023 · 4 comments
Closed

Update events are missing the "before" in payload #70

flexwende opened this issue Sep 25, 2023 · 4 comments

Comments

@flexwende
Copy link

Update events are missing the "before"-data in the payload, the "after" is present. This makes it hard to further work with the data and perform the correct update in a second database.

example output of an update event using sink.type = 'stdout':

{"payload":{"op":"u","after":{"ts":"2023-09-25T09:55:23.968497Z","details":"asdf"},"source":{"connector":"timescaledb-event-streamer","ts_ms":1695635729265,"snapshot":false,"db":"timescaledb","schema":"public","table":"event_table","lsn":"0/2244CB0","version":"0.10.1","name":"timescaledb","txId":975},"ts_ms":1695635729116}}

I am not sure if this is intended or can be enabled with a setting that I overlooked.

Versions:

  • postgresql: 14
  • timescaledb: 2.11.2
  • timescaledb-event-streamer: 0.10.1
@noctarius
Copy link
Owner

You have to enable REPLICA IDENTITY FULL. I just don't remember if this is already merged or if you have to wait for 2.12.

@noctarius
Copy link
Owner

Yes, 2.12 includes all the necessary changes: timescale/timescaledb#6086

Not sure if the packages are already available though. This version also includes a way to prevent decompressions / decompressions to create insert events.

@flexwende
Copy link
Author

ok, thanks for the information :)

@noctarius
Copy link
Owner

noctarius commented Sep 25, 2023

Btw, the related commits are:

Specifically the last one is the PR to help with decompression/recompression by providing a begin- and end-marker before larger decompressions which will potentially create insert events. It's basically hiding some internal behavior.

To enable the support you need to set timescaledb.enable_decompression_logrep_markers = on in postgresql.conf.

The support is already available in the tool for a while and should automatically be enabled when it sees a 2.12 TimescaleDB instance (https://github.com/noctarius/timescaledb-event-streamer/blob/main/internal/replication/logicalreplicationresolver/transactiontracker.go#L67). Without the above property the TimescaleDB extension will not generate the necessary markers though.

I'll add a 2.12 test suite when the docker image is available :)

noctarius added a commit that referenced this issue Sep 30, 2023
Fixes #70: Implemented unit test and check for replica identity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants