Skip to content

Commit 2b36b77

Browse files
authored
feat: upgrade redb to v3 compatible format (#3483)
## Description We are using redb in iroh-dns-server. The recently released redb v3 has incompatible changes to the database format. The recommended upgrade procedure is to upgrade the database with `Database::upgrade` on redb v2.6+. The upgrade has to be done on redb v2, not v3. See https://github.com/cberner/redb/blob/master/CHANGELOG.md#removes-support-for-file-format-v2. This updates redb to 2.6 and performs the upgrade when opening the database. Calling upgrade on an already upgraded database is a no-op. With this merged in the next release, we can then update redb to v3 in the version after. ## Breaking Changes <!-- Optional, if there are any breaking changes document them, including how to migrate older code. --> ## Notes & open questions <!-- Any notes, remarks or open questions you have to make about the PR. --> ## Change checklist <!-- Remove any that are not relevant. --> - [ ] Self-review. - [ ] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [ ] Tests if relevant. - [ ] All breaking changes documented. - [ ] List all breaking changes in the above "Breaking Changes" section. - [ ] Open an issue or PR on any number0 repos that are affected by this breaking change. Give guidance on how the updates should be handled or do the actual updates themselves. The major ones are: - [ ] [`quic-rpc`](https://github.com/n0-computer/quic-rpc) - [ ] [`iroh-gossip`](https://github.com/n0-computer/iroh-gossip) - [ ] [`iroh-blobs`](https://github.com/n0-computer/iroh-blobs) - [ ] [`dumbpipe`](https://github.com/n0-computer/dumbpipe) - [ ] [`sendme`](https://github.com/n0-computer/sendme)
1 parent 427fcad commit 2b36b77

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

Cargo.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

iroh-dns-server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ n0-future = "0.1.2"
3434
n0-snafu = "0.2.2"
3535
pkarr = { version = "3.7", features = ["relays", "dht"], default-features = false }
3636
rcgen = "0.13"
37-
redb = "=2.4.0" # 2.5.0 has MSRV 1.85
37+
redb = "2.6.3"
3838
regex = "1.10.3"
3939
rustls = { version = "0.23", default-features = false, features = ["ring"] }
4040
rustls-pemfile = { version = "2.1" }

iroh-dns-server/src/store/signed_packets.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,14 @@ impl SignedPacketStore {
272272
)
273273
})?;
274274
}
275-
let db = Database::builder()
275+
let mut db = Database::builder()
276276
.create(path)
277277
.context("failed to open packet database")?;
278+
match db.upgrade() {
279+
Ok(true) => info!("Database was upgraded to redb v3 compatible format"),
280+
Ok(false) => {}
281+
Err(err) => warn!("Database upgrade to redb v3 compatible format failed: {err:#}"),
282+
}
278283
Self::open(db, options, metrics)
279284
}
280285

0 commit comments

Comments
 (0)