mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-19 09:34:18 +01:00
core/storage: Allocate page1 lazily for MVCC transactions
This commit is contained in:
@@ -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 (
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user