Skip to content

Commit 6919dd9

Browse files
authored
Merge branch 'main' into fix-join-order
2 parents 726836d + 845dd15 commit 6919dd9

File tree

6 files changed

+2
-82
lines changed

6 files changed

+2
-82
lines changed

src/handler/http/request/status/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,6 @@ async fn get_stream_schema_status() -> (usize, usize, usize) {
505505
drop(r);
506506
let r = STREAM_SCHEMAS_LATEST.read().await;
507507
for (key, schema) in r.iter() {
508-
stream_num += 1;
509-
stream_schema_num += 1;
510508
mem_size += std::mem::size_of::<String>() + key.len();
511509
mem_size += schema.size();
512510
}

src/infra/src/file_list/mod.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,6 @@ pub trait FileList: Sync + Send + 'static {
110110
limit: i64,
111111
) -> Result<Vec<FileListDeleted>>;
112112
async fn list_deleted(&self) -> Result<Vec<FileListDeleted>>;
113-
async fn get_min_ts(
114-
&self,
115-
org_id: &str,
116-
stream_type: StreamType,
117-
stream_name: &str,
118-
) -> Result<i64>;
119113
async fn get_min_date(
120114
&self,
121115
org_id: &str,
@@ -355,11 +349,6 @@ pub async fn list_deleted() -> Result<Vec<FileListDeleted>> {
355349
CLIENT.list_deleted().await
356350
}
357351

358-
#[inline]
359-
pub async fn get_min_ts(org_id: &str, stream_type: StreamType, stream_name: &str) -> Result<i64> {
360-
CLIENT.get_min_ts(org_id, stream_type, stream_name).await
361-
}
362-
363352
#[inline]
364353
pub async fn get_min_date(
365354
org_id: &str,

src/infra/src/file_list/mysql.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -872,28 +872,6 @@ SELECT date
872872
.collect())
873873
}
874874

875-
async fn get_min_ts(
876-
&self,
877-
org_id: &str,
878-
stream_type: StreamType,
879-
stream_name: &str,
880-
) -> Result<i64> {
881-
let stream_key = format!("{org_id}/{stream_type}/{stream_name}");
882-
let min_ts = config::utils::time::BASE_TIME.timestamp_micros();
883-
let pool = CLIENT_RO.clone();
884-
DB_QUERY_NUMS
885-
.with_label_values(&["select", "file_list"])
886-
.inc();
887-
let ret: Option<i64> = sqlx::query_scalar(
888-
r#"SELECT MIN(min_ts) AS num FROM file_list WHERE stream = ? AND min_ts > ?;"#,
889-
)
890-
.bind(stream_key)
891-
.bind(min_ts)
892-
.fetch_one(&pool)
893-
.await?;
894-
Ok(ret.unwrap_or_default())
895-
}
896-
897875
async fn get_min_date(
898876
&self,
899877
org_id: &str,

src/infra/src/file_list/postgres.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -815,28 +815,6 @@ SELECT date
815815
.collect())
816816
}
817817

818-
async fn get_min_ts(
819-
&self,
820-
org_id: &str,
821-
stream_type: StreamType,
822-
stream_name: &str,
823-
) -> Result<i64> {
824-
let stream_key = format!("{org_id}/{stream_type}/{stream_name}");
825-
let min_ts = config::utils::time::BASE_TIME.timestamp_micros();
826-
let pool = CLIENT_RO.clone();
827-
DB_QUERY_NUMS
828-
.with_label_values(&["select", "file_list"])
829-
.inc();
830-
let ret: Option<i64> = sqlx::query_scalar(
831-
r#"SELECT MIN(min_ts)::BIGINT AS num FROM file_list WHERE stream = $1 AND min_ts > $2;"#,
832-
)
833-
.bind(stream_key)
834-
.bind(min_ts)
835-
.fetch_one(&pool)
836-
.await?;
837-
Ok(ret.unwrap_or_default())
838-
}
839-
840818
async fn get_min_date(
841819
&self,
842820
org_id: &str,

src/infra/src/file_list/sqlite.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -661,25 +661,6 @@ SELECT date
661661
.collect())
662662
}
663663

664-
async fn get_min_ts(
665-
&self,
666-
org_id: &str,
667-
stream_type: StreamType,
668-
stream_name: &str,
669-
) -> Result<i64> {
670-
let stream_key = format!("{org_id}/{stream_type}/{stream_name}");
671-
let min_ts = config::utils::time::BASE_TIME.timestamp_micros();
672-
let pool = CLIENT_RO.clone();
673-
let ret: Option<i64> = sqlx::query_scalar(
674-
r#"SELECT MIN(min_ts) AS num FROM file_list WHERE stream = $1 AND min_ts > $2;"#,
675-
)
676-
.bind(stream_key)
677-
.bind(min_ts)
678-
.fetch_one(&pool)
679-
.await?;
680-
Ok(ret.unwrap_or_default())
681-
}
682-
683664
async fn get_min_date(
684665
&self,
685666
org_id: &str,

src/service/compact/retention.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -430,12 +430,8 @@ pub async fn delete_by_date(
430430

431431
// update stream stats retention time
432432
let mut stats = cache::stats::get_stream_stats(org_id, stream_name, stream_type);
433-
let mut min_ts = infra_file_list::get_min_ts(org_id, stream_type, stream_name)
434-
.await
435-
.unwrap_or_default();
436-
if min_ts == 0 {
437-
min_ts = stats.doc_time_min;
438-
};
433+
// we use date_end as the new min doc time
434+
let min_ts = date_end.timestamp_micros();
439435
infra_file_list::reset_stream_stats_min_ts(
440436
org_id,
441437
format!("{org_id}/{stream_type}/{stream_name}").as_str(),

0 commit comments

Comments
 (0)