feat(go-collector): migrate with CREATE TABLE IF NOT EXISTS (SQLR-11) - #173
Merged
Merged
Conversation
Tables are now idempotent on every open. CREATE INDEX stays gated on sqlrite_master so reopen under MVCC does not re-issue it.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
marvin-agent-rockflow
approved these changes
Sep 19, 2026
marvin-agent-rockflow
left a comment
Collaborator
There was a problem hiding this comment.
Hermes Agent Review
Head: 25e681c · Files: 3 · +128 / -82
Verdict: Approve
Critical
- None.
Warnings
- None that should block merge.
wasm-buildis red on this SHA; this PR only touchesexamples/go-collector/**, so treat that as unrelated/pre-existing unless it is a required check onmain.
Suggestions
indexExistsstill treats any query error as “index absent” (same shape as the oldtableExistsprobe). Distinguishingsql.ErrNoRowsfrom catalog/driver failures would surface a realsqlrite_masterproblem instead of falling through toCREATE INDEX(which then fails under persisted MVCC with a less useful error). Fine for this example; not a merge blocker.- README now has two adjacent rows that both describe
CREATE INDEXvs MVCC. Could collapse to one row.
Looks good
CREATE TABLE IF NOT EXISTSon every open matches SQLR-10/SQLR-11; no moreSELECT id FROM <t>existence probe.- Optional
CREATE INDEX idx_events_devicestays gated onsqlrite_masterand still runs beforePRAGMA journal_mode = mvcc. - Identifier interpolated via
quoteText(constant name today). TestMigrateIdempotentFreshAndReopencovers fresh + reopen × concurrent/serialized × ±index; reopen success is the MVCC regression.- go-collector CI jobs (ubuntu + macos) passed.
Automated hourly review by marvin-agent-rockflow (Hermes). Will re-review only if new commits land.
arthur-dent-agent
left a comment
Collaborator
Author
There was a problem hiding this comment.
Hermes Agent Review
Head: 25e681c · Files: 3 · +128 / -82
Verdict: Comment
Own PR (arthur-dent-agent) -- COMMENT only. Independently this HEAD would be Approve.
Critical
- none
Warnings
- none
Suggestions
- Concurrent reopen with
Indexed=trueafter a first open that never createdidx_events_devicewill still runCREATE INDEXwhilejournal_mode = mvccis already persisted, andOpenfails. The old SELECT-probe never issued DDL on reopen, so the flag flip was a no-op. The new matrix only covers matching flags. README notes that a flip does not drop an existing index; it does not say false-to-true errors. Cheap follow-up: skipCREATE INDEXwhen the catalog query fails or whenjournal_modeis already mvcc, and add one concurrent false-then-true case. indexExiststreats everyQueryRowerror as absent (including a catalog miss). That is the right skip forErrNoRows; any other error then falls through toCREATE INDEXand fails migrate anyway. DistinguishingErrNoRowswould make a real catalog failure obvious.
Looks good
CREATE TABLE IF NOT EXISTSforevents/devices/upload_runson every open; theSELECT id FROM events LIMIT 1gate is gone.idx_events_deviceis issued only whensqlrite_masterdoes not list it, viaquoteText, and still beforePRAGMA journal_mode = mvcc.TestMigrateIdempotentFreshAndReopencovers fresh + reopen x concurrent/serialized x +/- index, including a post-reopen insert.- README constraint table matches the new idiom.
Automated hourly review by arthur-dent-agent (Hermes). Will re-review only if new commits land.
This branch was successfully deployed
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.
Summary
SQLR-11: the go-collector example still probed for
eventswithSELECT id FROM <t> LIMIT 1and gated all DDL on that, even though SQLR-10 madeCREATE TABLE IF NOT EXISTSa no-op and exposedsqlrite_master.migrate()now runsCREATE TABLE IF NOT EXISTSforevents/devices/upload_runson every open.CREATE INDEX idx_events_deviceis issued only whensqlrite_masterdoes not already list it, and still beforePRAGMA journal_mode = mvcc(CREATE INDEX is rejected under MVCC; there is noIF NOT EXISTSescape).TestMigrateIdempotentFreshAndReopencovers fresh + reopen × concurrent/serialized × ±index.MarvinApp: SQLR-11
Test Plan
go test ./... -count=1inexamples/go-collector(store/server/uploader)go vet ./...go buildcollector + loadgenmake run/ loadgen smoke against a file that is created then reopened