Skip to content

schemastore: support ActionCreateMaterializedView (#4779)#5229

Merged
lidezhu merged 5 commits into
pingcap:feature/release-8.5-materialized-viewfrom
lidezhu:ldz/mv02
Jun 8, 2026
Merged

schemastore: support ActionCreateMaterializedView (#4779)#5229
lidezhu merged 5 commits into
pingcap:feature/release-8.5-materialized-viewfrom
lidezhu:ldz/mv02

Conversation

@lidezhu

@lidezhu lidezhu commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

What problem does this PR solve?

Issue Number: close #5183

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Questions

Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?

Release note

Please refer to [Release Notes Language Style Guide](https://pingcap.github.io/tidb-dev-guide/contribute-to-tidb/release-notes-style-guide.html) to write a quality release note.

If you don't think this PR needs a release note then fill it with `None`.

* wip

* add more log

* add more log

* f

* fix

* fix

* fix

* add more test

* add some log

* support create mv

* try fix

* f

* f

* fix

* fix

* fix

* fix

* add comment
@ti-chi-bot

ti-chi-bot Bot commented Jun 7, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot Bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Jun 7, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jun 7, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign 3aceshowhand for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b9603d43-565b-496e-bb6a-fac3d2dcd6bf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ti-chi-bot ti-chi-bot Bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jun 7, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for tracking materialized views and handling their out-of-place refresh cutovers. Key changes include adding methods to retrieve materialized view IDs, updating table trigger DDL event fetching to track materialized view lineages, and introducing a local DDL event type for cutovers in the filter package. The review feedback highlights two important issues: first, mutating the trackedMaterializedViewIDs map in-place during event fetching makes the operation non-idempotent and can lead to silently skipped events on retries; second, a potential nil pointer dereference exists when accessing the database map in loadMaterializedViewIDsAtTs without verifying if the schema ID is present.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread logservice/schemastore/persist_storage.go Outdated
Comment thread logservice/schemastore/disk_format.go Outdated
@lidezhu lidezhu marked this pull request as ready for review June 7, 2026 12:01
@ti-chi-bot ti-chi-bot Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 7, 2026
@lidezhu

lidezhu commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator Author

/gemini summary

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

This pull request enables TiCDC to support the ActionCreateMaterializedView DDL operation. It integrates the necessary logic to persist these events, ensures they are correctly handled by the schema store, and updates the filtering framework to accommodate materialized view refresh operations. These changes ensure that materialized views are properly tracked and processed within the replication pipeline.

Highlights

  • Materialized View Support: Added support for the ActionCreateMaterializedView DDL operation within the TiCDC schema store.
  • DDL Handling and Persistence: Implemented necessary DDL handlers and persistence logic to correctly process and store materialized view creation events.
  • Filtering Logic: Updated the filtering system to support the new EventTypeMViewRefreshOutOfPlaceCutover event type.
  • Testing: Added comprehensive unit tests to verify the handling of materialized view DDLs and their interaction with the schema store.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Activity
  • Pull request created by lidezhu.
  • Automated bot comments regarding CI and approval requirements.
  • Review comments received from gemini-code-assist regarding idempotency and potential nil pointer dereferences.

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

This pull request introduces support for ActionCreateMaterializedView within the schema store, ensuring that materialized view creation events are correctly persisted and handled. It also includes updates to the DDL filtering logic to accommodate materialized view-specific events, such as out-of-place refresh cutovers, and adds robust unit testing to verify these new capabilities.

Highlights

  • Materialized View Support: Added support for ActionCreateMaterializedView in the schema store to correctly process and persist materialized view creation DDLs.
  • Code Refactoring: Refactored loadAllPhysicalTablesAtTs to use a dedicated tablesAtTsState struct, improving code maintainability and readability.
  • DDL Filtering Enhancements: Updated DDL filtering logic to support materialized view-specific events, including custom handling for refresh cutover events.
  • Resource Management: Ensured proper resource cleanup by adding storageSnap.Close() calls in error handling paths within persistent storage.
  • Testing: Added comprehensive unit tests to verify materialized view DDL handling, filtering, and schema store integration.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Activity
  • The pull request was initially created as a draft, skipping CI.
  • The pull request is currently marked as not approved.
  • CodeRabbit skipped the automated review due to branch settings.
  • Author lidezhu requested a summary of the pull request.
  • Gemini-code-assist provided feedback regarding idempotency in FetchTableTriggerDDLEvents and a potential nil pointer dereference in schema processing.

@lidezhu lidezhu merged commit 5445ede into pingcap:feature/release-8.5-materialized-view Jun 8, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant