Skip to content

pkg/ddl, pkg/executor: validate MV START WITH/NEXT expr type and remove defaults#66383

Merged
ti-chi-bot[bot] merged 3 commits intopingcap:feature/release-8.5-materialized-viewfrom
windtalker:update_next_column_when_build_mv_and_mv_log
Feb 26, 2026
Merged

pkg/ddl, pkg/executor: validate MV START WITH/NEXT expr type and remove defaults#66383
ti-chi-bot[bot] merged 3 commits intopingcap:feature/release-8.5-materialized-viewfrom
windtalker:update_next_column_when_build_mv_and_mv_log

Conversation

@windtalker
Copy link
Contributor

What problem does this PR solve?

Issue Number: ref #18023

Problem Summary:
Support START WITH / NEXT for CREATE MATERIALIZED VIEW and CREATE MATERIALIZED VIEW LOG with correct create-time semantics.

What changed and how does it work?

  1. Removed implicit defaults during create:
  • For MV refresh metadata, when user does not specify START WITH or NEXT, store empty strings instead of defaulting to NOW() / 300.
  1. Added expression type validation for schedule clauses:
  • Validate that START WITH / NEXT expressions in MV refresh and MV LOG purge are DATETIME / TIMESTAMP typed.
  • Non-datetime expressions now return DDL unsupported errors.
  1. Updated related tests:
  • Replaced previous NEXT 300/NEXT 600 style SQL in affected tests with datetime expressions.
  • Added negative test coverage for non-datetime START WITH / NEXT.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Test command:

(find "$PWD"/ -type d | grep -vE "(\.git|tools)" | xargs tools/bin/failpoint-ctl enable) && (
  pushd pkg/executor/test/ddl >/dev/null
  go test -run 'Test(MaterializedViewDDLBasic|CreateMaterializedView.*|DropMaterializedViewLogRecheckWithConcurrentCreateMaterializedView|CreateMaterializedViewLog.*|TruncateMaterializedViewRelatedTablesRejected|MaterializedViewRelatedTablesDDLRejected)' -tags=intest,deadlock -count=1
  rc=$?
  popd >/dev/null
  find "$PWD"/ -type d | grep -vE "(\.git|tools)" | xargs tools/bin/failpoint-ctl disable
  exit $rc
)

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 25, 2026
@tiprow
Copy link

tiprow bot commented Feb 25, 2026

Hi @windtalker. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@codecov
Copy link

codecov bot commented Feb 25, 2026

Codecov Report

❌ Patch coverage is 68.96552% with 9 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (feature/release-8.5-materialized-view@a203693). Learn more about missing BASE report.

Additional details and impacted files
@@                            Coverage Diff                             @@
##             feature/release-8.5-materialized-view     #66383   +/-   ##
==========================================================================
  Coverage                                         ?   57.6079%           
==========================================================================
  Files                                            ?       1791           
  Lines                                            ?     641911           
  Branches                                         ?          0           
==========================================================================
  Hits                                             ?     369792           
  Misses                                           ?     246961           
  Partials                                         ?      25158           
Flag Coverage Δ
integration 38.2135% <0.0000%> (?)
unit 72.4926% <68.9655%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.9278% <0.0000%> (?)
parser ∅ <0.0000%> (?)
br 63.3895% <0.0000%> (?)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@windtalker
Copy link
Contributor Author

/test unit-test

@tiprow
Copy link

tiprow bot commented Feb 25, 2026

@windtalker: PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test.

Details

In response to this:

/test unit-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Feb 26, 2026
@windtalker
Copy link
Contributor Author

/run check_dev_2

@windtalker
Copy link
Contributor Author

/test check_dev_2

@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 26, 2026

@windtalker: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

/test build
/test check-dev
/test check-dev2
/test mysql-test
/test pull-br-integration-test
/test pull-unit-test-ddlv1
/test unit-test

The following commands are available to trigger optional jobs:

/test pull-common-test
/test pull-e2e-test
/test pull-integration-common-test
/test pull-integration-copr-test
/test pull-integration-ddl-test
/test pull-integration-e2e-test
/test pull-integration-jdbc-test
/test pull-integration-mysql-test
/test pull-integration-nodejs-test
/test pull-integration-python-orm-test
/test pull-integration-tidb-tools-test
/test pull-lightning-integration-test
/test pull-mysql-client-test
/test pull-sqllogic-test

Use /test all to run the following jobs that were automatically triggered:

pingcap/tidb/release-8.5/pull_br_integration_test
pingcap/tidb/release-8.5/pull_build
pingcap/tidb/release-8.5/pull_check
pingcap/tidb/release-8.5/pull_check2
pingcap/tidb/release-8.5/pull_mysql_test
pingcap/tidb/release-8.5/pull_unit_test
pingcap/tidb/release-8.5/pull_unit_test_ddlv1
Details

In response to this:

/test check_dev_2

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@tiprow
Copy link

tiprow bot commented Feb 26, 2026

@windtalker: PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test.

Details

In response to this:

/test check_dev_2

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@windtalker
Copy link
Contributor Author

/test check-dev2

@tiprow
Copy link

tiprow bot commented Feb 26, 2026

@windtalker: PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test.

Details

In response to this:

/test check-dev2

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link
Contributor

@xzhangxian1008 xzhangxian1008 left a comment

Choose a reason for hiding this comment

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

lgtm

@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 26, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wjhuang2016, xzhangxian1008

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

The pull request process is described 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

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Feb 26, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 26, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-02-26 04:20:26.393521904 +0000 UTC m=+328698.908316503: ☑️ agreed by wjhuang2016.
  • 2026-02-26 06:34:07.180782886 +0000 UTC m=+336719.695577495: ☑️ agreed by xzhangxian1008.

@ti-chi-bot ti-chi-bot bot merged commit e8829b0 into pingcap:feature/release-8.5-materialized-view Feb 26, 2026
20 of 21 checks passed
@windtalker windtalker deleted the update_next_column_when_build_mv_and_mv_log branch February 26, 2026 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants