From 6f16f98c3acec9cf67f39056ba56424021e1d547 Mon Sep 17 00:00:00 2001 From: Christopher Berner Date: Sun, 28 Jul 2024 10:04:41 -0700 Subject: [PATCH] Revert "Remove attempted free uncommited in restore_savepoint" This reverts commit a41f3ff76d0898bd9b9b95d4ae9545e60e557610. Actually this optimization is useful because we allow restoring into dirty transcations. The original commit message was wrong about that --- src/transactions.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/transactions.rs b/src/transactions.rs index 73e8981d..369b2c60 100644 --- a/src/transactions.rs +++ b/src/transactions.rs @@ -737,7 +737,11 @@ impl WriteTransaction { if whitelist.contains(&page) { continue; } - freed_pages.push(page); + if self.mem.uncommitted(page) { + self.mem.free(page); + } else { + freed_pages.push(page); + } } *self.freed_pages.lock().unwrap() = freed_pages; self.tables.lock().unwrap().table_tree = TableTreeMut::new( @@ -777,8 +781,12 @@ impl WriteTransaction { && !freed_pages_hash.contains(&page) && !whitelist.contains(&page) { - freed_pages.push(page); - freed_pages_hash.insert(page); + if self.mem.uncommitted(page) { + self.mem.free(page); + } else { + freed_pages.push(page); + freed_pages_hash.insert(page); + } } } }