Repository navigation
Conversation
Lag.Prepare never assigned `configured`, so every level re-ran the full writer setup and mixed writers were never rejected. With the blip writer, only the first level (in random map order) got report-no-heartbeat, so other levels reported -1 instead of dropping it. And the heartbeat reader was made before repl-check was set, so it never selected @@<repl-check> and report-not-a-replica did nothing. Prepare now sets up the writer once, from the first level, rejects a different writer at another level (an unset writer is auto), and sets the per-level options at every level. The reader gets repl-check from the level options. Document on blip.Collector.Prepare that a collector must release what it started before it returns an error, with the engine calling a returned cleanup func only as a backstop. Lag already did this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Prepare compared each level's raw writer option with the first level's, so a plan with no writer (auto) at one level and writer: blip at another failed to prepare. Plans have that because levels inherit options only from lower levels whose frequency divides theirs. Which side the error named also depended on map order. Now Prepare sets up the writer from the first level, by name, that sets pfs or blip, else it auto-detects once from the first level. Levels with no writer or auto use that writer. Only pfs at one level and blip at another is an error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Stop closed stopChan but didn't wait for run to return. If a heartbeat query was running, run reported status after the query returned, which could be after the monitor loader removed the monitor's status. The removed monitor then reappeared in the monitor status with one stale heartbeat-reader component. Stop now waits for run to return, without holding the lock that run uses to update lag. That takes up to ReadTimeout if a query is running. Start doesn't start a stopped reader, so Stop doesn't wait for a reader that never started, which happens when repl.lag stops the reader before its Start goroutine runs. TestReader now stops its reader. It leaked the reader, which raced with the next run's ReadErrorWait write under -count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been 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.
Stacked on #189.
Lag.Preparenever assignedconfigured, so its per-level loop had three bugs (all also onmain):report-no-heartbeat. Other levels reportedrepl.lag.current = -1instead of dropping it.repl-checkwas set, so it never selected@@<repl-check>andreport-not-a-replicadid nothing.Now
Preparesets up the writer once, from the first level (by name) that setspfsorblip, or else by auto-detecting once. Levels with nowriterorautouse that writer, because inheritance can leave them unset. Onlypfsat one level andblipat another is rejected, whatever the map order.Preparealso setsreport-no-heartbeat,report-not-a-replicaanddefault-channel-nameat every level. The reader getsrepl-checkfrom the level options.This also documents the cleanup-on-error contract on
blip.Collector.Prepare: a collector releases what it started before returning an error, and returns a nil cleanup. The engine call from #189 stays as a documented backstop.Lagalready did this.BlipReader.Stopnow waits for the reader to return (separate commit). Before, a heartbeat query running at stop could report status after the loader removed the monitor's status, and the removed monitor reappeared in/status/monitors. Stop can now block up toReadTimeout(2s).Monitor.Stop'sdb.Closealready waited for that query, so the wait moves earlier rather than adding time. It fits in #190's 3s default stop timeout, and exceeding that timeout only reportserror:stop. A reader stopped before itsStartgoroutine runs doesn't start, so Stop doesn't block on it.TestReadernow stops its reader.The new tests run without MySQL, except
TestPrepareAutoAndPFSOnMySQL80. Each fails on the oldPrepare.🤖 Generated with Claude Code