Skip to content

Commit

Permalink
Fix build?
Browse files Browse the repository at this point in the history
  • Loading branch information
ryoqun committed May 25, 2020
1 parent e88a3c9 commit 71e4c8c
Show file tree
Hide file tree
Showing 33 changed files with 209 additions and 197 deletions.
3 changes: 2 additions & 1 deletion banking-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ fn main() {
let ledger_path = get_tmp_ledger_path!();
{
let blockstore = Arc::new(
Blockstore::open(&ledger_path).expect("Expected to be able to open database ledger"),
Blockstore::open_as_primary(&ledger_path)
.expect("Expected to be able to open database ledger"),
);
let (exit, poh_recorder, poh_service, signal_receiver) =
create_test_recorder(&bank, &blockstore, None);
Expand Down
6 changes: 4 additions & 2 deletions core/benches/banking_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ fn bench_consume_buffered(bencher: &mut Bencher) {
let my_pubkey = Pubkey::new_rand();
{
let blockstore = Arc::new(
Blockstore::open(&ledger_path).expect("Expected to be able to open database ledger"),
Blockstore::open_as_primary(&ledger_path)
.expect("Expected to be able to open database ledger"),
);
let (exit, poh_recorder, poh_service, _signal_receiver) =
create_test_recorder(&bank, &blockstore, None);
Expand Down Expand Up @@ -185,7 +186,8 @@ fn bench_banking(bencher: &mut Bencher, tx_type: TransactionType) {
let ledger_path = get_tmp_ledger_path!();
{
let blockstore = Arc::new(
Blockstore::open(&ledger_path).expect("Expected to be able to open database ledger"),
Blockstore::open_as_primary(&ledger_path)
.expect("Expected to be able to open database ledger"),
);
let (exit, poh_recorder, poh_service, signal_receiver) =
create_test_recorder(&bank, &blockstore, None);
Expand Down
20 changes: 10 additions & 10 deletions core/benches/blockstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use test::Bencher;

// Given some shreds and a ledger at ledger_path, benchmark writing the shreds to the ledger
fn bench_write_shreds(bench: &mut Bencher, entries: Vec<Entry>, ledger_path: &Path) {
let blockstore =
Blockstore::open(ledger_path).expect("Expected to be able to open database ledger");
let blockstore = Blockstore::open_as_primary(ledger_path)
.expect("Expected to be able to open database ledger");
bench.iter(move || {
let shreds = entries_to_test_shreds(entries.clone(), 0, 0, true, 0);
blockstore.insert_shreds(shreds, None, false).unwrap();
Expand Down Expand Up @@ -71,8 +71,8 @@ fn bench_write_big(bench: &mut Bencher) {
#[ignore]
fn bench_read_sequential(bench: &mut Bencher) {
let ledger_path = get_tmp_ledger_path!();
let mut blockstore =
Blockstore::open(&ledger_path).expect("Expected to be able to open database ledger");
let mut blockstore = Blockstore::open_as_primary(&ledger_path)
.expect("Expected to be able to open database ledger");

// Insert some big and small shreds into the ledger
let num_small_shreds = 32 * 1024;
Expand All @@ -98,8 +98,8 @@ fn bench_read_sequential(bench: &mut Bencher) {
#[ignore]
fn bench_read_random(bench: &mut Bencher) {
let ledger_path = get_tmp_ledger_path!();
let mut blockstore =
Blockstore::open(&ledger_path).expect("Expected to be able to open database ledger");
let mut blockstore = Blockstore::open_as_primary(&ledger_path)
.expect("Expected to be able to open database ledger");

// Insert some big and small shreds into the ledger
let num_small_shreds = 32 * 1024;
Expand Down Expand Up @@ -129,8 +129,8 @@ fn bench_read_random(bench: &mut Bencher) {
#[ignore]
fn bench_insert_data_shred_small(bench: &mut Bencher) {
let ledger_path = get_tmp_ledger_path!();
let blockstore =
Blockstore::open(&ledger_path).expect("Expected to be able to open database ledger");
let blockstore = Blockstore::open_as_primary(&ledger_path)
.expect("Expected to be able to open database ledger");
let num_entries = 32 * 1024;
let entries = create_ticks(num_entries, 0, Hash::default());
bench.iter(move || {
Expand All @@ -144,8 +144,8 @@ fn bench_insert_data_shred_small(bench: &mut Bencher) {
#[ignore]
fn bench_insert_data_shred_big(bench: &mut Bencher) {
let ledger_path = get_tmp_ledger_path!();
let blockstore =
Blockstore::open(&ledger_path).expect("Expected to be able to open database ledger");
let blockstore = Blockstore::open_as_primary(&ledger_path)
.expect("Expected to be able to open database ledger");
let num_entries = 32 * 1024;
let entries = create_ticks(num_entries, 0, Hash::default());
bench.iter(move || {
Expand Down
18 changes: 9 additions & 9 deletions core/src/banking_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@ mod tests {
let ledger_path = get_tmp_ledger_path!();
{
let blockstore = Arc::new(
Blockstore::open(&ledger_path)
Blockstore::open_as_primary(&ledger_path)
.expect("Expected to be able to open database ledger"),
);
let (exit, poh_recorder, poh_service, _entry_receiever) =
Expand Down Expand Up @@ -1084,7 +1084,7 @@ mod tests {
let ledger_path = get_tmp_ledger_path!();
{
let blockstore = Arc::new(
Blockstore::open(&ledger_path)
Blockstore::open_as_primary(&ledger_path)
.expect("Expected to be able to open database ledger"),
);
let mut poh_config = PohConfig::default();
Expand Down Expand Up @@ -1146,7 +1146,7 @@ mod tests {
let ledger_path = get_tmp_ledger_path!();
{
let blockstore = Arc::new(
Blockstore::open(&ledger_path)
Blockstore::open_as_primary(&ledger_path)
.expect("Expected to be able to open database ledger"),
);
let mut poh_config = PohConfig::default();
Expand Down Expand Up @@ -1286,7 +1286,7 @@ mod tests {
// start a banking_stage to eat verified receiver
let bank = Arc::new(Bank::new(&genesis_config));
let blockstore = Arc::new(
Blockstore::open(&ledger_path)
Blockstore::open_as_primary(&ledger_path)
.expect("Expected to be able to open database ledger"),
);
let mut poh_config = PohConfig::default();
Expand Down Expand Up @@ -1354,7 +1354,7 @@ mod tests {
};
let ledger_path = get_tmp_ledger_path!();
{
let blockstore = Blockstore::open(&ledger_path)
let blockstore = Blockstore::open_as_primary(&ledger_path)
.expect("Expected to be able to open database ledger");
let (poh_recorder, entry_receiver) = PohRecorder::new(
bank.tick_height(),
Expand Down Expand Up @@ -1665,7 +1665,7 @@ mod tests {
};
let ledger_path = get_tmp_ledger_path!();
{
let blockstore = Blockstore::open(&ledger_path)
let blockstore = Blockstore::open_as_primary(&ledger_path)
.expect("Expected to be able to open database ledger");
let (poh_recorder, entry_receiver) = PohRecorder::new(
bank.tick_height(),
Expand Down Expand Up @@ -1758,7 +1758,7 @@ mod tests {
};
let ledger_path = get_tmp_ledger_path!();
{
let blockstore = Blockstore::open(&ledger_path)
let blockstore = Blockstore::open_as_primary(&ledger_path)
.expect("Expected to be able to open database ledger");
let (poh_recorder, _entry_receiver) = PohRecorder::new(
bank.tick_height(),
Expand Down Expand Up @@ -1846,7 +1846,7 @@ mod tests {

let ledger_path = get_tmp_ledger_path!();
{
let blockstore = Blockstore::open(&ledger_path)
let blockstore = Blockstore::open_as_primary(&ledger_path)
.expect("Expected to be able to open database ledger");
let (poh_recorder, _entry_receiver) = PohRecorder::new(
bank.tick_height(),
Expand Down Expand Up @@ -1913,7 +1913,7 @@ mod tests {
};
let ledger_path = get_tmp_ledger_path!();
{
let blockstore = Blockstore::open(&ledger_path)
let blockstore = Blockstore::open_as_primary(&ledger_path)
.expect("Expected to be able to open database ledger");
let blockstore = Arc::new(blockstore);
let (poh_recorder, _entry_receiver) = PohRecorder::new(
Expand Down
4 changes: 2 additions & 2 deletions core/src/broadcast_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ pub mod test {
fn test_duplicate_retransmit_signal() {
// Setup
let ledger_path = get_tmp_ledger_path!();
let blockstore = Arc::new(Blockstore::open(&ledger_path).unwrap());
let blockstore = Arc::new(Blockstore::open_as_primary(&ledger_path).unwrap());
let (transmit_sender, transmit_receiver) = channel();
let (retransmit_slots_sender, retransmit_slots_receiver) = unbounded();
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(100_000);
Expand Down Expand Up @@ -585,7 +585,7 @@ pub mod test {
retransmit_slots_receiver: RetransmitSlotsReceiver,
) -> MockBroadcastStage {
// Make the database ledger
let blockstore = Arc::new(Blockstore::open(ledger_path).unwrap());
let blockstore = Arc::new(Blockstore::open_as_primary(ledger_path).unwrap());

// Make the leader node and scheduler
let leader_info = Node::new_localhost_with_pubkey(leader_pubkey);
Expand Down
3 changes: 2 additions & 1 deletion core/src/broadcast_stage/standard_broadcast_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,8 @@ mod test {
// Setup
let ledger_path = get_tmp_ledger_path!();
let blockstore = Arc::new(
Blockstore::open(&ledger_path).expect("Expected to be able to open database ledger"),
Blockstore::open_as_primary(&ledger_path)
.expect("Expected to be able to open database ledger"),
);
let leader_keypair = Arc::new(Keypair::new());
let leader_pubkey = leader_keypair.pubkey();
Expand Down
4 changes: 2 additions & 2 deletions core/src/cluster_info_vote_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ mod tests {
let bank = bank_forks.get(0).unwrap().clone();
let vote_tracker = VoteTracker::new(&bank);
let ledger_path = get_tmp_ledger_path!();
let blockstore = Arc::new(Blockstore::open(&ledger_path).unwrap());
let blockstore = Arc::new(Blockstore::open_as_primary(&ledger_path).unwrap());
let subscriptions = Arc::new(RpcSubscriptions::new(
&exit,
Arc::new(RwLock::new(bank_forks)),
Expand Down Expand Up @@ -1067,7 +1067,7 @@ mod tests {
let bank_forks = BankForks::new(0, bank);
let bank = bank_forks.get(0).unwrap().clone();
let ledger_path = get_tmp_ledger_path!();
let blockstore = Arc::new(Blockstore::open(&ledger_path).unwrap());
let blockstore = Arc::new(Blockstore::open_as_primary(&ledger_path).unwrap());
let subscriptions = Arc::new(RpcSubscriptions::new(
&exit,
Arc::new(RwLock::new(bank_forks)),
Expand Down
6 changes: 3 additions & 3 deletions core/src/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ mod tests {
fn test_get_confirmations() {
let bank = Arc::new(Bank::default());
let ledger_path = get_tmp_ledger_path!();
let blockstore = Arc::new(Blockstore::open(&ledger_path).unwrap());
let blockstore = Arc::new(Blockstore::open_as_primary(&ledger_path).unwrap());
// Build BlockCommitmentCache with votes at depths 0 and 1 for 2 slots
let mut cache0 = BlockCommitment::default();
cache0.increase_confirmation_stake(1, 5);
Expand Down Expand Up @@ -481,7 +481,7 @@ mod tests {
fn test_is_confirmed_rooted() {
let bank = Arc::new(Bank::default());
let ledger_path = get_tmp_ledger_path!();
let blockstore = Arc::new(Blockstore::open(&ledger_path).unwrap());
let blockstore = Arc::new(Blockstore::open_as_primary(&ledger_path).unwrap());
blockstore.set_roots(&[0, 1]).unwrap();
// Build BlockCommitmentCache with rooted slots
let mut cache0 = BlockCommitment::default();
Expand Down Expand Up @@ -532,7 +532,7 @@ mod tests {
let bank = Arc::new(Bank::new(&GenesisConfig::default()));
let bank_slot_5 = Arc::new(Bank::new_from_parent(&bank, &Pubkey::default(), 5));
let ledger_path = get_tmp_ledger_path!();
let blockstore = Arc::new(Blockstore::open(&ledger_path).unwrap());
let blockstore = Arc::new(Blockstore::open_as_primary(&ledger_path).unwrap());
let total_stake = 50;

// Build cache with confirmation_count 2 given total_stake
Expand Down
4 changes: 2 additions & 2 deletions core/src/ledger_cleanup_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ mod tests {
fn test_cleanup() {
solana_logger::setup();
let blockstore_path = get_tmp_ledger_path!();
let blockstore = Blockstore::open(&blockstore_path).unwrap();
let blockstore = Blockstore::open_as_primary(&blockstore_path).unwrap();
let (shreds, _) = make_many_slot_entries(0, 50, 5);
blockstore.insert_shreds(shreds, None, false).unwrap();
let blockstore = Arc::new(blockstore);
Expand All @@ -236,7 +236,7 @@ mod tests {
fn test_cleanup_speed() {
solana_logger::setup();
let blockstore_path = get_tmp_ledger_path!();
let mut blockstore = Blockstore::open(&blockstore_path).unwrap();
let mut blockstore = Blockstore::open_as_primary(&blockstore_path).unwrap();
blockstore.set_no_compaction(true);
let blockstore = Arc::new(blockstore);
let (sender, receiver) = channel();
Expand Down
Loading

0 comments on commit 71e4c8c

Please sign in to comment.