core/rawdb: use non-atomic load while holding mutex

This commit is contained in:
Marius van der Wijden 2020-04-14 14:40:51 +02:00
parent e1856f2bc3
commit 38064398af

View file

@ -552,12 +552,11 @@ func (t *freezerTable) Retrieve(item uint64) ([]byte, error) {
return nil, errOutOfBounds
}
// Ensure the item was not deleted from the tail either
offset := atomic.LoadUint32(&t.itemOffset)
if uint64(offset) > item {
if uint64(t.itemOffset) > item {
t.lock.RUnlock()
return nil, errOutOfBounds
}
startOffset, endOffset, filenum, err := t.getBounds(item - uint64(offset))
startOffset, endOffset, filenum, err := t.getBounds(item - uint64(t.itemOffset))
if err != nil {
t.lock.RUnlock()
return nil, err