fix: Handle wal2json enum type quoting issue in LOG_BASED replication#736
Merged
edgarrmondragon merged 6 commits intoMeltanoLabs:mainfrom Mar 3, 2026
Conversation
…iscover_streams The `connection_parameters` attribute is set as a side effect of the `connector` cached property. In `discover_streams`, accessing `self.connection_parameters` (for LOG_BASED streams) without first ensuring `self.connector` has been called could raise an AttributeError. This change accesses the connector once at the top of the method, stores it in a local variable, and reuses it — guaranteeing initialization order and avoiding redundant cached property lookups in the loop. Co-authored-by: Cursor <cursoragent@cursor.com>
…connection-parameters-in-discover-streams fix: Initialize connector before accessing connection_parameters in d…
Member
edgarrmondragon
left a comment
There was a problem hiding this comment.
Thanks!
Just two comments. Let me know what you think.
Comment on lines
+401
to
+407
| try: | ||
| message_payload = json.loads(fixed_payload) | ||
| except json.JSONDecodeError: | ||
| self.logger.warning( | ||
| "A message payload of %s could not be converted to JSON", | ||
| message.payload, | ||
| ) |
Member
There was a problem hiding this comment.
perf: this adds another try/except block to each iteration of the log message loop. Even if the performance hit is measurable, having the sync crash is worse.
I %100 need to add some sort of automatic benchmarks for general and log-based performance here.
edgarrmondragon
approved these changes
Mar 3, 2026
Member
|
Thanks @ksohail22! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wal2jsonoutputs PostgreSQL enum type names with unescaped double quotes (e.g.,"type":""EnumName"") which produces invalid JSON. This causesjson.JSONDecodeErrorin_parse_message_payload, resulting in the entire message being silently dropped (returning{}).""EnumName""→"EnumName") using a regex substitution, then retry JSON parsing. Only logs and returns{}if the retry also fails._fix_wal2json_enum_quotes()helper method toPostgresLogBasedStream.Test plan
{}