Repository navigation
fix(deps): update rust crate redb to v5 - autoclosed - #226
Closed
renovate[bot] wants to merge 1 commit into
Closed
renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
4.4→5.0Release Notes
cberner/redb (redb)
v5.0.0Compare Source
Breaking changes
The encoding of
Option<&str>,Option<String>,Option<bool>, andOption<char>has been changedto optimize the storage of these types. The new encoding is not compatible with the one used in prior versions.
Tables that contain these
Optiontypes, and were created prior to version 5.0, will fail to open withTableTypeMismatch. To load them, wrap the inner type in the newLegacytype. For example,TableDefinition<u64, Option<&str>>becomesTableDefinition<u64, Option<Legacy<&str>>>. This alsoapplies to an
Optionthat is nested inside another type, such as a tuple.The recommended pattern to migrate is to create a new table, and then copy the data from the old table to the new table.
Important: If you have implemented
Valuefor your own type, and its encoding usesOption<&str>,Option<String>,Option<bool>, orOption<char>(including inside aVec,array, or tuple), redb cannot detect the change and will silently misread existing tables.
Change the implementation to use
Option<Legacy<T>>to read existing tables, and use a newTypeNamefor the new encoding.A number of other APIs have changed in breaking ways:
get()andrange()methods ofReadOnlyTableandReadOnlyMultimapTable.They returned
'staticguards and iterators, which did not keep the transaction alive. Use themethods on
ReadableTableandReadableMultimapTableinstead, orget_owned()andrange_owned()if the result must outlive the table.
RangeandMultimapRangeto borrow the table until they are dropped. Mutating a tablewhile a range over it is still in scope could panic, and is now a compile error.
Entry,OccupiedEntry, andVacantEntryto take a second lifetime, for the key, whichno longer needs to live as long as the borrow of the table.
FileBackend::new()to returnFileBackendinstead of aResult.ReadableTable::lower_bound()andReadableTable::upper_bound()to be required methods.ReadableDatabaseto be a sealed trait.Table::extract_from_if(). Useextract_if()instead.Table::extract_if()to take a range as its first argument, likeBTreeMap::extract_if(). Useextract_if(.., predicate)to visit the whole table.Builder::create_file(). UseBuilder::create_with_backend(FileBackend::new(file))instead.WriteTransaction::print_allocated_page_debug().From<PoisonError<T>>forStorageErrorandError.range(),range_owned(),retain_in(), andextract_if()to take aKeyRangeinsteadof a
RangeBounds. The key type no longer needs to be specified. For example,table.range::<u64>(..)becomestable.range(..).StorageBackendto returnBackendErrorinstead ofio::Error. Anio::Errorcan still be converted with?. Note that anio::Errorof kindUnsupportedisnow converted to
BackendError::Ioinstead ofBackendError::Unsupported. Lock methods mayreturn either to indicate that locking is not supported.
TableTypeMismatchandTypeDefinitionChangedvariants ofTableErrorandErrorto contain a
Box. Their fields are replaced by methods on the newTableTypeMismatchandTypeDefinitionInfostructs.Database::compact()to take aCompactionMode, which selects how thoroughly to compact.Use
compact(CompactionMode::Balanced)to compact as before.chrono_v0_4feature, because thechronocrate is no longer maintained. To readexisting tables of its types, implement
ValueandKeyfor a type of your own with the sameTypeNameand encoding.no_stdsupportredb can now be built without the standard library by disabling the
stdfeature.If you depend on redb with
default-features = false, addfeatures = ["std"]to continuebuilding with the standard library.
File locking changes
Database files are now locked using only byte-range locks. On Linux, do not use redb 4.2 or earlier
on a database that redb 5.x has open. Their locking is incompatible, and only an
ExclusiveWriterwriter can detect the older version.
A read-only open now fails with
DatabaseError::LockProtocolMismatchif a read-only handle fromredb 4.3 or 4.4 has the file open. Previously, this was allowed in
ExclusiveWritermode.Other changes
CompactionMode::Maximum. This reclaims the free space inside pages, whichCompactionMode::Balancedleaves for later inserts to fill.Legacy<T>, for reading tables ofOption<T>that were created prior to version 5.0.BackendError::Other, for errors from a storage backend that are not anio::Error. It isreported as
StorageError::BackendandError::Backend.Bug fixes
compact()on aSingleWriterorMultiWriterdatabase could returnCompactionError::TransactionInProgress, while an attempt to open the same file for writing inExclusiveWritermode was being refused.StorageBackend, unwound while a page ofthe write buffer was in use. The panic now propagates, and later operations return
StorageError::PreviousIountil the database is reopened.Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.