@@ -118,6 +118,7 @@ public class TableCleanup extends AbstractJooqDao implements Task {
118118 public static final DynamicLongProperty EVENT_AGE_LIMIT_SECONDS = ArchaiusUtil .getLong ("events.purge.after.seconds" );
119119 public static final DynamicLongProperty AUDIT_LOG_AGE_LIMIT_SECONDS = ArchaiusUtil .getLong ("audit_log.purge.after.seconds" );
120120 public static final DynamicLongProperty SERVICE_LOG_AGE_LIMIT_SECONDS = ArchaiusUtil .getLong ("service_log.purge.after.seconds" );
121+ public static final DynamicLongProperty MOUNT_DELETE_AGE_LIMIT_SECONDS = ArchaiusUtil .getLong ("mount_delete.purge.after.seconds" );
121122 public static final String MOUNT_DELETE_QUERY = "delete m " +
122123 " from mount as m " +
123124 " join ( " +
@@ -127,16 +128,16 @@ public class TableCleanup extends AbstractJooqDao implements Task {
127128 " join volume as v on mm.volume_id = v.id " +
128129 " where i.state = 'purged' " +
129130 " and i.removed < ? " +
130- " and (v.data like '%\" isHostPath\" :true%' or v.data like '%\" driver\" :\" local\" %')" +
131+ " and (v.data like '%% \" isHostPath\" :true%% ' or v.data like '%% \" driver\" :\" local\" % %')" +
131132 " limit ? " +
132133 " ) mx on m.id = mx.id" ;
133134 public static final String SECRET_CLEANUP_VSPM_QUERY = "delete s " +
134135 " from volume_storage_pool_map as s " +
135136 " join ( " +
136137 " select vv.id " +
137138 " from volume as vv " +
138- " where vv.data like '%\\ \" driver\\ \" :\\ \" rancher-secrets\\ \" %' " +
139- " and created < date_sub(utc_timestamp(), INTERVAL 1 HOUR ) " +
139+ " where vv.data like '%% \\ \" driver\\ \" :\\ \" rancher-secrets\\ \" % %' " +
140+ " and created < date_sub(utc_timestamp(), INTERVAL %s SECOND ) " +
140141 " and vv.state = \" inactive\" " +
141142 " and vv.instance_id is NULL " +
142143 " and id not in(" +
@@ -148,8 +149,8 @@ public class TableCleanup extends AbstractJooqDao implements Task {
148149 " from volume as v " +
149150 " join (" +
150151 " select vv.id from volume as vv " +
151- " where vv.data like '%\\ \" driver\\ \" :\\ \" rancher-secrets\\ \" %' " +
152- " and created < date_sub(utc_timestamp(), INTERVAL 1 HOUR ) and " +
152+ " where vv.data like '%% \\ \" driver\\ \" :\\ \" rancher-secrets\\ \" % %' " +
153+ " and created < date_sub(utc_timestamp(), INTERVAL %s SECOND ) and " +
153154 " vv.state = \" inactive\" and " +
154155 " vv.instance_id is NULL and " +
155156 " id not in(" +
@@ -300,7 +301,7 @@ private void cleanupLabelTables(Date cutoff) {
300301
301302 private void cleanupTableByQuery (String query , String tableKind , Date cutoff ) {
302303 log .debug ("Cleaning up {} table [cutoff={}]" , tableKind , cutoff );
303- Query q = create ().query (query , cutoff , QUERY_LIMIT_ROWS .getValue ());
304+ Query q = create ().query (String . format ( query , MOUNT_DELETE_AGE_LIMIT_SECONDS . getValue (). toString ()) , cutoff , QUERY_LIMIT_ROWS .getValue ());
304305 int rowsAffected = 0 ;
305306 int total = 0 ;
306307
0 commit comments