Log key on db misses (#45)
This commit is contained in:
parent
b706c596c5
commit
fd19af396d
@ -18,6 +18,7 @@ package pgipfsethdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"database/sql"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
@ -28,6 +29,7 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/ethdb"
|
"github.com/ethereum/go-ethereum/ethdb"
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/jmoiron/sqlx"
|
||||||
"github.com/mailgun/groupcache/v2"
|
"github.com/mailgun/groupcache/v2"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
var errNotSupported = errors.New("this operation is not supported")
|
var errNotSupported = errors.New("this operation is not supported")
|
||||||
@ -113,7 +115,12 @@ func (d *Database) Has(key []byte) (bool, error) {
|
|||||||
// Get retrieves the given key if it's present in the key-value data store
|
// Get retrieves the given key if it's present in the key-value data store
|
||||||
func (d *Database) dbGet(key string) ([]byte, error) {
|
func (d *Database) dbGet(key string) ([]byte, error) {
|
||||||
var data []byte
|
var data []byte
|
||||||
return data, d.db.Get(&data, getPgStr, key)
|
err := d.db.Get(&data, getPgStr, key)
|
||||||
|
if err == sql.ErrNoRows {
|
||||||
|
log.Warn("Database miss for key", key)
|
||||||
|
}
|
||||||
|
|
||||||
|
return data, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get satisfies the ethdb.KeyValueReader interface
|
// Get satisfies the ethdb.KeyValueReader interface
|
||||||
|
Loading…
Reference in New Issue
Block a user