From 39e187a7ca4c97122d2d4d5119f2e1e18402bf63 Mon Sep 17 00:00:00 2001 From: Faiaz Sanaulla Date: Fri, 18 Oct 2024 10:39:17 +0200 Subject: [PATCH 1/2] fix race index assignment --- object_store/src/upload.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/object_store/src/upload.rs b/object_store/src/upload.rs index 4df4d8fd46ad..aebd4303eae1 100644 --- a/object_store/src/upload.rs +++ b/object_store/src/upload.rs @@ -209,7 +209,9 @@ impl WriteMultipart { } pub(crate) fn put_part(&mut self, part: PutPayload) { - self.tasks.spawn(self.upload.put_part(part)); + // This is safe because we are the only ones with a reference to the upload + let task = self.upload.put_part(part); + self.tasks.spawn(task); } /// Abort this upload, attempting to clean up any successfully uploaded parts From c4c37beeb1f12a60c3cdc67c66fd7dd45e93ad77 Mon Sep 17 00:00:00 2001 From: Faiaz Sanaulla Date: Fri, 18 Oct 2024 10:41:32 +0200 Subject: [PATCH 2/2] comment --- object_store/src/upload.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/object_store/src/upload.rs b/object_store/src/upload.rs index aebd4303eae1..e20d3981c078 100644 --- a/object_store/src/upload.rs +++ b/object_store/src/upload.rs @@ -209,7 +209,8 @@ impl WriteMultipart { } pub(crate) fn put_part(&mut self, part: PutPayload) { - // This is safe because we are the only ones with a reference to the upload + // appereantly doing this inside spawn call, causes a index assignment race, + // to prevent it from happenin we do it here before spawn to ensure that the index is assigned correctly let task = self.upload.put_part(part); self.tasks.spawn(task); }