Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into storage-backend
Browse files Browse the repository at this point in the history
  • Loading branch information
DouglasDwyer committed Oct 22, 2023
2 parents 322ec2c + 267b473 commit e5aa450
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# redb - Changelog

## 1.3.0 - 2023-10-22
* Implement `RedbKey` for `Option<T>`
* Implement `RedbValue` for `Vec<T>`
* Implement `Debug` for tables
* Add `ReadableTable::first()` and `last()` which retrieve the first and last key-value pairs, respectively`
* Reduce lock contention for mixed read-write workloads
* Documentation improvements

## 1.2.0 - 2023-09-24
* Add `Builder::create_file()` which does the same thing as `create()` but
takes a `File` instead of a path
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ homepage = "https://www.redb.org"
repository = "https://github.com/cberner/redb"
readme = "README.md"
license = "MIT OR Apache-2.0"
version = "1.2.0"
version = "1.3.0"
edition = "2021"
rust-version = "1.66"
authors = ["Christopher Berner <[email protected]>"]
Expand Down
29 changes: 14 additions & 15 deletions src/tree_store/page_store/page_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -657,21 +657,6 @@ impl TransactionalMemory {
page_number: PageNumber,
hint: PageHint,
) -> Result<PageImpl> {
// We must not retrieve an immutable reference to a page which already has a mutable ref to it
#[cfg(debug_assertions)]
{
debug_assert!(
!self.open_dirty_pages.lock().unwrap().contains(&page_number),
"{page_number:?}",
);
*(self
.read_page_ref_counts
.lock()
.unwrap()
.entry(page_number)
.or_default()) += 1;
}

let range = page_number.address_range(
self.page_size as u64,
self.region_size,
Expand All @@ -683,6 +668,20 @@ impl TransactionalMemory {
.storage
.read(range.start, len, hint, CachePriority::default_btree)?;

// We must not retrieve an immutable reference to a page which already has a mutable ref to it
#[cfg(debug_assertions)]
{
let dirty_pages = self.open_dirty_pages.lock().unwrap();
debug_assert!(!dirty_pages.contains(&page_number), "{page_number:?}");
*(self
.read_page_ref_counts
.lock()
.unwrap()
.entry(page_number)
.or_default()) += 1;
drop(dirty_pages);
}

Ok(PageImpl {
mem,
page_number,
Expand Down

0 comments on commit e5aa450

Please sign in to comment.