Skip to content
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

common, core, light: add block age into info logs #17718

Merged
merged 1 commit into from
Sep 20, 2018

Conversation

karalabe
Copy link
Member

While catching up with the chain (you turned off your machine for a few days), it's generally annoying that you don't know where in the sync you are progress wise. Checking against a block explorer is of course an option, but it would be nice if the logs helped you a bit out.

This PR adds an age field to all the import logs (receipt, block, header) and also to the "loaded most recent" logs. This hopefully provides a bit more context as to how long a catch-up might take:

Startup logs:

INFO [09-20|11:39:23.581] Loaded most recent local header          number=3002486 hash=0a0b16…555511 td=5587832 age=3d2h38m
INFO [09-20|11:39:23.581] Loaded most recent local full block      number=3002486 hash=0a0b16…555511 td=5587832 age=3d2h38m
INFO [09-20|11:39:23.581] Loaded most recent local fast block      number=3002486 hash=0a0b16…555511 td=5587832 age=3d2h38m

Import logs:

INFO [09-20|12:11:26.785] Imported new block headers               count=384 elapsed=328.229ms number=4074232 hash=633555…f35f7f age=10h15m48s
INFO [09-20|12:11:26.976] Imported new block headers               count=192 elapsed=174.491ms number=4074424 hash=2aa83c…a08d66 age=9h31m36s
INFO [09-20|12:11:27.465] Imported new block headers               count=576 elapsed=469.789ms number=4075000 hash=a32347…47afd9 age=7h25m36s
INFO [09-20|12:11:27.644] Imported new block headers               count=192 elapsed=162.887ms number=4075192 hash=274c76…d5b962 age=6h47m5s
INFO [09-20|12:11:28.334] Imported new block headers               count=768 elapsed=670.033ms number=4075960 hash=9397fe…8dd879 age=3h54m55s
INFO [09-20|12:11:28.647] Imported new block headers               count=384 elapsed=290.009ms number=4076344 hash=b69eea…c5a0e2 age=2h31m51s
INFO [09-20|12:11:29.113] Imported new block headers               count=576 elapsed=447.128ms number=4076920 hash=c64a30…7894ab age=29m2s
INFO [09-20|12:11:29.243] Imported new block headers               count=127 elapsed=110.961ms number=4077047 hash=ea1c6b…eb6b18 age=35s
INFO [09-20|12:11:50.367] Imported new block headers               count=2   elapsed=5.152ms   number=4077049 hash=d59587…a766ac age=9s
INFO [09-20|12:12:02.047] Imported new block headers               count=1   elapsed=11.174ms  number=4077050 hash=b1db79…07c590 age=13s

Note, this PR drops the mgas log field from imports. It's a cute statistic, but it's not really useful. Blocks are generally full, so there's not much surprise in mgas. Also, the mgas is just the elapsed * mgasps that we sill log so you can calculate it if you really must.

@karalabe karalabe added this to the 1.8.16 milestone Sep 20, 2018
Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although I think mgas is good to have. I don't think it's quite replaceable: I doubt you can losslessly calculate it from the pretty-printed mgasps and elapsed.

@karalabe
Copy link
Member Author

But is it useful? If I import blocks 1-by-1 (i.e. I'm in sync), it will just hover around 8M (or whatever mainnet is pushed to). If I'm importing a lot of blocks (random number), then the mgas loses it's value, because it's just some average across a few hundred blocks. I'm genuinely curious, I can put it back if it's useful.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK for this feature

@karalabe
Copy link
Member Author

Pushed a tiny fixup:

  • Restore the mgas field.
  • Raise the age display threshold from 2 secs to 1 minute (avoid propagation confusion)
  • Add the age to the light client CHT restoration log.

@karalabe karalabe merged commit f89dce0 into ethereum:master Sep 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants