Fix day-based table rolling time range strategy in JDBC storage. (#11915)
This commit is contained in:
parent
f021b7bdd9
commit
0f7844278a
|
|
@ -53,6 +53,7 @@
|
|||
* Fix ServiceInstance `in` query.
|
||||
* Mock `/api/v1/status/buildinfo` for PromQL API.
|
||||
* Fix table exists check in the JDBC Storage Plugin.
|
||||
* Fix day-based table rolling time range strategy in JDBC storage.
|
||||
|
||||
#### UI
|
||||
|
||||
|
|
|
|||
|
|
@ -68,12 +68,12 @@ public class CoreModuleConfig extends ModuleConfig {
|
|||
* The time to live of all metrics data. Unit is day.
|
||||
*/
|
||||
|
||||
private int metricsDataTTL = 3;
|
||||
private int metricsDataTTL = 7;
|
||||
/**
|
||||
* The time to live of all record data, including tracing. Unit is Day.
|
||||
*/
|
||||
|
||||
private int recordDataTTL = 7;
|
||||
private int recordDataTTL = 3;
|
||||
|
||||
private int gRPCThreadPoolSize;
|
||||
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ public class TableHelper {
|
|||
getConfigService().getRecordDataTTL() :
|
||||
getConfigService().getMetricsDataTTL();
|
||||
return LongStream
|
||||
.rangeClosed(0, ttl)
|
||||
.range(0, ttl)
|
||||
.mapToObj(it -> TimeBucket.getTimeBucket(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(it), DownSampling.Day))
|
||||
.distinct()
|
||||
.collect(toList());
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public class JDBCHistoryDeleteDAO implements IHistoryDeleteDAO {
|
|||
@SneakyThrows
|
||||
public void deleteHistory(Model model, String timeBucketColumnName, int ttl) {
|
||||
final var endTimeBucket = TimeBucket.getTimeBucket(clock.millis() + TimeUnit.DAYS.toMillis(1), DownSampling.Day);
|
||||
final var startTimeBucket = TimeBucket.getTimeBucket(clock.millis() - TimeUnit.DAYS.toMillis(ttl), DownSampling.Day);
|
||||
final var startTimeBucket = TimeBucket.getTimeBucket(clock.millis() - TimeUnit.DAYS.toMillis(ttl - 1), DownSampling.Day);
|
||||
log.info(
|
||||
"Deleting history data, ttl: {}, now: {}. Keep [{}, {}]",
|
||||
ttl,
|
||||
|
|
|
|||
Loading…
Reference in New Issue