Commit Graph
2 Commits
Author SHA1 Message Date
Chris LuandClaude Opus 5.5 ca09dae400 filer/postgres: postgres and postgres2 share their connection setup (#13252)
* filer/store_test: conformance suite for filer stores

Entries in and out of buckets, byte-ordered and prefixed listings,
key-value records, transactions, bucket tables and the snapshot scan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* filer: run postgres2 and mysql2 through the conformance suite

RUN_POSTGRES_TESTS and RUN_MYSQL_TESTS enable them, as RUN_REDIS_TESTS
does the Redis stores; each test gets a schema or database of its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* ci: give the go test job Postgres and MySQL services

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* filer/sql: generators bind the arguments of row statements

Insert, update, find and delete now take the row key and return their
arguments with the query, so a generator decides how a key maps to its
columns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* filer/sql: generators bind the arguments of directory statements

Listing and deleting a directory's children take the directory and return
their arguments with the query.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* filer/sql: batch lookup takes row keys and matches rows by name and directory

A key-value key's directory column already determines its dirhash, so the
batch read no longer selects dirhash to match its rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* filer/postgres: build the connection string with pgxutil.BuildDSN

The credential store already does; it quotes values per libpq, so a
password or certificate path with spaces or quotes no longer breaks the
connection string. The OpenPGXDB alias has no callers left.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* filer/sql: scan pages take the row key of the last row as their cursor

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* filer/postgres: postgres and postgres2 share their connection setup

ReadConnection reads the settings and their defaults, Connection.Open
opens the store's pools.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* filer/sql: test the arguments each generator binds

Each statement's arguments must match its placeholders in count and
column. Check them for every generator method, including the Postgres
UPDATE whose parameters are now numbered key first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* filer/postgres: escape the table name inside its quotes

A double quote in it is doubled, as PostgreSQL reads a quoted identifier.
Bucket names cannot hold one; the statements no longer rely on that.
Reported by CodeQL (go/unsafe-quoting) on the lines this branch changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* filer/postgres: keep the nameExpr doc comment on nameExpr

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 03:46:57 -08:00
Chris LuandClaude Opus 5.5 9e4e1ade67 filer: conformance suite for filer stores, run against Postgres and MySQL in CI (#13250)
* filer/store_test: conformance suite for filer stores

Entries in and out of buckets, byte-ordered and prefixed listings,
key-value records, transactions, bucket tables and the snapshot scan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* filer: run postgres2 and mysql2 through the conformance suite

RUN_POSTGRES_TESTS and RUN_MYSQL_TESTS enable them, as RUN_REDIS_TESTS
does the Redis stores; each test gets a schema or database of its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* ci: give the go test job Postgres and MySQL services

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* filer/store_test: create the shared fixtures before the subtests

The scan and delete-folder-children subtests read the order directory that
only the list subtest created, so selecting either one with -run failed on
a conforming store.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* filer/store_test: roll back a transaction an assertion abandons

A failed assertion between BeginTransaction and the commit left the
transaction open with its locks, and the cleanup's DROP SCHEMA then waited
on them until the go test timeout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* filer/store_test: check limited listings without trimming the result

The limit-1 checks sliced the listing to one name, so a store that ignored
the limit passed, and one that returned nothing panicked. Allow only the one
look-ahead entry the SQL stores return and compare the first name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* filer/store_test: give the exclusive limit check three eligible names

Starting after a%b left only two names under the prefix, so a store that
ignored the limit still met the one look-ahead bound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* filer/store_test: check that a bucket drop removes nested entries

A store that reports CanDropWholeBucket gets no recursive walk from the
filer, so its DeleteFolderChildren on the bucket has to remove every
descendant. With only a direct child in bkt2, a store that deleted the
direct children and kept the table passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 00:13:02 -08:00