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>>
84
84
) ;
85
85
86
86
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 ;
91
91
for enable_table in cfg. tables . iter ( ) {
92
+ if enable_table. table_name == "log_history" {
93
+ user_defined_log_history = true ;
94
+ }
92
95
if let Some ( predefined_table) = predefined_map. remove ( & enable_table. table_name ) {
93
96
let retention = enable_table. retention ;
94
97
history_tables. push ( Arc :: new ( HistoryTable :: create (
@@ -102,6 +105,12 @@ pub fn init_history_tables(cfg: &HistoryConfig) -> Result<Vec<Arc<HistoryTable>>
102
105
) ) ) ;
103
106
}
104
107
}
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
+ }
105
114
Ok ( history_tables)
106
115
}
107
116
You can’t perform that action at this time.
0 commit comments