Skip to content

Retry queued transactions after transient connection loss - #4794

Open
Minecraft0122 wants to merge 1 commit into
plan-player-analytics:masterfrom
Minecraft0122:codex/database-outage-buffer
Open

Retry queued transactions after transient connection loss#4794
Minecraft0122 wants to merge 1 commit into
plan-player-analytics:masterfrom
Minecraft0122:codex/database-outage-buffer

Conversation

@Minecraft0122

Copy link
Copy Markdown

Summary

  • keep the current transaction at the head of Plan's single-threaded database queue when a transient/recoverable connection failure occurs
  • retry with bounded exponential backoff from 1 to 30 seconds so later transactions cannot overtake failed work
  • stop retrying promptly when the database is closing and preserve interruption status
  • recognize JDBC transient/recoverable exceptions and SQLState class 08, while excluding fatal and explicitly non-transient failures
  • replace recursive invalid-connection lookup in MySQLDB with a transient exception handled by the queue retry path

The buffer is intentionally in-memory for the lifetime of the running server process; this PR does not claim crash/restart persistence.

Tests

  • verifies transient exceptions through JDBC type and SQLState cause chains
  • verifies statement, fatal, and non-transient failures are not retried
  • verifies an invalid MySQL connection is closed and rejected after one pool lookup rather than recursing
  • verifies a temporarily failing transaction completes before the transaction queued behind it and the queue drains to zero
  • targeted tests and :common:checkstyleMain / :common:checkstyleTest pass locally

This is the temporary-database-outage portion of the closed #4772, split into a single-purpose PR as requested.

Closes #4727

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.

Support buffering data while the database is temporarily unavailable

1 participant