mirror of
https://github.com/rustfs/rustfs.git
synced 2026-09-01 17:58:22 +00:00
fix(ecstore): preserve list marker set index (#2919)
Co-authored-by: houseme <housemecn@gmail.com>
This commit is contained in:
@@ -213,7 +213,7 @@ impl ListPathOptions {
|
|||||||
MARKER_TAG_VERSION,
|
MARKER_TAG_VERSION,
|
||||||
id.to_owned(),
|
id.to_owned(),
|
||||||
self.pool_idx.unwrap_or_default(),
|
self.pool_idx.unwrap_or_default(),
|
||||||
self.pool_idx.unwrap_or_default(),
|
self.set_idx.unwrap_or_default(),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
format!("{marker}[rustfs_cache:{MARKER_TAG_VERSION},return:]")
|
format!("{marker}[rustfs_cache:{MARKER_TAG_VERSION},return:]")
|
||||||
@@ -1405,6 +1405,7 @@ fn calc_common_counter(infos: &[DiskInfo], read_quorum: usize) -> u64 {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
|
use super::ListPathOptions;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
/// Test that "null" version marker is handled correctly
|
/// Test that "null" version marker is handled correctly
|
||||||
@@ -1477,6 +1478,35 @@ mod test {
|
|||||||
assert_eq!(parsed.unwrap().to_string(), uuid_str);
|
assert_eq!(parsed.unwrap().to_string(), uuid_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn list_path_marker_round_trip_preserves_set_index() {
|
||||||
|
let mut opts = ListPathOptions {
|
||||||
|
id: Some("list-cache-id".to_string()),
|
||||||
|
pool_idx: Some(3),
|
||||||
|
set_idx: Some(7),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
|
||||||
|
let marker = opts.encode_marker("photos/2026/image.jpg");
|
||||||
|
let expected_marker = format!(
|
||||||
|
"photos/2026/image.jpg[rustfs_cache:{},id:list-cache-id,p:3,s:7]",
|
||||||
|
super::MARKER_TAG_VERSION
|
||||||
|
);
|
||||||
|
assert_eq!(marker, expected_marker);
|
||||||
|
|
||||||
|
let mut parsed = ListPathOptions {
|
||||||
|
marker: Some(marker),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
parsed.parse_marker();
|
||||||
|
|
||||||
|
assert_eq!(parsed.marker.as_deref(), Some("photos/2026/image.jpg"));
|
||||||
|
assert_eq!(parsed.id.as_deref(), Some("list-cache-id"));
|
||||||
|
assert_eq!(parsed.pool_idx, Some(3));
|
||||||
|
assert_eq!(parsed.set_idx, Some(7));
|
||||||
|
assert!(!parsed.create);
|
||||||
|
}
|
||||||
|
|
||||||
// use std::sync::Arc;
|
// use std::sync::Arc;
|
||||||
|
|
||||||
// use crate::cache_value::metacache_set::list_path_raw;
|
// use crate::cache_value::metacache_set::list_path_raw;
|
||||||
|
|||||||
Reference in New Issue
Block a user