Skip to content

Commit

Permalink
Move and rename ledger services from core to ledger (solana-labs#33947)
Browse files Browse the repository at this point in the history
These services currently live in core/; however, they operate on the
ledger. Mores so, these two services operate on the blockstore only,
and not necessarily the entire ledger. So, it makes sense to move these
services out of core and into ledger. We've recently been doing similar
changes with breaking things out into individual crates in order to
reduce the scope of core.

So, this change moves the services from core/ to ledger/, and replaces
ledger with blockstore.
  • Loading branch information
steviez authored Nov 8, 2023
1 parent 8c5b5f1 commit 73815ae
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 708 deletions.
2 changes: 0 additions & 2 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ pub mod cost_update_service;
pub mod drop_bank_service;
pub mod fetch_stage;
pub mod gen_keys;
pub mod ledger_cleanup_service;
pub mod ledger_metric_report_service;
pub mod next_leader;
pub mod optimistic_confirmation_verifier;
pub mod poh_timing_report_service;
Expand Down
24 changes: 12 additions & 12 deletions core/src/tvu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use {
consensus::{tower_storage::TowerStorage, Tower},
cost_update_service::CostUpdateService,
drop_bank_service::DropBankService,
ledger_cleanup_service::LedgerCleanupService,
repair::{quic_endpoint::LocalRequest, repair_service::RepairInfo},
replay_stage::{ReplayStage, ReplayStageConfig},
rewards_recorder_service::RewardsRecorderSender,
Expand All @@ -32,8 +31,9 @@ use {
duplicate_shred_listener::DuplicateShredListener,
},
solana_ledger::{
blockstore::Blockstore, blockstore_processor::TransactionStatusSender,
entry_notifier_service::EntryNotifierSender, leader_schedule_cache::LeaderScheduleCache,
blockstore::Blockstore, blockstore_cleanup_service::BlockstoreCleanupService,
blockstore_processor::TransactionStatusSender, entry_notifier_service::EntryNotifierSender,
leader_schedule_cache::LeaderScheduleCache,
},
solana_poh::poh_recorder::PohRecorder,
solana_rpc::{
Expand Down Expand Up @@ -63,7 +63,7 @@ pub struct Tvu {
window_service: WindowService,
cluster_slots_service: ClusterSlotsService,
replay_stage: ReplayStage,
ledger_cleanup_service: Option<LedgerCleanupService>,
blockstore_cleanup_service: Option<BlockstoreCleanupService>,
cost_update_service: CostUpdateService,
voting_service: VotingService,
warm_quic_cache_service: Option<WarmQuicCacheService>,
Expand Down Expand Up @@ -236,14 +236,14 @@ impl Tvu {
exit.clone(),
);

let (ledger_cleanup_slot_sender, ledger_cleanup_slot_receiver) = unbounded();
let (blockstore_cleanup_slot_sender, blockstore_cleanup_slot_receiver) = unbounded();
let replay_stage_config = ReplayStageConfig {
vote_account: *vote_account,
authorized_voter_keypairs,
exit: exit.clone(),
rpc_subscriptions: rpc_subscriptions.clone(),
leader_schedule_cache: leader_schedule_cache.clone(),
latest_root_senders: vec![ledger_cleanup_slot_sender],
latest_root_senders: vec![blockstore_cleanup_slot_sender],
accounts_background_request_sender,
block_commitment_cache,
transaction_status_sender,
Expand Down Expand Up @@ -311,9 +311,9 @@ impl Tvu {
popular_pruned_forks_receiver,
)?;

let ledger_cleanup_service = tvu_config.max_ledger_shreds.map(|max_ledger_shreds| {
LedgerCleanupService::new(
ledger_cleanup_slot_receiver,
let blockstore_cleanup_service = tvu_config.max_ledger_shreds.map(|max_ledger_shreds| {
BlockstoreCleanupService::new(
blockstore_cleanup_slot_receiver,
blockstore.clone(),
max_ledger_shreds,
exit.clone(),
Expand All @@ -337,7 +337,7 @@ impl Tvu {
window_service,
cluster_slots_service,
replay_stage,
ledger_cleanup_service,
blockstore_cleanup_service,
cost_update_service,
voting_service,
warm_quic_cache_service,
Expand All @@ -352,8 +352,8 @@ impl Tvu {
self.cluster_slots_service.join()?;
self.fetch_stage.join()?;
self.shred_sigverify.join()?;
if self.ledger_cleanup_service.is_some() {
self.ledger_cleanup_service.unwrap().join()?;
if self.blockstore_cleanup_service.is_some() {
self.blockstore_cleanup_service.unwrap().join()?;
}
self.replay_stage.join()?;
self.cost_update_service.join()?;
Expand Down
12 changes: 6 additions & 6 deletions core/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use {
tower_storage::{NullTowerStorage, TowerStorage},
ExternalRootSource, Tower,
},
ledger_metric_report_service::LedgerMetricReportService,
poh_timing_report_service::PohTimingReportService,
repair::{self, serve_repair::ServeRepair, serve_repair_service::ServeRepairService},
rewards_recorder_service::{RewardsRecorderSender, RewardsRecorderService},
Expand Down Expand Up @@ -56,6 +55,7 @@ use {
blockstore::{
Blockstore, BlockstoreError, BlockstoreSignals, CompletedSlotsReceiver, PurgeType,
},
blockstore_metric_report_service::BlockstoreMetricReportService,
blockstore_options::{BlockstoreOptions, BlockstoreRecoveryMode, LedgerColumnOptions},
blockstore_processor::{self, TransactionStatusSender},
entry_notifier_interface::EntryNotifierArc,
Expand Down Expand Up @@ -465,7 +465,7 @@ pub struct Validator {
pub bank_forks: Arc<RwLock<BankForks>>,
pub blockstore: Arc<Blockstore>,
geyser_plugin_service: Option<GeyserPluginService>,
ledger_metric_report_service: LedgerMetricReportService,
blockstore_metric_report_service: BlockstoreMetricReportService,
accounts_background_service: AccountsBackgroundService,
accounts_hash_verifier: AccountsHashVerifier,
turbine_quic_endpoint: Endpoint,
Expand Down Expand Up @@ -1102,8 +1102,8 @@ impl Validator {
)
.map_err(|err| format!("wait_for_supermajority failed: {err:?}"))?;

let ledger_metric_report_service =
LedgerMetricReportService::new(blockstore.clone(), exit.clone());
let blockstore_metric_report_service =
BlockstoreMetricReportService::new(blockstore.clone(), exit.clone());

let wait_for_vote_to_start_leader =
!waited_for_supermajority && !config.no_wait_for_vote_to_start_leader;
Expand Down Expand Up @@ -1378,7 +1378,7 @@ impl Validator {
bank_forks,
blockstore,
geyser_plugin_service,
ledger_metric_report_service,
blockstore_metric_report_service,
accounts_background_service,
accounts_hash_verifier,
turbine_quic_endpoint,
Expand Down Expand Up @@ -1507,7 +1507,7 @@ impl Validator {
self.stats_reporter_service
.join()
.expect("stats_reporter_service");
self.ledger_metric_report_service
self.blockstore_metric_report_service
.join()
.expect("ledger_metric_report_service");
self.accounts_background_service
Expand Down
Loading

0 comments on commit 73815ae

Please sign in to comment.