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

[improve] [proxy] Not close the socket if lookup failed caused by too many requests #21216

Merged
merged 2 commits into from
Sep 21, 2023

Conversation

poorbarcode
Copy link
Contributor

Motivation

Background: The Pulsar client will close the socket if it receives a ServiceNotReady error when doing a lookup.
see

private void checkServerError(ServerError error, String errMsg) {
if (ServerError.ServiceNotReady.equals(error)) {
log.error("{} Close connection because received internal-server error {}", ctx.channel(), errMsg);
ctx.close();
} else if (ServerError.TooManyRequests.equals(error)) {
incrementRejectsAndMaybeClose();
}
}

The Broker will respond to the client with a TooManyRequests error if there are too many lookup requests in progress, but the Pulsar Proxy responds to the client with a ServiceNotReady error in the same scenario.

Modifications

Make Pulsar Proxy respond to the client with a TooManyRequests error if there are too many lookup requests in progress.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: x

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Sep 21, 2023
@poorbarcode poorbarcode self-assigned this Sep 21, 2023
@poorbarcode poorbarcode added release/3.0.2 release/2.11.3 release/2.10.6 category/reliability The function does not work properly in certain specific environments or failures. e.g. data lost labels Sep 21, 2023
@poorbarcode poorbarcode added this to the 3.2.0 milestone Sep 21, 2023

@Test
public void testLookupThrottling() throws Exception {
PulsarClientImpl client = (PulsarClientImpl) PulsarClient.builder()
Copy link
Contributor

Choose a reason for hiding this comment

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

close the client

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@codecov-commenter
Copy link

Codecov Report

Merging #21216 (addd907) into master (eefc517) will increase coverage by 36.09%.
Report is 3 commits behind head on master.
The diff coverage is 100.00%.

Impacted file tree graph

@@              Coverage Diff              @@
##             master   #21216       +/-   ##
=============================================
+ Coverage     36.75%   72.85%   +36.09%     
+ Complexity    12193     3684     -8509     
=============================================
  Files          1698     1887      +189     
  Lines        130430   140118     +9688     
  Branches      14250    15426     +1176     
=============================================
+ Hits          47940   102081    +54141     
+ Misses        76167    29931    -46236     
- Partials       6323     8106     +1783     
Flag Coverage Δ
inttests 24.21% <0.00%> (+0.07%) ⬆️
systests 24.79% <0.00%> (+0.02%) ⬆️
unittests 72.11% <100.00%> (+40.22%) ⬆️

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

Files Changed Coverage Δ
...apache/pulsar/proxy/server/LookupProxyHandler.java 60.16% <100.00%> (+17.37%) ⬆️

... and 1456 files with indirect coverage changes

@poorbarcode poorbarcode merged commit d6c3fa4 into apache:master Sep 21, 2023
@heesung-sn
Copy link
Contributor

LGTM

poorbarcode added a commit that referenced this pull request Sep 24, 2023
… many requests (#21216)

Motivation: The Pulsar client will close the socket if it receives a `ServiceNotReady` error when doing a lookup. The Broker will respond to the client with a `TooManyRequests` error if there are too many lookup requests in progress, but the Pulsar Proxy responds to the client with a `ServiceNotReady` error in the same scenario.

Modifications: Make Pulsar Proxy respond to the client with a `TooManyRequests` error if there are too many lookup requests in progress.
(cherry picked from commit d6c3fa4)
poorbarcode added a commit that referenced this pull request Sep 24, 2023
… many requests (#21216)

Motivation: The Pulsar client will close the socket if it receives a `ServiceNotReady` error when doing a lookup. The Broker will respond to the client with a `TooManyRequests` error if there are too many lookup requests in progress, but the Pulsar Proxy responds to the client with a `ServiceNotReady` error in the same scenario.

Modifications: Make Pulsar Proxy respond to the client with a `TooManyRequests` error if there are too many lookup requests in progress.
(cherry picked from commit d6c3fa4)
poorbarcode added a commit that referenced this pull request Sep 24, 2023
… many requests (#21216)

Motivation: The Pulsar client will close the socket if it receives a `ServiceNotReady` error when doing a lookup. The Broker will respond to the client with a `TooManyRequests` error if there are too many lookup requests in progress, but the Pulsar Proxy responds to the client with a `ServiceNotReady` error in the same scenario.

Modifications: Make Pulsar Proxy respond to the client with a `TooManyRequests` error if there are too many lookup requests in progress.
(cherry picked from commit d6c3fa4)
mukesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Apr 15, 2024
… many requests (apache#21216)

Motivation: The Pulsar client will close the socket if it receives a `ServiceNotReady` error when doing a lookup. The Broker will respond to the client with a `TooManyRequests` error if there are too many lookup requests in progress, but the Pulsar Proxy responds to the client with a `ServiceNotReady` error in the same scenario.

Modifications: Make Pulsar Proxy respond to the client with a `TooManyRequests` error if there are too many lookup requests in progress.
(cherry picked from commit d6c3fa4)
(cherry picked from commit 9a7c4bb)
mukesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Apr 15, 2024
… many requests (apache#21216)

Motivation: The Pulsar client will close the socket if it receives a `ServiceNotReady` error when doing a lookup. The Broker will respond to the client with a `TooManyRequests` error if there are too many lookup requests in progress, but the Pulsar Proxy responds to the client with a `ServiceNotReady` error in the same scenario.

Modifications: Make Pulsar Proxy respond to the client with a `TooManyRequests` error if there are too many lookup requests in progress.
(cherry picked from commit d6c3fa4)
(cherry picked from commit 9a7c4bb)
mukesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Apr 17, 2024
… many requests (apache#21216)

Motivation: The Pulsar client will close the socket if it receives a `ServiceNotReady` error when doing a lookup. The Broker will respond to the client with a `TooManyRequests` error if there are too many lookup requests in progress, but the Pulsar Proxy responds to the client with a `ServiceNotReady` error in the same scenario.

Modifications: Make Pulsar Proxy respond to the client with a `TooManyRequests` error if there are too many lookup requests in progress.
(cherry picked from commit d6c3fa4)
(cherry picked from commit 9a7c4bb)
mukesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Apr 19, 2024
… many requests (apache#21216)

Motivation: The Pulsar client will close the socket if it receives a `ServiceNotReady` error when doing a lookup. The Broker will respond to the client with a `TooManyRequests` error if there are too many lookup requests in progress, but the Pulsar Proxy responds to the client with a `ServiceNotReady` error in the same scenario.

Modifications: Make Pulsar Proxy respond to the client with a `TooManyRequests` error if there are too many lookup requests in progress.
(cherry picked from commit d6c3fa4)
(cherry picked from commit 9a7c4bb)
mukesh-ctds added a commit to datastax/pulsar that referenced this pull request Apr 22, 2024
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Apr 23, 2024
… many requests (apache#21216)

Motivation: The Pulsar client will close the socket if it receives a `ServiceNotReady` error when doing a lookup. The Broker will respond to the client with a `TooManyRequests` error if there are too many lookup requests in progress, but the Pulsar Proxy responds to the client with a `ServiceNotReady` error in the same scenario.

Modifications: Make Pulsar Proxy respond to the client with a `TooManyRequests` error if there are too many lookup requests in progress.
(cherry picked from commit d6c3fa4)
(cherry picked from commit 9a7c4bb)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category/reliability The function does not work properly in certain specific environments or failures. e.g. data lost cherry-picked/branch-2.10 cherry-picked/branch-2.11 cherry-picked/branch-3.0 doc-not-needed Your PR changes do not impact docs ready-to-test release/2.10.6 release/2.11.3 release/3.0.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants