-
Notifications
You must be signed in to change notification settings - Fork 452
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
Use SQLite to store torrent checkpoints data #5669
Comments
@egbertbouman , we need your opinion on this, as the person who touched the wrapper/checkpoint files most closely? |
I don't really see how the issue you referenced is tied to the fact that we're storing the metadata/stats in files. Since we have to write the metadata/stats ourselves in both situations, the incorrect data will just be in the database instead. I also don't get the benefit in terms of hassle. If there is a performance improvement by using the database, I think it's worth investigating this. Just for my understanding. What information that we're currently getting from files, will be faster by moving it to the database? |
AFAIK, in our current design, we store the upload/download counters in-memory. We dump the data on disk only when closing Tribler, right? When opening Tribler, we load all the counters back into memory. This may cause losing ratio counters if Tribler was shut down incorrectly. By using SQLite we can solve persistence/shutdown problems with dlcheckpoints, while simultaneously removing a lot of utility code for e.g. managing our own file format for config files. Also, this will enable us to cache torrent bencoded dicts in the DB, as we did before in times of |
I like the idea of persisting stats but if something like this #5252 happens the user will lose their downloads (list). |
The stats are collected by libtorrent itself (it's part of the resumedata). When checkpointing, this data is stored in the checkpoint file, along with the metadata. |
You mean, the stats are stored in binary form and read directly by Libtorrent, right? |
Correct, when we resume a download after a restart, we give to metadata/resumedata back to libtorrent: tribler/src/tribler-core/tribler_core/modules/libtorrent/download.py Lines 160 to 168 in 8ad6a59
|
Not an expert on performance or balance design as discussed above; but.... |
Firefox uses SQLite internally. I guess if it is good for them, it is good for us too... |
We'll follow the advice of @egbertbouman and not do this. |
Currently, we store torrent data and stats in separate files in the
dlcheckpoints
dir. Libtorrent never touches any of these. Instead, we mediate its access through Python code.Moving to use PonyORM backed SQLite storage for torrents will save us a lot of hassle regarding file access synchronization/persistence, the kind of things affecting e.g. #5615. Also, it will enable simpler and tighter integration with Channels database, resulting in faster UI response.
What do you think, guys?
The text was updated successfully, but these errors were encountered: