File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
src/common/tracing/src/predefined_tables Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -84,11 +84,14 @@ pub fn init_history_tables(cfg: &HistoryConfig) -> Result<Vec<Arc<HistoryTable>>
8484 ) ;
8585
8686 let mut history_tables = Vec :: with_capacity ( cfg. tables . len ( ) ) ;
87- history_tables . push ( Arc :: new ( HistoryTable :: create (
88- predefined_map . remove ( " log_history" ) . unwrap ( ) ,
89- 24 * 7 ,
90- ) ) ) ;
87+ // log_history is the source table, it is always included
88+ // if user defined log_history, we will use the user defined retention
89+ // if user did not define log_history, we will use the default retention of 24*7 hours
90+ let mut user_defined_log_history = false ;
9191 for enable_table in cfg. tables . iter ( ) {
92+ if enable_table. table_name == "log_history" {
93+ user_defined_log_history = true ;
94+ }
9295 if let Some ( predefined_table) = predefined_map. remove ( & enable_table. table_name ) {
9396 let retention = enable_table. retention ;
9497 history_tables. push ( Arc :: new ( HistoryTable :: create (
@@ -102,6 +105,12 @@ pub fn init_history_tables(cfg: &HistoryConfig) -> Result<Vec<Arc<HistoryTable>>
102105 ) ) ) ;
103106 }
104107 }
108+ if !user_defined_log_history {
109+ history_tables. push ( Arc :: new ( HistoryTable :: create (
110+ predefined_map. remove ( "log_history" ) . unwrap ( ) ,
111+ 24 * 7 ,
112+ ) ) ) ;
113+ }
105114 Ok ( history_tables)
106115}
107116
You can’t perform that action at this time.
0 commit comments