we don't need read_tx return IOResult anymore

This commit is contained in:
meteorgan
2025-07-23 19:50:42 +08:00
parent 2ec40db6b5
commit c48a5ef538
5 changed files with 8 additions and 8 deletions

View File

@@ -874,7 +874,7 @@ impl Connection {
#[cfg(feature = "fs")]
pub fn wal_insert_begin(&self) -> Result<()> {
let pager = self.pager.borrow();
match pager.io.block(|| pager.begin_read_tx())? {
match pager.begin_read_tx()? {
result::LimboResult::Busy => return Err(LimboError::Busy),
result::LimboResult::Ok => {}
}

View File

@@ -156,7 +156,7 @@ impl Schema {
let mut automatic_indices: HashMap<String, Vec<(String, usize)>> =
HashMap::with_capacity(10);
if matches!(pager.io.block(|| pager.begin_read_tx())?, LimboResult::Busy) {
if matches!(pager.begin_read_tx()?, LimboResult::Busy) {
return Err(LimboError::Busy);
}

View File

@@ -7111,7 +7111,7 @@ mod tests {
tracing::info!("seed: {seed}");
for insert_id in 0..inserts {
let do_validate = do_validate_btree || (insert_id % VALIDATE_INTERVAL == 0);
run_until_done(|| pager.begin_read_tx(), &pager).unwrap();
pager.begin_read_tx().unwrap();
run_until_done(|| pager.begin_write_tx(), &pager).unwrap();
let size = size(&mut rng);
let key = {
@@ -7163,7 +7163,7 @@ mod tests {
}
}
}
run_until_done(|| pager.begin_read_tx(), &pager).unwrap();
pager.begin_read_tx().unwrap();
// FIXME: add sorted vector instead, should be okay for small amounts of keys for now :P, too lazy to fix right now
cursor.move_to_root().unwrap();
let mut valid = true;
@@ -7193,7 +7193,7 @@ mod tests {
}
pager.end_read_tx().unwrap();
}
run_until_done(|| pager.begin_read_tx(), &pager).unwrap();
pager.begin_read_tx().unwrap();
tracing::info!(
"=========== btree ===========\n{}\n\n",
format_btree(pager.clone(), root_page, 0)

View File

@@ -735,13 +735,13 @@ impl Pager {
#[inline(always)]
#[instrument(skip_all, level = Level::DEBUG)]
pub fn begin_read_tx(&self) -> Result<IOResult<LimboResult>> {
pub fn begin_read_tx(&self) -> Result<LimboResult> {
let (result, changed) = self.wal.borrow_mut().begin_read_tx()?;
if changed {
// Someone else changed the database -> assume our page cache is invalid (this is default SQLite behavior, we can probably do better with more granular invalidation)
self.clear_page_cache();
}
Ok(IOResult::Done(result))
Ok(result)
}
#[instrument(skip_all, level = Level::DEBUG)]

View File

@@ -1961,7 +1961,7 @@ pub fn op_transaction(
};
if updated && matches!(current_state, TransactionState::None) {
if let LimboResult::Busy = return_if_io!(pager.begin_read_tx()) {
if let LimboResult::Busy = pager.begin_read_tx()? {
return Ok(InsnFunctionStepResult::Busy);
}
}