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

Function test_compaction

src/storage/src/source/reclock.rs:381–472  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

379 #[mz_ore::test(tokio::test)]
380 #[cfg_attr(miri, ignore)] // error: unsupported operation: can't call foreign function `decNumberFromInt32` on OS `linux`
381 async fn test_compaction() {
382 let persist_location = PersistLocation {
383 blob_uri: SensitiveUrl::from_str("mem://").expect("invalid URL"),
384 consensus_uri: SensitiveUrl::from_str("mem://").expect("invalid URL"),
385 };
386
387 let remap_shard = ShardId::new();
388
389 let persist_client = PERSIST_CACHE
390 .open(persist_location)
391 .await
392 .expect("error creating persist client");
393
394 let mut remap_read_handle = persist_client
395 .open_critical_since::<SourceData, (), Timestamp, StorageDiff>(
396 remap_shard,
397 PersistClient::CONTROLLER_CRITICAL_SINCE,
398 Opaque::encode(&0u64),
399 Diagnostics::from_purpose("test_since_hold"),
400 )
401 .await
402 .expect("error opening persist shard");
403
404 let (mut operator, _batch) =
405 make_test_operator(remap_shard, Antichain::from_elem(0.into())).await;
406
407 // Ming a few bindings
408 let source_upper = partitioned_frontier([(0, MzOffset::from(3))]);
409 operator
410 .mint(
411 1000.into(),
412 Antichain::from_elem(1001.into()),
413 source_upper.borrow(),
414 )
415 .await;
416
417 let source_upper = partitioned_frontier([(0, MzOffset::from(5))]);
418 operator
419 .mint(
420 2000.into(),
421 Antichain::from_elem(2001.into()),
422 source_upper.borrow(),
423 )
424 .await;
425
426 // Compact enough so that offsets >= 3 remain uncompacted
427 remap_read_handle
428 .compare_and_downgrade_since(
429 &Opaque::encode(&0u64),
430 (&Opaque::encode(&0u64), &Antichain::from_elem(1000.into())),
431 )
432 .await
433 .unwrap();
434
435 // Starting a new operator with an `as_of` is the same as having compacted
436 let (_operator, mut initial_batch) =
437 make_test_operator(remap_shard, Antichain::from_elem(1000.into())).await;
438

Callers

nothing calls this directly

Calls 10

make_test_operatorFunction · 0.85
expectMethod · 0.80
unwrapMethod · 0.80
sortMethod · 0.80
partitioned_frontierFunction · 0.70
encodeFunction · 0.50
openMethod · 0.45
mintMethod · 0.45
borrowMethod · 0.45

Tested by

no test coverage detected