SQLite resilience updates.#298
Merged
Merged
Conversation
SQLite fails transiently (SQLITE_BUSY, SQLITE_LOCKED) when a competing transaction holds the database lock for longer than the driver's busy timeout, and the persist layer surfaced those failures immediately. withSerializableTx, the single choke point every write flows through, now retries the whole begin-execute-commit cycle with exponential backoff for transient errors, while permanent errors still surface on the first attempt. Transient detection unwraps the error chain and matches the driver's typed busy/locked codes, so SDKError-wrapped failures are recognized. The previously unused SPIKE_NEXUS_DB_OPERATION_TIMEOUT (default 15s, already documented in the configuration table) now bounds the DB path as a context deadline: it caps the write retry window and applies to the four read entry points (LoadPolicy, LoadAllPolicies, LoadSecret, LoadAllSecrets). Reads keep relying on WAL mode and the busy_timeout DSN parameter for lock handling. Unit tests cover transient detection through wrapped chains, retry-then-succeed, permanent-error-no-retry, and deadline bounding. Spec: TBD Signed-off-by: Volkan Özçelik <volkan.ozcelik@broadcom.com>
File two follow-ups discovered during this week's work: the Pilot prints normal output to stderr (cobra's Print family defaults to OutOrStderr and the root command never calls SetOut, so `spike secret get x > file.txt` yields an empty file), and the sqlite state tests use the real ~/.spike/data/spike.db, deleting the live dev environment's database whenever `make test` runs alongside it. Close the Bootstrap keeper-wait task as stale: the SDK retry migration already bounded every keeper interaction (retry.WithMaxAttempts with a per-keeper context timeout and configurable backoff in app/bootstrap/internal/net/dispatch.go; WithMaxElapsedTime bounds init verification in broadcast.go). Annotate the env-accessor task: the log.FatalLn-calling accessors now live in spike-sdk-go config/env, so the sentinel-error refactor is an upstream SDK change, and the in-repo share is adapting callers once the SDK ships it. Close the sqlite retry task and the DatabaseOperationTimeoutVal wiring task, both delivered by the previous commit. Spec: TBD Signed-off-by: Volkan Özçelik <volkan.ozcelik@broadcom.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.