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

[Fix CQL Sticher 3/4] Populate map of streams to frames during parsing #1716

Merged
merged 5 commits into from
Nov 2, 2023

Conversation

benkilimnik
Copy link
Member

@benkilimnik benkilimnik commented Sep 29, 2023

Summary: Modifies all protocol parsers to use a map of streams to deques by default. Protocols which do not have a notion of streams are encoded as single keys in a map. This completes the CQL stitcher fix and should simplify stitching frames for protocols with streams.

The final PR in this sequence #1732 populates a map of streamIDs to deque of frames in ParseFramesLoop instead of ParseFrames. This should provide a small efficiency boost, as we won't have to loop over the frames twice.

Related issues: Closes #1375

Type of change: /kind bug

Test Plan: Updated parsing tests to use new interface. Note: this PR relies on changes introduced in #1689 and #1715

@benkilimnik benkilimnik requested a review from a team September 30, 2023 03:15
Comment on lines 144 to 149
for (auto& frame : new_frames) {
// GetStreamID returns 0 by default if not implemented in protocol.
TKey key = GetStreamID<TKey, TFrameType>(&frame);
(*frames)[key].push_back(frame);
}
Copy link
Member

Choose a reason for hiding this comment

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

Have you tried pushing the GetStreamID call into the ParseFramesLoop function? It seems like we could avoid this loop if GetStreamID could be called here as the frame is pushed into the deque.

This comment was marked as outdated.

Copy link
Member Author

Choose a reason for hiding this comment

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

On second thought, I think it is better to have the call to GetStreamID in ParseFramesLoop. To avoid this PR getting too large, I've moved that change to #1732

@benkilimnik benkilimnik changed the title [Fix CQL Sticher 3/3] Populate map of streams to frames during parsing [Fix CQL Sticher 3/4] Populate map of streams to frames during parsing Oct 11, 2023
vihangm pushed a commit that referenced this pull request Oct 11, 2023
…1731)

Summary: Raises the stirling size limit for `dbg` builds by 5 MiB (to
300mb) to accommodate upcoming changes and additions, including mongodb
parsing/stitching and `StitchFrames` interface changes (#1716).

Type of change: /kind cleanup

Test Plan: Existing targets

Signed-off-by: Benjamin Kilimnik <bkilimnik@pixielabs.ai>
Signed-off-by: Benjamin Kilimnik <bkilimnik@pixielabs.ai>
Signed-off-by: Benjamin Kilimnik <bkilimnik@pixielabs.ai>
Signed-off-by: Benjamin Kilimnik <bkilimnik@pixielabs.ai>
Signed-off-by: Benjamin Kilimnik <bkilimnik@pixielabs.ai>
@benkilimnik benkilimnik requested a review from etep October 25, 2023 18:06
@benkilimnik benkilimnik marked this pull request as ready for review October 25, 2023 18:28
@benkilimnik benkilimnik requested a review from a team October 25, 2023 18:29
std::get<std::deque<TFrameType>>(frames_).empty());
bool data_buffer_empty = data_buffer_.empty();
bool monostate = std::holds_alternative<std::monostate>(frames_);
if (data_buffer_empty || monostate) {
Copy link

Choose a reason for hiding this comment

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

Can this be a constexpr if?

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe the condition of the if statement depends on the runtime state of data_buffer_ and frames_, so we can't use a constexpr.

Comment on lines 789 to 793
// std::monostate.
ECHECK((conn_tracker->send_data()
.Empty<protocols::http::stream_id_t, protocols::http::Message>()));
ECHECK((conn_tracker->recv_data()
.Empty<protocols::http::stream_id_t, protocols::http::Message>()));
Copy link

Choose a reason for hiding this comment

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

We should probably make this a DCHECK.

Also, is it possible to create a type alias so that the line breaks are avoided, e.g.

using stream_id_t = protocols::http::stream_id_t;
using message_t = protocols::http::Message;
.Empty<stream_id_t, message_t>();

Copy link
Member Author

Choose a reason for hiding this comment

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

Added type alias and changed to DCHECK

… function

Signed-off-by: Benjamin Kilimnik <bkilimnik@pixielabs.ai>
@JamesMBartlett JamesMBartlett merged commit e04a764 into pixie-io:main Nov 2, 2023
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.

Large CQL Result frames (> 1MiB) cause poor CQL protocol stitching
4 participants