mirror of
https://github.com/rustfs/rustfs.git
synced 2026-12-02 22:26:21 +00:00
test(ecstore): check replica lock ordering during publication
This commit is contained in:
@@ -308,12 +308,12 @@ async fn replica_write_with_waiting_metadata_writer(multipart: bool) {
|
||||
.new_ns_lock(".rustfs.sys", &format!("bucket-targets/{bucket}/transaction.lock"))
|
||||
.await
|
||||
.expect("create metadata writer");
|
||||
let writer = lock.get_write_lock(Duration::from_secs(5));
|
||||
let writer = lock.get_write_lock(Duration::from_secs(30));
|
||||
tokio::pin!(writer);
|
||||
// Leave the writer registered while the replica continues. A second read
|
||||
// acquisition would queue behind this writer, which needs our first read.
|
||||
assert!(futures::poll!(&mut writer).is_pending());
|
||||
timeout(Duration::from_secs(2), async {
|
||||
let commit = async {
|
||||
if let Some((upload_id, parts)) = upload {
|
||||
store
|
||||
.clone()
|
||||
@@ -323,10 +323,13 @@ async fn replica_write_with_waiting_metadata_writer(multipart: bool) {
|
||||
let mut data = PutObjReader::from_vec(b"replicated version".to_vec());
|
||||
store.put_object(bucket, "object", &mut data, &opts).await
|
||||
}
|
||||
})
|
||||
.await
|
||||
.expect("replica must reuse its metadata read lock instead of waiting behind the writer")
|
||||
.expect("replica PUT should commit");
|
||||
};
|
||||
// The queued writer bounds a recursive read. Disk publication may take longer on a busy filesystem.
|
||||
tokio::select! {
|
||||
biased;
|
||||
_ = &mut writer => panic!("metadata writer finished before the replica committed under its snapshot"),
|
||||
result = commit => result.expect("replica PUT should commit"),
|
||||
};
|
||||
assert!(futures::poll!(&mut writer).is_pending(), "the snapshot must still fence metadata updates");
|
||||
let read_opts = ObjectOptions {
|
||||
version_id: opts.version_id.clone(),
|
||||
|
||||
Reference in New Issue
Block a user