fix(backend): report CREATE DATABASE retry failures during DB init - #13992
fix(backend): report CREATE DATABASE retry failures during DB init#13992hsinhoyeh wants to merge 1 commit into
Conversation
initDBDriver retried "CREATE DATABASE" with backoff.Retry, which discards
the error from every attempt. Nothing at all was logged for the whole
InitConnectionTimeout window (6m by default), and the startup probe
restarts the container long before that deadline lets TerminateIfError
turn the failure into a fatal. The error therefore never surfaced.
The observable symptom is an api-server that logs three lines and then
appears to hang forever:
I client_manager.go:275] Initializing client manager
I client_manager.go:276] Initializing DB client...
I config.go:75] Config DBConfig.MySQLConfig.ExtraParams not specified, skipping
Any misconfiguration reached through this path - an unresolvable database
host, a wrong password, a driver pointed at the wrong engine - looks
identical from the outside, and identical to a slow but healthy start.
Use backoff.RetryNotify, matching the sql.Open retry immediately above it,
and include the database name and the next retry interval so a failing
attempt names its own cause. This is logging only; the retry policy and
the eventual TerminateIfError are unchanged.
initDBDriver opens real connections and terminates the process on failure,
so it has no unit tests and none are added here.
Part of kubeflow#13956
Signed-off-by: hsinhoyeh <yhh92u@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @hsinhoyeh. Thanks for your PR. I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Fixes item 7 of #13956 — the DB initialisation failure that produces no log output at all.
initDBDriverretriesCREATE DATABASEwithbackoff.Retry, which discards the error from every attempt:https://github.com/kubeflow/pipelines/blob/master/backend/src/apiserver/client_manager/client_manager.go#L441-L445
Nothing is logged for the whole
InitConnectionTimeoutwindow (6m by default), and the startup probe restarts the container long before that deadline letsutil.TerminateIfErrorturn the failure into a fatal. The error therefore never surfaces — not as a warning, not as a fatal, not at all.Symptom
An api-server that logs three lines and then appears to hang forever:
Every misconfiguration reached through this path looks identical from the outside — an unresolvable database host, a wrong password, a driver pointed at the wrong engine — and identical to a slow but healthy start.
This is what made the other items in #13956 take hours to diagnose rather than seconds. It is the smallest change in that issue and, I would argue, the one with the best diagnostic return.
Change
Use
backoff.RetryNotify, matching thesql.Openretry immediately above it (client_manager.go:425), and include the database name and the next retry interval so a failing attempt names its own cause:This is logging only. The retry policy, the backoff parameters, and the eventual
util.TerminateIfErrorare all unchanged — no behavioural difference beyond the log line.Testing
initDBDriveropens real database connections and terminates the process on failure, so it has no unit tests today and this PR does not add any; the change is a logging call inside that function.Verified locally:
go build ./src/apiserver/...— passesgo vet ./src/apiserver/client_manager/— passesgo test ./src/apiserver/client_manager/—ok ... 7.251sgofmt— cleanNote for anyone reproducing: the
storagepackage needsCGO_ENABLED=1, sinceSQLiteDialect.IsDuplicateErrorusesmattn/go-sqlite3, which only exposessqlite3.Errorandsqlite3.ErrConstraintunder cgo.Scope
This is deliberately one item from #13956, kept separate so it can be reviewed on its own. The manifest items (3–6) are in #13958. The storage-layer items (1 and 2) need a design decision and are discussed in #13956 (comment).