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][broker] Do not print error logs for NotFound or Conflict errors when using the Admin API #23928

Merged
merged 3 commits into from
Feb 6, 2025

Conversation

RobertIndie
Copy link
Member

@RobertIndie RobertIndie commented Feb 5, 2025

Motivation

Currently, when there is a 404 or 409 error in the Admin API call, the broker prints the error logs.

ERROR org.apache.pulsar.broker.admin.v2.PersistentTopics - [xxx] Failed to get partitioned metadata topic persistent://xxx: Namespace not found
ERROR org.apache.pulsar.broker.admin.v2.Namespaces - Failed to get policies for namespace xxx: Namespace does not exist
ERROR org.apache.pulsar.broker.admin.v2.PersistentTopics - [xxx] Failed to create non-partitioned topic persistent:/xxx: This topic already exists
 [pulsar-web-44-1] ERROR org.apache.pulsar.broker.admin.AdminResource - [admin] Failed to create partitioned topic persistent://xxx

java.util.concurrent.CompletionException: org.apache.pulsar.broker.web.RestException: This topic already exists

These errors are related to the client side. The client can handle the error, so we don't need to print it in the broker log.

Modifications

  • Print a warning log for NotFound or Conflict errors in the Admin API.

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

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

Matching PR in forked repository

PR in forked repository:

@RobertIndie RobertIndie added type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages area/broker release/3.0.10 release/3.3.5 release/4.0.3 labels Feb 5, 2025
@RobertIndie RobertIndie added this to the 4.1.0 milestone Feb 5, 2025
@RobertIndie RobertIndie self-assigned this Feb 5, 2025
Copy link

github-actions bot commented Feb 5, 2025

@RobertIndie Please add the following content to your PR description and select a checkbox:

- [ ] `doc` <!-- Your PR contains doc changes -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->

@github-actions github-actions bot added doc-not-needed Your PR changes do not impact docs and removed doc-label-missing labels Feb 5, 2025
@RobertIndie RobertIndie marked this pull request as ready for review February 5, 2025 10:21
@codecov-commenter
Copy link

codecov-commenter commented Feb 5, 2025

Codecov Report

Attention: Patch coverage is 78.57143% with 3 lines in your changes missing coverage. Please review.

Project coverage is 74.24%. Comparing base (bbc6224) to head (2b702dd).
Report is 883 commits behind head on master.

Files with missing lines Patch % Lines
.../org/apache/pulsar/broker/admin/v2/Namespaces.java 33.33% 1 Missing and 1 partial ⚠️
.../org/apache/pulsar/broker/admin/AdminResource.java 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #23928      +/-   ##
============================================
+ Coverage     73.57%   74.24%   +0.67%     
+ Complexity    32624    31883     -741     
============================================
  Files          1877     1853      -24     
  Lines        139502   143747    +4245     
  Branches      15299    16341    +1042     
============================================
+ Hits         102638   106727    +4089     
+ Misses        28908    28628     -280     
- Partials       7956     8392     +436     
Flag Coverage Δ
inttests 26.65% <21.42%> (+2.06%) ⬆️
systests 23.23% <21.42%> (-1.09%) ⬇️
unittests 73.75% <71.42%> (+0.90%) ⬆️

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

Files with missing lines Coverage Δ
...pache/pulsar/broker/admin/v2/PersistentTopics.java 88.61% <100.00%> (+7.67%) ⬆️
.../org/apache/pulsar/broker/admin/AdminResource.java 77.43% <88.88%> (-0.19%) ⬇️
.../org/apache/pulsar/broker/admin/v2/Namespaces.java 90.60% <33.33%> (+21.50%) ⬆️

... and 1032 files with indirect coverage changes

Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

LGTM

@RobertIndie RobertIndie merged commit 99dc74b into apache:master Feb 6, 2025
52 checks passed
RobertIndie added a commit that referenced this pull request Feb 7, 2025
…rors when using the Admin API (#23928)

### Motivation

Currently, when there is a 404 or 409 error in the Admin API call, the broker prints the error logs.

```
ERROR org.apache.pulsar.broker.admin.v2.PersistentTopics - [xxx] Failed to get partitioned metadata topic persistent://xxx: Namespace not found
```

```
ERROR org.apache.pulsar.broker.admin.v2.Namespaces - Failed to get policies for namespace xxx: Namespace does not exist
```

```
ERROR org.apache.pulsar.broker.admin.v2.PersistentTopics - [xxx] Failed to create non-partitioned topic persistent:/xxx: This topic already exists
```

```
 [pulsar-web-44-1] ERROR org.apache.pulsar.broker.admin.AdminResource - [admin] Failed to create partitioned topic persistent://xxx

java.util.concurrent.CompletionException: org.apache.pulsar.broker.web.RestException: This topic already exists
```

These errors are related to the client side. The client can handle the error, so we don't need to print it in the broker log.

### Modifications

- Print a warning log for NotFound or Conflict errors in the Admin API.

(cherry picked from commit 99dc74b)
RobertIndie added a commit that referenced this pull request Feb 7, 2025
…rors when using the Admin API (#23928)

### Motivation

Currently, when there is a 404 or 409 error in the Admin API call, the broker prints the error logs.

```
ERROR org.apache.pulsar.broker.admin.v2.PersistentTopics - [xxx] Failed to get partitioned metadata topic persistent://xxx: Namespace not found
```

```
ERROR org.apache.pulsar.broker.admin.v2.Namespaces - Failed to get policies for namespace xxx: Namespace does not exist
```

```
ERROR org.apache.pulsar.broker.admin.v2.PersistentTopics - [xxx] Failed to create non-partitioned topic persistent:/xxx: This topic already exists
```

```
 [pulsar-web-44-1] ERROR org.apache.pulsar.broker.admin.AdminResource - [admin] Failed to create partitioned topic persistent://xxx

java.util.concurrent.CompletionException: org.apache.pulsar.broker.web.RestException: This topic already exists
```

These errors are related to the client side. The client can handle the error, so we don't need to print it in the broker log.

### Modifications

- Print a warning log for NotFound or Conflict errors in the Admin API.

(cherry picked from commit 99dc74b)
RobertIndie added a commit that referenced this pull request Feb 7, 2025
…rors when using the Admin API (#23928)

### Motivation

Currently, when there is a 404 or 409 error in the Admin API call, the broker prints the error logs.

```
ERROR org.apache.pulsar.broker.admin.v2.PersistentTopics - [xxx] Failed to get partitioned metadata topic persistent://xxx: Namespace not found
```

```
ERROR org.apache.pulsar.broker.admin.v2.Namespaces - Failed to get policies for namespace xxx: Namespace does not exist
```

```
ERROR org.apache.pulsar.broker.admin.v2.PersistentTopics - [xxx] Failed to create non-partitioned topic persistent:/xxx: This topic already exists
```

```
 [pulsar-web-44-1] ERROR org.apache.pulsar.broker.admin.AdminResource - [admin] Failed to create partitioned topic persistent://xxx

java.util.concurrent.CompletionException: org.apache.pulsar.broker.web.RestException: This topic already exists
```

These errors are related to the client side. The client can handle the error, so we don't need to print it in the broker log.

### Modifications

- Print a warning log for NotFound or Conflict errors in the Admin API.

(cherry picked from commit 99dc74b)
nodece pushed a commit to ascentstream/pulsar that referenced this pull request Feb 10, 2025
…rors when using the Admin API (apache#23928)

### Motivation

Currently, when there is a 404 or 409 error in the Admin API call, the broker prints the error logs.

```
ERROR org.apache.pulsar.broker.admin.v2.PersistentTopics - [xxx] Failed to get partitioned metadata topic persistent://xxx: Namespace not found
```

```
ERROR org.apache.pulsar.broker.admin.v2.Namespaces - Failed to get policies for namespace xxx: Namespace does not exist
```

```
ERROR org.apache.pulsar.broker.admin.v2.PersistentTopics - [xxx] Failed to create non-partitioned topic persistent:/xxx: This topic already exists
```

```
 [pulsar-web-44-1] ERROR org.apache.pulsar.broker.admin.AdminResource - [admin] Failed to create partitioned topic persistent://xxx

java.util.concurrent.CompletionException: org.apache.pulsar.broker.web.RestException: This topic already exists
```

These errors are related to the client side. The client can handle the error, so we don't need to print it in the broker log.

### Modifications

- Print a warning log for NotFound or Conflict errors in the Admin API.

(cherry picked from commit 99dc74b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/broker cherry-picked/branch-3.0 cherry-picked/branch-3.3 cherry-picked/branch-4.0 doc-not-needed Your PR changes do not impact docs ready-to-test release/3.0.10 release/3.3.5 release/4.0.3 type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants