Skip to content

4.5.0

Latest

Choose a tag to compare

@cberner cberner released this 05 Nov 23:50
· 33 commits to master since this release

Multi-process support

Database files cannot be shared between processes using these modes and processes using the
experimental-multiprocess feature of redb 4.3 or 4.4. Their locking is incompatible, and 4.5
can't detect the older processes.

  • Add Builder::set_concurrency_mode(), which takes a ConcurrencyMode configuring how processes
    may share the database.
  • ConcurrencyMode::ExclusiveWriter (the default) locks the whole file, as earlier versions do.
  • ConcurrencyMode::SingleWriter allows one process to write, and any number of processes may open
    the database read-only.
  • ConcurrencyMode::MultiWriter allows any number of processes to open the database for
    writing, one write transaction at a time, and any number may open it read-only.

New features

  • Add Builder::open_read_only_with_backend() to open a read-only database from a storage backend.
  • Add Builder::set_check_integrity_on_open(), which verifies the whole file on every open()
    instead of trusting the state recorded by a clean shutdown.
  • Add ReadOnlyDatabase::close(), which releases the file and its locks without waiting for the
    read transactions opened from the database to be dropped.
  • Add Database::close(), which closes the database as dropping it does, but returns any error
    rather than ignoring it.
  • Add Database::try_begin_write(), which returns TransactionError::WouldBlock instead of
    waiting for an in-progress write transaction to finish.

Performance

  • Operations on tables with &str or String keys are faster.

Deprecations

  • Builder::create_file() is deprecated; use
    Builder::create_with_backend(FileBackend::new(file)?) instead.
  • WriteTransaction::print_allocated_page_debug() is deprecated. It is an internal debugging aid,
    present only in debug builds.

Bug fixes

  • open() reports a malformed allocator state as StorageError::Corrupted instead of panicking.
  • Repair and check_integrity() verify the trees kept by persistent savepoints, which were not
    checked before.
  • Fix cache_stats(), with the cache_metrics feature, panicking in debug builds or returning a
    write_misses() near u64::MAX in release builds when called while another thread is writing.
  • Repair, check_integrity(), and commit() report some forms of file corruption as StorageError::Corrupted instead of panicking. This cannot occur in normal operation, and only effects database which were externally modified.