MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / test_concurrency

Function test_concurrency

src/storage/src/source/reclock.rs:476–546  ·  view source on GitHub ↗

error: unsupported operation: can't call foreign function `decNumberFromInt32` on OS `linux`

()

Source from the content-addressed store, hash-verified

474 #[mz_ore::test(tokio::test)]
475 #[cfg_attr(miri, ignore)] // error: unsupported operation: can't call foreign function `decNumberFromInt32` on OS `linux`
476 async fn test_concurrency() {
477 // Create two operators pointing to the same shard
478 let shared_shard = ShardId::new();
479 let (mut op_a, _) = make_test_operator(shared_shard, Antichain::from_elem(0.into())).await;
480 let (mut op_b, _) = make_test_operator(shared_shard, Antichain::from_elem(0.into())).await;
481
482 // Mint some bindings through operator A
483 let source_upper = partitioned_frontier([(0, MzOffset::from(3))]);
484 let mut batch = op_a
485 .mint(
486 1000.into(),
487 Antichain::from_elem(1001.into()),
488 source_upper.borrow(),
489 )
490 .await;
491 let mut expected_batch: ReclockBatch<_, Timestamp> = ReclockBatch {
492 updates: vec![
493 (
494 Partitioned::new_range(RB::NegInfinity, RB::before(0), MzOffset::from(0)),
495 1000.into(),
496 Diff::ONE,
497 ),
498 (
499 Partitioned::new_range(RB::after(0), RB::PosInfinity, MzOffset::from(0)),
500 1000.into(),
501 Diff::ONE,
502 ),
503 (
504 Partitioned::new_range(RB::NegInfinity, RB::PosInfinity, MzOffset::from(0)),
505 1000.into(),
506 Diff::MINUS_ONE,
507 ),
508 (
509 Partitioned::new_singleton(RB::exact(0), MzOffset::from(3)),
510 1000.into(),
511 Diff::ONE,
512 ),
513 ],
514 upper: Antichain::from_elem(Timestamp::from(1001)),
515 };
516 batch.updates.sort();
517 expected_batch.updates.sort();
518 assert_eq!(batch, expected_batch);
519
520 // Operator B should attempt to mint in one go, fail, re-sync, and retry only for the
521 // bindings that still need minting
522 let source_upper = partitioned_frontier([(0, MzOffset::from(5))]);
523 let mut batch = op_b
524 .mint(
525 11000.into(),
526 Antichain::from_elem(11001.into()),
527 source_upper.borrow(),
528 )
529 .await;
530 expected_batch.updates.extend([
531 (
532 Partitioned::new_singleton(RB::exact(0), MzOffset::from(3)),
533 11000.into(),

Callers

nothing calls this directly

Calls 6

make_test_operatorFunction · 0.85
sortMethod · 0.80
partitioned_frontierFunction · 0.70
mintMethod · 0.45
borrowMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected