Skip to content

[BugFix] Fix num_short_key_columns mismatch in partial tablet schema (backport #70586) (backport #70603)#73089

Merged
wanpengfei-git merged 1 commit into
branch-3.5-ccfrom
mergify/bp/branch-3.5-cc/pr-70603
May 12, 2026
Merged

[BugFix] Fix num_short_key_columns mismatch in partial tablet schema (backport #70586) (backport #70603)#73089
wanpengfei-git merged 1 commit into
branch-3.5-ccfrom
mergify/bp/branch-3.5-cc/pr-70603

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify Bot commented May 11, 2026

Why I'm doing:

Fix BE DCHECK crash num_short_keys <= sort_key_idxes.size() in SeekTuple::short_key_encode during column-mode partial update on primary key tables with separate sort keys (e.g. ORDER BY(k3, k2)).

TabletSchema::create copies num_short_key_columns from the source schema (e.g. 2), but sort_key_idxes in the partial schema may be empty when sort key columns are not in the partial column set. _init_from_pb then falls back to using key columns as sort keys (e.g. size=1), creating an inconsistency: num_short_key_columns(2) > sort_key_idxes.size()(1).

What I'm doing:

After constructing the partial tablet schema, ensure num_short_key_columns <= sort_key_idxes.size() to keep them consistent.

Trigger SQL:

CREATE TABLE tab1 (k0 int NOT NULL, k1 int, k2 int, k3 int, k4 int, k5 int, v1 int, v2 int)
PRIMARY KEY(k0) DISTRIBUTED BY HASH(k0) BUCKETS 1 ORDER BY(k3, k2)
PROPERTIES ("replication_num" = "1");

INSERT INTO tab1 VALUES (1,1,1,1,1,1,1,1);
SET partial_update_mode = 'column';
UPDATE tab1 SET k4 = 1;  -- crashes in ASAN build

Fixes https://github.com/StarRocks/StarRocksTest/issues/11136

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This PR needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport PR

Bugfix cherry-pick branch check:


This is an automatic backport of pull request #70603 done by [Mergify](https://mergify.com).

…(backport #70586) (#70603)

Signed-off-by: luohaha <18810541851@163.com>
Co-authored-by: Yixin Luo <18810541851@163.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
(cherry picked from commit 1d595c2)
@wanpengfei-git wanpengfei-git merged commit df0be92 into branch-3.5-cc May 12, 2026
36 checks passed
@wanpengfei-git wanpengfei-git deleted the mergify/bp/branch-3.5-cc/pr-70603 branch May 12, 2026 06:22
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