I get several of these errors while running the 1.0 migration. How should I start trouble shooting this? I already set --concurrency 1
ERROR migrate::orchestrator::account: account failed account_id=12 error=account error: account 12 does not exist in v1 because its Account object was not written; fix the registry errors reported for it and run again
ERROR migrate::orchestrator: run failed error=transient error: RocksDB error (store.rocksdb-error): reason = IO error: While open a file for random read: /stalwart-migrate/new/stalwart_db-v1/003600.sst: Too many open files
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.
Those log lines are two separate problems, and the last one is what stopped the run.
Too many open files comes from the operating system’s per-process limit. RocksDB keeps every table file open, and with 53 GB already copied the store has a lot of them. --concurrency 1 won’t change that, so you can go back to the default. Raise the limit in the shell that starts the tool and repeat the same command with the same --state, it continues from where it stopped:
ulimit -n 65536
In Docker, use --ulimit nofile=65536:65536 on the container.
The account 12 does not exist in v1 errors are a consequence of something earlier: the tool couldn’t write the Account object for those 12 accounts, so it can’t copy their data. The real reason is in the report rows for those objects, and the log excerpt doesn’t show them. What does this print?
stalwart-migrate report --state <your state dir> --severity error
The rows that matter are the ones that aren’t account N does not exist in v1. Please post them here, with names or domains masked if you prefer.
stalwart-migrate 1.0.5, which goes out today, raises its own soft open file limit to the hard limit when it starts, so on most systems you won’t need ulimit -n any more. Until it’s out, the ulimit step above is the way to run it.
I still need the report --severity error rows to work out why those 12 Account objects weren’t written.
Upgrading stalwart-migrate to 1.0.5 fixed the too many open files error. Thank you.
This is the output you requested for addressing the other error:
run severity category account object id message
1 error failed - x:Account 12 rejected by v1: Invalid foreign key: Domain with id f
1 error failed - x:Account 14 rejected by v1: Invalid foreign key: Domain with id f
1 error failed - x:Account 17 rejected by v1: Invalid foreign key: Domain with id f
1 error failed - x:Account 22 rejected by v1: Invalid foreign key: Domain with id i
1 error failed - x:DkimSignature 336073411572794368 rejected by v1: Invalid foreign key: Domain with id i
1 error failed - x:DkimSignature 336073411876881920 rejected by v1: Invalid foreign key: Domain with id i
1 error failed - x:Account 13 rejected by v1: Invalid foreign key: Domain with id f
1 error failed - x:Account 15 rejected by v1: Invalid foreign key: Domain with id f
1 error failed - x:Account 16 rejected by v1: Invalid foreign key: Domain with id f
Those nine rows all come down to two domains. The ids are in the short JMAP form: f is domain 5 and i is domain 8. The tool tried to write accounts 12 to 17 (domain 5), and account 22 and the two DKIM keys (domain 8), but 1.0 had no such domain at that point, so it refused them. The accounts’ data can’t follow until their Account objects exist.
All of these rows are from run 1, the one that stopped on the open file limit. Has a run with 1.0.5 finished since? If so, this shows whether anything is still failing (use the run number that stalwart-migrate status --state <your state dir> reports as the latest):
I have the same problem, and upgrading stalwart-migrate to v1.0.5 did not solve the problem nor did it emit more helpful error messages or context information. I have many such entries from subsequent runs of stalwart-migrate. My next step is purging all v1 data and re-start the migration process to find out whether that makes a difference.
./stalwart-migrate report --state /var/lib/stalwart-migstate --severity error
run severity category account object id message
1 error failed - x:Account 3 rejected by v1: Invalid foreign key: Domain with id c
1 error failed 3 - - account error: account 3 does not exist in v1 because its Account object was not written; fix the registry errors reported for it and run again
2 rows
Domain c is the main domain of that installation, also used by other accounts than 3. This is odd.
./stalwart-migrate report --state /var/lib/stalwart-migrate --severity error
run severity category account object id message
1 error failed - x:Account 12 rejected by v1: Invalid foreign key: Domain with id e
1 error failed - x:Account 14 rejected by v1: Invalid foreign key: Domain with id e
1 error failed - x:Account 11 rejected by v1: Invalid foreign key: Domain with id e
1 error failed - x:Account 13 rejected by v1: Invalid foreign key: Domain with id e
1 error skipped - x:SpamTrainingSample 327185180355426304 blob a1ede38d9f2de8143fad68b2013ae0633645e262854f87596d8d22d5348f1cac is missing in the source; the object was not copied
1 error failed 11 - - account error: account 11 does not exist in v1 because its Account object was not written; fix the registry errors reported for it and run again
1 error failed 13 - - account error: account 13 does not exist in v1 because its Account object was not written; fix the registry errors reported for it and run again
1 error failed 14 - - account error: account 14 does not exist in v1 because its Account object was not written; fix the registry errors reported for it and run again
1 error failed 12 - - account error: account 12 does not exist in v1 because its Account object was not written; fix the registry errors reported for it and run again
9 rows
I’ve had a good look through the filesystem and can’t find any reported registry errors in any file (I may well have missed something obvious though).
Domain ‘e’ is the only domain in the system with an alias domain set, but apart from that I can’t see anything else different about it.
The two domains in the error report did not have a tenant assigned, so I assigned them. After that, the errors went away and I successfully migrated to v1.
This is interesting. Based on your observation, I removed all tenancy assignments and re-tried migration. Same result: no more error messages.
Thanks a lot for sharing your observation!
blackboard and Maus found it. In 1.0 an account or DKIM key has to belong to the same tenant as its domain. 0.16 didn’t enforce that, so a domain without a tenant can end up with accounts that do have one (or the other way around), and 1.0 refuses those objects when the tool writes them. Up to 1.0.5 the tool words that refusal as Invalid foreign key: Domain with id ..., which makes it look like the domain is missing; 1.0.6 prints ... is not in the same tenant as this object instead. Either way, every account on that domain then fails with account N does not exist in v1.
The bigger problem was that prepare didn’t notice and reported 0 errors, so you only found out after a run. That’s fixed for the next stalwart-migrate release: prepare now stops with an error for each of these objects, naming the domain and both tenants, so you can fix it before starting.
NAB, your accounts 11 to 14 are the same case: their tenant doesn’t match domain e’s. The alias domain has nothing to do with it. Until the new release is out, put domain e and those accounts in the same tenant in 0.16 (or remove the tenant from both), then repeat the run with the same --state. It picks up the changed objects.
The SpamTrainingSample row is a separate thing and harmless: that training sample has no message left in the 0.16 blob store, so there’s nothing to copy.