Skip to content
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

"Clean database" option randomly nukes some galleries' metadata #635

Closed
soarpasser opened this issue May 29, 2022 · 1 comment
Closed

"Clean database" option randomly nukes some galleries' metadata #635

soarpasser opened this issue May 29, 2022 · 1 comment

Comments

@soarpasser
Copy link

soarpasser commented May 29, 2022

LRR Version and OS
v0.8.5
Windows 10 MSI

Bug Details
Clicked the "clean database" button to try and "remove the entries that aren't on my filesystem", but instead it nuked the metadata of some galleries that are ON my filesystem (but just renamed), and also removed them from their respective categories. I thought this only affected the entries that I have renamed, but it also seemed to affect the entries that haven't ever been renamed or moved. Countless hours of work into tagging were lost on one simple click. ┗( T﹏T )┛

Matching Logs

[2022-05-29 21:06:59] [Archive] [warn] File exists but its ID is no longer d185c0f7effbd969d56a8f066ad47de3670772fd -- Removing file reference in its database entry.
[2022-05-29 21:06:59] [Archive] [warn] File exists but its ID is no longer 473c2c546999c97e33c3fc77bfcc3187549be85a -- Removing file reference in its database entry.
[2022-05-29 21:06:59] [Archive] [warn] File exists but its ID is no longer 74d4ffe0598aac95687633644c1b84ac4816c46b -- Removing file reference in its database entry.
[2022-05-29 21:06:59] [Archive] [warn] File exists but its ID is no longer 6913db24dc00facf0f7b00a120b0b1562a1b4148 -- Removing file reference in its database entry.
[2022-05-29 21:06:59] [Archive] [warn] File exists but its ID is no longer e7e8273daf8aa77724295f6d168ad802fca902d2 -- Removing file reference in its database entry.
[2022-05-29 21:06:59] [Archive] [warn] File exists but its ID is no longer ac1c32417d2206e705bd6379b3b5b3ff3a794fd2 -- Removing file reference in its database entry.
[2022-05-29 21:06:59] [Archive] [warn] File exists but its ID is no longer 6e213b1e0fad0a38c2dad8a9f8b36a6e366cf5cb -- Removing file reference in its database entry.
[2022-05-29 21:06:59] [Archive] [warn] File exists but its ID is no longer 22a2558943822c603c989fd3d374d2327cd82e20 -- Removing file reference in its database entry.
[2022-05-29 21:06:59] [Archive] [warn] File exists but its ID is no longer 4191645e1041b362e54e33625134fbc45f58dda3 -- Removing file reference in its database entry.
[2022-05-29 21:06:59] [Archive] [warn] File exists but its ID is no longer d81a87433583f9f7a2c6b0ec73baad1f496629ca -- Removing file reference in its database entry.
[2022-05-29 21:06:59] [Archive] [warn] File exists but its ID is no longer ff716dde7285d6f0da2b3d25eeac2239d3714399 -- Removing file reference in its database entry.
[2022-05-29 21:06:59] [Archive] [warn] File exists but its ID is no longer e6d6c4cb2090918ce60fb8dbb6ceef65cb3bf163 -- Removing file reference in its database entry.
[2022-05-29 21:06:59] [Archive] [warn] File exists but its ID is no longer f93c3265f400377d2fcf383cbbaf8ee4700fc715 -- Removing file reference in its database entry.
[2022-05-29 21:06:59] [Archive] [warn] File exists but its ID is no longer d2e58525d29d8ba04c0addcbbfba7efe7e555ae8 -- Removing file reference in its database entry.
[2022-05-29 21:06:59] [Archive] [warn] File exists but its ID is no longer e2f5348b1c13e027613884d9010f1e090f55aa93 -- Removing file reference in its database entry.
[2022-05-29 21:06:59] [Archive] [warn] File exists but its ID is no longer 228347b547e59cea4bcea7b40fd1df3d8db4c30b -- Removing file reference in its database entry.
[2022-05-29 21:06:59] [Archive] [warn] File exists but its ID is no longer d94df611170c4f44b03f0a8d7324230b41071694 -- Removing file reference in its database entry.

[2022-05-29 21:08:12] [Categories] [error] 0da8f55ec7fa56d08d8f70dcf21d4b3077563d7f does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] ca0272dfdac52e8f39d03de1b5f3fb32ea314553 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] f93c3265f400377d2fcf383cbbaf8ee4700fc715 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] b43209d8858840079acfc4840505998c201bc462 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 688e1d7c5ccf6353b6327d34fd415a00c5654bb7 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 80330a6a29d636c64fa08f40ed6a08a1e33199bc does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] b578787de59e86d554c4e910eba08f12326fd89f does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] ea75573ad46d1b34e53c0a044d4c0af7c5b42a70 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] ec22ce356f6421902f1736400cf1d5872b5d7cb8 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] ea95006bcfb3e6fdcf719e6386d739cf44c5bda6 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 1acd8f420ff6963765b193a6b72785b44dbd3e8f does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 38314305d3ad1c6ab05ce047d7f873ca87b0e8d9 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] d6d7ab47ecac93c5d2497376843d3b6e75d1f192 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] a82f8edd2969879b294de9e890c7664533919e16 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] eea868d0f3d56d27cac3dd512eea5a5f5e9f9d8d does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] b4ed15ccaf3465e6028a32143b62066c78efb43a does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 43485d77947cb789b9db7708ab6381a8ea214d75 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] bf0da0c1c44f21df5b6f18ea0f17605b7c3a5955 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] f15778b9ce1951f2c33ceb51d123ba3cbf2394e5 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] d17383d90be1a7cf7a47d04dd1990d1a22d44eb5 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 109eee16e01acbf7c79ca9cff793c4a28574de28 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 79fb823985136e3ff2ba6076a2ec10db0c5bdb21 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 92f651694ecfe8659f828fa9d162d52f4575f170 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] aea26b3cbfa5f72809bd5fd3892ebb43398e8860 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 977e60885feb7e6a19150c0c765746f9bc3e1314 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] db743504adf305505cd202d36001aec93534f789 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] c3e1d85f7ff0ec2e816f0e67c1348bc134a6c43f does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] c6b7c7d5630756b5aaff45c8ff7acbd14185238e does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 1487a9c6c4bb7015a21fbe65e29ede574097f72a does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 3764cb16b2768bbafc81f3cd632219f37da4d877 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 15be365204827d3ef270225639720aa99f546d72 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] b107ac8c406e2928a861d27b971b6e31cb741c95 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] f5cef22cc136521a004887b45c85bc931ced1f77 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 82404898d55e193c543cb1b17292fa211fd94450 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] c1d27ac07e6614d3a0e1d633e698d5d1d96c1f41 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] add7819e77e4e615f40c277b4cdc86874cbdc3f3 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 95dba48b02ddf3cc8c2e06c0a16583ea03aa1461 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 109bbb827029dad6f49d21967f93829bcc1d6b9d does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 5b4d106cfb5e5001c4f40f5a8576f1cf4be8cd7b does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 2ba9424fc908d2db3d3d5274f3a1bc590b497926 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 04c5e2c049ac9b2928ecade3cd10be41cbca2d24 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] df51f48d3ac5e8ad14c65c7be8ae2ebff28353e6 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] b327d81d75b408b01b2611ba2397d6471a408ae9 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 3a5abc1133a5549e717014eed1ad0f3c66218581 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] c787bef3997dd481a674114c5252f1d609d1dc0d does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 2789738cc59187ad279cfd8ee168e86f46d0fc9e does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 863ef3d2d28423922442cbe81d896b6207371508 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] a6034a769e404cdbf62a815fe568a376eb62a0cf does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 3cbef5193f51cb8876acfa6c2b8be511c0a1a605 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] d853fd871f304ce5841830e0ba4bbebc61a7e6cd does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 8498940ab754024a21408cb9aea6b90f325372f7 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 8274ff0eade83f23e8ec12bb1f817ea48e3f7f2b does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] cbd2af92836a2b380f11daebe05b7742a44873be does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 80f168e454205d64a5cc2863aafb3dc5deb98606 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] ce07f2782b39564f57cfbf0920ac2106891c4302 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 67a9a9ed4053acf17ed27168d5b27cccbaf83a9f does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 1efade3c9c716522bf5d0aa2a365c6252517872f does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] b59cd1b6080d14045427e66cd8c6f8a2197e3c4b does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 19a0e4b134680a862b7cfb684a4d7e5a0d22e47d does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 31fd52eeb63fcbc76894a6c842994edb94f1d5b7 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 280cd4375ed38b948373f70185a5ae331397bfb5 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] f9ad2d6beae2306a33139c1e92ee9dff0f135903 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 5236cacbe431ba499313391b2d655f2f5de62f45 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 4d0ba652f98d326471dd82fe5ca29f4c33e4bd28 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] fe8efd0904caef7307a854a9a901dfeb3790f284 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] c0e9dd163ae1ad9313f68037beafd3aabc275917 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 1bac2fd6cf9b4526b7530cb3b87906fe5674ff12 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 1ae3cba4429404c2937a2abd1db55782f72762b4 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 7839102bb312292544cc9e983af0cfb71252ab6a does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 0a3274669634c08d9348781a17fd87c8cd3473da does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 9f902a3a604d30d5598c73e577eb645b1991821f does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 5bc09e9f2df7c276125167e5c8fb2289e5c05463 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] f15509aa33fbfa7f520f9f8281b3d6a9e5be7264 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 227a312ab45edda52498793983ecc10aac74859d does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 5de3745d105cb0d72e6a08b04204d5efdaccd58b does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 193a1d6a20e443c4c55f8c71da9bad388198e60e does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 2b1bb69b3302c98a590dd36a462dd9ad93430e3e does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 42e37ea5242d7490c188e304c831ab5db7cf540b does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] e2068041158615de16c37d372c6228c8e6e46d68 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] bea59e7ddd639f03e243993ef3f8117e8acfe275 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 6c7247e29554abef24db35b3d58494b346357dba does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 2446b7ad203cfda0e5f2926e39a16c3040ca09ff does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 7b784f4f1108e4b802531a7d7e60e52f2610dc53 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 78a193aaa75cb2d27b2b5584da17a84b45a77c16 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] e895ea84613a09b23f78791e109442058f2c5095 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] abdb62330bb2c7dd6a51b08a6d8b48d690b2769c does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] d19ea7266072b016a756b7fe437cf8317e3b252c does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 23a987f71df9b0c60dbe508c338fe5728896f4f1 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] a6cf7264edc09ebb7a7d32789e86c551a0ad7fbf does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 0af88faeb9b575c3d3d46e40b46ea2e9417ad227 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 1593c00c3ff7b3095fdbfc12e9822f8a7e933a31 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] a83fcea90299be6bbb8cf72312562986b9515bca does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] c71aa1f14406e2a39eead83f162548a41f683c26 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 10e713460185a209b1f60b5ab81b0e1ccbfcac27 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] ff716dde7285d6f0da2b3d25eeac2239d3714399 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] ee622aa41d8325c41350fa990accf169928d3dd0 does not exist in the database.
[2022-05-29 21:08:12] [Categories] [error] 9741f9166288c3520e77d0265b9c8309cb554409 does not exist in the database.

Screenshots
image

@Difegue
Copy link
Owner

Difegue commented Jun 1, 2022

Well, I hope you made a backup! 😬 DB cleanup actually makes an automatic backup so your metadata might not be lost -- Search in the LRR folder (openable from the windows app) for an autobackup.json file!

This issue actually doesn't have anything to do with renaming -- I suspect you modified the contents of the archives after adding them to LRR, which leads to their IDs changing. (IDs are calculated based on a hash of the archive file)

Modifying files used to simply disconnect them from their database entry, but I made some changes in v.0.7.7 to alleviate this:

The main difference with this approach is that if you modify an archive after adding it to LRR, its ID will now remain the same instead of becoming a new entry to match the new hash.
This has both good and bad consequences:
👍 You won't get duplicate entries anymore, and your metadata stays assigned to the file, as the ID doesn't change.
👎 If you restore a JSON backup on a new install, it's likely that your metadata for modified files won't be restored, as the newly calculated ID won't match the one in the backup. Which means you'll have to get your hands dirty and fix the IDs in the backup yourself but that's what you deserve for mucking up your files ya dingus

The database cleanup routine, on the other end, goes through the recorded IDs in the database and removes them if it can't find a matching file. Since the old ID now technically doesn't match any existing hash (as the archive data itself was modified), it gets removed.

There's a warning system in place so you need to run the cleanup twice for it to actively delete old entries, but nevertheless I'll admit there was a fatal flaw here 🙏I'm pushing a change to the cleanup routine so that it'll try to change the ID to the new one before removing data.

Thanks for the report! Hopefully this doesn't happen again. 😅

@Difegue Difegue closed this as completed Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants