diff --git a/pkg/storage/spanlatch/manager.go b/pkg/storage/spanlatch/manager.go index 4d5d071e8e5e..89fc6483b001 100644 --- a/pkg/storage/spanlatch/manager.go +++ b/pkg/storage/spanlatch/manager.go @@ -259,7 +259,7 @@ func (m *Manager) insertLocked(lg *Guard) { latches := lg.latches(s, a) for i := range latches { latch := &latches[i] - latch.id = m.nextID() + latch.id = m.nextIDLocked() switch a { case spanset.SpanReadOnly: // Add reads to the readSet. They only need to enter @@ -277,7 +277,7 @@ func (m *Manager) insertLocked(lg *Guard) { } } -func (m *Manager) nextID() uint64 { +func (m *Manager) nextIDLocked() uint64 { m.idAlloc++ return m.idAlloc } diff --git a/pkg/storage/spanlatch/manager_test.go b/pkg/storage/spanlatch/manager_test.go index 8641e2d3e857..fc7b105ba9e2 100644 --- a/pkg/storage/spanlatch/manager_test.go +++ b/pkg/storage/spanlatch/manager_test.go @@ -119,7 +119,7 @@ func TestLatchManager(t *testing.T) { defer leaktest.AfterTest(t)() var m Manager - // Try latch with no overlapping already-acquired lathes. + // Try latches with no overlapping already-acquired lathes. lg1 := m.MustAcquire(spans("a", "", write), zeroTS) m.Release(lg1)