about summary refs log tree commit diff
path: root/tvix
diff options
context:
space:
mode:
authorConnor Brewster <cbrewster@hey.com>2023-10-17T02·33-0500
committerConnor Brewster <cbrewster@hey.com>2023-10-17T13·01+0000
commit0325ae3ba328ac7b4215057d2c00ac467dd9d820 (patch)
tree182f31441c5e8a864c1804039295d7d4215da218 /tvix
parent73a19c249ef47cfdd55ebd8230cb9c0439beb749 (diff)
fix(tvix/castore): Fix race when ingesting into castore r/6842
After finishing the ingestion, the directory putter was not being
closed. This caused a race where the root directory node was accessed
before the directory node had been flushed to the server.

This patch makes it so we close the putter before returning the root
node which should ensure that the root node exists on the directory
service server before the `ingest_path` function returns.

Fixes b/326

Change-Id: Id16cf46bc48962121dde76d3c9c23a845d87d0f1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9761
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix')
-rw-r--r--tvix/castore/src/import.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/tvix/castore/src/import.rs b/tvix/castore/src/import.rs
index 65f2a30eeae2..e17338756b87 100644
--- a/tvix/castore/src/import.rs
+++ b/tvix/castore/src/import.rs
@@ -189,6 +189,10 @@ pub async fn ingest_path<P: AsRef<Path> + Debug>(
         .await?;
 
         if entry.depth() == 0 {
+            // Make sure all the directories are flushed.
+            if entry.file_type().is_dir() {
+                directory_putter.close().await?;
+            }
             return Ok(node);
         } else {
             // calculate the parent path, and make sure we register the node there.