Skip to content

Commit b1d682f

Browse files
committed
wip: remove table meta timestamp cache
1 parent fbec09a commit b1d682f

File tree

1 file changed

+30
-41
lines changed

1 file changed

+30
-41
lines changed

src/query/service/src/sessions/query_ctx.rs

Lines changed: 30 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,48 +1531,36 @@ impl TableContext for QueryContext {
15311531
table: &dyn Table,
15321532
previous_snapshot: Option<Arc<TableSnapshot>>,
15331533
) -> Result<TableMetaTimestamps> {
1534-
let table_id = table.get_id();
1535-
let cache = self.shared.get_table_meta_timestamps();
1536-
let cached_item = cache.lock().get(&table_id).copied();
1537-
1538-
match cached_item {
1539-
Some(ts) => Ok(ts),
1540-
None => {
1541-
let delta = {
1542-
let fuse_table = FuseTable::try_from_table(table)?;
1543-
let duration = if fuse_table.is_transient() {
1544-
Duration::from_secs(0)
1545-
} else {
1546-
let settings = self.get_settings();
1547-
let max_exec_time_secs = settings.get_max_execute_time_in_seconds()?;
1548-
if max_exec_time_secs != 0 {
1549-
Duration::from_secs(max_exec_time_secs)
1550-
} else {
1551-
// no limit, use retention period as delta
1552-
// prefer table-level retention setting.
1553-
match fuse_table.get_table_retention_period() {
1554-
None => {
1555-
Duration::from_days(settings.get_data_retention_time_in_days()?)
1556-
}
1557-
Some(v) => v,
1558-
}
1559-
}
1560-
};
1534+
let delta = {
1535+
let fuse_table = FuseTable::try_from_table(table)?;
1536+
let duration = if fuse_table.is_transient() {
1537+
Duration::from_secs(0)
1538+
} else {
1539+
let settings = self.get_settings();
1540+
let max_exec_time_secs = settings.get_max_execute_time_in_seconds()?;
1541+
if max_exec_time_secs != 0 {
1542+
Duration::from_secs(max_exec_time_secs)
1543+
} else {
1544+
// no limit, use retention period as delta
1545+
// prefer table-level retention setting.
1546+
match fuse_table.get_table_retention_period() {
1547+
None => Duration::from_days(settings.get_data_retention_time_in_days()?),
1548+
Some(v) => v,
1549+
}
1550+
}
1551+
};
15611552

1562-
chrono::Duration::from_std(duration).map_err(|e| {
1563-
ErrorCode::Internal(format!(
1564-
"[QUERY-CTX] Unable to construct delta duration of table meta timestamp: {e}",
1565-
))
1566-
})?
1567-
};
1568-
let ts = self
1569-
.txn_mgr()
1570-
.lock()
1571-
.get_table_meta_timestamps(previous_snapshot, delta);
1572-
cache.lock().insert(table_id, ts);
1573-
Ok(ts)
1574-
}
1575-
}
1553+
chrono::Duration::from_std(duration).map_err(|e| {
1554+
ErrorCode::Internal(format!(
1555+
"[QUERY-CTX] Unable to construct delta duration of table meta timestamp: {e}",
1556+
))
1557+
})?
1558+
};
1559+
let ts = self
1560+
.txn_mgr()
1561+
.lock()
1562+
.get_table_meta_timestamps(previous_snapshot, delta);
1563+
Ok(ts)
15761564
}
15771565

15781566
fn clear_table_meta_timestamps_cache(&self) {
@@ -1947,3 +1935,4 @@ pub fn convert_query_log_timestamp(time: SystemTime) -> i64 {
19471935
.unwrap_or(Duration::new(0, 0))
19481936
.as_micros() as i64
19491937
}
1938+

0 commit comments

Comments
 (0)