microsoft / microsoft/bf-tree

Read counter not reported in PageCacheWrapper

Open
#12 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.1k
Forks
46
PR merge metrics
No merged PRs in 30d

Description

Description:

The Read counter in bf-tree's internal metrics is only incremented within the BfTree::read() method. However, the PageCacheWrapper in the benchmark/ subdirectory implements its point-read logic using db.scan_with_count(key, 1, ...).

Because this approach bypasses the BfTree::read() method, point-read operations are not tracked in the Read counter, leading to a reported value of "Read": 0 in benchmark JSON results, even when throughput is high.

Proposed Fix:

Manually invoke the counter!(Read) macro within the read() implementation of the PageCacheWrapper to ensure these operations are consistently tracked alongside other engines.

Example Fix:

// benchmark/src/wrappers/page_cache_wrapper.rs

fn read(&self, key: &[u8], value: &mut [u8]) -> usize {
    bf_tree::counter!(Read); // Ensure point-reads via scan are recorded
    let mut iter = self.db.scan_with_count(key, 1, ScanReturnField::Value)
        .expect("Failed to create scan iterator");
    // ...
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open benchmark/src/wrappers/page_cache_wrapper.rs and inspect PageCacheWrapper::read(), which performs point reads through scan_with_count. Add the Read counter invocation described in the issue, then run the relevant benchmark and confirm the JSON results report a nonzero Read count.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases, performance
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.