Details
-
Sub-task
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
Impala 2.3.0
Description
The metrics in util/metrics.h use a spin lock to guard the metric value. Most metric values are 64-bit words (e.g. int64_t, uint64_t, double) so we could easily use atomic operations to get and set the value. The spinlock requires at minimum 2 atomic operations to lock and unlock in addition to the actual store, whereas get/set/increment can typically be done with one operation. It may also be reasonable to do a non-atomic read since x64 provides some guarantees about aligned reads of words.