[
https://issues.apache.org/jira/browse/HDDS-16280?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Attila Doroszlai resolved HDDS-16280.
-------------------------------------
Fix Version/s: 2.3.0
Resolution: Fixed
> Avoid eager Preconditions message on hot paths
> ----------------------------------------------
>
> Key: HDDS-16280
> URL: https://issues.apache.org/jira/browse/HDDS-16280
> Project: Apache Ozone
> Issue Type: Sub-task
> Reporter: Huang Kuan Hao
> Assignee: Nicolas Lu
> Priority: Major
> Labels: pull-request-available
> Fix For: 2.3.0
>
>
> Preconditions.checkState(cond, "..." + value + "...") builds the message
> eagerly on every call even when the check passes — on each commit-watch (per
> write ack) and each snapshot reference release:
> Preconditions.checkState(updated >= index, "Returned index " + updated + " <
> expected " + index);
> ...
> Preconditions.checkState(threadMap.get(tid) > 0L, "This thread " + tid + "
> already have a reference count of zero.");
> Fix: use Guava's varargs template (message built only on failure):
> Preconditions.checkState(updated >= index, "Returned index %s < expected %s",
> updated, index);
> ...
> Preconditions.checkState(threadMap.get(tid) > 0L, "This thread %s already
> have a reference count of zero.", tid);
> Behavior unchanged (identical message on failure).
> Files: hadoop-hdds/client/.../XceiverClientRatis.java:311,
> hadoop-ozone/ozone-manager/.../snapshot/ReferenceCounted.java:111
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]