An older build request never replaces a newer one's artifact
Builds of one module in flight together finish in any order, and the mesh took whatever it heard last as what the module is: RegisterModule overwrote the module's manifest unconditionally, and Held/BuiltAgainst/ReadRepositories ordered builds by when they were recorded. A postgres build asked before the mesh-tools runtime fix finished after the one asked after it, and the next push deployed the stale image (novox/hq issue 219). A build is now ordered by when it was asked, read from the build-<nanos> id the controller writes: build.asked and module.built_asked (migration 0055). A registration from an earlier request than the module's current one is recorded and refused as superseded. A plan takes as its outcome only a build asked at or after its own ask, so an earlier plan's leftover build cannot settle a later plan. Ids of any other shape keep the old order.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
-- A build is ordered by when it was asked, not when it finished (novox/hq 04-ISSUES/219).
|
||||
--
|
||||
-- Two builds of one module can be in flight together — two merge plans a few minutes apart, each
|
||||
-- asking for everything standing on what it changed — and they finish in any order. Each build
|
||||
-- stands on the bases the mesh held when it was *asked*, so the one asked later is the newer one.
|
||||
-- The mesh ordered builds by `at`, which is when the outcome was recorded, and registered whatever
|
||||
-- it heard last: an older request that took longer replaced a newer one as what the module is, and
|
||||
-- the next push sent machines an image built on a base the mesh had already replaced.
|
||||
--
|
||||
-- `build.asked` is when the build was requested, read from the correlation id the controller wrote
|
||||
-- (`build-<unix nanoseconds>`). Nullable: an id of any other shape says no request time, and such a
|
||||
-- build is placed where it was recorded, which is the order the mesh had before this.
|
||||
alter table build add column asked timestamptz;
|
||||
|
||||
update build
|
||||
set asked = to_timestamp((substring(id from '^build-([0-9]{19})$'))::numeric / 1000000000)
|
||||
where id ~ '^build-[0-9]{19}$';
|
||||
|
||||
-- `module.built_asked` is when the build the module's registered manifest came from was asked, so
|
||||
-- a later-heard outcome of an earlier request is recorded and not registered. A manifest handed over
|
||||
-- by hand is a request made when it is handed over. Null for a module registered before this was
|
||||
-- kept: its next registration, whichever it is, sets it.
|
||||
alter table module add column built_asked timestamptz;
|
||||
Reference in New Issue
Block a user