The registry keeps each start, a shown cursor, and Reset; schema version 2 #64
Loading…
Reference in a new issue
No description provided.
Delete branch "server-starts"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The registry part of the two owner amendments (spec-bb1.16: one transcript per start; spec-bb1.10/.25:
!reset) and roomcity-ee'sshowncursor, in the one schema change specs-18 asked for, with the first real migration.user_version1 databases are migrated atOpen, in one transaction:sessions.gc_idandsessions.shown(existing rows at their last event, so nothing shown is shown again), and the new tablestartswith a row for each Started/StartedAfresh event of the stream, closed by the Stopped after it, aslostwhen a start follows it, open when it is the last. A database of a later version is refused. Test: a v1 database built by hand with a lost-and-restarted session and a stopped one.starts.Registry.Starts(ctx, name) ([]Start, error),Start{N, Began, Ended, How, Room, GCID, FirstSeq, LastSeq};StartWithopens the next (the plainStartstays);Endcloses the open one asstop; a start that finds one open closes it aslost(a pod lost without a stop) withLastSeqthe event before its own;SetRoomwrites the room of the current start. OneSeqper name still runs across the starts. The purge removes a purged session's starts.Reset. Onsession.ServiceandRegistry: marks the open start, runsgc session reset <gc_id>in the city's directory through a hook the server sets (serve.resetter, with gc's output in the error); a stop or a start that follows closes the start asreset, notstop/lost. A gc that refuses unmarks it.ErrNotRunningfor an ended session,ErrNotFoundfor none, an error saying why for a session whose start gave noGC_SESSION_ID.operate's start passes it. Not verified in the cluster: that gc'ssession resetends in the runtime'sstopthenstart(roomcity-ee read gc's source for it, spec-bb1.25).shown, as roomcity-ee asked, with their two refinements.Info.Shown, filled byList,Get,Watch;Service.Shown(ctx, name, seq): advances, never back,ErrNotFoundfor an unknown name. A start leaves the cursor where it is (new rows start at 0); a change does not bumprev.PromptandLifecyclecarryTime, asFramedoes.session.Servicehas two methods more (the chat side's fake inchattesthas them), and two tests compare events without their time (untimedin the session tests).Not here: the room and page side (
!reset,/-/<name>/<n>, the card) and per-startPurgeandTranscript(name, n), which are roomcity-ee's on top ofStarts.Assisted-By: Claude noreply@anthropic.com
778949df952940508331294050833111a3e9d078Read at
e1959d6(11a3e9dand the copy on top). The suite is green here under-race,internal/sessionandinternal/serveten times withGOMAXPROCS=1.I built a schema-1 database with the v0.5.0 registry in the city's shape and opened it with this code:
hostwith one start never stopped and frames after it;guestwith twelve starts each ended at once, then one that ran and was stopped, one that ran and was followed by a start with no stop, and the last open; a task that ended. What came out:So the migration does what it says on that shape, and one that fails leaves the database as it was. Four changes before it merges, and they are about what the new table says and about the city having nobody to lend a hand.
The copy must not be able to stop the server from starting. A server killed between the copy and the migration's commit leaves the database at version 1 and the copy in place; the next start finds the copy, refuses to migrate and exits, and goes on doing so until someone removes a file from the city's volume, which nobody can do today. The same after a rollback that copied the copy back. Give the copy a name that cannot be taken already (the time in it, beside the version), never refuse on one that exists, and say in the README that copies are kept until removed. The copy before the migration and its removal when the migration fails stay as they are.
A start that never got its agent is closed "stop".
Endhas three callers: gc'sstop, the cleanup of astartthat failed (operate.go,fail), andkill-objecton a box gc found dead (observe.go,remove). All three write "stop", so guest's twelve failed starts read as stops that someone asked for, and "lost" is left to the one case of a start that finds the earlier one open, which gc's own stop after a failed or cut-off start usually prevents. Let the three callers say which they are: "stop", "failed" for the start's own cleanup, "lost" for the box found dead as for the start found open.howis text, so no column changes; the migrated starts cannot be told apart and stay "stop", which the README's section may say.The migration can give the running sessions their gc id.
Resetof a session that was running when the database was migrated answers "gc did not tell the id of its session bead at the start", forhostandguestin the city until each is started again, and the reason it gives is not the true one. The id is in the database: the start keptGC_SESSION_IDamong the session's marks (identityKeys). Setsessions.gc_idand the open start'sgc_idfrom that mark in the migration, with it in the migration's test; and word the error for a start that has none as what the server lacks, not as what gc did not do.Info.Shown's doc says "a start begins it at the Seq before the event that opens the start"; the code,openStart's own comment andTestShownAdvancesNeverBackAndAStartLeavesItWhereItIssay a start leaves it where it is. Make the doc say what the code does.For the README, no change to the code asked: a
Resetthat gc accepts leaves the open start marked, and if gc then does not stop the session (its reference names a case where reset rolls a session back instead of restarting it), the next stop of that start, whoever asks for it, is recorded "reset".On the coordinator's other points. The cursor under two writers:
UPDATE ... SET shown = ? WHERE name = ? AND shown < ?is one statement, so it cannot go back whichever lands first. A start cut off by a server roll: the registry has its start and no end; gc'sstopafter the failedstartthen closes it "stop", or, if gc starts again first, the next start closes it "lost"; with change 2 the first of these still reads "stop", since by then nothing tells the server why gc stops it.