You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Nicolas Lu (Jira)" <ji...@apache.org> on 2026/08/25 15:16:00 UTC

[jira] [Assigned] (HDDS-16280) Avoid eager Preconditions message on hot paths

     [ https://issues.apache.org/jira/browse/HDDS-16280?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nicolas Lu reassigned HDDS-16280:
---------------------------------

    Assignee: Nicolas Lu

> 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
>
> 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: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org