Skip to content

[release-0.16] pgsql: retry writes that collide with a gap fill - #862

Merged
brandond merged 1 commit into
k3s-io:release-0.16from
brandond:fix-postgres-gap-create_release-0.16
Dec 1, 2026
Merged

brandond merged 1 commit into
k3s-io:release-0.16from
brandond:fix-postgres-gap-create_release-0.16

Conversation

@brandond

@brandond brandond commented Dec 1, 2026

Copy link
Copy Markdown
Member

@brandond
brandond requested a review from a team as a code owner December 1, 2026 00:50
* pgsql: retry writes that collide with a gap fill

A poller can fill an ID before the writer that reserved it inserts its
row. Ignoring the primary-key conflict lets a create report success
without storing its key.

Limit append conflict handling to (name, prev_revision) and retry a
kine_pkey collision in a fresh read-committed transaction after rollback.
Cover the acknowledged revision and value through the etcd API.

Signed-off-by: Sambhav Kothari <sambhavs.email@gmail.com>

* logstructured: only acknowledge creates that wrote a revision

Report an unavailable write when a skipped insert is followed by an empty
lookup. Preserve the revision returned by a successful recreate after a
delete, even when another key advances the log.

Signed-off-by: Sambhav Kothari <sambhavs.email@gmail.com>

* pgsql: use one conflict clause for appends and gap fills

Treat an occupied revision as a completed fill while preserving the
writer's row. Return other fill errors. Exercise the writer-first case
against PostgreSQL alongside the existing poller-first regression.

Signed-off-by: Sambhav Kothari <sambhavs.email@gmail.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>

---------

Signed-off-by: Sambhav Kothari <sambhavs.email@gmail.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit cd1504b)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
@brandond
brandond force-pushed the fix-postgres-gap-create_release-0.16 branch from d165b6a to 5cc6773 Compare December 1, 2026 00:51
@brandond brandond changed the title [release-0.16] pgsql: retry writes that collide with a gap fill (#858) [release-0.16] pgsql: retry writes that collide with a gap fill Dec 1, 2026
@brandond
brandond merged commit 5040a3a into k3s-io:release-0.16 Dec 1, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants