Allow to cancel the txdb upgrade via splashscreen keypress 'q' #10660

pull jonasschnelli wants to merge 6 commits into bitcoin:master from jonasschnelli:2017/06/chainstate_update_prog changing 6 files +61 −3
  1. jonasschnelli commented at 7:51 AM on June 23, 2017: contributor

    Progress calc credit: @sipa

    This PR will accomplish three things:

    • Show the progress of the UTXO-db upgrade in the Qt splashscreen and in the debug log:
      • 2017-06-23 07:49:55 Upgrading utxo-set database...
      • 2017-06-23 07:49:55 [0%]...[0%]...[13%]...[25%]...[39%]...[52%]...[63%]...[76%]...[90%]...[DONE].
    • Allow to shutdown during the UTXO-db upgrade (ctrl-c, Qt quit)
    • Allow to press q in splash screen to shutdown.

    Let me explain why keypress instead of buttons: The current splash screen is a drawn pixmap. Adding buttons there will require a complete re-design of the splashscreen (should be done once). It should be an auto-resizing QWidget as used in the other layout situations.

    For getting a UTXO-upgrade abort into 0.15, this solution may be acceptable.

  2. jonasschnelli added the label UTXO Db and Indexes on Jun 23, 2017
  3. jonasschnelli force-pushed on Jun 23, 2017
  4. jonasschnelli force-pushed on Jun 23, 2017
  5. jonasschnelli force-pushed on Jun 23, 2017
  6. jonasschnelli commented at 7:53 AM on June 23, 2017: contributor

    Speak up if you have a better, state-less solution for the UI progress callback.

  7. laanwj commented at 8:30 AM on June 23, 2017: member

    Awesome! Will test.

    The current splash screen is a drawn pixmap. Adding buttons there will require a complete re-design of the splashscreen (should be done once). It should be an auto-resizing QWidget as used in the other layout situations.

    TBH this doesn't matter much. This is a one-time scenario, it's important to have something that works reliably, it doesn't need to look pretty.

  8. jonasschnelli renamed this:
    Allow to cancel the txdb upgrade via splashscreen keypress 's'
    Allow to cancel the txdb upgrade via splashscreen keypress 'q'
    on Jun 23, 2017
  9. in src/txdb.cpp:339 in 8aaf606cec outdated
     335 | +        }
     336 |          std::pair<unsigned char, uint256> key;
     337 |          if (pcursor->GetKey(key) && key.first == DB_COINS) {
     338 | +            if (count++ % 256 == 0) {
     339 | +                uint32_t high = 0x100 * *key.second.begin() + *(key.second.begin() + 1);
     340 | +                uiInterface.ShowProgress(_("Upgrading UTXO database") +"\n"+ _("(press q to shutdown and continue later"), (int)(high * 100.0 / 65536.0 + 0.5));
    


    achow101 commented at 7:40 PM on June 23, 2017:

    Couldn't this just be one string with a \n in the middle instead of two separate strings?


    laanwj commented at 11:17 AM on June 24, 2017:

    From my experience, translators hate messages with html or newlines in them, increasing the chance to make a mistake there.


    laanwj commented at 11:19 AM on June 24, 2017:

    shut down as two words maybe?

  10. sipa commented at 9:20 PM on June 23, 2017: member

    Tried this. Two issues:

    • 2017-06-23 21:15:54 [15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%]...[15%].... We should probably only print at most once for each %.
    • There seems to be a space missing between the message and the percentage in the spash screen.
  11. jonasschnelli force-pushed on Jun 28, 2017
  12. jonasschnelli force-pushed on Jun 28, 2017
  13. jonasschnelli commented at 7:31 PM on June 28, 2017: contributor

    Rebased and overhauled. Addressed @sipa's points. Also reports now [CANCELLED] instead of the [DONE] when shutting down during txdb upgrade.

  14. laanwj commented at 3:17 PM on June 29, 2017: member

    Tested upgrade w/ my test data up to height=430234:

    • quitting with q worked, it indeed continues on next start
    • killing with kill -9 also made it continue at next start without problems
    • progress logging in debug.log is as expected
    • upgrade succeeded, node is running
  15. in src/qt/splashscreen.cpp:145 in 5b304a180b outdated
     140 |  }
     141 |  
     142 | +bool SplashScreen::eventFilter(QObject * obj, QEvent * ev) {
     143 | +    if (ev->type() == QEvent::KeyPress) {
     144 | +        QKeyEvent *keyEvent = static_cast<QKeyEvent *>(ev);
     145 | +        if(keyEvent->text()[0] == 'q' && continueAction != nullptr) {
    


    laanwj commented at 3:24 PM on June 29, 2017:

    I'd prefer breakAction to 'continueAction'. Continue, to me, implies that it's part of a pause/continue kind of functionality, not early quit.

  16. jonasschnelli added this to the milestone 0.15.0 on Jun 29, 2017
  17. jonasschnelli force-pushed on Jun 29, 2017
  18. jonasschnelli commented at 3:45 PM on June 29, 2017: contributor

    Agree with @laanwj, changed continueAction (and similar function names) to breakAction. (amend commits / force push)

  19. jonasschnelli force-pushed on Jun 29, 2017
  20. [Qt] allow to execute a callback during splashscreen progress 00cb69bc86
  21. Allow to shut down during txdb upgrade ae09d4583b
  22. Allow to cancel the txdb upgrade via splashscreen callback 316fcb5106
  23. Show txdb upgrade progress in debug log 06c5b6edd3
  24. Report txdb upgrade not more often then every 10% 83fbea3f25
  25. Report [CANCELLED] instead of [DONE] when shut down during txdb upgrade 542ce6e246
  26. jonasschnelli force-pushed on Jun 29, 2017
  27. laanwj assigned laanwj on Jun 29, 2017
  28. laanwj commented at 5:51 PM on June 29, 2017: member

    ACK 542ce6e

  29. laanwj merged this on Jun 29, 2017
  30. laanwj closed this on Jun 29, 2017

  31. laanwj referenced this in commit 0c3542e5de on Jun 29, 2017
  32. TheBlueMatt commented at 9:11 PM on July 7, 2017: member

    utACK with the changes at #10770.

  33. codablock referenced this in commit 1ffecd3084 on Sep 27, 2017
  34. codablock referenced this in commit 7e380733cc on Oct 12, 2017
  35. codablock referenced this in commit bef651b8db on Oct 26, 2017
  36. codablock referenced this in commit a39b4af685 on Oct 26, 2017
  37. codablock referenced this in commit cd5cdab282 on Oct 26, 2017
  38. codablock referenced this in commit f10a882ca6 on Oct 30, 2017
  39. codablock referenced this in commit a3292b7caf on Oct 31, 2017
  40. codablock referenced this in commit 5f1eebe9cd on Oct 31, 2017
  41. codablock referenced this in commit 1a9add78c9 on Oct 31, 2017
  42. UdjinM6 referenced this in commit e50805fe04 on Nov 8, 2017
  43. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-22 06:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me