Skip to content

pgbk: ensure TOASTed values in the change feed#29965

Merged
espadolini merged 1 commit intomasterfrom
espadolini/pgbk-toasted
Aug 3, 2023
Merged

pgbk: ensure TOASTed values in the change feed#29965
espadolini merged 1 commit intomasterfrom
espadolini/pgbk-toasted

Conversation

@espadolini
Copy link
Copy Markdown
Contributor

@espadolini espadolini commented Aug 3, 2023

This PR makes it so that we forcibly update values during KeepAlive, because unchanged TOASTed values are not stored in the WAL, even at logical level. This can happen when doing KeepAlive on a node with a lot of labels, for example.

This relies on the planner not being able to see that we are not going to be actually mutating the value; from my tests it seems to work even with a literal value = value || '' but we go the extra mile and actually send an always-empty bytestring to concatenate to.

A more stable solution might be to switch to REPLICA IDENTITY FULL on the table, but that requires some smarter parsing of the change feed data and comes with some performance drawbacks (as the WAL essentially doubles in volume).

Fixes #29911.

Comment thread lib/backend/pgbk/pgbk.go
@espadolini espadolini requested a review from xacrimon August 3, 2023 11:27
Copy link
Copy Markdown
Contributor

@Tener Tener left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine as a stopgap measure before #29966 is fully implemented.

@espadolini espadolini added this pull request to the merge queue Aug 3, 2023
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 3, 2023
@espadolini espadolini added this pull request to the merge queue Aug 3, 2023
Merged via the queue into master with commit 4182ec3 Aug 3, 2023
@espadolini espadolini deleted the espadolini/pgbk-toasted branch August 3, 2023 13:55
@public-teleport-github-review-bot
Copy link
Copy Markdown

@espadolini See the table below for backport results.

Branch Result
branch/v13 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Postgres Backend on Azure - Change Feed contantly crashing - ERROR: invalid hexadecimal digit: "-" (SQLSTATE 22023)

4 participants