v0.12 specific stability changes

This commit is contained in:
Pankaj Garg
2019-03-21 19:51:20 +00:00
committed by Grimes
parent 3f7cd4adc4
commit 59f2a478b7
3 changed files with 11 additions and 15 deletions

View File

@ -27,13 +27,9 @@ use std::sync::{Arc, Mutex, RwLock};
use std::thread::{self, Builder, JoinHandle}; use std::thread::{self, Builder, JoinHandle};
use std::time::Duration; use std::time::Duration;
use std::time::Instant; use std::time::Instant;
use sys_info;
pub type UnprocessedPackets = Vec<(SharedPackets, usize)>; // `usize` is the index of the first unprocessed packet in `SharedPackets` pub type UnprocessedPackets = Vec<(SharedPackets, usize)>; // `usize` is the index of the first unprocessed packet in `SharedPackets`
// number of threads is 1 until mt bank is ready
pub const NUM_THREADS: u32 = 10;
/// Stores the stage's thread handle and output receiver. /// Stores the stage's thread handle and output receiver.
pub struct BankingStage { pub struct BankingStage {
bank_thread_hdls: Vec<JoinHandle<()>>, bank_thread_hdls: Vec<JoinHandle<()>>,
@ -57,7 +53,7 @@ impl BankingStage {
// Single thread to compute confirmation // Single thread to compute confirmation
let lcs_handle = LeaderConfirmationService::start(&poh_recorder, exit.clone()); let lcs_handle = LeaderConfirmationService::start(&poh_recorder, exit.clone());
// Many banks that process transactions in parallel. // Many banks that process transactions in parallel.
let mut bank_thread_hdls: Vec<JoinHandle<()>> = (0..Self::num_threads()) let mut bank_thread_hdls: Vec<JoinHandle<()>> = (0..4)
.map(|_| { .map(|_| {
let verified_receiver = verified_receiver.clone(); let verified_receiver = verified_receiver.clone();
let poh_recorder = poh_recorder.clone(); let poh_recorder = poh_recorder.clone();
@ -189,10 +185,6 @@ impl BankingStage {
} }
} }
pub fn num_threads() -> u32 {
sys_info::cpu_num().unwrap_or(NUM_THREADS)
}
/// Convert the transactions from a blob of binary data to a vector of transactions /// Convert the transactions from a blob of binary data to a vector of transactions
fn deserialize_transactions(p: &Packets) -> Vec<Option<Transaction>> { fn deserialize_transactions(p: &Packets) -> Vec<Option<Transaction>> {
p.packets p.packets

View File

@ -44,10 +44,9 @@ pub fn slot_leader_at(slot: u64, bank: &Bank) -> Option<Pubkey> {
} }
/// Return the next slot after the given current_slot that the given node will be leader /// Return the next slot after the given current_slot that the given node will be leader
pub fn next_leader_slot(pubkey: &Pubkey, current_slot: u64, bank: &Bank) -> Option<u64> { pub fn next_leader_slot(pubkey: &Pubkey, mut current_slot: u64, bank: &Bank) -> Option<u64> {
let (epoch, slot_index) = bank.get_epoch_and_slot_index(current_slot + 1); let (mut epoch, mut start_index) = bank.get_epoch_and_slot_index(current_slot + 1);
while let Some(leader_schedule) = leader_schedule(epoch, bank) {
if let Some(leader_schedule) = leader_schedule(epoch, bank) {
// clippy thinks I should do this: // clippy thinks I should do this:
// for (i, <item>) in leader_schedule // for (i, <item>) in leader_schedule
// .iter() // .iter()
@ -57,11 +56,15 @@ pub fn next_leader_slot(pubkey: &Pubkey, current_slot: u64, bank: &Bank) -> Opti
// //
// but leader_schedule doesn't implement Iter... // but leader_schedule doesn't implement Iter...
#[allow(clippy::needless_range_loop)] #[allow(clippy::needless_range_loop)]
for i in slot_index..bank.get_slots_in_epoch(epoch) { for i in start_index..bank.get_slots_in_epoch(epoch) {
current_slot += 1;
if *pubkey == leader_schedule[i] { if *pubkey == leader_schedule[i] {
return Some(current_slot + 1 + (i - slot_index) as u64); return Some(current_slot);
} }
} }
epoch += 1;
start_index = 0;
} }
None None
} }

View File

@ -57,6 +57,7 @@ clientCommand="\
--duration 7500 \ --duration 7500 \
--sustained \ --sustained \
--threads $threadCount \ --threads $threadCount \
--tx_count 10000 \
" "
tmux new -s solana-bench-tps -d " tmux new -s solana-bench-tps -d "