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
release-23.2: changefeedccl: fix bug with avro encoding and zero-scale decimal cols #118847
release-23.2: changefeedccl: fix bug with avro encoding and zero-scale decimal cols #118847
Conversation
This patch fixes a bug where creating a changefeed that targeted tables with a `DECIMAL(n)` column (i.e. zero-scale `DECIMAL` column), `format='avro'`, and `diff` would cause a panic. The cause of this panic was the fact that the third-party `goavro` library we use expected the JSON encoding of the schema to have a numeric `scale` field for decimal types, but we omitted this field whenever it was zero (using `omitempty`), which led to a runtime type assertion failure. We've updated the field to a pointer type in our type definition so that we can distinguish between an unset value and a zero value. Release note (enterprise change): Fixed a bug where creating a changefeed that targeted tables with a `DECIMAL(n)` column (i.e. zero-scale `DECIMAL` column), `format='avro'`, and `diff` would cause a panic.
d2a72ae
to
e2eafe7
Compare
Thanks for opening a backport. Please check the backport criteria before merging:
If your backport adds new functionality, please ensure that the following additional criteria are satisfied:
Also, please add a brief release justification to the body of your PR to justify this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @andyyang890, @jayshrivastava, @nicktrav, @rafiss, and @wenyihu6)
Backport 1/1 commits from #118815 on behalf of @andyyang890.
/cc @cockroachdb/release
This patch fixes a bug where creating a changefeed that targeted
tables with a
DECIMAL(n)
column (i.e. zero-scaleDECIMAL
column),format='avro'
, anddiff
would cause a panic.The cause of this panic was the fact that the third-party
goavro
library we use expected the JSON encoding of the schema to have
a numeric
scale
field for decimal types, but we omitted thisfield whenever it was zero (using
omitempty
), which led to aruntime type assertion failure. We've updated the field to a pointer
type in our type definition so that we can distinguish between an
unset value and a zero value.
Fixes #118647
Release note (enterprise change): Fixed a bug where creating a
changefeed that targeted tables with a
DECIMAL(n)
column(i.e. zero-scale
DECIMAL
column),format='avro'
, anddiff
would cause a panic.
Release justification: low-risk, high-priority bug fix