Skip to content

Commit e56e1fc

Browse files
committed
unique prepare
1 parent 91a2a7e commit e56e1fc

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

crates/core/src/host/module_host.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1788,7 +1788,14 @@ impl ModuleHost {
17881788
args,
17891789
};
17901790

1791-
let prepare_id = format!("prepare-{}", PREPARE_COUNTER.fetch_add(1, Ordering::Relaxed));
1791+
// Include the coordinator identity so prepare_ids from different coordinators
1792+
// cannot collide on the participant's st_2pc_state table.
1793+
let coordinator_hex = caller_identity.to_hex();
1794+
let prepare_id = format!(
1795+
"prepare-{}-{}",
1796+
&coordinator_hex.to_string()[..16],
1797+
PREPARE_COUNTER.fetch_add(1, Ordering::Relaxed),
1798+
);
17921799

17931800
// Channel for signalling PREPARED result back to this task.
17941801
let (prepared_tx, prepared_rx) = tokio::sync::oneshot::channel::<(ReducerCallResult, Option<Bytes>)>();

0 commit comments

Comments
 (0)