-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Allow private settings when system provided #133789
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
Allow private settings when system provided #133789
Conversation
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
server/src/main/java/org/elasticsearch/cluster/metadata/MetadataCreateIndexService.java
Outdated
Show resolved
Hide resolved
|
The I'm probably missing something here.. |
|
Looks like we're skipping adding the private settings during template validation via this hack: Lines 210 to 214 in eb005b0
I'd rather have the template validation work on the actual settings than the provider behaving differently during validation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked at this and left a couple of comments (nothing of substance). I keep having a sneaking suspicion that there's a more elegant way to do this, but it might be the late-Friday-afternoon brain telling me that. I'm going to take another look at it next week.
server/src/main/java/org/elasticsearch/cluster/metadata/MetadataCreateIndexService.java
Outdated
Show resolved
Hide resolved
...n/downsample/src/main/java/org/elasticsearch/xpack/downsample/TransportDownsampleAction.java
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexTemplateService.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Lee Hinman <[email protected]>
…s-if-system-provided
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I think with this we can also remove the isTemplateValidation check in LogsdbIndexModeSettingsProvider.
I would like either Ryan or Lee to also take a look at this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I left two really tiny optional things.
server/src/main/java/org/elasticsearch/cluster/metadata/MetadataCreateIndexService.java
Outdated
Show resolved
Hide resolved
| final var combinedSettings = resolveSettings(indexTemplate, projectMetadata.componentTemplates()); | ||
| // First apply settings sourced from index setting providers: | ||
| var finalSettings = Settings.builder(); | ||
| var additionalSettingsBuilder = Settings.builder(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor suggestion (take it or leave it), perhaps call this systemSettingsBuilder and systemSettings instead of additional… since it gets passed to the validation as the system-provided settings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OTOH, it's coming from the provideAdditionalSettings method and it's being passed in to the validateAdditionalSettings method. I think it make sense as-is. The main thing to convey about these within validateIndexTemplateV2 are that these are additional settings. What's more important about these in the context of validation is that these additional settings are indeed system provided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like @dakrone I'm a bit worried that we have three different names for what appears to be the same concept:
- "additional settings"
- "system provided settings"
- settings from an
IndexSettingProvider
I think we should either use the same name everywhere, or else very clearly define the differences between these concepts.
server/src/test/java/org/elasticsearch/cluster/metadata/MetadataCreateIndexServiceTests.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/cluster/metadata/MetadataCreateIndexServiceTests.java
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/cluster/metadata/MetadataCreateIndexServiceTests.java
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/cluster/metadata/MetadataIndexTemplateServiceTests.java
Show resolved
Hide resolved
...java/org/elasticsearch/action/admin/indices/create/CreateIndexClusterStateUpdateRequest.java
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/cluster/metadata/MetadataCreateIndexService.java
Show resolved
Hide resolved
The thought process behind it was that getIndexSettingsValidationErrors(
final Settings settings,
@Nullable Settings systemProvided,
final boolean forbidPrivateIndexSettings
)to getIndexSettingsValidationErrors(
final Settings settings,
@Nullable Settings additionalSettings,
final boolean forbidPrivateIndexSettings
)to match the naming in The main concern of What do you think about calling it consistently Personally, I still like it the best as-is. But I'm definitely not married to a particular name and I'm happy to rename to something y'all feel more comfortable with. This doesn't seem like a make or break kind of decision. So let's align on something so that we can move on. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re my naming comment, I'm happy that @felixbarny has thought about it a bunch, and that simplifying the naming isn't straightforward, so let's just merge it as is.
As discussed in #132566, we'd like to provide private index settings with an
IndexSettingsProvider. This is currently not possible because it fails validation for composable index templates (template v2). That's because we first merge all settings from the index template with the ones from theIndexSettingsProvidersand then check whether there are private settings.I've added a way so pass down the settings provided by the
IndexSettingsProvidersto the validation so that these system-provided settings are allowed to contain private settings.Another area that needs to be enhanced is to allow downsampling to create indices containing private settings that are copied from the source index. For that reason, I've added a
settingsSystemProvidedflag toCreateIndexClusterStateUpdateRequest.