mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 01:43:47 +00:00
swarm/storage: fixup
This commit is contained in:
parent
69e1361566
commit
0c41ebcd53
1 changed files with 1 additions and 5 deletions
|
|
@ -451,14 +451,11 @@ func (s *LDBStore) ReIndex() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *LDBStore) delete(idx uint64, idxKey []byte, po uint8) {
|
func (s *LDBStore) delete(idx uint64, idxKey []byte, po uint8) {
|
||||||
log.Trace("LDBStore delete()", "idx", idx, "idxKey", fmt.Sprintf("%x", idxKey), "po", po)
|
|
||||||
|
|
||||||
batch := new(leveldb.Batch)
|
batch := new(leveldb.Batch)
|
||||||
batch.Delete(idxKey)
|
batch.Delete(idxKey)
|
||||||
batch.Delete(getDataKey(idx, po))
|
batch.Delete(getDataKey(idx, po))
|
||||||
dbStoreDeleteCounter.Inc(1)
|
dbStoreDeleteCounter.Inc(1)
|
||||||
s.entryCnt--
|
s.entryCnt--
|
||||||
log.Trace("delete s.entryCnt--", "entryCnt", s.entryCnt)
|
|
||||||
s.bucketCnt[po]--
|
s.bucketCnt[po]--
|
||||||
cntKey := make([]byte, 2)
|
cntKey := make([]byte, 2)
|
||||||
cntKey[0] = keyDistanceCnt
|
cntKey[0] = keyDistanceCnt
|
||||||
|
|
@ -528,7 +525,6 @@ func (s *LDBStore) doPut(chunk *Chunk, index *dpaDBIndex, po uint8) {
|
||||||
index.Idx = s.dataIdx
|
index.Idx = s.dataIdx
|
||||||
s.bucketCnt[po] = s.dataIdx
|
s.bucketCnt[po] = s.dataIdx
|
||||||
s.entryCnt++
|
s.entryCnt++
|
||||||
log.Trace("doPut entryCnt++", "entryCnt", s.entryCnt)
|
|
||||||
s.dataIdx++
|
s.dataIdx++
|
||||||
|
|
||||||
cntKey := make([]byte, 2)
|
cntKey := make([]byte, 2)
|
||||||
|
|
@ -553,7 +549,7 @@ func (s *LDBStore) writeBatches() {
|
||||||
log.Error(fmt.Sprintf("spawn batch write (%d entries): %v", b.Len(), err))
|
log.Error(fmt.Sprintf("spawn batch write (%d entries): %v", b.Len(), err))
|
||||||
}
|
}
|
||||||
close(c)
|
close(c)
|
||||||
if e >= s.capacity && int(float32(e-1)*gcArrayFreeRatio) > 0 {
|
if e >= s.capacity {
|
||||||
log.Trace(fmt.Sprintf("collecting garbage (%d chunks)", e))
|
log.Trace(fmt.Sprintf("collecting garbage (%d chunks)", e))
|
||||||
s.collectGarbage(gcArrayFreeRatio)
|
s.collectGarbage(gcArrayFreeRatio)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue