feat: improve legacy metadata and admin compatibility (#2202)

This commit is contained in:
weisd
2026-03-18 21:05:09 +08:00
committed by GitHub
parent 84077adf17
commit b9b7d86ae4
133 changed files with 11707 additions and 1945 deletions
-11
View File
@@ -310,17 +310,6 @@ impl DataUsageHash {
let hash = self.calculate_hash();
warn!(
"mod_alt: key: {} hash: {} cycle: {} cycles: {} mod: {} hash >> 32: {} result: {}",
self.0,
hash,
cycle,
cycles,
(hash >> 32) as u32,
(hash >> 32) as u32 % cycles,
cycle % cycles,
);
(hash >> 32) as u32 % cycles == cycle % cycles
}
+10 -6
View File
@@ -162,7 +162,8 @@ impl ScannerIO for ECStore {
let all_buckets_clone = all_buckets.iter().map(|b| b.name.clone()).collect::<Vec<String>>();
tokio::spawn(async move {
let mut last_update = SystemTime::now();
let mut last_update = SystemTime::UNIX_EPOCH;
let mut has_sent_once = false;
let mut ticker = tokio::time::interval(Duration::from_secs(30));
loop {
@@ -184,7 +185,8 @@ impl ScannerIO for ECStore {
all_merged.merge(result);
}
if all_merged.root().is_some() && all_merged.info.last_update.unwrap() > last_update {
let merged_last_update = all_merged.info.last_update.unwrap_or(SystemTime::UNIX_EPOCH);
if all_merged.root().is_some() && (!has_sent_once || merged_last_update > last_update) {
let dui = all_merged.dui(&all_merged.info.name, &all_buckets_clone);
if let Err(e) = updates.send(dui).await {
error!("Failed to send data usage info: {}", e);
@@ -202,12 +204,14 @@ impl ScannerIO for ECStore {
all_merged.merge(result);
}
if all_merged.root().is_some() && all_merged.info.last_update.unwrap() > last_update {
let merged_last_update = all_merged.info.last_update.unwrap_or(SystemTime::UNIX_EPOCH);
if all_merged.root().is_some() && (!has_sent_once || merged_last_update > last_update) {
let dui = all_merged.dui(&all_merged.info.name, &all_buckets_clone);
if let Err(e) = updates.send(dui).await {
error!("Failed to send data usage info: {}", e);
}
last_update = all_merged.info.last_update.unwrap();
has_sent_once = true;
last_update = merged_last_update;
}
}
}
@@ -511,8 +515,8 @@ impl ScannerIODisk for Disk {
let fivs = match meta.get_file_info_versions(item.bucket.as_str(), item.object_path().as_str(), false) {
Ok(versions) => versions,
Err(e) => {
error!("Failed to get file info versions: {}", e);
return Err(StorageError::other("failed to get file info".to_string()));
error!("Failed to get file info versions: {}/{}, err: {e}", item.bucket, item.object_path());
return Err(StorageError::other("skip file".to_string()));
}
};