One servlet filter, two interchangeable stores, 18 tests (9 scenarios x 2 stores) against a real redis-server 7.0.15 and PostgreSQL 16.15, and 20 captured transcripts under output/: replay, 422 on a changed body, concurrent duplicates, expiry, the crash window and a handler slower than the lock. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b5yg8grY17JsVAJviV
21 lines
721 B
SQL
21 lines
721 B
SQL
CREATE TABLE IF NOT EXISTS payments (
|
|
id BIGSERIAL PRIMARY KEY,
|
|
customer TEXT NOT NULL,
|
|
amount BIGINT NOT NULL,
|
|
currency CHAR(3) NOT NULL,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
);
|
|
|
|
-- Used only when idempotency.store=postgres.
|
|
CREATE TABLE IF NOT EXISTS idempotency_keys (
|
|
idem_key TEXT PRIMARY KEY,
|
|
fingerprint CHAR(64) NOT NULL,
|
|
status TEXT NOT NULL,
|
|
response_status INT,
|
|
content_type TEXT,
|
|
response_body TEXT,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
expires_at TIMESTAMPTZ NOT NULL
|
|
);
|
|
CREATE INDEX IF NOT EXISTS idempotency_keys_expires_at ON idempotency_keys (expires_at);
|