Skip to content

[refactor](scan) remove SchemaCache to fix concurrent crash in OlapScanner::prepare - #62327

Merged
yiguolei merged 1 commit into
apache:masterfrom
csun5285:fix/remove-schema-cache-variant-crash
Apr 13, 2026
Merged

[refactor](scan) remove SchemaCache to fix concurrent crash in OlapScanner::prepare#62327
yiguolei merged 1 commit into
apache:masterfrom
csun5285:fix/remove-schema-cache-variant-crash

Conversation

@csun5285

@csun5285csun5285 commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

Remove SchemaCache entirely. Each scanner now always builds its own independent TabletSchema via std::make_shared<TabletSchema>(), eliminating shared mutable state between concurrent scanners.

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

Release note

None

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

@Thearas

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@csun5285

Copy link
Copy Markdown
ContributorAuthor

run buildall

@csun5285csun5285 changed the title [fix](scan) remove SchemaCache to fix concurrent crash in OlapScanner::prepare[refactor](scan) remove SchemaCache to fix concurrent crash in OlapScanner::prepareApr 10, 2026
@csun5285
csun5285force-pushed the fix/remove-schema-cache-variant-crash branch from f387677 to 881c2bdCompareApril 10, 2026 07:28
@csun5285

Copy link
Copy Markdown
ContributorAuthor

run buildall

…::prepare
After lightweight schema change adds a variant column, old-partition tablets
still have num_variant_columns()==0 in their _max_version_schema. This causes
OlapScanner::prepare() to cache the rebuilt schema (which now contains the
variant column) into SchemaCache. Subsequent scanners for the same tablet get
the exact same TabletSchema pointer via cache hit, then concurrently modify it
in merge_dropped_columns() / _init_variant_columns(), leading to SIGSEGV in
inherit_column_attributes().
Remove SchemaCache so each scanner always builds its own independent
TabletSchema.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@csun5285
csun5285force-pushed the fix/remove-schema-cache-variant-crash branch from 881c2bd to 9470d25CompareApril 10, 2026 12:14
@csun5285

Copy link
Copy Markdown
ContributorAuthor

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 7.69% (1/13) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage53.05% (20145/37975)
Line Coverage36.59% (189424/517715)
Region Coverage32.86% (147118/447723)
Branch Coverage33.98% (64387/189460)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (13/13) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage73.62% (27379/37188)
Line Coverage57.25% (295475/516118)
Region Coverage54.35% (245559/451828)
Branch Coverage56.11% (106635/190042)

@eldenmooneldenmoon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@github-actionsgithub-actionsBot added the approved Indicates a PR has been approved by one committer. label Apr 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@yiguolei
yiguolei merged commit aa1e21d into apache:masterApr 13, 2026
31 of 33 checks passed
@yiguoleiyiguolei added the usercase Important user case type label label Apr 13, 2026
github-actionsBot pushed a commit that referenced this pull request Apr 13, 2026
…anner::prepare (#62327)
Remove SchemaCache entirely. Each scanner now always builds its own
independent TabletSchema via `std::make_shared<TabletSchema>()`,
eliminating shared mutable state between concurrent scanners.
### What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [x] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
apache/doris-website#1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
yiguolei pushed a commit that referenced this pull request Apr 13, 2026
…sh in OlapScanner::prepare #62327 (#62414)
Cherry-picked from #62327
Co-authored-by: Chenyang Sun <sunchenyang@selectdb.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
csun5285 added a commit to csun5285/doris that referenced this pull request Apr 13, 2026
…anner::prepare (apache#62327)
Remove SchemaCache entirely. Each scanner now always builds its own
independent TabletSchema via `std::make_shared<TabletSchema>()`,
eliminating shared mutable state between concurrent scanners.
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
None
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [x] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
apache/doris-website#1214 -->
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
(cherry picked from commit aa1e21d)
csun5285 added a commit to csun5285/doris that referenced this pull request Apr 13, 2026
…anner::prepare (apache#62327)
Remove SchemaCache entirely. Each scanner now always builds its own
independent TabletSchema via `std::make_shared<TabletSchema>()`,
eliminating shared mutable state between concurrent scanners.
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
None
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [x] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
apache/doris-website#1214 -->
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
(cherry picked from commit aa1e21d)
yiguolei pushed a commit that referenced this pull request Apr 15, 2026
…Scanner::prepare (#62327) (#62427)
pick from master #62327
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@morningmanmorningman mentioned this pull request Jun 3, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approvedIndicates a PR has been approved by one committer.dev/4.0.6-mergeddev/4.1.0-mergedreviewedusercaseImportant user case type label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@csun5285@Thearas@hello-stephen@yiguolei@eldenmoon