Skip to content

to 3.0: fix: preserve task store during refresh - #24145

Merged
mergify[bot] merged 3 commits into
matrixorigin:3.0-devfrom
gouhongshen:codex/fix-taskservice-refresh-store-3.0-dev
Apr 15, 2026
Merged

mergify[bot] merged 3 commits into
matrixorigin:3.0-devfrom
gouhongshen:codex/fix-taskservice-refresh-store-3.0-dev

Conversation

@gouhongshen

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #24144

What this PR does / why we need it:

This fixes the task-service bug that showed up in PR #24141's compose CI as execute task sql_task_overlap -> sql: database is closed.

refreshableTaskStorage.refresh() was closing the current store before it confirmed that:

  1. the refresh request was still current, and
  2. a replacement store had been created successfully.

That meant a stale refresh request or a failed store recreation could leave the holder pointing at a closed task store, and later SQL task execution paths would observe sql: database is closed.

This change keeps the existing store alive until a replacement is ready and the refresh request is still valid, and adds regression tests for stale-refresh and create-failure paths.

gouhongshen and others added 2 commits April 15, 2026 20:38
Keep the current task store alive until a new one has been created successfully. This prevents stale refresh requests or failed refresh attempts from leaving SQL task execution paths with a closed database handle.

Add regression tests for stale refresh and store creation failure.

Co-authored-by: Copilot <[email protected]>

Copilot AI 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.

Pull request overview

Fixes a task-service refresh bug where refreshableTaskStorage.refresh() could close the active task store before confirming the refresh request was still current and before successfully creating a replacement store, which could surface later as sql: database is closed.

Changes:

  • Rework refreshableTaskStorage.refresh() to only close the previous store after successfully creating and installing a replacement, and to re-check staleness/closed state before swapping.
  • Add regression tests covering stale refresh requests and store creation failure to ensure the current store remains usable.
  • Tighten store identity assertions in existing refresh tests (assert.Same).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pkg/taskservice/task_service_holder.go Adjusts refresh flow to preserve the current store until a valid replacement is ready and installed.
pkg/taskservice/task_service_holder_test.go Adds regression tests for stale refresh + create-failure paths and updates assertions for store identity.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mergify mergify Bot added the queued label Apr 15, 2026
@mergify

mergify Bot commented Apr 15, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-04-15 14:25 UTC · Rule: release-3.0
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-04-15 14:26 UTC · at b66ad87d872823696972e3b2ddd269d42d09cd5c

This pull request spent 36 seconds in the queue, including 5 seconds running CI.

Required conditions to merge
  • #approved-reviews-by >= 1 [🛡 GitHub branch protection]
  • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
  • branch-protection-review-decision = APPROVED [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI (3.0) / Coverage
    • check-neutral = Matrixone Utils CI (3.0) / Coverage
    • check-skipped = Matrixone Utils CI (3.0) / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI (3.0) / SCA Test on Ubuntu/x86
    • check-neutral = Matrixone CI (3.0) / SCA Test on Ubuntu/x86
    • check-skipped = Matrixone CI (3.0) / SCA Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI (3.0) / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI (3.0) / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI (3.0) / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(Optimistic/PUSH)
    • check-neutral = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(Optimistic/PUSH)
    • check-skipped = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(Optimistic/PUSH)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-neutral = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-skipped = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI (3.0) / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-neutral = Matrixone Standlone CI (3.0) / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-skipped = Matrixone Standlone CI (3.0) / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
    • check-neutral = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
    • check-skipped = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Upgrade CI (3.0) / Compatibility Test With Target on Linux/x64(LAUNCH)
    • check-neutral = Matrixone Upgrade CI (3.0) / Compatibility Test With Target on Linux/x64(LAUNCH)
    • check-skipped = Matrixone Upgrade CI (3.0) / Compatibility Test With Target on Linux/x64(LAUNCH)

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants