-
Notifications
You must be signed in to change notification settings - Fork 428
OAK-10365: introduce mapping version in elastic index definition #1035
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
Conversation
| return getOptionalValue(definition, PROP_INDEX_MAPPING_VERSION, "1.0.0"); | ||
| } |
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.
Shouldn't the default value be a clearly invalid version, like 0.0.0? Because we will assume that 1.0.0 is a valid version, so it can create confusion in cases where the index is missing a version, we might assume wrongly that it has a version.
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.
The mapping version is internal and cannot be changed in the index definition (it's stored in a hidden property). If the index definition does not have a version, we return the base version currently set as 1.0.0.
| @Test | ||
| public void indexStoresMappingVersion() throws Exception { | ||
| IndexDefinitionBuilder builder = createIndex("a").noAsync(); | ||
| builder.indexRule("nt:base").property("a").propertyIndex(); | ||
| Tree index = setIndex(UUID.randomUUID().toString(), builder); | ||
| root.commit(); | ||
|
|
||
| assertEventually(() -> assertEquals(ElasticIndexHelper.MAPPING_VERSION, | ||
| getElasticIndexDefinition(index).getMappingVersion())); | ||
| } |
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.
It is missing a test that sets the mapping version and checks that it returns the version that we set.
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.
As in the comment above, the version is internal and cannot be configured in the index definition. In this test we just need to test the mapping version gets stored and is equal to the current mapping version (ElasticIndexHelper.MAPPING_VERSION).
No description provided.