Skip to content

Commit 4a60d6a

Browse files
authored
fix: reset stream stats with limit (openobserve#6992)
1 parent f18c098 commit 4a60d6a

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

src/cli/basic/cli.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,20 @@ pub async fn cli() -> Result<bool, anyhow::Error> {
327327
// load stream list
328328
db::schema::cache().await?;
329329
// update stats from file list
330-
compact::stats::update_stats_from_file_list()
331-
.await
332-
.expect("file list remote calculate stats failed");
330+
loop {
331+
let ret = compact::stats::update_stats_from_file_list()
332+
.await
333+
.expect("file list remote calculate stats failed");
334+
let Some(offset) = ret else {
335+
break;
336+
};
337+
log::info!(
338+
"keep updating stats from file list, offset: {:?} ...",
339+
offset
340+
);
341+
tokio::time::sleep(tokio::time::Duration::from_millis(50)).await;
342+
}
343+
log::info!("update stats from file list success");
333344
}
334345
_ => {
335346
return Err(anyhow::anyhow!(

src/service/compact/stats.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ pub async fn update_stats_from_file_list() -> Result<Option<(i64, i64)>, anyhow:
5050
Some((offset, latest_pk))
5151
};
5252

53+
// there is no new data to process
54+
if offset == latest_pk {
55+
return Ok(None);
56+
}
57+
5358
// get stats from file_list
5459
let orgs = db::schema::list_organizations_from_cache().await;
5560
for org_id in orgs {

0 commit comments

Comments
 (0)