mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
core/rawdb: use non-atomic load while holding mutex
This commit is contained in:
parent
090d7b0bdc
commit
cbb181c373
1 changed files with 2 additions and 3 deletions
|
|
@ -552,12 +552,11 @@ func (t *freezerTable) Retrieve(item uint64) ([]byte, error) {
|
||||||
return nil, errOutOfBounds
|
return nil, errOutOfBounds
|
||||||
}
|
}
|
||||||
// Ensure the item was not deleted from the tail either
|
// Ensure the item was not deleted from the tail either
|
||||||
offset := atomic.LoadUint32(&t.itemOffset)
|
if uint64(t.itemOffset) > item {
|
||||||
if uint64(offset) > item {
|
|
||||||
t.lock.RUnlock()
|
t.lock.RUnlock()
|
||||||
return nil, errOutOfBounds
|
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 {
|
if err != nil {
|
||||||
t.lock.RUnlock()
|
t.lock.RUnlock()
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue