clay: fix kelvin upgrade issues

This commit is contained in:
Philip Monk 2022-09-14 01:04:13 -08:00
parent 44074ad33b
commit 77319d20c4
6 changed files with 141 additions and 84 deletions

View File

@ -793,6 +793,7 @@
$>(%vega vane-task) :: report upgrade
[%warp wer=ship rif=riff] :: internal file req
[%werp who=ship wer=ship rif=riff-any] :: external file req
[%wick ~] :: try upgrade
[%zest des=desk liv=zest] :: live
$>(%plea vane-task) :: ames request
== ::

View File

@ -397,6 +397,7 @@
%pork ::
%warp ::
%werp ::
%wick ::
== ::
task ::
== ::
@ -1696,7 +1697,7 @@
?> ?=(~ deletes)
=/ data=(map path (each page lobe))
(~(run by changes) |=(=cage &+[p q.q]:cage))
(park | &+[~ data] *rang)
(park | & &+[~ data] *rang)
::
=/ parent-tako=tako (aeon-to-tako:ze let.dom)
=/ data=(map path (each page lobe))
@ -1711,7 +1712,7 @@
(~(run by changes) |=(=cage &+[p q.q]:cage))
::
=/ =yuki [~[parent-tako] data]
(park | &+yuki *rang)
(park | & &+yuki *rang)
::
:: Unix commit
::
@ -1743,20 +1744,9 @@
:: TODO: needs to check tako in rang
::
++ park
|= [updated=? =yoki =rang]
=. ..park (park-main +<)
:: tell gall which agents to run
::
?- liv.dom
%dead ..park
%live goad
%next (emit hen %pass /park-next/[syd] %b %wait now)
==
::
++ park-main
=/ check-sane |
|^
|= [updated=? =yoki =rang]
|= [updated=? goat=? =yoki =rang]
^+ ..park
=: hut.ran (~(uni by hut.rang) hut.ran)
lat.ran (~(uni by lat.rang) lat.ran)
@ -1776,15 +1766,30 @@
:: find desk kelvin
::
=/ kel=weft (get-kelvin yoki)
?. |(=(%base syd) =(kel [%zuse zuse]))
?. ?| =(kel zuse+zuse)
?& =(%base syd)
%+ levy ~(tap by tore:(lu now rof hen ruf))
|= [=desk =zest wic=(set weft)]
?| =(%base desk)
!?=(%live zest)
(~(has in wic) kel)
==
==
==
=. wic.dom (~(put by wic.dom) kel yoki)
=? ..park !?=(%base syd) (emit hen %pass /park-wick %c %wick ~)
%- (slog leaf+"clay: wait-for-kelvin, {<[need=zuse/zuse have=kel]>}" ~)
..park
=. wic.dom (~(del by wic.dom) kel)
::
=/ old-yaki
?: =(0 let.dom)
*yaki
(aeon-to-yaki:ze let.dom)
=/ old-kel
?: =(0 let.dom)
zuse+zuse
(get-kelvin %| old-yaki)
=/ [deletes=(set path) changes=(map path (each page lobe))]
(get-changes q.old-yaki new-data)
~| [from=let.dom deletes=deletes changes=~(key by changes)]
@ -1868,7 +1873,8 @@
=. ..park wake:?:(mem (ergo 0 mum.res) ..park)
:: if upgrading kelvin and there's a commit-in-waiting, use that
::
=? ..park &(=(%base syd) !=(kel [%zuse zuse]))
:: XX delete old items from wic
=? ..park &(=(%base syd) !=(old-kel kel))
=/ desks=(list [=desk =dojo]) ~(tap by dos.rom)
=^ moves-1 ruf abet
=| moves-2=(list move)
@ -1883,10 +1889,18 @@
::
$(desks t.desks)
=/ den ((de now rof hen ruf) our desk.i.desks)
=^ moves-3 ruf abet:(park-main:den | u.wat *^rang)
=^ moves-3 ruf abet:(park:den | | u.wat *^rang)
=. moves-2 (weld moves-2 moves-3)
$(desks t.desks)
..park
:: tell gall which agents to run
::
?. goat
..park
?- liv.dom
%dead ..park
%live goad
%next (emit hen %pass /park-next/[syd] %b %wait now)
==
::
:: +is-kernel-path: should changing .pax cause a kernel or vane reload?
::
@ -2278,7 +2292,7 @@
^+ ..take-fuse
?~ merges
=. ..take-fuse (done-fuse clean-state %& ~)
(park | [%| next-yaki(p (flop parents))] rag)
(park | & [%| next-yaki(p (flop parents))] rag)
=/ [bec=beak g=germ] i.merges
=/ ali-dom=dome:clay (need (~(got by sto.fiz) bec))
=/ result (merge-helper p.bec q.bec g ali-dom `next-yaki)
@ -2359,7 +2373,7 @@
?~ mr
(done %& ~)
=. ..merge (done %& conflicts.u.mr)
(park | new.u.mr ~ lat.u.mr)
(park | & new.u.mr ~ lat.u.mr)
==
::
+$ merge-result [conflicts=(set path) new=yoki lat=(map lobe page)]
@ -3070,6 +3084,19 @@
(~(put by ren.dom) dude u.on)
==
::
:: Try to apply highest-versioned %base commit-in-waiting
::
++ wick
^+ ..park
?> ?=(%base syd)
=/ wis=(list [weft =yoki])
%+ sort ~(tap by wic.dom)
|= [a=[weft yoki] b=[weft yoki]]
(gth num.a num.b)
?~ wis
..park
(park | & yoki.i.wis *rang)
::
:: Cancel a request.
::
:: For local requests, we just remove it from `qyx`. For foreign requests,
@ -4686,7 +4713,7 @@
%park
=^ mos ruf
=/ den ((de now rof hen ruf) our des.req)
abet:(park:den | [yok ran]:req)
abet:(park:den | & [yok ran]:req)
[mos ..^$]
::
%pork
@ -4694,7 +4721,7 @@
=. pud.ruf ~
=^ mos ruf
=/ den ((de now rof hen ruf) our syd)
abet:(park:den & yoki *rang)
abet:(park:den & & yoki *rang)
[mos ..^$]
::
%perm
@ -4796,13 +4823,20 @@
cancel-request:den
(start-request:den for u.q.rif)
[mos ..^$]
::
%wick
=^ mos ruf
=/ den ((de now rof hen ruf) our %base)
abet:wick:den
[mos ..^$]
::
%zest
=^ m1 ruf
=/ den ((de now rof hen ruf) our des.req)
abet:(set-zest:den liv.req)
=^ m2 ruf abet:goad:(lu now rof hen ruf)
[(weld m1 m2) ..^$]
=^ m2 ..^$ $(wrapped-task [%wick ~])
=^ m3 ruf abet:goad:(lu now rof hen ruf)
[:(weld m1 m2 m3) ..^$]
::
%plea
=* her ship.req

View File

@ -65,7 +65,8 @@
(mergebase-hashes our syd now her.u.sink sud.u.sink)
=/ dek (~(got by tyr) syd)
=/ =foam (~(got by cone) our syd)
=+ [on of]=(skid ~(tap by ren.foam) |=([* ?] +<+))
=/ [on=(list [@tas ?]) of=(list [@tas ?])]
(skid ~(tap by ren.foam) |=([* ?] +<+))
=/ sat
?- zest.dek
%live "running"
@ -86,7 +87,7 @@
leaf/"source desk: {?~(sink <~> <sud.u.sink>)}"
leaf/"source aeon: {?~(sink <~> <let.u.sink>)}"
leaf/"kids desk: {?~(sink <~> ?~(kid.u.sink <~> <u.kid.u.sink>))}"
leaf/"pending updates: {<~(tap in wic.dek)>}"
leaf/"pending updates: {<`(list [@tas @ud])`~(tap in wic.dek)>}"
==
:: +report-kids: non-vat cz hash report for kids desk
::

View File

@ -42,7 +42,7 @@
++ on-init
^- (quip card _this)
:_ this
:~ ~(tire pass /tire) :: XX need to do this in +on-load
:~ ~(tire pass /tire)
(~(connect pass /eyre) [~ /] %docket)
(~(wait pass /init) (add 1 now.bowl))
(~(connect pass /eyre) [~ /apps] %docket)
@ -96,7 +96,7 @@
--
::
++ on-save !>(-.state(- %2)) :: XX
++ on-save !>(-.state)
++ on-poke
|= [=mark =vase]
^- (quip card _this)

View File

@ -2,16 +2,16 @@
/+ verb, dbug, default-agent, agentio
|%
+$ card card:agent:gall
+$ state-0 [%0 lagging=_|]
+$ state-1 [%1 lagging=_|]
::
++ lag-interval ~m10
--
%+ verb |
%- agent:dbug
^- agent:gall
=| state-0
=| state-1
=* state -
=<
=<
|_ =bowl:gall
+* this .
def ~(. (default-agent this %|) bowl)
@ -21,12 +21,22 @@
++ on-init
^- (quip card _this)
:_ this
[onboard watch:kiln check:lag ~]:cc
[onboard tire:cy check:lag ~]:cc
::
++ on-load
|= =vase
=+ !<(old=state-0 vase)
`this(state old)
^- (quip card _this)
|^
=+ !<(old=app-states vase)
=^ cards-1 old
?. ?=(%0 -.old) `old
[[tire:cy]~ old(- %1)]
?> ?=(%1 -.old)
[cards-1 this(state old)]
::
+$ app-states $%(state-0 state-1)
+$ state-0 [%0 lagging=_|]
--
::
++ on-save !>(state)
++ on-poke on-poke:def
@ -34,45 +44,57 @@
++ on-watch on-watch:def
++ on-agent
|= [=wire =sign:agent:gall]
|^
^- (quip card _this)
?+ wire (on-agent:def wire sign)
[%kiln %vats ~] take-kiln-vats
[%kiln %vats ~] `this
==
++ take-kiln-vats
?- -.sign
?(%poke-ack %watch-ack) (on-agent:def wire sign)
%kick :_(this (drop safe-watch:kiln:cc))
::
%fact
?. ?=(%kiln-vats-diff-0 p.cage.sign) `this
=+ !<(=diff:hood q.cage.sign)
?+ -.diff `this
::
%commit
?. |(=(desk.diff %base) ~(has-docket de:cc desk.diff)) `this
=/ =action:hark ~(commit de:cc desk.diff)
::
++ on-arvo
|= [=wire sign=sign-arvo]
^- (quip card _this)
|^
?+ wire (on-arvo:def wire sign)
[%clay %tire ~] take-clay-tire
[%clay %warp * ~] (take-clay-warp i.t.t.wire)
[%check-lag ~] take-check-lag
==
::
++ take-check-lag
^- (quip card _this)
?> ?=([%behn %wake *] sign)
=+ .^(lag=? %$ (scry:io %$ /zen/lag))
?: =(lagging lag) :_(this ~[check:lag:cc])
:_ this(lagging lag)
:_ ~[check:lag:cc]
?:(lagging start:lag:cc stop:lag:cc)
::
++ take-clay-tire
^- (quip card _this)
?> ?=(%tire +<.sign)
?- -.p.sign
%& [(turn ~(tap in ~(key by p.p.sign)) warp:cy) this]
%|
?- -.p.p.sign
%zest `this
%warp `this
%wait
=/ =action:hark (~(blocked de:cc desk.p.p.sign) weft.p.p.sign)
:_ this
~[(poke:ha:cc action)]
::
%block
=/ =action:hark (~(blocked de:cc desk.diff) blockers.diff)
:_ this
~[(poke:ha:cc action)]
==
==
::
++ take-clay-warp
|= =desk
^- (quip card _this)
?> ?=(%writ +<.sign)
=/ cards
?. |(=(desk %base) ~(has-docket de:cc desk)) ~
=/ =action:hark ~(commit de:cc desk)
~[(poke:ha:cc action)]
[[(warp:cy desk) cards] this]
--
::
++ on-arvo
|= [=wire sign=sign-arvo]
^- (quip card _this)
?. ?=([%check-lag ~] wire) (on-arvo:def wire sign)
?> ?=([%behn %wake *] sign)
=+ .^(lag=? %$ (scry:io %$ /zen/lag))
?: =(lagging lag) :_(this ~[check:lag:cc])
:_ this(lagging lag)
:_ ~[check:lag:cc]
?:(lagging start:lag:cc stop:lag:cc)
::
++ on-fail on-fail:def
++ on-leave on-leave:def
--
@ -89,7 +111,7 @@
[~[text+'Welcome to urbit'] ~ now.bowl / /]
::
++ lag
|%
|%
++ check (~(wait pass /check-lag) (add now.bowl lag-interval))
++ place [q.byk.bowl /lag]
++ body `body:hark`[~[text/'Runtime lagging'] ~ now.bowl / /]
@ -102,24 +124,23 @@
++ poke
|=(=action:hark (poke-our:pass %hark-store hark-action+!>(action)))
--
++ kiln
::
++ cy
|%
++ path /kiln/vats
++ pass ~(. ^pass path)
++ watch (watch-our:pass %hood path)
++ watching (~(has by wex.bowl) [path our.bowl %hood])
++ safe-watch `(unit card)`?:(watching ~ `watch)
++ tire ~(tire pass /clay/tire)
++ warp
|= =desk
(~(warp-our pass /clay/warp/[desk]) desk ~ %next %z da+now.bowl /)
--
::
++ de
|_ =desk
++ scry-path (scry:io desk /desk/docket-0)
++ scry-path (scry:io desk /desk/docket-0)
++ has-docket .^(? %cu scry-path)
++ docket .^(docket:^docket %cx scry-path)
++ hash .^(@uv %cz (scry:io desk ~))
++ place `place:hark`[q.byk.bowl /desk/[desk]]
++ vat
.^(vat:hood %gx (scry:io %hood /kiln/vat/[desk]/noun))
++ docket .^(docket:^docket %cx scry-path)
++ hash .^(@uv %cz (scry:io desk ~))
++ place `place:hark`[q.byk.bowl /desk/[desk]]
++ version ud:.^(cass:clay %cw (scry:io desk /))
++ body
|= [=path title=cord content=(unit cord)]
^- body:hark
@ -131,7 +152,7 @@
%+ rap 3
?: =(desk %base)
['System software' cord ~]
?: has-docket
?: has-docket
['App: "' title:docket '"' cord ~]
['Desk: ' desk cord ~]
::
@ -142,7 +163,7 @@
::
++ commit
^- action:hark
?:(=(1 ud.cass:vat) created updated)
?:(=(1 version) created updated)
::
++ created
^- action:hark
@ -155,11 +176,11 @@
(body /desk/[desk] (title-prefix (rap 3 ' has been updated to ' get-version ~)) ~)
::
++ blocked
|= blockers=(set ^desk)
|= =weft
^- action:hark
:+ %add-note [/blocked place]
%^ body /blocked (title-prefix ' is blocked from upgrading')
`(rap 3 'Blocking desks: ' (join ', ' ~(tap in blockers)))
`(rap 3 'Blocked waiting for system version: ' (scot %ud num.weft) 'K' ~)
::
++ ver
|= =version:^docket
@ -172,7 +193,7 @@
--
++ note
|%
++ merge
++ merge
|= [=desk hash=@uv]
^- (list body:hark)
:_ ~

View File

@ -1,6 +1,6 @@
:~ %docket
%treaty
%hark-store
:: %hark-system-hook
%hark-system-hook
%settings-store
==