From 3475e614872ac436214521d165d7441e2022d96a Mon Sep 17 00:00:00 2001 From: rszyma Date: Sun, 10 Aug 2025 18:17:39 +0200 Subject: [PATCH 01/10] fix(snix/boot/tests): fix comment Change-Id: I342e81b04445b6122e71b563964e452f6bad537a Reviewed-on: https://cl.snix.dev/c/snix/+/30676 Tested-by: besadii Reviewed-by: Florian Klink --- snix/boot/tests/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snix/boot/tests/default.nix b/snix/boot/tests/default.nix index c031b2f08..a3c8c9ec9 100644 --- a/snix/boot/tests/default.nix +++ b/snix/boot/tests/default.nix @@ -120,7 +120,7 @@ let } # Upload all NAR files (with some parallelism). - # As mkBinaryCache produces them xz-compressed, unpack them on the fly. + # As mkBinaryCache produces them zstd-compressed, unpack them on the fly. # nar-bridge doesn't care about the path we upload *to*, but a # subsequent .narinfo upload need to refer to its contents (by narhash). echo -e "Uploading NARs… " From bd6cfb1e33d70e3951ceca793e5643cddf1a8ce1 Mon Sep 17 00:00:00 2001 From: Oleksandr Knyshuk Date: Tue, 5 Aug 2025 18:39:22 +0200 Subject: [PATCH 02/10] docs(eval): update `compile_if_else` docstring for JumpIfCatchable opcode Reflects control flow changes after cl/10288, documenting the new JumpIfCatchable instruction and updated branching logic for catchable defaults in conditional expressions. Change-Id: I6a6a6964b84ae42e35ccb84851c7993619516d0b Reviewed-on: https://cl.snix.dev/c/snix/+/30656 Tested-by: besadii Reviewed-by: Florian Klink Reviewed-by: Oleksandr Knyshuk Autosubmit: Oleksandr Knyshuk --- snix/eval/src/compiler/mod.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/snix/eval/src/compiler/mod.rs b/snix/eval/src/compiler/mod.rs index 0b978160b..db267ae17 100644 --- a/snix/eval/src/compiler/mod.rs +++ b/snix/eval/src/compiler/mod.rs @@ -906,14 +906,15 @@ impl Compiler<'_, '_> { /// Compile conditional expressions using jumping instructions in the VM. /// /// ```notrust - /// ┌────────────────────┐ - /// │ 0 [ conditional ] │ - /// │ 1 JUMP_IF_FALSE →┼─┐ - /// │ 2 [ main body ] │ │ Jump to else body if - /// ┌┼─3─← JUMP │ │ condition is false. - /// Jump over else body ││ 4 [ else body ]←┼─┘ - /// if condition is true.└┼─5─→ ... │ - /// └────────────────────┘ + /// ┌─────────────────────┐ + /// │ 0 [ conditional ] │ + /// │ 1 JUMP_IF_CATCH →┼───┐ Jump over else body + /// │ 2 JUMP_IF_FALSE →┼─┐ │ if condition is catchable. + /// │ 3 [ main body ] │ │ ← Jump to else body if + /// ┌┼─4─← JUMP │ │ ← condition is false. + /// Jump over else body ││ 5 [ else body ] ←┼─┘ │ + /// if condition is true.└┼─6─→ ... ←┼───┘ + /// └─────────────────────┘ /// ``` fn compile_if_else(&mut self, slot: LocalIdx, node: &ast::IfElse) { self.compile(slot, node.condition().unwrap()); From c23d7b011e662e7d605121b1105ffabaa00e2541 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sat, 9 Aug 2025 23:13:03 +0200 Subject: [PATCH 03/10] chore(3p/sources/nix-gerrit): bump nix-gerrit The current bazel fetcher doesn't work if run on a machine without any IPv4 addresses (v4 connectivity provided by 6to4 and NAT64). Change-Id: I2418ef35efcf6629cbd3a4b0d988c1a3c4add8f0 Reviewed-on: https://cl.snix.dev/c/snix/+/30673 Tested-by: besadii Reviewed-by: Florian Klink Reviewed-by: Ryan Lahfa --- third_party/sources/sources.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/sources/sources.json b/third_party/sources/sources.json index 8a0fdd8a1..33669c3fa 100644 --- a/third_party/sources/sources.json +++ b/third_party/sources/sources.json @@ -87,7 +87,7 @@ "nix-gerrit": { "branch": "main", "repo": "https://git.lix.systems/the-distro/nix-gerrit.git", - "rev": "b730594c169cf14dd9c258902d58e8bb7709501f", + "rev": "1fdef9c8c8c876f410b75b0c4220ad8221572ef8", "type": "git" }, "nixpkgs": { From 370c63fadbc233d41d4c66a79f1edd9cd7c79294 Mon Sep 17 00:00:00 2001 From: Ilan Joselevich Date: Sat, 9 Aug 2025 17:57:01 +0200 Subject: [PATCH 04/10] chore: Update .git-blame-ignore-revs Adds the nixpkgs-fmt -> nixfmt commit Change-Id: Ic3630fa5c274d5f333a2ceecde5a85b3ae809b92 Reviewed-on: https://cl.snix.dev/c/snix/+/30672 Tested-by: besadii Reviewed-by: Florian Klink Autosubmit: Ilan Joselevich --- .git-blame-ignore-revs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index ca28d690e..6d17907b6 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -24,3 +24,6 @@ c758de9d22506eb279c5abe61f621e5c8f61af95 # style: format entire depot with nixpkgs-fmt aa122cbae78ce97d60c0c98ba14df753d97e40b1 + +# style: Switch to nixfmt from nixpkgs-fmt +91d02d8c845d4ffbeefc7d99ef36b2234d87813b From b62838cc7593c7dcbd1868ef5ba00c4a258dc4b3 Mon Sep 17 00:00:00 2001 From: Ilan Joselevich Date: Fri, 8 Aug 2025 11:02:39 +0200 Subject: [PATCH 05/10] fix(ops/nixos): Include in CI Machines created with third_party.nixos would not be added to the buildkite pipeline because they are not derivations. Closes: https://git.snix.dev/snix/snix/issues/80 Change-Id: I1e107b83e352244b229e498adc00df373742fb1a Reviewed-on: https://cl.snix.dev/c/snix/+/30666 Reviewed-by: Florian Klink Reviewed-by: Ilan Joselevich Tested-by: besadii Autosubmit: Ilan Joselevich --- ops/nixos.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ops/nixos.nix b/ops/nixos.nix index b0b79fb3c..d3dee2a1c 100644 --- a/ops/nixos.nix +++ b/ops/nixos.nix @@ -53,12 +53,12 @@ rec { ) (throw "${hostname} is not a known NixOS host") (map nixosFor depot.ops.machines.all-systems)); # Systems that should be built in CI - archivistEC2System = nixosFor depot.ops.machines.archivist-ec2; - gerrit01System = nixosFor depot.ops.machines.gerrit01; - public01System = nixosFor depot.ops.machines.public01; - build01System = nixosFor depot.ops.machines.build01; - meta01System = nixosFor depot.ops.machines.meta01; - nixosSnixCacheSystem = nixosFor depot.ops.machines.snix-cache; + archivistEC2System = (nixosFor depot.ops.machines.archivist-ec2).system; + gerrit01System = (nixosFor depot.ops.machines.gerrit01).system; + public01System = (nixosFor depot.ops.machines.public01).system; + build01System = (nixosFor depot.ops.machines.build01).system; + meta01System = (nixosFor depot.ops.machines.meta01).system; + nixosSnixCacheSystem = (nixosFor depot.ops.machines.snix-cache).system; meta.ci.targets = [ "archivistEC2System" From 974a705e6b7e829525e6a5680f3a50bba3622b01 Mon Sep 17 00:00:00 2001 From: Ilan Joselevich Date: Fri, 8 Aug 2025 11:18:27 +0200 Subject: [PATCH 06/10] feat(ops/nixos): Add nixosSnixCacheSystem CI target Change-Id: Icaa5717fb9eafacebe0fce238f636e7ae40d9aa5 Reviewed-on: https://cl.snix.dev/c/snix/+/30667 Reviewed-by: Florian Klink Tested-by: besadii Reviewed-by: Ilan Joselevich Autosubmit: Ilan Joselevich --- ops/nixos.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/ops/nixos.nix b/ops/nixos.nix index d3dee2a1c..799d816fa 100644 --- a/ops/nixos.nix +++ b/ops/nixos.nix @@ -66,5 +66,6 @@ rec { "public01System" "build01System" "meta01System" + "nixosSnixCacheSystem" ]; } From bd4c4bb5f0c1ec96c917065a131ac4e1753ea733 Mon Sep 17 00:00:00 2001 From: Ilan Joselevich Date: Tue, 5 Aug 2025 22:14:39 +0200 Subject: [PATCH 07/10] chore(snix): Upgrade redb to 2.6.2 In a follow-up CL I will update to use the new database file format. Change-Id: I7b228546eed9194601de57ffb7d3b2c94c5c2803 Reviewed-on: https://cl.snix.dev/c/snix/+/30659 Autosubmit: Ilan Joselevich Tested-by: besadii Reviewed-by: Florian Klink --- snix/Cargo.lock | 4 ++-- snix/Cargo.nix | 6 +++--- snix/Cargo.toml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/snix/Cargo.lock b/snix/Cargo.lock index b74188c27..fe05a289d 100644 --- a/snix/Cargo.lock +++ b/snix/Cargo.lock @@ -3473,9 +3473,9 @@ dependencies = [ [[package]] name = "redb" -version = "2.4.0" +version = "2.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea0a72cd7140de9fc3e318823b883abf819c20d478ec89ce880466dc2ef263c6" +checksum = "59b38b05028f398f08bea4691640503ec25fcb60b82fb61ce1f8fd1f4fccd3f7" dependencies = [ "libc", "log", diff --git a/snix/Cargo.nix b/snix/Cargo.nix index c63f15040..847b57a4b 100644 --- a/snix/Cargo.nix +++ b/snix/Cargo.nix @@ -14092,9 +14092,9 @@ rec { }; "redb" = rec { crateName = "redb"; - version = "2.4.0"; - edition = "2021"; - sha256 = "1ik3y8pdqrh4i378kv3qshh9r0dz7a43p0hqwg1rzpj0f76p42pa"; + version = "2.6.2"; + edition = "2024"; + sha256 = "1xykri7izzgqw4fbcbxqc35mzhiya101csd4pq48yfcg082qpcsr"; type = [ "cdylib" "rlib" diff --git a/snix/Cargo.toml b/snix/Cargo.toml index 465e384e7..ab2627357 100644 --- a/snix/Cargo.toml +++ b/snix/Cargo.toml @@ -100,7 +100,7 @@ proptest = { version = "1.5.0", default-features = false } prost = "0.13.1" prost-build = "0.13.1" quote = "1.0.37" -redb = "2.1.2" +redb = "2.6.2" regex = "1.10.6" reqwest = { version = "0.12.7", default-features = false } reqwest-middleware = { version = "0.4.1", default-features = false } From 189cb17e34ab13578301ff93f7d9fe7e7f551361 Mon Sep 17 00:00:00 2001 From: Ilan Joselevich Date: Tue, 5 Aug 2025 23:40:16 +0200 Subject: [PATCH 08/10] feat(snix/{castore,store}): Upgrade all redb file formats In version 2.6.0 of redb a new file format was released. It will end up being the only supported format in version 3.0.0. With this change we prepare for v3 by migrating all databases to the new format. Change-Id: I297a7d70e00e872d9354d1fc7acb277c83d76c71 Reviewed-on: https://cl.snix.dev/c/snix/+/30661 Autosubmit: Ilan Joselevich Tested-by: besadii Reviewed-by: Florian Klink --- snix/castore/src/directoryservice/redb.rs | 17 +++++++++++++---- snix/castore/src/errors.rs | 6 ++++++ snix/store/src/pathinfoservice/redb.rs | 17 +++++++++++++---- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/snix/castore/src/directoryservice/redb.rs b/snix/castore/src/directoryservice/redb.rs index 2eaa0b515..973ac5f1a 100644 --- a/snix/castore/src/directoryservice/redb.rs +++ b/snix/castore/src/directoryservice/redb.rs @@ -3,7 +3,7 @@ use prost::Message; use redb::{Database, TableDefinition}; use std::{path::PathBuf, sync::Arc}; use tonic::async_trait; -use tracing::{instrument, warn}; +use tracing::{info, instrument, warn}; use super::{ Directory, DirectoryGraph, DirectoryPutter, DirectoryService, LeavesToRootValidator, @@ -41,7 +41,15 @@ impl RedbDirectoryService { } let db = tokio::task::spawn_blocking(|| -> Result<_, redb::Error> { - let db = redb::Database::create(path)?; + let mut db = redb::Database::builder() + .create_with_file_format_v3(true) + .create(path)?; + + // Upgrade redb database file format. + if db.upgrade()? { + info!("Upgraded database format"); + }; + create_schema(&db)?; Ok(db) }) @@ -55,8 +63,9 @@ impl RedbDirectoryService { /// Constructs a new instance using the in-memory backend. pub fn new_temporary() -> Result { - let db = - redb::Database::builder().create_with_backend(redb::backends::InMemoryBackend::new())?; + let db = redb::Database::builder() + .create_with_file_format_v3(true) + .create_with_backend(redb::backends::InMemoryBackend::new())?; create_schema(&db)?; diff --git a/snix/castore/src/errors.rs b/snix/castore/src/errors.rs index 84567fbc3..282ce0097 100644 --- a/snix/castore/src/errors.rs +++ b/snix/castore/src/errors.rs @@ -125,6 +125,12 @@ impl From for Error { } } +impl From for Error { + fn from(value: redb::UpgradeError) -> Self { + Error::StorageError(value.to_string()) + } +} + impl From for Error { fn from(value: std::io::Error) -> Self { if value.kind() == std::io::ErrorKind::InvalidInput { diff --git a/snix/store/src/pathinfoservice/redb.rs b/snix/store/src/pathinfoservice/redb.rs index 851145817..3cd1adff9 100644 --- a/snix/store/src/pathinfoservice/redb.rs +++ b/snix/store/src/pathinfoservice/redb.rs @@ -11,7 +11,7 @@ use snix_castore::{ use std::{path::PathBuf, sync::Arc}; use tokio_stream::wrappers::ReceiverStream; use tonic::async_trait; -use tracing::{instrument, warn}; +use tracing::{info, instrument, warn}; const PATHINFO_TABLE: TableDefinition<[u8; 20], Vec> = TableDefinition::new("pathinfo"); @@ -40,7 +40,15 @@ impl RedbPathInfoService { } let db = tokio::task::spawn_blocking(|| -> Result<_, redb::Error> { - let db = redb::Database::create(path)?; + let mut db = redb::Database::builder() + .create_with_file_format_v3(true) + .create(path)?; + + // Upgrade redb database file format. + if db.upgrade()? { + info!("Upgraded database format"); + }; + create_schema(&db)?; Ok(db) }) @@ -54,8 +62,9 @@ impl RedbPathInfoService { /// Constructs a new instance using the in-memory backend. pub fn new_temporary(instance_name: String) -> Result { - let db = - redb::Database::builder().create_with_backend(redb::backends::InMemoryBackend::new())?; + let db = redb::Database::builder() + .create_with_file_format_v3(true) + .create_with_backend(redb::backends::InMemoryBackend::new())?; create_schema(&db)?; From 0beb9f6d5c936f00d309712922be1006e8198cd0 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 11 Aug 2025 20:33:30 +0200 Subject: [PATCH 09/10] refactor(ops/nixos): rename nixosSnixCacheSystem to snixCacheSystem This is defined at the `ops.machines.snix-cache`, let's keep the naming consistent and short. Change-Id: Ifb6f0779ee098b7a5c65d3e3989cbf98323e16d0 Reviewed-on: https://cl.snix.dev/c/snix/+/30678 Autosubmit: Florian Klink Reviewed-by: Ilan Joselevich Tested-by: besadii --- ops/nixos.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ops/nixos.nix b/ops/nixos.nix index 799d816fa..59946c4b7 100644 --- a/ops/nixos.nix +++ b/ops/nixos.nix @@ -54,18 +54,18 @@ rec { # Systems that should be built in CI archivistEC2System = (nixosFor depot.ops.machines.archivist-ec2).system; - gerrit01System = (nixosFor depot.ops.machines.gerrit01).system; - public01System = (nixosFor depot.ops.machines.public01).system; build01System = (nixosFor depot.ops.machines.build01).system; + gerrit01System = (nixosFor depot.ops.machines.gerrit01).system; meta01System = (nixosFor depot.ops.machines.meta01).system; - nixosSnixCacheSystem = (nixosFor depot.ops.machines.snix-cache).system; + public01System = (nixosFor depot.ops.machines.public01).system; + snixCacheSystem = (nixosFor depot.ops.machines.snix-cache).system; meta.ci.targets = [ "archivistEC2System" - "gerrit01System" - "public01System" "build01System" + "gerrit01System" "meta01System" - "nixosSnixCacheSystem" + "public01System" + "snixCacheSystem" ]; } From 6b75eb0f2cda0343800c08d5d9fb470bdc5a0444 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 11 Aug 2025 20:46:27 +0200 Subject: [PATCH 10/10] docs(ops/machines/snix-cache): document hostName Change-Id: Ic07983938174277a1bef765a4b14a3f22bd08c76 Reviewed-on: https://cl.snix.dev/c/snix/+/30679 Tested-by: besadii Reviewed-by: Ilan Joselevich Autosubmit: Florian Klink --- ops/machines/snix-cache/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/ops/machines/snix-cache/default.nix b/ops/machines/snix-cache/default.nix index 2cbf0f4e4..6dfbf8511 100644 --- a/ops/machines/snix-cache/default.nix +++ b/ops/machines/snix-cache/default.nix @@ -49,6 +49,7 @@ in nixpkgs.hostPlatform = lib.mkForce "x86_64-linux"; + # kept as-is because we don't want to relabel historical metrics networking.hostName = "tvix-cache"; systemd.network.networks."10-uplink".networkConfig.Address = "2a01:4f9:3071:1091::2/64";