Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
[Qt] Add option to pause/resume block downloads #9502
Conversation
jonasschnelli
added the
GUI
label
Jan 10, 2017
|
Isn't network toggle button usable in this case? If it is not, let's fix it instead... |
|
I extracted this from my SPV branch. Especially there, it is very useful to pause IBD and continue with SPV during a time where you don't want to use all available resources on verification. But also without SPV, I think this can be useful (pause IBD and not loose broadcast capabilities, fetch headers but not the blocks)... |
|
IMO it would be too confusing to be worth it without "SPV" mode, but probably should go in after the latter is. |
|
Isn't network toggle button usable in this case? If it is not, let's fix it instead...
Imo those are different features, but I agree that the GUI should not
"diverge" in regard to presenting features. The toggle network
functionality should be removed from the network icon and a proper
button should be put beside the new "Pause" button?
|
|
The "Pause" button won't be visible in normal cases. |
Yes. These are internally two completely different features. Expose to the users, these have similar effects.
Yes. The modal overlay is currently only accessible during IBD. Though, we could extend it to support a state where the chain is in-sync and show it when someone click on the network statusbar icon. |
| @@ -14,6 +14,10 @@ void RegisterNodeSignals(CNodeSignals& nodeSignals); | ||
| /** Unregister a network node */ | ||
| void UnregisterNodeSignals(CNodeSignals& nodeSignals); | ||
| +/** if disabled, blocks will not be requested automatically, usefull for low-resources-available mode */ |
| @@ -81,6 +81,10 @@ class ClientModel : public QObject | ||
| QString formatClientStartupTime() const; | ||
| QString dataDir() const; | ||
| + // get/set state about autorequesting-blocks during IBD | ||
| + bool isAutorequestBlocks() const; |
kallewoof
Feb 28, 2017
Contributor
Nit: isAutorequestingBlocks (add ing). The setAutorequestBlocks below is fine as is, though.
laanwj
added this to the
0.15.0
milestone
Mar 14, 2017
|
Added 0.15 milestone |
|
Rebased. |
| @@ -23,6 +23,10 @@ void RegisterNodeSignals(CNodeSignals& nodeSignals); | ||
| /** Unregister a network node */ | ||
| void UnregisterNodeSignals(CNodeSignals& nodeSignals); | ||
| +/** if disabled, blocks will not be requested automatically, usefull for low-resources-available mode */ | ||
| +static const bool DEFAULT_AUTOMATIC_BLOCK_REQUESTS = true; | ||
| +extern std::atomic<bool> fAutoRequestBlocks; |
laanwj
Apr 19, 2017
Owner
Instead of exporting this variable (whose definition is an implementation detail) from net_processing.h I'd prefer a setter/getter, e.g. SetAutoRequestBlocks(bool) GetAutoRequestBlocks()
| @@ -233,6 +234,22 @@ QString ClientModel::dataDir() const | ||
| return GUIUtil::boostPathToQString(GetDataDir()); | ||
| } | ||
| +bool ClientModel::isAutorequestBlocks() const |
laanwj
Apr 19, 2017
Owner
isAutorequestBlocks is a bit of a strange name; isAutoRequestingBlocks maybe?
|
When re-enabling AutoRequestBlocks, what 'kicks off' the block requesting process again? Setting the flag will make it request blocks the next time |
|
Overhauled the PR and addresses @laanwj points. Also, I added the info "Blocks requested from peers" (blocks in flight). This may be important because pause will not result in disconnecting peers. Already requested blocks will be downloaded (and verified) in the "pause" state. If blocks are in flight and the pause has been triggered, there is now a special info label |
|
Well, I have to change my previous opinion. I think this can be useful. Concept ACK Will test soon. |
|
Needs rebase. |
|
ACK e952b67 Code looks good. On the UI feature, two minor comments:
|
|
Needs rebase. |
|
Rebased. |
|
Testing this again. ACK fc84323 I think this could be even more usable if it can be called once fully in sync with the network. But I can't display the overlay then... |
Hm I vaguely remember I added that functionality once, you should be able to bring up the overlay by the secret trick of clicking on the sync icon. |
|
@laanwj But the sync icon (you mean the triangle with an exclamation mark inside?) is not displayed when you are "in sync" with the network. |
There are four ways how the modal-overlay can be opened: Though I agree with you, there is no option how to open it once you are in sync... which could be useful, but independent to this PR. |
|
@paveljanik Oh, though it also worked with the checkmark that takes its place. |
Yes. We should probably allow that. |
|
Concept ACK. (I haven't reviewed the qt code at all, but I did look over the net_processing changes.) What is the intended behavior if the user turns off block download after being synced or nearly synced? I believe this PR only disables the parallel fetch logic, and not the direct fetch -- so block download could conceivably be disabled by the user, but blocks could still be requested as they are announced. (Maybe this is hard to accomplish, if the modal overlay is not accessible when bitcoind is close to synced, but my recollection is that the modal overlay becomes visible whenever the headers chain is out of sync, which can happen even after leaving IBD, does that sound right?) Perhaps the ability to disable block download should disappear if we're close to caught up, eg if Additionally, perhaps if we've disabled block download, we should also disable transaction download. |
jonasschnelli
added some commits
Jan 10, 2017
|
Rebased and addressed the The current implementation avoids exposing I'm not doing to tackle the transaction download in the PR (main scope is disabling block download). |
|
ACK I have tested this on a node that was a few weeks behind and I was able to pause the block download multiple times while it was syncing. I noticed that even when paused, UpdateTip is still happening for hundreds of blocks after what the GUI said still needed to be downloaded. I assume this is because it still processes all of the blocks that have been downloaded and the downloading happens faster than the processing. The UpdateTip lines do stop after a while which I assume is because all downloaded blocks have been processed. |
Yes, that's expected. We download multiple blocks in parallel, ahead of the next one to connect. I expect that this PR also keeps processing the ones that were in flight at the time blocks downloads are disabled. |
| @@ -334,6 +354,33 @@ QLabel { color: rgb(40,40,40); }</string> | ||
| <number>10</number> | ||
| </property> | ||
| <item> |
promag
Jul 17, 2017
Contributor
Nit, can't comment there, but remove leftMargin above to be consistent.
| @@ -334,6 +354,33 @@ QLabel { color: rgb(40,40,40); }</string> | ||
| <number>10</number> | ||
| </property> | ||
| <item> | ||
| + <widget class="QPushButton" name="pauseResumeVerification"> |
| + | ||
| +void ModalOverlay::updatePauseState(bool pauseActive) | ||
| +{ | ||
| + ui->labelNumberBlocksRequested->setText((pauseActive ? "Finish downloading blocks": "Blocks requested from peers")); |
promag
Jul 17, 2017
Contributor
Don't see the need to change label, maybe a generic Downloading: %d blocks?
| +{ | ||
| + ui->labelNumberBlocksRequested->setText((pauseActive ? "Finish downloading blocks": "Blocks requested from peers")); | ||
| + ui->pauseResumeVerification->setText((pauseActive ? "Resume downloading blocks ": "Pause downloading blocks")); | ||
| + ui->infoLabel->setText((pauseActive && getAmountOfBlocksInFlight() > 0 ? "Wait to finish current downloads...": "")); |
promag
Jul 17, 2017
Contributor
I don't know if you plan to show other messages for this label, but if not then toggle visibility like above?
laanwj
modified the milestone: 0.16.0, 0.15.0
Jul 18, 2017
|
This has missed the 0.15 feature freeze, moving to 0.16. |
jonasschnelli commentedJan 10, 2017
This, almost UI only change, will add a Pause/Resume button to the modal overlay to pause/resume block downloads during IBD.
This is an effective way to pause/resume IBD during a time when the computers resources are required somewhere else.