Skip to content

ADR-0015 — copy_thread refuses a destination that has rows

  • Status: Accepted
  • Date: 2026-11-12
  • Supersedes: none
  • Authors: project maintainers

Context

copy_thread copies every row of a thread, patches as patches, in one statement. Copying into a thread that already has checkpoints would interleave two histories, and two concurrent copies to one destination could do the same.

Decision

copy_thread will refuse a destination that already has rows with ValueError. Of concurrent copies to one destination exactly one wins; the others get ValueError.

Alternatives considered

  • Merge into the destination — rejected: the result is neither thread's history.
  • Replace the destination — rejected: a copy should not delete data the caller did not name.

Consequences

  • A caller who wants to overwrite deletes the destination first.
  • A destination left with no checkpoint but still holding values that a lifecycle operation kept is refused until it is deleted (architecture.md §7).

References

  • src/open_postgres_checkpointer/aio.py (acopy_thread)