Skip to content

refactor(logging): Do not double log and do not classify errors#134

Merged
sbalabanov merged 1 commit into
mainfrom
logging
Mar 10, 2026
Merged

refactor(logging): Do not double log and do not classify errors#134
sbalabanov merged 1 commit into
mainfrom
logging

Conversation

@sbalabanov
Copy link
Copy Markdown
Contributor

  1. Remove logging from places where error is returned to avoid logging twice. Logging should be done at error chain termination point.
  2. Remove errs.NewRetryableError, we'll do classification later and the retried errors will be "opt in" by type, rather than everything.

@sbalabanov sbalabanov requested review from a team and behinddwalls as code owners March 10, 2026 02:38
@sbalabanov sbalabanov enabled auto-merge March 10, 2026 02:38
@sbalabanov sbalabanov added this pull request to the merge queue Mar 10, 2026
Merged via the queue into main with commit 6099cd2 Mar 10, 2026
11 checks passed
@behinddwalls behinddwalls deleted the logging branch March 10, 2026 17:37
behinddwalls added a commit that referenced this pull request May 21, 2026
## Summary
Stacked on top of #152 (change store extension).

Detects duplicate land requests by reading per-URI claims from the new
change store. The `start` controller writes a claim row for each URI on
the request; `validate` reads the change store and rejects requests
whose URIs overlap with another in-flight request in the same queue.

- **start.go** — after persisting the request, claim each URI in the
change store. `INSERT IGNORE` makes this idempotent on queue redelivery
(same `request_id` retry is a no-op).
- **validate.go** — query the change store for any row with an
overlapping URI in the same queue (excluding self). For each unique
candidate `request_id` returned, look up the request and skip
terminal/orphan owners. If any live owner remains, reject as a user
error naming the conflicting `request_id`.
- Two single-table queries per check, no cross-store SQL joins.
- Stop wrapping every storage error as `Retryable`; default is plain
`fmt.Errorf` per the `core/errs` framework + #134.
- Wires `changeStore` into both controllers in
`example/server/orchestrator/main.go`.

## Behavior

- **Overlap (not full-set equality):** the change store returns rows for
any URI in the new request that matches a row from another in-flight
request, so partial-overlap is rejected — addresses @sbalabanov's review
comment.
- **Liveness:** terminal-state owners and orphans (whose request row is
gone) are skipped, so stale claims don't block new requests
indefinitely.
- **Retries:** `start` tolerates `ErrAlreadyExists` from request
creation as a same-id replay; the change store's `INSERT IGNORE` is
idempotent for the same reason.

## Test Plan
- Unit tests for `start` and `validate` cover happy path,
overlap-with-live, overlap-with-terminal-skipped,
overlap-with-orphan-skipped, multi-URI-same-owner deduped, and
infra-error propagation.
- Existing integration tests on `extension/storage/mysql` continue to
pass after `GetActiveByQueue` removal.
- Change store integration test (in #152) exercises the MySQL impl
against a real DB.

## Issues

---------

Co-authored-by: Preetam Dwivedi <preetam@uber.com>
Co-authored-by: Preetam Dwivedi <behinddwalls@gmail.com>
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