Repository navigation
perf: one-statement claims, a partial pending index, ack ids from row ids - #13
Merged
Merged
Conversation
… ids Claims and pops are one UPDATE/DELETE ... RETURNING statement, sorted back into queue order. Queue order is id (priority, id for priority queues), not created_at. Opening a table drops the four v0.2 indexes and creates one partial index on pending rows. The ack id is the row id; acks match only processing rows, so garbage, v0.2 cuids and repeat acks return false. Statements are prepared once per handle, the pool keeps 8 idle connections, and lucsky/cuid is gone.
SQLite keeps tables and indexes in one namespace. With the index named <name>_pending, a single file could not hold queues orders and orders_pending: whichever opened second failed. The index is now <name>__sqliteq_pending.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #12 (
feat/v03-api). Second of five for sqliteq v0.3.0.What changes
UPDATE/DELETE ... RETURNINGstatement, sorted back into queue order. It replaces the select-then-update transaction.priority, idfor priority queues) instead ofcreated_at.<name>__sqliteq_pending. The suffix keeps index names from colliding with queue names, since SQLite keeps tables and indexes in one namespace.lucsky/cuiddependency is gone.v0.2.x files migrate on open: their data is kept and the index swap is idempotent. The tests include a v0.2.3 file fixture.
Tests
go test -race ./...passes. New tests cover the migration from a v0.2.3 file, the index-name collision and concurrent claims without duplicates.Fixes #6
Fixes #7