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

cmd/utils, eth/ethconfig: unindex txs older than ~1 year #22293

Merged
merged 1 commit into from
Feb 10, 2021

Conversation

karalabe
Copy link
Member

@karalabe karalabe commented Feb 8, 2021

https://twitter.com/peter_szilagyi/status/1358767100995784704 .

This PR changes the default number of indexed transaction from infinite to the most recent 1 year (assuming block times of around 13-14s).

The reasoning behind this change is that currently on mainnet there are over 1 billion transactions. Just tracking the hash->blocknum mapping weighs 33GB on the database (requires SSD speeds due to the hash keying) and represents 3/5th of the database entry count, which makes trie operations and compactions exceedingly expensive.

Without any form of pruning, the transaction index dataset grows indefinitely. We must bite the bullet and have normal full nodes retain meaningful history, but not indefinite.

Operators still wishing to index all transactions since genesis can run geth with --txlookuplimit=0. The index can be reconstructed even if it was pruned, so no data is lost. The index is not needed for network health, it's just a local acceleration structure.-

@karalabe karalabe added this to the 1.10.0 milestone Feb 8, 2021
Name: "txlookuplimit",
Usage: "Number of recent blocks to maintain transactions index by-hash for (default = index all blocks)",
Value: 0,
Usage: "Number of recent blocks to maintain transactions index by-hash for (default = index about one year)",
Copy link
Contributor

Choose a reason for hiding this comment

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

Does 0 mean infinity ? Might need a clarification in the Usage

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, there's no way to say infinity in Go, so 0 is kind of "disable"

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, but 0, for a uint-flag, might to the user mean "Don't index anything". And if the user sets 0 with that notion, it's bad UX

Copy link
Contributor

Choose a reason for hiding this comment

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

Alternatives:

  • keep it as a int flag, and make -1 mean "everything"
  • Add to teh Usage string: (default = index about one year, 0 = index everything)

Copy link
Member Author

Choose a reason for hiding this comment

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

Went with the 2nd suggestion

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