mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-25 21:46:50 +00:00
Revert "feat(ecstore): add list marker v2 cache id"
This reverts commit 980c364e02.
This commit is contained in:
@@ -178,8 +178,7 @@ pub struct ListPathOptions {
|
|||||||
pub set_idx: Option<usize>,
|
pub set_idx: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
const MARKER_TAG_VERSION: &str = "v2";
|
const MARKER_TAG_VERSION: &str = "v1";
|
||||||
const LEGACY_MARKER_TAG_VERSIONS: &[&str] = &["v1", MARKER_TAG_VERSION];
|
|
||||||
const ENV_API_LIST_QUORUM: &str = "RUSTFS_API_LIST_QUORUM";
|
const ENV_API_LIST_QUORUM: &str = "RUSTFS_API_LIST_QUORUM";
|
||||||
const DEFAULT_API_LIST_QUORUM: &str = "strict";
|
const DEFAULT_API_LIST_QUORUM: &str = "strict";
|
||||||
const ENV_API_LIST_OBJECTS_QUORUM: &str = "RUSTFS_LIST_OBJECTS_QUORUM";
|
const ENV_API_LIST_OBJECTS_QUORUM: &str = "RUSTFS_LIST_OBJECTS_QUORUM";
|
||||||
@@ -210,17 +209,6 @@ fn list_objects_quorum_from_env() -> String {
|
|||||||
normalize_list_quorum(&value).to_owned()
|
normalize_list_quorum(&value).to_owned()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn append_list_cache_id_to_marker(marker: String, cache_id: Option<&str>) -> String {
|
|
||||||
match cache_id {
|
|
||||||
Some(id) => ListPathOptions {
|
|
||||||
id: Some(id.to_owned()),
|
|
||||||
..Default::default()
|
|
||||||
}
|
|
||||||
.encode_marker(&marker),
|
|
||||||
None => marker,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn list_metadata_resolution_params(bucket: String, listing_quorum: usize, versioned: bool) -> MetadataResolutionParams {
|
fn list_metadata_resolution_params(bucket: String, listing_quorum: usize, versioned: bool) -> MetadataResolutionParams {
|
||||||
let mut resolver = MetadataResolutionParams {
|
let mut resolver = MetadataResolutionParams {
|
||||||
dir_quorum: listing_quorum,
|
dir_quorum: listing_quorum,
|
||||||
@@ -297,7 +285,7 @@ impl ListPathOptions {
|
|||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
if key == "rustfs_cache" {
|
if key == "rustfs_cache" {
|
||||||
if !LEGACY_MARKER_TAG_VERSIONS.contains(&value) {
|
if value != MARKER_TAG_VERSION {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
supported_marker = true;
|
supported_marker = true;
|
||||||
@@ -341,16 +329,14 @@ impl ListPathOptions {
|
|||||||
}
|
}
|
||||||
pub fn encode_marker(&mut self, marker: &str) -> String {
|
pub fn encode_marker(&mut self, marker: &str) -> String {
|
||||||
if let Some(id) = &self.id {
|
if let Some(id) = &self.id {
|
||||||
let mut marker_tag = format!("{}[rustfs_cache:{}", marker, MARKER_TAG_VERSION);
|
format!(
|
||||||
marker_tag.push_str(&format!(",id:{}", id));
|
"{}[rustfs_cache:{},id:{},p:{},s:{}]",
|
||||||
if let Some(pool_idx) = self.pool_idx {
|
marker,
|
||||||
marker_tag.push_str(&format!(",p:{}", pool_idx));
|
MARKER_TAG_VERSION,
|
||||||
}
|
id.to_owned(),
|
||||||
if let Some(set_idx) = self.set_idx {
|
self.pool_idx.unwrap_or_default(),
|
||||||
marker_tag.push_str(&format!(",s:{}", set_idx));
|
self.set_idx.unwrap_or_default(),
|
||||||
}
|
)
|
||||||
marker_tag.push(']');
|
|
||||||
marker_tag
|
|
||||||
} else {
|
} else {
|
||||||
format!("{marker}[rustfs_cache:{MARKER_TAG_VERSION},return:]")
|
format!("{marker}[rustfs_cache:{MARKER_TAG_VERSION},return:]")
|
||||||
}
|
}
|
||||||
@@ -451,7 +437,6 @@ impl ECStore {
|
|||||||
err: Some(err.into()),
|
err: Some(err.into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
let next_cache_id = list_result.entries.as_ref().and_then(|entries| entries.list_id.clone());
|
|
||||||
|
|
||||||
// err=None means gather_results filled its limit → disk has more data
|
// err=None means gather_results filled its limit → disk has more data
|
||||||
let disk_has_more = list_result.err.is_none();
|
let disk_has_more = list_result.err.is_none();
|
||||||
@@ -489,9 +474,7 @@ impl ECStore {
|
|||||||
|
|
||||||
let mut next_marker = {
|
let mut next_marker = {
|
||||||
if is_truncated {
|
if is_truncated {
|
||||||
get_objects
|
get_objects.last().map(|last| last.name.clone())
|
||||||
.last()
|
|
||||||
.map(|last| append_list_cache_id_to_marker(last.name.clone(), next_cache_id.as_deref()))
|
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
@@ -532,8 +515,8 @@ impl ECStore {
|
|||||||
// Prefer last object name; fall back to last prefix for marker.
|
// Prefer last object name; fall back to last prefix for marker.
|
||||||
next_marker = objects
|
next_marker = objects
|
||||||
.last()
|
.last()
|
||||||
.map(|last| append_list_cache_id_to_marker(last.name.clone(), next_cache_id.as_deref()))
|
.map(|last| last.name.clone())
|
||||||
.or_else(|| prefixes.last().cloned().map(|marker| append_list_cache_id_to_marker(marker, next_cache_id.as_deref())));
|
.or_else(|| prefixes.last().cloned());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3561,22 +3544,6 @@ mod test {
|
|||||||
assert_eq!(parsed.set_idx, Some(7));
|
assert_eq!(parsed.set_idx, Some(7));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn list_path_marker_parser_accepts_legacy_v1_tag() {
|
|
||||||
let mut parsed = ListPathOptions {
|
|
||||||
marker: Some("photos/2026/image.jpg[rustfs_cache:v1,id:legacy-cache-id,p:4,s:1]".to_string()),
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
parsed.parse_marker();
|
|
||||||
|
|
||||||
assert_eq!(parsed.marker.as_deref(), Some("photos/2026/image.jpg"));
|
|
||||||
assert_eq!(parsed.id.as_deref(), Some("legacy-cache-id"));
|
|
||||||
assert_eq!(parsed.pool_idx, Some(4));
|
|
||||||
assert_eq!(parsed.set_idx, Some(1));
|
|
||||||
assert!(!parsed.create);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn list_path_marker_parser_ignores_unsupported_cache_tag_version() {
|
fn list_path_marker_parser_ignores_unsupported_cache_tag_version() {
|
||||||
let marker = "photos/image.jpg[rustfs_cache:v0,id:list-cache-id,p:3,s:7]".to_string();
|
let marker = "photos/image.jpg[rustfs_cache:v0,id:list-cache-id,p:3,s:7]".to_string();
|
||||||
|
|||||||
Reference in New Issue
Block a user