From 627a541ac5f7ae221c8a8aba3fba5fde3c4cc8b3 Mon Sep 17 00:00:00 2001 From: Jackie Han Date: Tue, 11 Jun 2024 11:28:29 -0700 Subject: [PATCH] test Signed-off-by: Jackie Han --- .../timeseries/indices/IndexManagement.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/opensearch/timeseries/indices/IndexManagement.java b/src/main/java/org/opensearch/timeseries/indices/IndexManagement.java index da116b8a7..4d077a016 100644 --- a/src/main/java/org/opensearch/timeseries/indices/IndexManagement.java +++ b/src/main/java/org/opensearch/timeseries/indices/IndexManagement.java @@ -800,6 +800,8 @@ private void getConfigsWithCustomResultIndexAlias(ActionListener> l .indices(new String[] { configIndex.getIndexName() }) .source(new SearchSourceBuilder().size(10000).query(boolQuery)); client.search(searchRequest, ActionListener.wrap(r -> { + System.out.println(searchRequest); + System.out.println(r); if (r == null || r.getHits().getTotalHits() == null || r.getHits().getTotalHits().value == 0) { logger.info("no config available."); listener.onResponse(new ArrayList()); @@ -1077,9 +1079,11 @@ public void onClusterManager() { // try to rollover immediately as we might be restarting the cluster rolloverAndDeleteHistoryIndex(); - // schedule the next rollover for approx MAX_AGE later scheduledRollover = threadPool - .scheduleWithFixedDelay(() -> rolloverAndDeleteHistoryIndex(), historyRolloverPeriod, executorName()); + .scheduleWithFixedDelay(() -> rolloverAndDeleteHistoryIndex(), TimeValue.timeValueMinutes(1), executorName()); + // schedule the next rollover for approx MAX_AGE later +// scheduledRollover = threadPool +// .scheduleWithFixedDelay(() -> rolloverAndDeleteHistoryIndex(), historyRolloverPeriod, executorName()); } catch (Exception e) { // This should be run on cluster startup logger.error("Error rollover result indices. " + "Can't rollover result until clusterManager node is restarted.", e); @@ -1263,7 +1267,9 @@ private void handleCustomResultIndex(Config config, IndexType resultIndex) { // add rollover conditions if found in config if (config.getCustomResultIndexMinAge() != null) { - rolloverRequest.addMaxIndexAgeCondition(TimeValue.timeValueDays(config.getCustomResultIndexMinAge())); + rolloverRequest.addMaxIndexAgeCondition(TimeValue.timeValueMinutes(1)); + +// rolloverRequest.addMaxIndexAgeCondition(TimeValue.timeValueDays(config.getCustomResultIndexMinAge())); } if (config.getCustomResultIndexMinSize() != null) { rolloverRequest.addMaxIndexSizeCondition(new ByteSizeValue(config.getCustomResultIndexMinSize(), ByteSizeUnit.MB));