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 {
354354pub struct HistoryTableConfig {
355355 pub table_name : String ,
356356 pub retention : usize ,
357+ pub invisible : bool ,
357358}
358359
359360impl Display for HistoryConfig {
@@ -399,6 +400,16 @@ impl Default for HistoryTableConfig {
399400 Self {
400401 table_name : "" . to_string ( ) ,
401402 retention : 168 ,
403+ invisible : false ,
402404 }
403405 }
404406}
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 {
28162816 /// The retention period (in hours) for history logs.
28172817 /// Data older than this period will be deleted during retention tasks.
28182818 pub retention : usize ,
2819+
2820+ /// Whether this history table is invisible for querying.
2821+ /// Default is false.
2822+ pub invisible : bool ,
28192823}
28202824
28212825impl Default for HistoryLogConfig {
@@ -2837,6 +2841,7 @@ impl TryInto<InnerHistoryTableConfig> for HistoryLogTableConfig {
28372841 Ok ( InnerHistoryTableConfig {
28382842 table_name : self . table_name ,
28392843 retention : self . retention ,
2844+ invisible : self . invisible ,
28402845 } )
28412846 }
28422847}
@@ -2846,6 +2851,7 @@ impl From<InnerHistoryTableConfig> for HistoryLogTableConfig {
28462851 Self {
28472852 table_name : inner. table_name ,
28482853 retention : inner. retention ,
2854+ invisible : inner. invisible ,
28492855 }
28502856 }
28512857}
Original file line number Diff line number Diff line change @@ -131,8 +131,14 @@ pub async fn should_reset(
131131 if let Some ( c) = connection {
132132 let uri = format ! ( "{}{}/" , c. uri, "log_history" ) ;
133133 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 ?;
136142
137143 // External1 -> External2
138144 // return error to prevent cyclic conversion
Original file line number Diff line number Diff line change @@ -1190,6 +1190,13 @@ impl TableContext for QueryContext {
11901190 self . get_settings ( ) . get_enterprise_license ( ) ,
11911191 Feature :: SystemHistory ,
11921192 ) ?;
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+ }
11931200 }
11941201
11951202 let batch_size = self . get_settings ( ) . get_stream_consume_batch_size_hint ( ) ?;
You can’t perform that action at this time.
0 commit comments