-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CON-510] Migrate legacy storage paths in background #4363
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generally really nicely done, main thing we should talk about is the dir / image / nondir stuff, i need to handle that in my pr as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really really clean and thorough code. PR desc and code both very easy to follow. great work
p much good to go imo, 1 question about terminal condition of the while loop
and we should fast-follow the prom metric
Description
migrateFilesWithLegacyStoragePath
type=image
rows and their correspondingtype=dir
row non atomicallyDatabase impact
SELECT * FROM "Files" WHERE "storagePath" NOT LIKE '/file_storage/files/%' AND "storagePath" LIKE '/file_storage/%';
SELECT COUNT(*) FROM "Files" WHERE "storagePath" NOT LIKE '/file_storage/files/%' AND "storagePath" LIKE '/file_storage/%';
SELECT "storagePath" FROM "Files" WHERE "multihash" > 'Qma' AND "type" != 'dir' AND "storagePath" NOT LIKE '/file_storage/files/%' AND "storagePath" LIKE '/file_storage/%' LIMIT 100;
File storage impact
avg track+image file size
*# of tracks and files on CN2
SELECT COUNT(*) FROM "Files" WHERE "type" != 'dir' AND "storagePath" NOT LIKE '/file_storage/files/%' AND "storagePath" LIKE '/file_storage/%';
Testing Legacy Path Migration
migrateFilesWithLegacyStoragePath
to false in config.jsUPDATE "Files" SET "storagePath" = CONCAT('/file_storage', SUBSTRING("storagePath" FROM 20)) WHERE true;
docker exec -it cn3_creator-node_1 /bin/sh
and move each file manually:cd /file_storage/files; ls
then for each dir:mv <dir>/<CID> /file_storage
migrateFilesWithLegacyStoragePath
to true in config.jsOther tests
Monitoring - How will this change be monitored? Are there sufficient logs / alerts?
filesMigratedFromLegacyPath
metricError migrating legacy storagePaths
,_copyLegacyFiles() could not remove
, orError updating legacy path db rows
SELECT * FROM "Files" WHERE "storagePath" NOT LIKE '/file_storage/files/%' AND "storagePath" LIKE '/file_storage/%' ORDER BY "multihash" ASC LIMIT 100;