Reset datasource metadata when failed to update it in postIndex and postDelete to force refresh it from the primary index shard.#761
Conversation
Signed-off-by: Bo Zhang <bzhangam@amazon.com>
47af1df to
14c7059
Compare
src/main/java/org/opensearch/geospatial/ip2geo/dao/Ip2GeoCachedDao.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/geospatial/ip2geo/dao/Ip2GeoCachedDao.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/geospatial/ip2geo/processor/Ip2GeoProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/geospatial/ip2geo/dao/Ip2GeoCachedDao.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/geospatial/ip2geo/dao/Ip2GeoCachedDao.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/geospatial/ip2geo/processor/Ip2GeoProcessor.java
Show resolved
Hide resolved
|
Please add a change log. |
|
|
||
| private void clearMetadata() { | ||
| log.info("Resetting all datasource metadata to force a refresh from the primary index shard."); | ||
| metadata = null; |
There was a problem hiding this comment.
We might need to handle it more gracefully. Current metadata reading shouldn't be breaking due to this code.
There was a problem hiding this comment.
Consider initializing an empty Map instead? Will it cause NPE when getMetadata() is called elsewhere?
There was a problem hiding this comment.
Modified the getMetadata() to handle the edge case that we can set the metadata as null before getMetadata() returns the non-null metadata. Create a local variable to ensure the returned metadata is non-null.
There was a problem hiding this comment.
Please add a comment to getMetadata() method explaning why we return local variable instead of metadat.
|
|
||
| private void clearMetadata() { | ||
| log.info("Resetting all datasource metadata to force a refresh from the primary index shard."); | ||
| metadata = null; |
There was a problem hiding this comment.
Consider initializing an empty Map instead? Will it cause NPE when getMetadata() is called elsewhere?
src/main/java/org/opensearch/geospatial/ip2geo/processor/Ip2GeoProcessor.java
Outdated
Show resolved
Hide resolved
c1b11f5 to
5a02aba
Compare
…ostDelete to force refresh it from the primary index shard. Signed-off-by: Bo Zhang <bzhangam@amazon.com>
…ostDelete to force refresh it from the primary index shard. (#761) * Add release notes for 3.1.0 Signed-off-by: Bo Zhang <bzhangam@amazon.com> * Reset datasource metadata when failed to update it in postIndex and postDelete to force refresh it from the primary index shard. Signed-off-by: Bo Zhang <bzhangam@amazon.com> --------- Signed-off-by: Bo Zhang <bzhangam@amazon.com> (cherry picked from commit f57507c)
…ostDelete to force refresh it from the primary index shard. (#761) (#762) * Add release notes for 3.1.0 * Reset datasource metadata when failed to update it in postIndex and postDelete to force refresh it from the primary index shard. --------- (cherry picked from commit f57507c) Signed-off-by: Bo Zhang <bzhangam@amazon.com> Co-authored-by: Bo Zhang <bzhangam@amazon.com>
Description
Reset datasource metadata when failed to update it in postIndex and postDelete to force refresh it from the primary index shard. This can help on the case when the update in the primary shard succeeds but the update in the replica shard fails and causing the outdated datasource metadata in the Cache.
Also add more logs to Ip2GeoCachedDao to monitor its behavior.
Related Issues
N/A
Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.