tarun11Mavani commented on code in PR #19093: URL: https://github.com/apache/pinot/pull/19093#discussion_r3975776865
########## pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/openstruct/MutableOpenStructIndex.java: ########## @@ -63,12 +63,20 @@ public class MutableOpenStructIndex implements OpenStructIndexReader<ForwardInde private final PinotDataBufferMemoryManager _memoryManager; private final int _capacity; - // Volatile for lock-free reader access; writer always holds the consuming-thread lock. + // Volatile copy-on-write: the writer (consuming thread) creates a fresh HashMap copy and publishes + // atomically via volatile write (see allocateKeyColumn). Readers see a consistent snapshot of the + // entire map. ConcurrentHashMap is NOT appropriate here — it would allow readers to observe + // partially-updated state during a put. Single-writer is guaranteed by the Pinot consuming thread + // model (one thread per partition). private volatile Map<String, MutableKeyColumn> _keyColumns = new HashMap<>(); // Single-writer (see #index), but close() may run on a different thread, so volatile for // visibility; flushed to ServerMetrics on close() to avoid a metered-value call on every // ignored key of every consumed row. private volatile long _ignoredKeyDropCount; + // Batched for the same reason as _ignoredKeyDropCount: keep a metered-value call, which rebuilds + // the metric name and hits the registry, off the per-row consuming path. Flushed in close(). + private volatile long _typeCoercionFailureCount; Review Comment: Switched to live metering with cache. Thanks. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
