backupds: handle log bool in shed
This commit is contained in:
parent
bb79eba74c
commit
924c419e61
@ -180,8 +180,11 @@ var datastoreBackupStatCmd = &cli.Command{
|
||||
}
|
||||
defer f.Close() // nolint:errcheck
|
||||
|
||||
var keys, kbytes, vbytes uint64
|
||||
err = backupds.ReadBackup(f, func(key datastore.Key, value []byte) error {
|
||||
var keys, logs, kbytes, vbytes uint64
|
||||
err = backupds.ReadBackup(f, func(key datastore.Key, value []byte, log bool) error {
|
||||
if log {
|
||||
logs++
|
||||
}
|
||||
keys++
|
||||
kbytes += uint64(len(key.String()))
|
||||
vbytes += uint64(len(value))
|
||||
@ -192,6 +195,7 @@ var datastoreBackupStatCmd = &cli.Command{
|
||||
}
|
||||
|
||||
fmt.Println("Keys: ", keys)
|
||||
fmt.Println("Log values: ", log)
|
||||
fmt.Println("Key bytes: ", units.BytesSize(float64(kbytes)))
|
||||
fmt.Println("Value bytes: ", units.BytesSize(float64(vbytes)))
|
||||
|
||||
@ -225,7 +229,7 @@ var datastoreBackupListCmd = &cli.Command{
|
||||
defer f.Close() // nolint:errcheck
|
||||
|
||||
printKv := kvPrinter(cctx.Bool("top-level"), cctx.String("get-enc"))
|
||||
err = backupds.ReadBackup(f, func(key datastore.Key, value []byte) error {
|
||||
err = backupds.ReadBackup(f, func(key datastore.Key, value []byte, _ bool) error {
|
||||
return printKv(key.String(), value)
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -177,7 +177,7 @@ func (d *Datastore) openLog(p string) (*logfile, string, error) {
|
||||
return nil, "", xerrors.Errorf("logfile %s validated %d bytes, but the file has %d bytes (%d more)", p, at, end, end-at)
|
||||
}
|
||||
|
||||
compact := logvals > vals * int64(compactThresh)
|
||||
compact := logvals > vals*int64(compactThresh)
|
||||
if compact {
|
||||
log.Infow("compacting log", "current", p, "openCount", openCount, "baseValues", vals, "logValues", logvals)
|
||||
if err := f.Close(); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user