yadayada / acd_cli

An unmaintained command line interface and FUSE filesystem for Amazon (Cloud) Drive
Other
1.35k stars 165 forks source link

How to purge dangling parents? #571

Open legnaleurc opened 7 years ago

legnaleurc commented 7 years ago

I'm not sure how to reproduce this, but I have some nodes which have dangling parents, i.e. the ID does not exists in nodes table.

I think if we alter the table parentage's key parent to FOREIGN KEY(parent) REFERENCES nodes (id) could solve/detect this problem, since the folders table has been removed from schema version 2.

bgemmill commented 7 years ago

I did the schema change you mentioned a while back in #374, but the larger issue is that the nodes table is just missing a value. Have you had successful a successful sync before running into this?

legnaleurc commented 7 years ago

I think so. It will show Root node not found. Sync may have been incomplete. warning at the first time sync, but succeed at the second run.

I also dumped changes list into a file, and it indicates that it added a node, but its parent does not exists anywhere.

These nodes will break some functions, because when we attempt to do cache.first_path(node_id), it always fail.

If the tables are supposed to reflect what changes list do, we could probably add a function detect orphan nodes, and let users decide how to fix them.