Xuanwo opened a new pull request, #8759:
URL: https://github.com/apache/opendal/pull/8759
# Which issue does this PR close?
Part of #8705. This PR takes only the `redb` 4.1.0 -> 5.0.0 update out of
that
group bump, so it does not close it.
# Rationale for this change
`redb` 5.0 is a new major release. `RedbBuilder::database` exposes
`redb::Database` in its public signature, so the version bump has to land
together with the migration of the Redb service and a breaking-change note.
Keeping it separate from #8705 leaves the `jiff`, `opentelemetry*`, and
`suppaftp` upgrades out of this change.
# What changes are included in this PR?
- Bump `redb` from 4 to 5 in `core/services/redb/Cargo.toml`.
`core/Cargo.lock`
only changes the `redb` entry plus the `tempfile` dev-dependency of
`opendal-service-redb`; no other crate is upgraded.
- Migrate `RedbCore::scan` to `ReadOnlyTable::range_owned` and hold
`redb::OwnedRange` in `RedbLister`. redb 5 makes `Range` borrow the table,
while `OwnedRange` keeps the read transaction alive, which is what the
lister
needs because it iterates after `scan()` returns.
- Import `redb::ReadableTable` for `get()`. redb 5 removed the inherent
`ReadOnlyTable::get()` and `range()` methods.
- Add `core/services/redb/tests/shared_database.rs`. It opens an externally
created `Arc<redb::Database>`, shares it between two operators on different
tables, and runs `write()`, `read()`, and `list()` against it. It also
checks
that rows written through a plain `TableDefinition<&str, &[u8]>`
transaction
are listed and readable through OpenDAL.
- Document the upgrade in `core/core/src/docs/upgrade.md`.
No data migration is needed: redb 5 changed the encoding of `Option<&str>`,
`Option<String>`, `Option<bool>`, and `Option<char>` only, and the Redb
service
stores entries in a `TableDefinition<&str, &[u8]>` table. Verified by
writing a
database file with `redb` 4.1.0 and then listing, reading, and updating it
through OpenDAL with `redb` 5.0.0.
# Are there any user-facing changes?
Yes, see the migration notes below. The upgrade guide also documents them
under
"Services".
# Breaking changes
Affected packages: core
Migration:
- Upgrade your `redb` dependency to `5.x` if you pass an
`Arc<redb::Database>`
to `RedbBuilder::database`. The `redb::Database` in that signature now
comes
from `redb` 5.
- `redb` 5 uses a different file locking protocol. Every process that opens
the
same database file must use `redb` 5.x, because `redb` 5 does not reliably
detect a `redb` 4.2 or earlier process that still has the file open.
- No data migration is required. The Redb service keeps using
`TableDefinition<&str, &[u8]>`, whose encoding did not change in `redb` 5.
# AI Usage Statement
- Harness: pi coding agent
- Model: group/deepseek
- Effort: max
- Role: Implemented the dependency bump, the `redb` 5 API migration, the
integration tests, and the upgrade note. The accountable human maintainer
reviewed the change and remains responsible for it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]