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 4/4] Move StreamID assignment to ParseFramesLoop #1732

Merged
merged 1 commit into from
Nov 9, 2023

Conversation

benkilimnik
Copy link
Member

@benkilimnik benkilimnik commented Oct 11, 2023

Summary: 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. This PR relies on #1761 due to the way timestamps are updated using ParseResult.

Related issues: #1375

Type of change: /kind cleanup

Test Plan: Updated parsing tests to use new interface

JamesMBartlett pushed a commit that referenced this pull request Nov 2, 2023
#1716)

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

---------

Signed-off-by: Benjamin Kilimnik <bkilimnik@pixielabs.ai>
vihangm pushed a commit that referenced this pull request Nov 8, 2023
…commodate #1732 (#1761)

Summary: Preemptively adapts the timestamp monotonicity change
introduced in #1733 to the last stitcher api PR #1732, which modifies
`ParseResult.frame_positions` to be an unordered `flat_hash_map`. This
changes the order in which `GetTimestamp` is called because we are now
iterating over an unordered map of streamIDs to positions when matching
timestamps with the parsed frames in the
[event_parser](https://github.com/pixie-io/pixie/blob/e6bfab707f1f4871f4b7b8ed53321ec9e7b5807d/src/stirling/source_connectors/socket_tracer/protocols/common/event_parser.h#L138C29-L138C36).

Previously, we were always iterating over the `frame_position` with the
oldest timestamp first, meaning that `prev_timestamp_` in the datastream
buffer was set correctly. With `frame_positions` being an unordered map,
we no longer have this guarantee.

To address this, we move the monotonicity check to the `Head()`
implementation of the datastream buffer and enforce increasing
timestamps for the contiguous chunk returned by `Head()` only.

Type of change: /kind bug

Test Plan: Extended the data stream buffer test + existing targets.

Signed-off-by: Benjamin Kilimnik <bkilimnik@pixielabs.ai>
Signed-off-by: Benjamin Kilimnik <bkilimnik@pixielabs.ai>
@benkilimnik benkilimnik requested a review from a team November 8, 2023 22:27
@benkilimnik benkilimnik marked this pull request as ready for review November 8, 2023 22:27
@JamesMBartlett JamesMBartlett merged commit 4926254 into pixie-io:main Nov 9, 2023
27 checks passed
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.

4 participants