fix(rebalance): converge multipart data movement retries

This commit is contained in:
马登山
2026-08-12 14:32:46 +08:00
parent 5d05897ae0
commit 3234c72683
36 changed files with 5045 additions and 681 deletions
+20 -2
View File
@@ -23,6 +23,8 @@ pub const MINIO_INTERNAL_PREFIX: &str = "x-minio-internal-";
// Key suffixes (lowercase, no prefix)
pub const SUFFIX_INLINE_DATA: &str = "inline-data";
pub const SUFFIX_DATA_MOVED: &str = "data-moved";
/// Internal ownership marker for a data-movement multipart upload.
pub const SUFFIX_DATA_MOVEMENT_UPLOAD: &str = "data-movement-upload";
/// Transient flag for data movement
pub const SUFFIX_DATA_MOV: &str = "data-mov";
/// Transient flag for healing
@@ -37,6 +39,8 @@ pub const SUFFIX_ACTUAL_OBJECT_SIZE: &str = "actual-object-size";
/// Used by replication; key stored with capital A
pub const SUFFIX_ACTUAL_OBJECT_SIZE_CAP: &str = "Actual-Object-Size";
pub const SUFFIX_CRC: &str = "crc";
/// JSON-encoded per-part S3 checksum maps retained across raw data movement.
pub const SUFFIX_PART_CHECKSUMS: &str = "part-checksums";
pub const SUFFIX_TRANSITION_STATUS: &str = "transition-status";
pub const SUFFIX_TRANSITIONED_OBJECTNAME: &str = "transitioned-object";
pub const SUFFIX_TRANSITIONED_VERSION_ID: &str = "transitioned-versionID";
@@ -125,8 +129,10 @@ pub fn internal_key_starts_with(key: &str, suffix_prefix: &str) -> bool {
/// For keys like x-rustfs-internal-replication-reset-{arn}, strips the internal prefix and suffix_prefix,
/// returning the remainder (e.g. "arn1"). Returns None if key does not match.
pub fn internal_key_strip_suffix_prefix(key: &str, suffix_prefix: &str) -> Option<String> {
let rest = strip_internal_prefix(key)?;
rest.strip_prefix(suffix_prefix).map(|s| s.to_string())
let rest = strip_internal_prefix_preserving_case(key)?;
rest.get(..suffix_prefix.len())
.is_some_and(|prefix| prefix.eq_ignore_ascii_case(suffix_prefix))
.then(|| rest[suffix_prefix.len()..].to_string())
}
fn both_keys(suffix: &str) -> (String, String) {
@@ -522,6 +528,18 @@ mod tests {
assert!(!has_internal_suffix(key, SUFFIX_COMPRESSION));
}
#[test]
fn internal_suffix_prefix_preserves_dynamic_identifier_case() {
assert_eq!(
internal_key_strip_suffix_prefix(
"X-Minio-Internal-Replication-Reset-arn:minio:replication::TenantA:bucket",
SUFFIX_REPLICATION_RESET_ARN_PREFIX,
)
.as_deref(),
Some("arn:minio:replication::TenantA:bucket")
);
}
#[test]
fn test_get_str_case_insensitive_fallback() {
// Non-canonical mixed-case key must still be found via the case-insensitive scan.