Skip to content

TcpProxy::CombinedUpstream: Implement watermark callback functions - #34098

Merged
alyssawilk merged 19 commits into
envoyproxy:mainfrom
vikaschoudhary16:tcpproxy-watermark
Jun 4, 2024
Merged

alyssawilk merged 19 commits into
envoyproxy:mainfrom
vikaschoudhary16:tcpproxy-watermark

Conversation

@vikaschoudhary16

Copy link
Copy Markdown
Contributor

followup to #32991
Commit Message: Implement watermark functions which was a TODO and some cleanup
Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

@vikaschoudhary16

Copy link
Copy Markdown
Contributor Author

/assign @alyssawilk

@vikaschoudhary16
vikaschoudhary16 marked this pull request as draft May 11, 2024 11:41
Signed-off-by: Vikas Choudhary <[email protected]>
@vikaschoudhary16
vikaschoudhary16 marked this pull request as ready for review May 11, 2024 11:48
@vikaschoudhary16
vikaschoudhary16 marked this pull request as draft May 11, 2024 14:38
Signed-off-by: Vikas Choudhary <[email protected]>
Signed-off-by: Vikas Choudhary <[email protected]>
@vikaschoudhary16
vikaschoudhary16 marked this pull request as ready for review May 11, 2024 15:39
Comment thread source/common/tcp_proxy/tcp_proxy.h Resolved
Signed-off-by: Vikas Choudhary <[email protected]>
setEndStreamAndDecodeTimer();
}
if (stop_and_buffer_) {
return Http::FilterDataStatus::StopIterationAndBuffer;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If this change is not added, assertion fails in tcp_proxy.cc

 // The upstream should consume all of the data.
  // Before there is an upstream the connection should be readDisabled. If the upstream is
  // destroyed, there should be no further reads as well.
  ASSERT(0 == data.length());

Why we dont need this assertion in HCM case and it is there only in tcp_proxy?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

StopIterationNobuffer is generally called before we quit processing a request. it results in discarding data that's in the filter.
in the tcp proxy case it means the filter manager doesn't consume the data to

Signed-off-by: Vikas Choudhary <[email protected]>
Signed-off-by: Vikas Choudhary <[email protected]>
@vikaschoudhary16
vikaschoudhary16 marked this pull request as draft May 25, 2024 02:21
Signed-off-by: Vikas Choudhary <[email protected]>
Signed-off-by: Vikas Choudhary <[email protected]>
Signed-off-by: Vikas Choudhary <[email protected]>
Signed-off-by: Vikas Choudhary <[email protected]>
This reverts commit 2196563.

Signed-off-by: Vikas Choudhary <[email protected]>
This reverts commit 9b7bc61.

Signed-off-by: Vikas Choudhary <[email protected]>
This reverts commit 148ca65.

Signed-off-by: Vikas Choudhary <[email protected]>
This reverts commit 201f6b5.

Signed-off-by: Vikas Choudhary <[email protected]>
Signed-off-by: Vikas Choudhary <[email protected]>
Signed-off-by: Vikas Choudhary <[email protected]>
@vikaschoudhary16
vikaschoudhary16 force-pushed the tcpproxy-watermark branch 21 times, most recently from 25b5a57 to 473d077 Compare June 1, 2024 01:06
Signed-off-by: Vikas Choudhary <[email protected]>
@vikaschoudhary16
vikaschoudhary16 marked this pull request as ready for review June 1, 2024 01:43
@vikaschoudhary16 vikaschoudhary16 changed the title TcpProxy::CombinedUpstream: Implement watermark functions TcpProxy::CombinedUpstream: Implement watermark callback functions Jun 1, 2024

@alyssawilk alyssawilk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM with a few questions - just to make sure you verified your tests hit the backup and unwind code?

if (disable) {
upstream_requests_.front()->onAboveWriteBufferHighWatermark();
}
upstream_requests_.front()->readDisableOrDefer(disable);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this can't actually be a multi-entry list right?
I think I'm going to send out a PR to convert to unique ptr.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, this will always be single entry

setEndStreamAndDecodeTimer();
}
if (stop_and_buffer_) {
return Http::FilterDataStatus::StopIterationAndBuffer;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

StopIterationNobuffer is generally called before we quit processing a request. it results in discarding data that's in the filter.
in the tcp proxy case it means the filter manager doesn't consume the data to

@vikaschoudhary16

Copy link
Copy Markdown
Contributor Author

LGTM with a few questions - just to make sure you verified your tests hit the backup and unwind code?

yes, I have verified that it hits backup and unwind code.

@alyssawilk
alyssawilk merged commit 222c1fe into envoyproxy:main Jun 4, 2024
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