OpenSearch
OpenSearch copied to clipboard
Change abstraction point for transport protocol
The previous implementation had a transport switch point in InboundPipeline when the bytes were initially pulled off the wire. There was no implementation for any other protocol as the canHandleBytes method was hardcoded to return true. I believe this is the wrong point to switch on the protocol. This change makes NativeInboundBytesHandler protocol agnostic beyond the header. With this change, a complete message is parsed from the stream of bytes, with the header schema being unchanged from what exists today. The protocol switch point will now be at InboundHandler::inboundMessage. The header will indicate what protocol was used to serialize the the non-header bytes of the message and then invoke the appropriate handler based on that field.
Check List
- [x] Functionality includes testing.
- [x] API changes companion pull request created, if applicable.
- [x] Public documentation issue/PR created, if applicable.
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.
@reta It was easier to illustrate the change here as a PR as opposed to describing it in an issue. The key changes here are basically:
- Remove protocol-specific types from NativeInboundBytesHandler (this class is now mis-named, but I didn't rename yet it to avoid polluting the diff).
- Make
ProtocolInboundMessagean abstract class containing the non-protocol-specific parts of the message. Essentially only the StreamInput part is inNativeInboundMessagenow.
The upshot of the change here is that the "header" part of the transport protocol remains unchanged, but they payload of each message is what now can be different protocols. The server will be able to freely exchange a mix of protocols on one connection at runtime (required for bwc anyway). The following code is where we will switch to the appropriate payload handler based on the protocol specified in the header:
https://github.com/opensearch-project/OpenSearch/blob/0138b6e3fd5d5d90c22b7b9f89dfdcfaa60af50e/server/src/main/java/org/opensearch/transport/InboundHandler.java#L110-L122
:x: Gradle check result for 0138b6e3fd5d5d90c22b7b9f89dfdcfaa60af50e: FAILURE
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?
This looks right to me!
This looks right to me!
Double it!
:grey_exclamation: Gradle check result for d4217c148c5fb669ef64f5c017d2be5af67d6715: UNSTABLE
- TEST FAILURES:
1 org.opensearch.cluster.MinimumClusterManagerNodesIT.testThreeNodesNoClusterManagerBlock
Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.
Codecov Report
Attention: Patch coverage is 84.09091% with 21 lines in your changes missing coverage. Please review.
Project coverage is 71.88%. Comparing base (
f5da8c8) to head (f6d5ce9). Report is 2 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #15432 +/- ##
============================================
+ Coverage 71.79% 71.88% +0.09%
- Complexity 63263 63305 +42
============================================
Files 5231 5233 +2
Lines 296526 296526
Branches 42832 42827 -5
============================================
+ Hits 212900 213171 +271
+ Misses 66121 65782 -339
- Partials 17505 17573 +68
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:x: Gradle check result for 95eeaf06fc884e5999041b6f932a72d17bb7ee5d: FAILURE
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?
:x: Gradle check result for 4c6b24ff059d58e025380703c7255fb6a4b644d5: FAILURE
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?
:white_check_mark: Gradle check result for 39c14fd0abe2327db8139840be4457fd27f32566: SUCCESS
:white_check_mark: Gradle check result for c3c7a27b9e046190544d7a7beb05f3a17a947095: SUCCESS
:x: Gradle check result for 27a7a5943304aa6f4dca35c8ba3f4b478c5c664d: FAILURE
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?
:x: Gradle check result for 8580aced1efcafb478cf09efe356c75bc7b5080e: FAILURE
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?
java.lang.AssertionError:
Expected: an empty collection
but: <[LEAK: ByteBuf.release() was not called before it's garbage-collected. See https://netty.io/wiki/reference-counted-objects.html for more information.
Recent access records:
#1:
org.opensearch.http.reactor.netty4.ReactorNetty4StreamingRequestConsumer.createChunk(ReactorNetty4StreamingRequestConsumer.java:47)
org.opensearch.http.reactor.netty4.ReactorNetty4StreamingRequestConsumer.accept(ReactorNetty4StreamingRequestConsumer.java:37)
org.opensearch.http.reactor.netty4.ReactorNetty4StreamingRequestConsumer.accept(ReactorNetty4StreamingRequestConsumer.java:23)
Working on the fix right away
Fix is out https://github.com/opensearch-project/OpenSearch/pull/15475
:grey_exclamation: Gradle check result for 8580aced1efcafb478cf09efe356c75bc7b5080e: UNSTABLE
Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.
:x: Gradle check result for f6d5ce9fb2d7a9eef76af0837f7759e1c5df4db6: FAILURE
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?
:white_check_mark: Gradle check result for f6d5ce9fb2d7a9eef76af0837f7759e1c5df4db6: SUCCESS
The backport to 2.x failed:
The process '/usr/bin/git' failed with exit code 128
To backport manually, run these commands in your terminal:
# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch/backport-2.x
# Create a new branch
git switch --create backport/backport-15432-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 5663b4ae5c5553b358226f15f17b89aa843f9479
# Push it to GitHub
git push --set-upstream origin backport/backport-15432-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch/backport-2.x
Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-15432-to-2.x.
@andrross backport manually pls?