Skip to content

A checkpoint write that fails with checkpoints_pending at or above checkpoint_threshold is retried on every later ack #80

Closed

Description

@vheathen

After a checkpoint write fails with checkpoints_pending at or above checkpoint_threshold, each later ack that moves the checkpoint retries the write until one succeeds. Since #71, write_checkpoint/1 keeps checkpoints_pending after a failed write, so each further ack that moves the checkpoint leaves it at or above the threshold in maybe_persist_checkpoint/1. Before #71 the count went back to 0, so the next write triggered by an ack waited until another checkpoint_threshold events had moved the checkpoint, though a checkpoint_after timer could write sooner.

Severity: low: the recorded position stays right; while writes keep failing, each ack costs an extra write attempt and a warning. Likelihood: low: it needs checkpoint_threshold above 1 and checkpoint writes that fail while the lock session stays healthy.

NodeA owns subscription S with checkpoint_threshold: 3 and 10 events in flight. The database turns read-only while NodeA's lock session stays up, and the subscriber keeps acking the events it already holds.

I ran that through the public API. I acked events 1 and 2 while the database was healthy, then ran ALTER DATABASE ... SET default_transaction_read_only = on, terminated the main pool's backend so its new session picks the setting up, left the lock session alone, and acked events 3 to 10 one at a time. At a2ce825 each of acks 3 to 10 made a write attempt, 8 attempts and 8 Failed to ack last seen event warnings with read_only_sql_transaction (3 of 3 runs). At 383d9df, just before #71, attempts came only on acks 3, 6 and 9, with 3 warnings (2 of 2). Every ack replied :ok within 4 ms. A test on the FSM with threshold 5 and a failing schema agrees: a checkpoint followed by three acks made 4 write attempts at a2ce825 (3 of 3) and 1 at 383d9df.

It needs checkpoint_threshold above 1 (with the default of 1, every ack wrote before #71 too) and checkpoint writes that fail while the lock session stays healthy, as when the database turns read-only, the disk fills up, or the role loses UPDATE. A failover that drops connections also ends the lock session, and the disconnect resets checkpoints_pending to 0, which stops the extra writes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions