forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changefeedccl: Encoding and cdc_prev handling fixes
Fix multiple related handling and encoding issues when using CDC queries. Assuming the following changefeed: `CREATE CHANGEFEED ... AS SELECT *, cdc_prev, event_op() FROM t` * Newly inserted rows will contain NULL in the `cdc_prev` column. * Deleted rows will emit all *primary key* columns; all other columns will be left `NULL`. `event_op` column will contain appropriate even op description (`deleted`) * `cdc_prev` tuple no longer contains cdc_mvcc_internal_timestamp column This was a bug that incorrectly made that column available in cdc_prev. If the application needs to determine how much time exlapsed since the previous update, the application should update an explicit timestamp column, and use that instead of the system column. The deleted row handling, when using CDC Queries, might be a bit awkward in that the row is still emitted, albeit with all but the primary key columns set to `NULL`. Of course, there is an `event_op()` function that can make the distinction between a new row with `NULL` values, or a deleted row. However, the customers may find `wrapped` envelope simpler to use (`WITH envelope='wrapped', format='json', diff`) would produce JSON object with `before` and `after` keys containing prior/current state of the row). This PR makes it possible to use `wrapped` envelope with `diff` option when using CDC queries. The `before` value in the output will always be an entire row -- without any projections. Fixes cockroachdb#101000 Release note (enterprise change): CDC queries now support wrapped envelope with diff (`envelope='wrapped', diff`).
- Loading branch information
Yevgeniy Miretskiy
committed
Apr 12, 2023
1 parent
847f270
commit 12a0b3d
Showing
17 changed files
with
254 additions
and
101 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.