Skip to content

Commit f1b5257

Browse files
Zekun LiZekun Li
Zekun Li
authored and
Zekun Li
committed
[CO] fix pipeline futures
This commit properly sets parent futures when the ordered blocks have more than one block.
1 parent 32c9f76 commit f1b5257

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

consensus/src/consensus_observer/observer/consensus_observer.rs

+18-11
Original file line numberDiff line numberDiff line change
@@ -272,22 +272,29 @@ impl ConsensusObserver {
272272
);
273273

274274
if self.pipeline_enabled() {
275-
for block in ordered_block.blocks() {
276-
let commit_callback = self.active_observer_state.create_commit_callback(
277-
self.ordered_block_store.clone(),
278-
self.block_payload_store.clone(),
279-
);
280-
if let Some(futs) = self.get_parent_pipeline_futs(block) {
281-
self.pipeline_builder().build(block, futs, commit_callback);
282-
} else {
283-
warn!(
275+
let block = ordered_block.first_block();
276+
let mut parent_fut = if let Some(futs) = self.get_parent_pipeline_futs(&block) {
277+
Some(futs)
278+
} else {
279+
warn!(
284280
LogSchema::new(LogEntry::ConsensusObserver).message(&format!(
285281
"Parent block's pipeline futures for ordered block is missing! Ignoring: {:?}",
286282
ordered_block.proof_block_info()
287283
))
288284
);
289-
return;
290-
}
285+
return;
286+
};
287+
for block in ordered_block.blocks() {
288+
let commit_callback = self.active_observer_state.create_commit_callback(
289+
self.ordered_block_store.clone(),
290+
self.block_payload_store.clone(),
291+
);
292+
self.pipeline_builder().build(
293+
block,
294+
parent_fut.take().expect("future should be set"),
295+
commit_callback,
296+
);
297+
parent_fut = Some(block.pipeline_futs().expect("pipeline futures just built"));
291298
}
292299
}
293300
// Create the commit callback (to be called after the execution pipeline)

consensus/src/pipeline/buffer_manager.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,8 @@ impl BufferManager {
399399
} = ordered_blocks;
400400

401401
info!(
402-
"Receive ordered block {}, the queue size is {}",
402+
"Receive {} ordered block ends with {}, the queue size is {}",
403+
ordered_blocks.len(),
403404
ordered_proof.commit_info(),
404405
self.buffer.len() + 1,
405406
);

0 commit comments

Comments
 (0)