mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-12-23 08:21:09 +00:00
Merge 'Remove some useless clones in pager.rs' from Preston Thorpe
Some checks are pending
Build and push limbo-sim image / deploy (push) Waiting to run
C compat Tests / test (push) Waiting to run
Dart/Flutter / test (blacksmith-4vcpu-ubuntu-2404) (push) Waiting to run
Dart/Flutter / test (windows-latest) (push) Waiting to run
Dart/Flutter / precompile (blacksmith-4vcpu-ubuntu-2404) (push) Waiting to run
Dart/Flutter / precompile (macOS-latest) (push) Waiting to run
Dart/Flutter / precompile (windows-latest) (push) Waiting to run
Dart/Flutter / publish (push) Waiting to run
Run long fuzz tests and stress test / run-fuzz-tests (push) Waiting to run
Run long fuzz tests and stress test / run-long-fuzz-tests (push) Waiting to run
Run long fuzz tests and stress test / simple-stress-test (push) Waiting to run
Java Tests / test (push) Waiting to run
Build & publish @tursodatabase/database / db-bindings-aarch64-apple-darwin - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / db-bindings-aarch64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / db-bindings-wasm32-wasip1-threads - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / db-bindings-x86_64-pc-windows-msvc - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / db-bindings-x86_64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-aarch64-apple-darwin - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-aarch64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-wasm32-wasip1-threads - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-x86_64-pc-windows-msvc - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-x86_64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / Test DB bindings on Linux-x64-gnu - node@20 (push) Blocked by required conditions
Build & publish @tursodatabase/database / Test DB bindings on browser@20 (push) Blocked by required conditions
Build & publish @tursodatabase/database / Publish (push) Blocked by required conditions
Python / configure-strategy (push) Waiting to run
Python / test (push) Blocked by required conditions
Python / lint (push) Waiting to run
Python / linux (x86_64) (push) Waiting to run
Python / macos-arm64 (aarch64) (push) Waiting to run
Python / sdist (push) Waiting to run
Python / Release (push) Blocked by required conditions
Rust / cargo-fmt-check (push) Waiting to run
Rust / build-native (blacksmith-4vcpu-ubuntu-2404) (push) Waiting to run
Rust / build-native (macos-latest) (push) Waiting to run
Rust / build-native (windows-latest) (push) Waiting to run
Rust / clippy (push) Waiting to run
Rust / simulator (push) Waiting to run
Rust / test-limbo (push) Waiting to run
Rust / test-sqlite (push) Waiting to run
Rust Benchmarks+Nyrkiö / bench (push) Waiting to run
Rust Benchmarks+Nyrkiö / clickbench (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h-criterion (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h (push) Waiting to run
Rust Benchmarks+Nyrkiö / vfs-bench-compile (push) Waiting to run
Some checks are pending
Build and push limbo-sim image / deploy (push) Waiting to run
C compat Tests / test (push) Waiting to run
Dart/Flutter / test (blacksmith-4vcpu-ubuntu-2404) (push) Waiting to run
Dart/Flutter / test (windows-latest) (push) Waiting to run
Dart/Flutter / precompile (blacksmith-4vcpu-ubuntu-2404) (push) Waiting to run
Dart/Flutter / precompile (macOS-latest) (push) Waiting to run
Dart/Flutter / precompile (windows-latest) (push) Waiting to run
Dart/Flutter / publish (push) Waiting to run
Run long fuzz tests and stress test / run-fuzz-tests (push) Waiting to run
Run long fuzz tests and stress test / run-long-fuzz-tests (push) Waiting to run
Run long fuzz tests and stress test / simple-stress-test (push) Waiting to run
Java Tests / test (push) Waiting to run
Build & publish @tursodatabase/database / db-bindings-aarch64-apple-darwin - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / db-bindings-aarch64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / db-bindings-wasm32-wasip1-threads - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / db-bindings-x86_64-pc-windows-msvc - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / db-bindings-x86_64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-aarch64-apple-darwin - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-aarch64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-wasm32-wasip1-threads - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-x86_64-pc-windows-msvc - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-x86_64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / Test DB bindings on Linux-x64-gnu - node@20 (push) Blocked by required conditions
Build & publish @tursodatabase/database / Test DB bindings on browser@20 (push) Blocked by required conditions
Build & publish @tursodatabase/database / Publish (push) Blocked by required conditions
Python / configure-strategy (push) Waiting to run
Python / test (push) Blocked by required conditions
Python / lint (push) Waiting to run
Python / linux (x86_64) (push) Waiting to run
Python / macos-arm64 (aarch64) (push) Waiting to run
Python / sdist (push) Waiting to run
Python / Release (push) Blocked by required conditions
Rust / cargo-fmt-check (push) Waiting to run
Rust / build-native (blacksmith-4vcpu-ubuntu-2404) (push) Waiting to run
Rust / build-native (macos-latest) (push) Waiting to run
Rust / build-native (windows-latest) (push) Waiting to run
Rust / clippy (push) Waiting to run
Rust / simulator (push) Waiting to run
Rust / test-limbo (push) Waiting to run
Rust / test-sqlite (push) Waiting to run
Rust Benchmarks+Nyrkiö / bench (push) Waiting to run
Rust Benchmarks+Nyrkiö / clickbench (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h-criterion (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h (push) Waiting to run
Rust Benchmarks+Nyrkiö / vfs-bench-compile (push) Waiting to run
## Description This PR removes some unneeded clones (mostly Arc clones, but still clones) in the Pager ## AI disclosure No LLM's were used in this PR Reviewed-by: Pedro Muniz (@pedrocarlo) Closes #4170
This commit is contained in:
commit
e529b0c246
1 changed files with 7 additions and 9 deletions
|
|
@ -887,7 +887,7 @@ impl Pager {
|
|||
let page = Arc::new(Page::new(page_id as i64));
|
||||
let c = subjournal.read_page(
|
||||
current_offset,
|
||||
page_buffer.clone(),
|
||||
page_buffer,
|
||||
page.clone(),
|
||||
page_size as usize,
|
||||
)?;
|
||||
|
|
@ -1592,7 +1592,7 @@ impl Pager {
|
|||
"attempted to read page {page_idx} but got page {}",
|
||||
page.get().id
|
||||
);
|
||||
return Ok((page.clone(), None));
|
||||
return Ok((page, None));
|
||||
}
|
||||
let (page, c) = self.read_page_no_cache(page_idx, None, false)?;
|
||||
turso_assert!(
|
||||
|
|
@ -1628,7 +1628,7 @@ impl Pager {
|
|||
page_cache: &mut PageCache,
|
||||
) -> Result<()> {
|
||||
let page_key = PageCacheKey::new(page_idx);
|
||||
match page_cache.insert(page_key, page.clone()) {
|
||||
match page_cache.insert(page_key, page) {
|
||||
Ok(_) => {}
|
||||
Err(CacheError::KeyExists) => {
|
||||
unreachable!("Page should not exist in cache after get() miss")
|
||||
|
|
@ -1660,7 +1660,7 @@ impl Pager {
|
|||
tracing::debug!(
|
||||
"cache_get_for_checkpoint: page {page_idx} frame {target_frame} is valid",
|
||||
);
|
||||
Some(page.clone())
|
||||
Some(page)
|
||||
} else {
|
||||
tracing::trace!(
|
||||
"cache_get_for_checkpoint: page {} has frame/tag {:?}: (dirty={}), need frame {} and seq {seq}",
|
||||
|
|
@ -2472,7 +2472,7 @@ impl Pager {
|
|||
// After we wrote the header page, we may now set this None, to signify we initialized
|
||||
self.init_page_1.store(None);
|
||||
*self.allocate_page1_state.write() = AllocatePage1State::Done;
|
||||
Ok(IOResult::Done(page.clone()))
|
||||
Ok(IOResult::Done(page))
|
||||
}
|
||||
AllocatePage1State::Done => unreachable!("cannot try to allocate page 1 again"),
|
||||
}
|
||||
|
|
@ -2531,7 +2531,7 @@ impl Pager {
|
|||
self.add_dirty(&page)?;
|
||||
let page_key = PageCacheKey::new(page.get().id as usize);
|
||||
let mut cache = self.page_cache.write();
|
||||
cache.insert(page_key, page.clone())?;
|
||||
cache.insert(page_key, page)?;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2692,9 +2692,7 @@ impl Pager {
|
|||
let page_key = PageCacheKey::new(richard_hipp_special_page.get().id);
|
||||
{
|
||||
let mut cache = self.page_cache.write();
|
||||
cache
|
||||
.insert(page_key, richard_hipp_special_page.clone())
|
||||
.unwrap();
|
||||
cache.insert(page_key, richard_hipp_special_page).unwrap();
|
||||
}
|
||||
// HIPP special page is assumed to zeroed and should never be read or written to by the BTREE
|
||||
new_db_size += 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue