Skip to content

test: stabilize prepared current timestamp assertion - #27694

Merged
XuPeng-SH merged 6 commits into
matrixorigin:mainfrom
ck89119:issue-27633-main
Aug 27, 2026
Merged

test: stabilize prepared current timestamp assertion#27694
XuPeng-SH merged 6 commits into
matrixorigin:mainfrom
ck89119:issue-27633-main

Conversation

@ck89119

@ck89119 ck89119 commented Aug 26, 2026

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:

Fixes #27633

What this PR does / why we need it:

prepare.test assumed that two separate executions of a prepared statement would return the same CURRENT_TIMESTAMP value. Each execution has its own statement time, so that assertion was timing-dependent and flaky.

This change:

  • evaluates two explicit CURRENT_TIMESTAMP(6) calls within one prepared-statement execution;
  • asserts that two rows are inserted while both values share the same statement timestamp;
  • explicitly deallocates the prepared statement.

Validation:

  • TestBuiltInCurrentTimestampReadsStatementTimePerExecution passed with exact test selection.
  • prepare.test passed twice on the same clean local instance: 531/531 statements, 100% success on both runs.
  • The created table was absent after each run, and the service stopped cleanly without panic/fatal logs.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Deep-reviewed exact head 88b75ce9917acb6f56a3c9fc6a16d7029d8db747 against base ff4270c844c4b630cf1d921da813ba119d5b5e89, issue #27633, the full two-file diff, and exact-head CI.

The old BVT oracle was invalid: separate EXECUTE calls are separate statements and may legitimately cross a timestamp boundary, so expecting one distinct value was timing-dependent. The replacement asserts the correct deterministic contract: one prepared-statement execution inserts two rows, and both CURRENT_TIMESTAMP(6) occurrences observe the same statement timestamp. count(*) = 2 prevents a vacuous distinct-count pass, and explicit DEALLOCATE PREPARE closes the statement lifecycle before table teardown.

This does not lose the per-execution contract: TestBuiltInCurrentTimestampReadsStatementTimePerExecution deterministically reuses the same cached overload while injecting two different statement times and verifies each execution reads its own value. The BVT remains the public prepared-SQL/statement-consistency oracle without sleeps or wall-clock assumptions.

git diff --check is clean; exact-head build/UT/SCA are green, and the changed prepare.test was selected by the passing PESSIMISTIC BVT. No correctness, test-quality, performance, cleanup, or unhappy-path blocker found.

@mergify mergify Bot added the queued label Aug 27, 2026
@mergify

mergify Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-08-27 04:16 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • Checks failed · in-place
  • 🚫 Left the queue2026-08-27 05:41 UTC · at bdd7698dc8bd4e969e7b994a467262588e8a34a4

This pull request spent 1 hour 25 minutes 38 seconds in the queue, with no time running CI.

Waiting for
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
    • check-success = Matrixone CI / SCA Test on Linux/arm64
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-success = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
All conditions
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
    • check-success = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-success = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86

Reason

The merge conditions cannot be satisfied due to failing checks

Failing checks:

Hint

You may have to fix your CI before adding the pull request to the queue again.
If you update this pull request, to fix the CI, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Requeued — the merge queue status continues in this comment ↓.

@aptend aptend left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Deep-reviewed exact head 38bee17 against merge-base b0ae66c, issue #27633, the complete two-file diff, all review/comment history, and the statement-time semantics. The old assertion compared two separate EXECUTE statements, so crossing a microsecond boundary legitimately produced two distinct timestamps. The replacement tests the deterministic contract: one prepared INSERT evaluates two CURRENT_TIMESTAMP(6) expressions under one statement time; count(*) = 2 prevents a vacuous distinct-count result, count(distinct a) = 1 proves statement consistency, and DEALLOCATE PREPARE closes the lifecycle. The existing package test independently verifies that reusing the same cached overload across separate executions reads each execution’s new statement time. No production or hot-path behavior changes. Validation passed on the exact head: diff check, package selection/dependency classification, build and vet for pkg/sql/plan/function, and 20 focused CGo-controlled repetitions of TestBuiltInCurrentTimestampReadsStatementTimePerExecution. No blocking correctness, flakiness, cleanup, or coverage issue found.

@mergify

mergify Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-08-27 07:07 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue2026-08-27 07:48 UTC · at bfc770c377e06cff28e6a22f1cec48d72dabac7f

This pull request spent 41 minutes 6 seconds in the queue, with no time running CI.

Reason

The pull request can't be updated

This pull request seems to come from a fork, and Mergify needs the author's permission to update its branch.
The author needs to enable "Allow edits from maintainers" on this pull request, or update the branch manually.

Hint

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

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

Labels

dequeued kind/bug Something isn't working kind/test-ci size/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: prepare.test current_timestamp assertion is flaky in Compose Proxy BVT

4 participants