From 27f59e809dbce3fc6e7115b5f2d43000b7f2e751 Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Sun, 24 Sep 2023 12:26:17 -0700 Subject: [PATCH] disk idx: apply_grow_index does not delete index file (#33384) --- bucket_map/src/bucket.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bucket_map/src/bucket.rs b/bucket_map/src/bucket.rs index 924aa8b173ee42..e727e8424a8a10 100644 --- a/bucket_map/src/bucket.rs +++ b/bucket_map/src/bucket.rs @@ -679,11 +679,20 @@ impl<'b, T: Clone + Copy + PartialEq + std::fmt::Debug + 'static> Bucket { } } - pub fn apply_grow_index(&mut self, index: BucketStorage>) { + pub fn apply_grow_index(&mut self, mut index: BucketStorage>) { self.stats .index .resize_grow(self.index.capacity_bytes(), index.capacity_bytes()); + if self.restartable_bucket.restart.is_some() { + // we are keeping track of which files we use for restart. + // And we are resizing. + // So, delete the old file and set the new file to NOT delete. + // This way the new file will still be around on startup. + // We are completely done with the old file. + self.index.delete_file_on_drop = true; + index.delete_file_on_drop = false; + } self.index = index; }