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

Remove PROTO-serialization from IndexMetaData.Custom #32683

Closed

Conversation

imotov
Copy link
Contributor

@imotov imotov commented Aug 7, 2018

Switches IndexMetaData.Custom to standard named serialization. In
order to achieve this it also removes support for specifying custom
index metadata on create index and put template requests.

@dakrone as per our discussion

Switches IndexMetaData.Custom to standard named serialization. In
order to achieve this it also removes support for specifying custom
index metadata on create index and put template requests.
@imotov imotov added >breaking v7.0.0 :Distributed/Distributed A catch all label for anything in the Distributed Area. If you aren't sure, use this one. >refactoring v6.5.0 labels Aug 7, 2018
@imotov imotov requested a review from dakrone August 7, 2018 14:35
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

@jasontedor
Copy link
Member

In order to achieve this it also removes support for specifying custom index metadata on create index and put template requests.

This change ruins plans that we have in CCR to use the index metadata to store a UUID (either the index UUID of the leader, or hopefully the history UUID of the leader). We would do this on create and follow requests, for example. What is the motivation for this change and breaking custom index metadata in this way?

Copy link
Member

@jasontedor jasontedor left a comment

Choose a reason for hiding this comment

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

I have a concern, which I left as a top-level comment on the PR.

@jasontedor jasontedor added the :Data Management/Indices APIs APIs to create and manage indices and templates label Aug 7, 2018
@imotov
Copy link
Contributor Author

imotov commented Aug 7, 2018

@jasontedor I have removed it because I thought that it will not used as part of the templates of create index requests. Supporting custom parsing in templates creates additional complexity (for example, we need to know how to parse both Map and XContent and we parse the template in HL REST response). So, I was trying to avoid this unnecessary complexity mistakenly thinking that we are not going to have any users for it.

@jasontedor
Copy link
Member

We intend to use custom index metadata in both CCR and ILM. I would prefer that we proof out what our needs are there before we make any changes to custom index metadata. This feature was on its way out (deprecated!) but we are going to resurrect it.

@imotov
Copy link
Contributor Author

imotov commented Aug 8, 2018

I am fine with resurrecting it, I am just not OK with resurrecting it based on PROTO serialization. I left it as is when I was converting the rest of the cluster state to NamedObject serialization because it wasn't used so we marked it as deprecated instead. So, I feel responsible for finishing PROTO off :) I will see if I can migrate it without significant loss of functionality, now that I know that it is needed by more than one efforts.

@imotov imotov closed this Aug 8, 2018
imotov added a commit to imotov/elasticsearch that referenced this pull request Aug 9, 2018
Switches IndexMetaData.Custom to standard named serialization.

Supersedes elastic#32683
imotov added a commit to imotov/elasticsearch that referenced this pull request Aug 13, 2018
Currently, if geo context is represented by something other than
geo_point or an object with lat and lon fields, the parsing of it
as a geo context can result in ignoring the context altogether,
returning confusing errors such as number_format_exception or trying
to parse the number specifying as long-encoded hash code. It would also
fail if the geo_point was stored.

This commit makes the mapping parsing more strict and will fail during
mapping update or index creation if the geo context doesn't point to
a geo_point field.

Supersedes elastic#32683

Closes elastic#32202
dakrone pushed a commit that referenced this pull request Aug 30, 2018
This PR removes the deprecated `Custom` class in `IndexMetaData`, in favor
of a `Map<String, DiffableStringMap>` that is used to store custom index
metadata. As part of this, there is now no way to set this metadata in a
template or create index request (since it's only set by plugins, or dedicated
REST endpoints).

The `Map<String, DiffableStringMap>` is intended to be a namespaced `Map<String,
String>` (`DiffableStringMap` implements `Map<String, String>`, so the signature
is more like `Map<String, Map<String, String>>`). This is so we can do things
like:

``` java
Map<String, String> ccrMeta = indexMetaData.getCustom("ccr");
```

And then have complete control over the metadata. This also means any
plugin/feature that uses this has to manage its own BWC, as the map is just
serialized as a map. It also means that if metadata is put in the map that isn't
used (for instance, if a plugin were removed), it causes no failures the way
an unregistered `Setting` would.

The reason I use a custom `DiffableStringMap` here rather than a plain
`Map<String, String>` is so the map can be diffed with previous cluster state
updates for serialization.

Supersedes #32683
dakrone pushed a commit to dakrone/elasticsearch that referenced this pull request Aug 30, 2018
…32749)

This PR removes the deprecated `Custom` class in `IndexMetaData`, in favor
of a `Map<String, DiffableStringMap>` that is used to store custom index
metadata. As part of this, there is now no way to set this metadata in a
template or create index request (since it's only set by plugins, or dedicated
REST endpoints).

The `Map<String, DiffableStringMap>` is intended to be a namespaced `Map<String,
String>` (`DiffableStringMap` implements `Map<String, String>`, so the signature
is more like `Map<String, Map<String, String>>`). This is so we can do things
like:

``` java
Map<String, String> ccrMeta = indexMetaData.getCustom("ccr");
```

And then have complete control over the metadata. This also means any
plugin/feature that uses this has to manage its own BWC, as the map is just
serialized as a map. It also means that if metadata is put in the map that isn't
used (for instance, if a plugin were removed), it causes no failures the way
an unregistered `Setting` would.

The reason I use a custom `DiffableStringMap` here rather than a plain
`Map<String, String>` is so the map can be diffed with previous cluster state
updates for serialization.

Supersedes elastic#32683
@jimczi jimczi added v7.0.0-beta1 and removed v7.0.0 labels Feb 7, 2019
@imotov imotov deleted the remove-proto-from-indexmetadata-custom branch May 1, 2020 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>breaking :Data Management/Indices APIs APIs to create and manage indices and templates :Distributed/Distributed A catch all label for anything in the Distributed Area. If you aren't sure, use this one. >refactoring v6.5.0 v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants