`Arc` is already a reference internally, so it does not seem to be
beneficial to pass a reference to it. Just adds an extra layer of
indirection.
Functions that need to be able to increment `Arc` reference count need
to take `Arc<AtomicBool>`, but those that just want to read the
`AtomicBool` value can accept `&AtomicBool`, making them a bit more
generic.
This change focuses specifically on `Arc<AtomicBool>`. There are other
uses of `&Arc<T>` in the code base that could be converted in a similar
manner. But it would make the change even larger.
This function has morphed as it has been updated, and the existing
function name is a bit of misnomer. Update the function name to use
terminology that I think is more clear and more consistent with what we
use core/src/validator.rs. Additionally, adjust the error messages to be
more clear about what exactly is wrong for when we can't process.
The callstack updated in this PR passed an &Arc<...> down only to have
the bottom level clone the reference. Thus, we are giving shared
ownership so the reference is a bit redundant and arguably obscures the
intention to clone further down the callstack.
* Fix ledger-tool program command for non-runnable subcommands
These subcommands (cfg and disassemble) don't need to load a ledger
database for running, and neither do they need an input file
specifying instruction accounts etc. This change creates a simplified
invoke_context for processing the static actions of ledger-tool
program subcommand.
* Factor out program file loading
* Move entry_notifier_interface
* Add EntryNotifierService
* Use descriptive struct in sender/receiver
* Optionally initialize EntryNotifierService in validator
* Plumb EntryNotfierSender into Tvu, blockstore_processor
* Plumb EntryNotfierSender into Tpu
* Only return one option when constructing EntryNotifierService
* Add debug and trace capabilities to ledger-tool, previously rbpf-cli
* Dump nested logs from saved traces in invoke_context
* Change the ledger-tool run input format to represent keys as strings
* Enables JIT everywhere by default.
* Removes the CLI argument "no-bpf-jit" and its plumbering through out the validator code base.
* Removes with_jit bpf_loader variants.
* Removes the to_builtin!() macro.
Performing a manual ledger compaction can be very time consuming.
Although the compaction will optimize storage use, swapping to skip
compaction favors the command completing faster. Additionally, we no
longer do regular compaction in the validator (via LedgerCleanupService)
and instead make use of range deletion which is much more efficient.
Given the above, this changes alters the default behavior to skip ledger
compaction by default, and introduces a flag should a user really want
to run compaction.
PR #29975 previously combined some repeated logic around parsing
AccountsDb configuration options. That PR consolidated logic between
verify and create-snapshot, but left alone all of the other commands
that load up and process Bank(s).
Make all functions that will spin up Banks / AccountsDb share this
common function. Additionally, expose some of the AccountsDb
configuration flags to the other commands such as accounts, graph, etc.
In cluster restart scenarios, it is desirable to know the latest
optimistic slot(s), which the subcommand latest-optimistic-slots will
return. However, it is also useful to know whether slots contain only
votes or if they contain votes and user transactions.
This PR adds an extra column of output to show whether an optimistically
confirmed slot is vote only (contains zero non-vote transactions).
Additionally, a flag has been added to enable filtering output to
exclude vote only slots.
* Add --{replaying,banking}-backend flags (noop atm)
* Greatly simplify enums with strum
* Update programs/sbf/Cargo.lock...
* Rely on Display, removing Debug
* constify cli_names()
* Don't allow omitting bankend value
* Rename to --block-{verification,production}-method
* Use more specific name
* Actually support missing value....
* Remove strictly-unnecessary flags
* Use lazy_static! instead of abusing DefaultArgs...
`poh_verify` actually disables transaction signature, tick count and
built in program argument verifications as well. It is somewhat
confusing to call it `poh_verify`.
* Clean up orphaned account snapshot hardlink dirs
* fix compilation issues
* debugged, now working. seeing the orphaned directories deleted
* change back to eprintln + exit for account_path error
* changed eprintln to panic for now
* add test_clean_orphaned_account_snapshot_dirs for codecov check
* address a few comments and nit isseus
* directly unzip, skipped the intermediate array of tuples
* let set_up_account_run_and_snapshot_paths return Result
* 'proper' typo, and comment on return
* use map_err
* use for loop in clean_orphaned_account_snapshot_dirs, removed panic
* add test_set_up_account_run_and_snapshot_paths
* minor, replace .for_each with .all
* rename set_up_account_run_and_snapshot_paths to create_all_accounts_run_and_snapshot_dirs
* remove unnecessary closure return type
* change to for loop
* change match to unwrap_or_else
* remove create_dir_all(&account_path) in create_all
* minor comment cleanup
Declare constants at top of function with comment, and stringify the
constants when needed to be in line with how other defaults are done in
ledger-tool main function.
The print command looks up program_ids from transactions by creating
SanitizedTransactions. But, print doesn't have access to a Bank so
transactions that include an address table lookup can't be sanitized.
Sanitizing the transaction isn't necessary, so this change just looks up
the program id from unsanitized transactions.
* introduce workspace.package
* introduce workspace.dependencies
* read version from root cargo.toml
* pass check when version = { workspace = true }
* don't bump version when version = { workspace = true }
* including workspace Cargo.toml when bump version
* programs/sbf use workspace inheritance
* fix increasing cargo version ignore program/sbf/Cargo.toml
The previous change used Primary access; however, it is better to use
PrimaryForMaintenance in this case to disallow any potential compaction
from happening.
* Add address lookup tables to minimized snapshot
* Add comment for future posterity
* Add reference to the issue
* Adjust comment a bit
Co-authored-by: Andrew Fitzgerald <apfitzge@gmail.com>
---------
Co-authored-by: Andrew Fitzgerald <apfitzge@gmail.com>
Previously, ledger-tool had a guardrail to disallow a custom accounts
path when access mode to the blockstore was Secondary. This was to avoid
potentially pulling the accounts out from underneath solana-validator.
When ledger-tool switched over to use Secondary blockstore access for
all commands that do not need write access, this removed the ability to
use custom accounts paths with ledger-tool at all for these commands.
Custom accounts paths are desirable, especially if that custom path is
in tmpfs to speed up processing.
With this change, when a custom accounts path is passed for a command
using Secondary access, ledger-tool now checks if Primary access is
being held by another process. If not, allow processing to proceed
with the custom accounts path.
The above check isn't fullproof, but it is about equal to the check that
previously existed when ledger-tool would run in Primary access mode
when it didn't need to.
Several subcommands may wish to specify AccountsDb configuration
options. The matching is currently duplicated in both "verify" and
"create-snapshot" command, so move the config to a common helper.
Note that each subcommand that wishes to use any argument will still
need to add the argument to its' argument list under App::new().
* Add run parent directory for accounts files
* fix test test_concurrent_snapshot_packaging
* review comments. renamed the path setup function
* Addressed most of the review comments
* remove explict type def for map result
* handle create_accounts_run_and_snapshot_dirs error with expect
* update with more review comments
* minor fixes from review comments
* simplify account_filename option assignment
* handle error from create_accounts_run_and_snapshot_dirs
* use then instead of then_some for lazy evaluation
* Clean up files in the old account_path before trasitioning to the new run path
* try_exist and accounts_dir removing extra
* sync rmdir, is_dir check
* handle the account_path not deletable case
* special case is_connected check for slot 0 so that we can load snapshot 0 for gce cluster boostrapting
* remove obsolete comments
* refactor with match expr
* update comments
* Update ledger-tool/src/main.rs
Co-authored-by: steviez <steven@solana.com>
* Update ledger-tool/src/main.rs
Co-authored-by: steviez <steven@solana.com>
Co-authored-by: steviez <steven@solana.com>
* introduce workspace.package
* introduce workspace.dependencies
* read version from root cargo.toml
* pass check when version = { workspace = true }
* don't bump version when version = { workspace = true }
* including workspace Cargo.toml when bump version
* programs/sbf use workspace inheritance
* fix increasing cargo version ignore program/sbf/Cargo.toml
* Add run parent directory for accounts files
* fix test test_concurrent_snapshot_packaging
* review comments. renamed the path setup function
* Addressed most of the review comments
* remove explict type def for map result
* handle create_accounts_run_and_snapshot_dirs error with expect
* update with more review comments
* minor fixes from review comments
* simplify account_filename option assignment
* handle error from create_accounts_run_and_snapshot_dirs
* use then instead of then_some for lazy evaluation
The existing logic would clean account paths only when we had secondary
access to the blockstore. However, the access mode shouldn't dictate
when we clean accounts data; we can and should clean account data from
previous runs in all instances given that we always start over from a
snapshot.
Introduce a struct to store all of the relevant slot/root information, and then output all in one go at the end as either human-readable or json. There are some slight changes to the human-readable format for the case of an empty ledger
Removed an "ok" print that occurs after several commands; we already
print a log statement that indicates ledger-tool is done and how long it
took. Additionally, switch a println to info to avoid polluting stdout
incase we want to print information in a more easily readable format
such as json.
* init copy cmd
* extract creating emulator connection logic
* extract copy args as struct
* add new_for_emulator
* add tryFrom confirmed block to versioned block
* implement bigtable copy command
* use 'force' flag to force upload
* use unwrap_or
* remove redundant importing
* fix nightly lint
* explicit transactions missing error
* process ending_slot
* prevent start slot > end slot
* print skip slots in debug level
* fix destination bigtable should not be readonly
* combine is-emulator and endpoint to emulated source. conflict with crenditial path
* wording
* log some error messages with error level
* nightly lint
* add dry-run
* extract create bigtable instances logic
* use a lighter way to check block
* use the latest futures version which is used in the repo
* use futures = "0.3"
Co-authored-by: Tyera <teulberg@gmail.com>
* wording
Co-authored-by: Tyera <teulberg@gmail.com>
* wording
Co-authored-by: Tyera <teulberg@gmail.com>
Co-authored-by: Tyera <teulberg@gmail.com>
Currently, if starting-slot is unspecified, a value of 0 will be chosen.
In the common case where someone is operating on a much more recent
range, this would result in a ton of wasted operations & time.
Instead, choose a smarter default value for starting-slot based on what
we detect is currently in the blockstore.
* Update cost model to use requested_cu instead of estimated cu #27608
* remove CostUpdate and CostModel from replay/tvu
* revive cost update service to send cost tracker stats
* CostModel is now static
* remove unused package
Co-authored-by: Tao Zhu <tao@solana.com>