github.com/matrixorigin/matrixone@v1.2.0/test/distributed/cases/function/func_purge_log.sql (about) 1 -- prepare 2 drop account if exists bvt_purge_log; 3 create account bvt_purge_log admin_name 'admin' identified by '111'; 4 5 -- check not support 6 -- @session:id=2&user=bvt_purge_log:admin&password=111 7 select purge_log('rawlog', '2023-06-30') a; 8 -- @session 9 10 -- check valid args 11 select purge_log('rawlog', '2023-06-30') a; 12 select purge_log('statement_info', '2023-06-30') a; 13 select purge_log('metric', '2023-06-30') a; 14 select purge_log('rawlog,statement_info,metric', '2023-06-30') a; 15 16 -- check invalid args 17 select purge_log('rawlog_not_exist', '2023-06-30') a; 18 select purge_log('rawlog_not_exist', '123') a; 19 20 -- check null arg 21 select purge_log('rawlog_not_exist', NULL) a; 22 select purge_log(NULL, '2023-06-30') a; 23 select purge_log(NULL, NULL) a; 24 25 -- case for issue 10421, 15,455 26 -- case for issue 15,455 - ETLMerge casse 27 set @ts=(select max(collecttime) from system_metrics.metric); 28 set @metric_name=(select metric_name from system_metrics.metric where collecttime between @ts and date_add(@ts, interval 1 second) limit 1); 29 set @node=(select node from system_metrics.metric where collecttime between @ts and date_add(@ts, interval 1 second) and metric_name=@metric_name limit 1); 30 select purge_log('statement_info,metric', DATE_ADD( @ts, interval 1 day)) a; 31 -- @ignore:1,2,3 32 select count(1) cnt, @ts, @metric_name, @node from system_metrics.metric where collecttime between @ts and date_add(@ts, interval 1 second) and metric_name=@metric_name and node=@node; 33 34 -- clean 35 drop account if exists bvt_purge_log;