mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-19 23:15:28 +01:00
we don't need read_tx return IOResult anymore
This commit is contained in:
@@ -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 => {}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)]
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user