Huang Kuan Hao created HDDS-16280:
-------------------------------------
Summary: 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
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]