Skip to content

Commit

Permalink
changefeedccl: don't hide error encountered during table resolution
Browse files Browse the repository at this point in the history
Stop masking the error returned if table resolution fails.
The *backupresolver.MissingTableErr already includes the table name
in its Error() method, in addition to the wrapped error, which is
currently dropped. This is a debugging step for the linked issue.

Part of: #128255

Release note: None
  • Loading branch information
asg0451 committed Aug 15, 2024
1 parent 4aafdaf commit be5e6bf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions pkg/ccl/changefeedccl/changefeed_stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -807,8 +807,7 @@ func getTableDescriptors(
if err != nil {
var m *backupresolver.MissingTableErr
if errors.As(err, &m) {
tableName := m.GetTableName()
err = errors.Errorf("table %q does not exist", tableName)
err = errors.Wrapf(m.Unwrap(), "table %q does not exist", m.GetTableName())
}
err = errors.Wrap(err, "failed to resolve targets in the CHANGEFEED stmt")
if !initialHighWater.IsEmpty() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/changefeedccl/changefeed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ func TestMissingTableErr(t *testing.T) {

t.Run("changefeed on non existing table fails", func(t *testing.T) {
kvSQL := sqlutils.MakeSQLRunner(s.DB)
kvSQL.ExpectErr(t, `^pq: failed to resolve targets in the CHANGEFEED stmt: table "foo" does not exist$`,
kvSQL.ExpectErr(t, `^pq: failed to resolve targets in the CHANGEFEED stmt: table "foo" does not exist`,
`CREATE CHANGEFEED FOR foo`,
)
})
Expand Down

0 comments on commit be5e6bf

Please sign in to comment.