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
mempool: Log added for dumping mempool transactions to disk #29402
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Why is this needed? A progress log for something that takes less than a second does not sound useful |
This is in response to this comment #29227 (review) |
7b2092f
to
9534383
Compare
The delay is probably from leveldb, but it would be good to first check |
I agree that logging the detailed progress in % is a bit overkill, but IMHO a single line "Dumping xyz mempool transactions to disk..." would still make sense. The "less than a second" data point seems to be closer to best-case, I have one machine here where dumping a full default-sized mempool takes more than 10 seconds. |
Sure, it may take longer than one second, depending on the hardware and its size. However,
Shutdown should be single-threaded, so the debug log should contain the last timestamp, which is enough to derive how long it took to dump the mempool, or whether it is still ongoing. I don't expect anyone to poll the debug log every second to see an update on the progress.
Agree, if there isn't such a log line right now, it could make sense to add it. |
+1 to @theStack's comment. Logging the start and end would be sufficient, no need for the 10% increments. |
9534383
to
33153b0
Compare
force pushed 33153b0 This removes the 10% increments and now logs a single line with the amount of mempool transactions being written to the disk |
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.
lgtm
c23f5be
to
6312513
Compare
utACK 6312513. Planning to test as well. |
I'm seeing an issue during testing. The debug log incorrectly reports 0 MB. Are others able to reproduce my result?
|
src/kernel/mempool_persist.cpp
Outdated
file << (uint64_t)vinfo.size(); | ||
uint64_t mempool_transactions_to_write(vinfo.size()); | ||
file << mempool_transactions_to_write; | ||
LogInfo("Writing %u mempool transactions to file %u MB...\n", mempool_transactions_to_write, sizeof(vinfo)/1000000); |
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.
very minor nit - To make the log more readable, can you please add a comma after 'file'?
So it displays as:
Writing xx mempool transactions to file, xx MB...
It looks like DynamicMemoryUsage computes like this which includes
I think it might make more sense to not have a MB amount on |
Approach ACK. |
616f798
to
4218460
Compare
d161129
to
dbdb732
Compare
lgtm ACK dbdb732 Seems fine to log when starting to dump the mempool. |
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.
utACK dbdb732
src/kernel/mempool_persist.cpp
Outdated
@@ -44,7 +44,7 @@ bool LoadMempool(CTxMemPool& pool, const fs::path& load_path, Chainstate& active | |||
|
|||
AutoFile file{opts.mockable_fopen_function(load_path, "rb")}; | |||
if (file.IsNull()) { | |||
LogPrintf("Failed to open mempool file from disk. Continuing anyway.\n"); | |||
LogInfo("Failed to open mempool file from disk. Continuing anyway.\n"); |
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.
Remove "from disk" here, if dropping "disk" mentions elsewhere?
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.
I didn't modify this line because opening the file from disk
is accurate but I can change this to Failed to open mempool file. Continuing anyway
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.
updated in 34b6a8d
dbdb732
to
34b6a8d
Compare
ACK 34b6a8d |
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.
utACK 34b6a8d
34b6a8d
to
4d5b557
Compare
cr-ACK 4d5b557 |
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.
reACK 4d5b557
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.
crACK. Will test shortly
Tested from master after merge. lgtm.
|
Sometimes when shutting off bitcoind it can take a while to dump the mempool transaction onto the disk so
this change adds additional logging to the
DumpMempool
method inkernel/mempool_persist.cpp
Motivated by #29227 this change
This is in response to #29227 (comment)
The logs will now look like this