-
Notifications
You must be signed in to change notification settings - Fork 30
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
Favor ByteBuf Duplicates, NettyJsonContentAuthSigner and StreamChannelConnectionCaptureSerializer Refactoring #615
Favor ByteBuf Duplicates, NettyJsonContentAuthSigner and StreamChannelConnectionCaptureSerializer Refactoring #615
Conversation
ecde713
to
82bd98a
Compare
82bd98a
to
be72c5b
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #615 +/- ##
============================================
+ Coverage 75.76% 75.79% +0.03%
- Complexity 1533 1543 +10
============================================
Files 168 168
Lines 6395 6437 +42
Branches 570 575 +5
============================================
+ Hits 4845 4879 +34
- Misses 1173 1179 +6
- Partials 377 379 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
be72c5b
to
32a2485
Compare
...rafficReplayer/src/main/java/org/opensearch/migrations/replay/ParsedHttpMessagesAsDicts.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a couple comments for my own understanding. Provided that you're comfortable with the answers, this LGTM.
...rafficReplayer/src/main/java/org/opensearch/migrations/replay/ParsedHttpMessagesAsDicts.java
Outdated
Show resolved
Hide resolved
...rafficReplayer/src/main/java/org/opensearch/migrations/replay/ParsedHttpMessagesAsDicts.java
Outdated
Show resolved
Hide resolved
...in/java/org/opensearch/migrations/replay/datahandlers/http/HttpJsonTransformingConsumer.java
Show resolved
Hide resolved
...main/java/org/opensearch/migrations/replay/datahandlers/http/NettyJsonContentAuthSigner.java
Show resolved
Hide resolved
...main/java/org/opensearch/migrations/replay/datahandlers/http/NettyJsonContentAuthSigner.java
Show resolved
Hide resolved
32a2485
to
0ee07e3
Compare
...in/java/org/opensearch/migrations/replay/datahandlers/http/HttpJsonTransformingConsumer.java
Show resolved
Hide resolved
.../java/org/opensearch/migrations/trafficcapture/StreamChannelConnectionCaptureSerializer.java
Outdated
Show resolved
Hide resolved
6f62907
to
507dd36
Compare
.../java/org/opensearch/migrations/trafficcapture/StreamChannelConnectionCaptureSerializer.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see the ByteBuffer conversion in the serializer be reversed. I think that it will be a big performance hit and won't always work as you are hoping that it would (making it less maintainable). The other comments should be minor/easy to address
.../java/org/opensearch/migrations/trafficcapture/StreamChannelConnectionCaptureSerializer.java
Outdated
Show resolved
Hide resolved
.../java/org/opensearch/migrations/trafficcapture/StreamChannelConnectionCaptureSerializer.java
Outdated
Show resolved
Hide resolved
.../java/org/opensearch/migrations/trafficcapture/StreamChannelConnectionCaptureSerializer.java
Outdated
Show resolved
Hide resolved
.../java/org/opensearch/migrations/trafficcapture/StreamChannelConnectionCaptureSerializer.java
Outdated
Show resolved
Hide resolved
.../java/org/opensearch/migrations/trafficcapture/StreamChannelConnectionCaptureSerializer.java
Outdated
Show resolved
Hide resolved
...rafficReplayer/src/main/java/org/opensearch/migrations/replay/ParsedHttpMessagesAsDicts.java
Show resolved
Hide resolved
...rafficReplayer/src/main/java/org/opensearch/migrations/replay/ParsedHttpMessagesAsDicts.java
Outdated
Show resolved
Hide resolved
...main/java/org/opensearch/migrations/replay/datahandlers/http/NettyJsonContentAuthSigner.java
Show resolved
Hide resolved
...main/java/org/opensearch/migrations/replay/datahandlers/http/NettyJsonContentAuthSigner.java
Outdated
Show resolved
Hide resolved
...ficReplayer/src/main/java/org/opensearch/migrations/replay/netty/BacksideSnifferHandler.java
Show resolved
Hide resolved
507dd36
to
86a6b3a
Compare
c23ecef
to
305c5dc
Compare
Signed-off-by: Andre Kurait <[email protected]>
Signed-off-by: Andre Kurait <[email protected]>
Signed-off-by: Andre Kurait <[email protected]>
Signed-off-by: Andre Kurait <[email protected]>
Signed-off-by: Andre Kurait <[email protected]>
Signed-off-by: Andre Kurait <[email protected]>
…r bytes written than capacity Signed-off-by: Andre Kurait <[email protected]>
…that have larger capacity than limit Signed-off-by: Andre Kurait <[email protected]>
Signed-off-by: Andre Kurait <[email protected]>
Signed-off-by: Andre Kurait <[email protected]>
…ervations at capacity of stream Signed-off-by: Andre Kurait <[email protected]>
b8054eb
to
5632748
Compare
…edObservations at capacity of stream Signed-off-by: Andre Kurait <[email protected]>
Signed-off-by: Andre Kurait <[email protected]>
Signed-off-by: Andre Kurait <[email protected]>
5632748
to
9967581
Compare
I've updated the serializer to be more deterministic around edge cases and require less data copying. Please take a look at the latest revision |
Signed-off-by: Andre Kurait <[email protected]>
9967581
to
1b66165
Compare
Signed-off-by: Andre Kurait <[email protected]>
|
||
// Similar to calculateMaxWritableSpace but perform pessimistic calculation with fewer operations. In some cases returns | ||
// up to 1 byte fewer than what could be written out of the available space. | ||
public static int pessimisticallyCalculateMaxWritableSpace(int totalAvailableSpace, int requestedWriteableSpace) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gregschohn, added, depended on, and tested pessimisticallyCalculateMaxWritableSpace instead of calculateMaxWritableSpace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function calculates the max bytes that I could write to a protobuf stream, including the overhead to write the array, right? I'm thinking something like "calculateMaxArrayLengthForSpace" - something that indicates that exactly one piece of overhead is taken into account here, not the tag, no omission of the length. A clearer name (as hard as that is) will make this definition (which is now really easy to understand, thanks) and its applications more obvious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking computeMaxLengthDelimitedFieldSizeForSpace
which is analogous to (internal method) computeLengthDelimitedFieldSize
in CodedOutputStream
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still a really hard PR to go through because the CodedOutputStream stuff has always been so challenging. I think that 80% of this is great. We just need to cleanup some names to get the rest of it to the point where it can be maintained.
Thanks for persevering.
...loader/src/main/java/org/opensearch/migrations/trafficcapture/CodedOutputStreamSizeUtil.java
Outdated
Show resolved
Hide resolved
.../java/org/opensearch/migrations/trafficcapture/StreamChannelConnectionCaptureSerializer.java
Show resolved
Hide resolved
.../java/org/opensearch/migrations/trafficcapture/StreamChannelConnectionCaptureSerializer.java
Outdated
Show resolved
Hide resolved
.../java/org/opensearch/migrations/trafficcapture/StreamChannelConnectionCaptureSerializer.java
Outdated
Show resolved
Hide resolved
.../java/org/opensearch/migrations/trafficcapture/StreamChannelConnectionCaptureSerializer.java
Outdated
Show resolved
Hide resolved
...main/java/org/opensearch/migrations/replay/datahandlers/http/NettyJsonContentAuthSigner.java
Outdated
Show resolved
Hide resolved
...main/java/org/opensearch/migrations/replay/datahandlers/http/NettyJsonContentAuthSigner.java
Outdated
Show resolved
Hide resolved
...rafficReplayer/src/test/java/org/opensearch/migrations/replay/ResultsToLogsConsumerTest.java
Show resolved
Hide resolved
...rafficReplayer/src/test/java/org/opensearch/migrations/replay/ResultsToLogsConsumerTest.java
Show resolved
Hide resolved
...apture/trafficReplayer/src/testFixtures/java/org/opensearch/migrations/replay/TestUtils.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Andre Kurait <[email protected]>
a5a9861
to
61dbc8f
Compare
Signed-off-by: Andre Kurait <[email protected]>
Description
This change seeks to simplify the complexity ByteBuf reading and duplicating indexes through use of
.duplicate
over.slice
and being more intentional about side effects to the buffer after reading.This change also seeks to harden NettyJsonContentAuthSigner by flushing the buffer in error cases and removing unnecessary release/retains.
Furthermore, moved to the Netty Base64 Encoder in ParsedHttpMessagesAsDicts to directly decode from ByteBufs.
Also, fixed up some trace logging that previously wasn't using a supplier to reduce unnecessary cycles.
This change also refactors StreamChannelConnectionCaptureSerializer to clean up the interfaces, improve performance, and remove bugs around chunking and serializing data.
Issues Resolved
MIGRATIONS-1696
Is this a backport? If so, please add backport PR # and/or commits #
Testing
Unit testing
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.