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

[BUG] Compatibility of 1.x client with 2.x OpenSearch #9799

Closed
guthedar opened this issue Sep 6, 2023 · 3 comments
Closed

[BUG] Compatibility of 1.x client with 2.x OpenSearch #9799

guthedar opened this issue Sep 6, 2023 · 3 comments
Labels
bug Something isn't working untriaged

Comments

@guthedar
Copy link

guthedar commented Sep 6, 2023

Coming from 152 , Our case is otherway around. We tried using 1.x client to connect to 2.x opensearch cluster, We were able to push the bulk data and persist into Opensearch DB, but after pushing the data, the HighLevelRestClient is parsing the response and trying to return it, but its failing while parsing the response. Below is the stack trace of Error while parsing -

c.m.m.c.ES_tools_v2 Thread-12-kafka-messages-to-es-bolt-id-executor[5 5] [ERROR] bulkAction exception: Unable to parse response body for Response{requestLine=POST /_bulk?timeout=10s HTTP/1.1, host=http://10.213.15.121:9200, response=HTTP/1.1 200 OK}
 STDIO Thread-12-kafka-messages-to-es-bolt-id-executor[5 5] [ERROR] java.io.IOException: Unable to parse response body for Response{requestLine=POST /_bulk?timeout=10s HTTP/1.1, host=http://10.213.15.121:9200, response=HTTP/1.1 200 OK}
 [ERROR] at org.opensearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1781)
 [ERROR] at org.opensearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1728)
 [ERROR] at org.opensearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1696)
 [ERROR] at org.opensearch.client.RestHighLevelClient.bulk(RestHighLevelClient.java:363)
 [ERROR] at com.mist.mobius.common.OS_tools.BulkExec(OS_tools.java:819)
 [ERROR] at com.mist.mobius.bolt.OSBolt.execute(OSBolt.java:150)
 [ERROR] at org.apache.storm.daemon.executor$fn__9766$tuple_action_fn__9768.invoke(executor.clj:739)
 [ERROR] at org.apache.storm.daemon.executor$mk_task_receiver$fn__9687.invoke(executor.clj:471)
 [ERROR] at org.apache.storm.disruptor$clojure_handler$reify__9198.onEvent(disruptor.clj:41)
 [ERROR] at org.apache.storm.utils.DisruptorQueue.consumeBatchToCursor(DisruptorQueue.java:509)
 [ERROR] at org.apache.storm.utils.DisruptorQueue.consumeBatchWhenAvailable(DisruptorQueue.java:487)
 [ERROR] at org.apache.storm.disruptor$consume_batch_when_available.invoke(disruptor.clj:74)
 [ERROR] at org.apache.storm.daemon.executor$fn__9766$fn__9779$fn__9832.invoke(executor.clj:861)
 [ERROR] at org.apache.storm.util$async_loop$fn__553.invoke(util.clj:484)
 [ERROR] at clojure.lang.AFn.run(AFn.java:22)
 [ERROR] at java.lang.Thread.run(Thread.java:750)
 [ERROR] Caused by: java.lang.NullPointerException
 [ERROR] at java.util.Objects.requireNonNull(Objects.java:203)
 [ERROR] at org.opensearch.action.DocWriteResponse.<init>(DocWriteResponse.java:140)
 [ERROR] at org.opensearch.action.index.IndexResponse.<init>(IndexResponse.java:67)
 [ERROR] at org.opensearch.action.index.IndexResponse.<init>(IndexResponse.java:52)
 [ERROR] at org.opensearch.action.index.IndexResponse$Builder.build(IndexResponse.java:120)
 [ERROR] at org.opensearch.action.index.IndexResponse$Builder.build(IndexResponse.java:117)
 [ERROR] at org.opensearch.action.bulk.BulkItemResponse.fromXContent(BulkItemResponse.java:172)
 [ERROR] at org.opensearch.action.bulk.BulkResponse.fromXContent(BulkResponse.java:208)
 [ERROR] at org.opensearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:2075)
 [ERROR] at org.opensearch.client.RestHighLevelClient.lambda$performRequestAndParseEntity$8(RestHighLevelClient.java:1696)
 [ERROR] at org.opensearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1779)

When I run the same storm topology with 1.x OS client and 1.x version of Opensearch cluster I dont see this error. I get this error with 2.x version of Opensearch cluster(tried with 2.0.0 & 2.8.0).

Expected behavior
Expectation is that the newer versions of Opensearch DB cluster should be backward compatible with older Opensearch (java) clients i.e. We should be able to connect from 1.x opensearch client to 2.x opensearch cluster without any errors.

Additional context
We are tightly coupled to use java 1.8. Since opensearch 2.x versions dropped support for java1.8 - reference , we are forced to use older version of Opensearch clients(1.3.12) but this should not stop us from connecting to and persisting data in latest Opensearch cluster(2.x versions). When I try to connect to Opensearch cluster 1.3.12 it works fine, but when I try to connect to 2.x version it pushes the data into db but with above error.

@guthedar guthedar added bug Something isn't working untriaged labels Sep 6, 2023
@reta
Copy link
Collaborator

reta commented Sep 7, 2023

@guthedar at this moment, OpenSearch strives hard to preserve backward compatibility (later versions could work with older versions), but not forward compatibility (older versions could work later versions).

@reta
Copy link
Collaborator

reta commented Sep 7, 2023

@dblock
Copy link
Member

dblock commented Sep 8, 2023

There's a proposal in #3035 for a REST-level API versioning that would enable in this case 2.x to talk the 1.x protocol. I am going to close this as a dup of that. Let me know/reopen if you don't agree.

I believe we should do both that and opensearch-project/opensearch-java#156 btw. @guthedar if you want to help I'd focus on opensearch-java JDK 8 support, it would go a long way.

@dblock dblock closed this as completed Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working untriaged
Projects
None yet
Development

No branches or pull requests

3 participants