Repository navigation
fix ut - #26381
fix ut#26381
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
[P1] The changes do not cover the failure modes recorded in #26374. (1) TestClusterCanStartNewCNServices failed by panicking inside the CN bootstrap goroutine before validCNCanWork runs, so retrying the later SQL readiness check cannot prevent it. (2) TestReLockInRollingRestartCN and TestPreTxnLockInRollingRestartCN failed after the service reached the requested state, when the following one-shot remote Lock returned backend connection closed. State polling does not retry those operations; please use the existing rolling-restart retry contract/helper for the transient RPC errors and add deterministic coverage. Also prefer a fatal readiness assertion so a timed-out prerequisite does not let the test continue.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep re-review of exact head 7b964ac. The idempotent HAKeeper allocation closes the prior lock-ownership hole, but bootstrap connection-error closure is still incomplete.
[P1] Make bootstrap retries phase-aware across the initial check and an unknown transaction commit — pkg/bootstrap/service.go:186-190, pkg/bootstrap/service.go:223-237
Two retryable windows still reach handleBootstrapErr or can make the owner panic:
-
Bootstrapreturns any connection error from the initialcheckAlreadyBootstrappeddirectly, before the new idempotent lock path is reached. A transient SQL connection reset in this pre-owner check therefore still reproduces the original pre-readiness failure class. -
execBootstrapWithRetryblindly starts the full bootstrap transaction again after every connection error. IfExecTxncommitted the initialization but the commit response was lost, the next attempt does not re-check bootstrap state and reruns non-idempotent initialization SQL (create database, version insert, etc.); that can fail with a non-connection duplicate-object error and still panic. This is the SQL-side equivalent of the allocation unknown-outcome case the new request ID correctly handles.
TestBootstrapRetriesOwnerInitializationWithoutReacquiringLock only injects the error from the first init SQL before a successful commit, so it cannot exercise either case. Please retry the safe pre-owner check, and after an owner transaction connection error reconcile committed bootstrap state before deciding whether to rerun, with deterministic tests for the initial-check reset and a committed-but-response-lost ExecTxn. The rolling-restart lock retry changes and idempotent HAKeeper request handling otherwise look sound.
|
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep re-review of exact head fd0ea3a24a344a60fa29559455633ebec4a71caf. The phase-aware uncertain-commit reconciliation closes the two conceptual gaps from the previous review, and the new focused tests pass, but the retry classifier still does not receive the error shape produced by the real SQL executor.
[P1] Preserve retryable error classification through the SQL executor rollback wrapper — pkg/bootstrap/service.go:250-251
checkAlreadyBootstrapped calls SQLExecutor.Exec, and pre-commit initialization runs inside SQLExecutor.ExecTxn. In the production implementation, a transaction-body error takes pkg/sql/compile/sql_executor.go:179-186 and txnExecutor.rollback returns errors.Join(originalErr, Rollback(...)) even when rollback succeeds (sql_executor.go:670-674). The new isBootstrapRetryableError then calls classifiers whose MatrixOne-code paths only accept a top-level *moerr.Error; they do not traverse that joined wrapper.
On this exact head I exercised isBootstrapRetryableError(errors.Join(err, nil)): connection reset happens to pass via morpc string matching, but ErrBackendClosed, ErrBackendCannotConnect, and ErrTxnUnknown all return false. Consequently those errors from the initial state check or an init SQL before commit still return from Bootstrap and reach the CN bootstrap panic instead of the new retry path. TestBootstrapRetriesInitialStateCheckBeforeLock uses NewMemExecutor, and the owner retry test also returns raw errors, so both bypass the production wrapper and cannot catch this.
Please make the retry classification unwrap/traverse joined errors (or fix the shared classifiers) and add deterministic coverage using the production-shaped joined error for the initial-check and pre-commit paths. The uncertain-commit no-replay logic and its delayed-visibility/context tests otherwise look sound.
Non-blocking: the PR description still says this only changes tests, although the head now changes production bootstrap, HAKeeper allocation, and protocol state.
|
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep re-review of exact head a5e608784b7531f4a08f1315ae013a2fd9436322: the previous blocker is resolved; no remaining blocking findings.
isBootstrapRetryableError now traverses production-shaped single/joined wrappers and deliberately classifies only the transaction-body child, so backend-closed/backend-cannot-connect/txn-unknown errors survive SQLExecutor rollback wrapping without allowing a retryable rollback error to turn a non-retryable bootstrap SQL failure into a replay. The phase-aware ownership and uncertain-commit safeguards from the prior head remain intact.
Fresh local evidence: all six bootstrap retry/reconciliation regressions pass under -race -count=5; go build, go vet, and git diff --check pass across the affected bootstrap/CN/embed/HAKeeper/lockservice/logservice packages. Latest CI is green and the PR is MERGEABLE.
What type of PR is this?
Which issue(s) this PR fixes:
issue #26374
What this PR does / why we need it: