File tree Expand file tree Collapse file tree 4 files changed +32
-2
lines changed Expand file tree Collapse file tree 4 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -354,6 +354,7 @@ pub struct HistoryConfig {
354
354
pub struct HistoryTableConfig {
355
355
pub table_name : String ,
356
356
pub retention : usize ,
357
+ pub invisible : bool ,
357
358
}
358
359
359
360
impl Display for HistoryConfig {
@@ -399,6 +400,16 @@ impl Default for HistoryTableConfig {
399
400
Self {
400
401
table_name : "" . to_string ( ) ,
401
402
retention : 168 ,
403
+ invisible : false ,
402
404
}
403
405
}
404
406
}
407
+
408
+ impl HistoryConfig {
409
+ pub fn is_invisible ( & self , table_name : & str ) -> bool {
410
+ self . tables
411
+ . iter ( )
412
+ . find ( |table| table. table_name . eq_ignore_ascii_case ( table_name) )
413
+ . is_some_and ( |table| table. invisible )
414
+ }
415
+ }
Original file line number Diff line number Diff line change @@ -2816,6 +2816,10 @@ pub struct HistoryLogTableConfig {
2816
2816
/// The retention period (in hours) for history logs.
2817
2817
/// Data older than this period will be deleted during retention tasks.
2818
2818
pub retention : usize ,
2819
+
2820
+ /// Whether this history table is invisible for querying.
2821
+ /// Default is false.
2822
+ pub invisible : bool ,
2819
2823
}
2820
2824
2821
2825
impl Default for HistoryLogConfig {
@@ -2837,6 +2841,7 @@ impl TryInto<InnerHistoryTableConfig> for HistoryLogTableConfig {
2837
2841
Ok ( InnerHistoryTableConfig {
2838
2842
table_name : self . table_name ,
2839
2843
retention : self . retention ,
2844
+ invisible : self . invisible ,
2840
2845
} )
2841
2846
}
2842
2847
}
@@ -2846,6 +2851,7 @@ impl From<InnerHistoryTableConfig> for HistoryLogTableConfig {
2846
2851
Self {
2847
2852
table_name : inner. table_name ,
2848
2853
retention : inner. retention ,
2854
+ invisible : inner. invisible ,
2849
2855
}
2850
2856
}
2851
2857
}
Original file line number Diff line number Diff line change @@ -131,8 +131,14 @@ pub async fn should_reset(
131
131
if let Some ( c) = connection {
132
132
let uri = format ! ( "{}{}/" , c. uri, "log_history" ) ;
133
133
let mut uri_location = UriLocation :: from_uri ( uri, c. params . clone ( ) ) ?;
134
- let ( new_storage_params, _) =
135
- parse_uri_location ( & mut uri_location, Some ( context. as_ref ( ) ) ) . await ?;
134
+ let mut payload = ThreadTracker :: new_tracking_payload ( ) ;
135
+ payload. capture_log_settings = Some ( CaptureLogSettings :: capture_off ( ) ) ;
136
+ let _guard = ThreadTracker :: tracking ( payload) ;
137
+ let ( new_storage_params, _) = ThreadTracker :: tracking_future ( parse_uri_location (
138
+ & mut uri_location,
139
+ Some ( context. as_ref ( ) ) ,
140
+ ) )
141
+ . await ?;
136
142
137
143
// External1 -> External2
138
144
// return error to prevent cyclic conversion
Original file line number Diff line number Diff line change @@ -1190,6 +1190,13 @@ impl TableContext for QueryContext {
1190
1190
self . get_settings ( ) . get_enterprise_license ( ) ,
1191
1191
Feature :: SystemHistory ,
1192
1192
) ?;
1193
+
1194
+ if GlobalConfig :: instance ( ) . log . history . is_invisible ( table) {
1195
+ return Err ( ErrorCode :: InvalidArgument ( format ! (
1196
+ "history table `{}` is configured as invisible" ,
1197
+ table
1198
+ ) ) ) ;
1199
+ }
1193
1200
}
1194
1201
1195
1202
let batch_size = self . get_settings ( ) . get_stream_consume_batch_size_hint ( ) ?;
You can’t perform that action at this time.
0 commit comments