Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distributed bench #1661

Merged
merged 24 commits into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
improve genesis objectload
  • Loading branch information
oxade committed Apr 28, 2022
commit d2d4b84ef34fa0540a7e3860cc8d34d46ec9b4cc
31 changes: 28 additions & 3 deletions sui/src/sui_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,34 @@ async fn make_server_with_genesis_ctx(
)
.await;

for object in preload_objects {
state.insert_genesis_object(object.clone()).await;
}
// use tokio::sync::broadcast;

// let (obj_chann_tx, mut obj_chann_rx) = broadcast::channel(preload_objects.len());

// for _ in 0..50 {
// let mut chann_rx = obj_chann_tx.subscribe();
// tokio::spawn(async move {
// loop {
// match chann_rx.recv().await {
// Ok(o) => state.insert_genesis_object(o).await,
// Err(RecvError) => break,
// Err(e) => panic!(""),
// }
// }
// });
// }

// for p in preload_objects {
// obj_chann_tx.send(*p).unwrap();
// }

state
.insert_genesis_objects_bulk_unsafe(&preload_objects.iter().collect::<Vec<_>>())
.await;
// for object in preload_objects {

// state.insert_genesis_object(object.clone()).await;
// }

let (tx_sui_to_consensus, _rx_sui_to_consensus) = channel(1);
Ok(AuthorityServer::new(
Expand Down
6 changes: 6 additions & 0 deletions sui_core/src/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,12 @@ impl AuthorityState {
.expect("TODO: propagate the error")
}

pub async fn insert_genesis_objects_bulk_unsafe(&self, objects: &[&Object]) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add a comment this must not be used away from bench / test code. I would even feel better if we use something to not make it visible outside this context.

self._database
.bulk_object_insert(objects)
.expect("TODO: propagate the error")
}

/// Persist the Genesis package to DB along with the side effects for module initialization
async fn store_package_and_init_modules_for_genesis(
&self,
Expand Down