V1 started against old v0.16 database - is blob store safe?

Your question

I made a mistake and pointed the new stalwart v1 at the old config file after the migration. Docker logs repeat the following line:

⚠️ Startup failed: Failed to iterate store: PostgreSQL error (store.postgresql-error): reason = error deserializing column 1: cannot convert between the Rust type `&[u8]` and the Postgres type `int8`, causedBy = crates/store/src/dispatch/store.rs:152

I am about 99% sure that this error is early enough to not cause any data integrity issues, and v1 started up fine after pointing it to the correct DB, but I wanted to double check. Thanks.

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

Your reasoning looks right, but I haven’t confirmed it for every startup path. The error comes from a read, not a write.

The line store.rs:152 is the generic iterate wrapper. It runs a read-only scan of the store, and the PostgreSQL driver failed while decoding a column. The old v0.16 table layout stores that column as int8, and v1 expected &[u8]. The failure happened while deserializing a row that had been read. That is the symptom of a schema mismatch, and no write was involved. The startup failure was then reported and the process stopped. I found nothing in that code path that writes data. I didn’t trace everything v1 does at startup before it reaches that scan, so I can’t promise that nothing ran earlier.

Some practical checks:

  • Make sure the v1 instance you pointed at the old config never got past startup. The log you pasted says it didn’t.
  • Confirm that your normal v1 startup is now clean. You said it is.
  • Spot-check a few mailboxes through JMAP or IMAP, and check that the blob store is intact. Blob data is only read by the code that reads messages, so it shouldn’t have been touched.
  • If you have a backup or snapshot from before the mistake, keep it until you’re satisfied.

If you ran the old config against a database that was already migrated, you can still follow the upgrade guide to check the migration state: Overview | Stalwart

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.

Your blob store is fine. The blob store settings live in the database, and 1.0 stopped before it got to read them, so it never opened the blob store at all.

The only thing that start did to the old PostgreSQL database was a CREATE TABLE IF NOT EXISTS for every table 1.0 uses, which adds the ones 0.16 doesn’t have as empty tables and leaves the existing ones alone. Right after that it tried to read its node id and failed on the first query, because the 0.16 table with that name has a different column type, before anything was written. 0.16 ignores tables it doesn’t know, so the old database still works as a fallback.