We're Hiring!

Mattermost Discussion Forums

Missing attachments (files/dirs) causing bulk export/import to fail

Missing files in the data/ dir are causing bulk export/import to fail when I’m trying to include attachments

Steps to reproduce
Delete files from the data/YYYYMMDD directories
Try to run a bulk export with attachments and it will fail
Try to run a bulk import with attachments and it will fail

Expected behavior
The failure is expected, I just need a work around

Observed behavior
Error: BulkImport: Error reading the file at: “/opt/mattermost/old-data/teams/bf5w9anc9bnz8xyfi7tsyemzeh/channels/8oxq5fej8p8qmddfpwgeax49me/users/qg5qfw63utymdcibe3w35oy5uc/mrdkaoyuhtgpzbgfge3ou58hjh/Image Pasted at 2017-5-23 13-51.png”, open /opt/mattermost/old-data/teams/bf5w9anc9bnz8xyfi7tsyemzeh/channels/8oxq5fej8p8qmddfpwgeax49me/users/qg5qfw63utymdcibe3w35oy5uc/mrdkaoyuhtgpzbgfge3ou58hjh/Image Pasted at 2017-5-23 13-51.png: no such file or directory

Current mattermost is 5.33.3
Trying to import to 5.37.2

Since I have a database issue right now, I’m unable to upgrade my version of mattermost. So, I’ve decided to try a bulk export and then import to a new instance. The issue is, somewhere along the way it looks like a number of directories were deleted from the data directory. Because of this, when I try to export with attachments, it fails saying it can’t find the file. Which is correct because the file isn’t there. Same happens when I try to do a bulk import and I’ve moved the data directory by hand (its still missing the same files of course).

Also, when I try to do an export it fails with a similar error because of the missing file. I’ve tried bulk export and using mmctl and both fail at the missing file/attachment

Is there some work around where I can say ‘yes, its missing attachments, please just continue’?

Side note:
I cannot upgrade the current mattermost because of this database error. I’ve tried several different versions but I cannot use anything newer than 5.33.3. But I would rather migrate to another instance of mattermost
{“level”:“error”,“ts”:1634518984.4649901,“caller”:“sqlstore/store.go:170”,“msg”:“Failed to apply database migrations.”,“error”:“Dirty database version 1. Fix and force version.”}

We have a fix submitted for this, which we are planning to backport to 5.37.x.

Is there any way I can apply that fix? I’m a little stuck since I can’t upgrade, and I can’t migrate to another instance.