Repository navigation
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 aConcurrencyModeconfiguring how processes
may share the database. ConcurrencyMode::ExclusiveWriter(the default) locks the whole file, as earlier versions do.ConcurrencyMode::SingleWriterallows one process to write, and any number of processes may open
the database read-only.ConcurrencyMode::MultiWriterallows 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 everyopen()
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 returnsTransactionError::WouldBlockinstead of
waiting for an in-progress write transaction to finish.
Performance
- Operations on tables with
&strorStringkeys 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 asStorageError::Corruptedinstead of panicking.- Repair and
check_integrity()verify the trees kept by persistent savepoints, which were not
checked before. - Fix
cache_stats(), with thecache_metricsfeature, panicking in debug builds or returning a
write_misses()nearu64::MAXin release builds when called while another thread is writing. - Repair,
check_integrity(), andcommit()report some forms of file corruption asStorageError::Corruptedinstead of panicking. This cannot occur in normal operation, and only effects database which were externally modified.