Skip to content

Conversation

wcy-fdu
Copy link
Contributor

@wcy-fdu wcy-fdu commented Sep 5, 2025

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

As title

Show cdc auto schema change fail event in rw_event_logs:

select * from rw_event_logs where event_type = 'AUTO_SCHEMA_CHANGE_FAIL' order by timestamp desc;

Example1: fail due to unsupported type

------------------------------------------------------
unique_id  | 357742df-5f0d-4b6e-a1ab-e77c338bf42a
timestamp  | 2025-09-05 10:45:24.213+00:00
event_type | AUTO_SCHEMA_CHANGE_FAIL
info       | {"autoSchemaChangeFail": {"cdcTableId": "s.public.t", "failInfo": "Unsupported postgres type 'hstore' in table 'public.t'", "tableId": 6, "tableName": "public.t"}}

Example2: fail due to the ddl is not add column or drop column

unique_id  | 4792fc05-54ae-44dc-bcda-0bdb5d63aaea
timestamp  | 2025-09-05 10:48:22.691+00:00
event_type | AUTO_SCHEMA_CHANGE_FAIL
info       | {"autoSchemaChangeFail": {"cdcTableId": "6.public.t", "failInfo": "New columns should be a subset or superset of the original columns (including hidden columns), since only `ADD COLUMN` and `DROP COLUMN` is supported", "tableId": 8, "tableName": "t", "upstreamDdl": "UNKNOWN_DDL"}}

Checklist

  • I have written necessary rustdoc comments.
  • I have added necessary unit tests and integration tests.
  • I have added test labels as necessary.
  • I have added fuzzing tests or opened an issue to track them.
  • My PR contains breaking changes.
  • My PR changes performance-critical code, so I will run (micro) benchmarks and present the results.
  • I have checked the Release Timeline and Currently Supported Versions to determine which release branches I need to cherry-pick this PR into.

  • My PR needs documentation updates.
Release note

@graphite-app graphite-app bot requested a review from a team September 5, 2025 11:26
@wcy-fdu wcy-fdu marked this pull request as draft September 8, 2025 02:52
@wcy-fdu wcy-fdu marked this pull request as ready for review September 8, 2025 05:26
@wcy-fdu wcy-fdu requested review from hzxa21 and zwang28 September 8, 2025 05:26
@@ -213,6 +213,10 @@ pub fn parse_schema_change(
};
let id = jsonb_access_field!(jsonb, "id", string);
let ty = jsonb_access_field!(jsonb, "type", string);
// Try to extract table name from the JSON data
let table_name = jsonb_access_field!(jsonb, "id", string)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You are accessing the "id" field here (duplicate with L214), not the table name

(fail_info, clean_table_name, cdc_table_id)
} else {
let fail_info =
format!("Unsupported postgres type: {:?}", ty);
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

} else {
let fail_info =
format!("Unsupported postgres type: {:?}", ty);
(fail_info, "".to_owned(), "".to_owned())
Copy link
Collaborator

Choose a reason for hiding this comment

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

We have the source name available in self.source_ctx.source_name. We should include that in the error message.

"Failed to parse schema change: {:?}",
err.as_report()
);
(fail_info, "".to_owned(), "".to_owned())
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

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

Successfully merging this pull request may close these issues.

2 participants