Skip to content

Commit

Permalink
x-pack/plugin/core: make automatic rollovers lazy
Browse files Browse the repository at this point in the history
Apply automatic rollovers lazily, upon the next write,
to avoid unnecessary empty backing indices.
See elastic#89346
  • Loading branch information
axw committed Jan 22, 2024
1 parent 0bb87db commit 0678f08
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,7 @@ public void onFailure(Exception e) {
templateName
);
RolloverRequest request = new RolloverRequest(rolloverTarget, null);
request.lazy(true);
request.masterNodeTimeout(TimeValue.timeValueMinutes(1));
executeAsyncWithOrigin(
client.threadPool().getThreadContext(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ public void testAutomaticRollover() throws Exception {
rolloverCounter.incrementAndGet();
RolloverRequest rolloverRequest = ((RolloverRequest) request);
assertThat(rolloverRequest.getRolloverTarget(), startsWith("logs-my_app-"));
assertThat(rolloverRequest.isLazy(), equalTo(true));
} else if (action == TransportPutComposableIndexTemplateAction.TYPE) {
putIndexTemplateCounter.incrementAndGet();
}
Expand Down

0 comments on commit 0678f08

Please sign in to comment.