Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
Signed-off-by: Jackie Han <[email protected]>
  • Loading branch information
jackiehanyang committed Jun 11, 2024
1 parent d03ed70 commit 627a541
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,8 @@ private void getConfigsWithCustomResultIndexAlias(ActionListener<List<Config>> 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<Config>());
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 627a541

Please sign in to comment.