mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-31 09:18:28 +00:00
Feature/scanner performance optimization (#498)
* Refactor: reimplement scanner Signed-off-by: RustFS Developer <dandan@rustfs.com> * comment lock Signed-off-by: junxiang Mu <1948535941@qq.com> * remove dirty file Signed-off-by: junxiang Mu <1948535941@qq.com> * Fix: fix rebase * fix(scanner): Improve error handling and logging Signed-off-by: junxiang Mu <1948535941@qq.com> --------- Signed-off-by: RustFS Developer <dandan@rustfs.com> Signed-off-by: junxiang Mu <1948535941@qq.com> Co-authored-by: RustFS Developer <dandan@rustfs.com>
This commit is contained in:
@@ -686,7 +686,14 @@ pub async fn expire_transitioned_object(
|
||||
//transitionLogIf(ctx, err);
|
||||
}
|
||||
|
||||
let dobj = api.delete_object(&oi.bucket, &oi.name, opts).await?;
|
||||
let dobj = match api.delete_object(&oi.bucket, &oi.name, opts).await {
|
||||
Ok(obj) => obj,
|
||||
Err(e) => {
|
||||
error!("Failed to delete transitioned object {}/{}: {:?}", oi.bucket, oi.name, e);
|
||||
// Return the original object info if deletion fails
|
||||
oi.clone()
|
||||
}
|
||||
};
|
||||
|
||||
//defer auditLogLifecycle(ctx, *oi, ILMExpiry, tags, traceFn)
|
||||
|
||||
@@ -947,10 +954,14 @@ pub async fn apply_expiry_on_non_transitioned_objects(
|
||||
|
||||
//debug!("lc_event.action: {:?}", lc_event.action);
|
||||
//debug!("opts: {:?}", opts);
|
||||
let mut dobj = api
|
||||
.delete_object(&oi.bucket, &encode_dir_object(&oi.name), opts)
|
||||
.await
|
||||
.unwrap();
|
||||
let mut dobj = match api.delete_object(&oi.bucket, &encode_dir_object(&oi.name), opts).await {
|
||||
Ok(obj) => obj,
|
||||
Err(e) => {
|
||||
error!("Failed to delete object {}/{}: {:?}", oi.bucket, oi.name, e);
|
||||
// Return the original object info if deletion fails
|
||||
oi.clone()
|
||||
}
|
||||
};
|
||||
//debug!("dobj: {:?}", dobj);
|
||||
if dobj.name.is_empty() {
|
||||
dobj = oi.clone();
|
||||
|
||||
@@ -439,6 +439,7 @@ impl Lifecycle for BucketLifecycleConfiguration {
|
||||
if date0.unix_timestamp() != 0
|
||||
&& (now.unix_timestamp() == 0 || now.unix_timestamp() > date0.unix_timestamp())
|
||||
{
|
||||
info!("eval_inner: expiration by date - date0={:?}", date0);
|
||||
events.push(Event {
|
||||
action: IlmAction::DeleteAction,
|
||||
rule_id: rule.id.clone().expect("err!"),
|
||||
@@ -473,7 +474,11 @@ impl Lifecycle for BucketLifecycleConfiguration {
|
||||
}*/
|
||||
events.push(event);
|
||||
}
|
||||
} else {
|
||||
info!("eval_inner: expiration.days is None");
|
||||
}
|
||||
} else {
|
||||
info!("eval_inner: rule.expiration is None");
|
||||
}
|
||||
|
||||
if obj.transition_status != TRANSITION_COMPLETE {
|
||||
@@ -619,6 +624,7 @@ impl LifecycleCalculate for Transition {
|
||||
|
||||
pub fn expected_expiry_time(mod_time: OffsetDateTime, days: i32) -> OffsetDateTime {
|
||||
if days == 0 {
|
||||
info!("expected_expiry_time: days=0, returning UNIX_EPOCH for immediate expiry");
|
||||
return OffsetDateTime::UNIX_EPOCH; // Return epoch time to ensure immediate expiry
|
||||
}
|
||||
let t = mod_time
|
||||
@@ -631,6 +637,7 @@ pub fn expected_expiry_time(mod_time: OffsetDateTime, days: i32) -> OffsetDateTi
|
||||
}
|
||||
}
|
||||
//t.Truncate(24 * hour)
|
||||
info!("expected_expiry_time: mod_time={:?}, days={}, result={:?}", mod_time, days, t);
|
||||
t
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user