-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Allow to store "resume data" in SQLite database file #14726
Conversation
a5e1c3b
to
01c06ce
Compare
When going from sqlite -> fastresume, shouldn't it create the |
It was done initially in an optimistic/lazy manner (it just allowed the queue to be saved at its regular time, at least when the application was shut down). Now it should do this immediately after the storage conversion is done. |
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.
it seems currently we don't need to be worried about sql injections right? All code paths only uses our own defined strings/columns.
I don't think there is any acute problem here, but we still need to evaluate it further. Perhaps some of the first users will be interested in researching it. |
e2bef24
to
0cfbb54
Compare
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.
(this is kind of a non-review)
This seems really awesome but haven't had the time to test this out, so I only left some minor comments. Nevertheless, after those are addressed, I'll immediately approve this, because it is off by default and it is gated behind an advanced settings toggle labeled "experimental" - because of this, there isn't any risk in breaking things for those who are not prepared to risk that. It seems desireable to get this into the hands of a larger audience of power users more quickly for feedback than to sit on it for long.
Also, I don't have much experience with using such tools to store program data, so I have a few questions:
- How easy does this makes upgrading to a new format? IMO the biggest pain point in changing the fast resume code is having to introduce janky temporary "upgrade code". I understand this solves that particular problem, but I'd be interested in some details, if you could explain them please.
- Similarly, what happens if the user wants to downgrade? Can the database also automatically downgrade, or would it be backwards-incompatible? If the latter is the case, what would a user have to do to downgrade the database (I'm mainly interested in knowing whether or not such a task can be accomplished by an average user)?
The current solution does not offer strong guarantees when downgrading between versions where the fastresume format changes; on the other hand, it "just works" if the format hasn't changed between versions.
If you mean an upgrade from one database layout to another, then it looks at first glance comparable in complexity to other data storage formats. Much depends on the changes in the data itself that need to be stored.
As I mentioned above, it depends on the specific case. To begin with, I added simple versioning so that we can later more easily determine the current data format to decide if it needs an upgrade. As for the downgrade, we don't really care about it even now. For me, such concern generally looks counterproductive. We just don't have to make changes in places like this (data storage format, etc.) too often. The user must take care of the backup of the current data during a major update, in case he decides to downgrade later. As for the first implementation, it will work almost the same as current bencoded ( |
@glassez Then once there are a couple of stable releases that have this included change it to the default that way the previous stable version still supports it so reverting won't be a problem. |
@zero77 |
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.
Approved as per #14726 (review).
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.
PR is rebased on top of current master to get compatible with new tags implementation. Need to be formally approved so I can merge it.
I am glad that this was the direction like my own initial try. I couldn't then figure out your suggestion for separating out the bencoded data. And something to ponder for future iterations: Does it make sense for us to dissect the native libtorrent format, when that format can change in the future? Sadly I was not able to follow through with that old PR. |
These are memories from the era before libtorrent-1.2. But now we have resume data in the form of
It might make sense if we get some benefit from it, so the extra care will be justified. |
gets this on the first startup after setting storage type to sqlite (ignore qbittorrent version it's built on top of the current master), qBittorrent has crashed qBittorrent version: v4.2.5 (64-bit) Caught signal: SIGABRT
|
my bad there was something wrong with my CMake configuration. |
Allow to store "resume data" in SQLite database file
@glassez Since
Can this be ignored? |
Yes. But we still need to fix it. It's a regression of 05e3e46. |
Will you do it or will I? PR title?? |
I'll fix it in #14976. |
It is available as "experimental" advanced option.
Existing "resume data" is transferring in selected storage once you start qBittorrent with changed option.
libtorrent native "resume data" is stored in bencoded form in single database column to simplify first implementation. Actually we don't need to split it into separate columns until we really implement some improvements that need such data layout. But since until then we can't have an accurate idea of what kind of layout and data format of individual columns we will need, it is completely useless to do any kind of separation now.