hood: fix update ordering

When we receive the %mere gift from clay, the kernel has not yet been
reloaded. This means any attempts to bump desks will fail, as they will
be bumped against the old kernel. Rectifies this by continuing the %base
desk update flow in +on-load, instead of +take-merge-main. Also adds a
wef=(unit weft) to the state in order to discriminate whether or not the
kernel has just been reloaded
This commit is contained in:
Liam Fitzgerald 2021-09-07 14:37:36 +10:00
parent 83be5162ed
commit 39a9ed4faa
3 changed files with 61 additions and 18 deletions

View File

@ -2,8 +2,8 @@
/+ drum=hood-drum, helm=hood-helm, kiln=hood-kiln /+ drum=hood-drum, helm=hood-helm, kiln=hood-kiln
|% |%
+$ state +$ state
$~ [%18 *state:drum *state:helm *state:kiln] $~ [%19 *state:drum *state:helm *state:kiln]
$>(%18 any-state) $>(%19 any-state)
:: ::
+$ any-state +$ any-state
$% [ver=?(%1 %2 %3 %4 %5 %6) lac=(map @tas fin-any-state)] $% [ver=?(%1 %2 %3 %4 %5 %6) lac=(map @tas fin-any-state)]
@ -19,6 +19,7 @@
[%16 drum=state-4:drum helm=state:helm kiln=state-3:kiln] [%16 drum=state-4:drum helm=state:helm kiln=state-3:kiln]
[%17 drum=state-4:drum helm=state:helm kiln=state-4:kiln] [%17 drum=state-4:drum helm=state:helm kiln=state-4:kiln]
[%18 drum=state-4:drum helm=state:helm kiln=state-5:kiln] [%18 drum=state-4:drum helm=state:helm kiln=state-5:kiln]
[%19 drum=state-4:drum helm=state:helm kiln=state-6:kiln]
== ==
+$ any-state-tuple +$ any-state-tuple
$: drum=any-state:drum $: drum=any-state:drum

View File

@ -5,7 +5,8 @@
=, format =, format
=* dude dude:gall =* dude dude:gall
|% |%
+$ state state-5 +$ state state-6
+$ state-6 [%6 pith-6]
+$ state-5 [%5 pith-5] +$ state-5 [%5 pith-5]
+$ state-4 [%4 pith-4] +$ state-4 [%4 pith-4]
+$ state-3 [%3 pith-3] +$ state-3 [%3 pith-3]
@ -14,13 +15,32 @@
+$ state-0 [%0 pith-0] +$ state-0 [%0 pith-0]
+$ any-state +$ any-state
$~ *state $~ *state
$% state-5 $% state-6
state-5
state-4 state-4
state-3 state-3
state-2 state-2
state-1 state-1
state-0 state-0
== ==
::
+$ pith-6
$: wef=(unit weft)
rem=(map desk per-desk) ::
syn=(map kiln-sync let=@ud) ::
ark=(map desk arak) ::
commit-timer=[way=wire nex=@da tim=@dr mon=term] ::
:: map desk to the currently ongoing fuse request
:: and the latest version numbers for beaks to
fus=(map desk per-fuse)
:: used for fuses - every time we get a fuse we
:: bump this. used when calculating hashes to
:: ensure they're unique even when the same
:: request is made multiple times.
hxs=(map desk @ud)
== ::
::
+$ pith-5 +$ pith-5
$: rem=(map desk per-desk) :: $: rem=(map desk per-desk) ::
syn=(map kiln-sync let=@ud) :: syn=(map kiln-sync let=@ud) ::
@ -253,13 +273,19 @@
|= a=arak-4 |= a=arak-4
^- arak ^- arak
[[paused=| ship desk aeon] next rein]:a [[paused=| ship desk aeon] next rein]:a
=? old ?=(%5 -.old)
[%6 ~ +.old]
:: ::
?> ?=(%5 -.old) ?> ?=(%6 -.old)
=. +<+.$.abet old =. +<+.$.abet old
=< abet =< abet
?~ old-ota =? kiln ?=(^ old-ota)
kiln
abet:(install:vats %base [her sud]:u.old-ota) abet:(install:vats %base [her sud]:u.old-ota)
=? kiln ?=(^ wef)
=/ except=(set desk) (sy %base %kids ~)
(bump:vats u.wef (all-desks-but:vats except) %.n)
=. wef ~
kiln
:: ::
++ on-peek ++ on-peek
|= =path |= =path
@ -479,7 +505,7 @@
=/ ded (find-blocked kel except) =/ ded (find-blocked kel except)
?: force ?: force
=. kiln (suspend-many ded) =. kiln (suspend-many ded)
(bump-many kel (all-desks-but except)) (bump-many kel (all-desks-but (~(uni in except) ded)))
?: =(~ ded) ?: =(~ ded)
(bump-many kel (all-desks-but except)) (bump-many kel (all-desks-but except))
=- (^emit (pyre:pass leaf/- ~)) =- (^emit (pyre:pass leaf/- ~))
@ -496,6 +522,7 @@
|= dead=(set desk) |= dead=(set desk)
^+ kiln ^+ kiln
=/ ded ~(tap in dead) =/ ded ~(tap in dead)
|- ^+ kiln |- ^+ kiln
?~ ded kiln ?~ ded kiln
$(ded t.ded, kiln abet:(suspend i.ded)) $(ded t.ded, kiln abet:(suspend i.ded))
@ -598,9 +625,19 @@
(emil sync-ud:pass (diff:give diff) ~) (emil sync-ud:pass (diff:give diff) ~)
?: (lth num.new-weft num.old-weft) ?: (lth num.new-weft num.old-weft)
~> %slog.0^leaf/"kiln: future version {<new-weft>}, enqueueing" ~> %slog.0^leaf/"kiln: future version {<new-weft>}, enqueueing"
:: retry upgrade if not blocked anymore
=/ base=arak (~(got by ark) %base)
=. next.rak (snoc next.rak [(dec aeon.rail.rak) new-weft]) =. next.rak (snoc next.rak [(dec aeon.rail.rak) new-weft])
=. ark (~(put by ark) loc rak)
=/ =diff [%block loc rak new-weft blockers=(sy %base ~)] =/ =diff [%block loc rak new-weft blockers=(sy %base ~)]
(emil sync-ud:pass (diff:give diff) ~) =. vats (emil sync-ud:pass (diff:give diff) ~)
?. &(?=(^ next.base) =(~ (get-blockers weft.i.next.base)))
vats
~> %slog.0^leaf/"kiln: unblocked system update, updating"
=. kiln
(bump-one weft.i.next.base %base)
vats
::
~> %slog.0^leaf/"kiln: merging into {here}" ~> %slog.0^leaf/"kiln: merging into {here}"
=. next.rak +:(crank-next %& (dec aeon.rail.rak)) =. next.rak +:(crank-next %& (dec aeon.rail.rak))
(emil ~[merge-main sync-ud]:pass) (emil ~[merge-main sync-ud]:pass)
@ -617,6 +654,9 @@
(emil sync-ud:pass (diff:give diff) ~) (emil sync-ud:pass (diff:give diff) ~)
~> %slog.0^leaf/"kiln: applying OTA to {here}, kelvin: {<new-weft>}" ~> %slog.0^leaf/"kiln: applying OTA to {here}, kelvin: {<new-weft>}"
=. next.rak +:(crank-next %& (dec aeon.rail.rak)) =. next.rak +:(crank-next %& (dec aeon.rail.rak))
=. wef
?: =(old-weft new-weft) ~
`new-weft
(emil ~[merge-main sync-ud]:pass) (emil ~[merge-main sync-ud]:pass)
:: ::
++ take-merge-main ++ take-merge-main
@ -639,8 +679,7 @@
(update-running-apps (get-apps-diff our loc now rein.rak)) (update-running-apps (get-apps-diff our loc now rein.rak))
?. =(%base loc) ?. =(%base loc)
vats vats
=/ except=(set desk) (sy %base %kids ~) ~> %slog.0^leaf/"kiln: bumping {<zuse>}"
=. kiln (bump-many zuse/zuse (all-desks-but except))
(emit merge-kids:pass) (emit merge-kids:pass)
:: ::
++ take-merge-kids ++ take-merge-kids
@ -774,7 +813,10 @@
:: ::
++ poke-bump ++ poke-bump
|= [except=(set desk) force=?] |= [except=(set desk) force=?]
=/ kel=weft zuse/+(zuse) =/ =arak
(~(got by ark) %base)
=/ kel=weft
?~(next.arak zuse+zuse weft.i.next.arak)
abet:(bump:vats kel except force) abet:(bump:vats kel except force)
:: ::
++ poke-cancel ++ poke-cancel

View File

@ -202,11 +202,11 @@
kelvin+(numb num.w) kelvin+(numb num.w)
== ==
:: ::
++ woof ++ rung
|= =rung |= r=^rung
%- pairs %- pairs
:~ aeon+(numb aeon.rung) :~ aeon+(numb aeon.r)
weft+(weft weft.rung) weft+(weft weft.r)
== ==
:: ::
++ rein ++ rein
@ -222,7 +222,7 @@
:~ ship+s+(scot %p ship.rail.a) :~ ship+s+(scot %p ship.rail.a)
desk+s+desk.rail.a desk+s+desk.rail.a
aeon+(numb aeon.rail.a) aeon+(numb aeon.rail.a)
next+a+(turn next.a woof) next+a+(turn next.a rung)
rein+(rein rein.a) rein+(rein rein.a)
== ==
-- --