aboutsummaryrefslogtreecommitdiff
path: root/libbrep
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2021-09-27 11:09:51 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2021-10-04 18:49:09 +0300
commitb7ff8f89cea055e75881e716d8358ffa4d7779af (patch)
tree38c41d7b144d86c23b42519a9e4e683be62ccbb4 /libbrep
parentac80e3c37f1fee068e46b6f5a2043581d413e992 (diff)
Add support for soft and hard rebuilds
Diffstat (limited to 'libbrep')
-rw-r--r--libbrep/build.cxx8
-rw-r--r--libbrep/build.hxx65
-rw-r--r--libbrep/build.xml18
3 files changed, 68 insertions, 23 deletions
diff --git a/libbrep/build.cxx b/libbrep/build.cxx
index 5f8cd71..9cbad8f 100644
--- a/libbrep/build.cxx
+++ b/libbrep/build.cxx
@@ -62,7 +62,9 @@ namespace brep
optional<string> inr,
optional<string> afp, optional<string> ach,
string mnm, string msm,
- butl::target_triplet trg)
+ butl::target_triplet trg,
+ string ccs,
+ string mcs)
: id (package_id (move (tnt), move (pnm), pvr),
move (cfg),
move (tnm), tvr),
@@ -79,7 +81,9 @@ namespace brep
agent_fingerprint (move (afp)), agent_challenge (move (ach)),
machine (move (mnm)),
machine_summary (move (msm)),
- target (move (trg))
+ target (move (trg)),
+ controller_checksum (move (ccs)),
+ machine_checksum (move (mcs))
{
}
diff --git a/libbrep/build.hxx b/libbrep/build.hxx
index 151f8dc..fbab13d 100644
--- a/libbrep/build.hxx
+++ b/libbrep/build.hxx
@@ -30,7 +30,7 @@
//
#define LIBBREP_BUILD_SCHEMA_VERSION_BASE 12
-#pragma db model version(LIBBREP_BUILD_SCHEMA_VERSION_BASE, 14, closed)
+#pragma db model version(LIBBREP_BUILD_SCHEMA_VERSION_BASE, 15, closed)
// We have to keep these mappings at the global scope instead of inside
// the brep namespace because they need to be also effective in the
@@ -194,7 +194,9 @@ namespace brep
optional<string> agent_fingerprint,
optional<string> agent_challenge,
string machine, string machine_summary,
- butl::target_triplet);
+ butl::target_triplet,
+ string controller_checksum,
+ string machine_checksum);
build_id id;
@@ -223,15 +225,26 @@ namespace brep
//
optional<result_status> status;
- // Time of setting the result status that can be considered as the build
- // task completion (currently all the result_status values). Initialized
- // with timestamp_nonexistent by default.
+ // Times of the last soft/hard completed (re)builds. Used to decide when
+ // to perform soft and hard rebuilds, respectively.
+ //
+ // The soft timestamp is updated whenever we receive a task result.
+ //
+ // The hard timestamp is updated whenever we receive a task result with
+ // a status other than skip.
+ //
+ // Also note that whenever hard_timestamp is updated, soft_timestamp is
+ // updated as well and whenever soft_timestamp is updated, timestamp is
+ // updated as well. Thus the following condition is always true:
//
- // Note that in the future we may not consider abort and abnormal as the
- // task completion and, for example, proceed with automatic rebuild (the
- // flake monitor idea).
+ // hard_timestamp <= soft_timestamp <= timestamp
//
- timestamp_type completion_timestamp;
+ // Note that the "completed" above means that we may analyze the task
+ // result/log and deem it as not completed and proceed with automatic
+ // rebuild (the flake monitor idea).
+ //
+ timestamp_type soft_timestamp;
+ timestamp_type hard_timestamp;
// May be present only for the building state.
//
@@ -248,6 +261,21 @@ namespace brep
operation_results results;
odb::section results_section;
+ // Checksums of entities involved in the build.
+ //
+ // Optional checksums are provided by the external entities (agent and
+ // worker). All are absent initially.
+ //
+ // Note that the agent checksum can also be absent after the hard rebuild
+ // task is issued and the worker and dependency checksums - after a failed
+ // rebuild (error result status or worse).
+ //
+ string controller_checksum;
+ string machine_checksum;
+ optional<string> agent_checksum;
+ optional<string> worker_checksum;
+ optional<string> dependency_checksum;
+
// Database mapping.
//
#pragma db member(id) id column("")
@@ -265,15 +293,6 @@ namespace brep
//
#pragma db member(timestamp) index
- // This is not required since 0.14.0. Note however, that just dropping
- // this line won't pan out since this would require migration which odb is
- // currently unable to handle automatically, advising to re-implement this
- // change by adding a new data member with the desired default value,
- // migrating the data, and deleting the old data member. This sounds a bit
- // hairy, so let's keep it for now.
- //
- #pragma db member(completion_timestamp) default(0)
-
#pragma db member(results) id_column("") value_column("") \
section(results_section)
@@ -396,10 +415,14 @@ namespace brep
string& toolchain_name; // Tracks id.toolchain_name.
upstream_version toolchain_version; // Original of id.toolchain_version.
- // Time of the latest delay report. Initialized with timestamp_nonexistent
- // by default.
+ // Times of the latest soft and hard rebuild delay reports. Initialized
+ // with timestamp_nonexistent by default.
+ //
+ // Note that both reports notify about initial build delays (at their
+ // respective time intervals).
//
- timestamp report_timestamp;
+ timestamp report_soft_timestamp;
+ timestamp report_hard_timestamp;
// Time when the package is initially considered as buildable for this
// configuration and toolchain. It is used to track the build delay if the
diff --git a/libbrep/build.xml b/libbrep/build.xml
index 0ca362a..6a2301b 100644
--- a/libbrep/build.xml
+++ b/libbrep/build.xml
@@ -1,4 +1,22 @@
<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" schema-name="build" version="1">
+ <changeset version="15">
+ <alter-table name="build">
+ <add-column name="soft_timestamp" type="BIGINT" null="false"/>
+ <add-column name="hard_timestamp" type="BIGINT" null="false"/>
+ <add-column name="controller_checksum" type="TEXT" null="false"/>
+ <add-column name="machine_checksum" type="TEXT" null="false"/>
+ <add-column name="agent_checksum" type="TEXT" null="true"/>
+ <add-column name="worker_checksum" type="TEXT" null="true"/>
+ <add-column name="dependency_checksum" type="TEXT" null="true"/>
+ <drop-column name="completion_timestamp"/>
+ </alter-table>
+ <alter-table name="build_delay">
+ <add-column name="report_soft_timestamp" type="BIGINT" null="false"/>
+ <add-column name="report_hard_timestamp" type="BIGINT" null="false"/>
+ <drop-column name="report_timestamp"/>
+ </alter-table>
+ </changeset>
+
<changeset version="14"/>
<changeset version="13">