diff --git a/swarm/storage/ldbstore.go b/swarm/storage/ldbstore.go index 8bc080c1ba..6619a02d5b 100644 --- a/swarm/storage/ldbstore.go +++ b/swarm/storage/ldbstore.go @@ -546,6 +546,7 @@ func (s *LDBStore) CurrentStorageIndex() uint64 { } func (s *LDBStore) Put(chunk *Chunk) { + log.Trace("ldbstore.put", "key", chunk.Key) ikey := getIndexKey(chunk.Key) var index dpaDBIndex @@ -553,6 +554,7 @@ func (s *LDBStore) Put(chunk *Chunk) { s.lock.Lock() defer s.lock.Unlock() + log.Trace("ldbstore.put: s.db.Get", "key", chunk.Key) idata, err := s.db.Get(ikey) if err != nil { s.doPut(chunk, ikey, &index, po) @@ -562,7 +564,7 @@ func (s *LDBStore) Put(chunk *Chunk) { close(chunk.dbStored) }() } else { - log.Trace(fmt.Sprintf("DbStore: chunk already exists, only update access")) + log.Trace("ldbstore.put: chunk already exists, only update access", "key", chunk.Key) decodeIndex(idata, &index) close(chunk.dbStored) } @@ -578,6 +580,7 @@ func (s *LDBStore) Put(chunk *Chunk) { // force putting into db, does not check access index func (s *LDBStore) doPut(chunk *Chunk, ikey []byte, index *dpaDBIndex, po uint8) { + log.Trace("ldbstore.doPut", "key", chunk.Key) data := s.encodeDataFunc(chunk) s.batch.Put(getDataKey(s.dataIdx, po), data) index.Idx = s.dataIdx @@ -659,6 +662,7 @@ func (s *LDBStore) tryAccessIdx(ikey []byte, index *dpaDBIndex) bool { } func (s *LDBStore) Get(key Key) (chunk *Chunk, err error) { + //log.Trace("ldbstore.get", "key", chunk.Key) - seems like chunk is nil sometimes s.lock.Lock() defer s.lock.Unlock() return s.get(key) @@ -671,6 +675,7 @@ func (s *LDBStore) get(key Key) (chunk *Chunk, err error) { var data []byte if s.getDataFunc != nil { // if getDataFunc is defined, use it to retrieve the chunk data + log.Trace("ldbstore.get retrieve with getDataFunc", "key", key) data, err = s.getDataFunc(key) if err != nil { return @@ -680,9 +685,9 @@ func (s *LDBStore) get(key Key) (chunk *Chunk, err error) { proximity := s.po(key) datakey := getDataKey(indx.Idx, proximity) data, err = s.db.Get(datakey) - log.Trace(fmt.Sprintf("DBStore: Chunk %v indexkey %v datakey %x proximity %d", key.Log(), indx.Idx, datakey, proximity)) + log.Trace("ldbstore.get retrieve", "key", key, "indexkey", indx.Idx, "datakey", datakey, "proximity", proximity) if err != nil { - log.Trace(fmt.Sprintf("DBStore: Chunk %v found but could not be accessed: %v", key.Log(), err)) + log.Trace("ldbstore.get chunk found but could not be accessed", "key", key, "err", err) s.delete(indx.Idx, getIndexKey(key), s.po(key)) return } diff --git a/swarm/storage/localstore.go b/swarm/storage/localstore.go index 1f38d518b6..d0fe062795 100644 --- a/swarm/storage/localstore.go +++ b/swarm/storage/localstore.go @@ -85,6 +85,7 @@ func (self *LocalStore) CacheCounter() uint64 { // LocalStore is itself a chunk store // unsafe, in that the data is not integrity checked func (self *LocalStore) Put(chunk *Chunk) { + log.Trace("localstore.put", "key", chunk.Key) self.mu.Lock() defer self.mu.Unlock() diff --git a/swarm/storage/memstore.go b/swarm/storage/memstore.go index ead9412b62..7f7c282dc4 100644 --- a/swarm/storage/memstore.go +++ b/swarm/storage/memstore.go @@ -144,6 +144,7 @@ func (s *MemStore) Counter() uint { // entry (not its copy) is going to be in MemStore func (s *MemStore) Put(entry *Chunk) { + log.Trace("memstore.put", "key", entry.Key) if s.capacity == 0 { return } @@ -219,6 +220,7 @@ func (s *MemStore) Put(entry *Chunk) { } func (s *MemStore) Get(hash Key) (chunk *Chunk, err error) { + log.Trace("memstore.get", "key", hash) s.lock.Lock() defer s.lock.Unlock()