Fix caching for PreConfiguredTokenFilter#50912
Conversation
The `PreConfiguredTokenFilter#singletonWithVersion` uses the version internaly for the token filter factories but it registers only one instance in the cahce and not one instance per version. This can lead to exceptions like the one described in elastic#50734 since the version created of the first index creates and caches the singleton. Remove the `singletonWithVersion()` methods and use the `elasticsearchVersion()` methods instead. Fixes: elastic#50734
|
Pinging @elastic/es-search (:Search/Analysis) |
| assertSame(tff_v1_1, tff_v1_2); | ||
|
|
||
|
|
||
| Version version2 = Version.V_7_2_1; |
There was a problem hiding this comment.
Any idea to use something like this: https://github.com/elastic/elasticsearch/pull/50912/files#diff-5a875cd5f076862a2984f3815807fc6aR95 but get a different random Version where the Lucene Version is also different?
There was a problem hiding this comment.
I think VersionUtils.getFirstVersion() will always return a version with a different lucene version to Version.CURRENT?
There was a problem hiding this comment.
Probably it would work, but there is no actual guarantee that the first released version (that's what getFirstVersion() does) has a different Lucene version.
romseygeek
left a comment
There was a problem hiding this comment.
LGTM, thanks @matriv!
| assertSame(tff_v1_1, tff_v1_2); | ||
|
|
||
|
|
||
| Version version2 = Version.V_7_2_1; |
There was a problem hiding this comment.
I think VersionUtils.getFirstVersion() will always return a version with a different lucene version to Version.CURRENT?
|
@elasticmachine run elasticsearch-ci/default-distro |
The PreConfiguredTokenFilter#singletonWithVersion uses the version internaly for the token filter factories but it registers only one instance in the cahce and not one instance per version. This can lead to exceptions like the one described in elastic#50734 since the singleton is created and cached using the version created of the first index that is processed. Remove the singletonWithVersion() methods and use the elasticsearchVersion() methods instead. Fixes: elastic#50734 (cherry picked from commit 24e1858)
The PreConfiguredTokenFilter#singletonWithVersion uses the version internaly for the token filter factories but it registers only one instance in the cahce and not one instance per version. This can lead to exceptions like the one described in elastic#50734 since the singleton is created and cached using the version created of the first index that is processed. Remove the singletonWithVersion() methods and use the elasticsearchVersion() methods instead. Fixes: elastic#50734 (cherry picked from commit 24e1858)
The PreConfiguredTokenFilter#singletonWithVersion uses the version internaly for the token filter factories but it registers only one instance in the cahce and not one instance per version. This can lead to exceptions like the one described in elastic#50734 since the singleton is created and cached using the version created of the first index that is processed. Remove the singletonWithVersion() methods and use the elasticsearchVersion() methods instead. Fixes: elastic#50734 (cherry picked from commit 24e1858)
The PreConfiguredTokenFilter#singletonWithVersion uses the version internally for the token filter factories but it registers only one instance in the cache and not one instance per version. This can lead to exceptions like the one described in #50734 since the singleton is created and cached using the version created of the first index that is processed. Remove the singletonWithVersion() methods and use the elasticsearchVersion() methods instead. Fixes: #50734 (cherry picked from commit 24e1858)
The PreConfiguredTokenFilter#singletonWithVersion uses the version internally for the token filter factories but it registers only one instance in the cache and not one instance per version. This can lead to exceptions like the one described in #50734 since the singleton is created and cached using the version created of the first index that is processed. Remove the singletonWithVersion() methods and use the elasticsearchVersion() methods instead. Fixes: #50734 (cherry picked from commit 24e1858)
The PreConfiguredTokenFilter#singletonWithVersion uses the version internally for the token filter factories but it registers only one instance in the cache and not one instance per version. This can lead to exceptions like the one described in #50734 since the singleton is created and cached using the version created of the first index that is processed. Remove the singletonWithVersion() methods and use the elasticsearchVersion() methods instead. Fixes: #50734 (cherry picked from commit 24e1858)
The PreConfiguredTokenFilter#singletonWithVersion uses the version internaly for the token filter factories but it registers only one instance in the cahce and not one instance per version. This can lead to exceptions like the one described in elastic#50734 since the singleton is created and cached using the version created of the first index that is processed. Remove the singletonWithVersion() methods and use the elasticsearchVersion() methods instead. Fixes: elastic#50734
The
PreConfiguredTokenFilter#singletonWithVersionuses the versioninternaly for the token filter factories but it registers only one
instance in the cahce and not one instance per version. This can lead
to exceptions like the one described in #50734 since the singleton is
created and cached using the
version createdof the first indexthat is processed.
Remove the
singletonWithVersion()methods and use theelasticsearchVersion()methods instead.Fixes: #50734