Add hidden cli option to allow validator reports replayed transaction cost metrics (backport #22369) (#22519)

* Add hidden cli option to allow validator reports replayed transaction cost metrics (#22369)

* add hidden cli option to allow validator reports replayed transaction cost detail metrics

* Update validator/src/main.rs

Co-authored-by: Michael Vines <mvines@gmail.com>

* - rebase master, using unbounded instead of channel; dowgrade to datapoint_trace

* removed cli arg, prefer log at trace

Co-authored-by: Michael Vines <mvines@gmail.com>
(cherry picked from commit a724fa2347)

# Conflicts:
#	core/src/tvu.rs

* fix conflict

Co-authored-by: Tao Zhu <82401714+taozhu-chicago@users.noreply.github.com>
Co-authored-by: Tao Zhu <tao@solana.com>
This commit is contained in:
mergify[bot]
2022-01-21 15:05:41 -07:00
committed by GitHub
parent 35ca3182ba
commit 91bc44931f
5 changed files with 147 additions and 0 deletions

View File

@ -49,6 +49,7 @@ use {
bank::{Bank, NewBankOptions},
bank_forks::BankForks,
commitment::BlockCommitmentCache,
transaction_cost_metrics_sender::TransactionCostMetricsSender,
vote_sender_types::ReplayVoteSender,
},
solana_sdk::{
@ -355,6 +356,7 @@ impl ReplayStage {
voting_sender: Sender<VoteOp>,
drop_bank_sender: Sender<Vec<Arc<Bank>>>,
block_metadata_notifier: Option<BlockMetadataNotifierLock>,
transaction_cost_metrics_sender: Option<TransactionCostMetricsSender>,
) -> Self {
let ReplayStageConfig {
vote_account,
@ -462,6 +464,7 @@ impl ReplayStage {
&mut duplicate_slots_to_repair,
&ancestor_hashes_replay_update_sender,
block_metadata_notifier.clone(),
transaction_cost_metrics_sender.as_ref(),
);
replay_active_banks_time.stop();
@ -1519,6 +1522,7 @@ impl ReplayStage {
bank_progress: &mut ForkProgress,
transaction_status_sender: Option<&TransactionStatusSender>,
replay_vote_sender: &ReplayVoteSender,
transaction_cost_metrics_sender: Option<&TransactionCostMetricsSender>,
verify_recyclers: &VerifyRecyclers,
) -> result::Result<usize, BlockstoreProcessorError> {
let tx_count_before = bank_progress.replay_progress.num_txs;
@ -1530,6 +1534,7 @@ impl ReplayStage {
false,
transaction_status_sender,
Some(replay_vote_sender),
transaction_cost_metrics_sender,
None,
verify_recyclers,
false,
@ -2019,6 +2024,7 @@ impl ReplayStage {
duplicate_slots_to_repair: &mut DuplicateSlotsToRepair,
ancestor_hashes_replay_update_sender: &AncestorHashesReplayUpdateSender,
block_metadata_notifier: Option<BlockMetadataNotifierLock>,
transaction_cost_metrics_sender: Option<&TransactionCostMetricsSender>,
) -> bool {
let mut did_complete_bank = false;
let mut tx_count = 0;
@ -2068,6 +2074,7 @@ impl ReplayStage {
bank_progress,
transaction_status_sender,
replay_vote_sender,
transaction_cost_metrics_sender,
verify_recyclers,
);
match replay_result {
@ -3644,6 +3651,7 @@ pub mod tests {
bank1_progress,
None,
&replay_vote_sender,
None,
&VerifyRecyclers::default(),
);
let max_complete_transaction_status_slot = Arc::new(AtomicU64::default());

View File

@ -49,6 +49,9 @@ use {
snapshot_package::{
AccountsPackageReceiver, AccountsPackageSender, PendingSnapshotPackage,
},
transaction_cost_metrics_sender::{
TransactionCostMetricsSender, TransactionCostMetricsService,
},
vote_sender_types::ReplayVoteSender,
},
solana_sdk::{clock::Slot, pubkey::Pubkey, signature::Keypair},
@ -76,6 +79,7 @@ pub struct Tvu {
cost_update_service: CostUpdateService,
voting_service: VotingService,
drop_bank_service: DropBankService,
transaction_cost_metrics_service: TransactionCostMetricsService,
}
pub struct Sockets {
@ -313,6 +317,15 @@ impl Tvu {
);
let (drop_bank_sender, drop_bank_receiver) = channel();
let (tx_cost_metrics_sender, tx_cost_metrics_receiver) = unbounded();
let transaction_cost_metrics_sender = Some(TransactionCostMetricsSender::new(
cost_model.clone(),
tx_cost_metrics_sender,
));
let transaction_cost_metrics_service =
TransactionCostMetricsService::new(tx_cost_metrics_receiver);
let drop_bank_service = DropBankService::new(drop_bank_receiver);
let replay_stage = ReplayStage::new(
@ -336,6 +349,7 @@ impl Tvu {
voting_sender,
drop_bank_sender,
block_metadata_notifier,
transaction_cost_metrics_sender,
);
let ledger_cleanup_service = tvu_config.max_ledger_shreds.map(|max_ledger_shreds| {
@ -370,6 +384,7 @@ impl Tvu {
cost_update_service,
voting_service,
drop_bank_service,
transaction_cost_metrics_service,
}
}
@ -386,6 +401,7 @@ impl Tvu {
self.cost_update_service.join()?;
self.voting_service.join()?;
self.drop_bank_service.join()?;
self.transaction_cost_metrics_service.join()?;
Ok(())
}
}