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

ledger-tool: Move blockstore arg parsing to open_blockstore() #34596

Merged
merged 2 commits into from
Jan 3, 2024

Conversation

steviez
Copy link
Contributor

@steviez steviez commented Dec 27, 2023

Problem

The open_blockstore() helper currently takes multiple configurable options. While the arguments are parsed at a high enough scope in main.rs to avoid repeated calls, this parsing is duplicated in program.rs and bigtable.rs. The repeated parsing is redundant, and also prone to having to missing an arg (as was the case with bigtable not having wal_recovery_mode).

Summary of Changes

Move the argument parsing to within open_blockstore() to avoid repeated code and to reduce the number of parameters getting passed around.

Steven Czabaniuk added 2 commits December 26, 2023 14:10
Copy link

codecov bot commented Dec 27, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d500eb6) 81.8% compared to head (1add55c) 81.8%.
Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##           master   #34596     +/-   ##
=========================================
- Coverage    81.8%    81.8%   -0.1%     
=========================================
  Files         824      824             
  Lines      222240   222235      -5     
=========================================
- Hits       181882   181852     -30     
- Misses      40358    40383     +25     

@steviez steviez marked this pull request as ready for review December 27, 2023 14:51
@steviez steviez requested a review from CriesofCarrots January 2, 2024 20:56
Copy link
Contributor

@CriesofCarrots CriesofCarrots left a comment

Choose a reason for hiding this comment

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

Just pointing out that in various places, cli flags will start to have an effect which did not previously. I'm approving on the assumption that there's no substantive reason they were previously not being respected, but please confirm :)

ledger-tool/src/ledger_utils.rs Show resolved Hide resolved
ledger-tool/src/main.rs Show resolved Hide resolved
@steviez
Copy link
Contributor Author

steviez commented Jan 3, 2024

Just pointing out that in various places, cli flags will start to have an effect which did not previously.

Yep, good call out; this was known but I probably could have been more explicit in stating that in the description.

I'm approving on the assumption that there's no substantive reason they were previously not being respected, but please confirm :)

There is no reason that I'm aware of for why we'd want to ignore the flags; I believe just an oversight when new flags or new commands were added. We have good defaults, but if someone really wants to set a certain value for any of these flags, there is no reason not to respect it. The only option that is really special on a per-command basis is the access mode, and that value is still explicitly specified on a per-command basis such that we run with the most restrictive access mode possible.

In general, another place where there is inconsistencies in which flags are available are the various process options. Granted some of those might be special to create-snapshot, but this is another instance where we have repeated code that has likely caused some inconsistencies. I also plan on consolidating that argument parsing into a single place for the sake of consistency between commands.

@steviez steviez merged commit 0b49d82 into solana-labs:master Jan 3, 2024
35 checks passed
@steviez steviez deleted the lt_x_bstore_open branch January 3, 2024 22:04
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