From 2359e8d5cd48d44a15bf03819d9ab93a5b810254 Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Wed, 23 Jun 2021 15:59:56 +1000 Subject: [PATCH] Use read_recursive locks in database --- beacon_node/store/src/hot_cold_store.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/beacon_node/store/src/hot_cold_store.rs b/beacon_node/store/src/hot_cold_store.rs index 97c954c99de..41baaace32e 100644 --- a/beacon_node/store/src/hot_cold_store.rs +++ b/beacon_node/store/src/hot_cold_store.rs @@ -690,7 +690,7 @@ impl, Cold: ItemStore> HotColdDB let high_restore_point_idx = low_restore_point_idx + 1; // Acquire the read lock, so that the split can't change while this is happening. - let split = self.split.read(); + let split = self.split.read_recursive(); let low_restore_point = self.load_restore_point_by_index(low_restore_point_idx)?; // If the slot of the high point lies outside the freezer, use the split state @@ -834,7 +834,7 @@ impl, Cold: ItemStore> HotColdDB /// Fetch a copy of the current split slot from memory. pub fn get_split_slot(&self) -> Slot { - self.split.read().slot + self.split.read_recursive().slot } /// Fetch the slot of the most recently stored restore point. @@ -1007,7 +1007,7 @@ pub fn migrate_database, Cold: ItemStore>( // 0. Check that the migration is sensible. // The new frozen head must increase the current split slot, and lie on an epoch // boundary (in order for the hot state summary scheme to work). - let current_split_slot = store.split.read().slot; + let current_split_slot = store.split.read_recursive().slot; if frozen_head.slot < current_split_slot { return Err(HotColdDBError::FreezeSlotError {