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: member
    Also uses std::function instead of boost::function.
  2. fanquake added the label Refactoring on Jan 20, 2017
  3. in src/scheduler.h: 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: 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: member
    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. theuni commented at 11:13 pm on March 6, 2017: member
    utACK. Needs rebase.
  13. CScheduler boost->std::function, use millisecs for times, not secs 73296f54d6
  14. Use CScheduler for wallet flushing, remove ThreadFlushWalletDB 735d9b5362
  15. Rename FlushWalletDB -> CompactWalletDB, add function description 0235be1e7a
  16. TheBlueMatt force-pushed on Mar 6, 2017
  17. TheBlueMatt commented at 11:35 pm on March 6, 2017: member
    Rebased.
  18. laanwj commented at 10:01 am on March 7, 2017: member
    utACK 0235be1
  19. laanwj merged this on Mar 7, 2017
  20. laanwj closed this on Mar 7, 2017

  21. laanwj referenced this in commit 779f2f9747 on Mar 7, 2017
  22. PastaPastaPasta referenced this in commit 01fa0df568 on Dec 30, 2018
  23. PastaPastaPasta referenced this in commit 59ab029c6f on Dec 31, 2018
  24. PastaPastaPasta referenced this in commit 85de06c75d on Dec 31, 2018
  25. PastaPastaPasta referenced this in commit 559c03f0f9 on Dec 31, 2018
  26. PastaPastaPasta referenced this in commit cbd0f0c34a on Jan 2, 2019
  27. PastaPastaPasta referenced this in commit 0019f5db2a on Jan 2, 2019
  28. PastaPastaPasta referenced this in commit d746f8e3e2 on Jan 3, 2019
  29. PastaPastaPasta referenced this in commit 1f85228a25 on Jan 21, 2019
  30. PastaPastaPasta referenced this in commit d71ae5f3a6 on Jan 27, 2019
  31. PastaPastaPasta referenced this in commit ff7daf4acf on Jan 29, 2019
  32. PastaPastaPasta referenced this in commit 1a32400bf9 on Feb 5, 2019
  33. PastaPastaPasta referenced this in commit 8d249d4dff on Feb 5, 2019
  34. PastaPastaPasta referenced this in commit 89d95213a0 on Feb 5, 2019
  35. PastaPastaPasta referenced this in commit 9a3067115f on Feb 5, 2019
  36. PastaPastaPasta referenced this in commit df8fab4d33 on Feb 5, 2019
  37. furszy referenced this in commit 6143f803b2 on Jan 30, 2021
  38. MarcoFalke locked this on Sep 8, 2021


TheBlueMatt sipa theuni laanwj

Labels
Refactoring

Milestone
0.15.0


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: 2024-12-18 21:12 UTC

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