core/storage: Allocate page1 lazily for MVCC transactions

This commit is contained in:
Pekka Enberg
2025-07-17 13:35:31 +03:00
parent 45c77f5e07
commit 1fc6126157
2 changed files with 3 additions and 1 deletions

View File

@@ -663,7 +663,7 @@ impl Pager {
}
#[instrument(skip_all, level = Level::INFO)]
fn maybe_allocate_page1(&self) -> Result<IOResult<()>> {
pub fn maybe_allocate_page1(&self) -> Result<IOResult<()>> {
if self.db_state.load(Ordering::SeqCst) < DB_STATE_INITIALIZED {
if let Ok(_lock) = self.init_lock.try_lock() {
match (

View File

@@ -1944,6 +1944,8 @@ pub fn op_transaction(
if let Some(mv_store) = &mv_store {
if state.mv_tx_id.is_none() {
// We allocate the first page lazily in the first transaction.
return_if_io!(pager.maybe_allocate_page1());
let tx_id = mv_store.begin_tx();
conn.mv_transactions.borrow_mut().push(tx_id);
state.mv_tx_id = Some(tx_id);