Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zwang28 committed Sep 12, 2024
1 parent 56cb908 commit bbc1491
Showing 1 changed file with 53 additions and 1 deletion.
54 changes: 53 additions & 1 deletion src/storage/hummock_test/src/state_store_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use risingwave_hummock_sdk::{
};
use risingwave_meta::hummock::test_utils::setup_compute_env;
use risingwave_rpc_client::HummockMetaClient;
use risingwave_storage::error::ErrorKind;
use risingwave_storage::hummock::iterator::change_log::test_utils::{
apply_test_log_data, gen_test_data,
};
Expand Down Expand Up @@ -1234,7 +1235,58 @@ async fn test_multiple_epoch_sync_v2() {
.try_wait_epoch(HummockReadEpoch::Committed(epoch3))
.await
.unwrap();
test_get().await;
// The barrier read always read the latest epoch if any committed version available.
if let ErrorKind::Hummock(err) = hummock_storage
.get(
gen_key_from_str(VirtualNode::ZERO, "bb"),
epoch1,
ReadOptions {
cache_policy: CachePolicy::Fill(CacheContext::Default),
..Default::default()
},
)
.await
.unwrap_err()
.inner()
{
assert!(err.is_expired_epoch());
} else {
panic!("unexpected error");
};

if let ErrorKind::Hummock(err) = hummock_storage
.get(
gen_key_from_str(VirtualNode::ZERO, "bb"),
epoch2,
ReadOptions {
cache_policy: CachePolicy::Fill(CacheContext::Default),
..Default::default()
},
)
.await
.unwrap_err()
.inner()
{
assert!(err.is_expired_epoch());
} else {
panic!("unexpected error");
}

assert_eq!(
hummock_storage
.get(
gen_key_from_str(VirtualNode::ZERO, "bb"),
epoch3,
ReadOptions {
cache_policy: CachePolicy::Fill(CacheContext::Default),
..Default::default()
}
)
.await
.unwrap()
.unwrap(),
"555".as_bytes()
);
}

#[tokio::test]
Expand Down

0 comments on commit bbc1491

Please sign in to comment.