-
Notifications
You must be signed in to change notification settings - Fork 2.3k
API changes for stream transport and stream based search transport action #18722
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
API changes for stream transport and stream based search transport action #18722
Conversation
|
❌ Gradle check result for e4e6a46: 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? |
e4e6a46 to
1942490
Compare
|
❌ Gradle check result for 1942490: 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? |
d45b25d to
684d627
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #18722 +/- ##
============================================
- Coverage 72.93% 72.84% -0.09%
- Complexity 68855 68895 +40
============================================
Files 5590 5600 +10
Lines 315887 316247 +360
Branches 45839 45866 +27
============================================
+ Hits 230382 230383 +1
- Misses 66832 67193 +361
+ Partials 18673 18671 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
libs/core/src/main/java/org/opensearch/core/common/io/stream/StreamInput.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/transport/nativeprotocol/NativeOutboundMessage.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/transport/InboundDecoder.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/transport/stream/StreamTransportResponse.java
Show resolved
Hide resolved
server/src/main/java/org/opensearch/cluster/node/DiscoveryNode.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/cluster/service/ClusterApplierService.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/transport/TcpTransport.java
Outdated
Show resolved
Hide resolved
684d627 to
798b2ea
Compare
Signed-off-by: Rishabh Maurya <[email protected]>
Signed-off-by: Rishabh Maurya <[email protected]>
Signed-off-by: Rishabh Maurya <[email protected]>
|
❌ Gradle check result for 5031cb1: 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? |
…transport service Signed-off-by: Rishabh Maurya <[email protected]>
server/src/main/java/org/opensearch/transport/StreamTransportService.java
Outdated
Show resolved
Hide resolved
|
❌ Gradle check result for 56d6e7e: 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? |
Signed-off-by: Rishabh Maurya <[email protected]>
|
❌ Gradle check result for cbcf9f5: 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? |
Signed-off-by: Rishabh Maurya <[email protected]>
|
❌ Gradle check result for 62c0454: 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? |
…tion (opensearch-project#18722) Signed-off-by: Rishabh Maurya <[email protected]> Signed-off-by: sunqijun.jun <[email protected]>
…tion (opensearch-project#18722) Signed-off-by: Rishabh Maurya <[email protected]>
Description
RFC: #18425
This PR covers -
Key points of discussion -
Client-Side Streaming API Flow
flowchart TD %% Simple Client Flow START[Client sends streaming request] --> WAIT[Wait for response asynchronously] WAIT --> RESPONSE{Response Type?} RESPONSE -->|Success| STREAM[handleStreamResponse called] RESPONSE -->|Error| ERROR[handleException called] RESPONSE -->|Timeout| TIMEOUT[Timeout exception] %% Stream Processing STREAM --> NEXT[Get next response] NEXT --> PROCESS[Process response] PROCESS --> CONTINUE{Continue?} CONTINUE -->|Yes| NEXT CONTINUE -->|No - Complete| CLOSE[streamResponse.close] CONTINUE -->|No - Cancel| CANCEL[streamResponse.cancel] %% Error & Completion ERROR --> HANDLE_ERROR[Handle error] TIMEOUT --> HANDLE_ERROR CLOSE --> SUCCESS[Complete] CANCEL --> SUCCESS HANDLE_ERROR --> SUCCESS %% Simple styling classDef client fill:#e8f5e8,stroke:#2e7d32,stroke-width:2px classDef framework fill:#e3f2fd,stroke:#1976d2,stroke-width:2px classDef error fill:#ffebee,stroke:#c62828,stroke-width:2px class START,NEXT,PROCESS,CLOSE,CANCEL client class WAIT,STREAM,ERROR,TIMEOUT framework class HANDLE_ERROR error class RESPONSE,CONTINUE decisionSimple Client Usage
Implementation:
Key Points:
nextResponse()blocks waiting for server datahandleExceptioncan cancel active streams for timeout scenariosServer-Side Streaming API Guide
Action Registration
Basic Implementation
Processing Flow
flowchart TD A[Request Received] --> B[Process Data Loop] B --> C[Send Response Batch] C --> D{Client Cancelled?} D -->|Yes| E[Exit Gracefully] D -->|No| F{More Data?} F -->|Yes| B F -->|No| G[Complete Stream] G --> H[Success] B --> I{Error?} I -->|Yes| J[Send Error] J --> K[Terminated] classDef success fill:#e8f5e8 classDef error fill:#ffebee classDef cancel fill:#fce4ec class G,H success class J,K error class E cancelKey Behaviors
Blocking
sendResponseBatch()may block if transport buffers are fullCancellation
sendResponseBatch()throwsStreamExceptionwithStreamErrorCode.CANCELLEDwhen client cancelscompleteStream()orsendResponse()after cancellationCompletion
completeStream()(success) ORsendResponse(exception)(error)Related Issues
Resolves #[Issue number to be closed when this PR is merged]
Check List
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.