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

Enhancements in StreamChannelConnectionCaptureSerializer #494

Merged
merged 6 commits into from
Feb 2, 2024

Conversation

AndreKurait
Copy link
Member

@AndreKurait AndreKurait commented Jan 30, 2024

Description

This pull request introduces two key enhancements to the StreamChannelConnectionCaptureSerializer:

  • Increasing the StreamChannelConnectionCaptureSerializer's max ID size.
  • Refactoring the StreamChannelConnectionCaptureSerializerTest with a calculated bufferSize and added test for maxID sizes.
  • Category: Bug fix, Refactoring
  • These changes are required to fix max id size assertion in StreamChannelConnectionCaptureSerializer which currently is not large enough to allow for kafka connectionIds when executed with assertions enabled.
  • Old behavior: Threw assertion error when starting up with -ea jdk flag.
  • New behavior: No StreamChannelConnectionCaptureSerializer assertion error during startup with -ea.

Issues Resolved

Is this a backport? If so, please add backport PR # and/or commits #

  • N/A

Testing

  • Unit testing have been conducted to ensure functionality with new tests added to verify behavior
  • Manual testing has been performed to verify the changes via starting up dockerSolution with -enableassertions with OSB --test script and doc count check

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.

Copy link

codecov bot commented Jan 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (af612a3) 73.49% compared to head (25e86f2) 73.53%.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #494      +/-   ##
============================================
+ Coverage     73.49%   73.53%   +0.04%     
- Complexity     1180     1181       +1     
============================================
  Files           124      124              
  Lines          4886     4886              
  Branches        439      439              
============================================
+ Hits           3591     3593       +2     
+ Misses         1000      999       -1     
+ Partials        295      294       -1     
Flag Coverage Δ
unittests 73.53% <ø> (+0.04%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

*/
@Slf4j
public class StreamChannelConnectionCaptureSerializer<T> implements IChannelConnectionCaptureSerializer<T> {

private static final int MAX_ID_SIZE = 96;
private static final int MAX_ID_SIZE = 100;
Copy link
Member Author

Choose a reason for hiding this comment

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

@gregschohn, let me know if we should increase this as 100 is exactly what we expect out of our realIds

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't have a strong opinion. If I were doing this code from scratch, I'd probably put an assertion that I could create a new CodedOutputStream from the factory that was able to write the boilerplate stuff - all within a lambda inside the assert statement.

Copy link
Collaborator

@gregschohn gregschohn left a 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 mockito test get dropped & the code that it was testing improve. I'd recommend filing an issue to improve it & leave that dragon sleep for the moment.

TrafficCapture/captureOffloader/build.gradle Outdated Show resolved Hide resolved
*/
@Slf4j
public class StreamChannelConnectionCaptureSerializer<T> implements IChannelConnectionCaptureSerializer<T> {

private static final int MAX_ID_SIZE = 96;
private static final int MAX_ID_SIZE = 100;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't have a strong opinion. If I were doing this code from scratch, I'd probably put an assertion that I could create a new CodedOutputStream from the factory that was able to write the boilerplate stuff - all within a lambda inside the assert statement.

@AndreKurait AndreKurait force-pushed the MIGRATIONS-1490 branch 2 times, most recently from df51fa9 to f42650a Compare February 1, 2024 18:51
@AndreKurait AndreKurait merged commit ed96552 into opensearch-project:main Feb 2, 2024
7 checks passed
@AndreKurait AndreKurait deleted the MIGRATIONS-1490 branch February 2, 2024 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants