Issue
etcd.Engine.AppliedIndex() (internal/raftengine/etcd/engine.go:560-567) takes e.mu.RLock() on every call. Under high read concurrency this contends with the Raft Ready loop's refreshStatus write lock (~100 Hz at current tick interval). Performance reviewer flagged as HIGH on PR #549.
Fix
Mirror e.applied uint64 into an atomic.Uint64. AppliedIndex() returns the atomic load with no lock.
Acceptance
- Hot-path
LeaseRead benchmark: AppliedIndex cost drops from ~50 ns (RLock) to ~5 ns (atomic load).
- No correctness regression: existing tests pass;
Status().AppliedIndex may continue to use the locked path if needed for snapshot semantics.
References: PR #549 (deferred).
Issue
etcd.Engine.AppliedIndex()(internal/raftengine/etcd/engine.go:560-567) takese.mu.RLock()on every call. Under high read concurrency this contends with the Raft Ready loop'srefreshStatuswrite lock (~100 Hz at current tick interval). Performance reviewer flagged as HIGH on PR #549.Fix
Mirror
e.applied uint64into anatomic.Uint64.AppliedIndex()returns the atomic load with no lock.Acceptance
LeaseReadbenchmark:AppliedIndexcost drops from ~50 ns (RLock) to ~5 ns (atomic load).Status().AppliedIndexmay continue to use the locked path if needed for snapshot semantics.References: PR #549 (deferred).