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

Use CRLF in NettyJsonToByteBufHandler #283

Merged

Conversation

mikaylathompson
Copy link
Collaborator

Signed-off-by: Mikayla Thompson [email protected]

Description

This PR includes three (related) categories of changes:

  1. It outputs the request that was replayed against the target cluster and the connection ID in the tuples that are logged as output.
  2. It updates our terminology in the tuples & surrounding areas from primary/shadow to source/target, which matches what we're using in the rest of our code & documentation.
  3. The NettyJsonToByteBufHandler was using line feeds (\n) when formatting HTTP messages, but the spec is to use carriage return line feeds (\r\n). This turned out to cause an issue in how we were parsing the HTTP message for the JSON, so rather than build in a workaround, I updated the code to use CRLFs.

These three categories are broken out quite neatly in the commits:
the first two commits are related to number 3, the next accomplishes 1, the third deals with 2, and then the final commit updates the humanReadableLogs script for 1 and 2.

Issues Resolved

I haven't created an issue for this yet 😬

Testing

Manual, and updated the unit tests affected.

Check List

  • New functionality includes testing
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented
  • Commits are signed per the DCO using --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.

@mikaylathompson mikaylathompson added capture-and-replay-v.0.1.0 Tag used to identify changes that should be merged from main to release branch backport capture-and-replay-v0.1.0 labels Aug 23, 2023
@codecov
Copy link

codecov bot commented Aug 23, 2023

Codecov Report

Merging #283 (2343f2a) into main (b7c3da0) will increase coverage by 0.06%.
Report is 20 commits behind head on main.
The diff coverage is 65.89%.

@@             Coverage Diff              @@
##               main     #283      +/-   ##
============================================
+ Coverage     61.93%   62.00%   +0.06%     
- Complexity      617      618       +1     
============================================
  Files            82       82              
  Lines          3129     3140      +11     
  Branches        292      292              
============================================
+ Hits           1938     1947       +9     
- Misses         1014     1016       +2     
  Partials        177      177              
Flag Coverage Δ
unittests 62.00% <65.89%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
...ch/migrations/replay/SourceTargetCaptureTuple.java 0.00% <0.00%> (ø)
...n/java/org/opensearch/migrations/replay/Utils.java 40.00% <ø> (ø)
.../datahandlers/http/NettyJsonContentCompressor.java 88.37% <ø> (ø)
...ions/transform/RemovingAuthTransformerFactory.java 0.00% <0.00%> (ø)
.../opensearch/migrations/replay/TrafficReplayer.java 6.75% <13.15%> (-0.42%) ⬇️
...nsearch/migrations/transform/IAuthTransformer.java 28.57% <28.57%> (ø)
...replay/PacketToTransformingHttpHandlerFactory.java 63.63% <75.00%> (ø)
.../org/opensearch/migrations/replay/SigV4Signer.java 77.58% <77.58%> (ø)
.../datahandlers/http/NettyJsonContentAuthSigner.java 86.36% <86.36%> (ø)
...datahandlers/http/RequestPipelineOrchestrator.java 96.36% <92.30%> (ø)
... and 17 more

... and 2 files with indirect coverage changes

meta.put("shadowResponse", jsonFromHttpData(triple.shadowResponseData,
triple.shadowResponseDuration));
meta.put("targetResponse", jsonFromHttpData(triple.targetResponseData,
triple.targetResponseDuration));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This should be named a tuple

@mikaylathompson mikaylathompson merged commit 92405b8 into opensearch-project:main Aug 29, 2023
@mikaylathompson mikaylathompson deleted the update-exported-tuples branch August 29, 2023 18:20
@opensearch-trigger-bot
Copy link

The backport to capture-and-replay-v0.1.0 failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/backport-capture-and-replay-v0.1.0 capture-and-replay-v0.1.0
# Navigate to the new working tree
pushd ../.worktrees/backport-capture-and-replay-v0.1.0
# Create a new branch
git switch --create backport/backport-283-to-capture-and-replay-v0.1.0
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 92405b8e967d60455a7217980025bdd4cd4b25be
# Push it to GitHub
git push --set-upstream origin backport/backport-283-to-capture-and-replay-v0.1.0
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/backport-capture-and-replay-v0.1.0

Then, create a pull request where the base branch is capture-and-replay-v0.1.0 and the compare/head branch is backport/backport-283-to-capture-and-replay-v0.1.0.

mikaylathompson added a commit that referenced this pull request Aug 29, 2023
sumobrian added a commit that referenced this pull request Aug 30, 2023
…-to-capture-and-replay-v0.1.0

Backport #283 to capture-and-replay-v0.1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport capture-and-replay-v0.1.0 capture-and-replay-v.0.1.0 Tag used to identify changes that should be merged from main to release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants