fix: resolve test conflicts and improve data scanner functionality

- Fix multi-threaded test conflicts in AHM heal integration tests
- Remove global environment sharing to prevent test state pollution
- Fix test_all_disk_method by clearing global disk map before test
- Improve data scanner and cache value implementations
- Update dependencies and resolve clippy warnings

Signed-off-by: junxiang Mu <1948535941@qq.com>
This commit is contained in:
junxiang Mu
2025-07-16 16:32:33 +08:00
parent 8e766b90cd
commit c49414f6ac
8 changed files with 36 additions and 68 deletions
+5 -7
View File
@@ -103,7 +103,7 @@ impl HealChannelProcessor {
let response = HealChannelResponse {
request_id: request.id,
success: true,
data: Some(format!("Task ID: {}", task_id).into_bytes()),
data: Some(format!("Task ID: {task_id}").into_bytes()),
error: None,
};
@@ -140,7 +140,7 @@ impl HealChannelProcessor {
let response = HealChannelResponse {
request_id: client_token,
success: true,
data: Some(format!("Query result for path: {}", heal_path).into_bytes()),
data: Some(format!("Query result for path: {heal_path}").into_bytes()),
error: None,
};
@@ -160,7 +160,7 @@ impl HealChannelProcessor {
let response = HealChannelResponse {
request_id: heal_path.clone(),
success: true,
data: Some(format!("Cancel request for path: {}", heal_path).into_bytes()),
data: Some(format!("Cancel request for path: {heal_path}").into_bytes()),
error: None,
};
@@ -196,9 +196,7 @@ impl HealChannelProcessor {
Some(rustfs_common::heal_channel::HealChannelScanMode::Normal) => {
rustfs_ecstore::heal::heal_commands::HEAL_NORMAL_SCAN
}
Some(rustfs_common::heal_channel::HealChannelScanMode::Deep) => {
rustfs_ecstore::heal::heal_commands::HEAL_DEEP_SCAN
}
Some(rustfs_common::heal_channel::HealChannelScanMode::Deep) => rustfs_ecstore::heal::heal_commands::HEAL_DEEP_SCAN,
None => rustfs_ecstore::heal::heal_commands::HEAL_NORMAL_SCAN,
};
@@ -210,7 +208,7 @@ impl HealChannelProcessor {
update_parity: request.update_parity.unwrap_or(true),
recursive: request.recursive.unwrap_or(false),
dry_run: request.dry_run.unwrap_or(false),
timeout: request.timeout_seconds.map(|secs| std::time::Duration::from_secs(secs)),
timeout: request.timeout_seconds.map(std::time::Duration::from_secs),
pool_index: request.pool_index,
set_index: request.set_index,
};
-2
View File
@@ -278,7 +278,6 @@ impl HealManager {
_ = interval.tick() => {
// Build list of endpoints that need healing
let mut endpoints = Vec::new();
println!("GLOBAL_LOCAL_DISK_MAP length: {:?}", GLOBAL_LOCAL_DISK_MAP.read().await.len());
for (_, disk_opt) in GLOBAL_LOCAL_DISK_MAP.read().await.iter() {
if let Some(disk) = disk_opt {
// detect unformatted disk via get_disk_id()
@@ -300,7 +299,6 @@ impl HealManager {
if endpoints.is_empty() {
continue;
}
println!("endpoints length: {:?}", endpoints.len());
for ep in endpoints {
// skip if already queued or healing