mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 17:33:47 +00:00
swarm/storage: close dbStored when we are retrieving from LevelDB
This commit is contained in:
parent
4ffd38efb7
commit
61ffbbbe78
2 changed files with 7 additions and 4 deletions
|
|
@ -707,6 +707,7 @@ func (s *LDBStore) get(key Key) (chunk *Chunk, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
chunk = NewChunk(key, nil)
|
chunk = NewChunk(key, nil)
|
||||||
|
close(chunk.dbStored)
|
||||||
decodeData(data, chunk)
|
decodeData(data, chunk)
|
||||||
} else {
|
} else {
|
||||||
err = ErrChunkNotFound
|
err = ErrChunkNotFound
|
||||||
|
|
|
||||||
|
|
@ -230,6 +230,7 @@ func (s *MemStore) Get(hash Key) (chunk *Chunk, err error) {
|
||||||
l := hash.bits(bitpos, node.bits)
|
l := hash.bits(bitpos, node.bits)
|
||||||
st := node.subtree[l]
|
st := node.subtree[l]
|
||||||
if st == nil {
|
if st == nil {
|
||||||
|
log.Trace("memstore.get ErrChunkNotFound", "key", hash)
|
||||||
return nil, ErrChunkNotFound
|
return nil, ErrChunkNotFound
|
||||||
}
|
}
|
||||||
bitpos += node.bits
|
bitpos += node.bits
|
||||||
|
|
@ -251,6 +252,7 @@ func (s *MemStore) Get(hash Key) (chunk *Chunk, err error) {
|
||||||
err = ErrChunkNotFound
|
err = ErrChunkNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Trace("memstore.get return", "key", hash, "chunk", chunk, "err", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -298,11 +300,11 @@ func (s *MemStore) removeOldest() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Trace(fmt.Sprintf("Memstore Clean: Waiting for chunk %v to be saved", node.entry.Key.Log()))
|
|
||||||
<-node.entry.dbStored
|
|
||||||
log.Trace(fmt.Sprintf("Memstore Clean: Chunk %v saved to DBStore. Ready to clear from mem.", node.entry.Key.Log()))
|
|
||||||
|
|
||||||
if node.entry.ReqC == nil {
|
if node.entry.ReqC == nil {
|
||||||
|
log.Trace(fmt.Sprintf("Memstore Clean: Waiting for chunk %v to be saved", node.entry.Key.Log()))
|
||||||
|
<-node.entry.dbStored
|
||||||
|
log.Trace(fmt.Sprintf("Memstore Clean: Chunk %v saved to DBStore. Ready to clear from mem.", node.entry.Key.Log()))
|
||||||
|
|
||||||
memstoreRemoveCounter.Inc(1)
|
memstoreRemoveCounter.Inc(1)
|
||||||
node.entry = nil
|
node.entry = nil
|
||||||
s.entryCnt--
|
s.entryCnt--
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue