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

Fix a few toString implementations+usages that affect test performance #112380

Merged

Conversation

original-brownbear
Copy link
Member

No need to precompute the toString for ActionListener and Releasable, that's quite expensive at times (taking like 30s across all threads for server:integTestCase needlessly). Also string concat is way faster than formating these days, so use that in the transport channels. Lastly, short-circuit some obvious spots in network address serialization and remove code that duplicates the JDK (remove the IPV4 specific forbidden API because it makes no sense, but still needed to disable the check to make the build green because of the exclude on the parent class).

No need to precompute the toString for `ActionListener` and
`Releasable`, that's quite expensive at times. Also string concat is way
faster than formating these days, so use that in the transport channels.
Lastly, short-circuit some obvious spots in network address
serialization and remove code that duplicates the JDK (remove the IPV4
specific forbidden API because it makes no sense, but still needed to
disable the check to make the build green because of the exclude on the
parent class).
@original-brownbear original-brownbear added >non-issue :Core/Infra/Core Core issues without another label labels Aug 29, 2024
@original-brownbear original-brownbear requested a review from a team as a code owner August 29, 2024 22:38
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@elasticsearchmachine elasticsearchmachine added v8.16.0 Team:Core/Infra Meta label for core/infra team labels Aug 29, 2024
@@ -246,14 +247,14 @@ public static String toUriString(InetAddress ip) {
* @return {@code String} containing the text-formatted IP address
* @since 10.0
*/
@SuppressForbidden(reason = "java.net.Inet4Address#getHostAddress() is fine no need to duplicate its code")
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment for this suggests "use NetworkAddress format() to print IP or IP+ports". Is that a better way to achieve this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure, I think the problem is only with the ipv6 version of this method, but it seems impossible to selectively catch that only with forbidden apis?

@original-brownbear original-brownbear merged commit 306491a into elastic:main Aug 30, 2024
16 checks passed
@original-brownbear original-brownbear deleted the fix-toString-for-tests branch August 30, 2024 13:17
dakrone pushed a commit to dakrone/elasticsearch that referenced this pull request Aug 30, 2024
elastic#112380)

No need to precompute the toString for `ActionListener` and
`Releasable`, that's quite expensive at times. Also string concat is way
faster than formating these days, so use that in the transport channels.
Lastly, short-circuit some obvious spots in network address
serialization and remove code that duplicates the JDK (remove the IPV4
specific forbidden API because it makes no sense, but still needed to
disable the check to make the build green because of the exclude on the
parent class).
cbuescher pushed a commit to cbuescher/elasticsearch that referenced this pull request Sep 4, 2024
elastic#112380)

No need to precompute the toString for `ActionListener` and
`Releasable`, that's quite expensive at times. Also string concat is way
faster than formating these days, so use that in the transport channels.
Lastly, short-circuit some obvious spots in network address
serialization and remove code that duplicates the JDK (remove the IPV4
specific forbidden API because it makes no sense, but still needed to
disable the check to make the build green because of the exclude on the
parent class).
@original-brownbear original-brownbear restored the fix-toString-for-tests branch November 30, 2024 10:07
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Mar 12, 2025
In elastic#112380 we changed this `assert` to yield a `String` on failure
rather than the original `ElasticsearchException`, which means we don't
see the original completion's stack trace any more. This commit
reinstates the lost stack trace.
elasticsearchmachine pushed a commit that referenced this pull request Mar 13, 2025
In #112380 we changed this `assert` to yield a `String` on failure
rather than the original `ElasticsearchException`, which means we don't
see the original completion's stack trace any more. This commit
reinstates the lost stack trace.
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Mar 13, 2025
In elastic#112380 we changed this `assert` to yield a `String` on failure
rather than the original `ElasticsearchException`, which means we don't
see the original completion's stack trace any more. This commit
reinstates the lost stack trace.
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Mar 13, 2025
In elastic#112380 we changed this `assert` to yield a `String` on failure
rather than the original `ElasticsearchException`, which means we don't
see the original completion's stack trace any more. This commit
reinstates the lost stack trace.
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Mar 13, 2025
In elastic#112380 we changed this `assert` to yield a `String` on failure
rather than the original `ElasticsearchException`, which means we don't
see the original completion's stack trace any more. This commit
reinstates the lost stack trace.
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Mar 13, 2025
In elastic#112380 we changed this `assert` to yield a `String` on failure
rather than the original `ElasticsearchException`, which means we don't
see the original completion's stack trace any more. This commit
reinstates the lost stack trace.
elasticsearchmachine pushed a commit that referenced this pull request Mar 13, 2025
In #112380 we changed this `assert` to yield a `String` on failure
rather than the original `ElasticsearchException`, which means we don't
see the original completion's stack trace any more. This commit
reinstates the lost stack trace.
elasticsearchmachine pushed a commit that referenced this pull request Mar 13, 2025
In #112380 we changed this `assert` to yield a `String` on failure
rather than the original `ElasticsearchException`, which means we don't
see the original completion's stack trace any more. This commit
reinstates the lost stack trace.
elasticsearchmachine pushed a commit that referenced this pull request Mar 13, 2025
In #112380 we changed this `assert` to yield a `String` on failure
rather than the original `ElasticsearchException`, which means we don't
see the original completion's stack trace any more. This commit
reinstates the lost stack trace.
elasticsearchmachine pushed a commit that referenced this pull request Mar 13, 2025
In #112380 we changed this `assert` to yield a `String` on failure
rather than the original `ElasticsearchException`, which means we don't
see the original completion's stack trace any more. This commit
reinstates the lost stack trace.
albertzaharovits pushed a commit to albertzaharovits/elasticsearch that referenced this pull request Mar 13, 2025
In elastic#112380 we changed this `assert` to yield a `String` on failure
rather than the original `ElasticsearchException`, which means we don't
see the original completion's stack trace any more. This commit
reinstates the lost stack trace.
jfreden pushed a commit to jfreden/elasticsearch that referenced this pull request Mar 13, 2025
In elastic#112380 we changed this `assert` to yield a `String` on failure
rather than the original `ElasticsearchException`, which means we don't
see the original completion's stack trace any more. This commit
reinstates the lost stack trace.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Core Core issues without another label >non-issue Team:Core/Infra Meta label for core/infra team v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants