-
Notifications
You must be signed in to change notification settings - Fork 414
ddl: Fix default value filling with finer granularity (#10682) #10691
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
ddl: Fix default value filling with finer granularity (#10682) #10691
Conversation
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
|
@JaySon-Huang This PR has conflicts, I have hold it. |
|
@ti-chi-bot: ## If you want to know how to resolve it, please read the guide in TiDB Dev Guide. DetailsInstructions 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 ti-community-infra/tichi repository. |
📝 WalkthroughWalkthroughAdds default-filling logic during row decoding (origin/default/NULL) via a new helper integrated into V1/V2 RowCodec paths, updates ColumnInfo with origin-default accessors and parsing, adds tests (unit and fullstack) covering nullability/default scenarios, and minor RegionBlockReader comments and formatting helper output. Changes
Sequence Diagram(s)sequenceDiagram
participant Reader as RegionBlockReader
participant Decoder as RowCodec
participant Schema as ColumnInfo
participant Block as Block
participant Sync as SchemaSync
Reader->>Decoder: request decode rows
Decoder->>Schema: query column metadata (hasOriginDefaultValue / defaultValueToField)
Decoder->>Block: append decoded datums
alt missing column detected
Decoder->>Schema: addDefaultValueToColumnIfPossible(column_info, block, pos, ...)
Schema-->>Decoder: Field / GenDefault / failure
alt success
Decoder->>Block: insert default or NULL
else failure
Decoder->>Sync: return schema-sync signal (false)
end
end
Decoder-->>Reader: decoded Block or schema-sync result
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Important Action Needed: IP Allowlist UpdateIf your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:
Reviews will stop working after February 8, 2026 if the new IP is not added to your allowlist. 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. Comment |
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.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@dbms/src/TiDB/Decode/RowCodec.cpp`:
- Around line 422-428: Resolve the git conflict markers in RowCodec.cpp by
removing the conflict markers (<<<<<<<, =======, >>>>>>>) and the duplicated
verbose comment, and keep the concise incoming comment "fallthrough for
best-effort fill when force_decode == true" so the code compiles; locate the
comment area in the RowCodec code path that handles non-clustered index /
pk_is_handle handling (around the logic that falls through to fill default
values) and replace the conflicted block with the single-line incoming comment.
In `@dbms/src/TiDB/Schema/tests/gtest_table_info.cpp`:
- Around line 144-174: The file contains unresolved Git conflict markers
(<<<<<<< HEAD, =======, >>>>>>>) that break compilation; remove these markers
and keep the intended new ParseCase tests that validate origin_default parsing
(the two ParseCase blocks that construct JSON and assert on TableInfo,
getColumnInfo(3), hasOriginDefaultValue(), and defaultValueToField()), ensuring
the duplicated/old chunk is not left behind and the test still compiles and
links with the TableInfo-related helpers (TableInfo, getColumnInfo,
defaultValueToField).
🧹 Nitpick comments (2)
dbms/src/Storages/KVStore/tests/gtest_region_block_reader.cpp (2)
818-818: Minor typo in comment."thrid" should be "third".
📝 Suggested fix
- // the thrid elem is filled wih origin_default + // the third elem is filled with origin_default
844-844: Same typo in comment.📝 Suggested fix
- // the thrid elem is filled wih origin_default + // the third elem is filled with origin_default
Signed-off-by: JaySon-Huang <tshent@qq.com>
Signed-off-by: JaySon-Huang <tshent@qq.com>
Signed-off-by: JaySon-Huang <tshent@qq.com>
|
/unhold |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: CalvinNeo, JaySon-Huang The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
This is an automated cherry-pick of #10682
What problem does this PR solve?
Issue Number: close #10680
Problem Summary:
Root cause
What is changed and how it works?
With old schema (NOT NULL, no origin default), missing column now triggers schema sync. After schema sync, column becomes nullable, so missing column can be decode and stored in tiflash with
NULL, matching TiKV.Check List
Tests
Side effects
Documentation
Release note
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Chores