Skip to content

check: main counts for the restructure's pinned rows (do not merge) - #197

Closed
okomarov wants to merge 3 commits into
mainfrom
check/73-main-counts
Closed

okomarov wants to merge 3 commits into
mainfrom
check/73-main-counts

Conversation

@okomarov

Copy link
Copy Markdown

Temporary check of three tests against main. Close without merging.

…cancel and build failure in it

dd-trace and Sentry rewrite and wrap the driver by shape, and npm run
test:tracing, which packs the fork and compares the spans against Postgres.js
3.4.9, was only ever run by hand. It now runs as a job on every pull request,
and a release waits for it like it waits for the test jobs.

The comparison had no COPY scenario, but dd-trace ends a COPY span on the
second resolve of the query, so a change that settles a query once would leave
every COPY span open and nothing would notice. The harness gains COPY in and
out, a query cancelled before it is sent and a query that fails to build, the
paths the request lifecycle restructure (#73) touches.
The restructure of the pool and query side must not change behaviour, so these
tests assert what main does today on real PostgreSQL, including paths that look
wrong. They pass on main and are the reference the refactor commits are held
to.

The query's resolve and reject are counted with a spy. The counts pin current
behaviour: COPY in and out resolve twice (the stream, then the result, which
dd-trace relies on), sql`begin` on a pool resolves after it rejected with
UNSAFE_TRANSACTION, and a query cancelled before it is awaited rejects once at
max: 2 and three times at max: 1, where the refused statement is written and
the server's reply to it also trips BindComplete on the unbuilt statement. The
restructure settles each query once except COPY, so the later commit changes
those entries in one table at the top of the group.

A query cancelled before it is awaited is still routed when it is awaited. It
is never built and the pool keeps working. An idle connection is filed busy
afterwards, while a connection that was still closed opens idle. This is pinned
for max: 1 and max: 2, warm and cold, so a later fix shows up as a deliberate
change.

Also covered: a reservation queued behind plain queries on a connection that is
still opening gets it after them, and close() during the first query's
connection start runs that query and lets the next one reopen.
@okomarov

Copy link
Copy Markdown
Author

Check finished: main matches.

@okomarov okomarov closed this Oct 25, 2026
@okomarov
okomarov deleted the check/73-main-counts branch October 25, 2026 21:38
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