Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce lazy rollover for mapping updates in data streams #103309

Merged
merged 42 commits into from
Jan 8, 2024

Conversation

gmarouli
Copy link
Contributor

@gmarouli gmarouli commented Dec 12, 2023

Currently, we recommend an unconditional rollover to apply mapping changes to data streams. However, as described in #89346, this can result in many empty backing indices.

In this PR we implement the idea to introduce a flag, that a data stream needs to be rolloved over before the next document is indexed.

The work is split into the following components:

Relates to #89346

@gmarouli gmarouli added >enhancement :Data Management/Data streams Data streams and their lifecycles labels Dec 12, 2023
@elasticsearchmachine elasticsearchmachine added v8.13.0 Team:Data Management Meta label for data/management team labels Dec 12, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

@elasticsearchmachine
Copy link
Collaborator

Hi @gmarouli, I've created a changelog YAML for you.

@gmarouli gmarouli marked this pull request as draft December 12, 2023 11:51
@gmarouli gmarouli requested a review from dakrone December 12, 2023 13:26
@gmarouli
Copy link
Contributor Author

@elasticmachine update branch

@gmarouli gmarouli marked this pull request as ready for review December 13, 2023 11:01
@elasticsearchmachine
Copy link
Collaborator

Hi @gmarouli, I've updated the changelog YAML for you.

Comment on lines 988 to 989
DataStream.isFailureStoreEnabled() && args[11] != null && (boolean) args[11],
DataStream.isFailureStoreEnabled() && args[12] != null ? (List<Index>) args[12] : List.of(),
Copy link
Contributor Author

@gmarouli gmarouli Dec 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fields behind feature flags need to be parsed last to ensure that the parser will not fail when the feature flag is disabled.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add that as a comment, since once the feature flags are removed it'll just look weird and out of order

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or potentially we could pull them out into temporary variables so the order can be changed at whim (either way it's a super minor thing, so no pressure)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if I got correctly what you had in mind :).

@elasticsearchmachine
Copy link
Collaborator

Hi @gmarouli, I've updated the changelog YAML for you.

Copy link
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks great so far! I left a few minor comments

docs/reference/indices/rollover-index.asciidoc Outdated Show resolved Hide resolved
Comment on lines 988 to 989
DataStream.isFailureStoreEnabled() && args[11] != null && (boolean) args[11],
DataStream.isFailureStoreEnabled() && args[12] != null ? (List<Index>) args[12] : List.of(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add that as a comment, since once the feature flags are removed it'll just look weird and out of order

Comment on lines 988 to 989
DataStream.isFailureStoreEnabled() && args[11] != null && (boolean) args[11],
DataStream.isFailureStoreEnabled() && args[12] != null ? (List<Index>) args[12] : List.of(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or potentially we could pull them out into temporary variables so the order can be changed at whim (either way it's a super minor thing, so no pressure)

Copy link
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I was playing around with this, and it appears that I can crash ES with the following:

$ ./gradlew run

Then:

POST /logs-bar-bag/_doc
{"@timestamp": "2023-06-01", "message": "my message"}

POST /logs-bar-bag/_rollover?dry_run&lazy
{
  "conditions": {
    "max_docs": 1
  }
}

Which then crashes with:

[2023-12-21T11:29:02,769][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [runTask-0] fatal error in thread [elasticsearch[runTask-0][management][T#3]], exiting java.lang.AssertionError: org.elasticsearch.ElasticsearchException: org.elasticsearch.action.ActionListenerImplementations$RunBeforeActionListener/org.elasticsearch.action.ActionListenerImplementations$MappedActionListener/org.elasticsearch.action.support.ContextPreservingActionListener/org.elasticsearch.tasks.TaskManager$1{org.elasticsearch.rest.action.RestCancellableNodeClient$1@69e12f1c}{Task{id=219, type='transport', action='indices:admin/rollover', description='', parentTask=unset, startTime=1703183342758, startTimeNanos=106715515529625}}/org.elasticsearch.xpack.security.action.filter.SecurityActionFilter$$Lambda$7006/0x0000000801c2ef98@7b5bf01d/org.elasticsearch.action.support.master.TransportMasterNodeAction$$Lambda$7208/0x0000000801ca50a0@7e331720
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListener$3.assertFirstRun(ActionListener.java:305)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListener$3.onResponse(ActionListener.java:310)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListenerImplementations$DelegatingResponseActionListener.onResponse(ActionListenerImplementations.java:182)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.admin.indices.rollover.TransportRolloverAction.lambda$masterOperation$1(TransportRolloverAction.java:215)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListenerImplementations$ResponseWrappingActionListener.onResponse(ActionListenerImplementations.java:236)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListener$3.onResponse(ActionListener.java:312)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.tasks.TaskManager$1.onResponse(TaskManager.java:202)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.tasks.TaskManager$1.onResponse(TaskManager.java:196)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.ContextPreservingActionListener.onResponse(ContextPreservingActionListener.java:32)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListenerImplementations$MappedActionListener.onResponse(ActionListenerImplementations.java:95)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.SubscribableListener$SuccessResult.complete(SubscribableListener.java:308)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.SubscribableListener.tryComplete(SubscribableListener.java:228)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.SubscribableListener.addListener(SubscribableListener.java:131)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.SubscribableListener.addListener(SubscribableListener.java:107)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.CancellableFanOut$SubtasksCompletionHandler.run(CancellableFanOut.java:201)
	at org.elasticsearch.base@8.13.0-SNAPSHOT/org.elasticsearch.core.AbstractRefCounted$1.closeInternal(AbstractRefCounted.java:118)
	at org.elasticsearch.base@8.13.0-SNAPSHOT/org.elasticsearch.core.AbstractRefCounted.decRef(AbstractRefCounted.java:70)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.RefCountingRunnable.close(RefCountingRunnable.java:112)
	at org.elasticsearch.base@8.13.0-SNAPSHOT/org.elasticsearch.core.Releasables$3.close(Releasables.java:142)
	at org.elasticsearch.base@8.13.0-SNAPSHOT/org.elasticsearch.core.IOUtils.close(IOUtils.java:71)
	at org.elasticsearch.base@8.13.0-SNAPSHOT/org.elasticsearch.core.Releasables.close(Releasables.java:33)
	at org.elasticsearch.base@8.13.0-SNAPSHOT/org.elasticsearch.core.Releasables.closeExpectNoException(Releasables.java:57)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListenerImplementations$2.run(ActionListenerImplementations.java:49)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListenerImplementations$RunAfterActionListener.onResponse(ActionListenerImplementations.java:262)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListener$3.onResponse(ActionListener.java:312)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListenerResponseHandler.handleResponse(ActionListenerResponseHandler.java:49)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.transport.TransportService$UnregisterChildTransportResponseHandler.handleResponse(TransportService.java:1709)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleResponse(TransportService.java:1425)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.transport.TransportService$DirectResponseChannel.processResponse(TransportService.java:1524)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.transport.TransportService$DirectResponseChannel$1.doRun(TransportService.java:1501)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:983)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.elasticsearch.ElasticsearchException: org.elasticsearch.action.ActionListenerImplementations$RunBeforeActionListener/org.elasticsearch.action.ActionListenerImplementations$MappedActionListener/org.elasticsearch.action.support.ContextPreservingActionListener/org.elasticsearch.tasks.TaskManager$1{org.elasticsearch.rest.action.RestCancellableNodeClient$1@69e12f1c}{Task{id=219, type='transport', action='indices:admin/rollover', description='', parentTask=unset, startTime=1703183342758, startTimeNanos=106715515529625}}/org.elasticsearch.xpack.security.action.filter.SecurityActionFilter$$Lambda$7006/0x0000000801c2ef98@7b5bf01d/org.elasticsearch.action.support.master.TransportMasterNodeAction$$Lambda$7208/0x0000000801ca50a0@7e331720
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListener$3.assertFirstRun(ActionListener.java:304)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListener$3.onFailure(ActionListener.java:321)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.master.TransportMasterNodeAction$AsyncSingleAction.lambda$doStart$2(TransportMasterNodeAction.java:233)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListenerImplementations$DelegatingResponseActionListener.acceptException(ActionListenerImplementations.java:186)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListenerImplementations.safeAcceptException(ActionListenerImplementations.java:62)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListenerImplementations$DelegatingResponseActionListener.onFailure(ActionListenerImplementations.java:191)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.admin.indices.rollover.TransportRolloverAction.masterOperation(TransportRolloverAction.java:155)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.admin.indices.rollover.TransportRolloverAction.masterOperation(TransportRolloverAction.java:65)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.master.TransportMasterNodeAction.executeMasterOperation(TransportMasterNodeAction.java:125)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.master.TransportMasterNodeAction$AsyncSingleAction.lambda$doStart$3(TransportMasterNodeAction.java:236)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionRunnable$4.doRun(ActionRunnable.java:95)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.common.util.concurrent.EsExecutors$DirectExecutorService.execute(EsExecutors.java:238)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.master.TransportMasterNodeAction$AsyncSingleAction.doStart(TransportMasterNodeAction.java:236)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.master.TransportMasterNodeAction.doExecute(TransportMasterNodeAction.java:173)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.master.TransportMasterNodeAction.doExecute(TransportMasterNodeAction.java:55)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:87)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.ActionFilter$Simple.apply(ActionFilter.java:53)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:85)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.action.filter.SecurityActionFilter.lambda$applyInternal$3(SecurityActionFilter.java:165)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListenerImplementations$DelegatingFailureActionListener.onResponse(ActionListenerImplementations.java:212)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService$1.onResponse(AuthorizationService.java:628)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService$1.onResponse(AuthorizationService.java:622)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.interceptor.FieldAndDocumentLevelSecurityRequestInterceptor.intercept(FieldAndDocumentLevelSecurityRequestInterceptor.java:79)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.interceptor.SearchRequestInterceptor.intercept(SearchRequestInterceptor.java:21)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService$1.onResponse(AuthorizationService.java:626)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService$1.onResponse(AuthorizationService.java:622)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.interceptor.BulkShardRequestInterceptor.intercept(BulkShardRequestInterceptor.java:85)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService$1.onResponse(AuthorizationService.java:626)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService$1.onResponse(AuthorizationService.java:622)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.interceptor.ResizeRequestInterceptor.intercept(ResizeRequestInterceptor.java:98)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService$1.onResponse(AuthorizationService.java:626)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService$1.onResponse(AuthorizationService.java:622)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.interceptor.FieldAndDocumentLevelSecurityRequestInterceptor.intercept(FieldAndDocumentLevelSecurityRequestInterceptor.java:79)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.interceptor.ShardSearchRequestInterceptor.intercept(ShardSearchRequestInterceptor.java:24)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService$1.onResponse(AuthorizationService.java:626)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService$1.onResponse(AuthorizationService.java:622)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.interceptor.IndicesAliasesRequestInterceptor.intercept(IndicesAliasesRequestInterceptor.java:124)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService$1.onResponse(AuthorizationService.java:626)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService$1.onResponse(AuthorizationService.java:622)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.interceptor.DlsFlsLicenseRequestInterceptor.intercept(DlsFlsLicenseRequestInterceptor.java:106)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService$1.onResponse(AuthorizationService.java:626)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService$1.onResponse(AuthorizationService.java:622)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.interceptor.FieldAndDocumentLevelSecurityRequestInterceptor.intercept(FieldAndDocumentLevelSecurityRequestInterceptor.java:79)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.interceptor.UpdateRequestInterceptor.intercept(UpdateRequestInterceptor.java:27)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService$1.onResponse(AuthorizationService.java:626)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService$1.onResponse(AuthorizationService.java:622)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.interceptor.SearchRequestCacheDisablingInterceptor.intercept(SearchRequestCacheDisablingInterceptor.java:53)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService.runRequestInterceptors(AuthorizationService.java:622)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService.handleIndexActionAuthorizationResult(AuthorizationService.java:607)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService.lambda$authorizeAction$13(AuthorizationService.java:505)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService$AuthorizationResultListener.onResponse(AuthorizationService.java:1033)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService$AuthorizationResultListener.onResponse(AuthorizationService.java:999)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.ContextPreservingActionListener.onResponse(ContextPreservingActionListener.java:32)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.RBACEngine.lambda$authorizeIndexAction$3(RBACEngine.java:401)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListenerImplementations$ResponseWrappingActionListener.onResponse(ActionListenerImplementations.java:236)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.SubscribableListener$SuccessResult.complete(SubscribableListener.java:308)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.SubscribableListener.tryComplete(SubscribableListener.java:228)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.SubscribableListener.addListener(SubscribableListener.java:131)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.SubscribableListener.addListener(SubscribableListener.java:107)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService$CachingAsyncSupplier.getAsync(AuthorizationService.java:1079)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.RBACEngine.authorizeIndexAction(RBACEngine.java:381)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService.authorizeAction(AuthorizationService.java:498)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService.maybeAuthorizeRunAs(AuthorizationService.java:435)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService.lambda$authorize$3(AuthorizationService.java:322)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListener$2.onResponse(ActionListener.java:169)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.ContextPreservingActionListener.onResponse(ContextPreservingActionListener.java:32)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.RBACEngine.lambda$resolveAuthorizationInfo$0(RBACEngine.java:151)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListenerImplementations$ResponseWrappingActionListener.onResponse(ActionListenerImplementations.java:236)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.store.CompositeRolesStore.lambda$getRoles$4(CompositeRolesStore.java:193)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListenerImplementations$ResponseWrappingActionListener.onResponse(ActionListenerImplementations.java:236)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.store.CompositeRolesStore.lambda$getRole$5(CompositeRolesStore.java:211)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListenerImplementations$ResponseWrappingActionListener.onResponse(ActionListenerImplementations.java:236)
	at org.elasticsearch.xcore@8.13.0-SNAPSHOT/org.elasticsearch.xpack.core.security.authz.store.RoleReferenceIntersection.lambda$buildRole$0(RoleReferenceIntersection.java:49)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListenerImplementations$ResponseWrappingActionListener.onResponse(ActionListenerImplementations.java:236)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.GroupedActionListener.onResponse(GroupedActionListener.java:56)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.store.CompositeRolesStore.buildRoleFromRoleReference(CompositeRolesStore.java:243)
	at org.elasticsearch.xcore@8.13.0-SNAPSHOT/org.elasticsearch.xpack.core.security.authz.store.RoleReferenceIntersection.lambda$buildRole$1(RoleReferenceIntersection.java:53)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at org.elasticsearch.xcore@8.13.0-SNAPSHOT/org.elasticsearch.xpack.core.security.authz.store.RoleReferenceIntersection.buildRole(RoleReferenceIntersection.java:53)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.store.CompositeRolesStore.getRole(CompositeRolesStore.java:209)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.store.CompositeRolesStore.getRoles(CompositeRolesStore.java:186)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.RBACEngine.resolveAuthorizationInfo(RBACEngine.java:147)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authz.AuthorizationService.authorize(AuthorizationService.java:338)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.action.filter.SecurityActionFilter.lambda$applyInternal$4(SecurityActionFilter.java:161)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListenerImplementations$ResponseWrappingActionListener.onResponse(ActionListenerImplementations.java:236)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListenerImplementations$MappedActionListener.onResponse(ActionListenerImplementations.java:95)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authc.AuthenticatorChain.authenticate(AuthenticatorChain.java:93)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authc.AuthenticationService.authenticate(AuthenticationService.java:262)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authc.AuthenticationService.authenticate(AuthenticationService.java:171)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.action.filter.SecurityActionFilter.applyInternal(SecurityActionFilter.java:157)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.action.filter.SecurityActionFilter.apply(SecurityActionFilter.java:114)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:85)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:62)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.tasks.TaskManager.registerAndExecute(TaskManager.java:196)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.client.internal.node.NodeClient.executeLocally(NodeClient.java:108)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.rest.action.RestCancellableNodeClient.doExecute(RestCancellableNodeClient.java:81)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.client.internal.support.AbstractClient.execute(AbstractClient.java:373)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.client.internal.support.AbstractClient$IndicesAdmin.execute(AbstractClient.java:1129)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.client.internal.support.AbstractClient$IndicesAdmin.rolloverIndex(AbstractClient.java:1534)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.rest.action.admin.indices.RestRolloverIndexAction.lambda$prepareRequest$1(RestRolloverIndexAction.java:58)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.rest.BaseRestHandler.handleRequest(BaseRestHandler.java:103)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.rest.SecurityRestFilter.doHandleRequest(SecurityRestFilter.java:94)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.rest.SecurityRestFilter.lambda$handleRequest$0(SecurityRestFilter.java:85)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListener$2.onResponse(ActionListener.java:169)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authc.support.SecondaryAuthenticator.lambda$authenticateAndAttachToContext$3(SecondaryAuthenticator.java:99)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.action.ActionListenerImplementations$ResponseWrappingActionListener.onResponse(ActionListenerImplementations.java:236)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authc.support.SecondaryAuthenticator.authenticate(SecondaryAuthenticator.java:109)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.authc.support.SecondaryAuthenticator.authenticateAndAttachToContext(SecondaryAuthenticator.java:90)
	at org.elasticsearch.security@8.13.0-SNAPSHOT/org.elasticsearch.xpack.security.rest.SecurityRestFilter.handleRequest(SecurityRestFilter.java:79)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.rest.RestController.dispatchRequest(RestController.java:441)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.rest.RestController.tryAllHandlers(RestController.java:570)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.rest.RestController.dispatchRequest(RestController.java:325)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.http.AbstractHttpServerTransport.dispatchRequest(AbstractHttpServerTransport.java:458)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.http.AbstractHttpServerTransport.handleIncomingRequest(AbstractHttpServerTransport.java:554)
	at org.elasticsearch.server@8.13.0-SNAPSHOT/org.elasticsearch.http.AbstractHttpServerTransport.incomingRequest(AbstractHttpServerTransport.java:431)
	at org.elasticsearch.transport.netty4@8.13.0-SNAPSHOT/org.elasticsearch.http.netty4.Netty4HttpPipeliningHandler.handlePipelinedRequest(Netty4HttpPipeliningHandler.java:128)
	at org.elasticsearch.transport.netty4@8.13.0-SNAPSHOT/org.elasticsearch.http.netty4.Netty4HttpPipeliningHandler.channelRead(Netty4HttpPipeliningHandler.java:118)
	at io.netty.transport@4.1.94.Final/io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
	at io.netty.transport@4.1.94.Final/io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.netty.transport@4.1.94.Final/io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
	at io.netty.codec@4.1.94.Final/io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
	at io.netty.codec@4.1.94.Final/io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111)
	at io.netty.transport@4.1.94.Final/io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
	at io.netty.transport@4.1.94.Final/io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.netty.transport@4.1.94.Final/io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
	at io.netty.codec@4.1.94.Final/io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
	at io.netty.transport@4.1.94.Final/io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
	at io.netty.transport@4.1.94.Final/io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.netty.transport@4.1.94.Final/io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
	at io.netty.codec@4.1.94.Final/io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
	at io.netty.transport@4.1.94.Final/io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
	at io.netty.transport@4.1.94.Final/io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.netty.transport@4.1.94.Final/io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
	at org.elasticsearch.transport.netty4@8.13.0-SNAPSHOT/org.elasticsearch.http.netty4.Netty4HttpHeaderValidator.forwardData(Netty4HttpHeaderValidator.java:194)
	at org.elasticsearch.transport.netty4@8.13.0-SNAPSHOT/org.elasticsearch.http.netty4.Netty4HttpHeaderValidator.forwardFullRequest(Netty4HttpHeaderValidator.java:137)
	at org.elasticsearch.transport.netty4@8.13.0-SNAPSHOT/org.elasticsearch.http.netty4.Netty4HttpHeaderValidator.lambda$requestStart$1(Netty4HttpHeaderValidator.java:120)
	at io.netty.common@4.1.94.Final/io.netty.util.concurrent.PromiseTask.runTask(PromiseTask.java:98)
	at io.netty.common@4.1.94.Final/io.netty.util.concurrent.PromiseTask.run(PromiseTask.java:106)
	at io.netty.common@4.1.94.Final/io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
	at io.netty.common@4.1.94.Final/io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)
	at io.netty.common@4.1.94.Final/io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
	at io.netty.transport@4.1.94.Final/io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:566)
	at io.netty.common@4.1.94.Final/io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
	at io.netty.common@4.1.94.Final/io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	... 1 more

@gmarouli
Copy link
Contributor Author

@dakrone great catch! I missed a return statement :face_palm:. It only crashes when es is running with $ ./gradlew run, I will use this more from now on.

@gmarouli gmarouli requested a review from dakrone December 22, 2023 10:16
@gmarouli
Copy link
Contributor Author

Missing something like this indicated that there were some tests missing. I added 2 more tests, one of them would have caught this.

@gmarouli
Copy link
Contributor Author

gmarouli commented Jan 2, 2024

@elasticmachine update branch

@gmarouli
Copy link
Contributor Author

gmarouli commented Jan 5, 2024

@elasticmachine update branch

Copy link
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thanks Mary! I left two super minor comments. Thanks for breaking this up into separate pieces so it was easier to review also.

@@ -175,6 +219,36 @@ static ClusterState updateDataLifecycle(
return ClusterState.builder(currentState).metadata(builder.build()).build();
}

/**
* Creates an updated cluster state in which the requested data stream has the flag 'rollover_on_write' set to true.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The flag is passed in, so it's not necessarily always set to true, can you update this javadoc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Fixed

gmarouli and others added 3 commits January 8, 2024 10:12
Co-authored-by: Lee Hinman <dakrone@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/Data streams Data streams and their lifecycles >enhancement Team:Data Management Meta label for data/management team v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants