Skip to content

Make S3 custom query parameter optional #128043

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

Conversation

DaveCTurner
Copy link
Contributor

@DaveCTurner DaveCTurner commented May 12, 2025

Today Elasticsearch will record the purpose for each request to S3 using
a custom query parameter1. This isn't believed to be necessary outside of
the ECH/ECE/ECK/... managed services, and it adds rather a lot to the
request logs, so with this commit we make the feature optional and
disabled by default.

Footnotes

  1. https://docs.aws.amazon.com/AmazonS3/latest/userguide/LogFormat.html#LogFormatCustom

@elasticsearchmachine
Copy link
Collaborator

Hi @DaveCTurner, I've created a changelog YAML for you. Note that since this PR is labelled >breaking, you need to update the changelog YAML to fill out the extended information sections.

@elasticsearchmachine elasticsearchmachine added the serverless-linked Added by automation, don't add manually label May 13, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @DaveCTurner, I've updated the changelog YAML for you. Note that since this PR is labelled >breaking, you need to update the changelog YAML to fill out the extended information sections.

Today Elasticsearch will record the purpose for each request to S3 using
a custom query parameter. This isn't believed to be necessary outside of
the ECH/ECE/ECK/... managed services, and it adds rather a lot to the
request logs, so with this commit we make the feature optional and
disabled by default.
@DaveCTurner DaveCTurner force-pushed the 2025/05/12/optional-s3-custom-query-parameter branch from 3fa7c30 to 6814d98 Compare May 13, 2025 11:47
@elasticsearchmachine
Copy link
Collaborator

Hi @DaveCTurner, I've updated the changelog YAML for you. Note that since this PR is labelled >breaking, you need to update the changelog YAML to fill out the extended information sections.

@DaveCTurner DaveCTurner marked this pull request as ready for review May 13, 2025 14:06
@DaveCTurner DaveCTurner requested a review from ywangd May 13, 2025 14:06
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Coordination Meta label for Distributed Coordination team label May 13, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine
Copy link
Collaborator

Hi @DaveCTurner, I've updated the changelog YAML for you. Note that since this PR is labelled >breaking, you need to update the changelog YAML to fill out the extended information sections.

@elasticsearchmachine
Copy link
Collaborator

Hi @DaveCTurner, I've updated the changelog YAML for you. Note that since this PR is labelled >breaking, you need to update the changelog YAML to fill out the extended information sections.

Copy link
Member

@ywangd ywangd left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +121 to +123
protected HttpHandler createHandler() {
return new AssertingHandler();
}
Copy link
Member

Choose a reason for hiding this comment

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

Should we make AssertingHandler delegate to the handler returned by super.createHandler() so that we don't miss the fix from #102976?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure see 6b91e9b. It doesn't really matter here, the test fails either way.

return new AssertingHandler();
}
};
httpFixture.apply(new Statement() {
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to stop the fixture explicitly especially when the test fails?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's handled within apply().

return;
}
}
repoAnalysisStarted.set(true);
Copy link
Member

Choose a reason for hiding this comment

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

I think it's more readable to move this statement to be the last statement inside the if (repoAnalysisStarted.get() == false) block.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok see 0e58906

if (request.path().startsWith("/bucket/base_path_integration_tests/temp-analysis-")) {
repoAnalysisStarted.set(true);
}
if (repoAnalysisStarted.get() == false) {
Copy link
Member

Choose a reason for hiding this comment

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

With #126593, the s3 fixture now runs with multiple threads. Is there any racing concern with checking the atomic boolean? I guess it's probably not an issue since operations before repo analysis are all sequential?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All the earlier operations relate to registering the repository and complete strictly before the start of repo analysis, regardless of concurrency in the handler.

@DaveCTurner DaveCTurner added auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) auto-backport Automatically create backport pull requests when merged labels May 20, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @DaveCTurner, I've updated the changelog YAML for you. Note that since this PR is labelled >breaking, you need to update the changelog YAML to fill out the extended information sections.

@elasticsearchmachine elasticsearchmachine merged commit 18c6079 into elastic:main May 20, 2025
17 checks passed
@DaveCTurner DaveCTurner deleted the 2025/05/12/optional-s3-custom-query-parameter branch May 20, 2025 07:15
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.19 Commit could not be cherrypicked due to conflicts
8.17 Commit could not be cherrypicked due to conflicts
8.18 Commit could not be cherrypicked due to conflicts
9.0 Commit could not be cherrypicked due to conflicts

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

DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request May 20, 2025
Today Elasticsearch will record the purpose for each request to S3 using
a custom query parameter[^1]. This isn't believed to be necessary
outside of the ECH/ECE/ECK/... managed services, and it adds rather a
lot to the request logs, so with this commit we make the feature
optional and disabled by default.

[^1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/LogFormat.html#LogFormatCustom

Backport of elastic#128043 to `9.0`
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request May 20, 2025
Today Elasticsearch will record the purpose for each request to S3 using
a custom query parameter[^1]. This isn't believed to be necessary
outside of the ECH/ECE/ECK/... managed services, and it adds rather a
lot to the request logs, so with this commit we make the feature
optional and disabled by default.

Backport of elastic#128043 to `9.0`

[^1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/LogFormat.html#LogFormatCustom
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 >breaking :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >enhancement serverless-linked Added by automation, don't add manually Team:Distributed Coordination Meta label for Distributed Coordination team v8.17.7 v8.18.2 v8.19.0 v9.0.2 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants