Skip to content

Return result instead of exception#2

Open
mostlyobvious wants to merge 10 commits into
masterfrom
result
Open

Return result instead of exception#2
mostlyobvious wants to merge 10 commits into
masterfrom
result

Conversation

@mostlyobvious
Copy link
Copy Markdown
Owner

  • result carries position of last appended (success) or last seen event (failure due to matching fail_if), which greatly helps in retries and continued appends without additional query
  • serialization error surfaces only after certain threshold, adjustable to concurrency

- Replace append-condition exceptions with explicit success and failure
  result values so callers can branch without relying on control flow.
- Return append status from the SQL append function to distinguish normal
  condition failures from serialization failures.
- Retry serialization failures in the repository and raise a library-level
  error only after retry exhaustion.
- Update adapter contracts, benchmarks, documentation, and tests for the new
  append result API.
- Use a domain-specific error name that describes the actual failure:
  append retries were exhausted after serialization conflicts.
- Make append serialization retries configurable so applications can tune
  contention handling for their workload.
- Raise the default retry count to 9 to allow ten total attempts before
  surfacing an append-retries-exhausted error.
- Include the last appended event position in successful append results so
  callers can continue from the write boundary without issuing a read.
- Return the position from the SQL append result alongside the status to keep
  the Ruby result derived from the database write.
- Preserve nil for successful empty appends because no event position is
  created in that case.
- Return a successful append result without opening a transaction when there
  are no events to write.
- Avoid invoking append-condition checks for empty writes because no database
  state can change.
- Include the last matching fail-if event position in failure results so
  callers can refresh their read boundary after a conditional append loses.
- Derive the position in the append SQL function so the reported boundary is
  consistent with the append-condition check.
- Use the failure result position when retrying conditional append benchmark
  writes so retries do not need a follow-up read to find the new boundary.
- Keep benchmark contention behavior aligned with the public append result API.
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.

1 participant