Use CScheduler for wallet flushing, remove ThreadFlushWalletDB #9605

pull TheBlueMatt wants to merge 3 commits into bitcoin:master from TheBlueMatt:2017-01-cscheduler-cleanups changing 8 files +42 −46
  1. TheBlueMatt commented at 9:04 PM on January 20, 2017: contributor

    Also uses std::function instead of boost::function.

  2. fanquake added the label Refactoring on Jan 20, 2017
  3. in src/scheduler.h:None in 5d0d061480 outdated
      21 | @@ -23,7 +22,7 @@
      22 |  //
      23 |  // CScheduler* s = new CScheduler();
      24 |  // s->scheduleFromNow(doSomething, 11); // Assuming a: void doSomething() { }
      25 | -// s->scheduleFromNow(boost::bind(Class::func, this, argument), 3);
      26 | +// s->scheduleFromNow(std::bind(Class::func, this, argument), 3);
      27 |  // boost::thread* t = new boost::thread(boost::bind(CScheduler::serviceQueue, s));
    


    sipa commented at 10:56 PM on January 20, 2017:

    Adapt comment here as well?


    TheBlueMatt commented at 11:14 PM on January 20, 2017:

    No, it still must run inside a boost::thread because it relies on boost::interruption_point. I believe @theuni is planning on cleaning that up.


    TheBlueMatt commented at 11:31 PM on January 20, 2017:

    well technically boost::thread takes a boost::function, so I assume if you uses std::bind it would create a boost::function around the std::function......I'll let cory do that when we kill boost::threads.


    theuni commented at 7:08 AM on January 21, 2017:

    Yes, I have a local branch with CScheduler converted. I'm doing them in chunks, because the last huge PR proved to be too big to review/rebase. I'll submit that one next (#9566 is the current one).

  4. sipa commented at 11:07 PM on January 20, 2017: member

    Concept ACK

  5. sipa commented at 11:24 PM on January 20, 2017: member

    I mean the boost::bind here.

  6. theuni commented at 7:09 AM on January 21, 2017: member

    Concept ACK!. I've considered doing this a few times as well.

  7. in src/wallet/walletdb.cpp:None in 5d0d061480 outdated
     767 | @@ -768,67 +768,60 @@ DBErrors CWalletDB::ZapWalletTx(CWallet* pwallet, vector<CWalletTx>& vWtx)
     768 |      return DB_LOAD_OK;
     769 |  }
     770 |  
     771 | -void ThreadFlushWalletDB()
     772 | +void MaybeFlushWalletDB()
    


    laanwj commented at 12:27 PM on January 23, 2017:

    If you're renaming this function please, finally, change it to something else than FlushWalletDB. What is being done here is not merely a flush (those are done all the time as CWalletDB instances go out of scope) but more like "database consolidation", merging the log files into wallet.dat so that the wallet is self-contained. This has confused many people over time.


    TheBlueMatt commented at 2:28 PM on January 23, 2017:

    Done, called it "compact"

  8. laanwj commented at 12:27 PM on January 23, 2017: member

    Concept ACK

  9. laanwj added this to the milestone 0.15.0 on Feb 6, 2017
  10. TheBlueMatt force-pushed on Feb 8, 2017
  11. TheBlueMatt commented at 6:20 PM on February 8, 2017: contributor

    Rebased. Note that this now forms the first of a rather long patchset to move wallet callbacks into a background thread without introducing races in APIs or wallet consistency issues.

  12. TheBlueMatt cross-referenced this on Feb 8, 2017 from issue CValidationInterface Cleanups by TheBlueMatt
  13. theuni commented at 11:13 PM on March 6, 2017: member

    utACK. Needs rebase.

  14. CScheduler boost->std::function, use millisecs for times, not secs 73296f54d6
  15. Use CScheduler for wallet flushing, remove ThreadFlushWalletDB 735d9b5362
  16. Rename FlushWalletDB -> CompactWalletDB, add function description 0235be1e7a
  17. TheBlueMatt force-pushed on Mar 6, 2017
  18. TheBlueMatt commented at 11:35 PM on March 6, 2017: contributor

    Rebased.

  19. laanwj commented at 10:01 AM on March 7, 2017: member

    utACK 0235be1

  20. laanwj merged this on Mar 7, 2017
  21. laanwj closed this on Mar 7, 2017

  22. laanwj referenced this in commit 779f2f9747 on Mar 7, 2017
  23. PastaPastaPasta referenced this in commit 01fa0df568 on Dec 30, 2018
  24. PastaPastaPasta referenced this in commit 59ab029c6f on Dec 31, 2018
  25. PastaPastaPasta referenced this in commit 85de06c75d on Dec 31, 2018
  26. PastaPastaPasta referenced this in commit 559c03f0f9 on Dec 31, 2018
  27. PastaPastaPasta referenced this in commit cbd0f0c34a on Jan 2, 2019
  28. PastaPastaPasta referenced this in commit 0019f5db2a on Jan 2, 2019
  29. PastaPastaPasta referenced this in commit d746f8e3e2 on Jan 3, 2019
  30. PastaPastaPasta referenced this in commit 1f85228a25 on Jan 21, 2019
  31. PastaPastaPasta referenced this in commit d71ae5f3a6 on Jan 27, 2019
  32. PastaPastaPasta referenced this in commit ff7daf4acf on Jan 29, 2019
  33. PastaPastaPasta referenced this in commit 1a32400bf9 on Feb 5, 2019
  34. PastaPastaPasta referenced this in commit 8d249d4dff on Feb 5, 2019
  35. PastaPastaPasta referenced this in commit 89d95213a0 on Feb 5, 2019
  36. PastaPastaPasta referenced this in commit 9a3067115f on Feb 5, 2019
  37. PastaPastaPasta referenced this in commit df8fab4d33 on Feb 5, 2019
  38. str4d cross-referenced this on Feb 7, 2020 from issue Replace boost::function with std::function by zancas
  39. random-zebra cross-referenced this on Aug 18, 2020 from issue [Wallet][Refactoring] wallet/init refactoring backports by random-zebra
  40. furszy cross-referenced this on Jan 21, 2021 from issue Revamping block validation interface interaction with wallet by furszy
  41. furszy referenced this in commit 6143f803b2 on Jan 30, 2021
  42. bitcoin 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-05-19 06:55 UTC