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

Limit the log line length for s3 deletion error #123953

Merged

Conversation

ywangd
Copy link
Member

@ywangd ywangd commented Mar 4, 2025

If all items fail to delete, the current warning log builds a huge string to include all of them (up to 1000). This PR limits the string length to first 10 entries.

Relates: #123630

If all items fail to delete, the current warning log builds a huge
string to include all of them (up to 1000). This PR limits the string to
a length of 1000 characters.

Relates: elastic#123630
@ywangd ywangd added >non-issue :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs v8.19.0 v9.1.0 labels Mar 4, 2025
@ywangd ywangd requested review from pxsalehi and DaveCTurner March 4, 2025 04:22
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Coordination Meta label for Distributed Coordination team label Mar 4, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination)

Copy link
Contributor

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

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

Yes fair point LGTM

() -> format(
"Failed to delete some blobs %s",
e.getErrors()
logger.warn(() -> {
Copy link
Member

Choose a reason for hiding this comment

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

I guess it makes sense to not spit out all of the blob names. But two nits: could we instead just pick the first N items rather than truncating it like this? Also since this is a WARN for an error case, having the runnable for the logger isn't really helping much, just makes it harder to read, IMO. Can we pull that out?

Copy link
Member Author

Choose a reason for hiding this comment

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

Pushe 5d67feb which should address both suggestions. Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

Btw the usage of Strings.collectionToDelimitedStringWithLimit was modelled after this. It might be worthwhile to extract a new common method for both as well.

@ywangd ywangd requested a review from pxsalehi March 5, 2025 04:00
@ywangd ywangd added auto-backport Automatically create backport pull requests when merged auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) labels Mar 5, 2025
@ywangd
Copy link
Member Author

ywangd commented Mar 5, 2025

@elasticmachine update branch

@elasticsearchmachine elasticsearchmachine merged commit a9432ba into elastic:main Mar 6, 2025
17 checks passed
@ywangd ywangd deleted the limit-s3-deletion-warn-log-length branch March 6, 2025 01:02
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.x Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 123953

@ywangd
Copy link
Member Author

ywangd commented Mar 6, 2025

💚 All backports created successfully

Status Branch Result
8.x

Questions ?

Please refer to the Backport tool documentation

ywangd added a commit to ywangd/elasticsearch that referenced this pull request Mar 6, 2025
If all items fail to delete, the current warning log builds a huge
string to include all of them (up to 1000). This PR limits the string
length to first 10 entries.

Relates: elastic#123630
(cherry picked from commit a9432ba)

# Conflicts:
#	modules/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3BlobStore.java
#	modules/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3BlobContainerRetriesTests.java
elasticsearchmachine pushed a commit that referenced this pull request Mar 6, 2025
)

* Limit the log line length for s3 deletion error (#123953)

If all items fail to delete, the current warning log builds a huge
string to include all of them (up to 1000). This PR limits the string
length to first 10 entries.

Relates: #123630
(cherry picked from commit a9432ba)

# Conflicts:
#	modules/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3BlobStore.java
#	modules/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3BlobContainerRetriesTests.java

* fix backport
georgewallace pushed a commit to georgewallace/elasticsearch that referenced this pull request Mar 11, 2025
If all items fail to delete, the current warning log builds a huge
string to include all of them (up to 1000). This PR limits the string
length to first 10 entries.

Relates: elastic#123630
costin pushed a commit to costin/elasticsearch that referenced this pull request Mar 15, 2025
If all items fail to delete, the current warning log builds a huge
string to include all of them (up to 1000). This PR limits the string
length to first 10 entries.

Relates: elastic#123630
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport pending :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >non-issue Team:Distributed Coordination Meta label for Distributed Coordination team v8.19.0 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants