Compute total db size from stats
parent
4f42d2f1d6
commit
cea1df9365
|
@ -178,7 +178,7 @@ func main() {
|
|||
if err != nil {
|
||||
glog.Error("internalState: ", err)
|
||||
}
|
||||
glog.Info("DB size on disk: ", index.DatabaseSizeOnDisk())
|
||||
glog.Info("DB size on disk: ", index.DatabaseSizeOnDisk(), ", DB size as computed: ", internalState.DBSizeTotal())
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -113,6 +113,16 @@ func (is *InternalState) SetDBColumnStats(c int, rowsDiff int64, keysSumDiff int
|
|||
is.DbColumns[c].ValuesSum = valuesSumDiff
|
||||
}
|
||||
|
||||
func (is *InternalState) DBSizeTotal() int64 {
|
||||
is.mux.Lock()
|
||||
defer is.mux.Unlock()
|
||||
total := int64(0)
|
||||
for _, c := range is.DbColumns {
|
||||
total += c.KeysSum + c.ValuesSum
|
||||
}
|
||||
return total
|
||||
}
|
||||
|
||||
func (is *InternalState) Pack() ([]byte, error) {
|
||||
is.mux.Lock()
|
||||
defer is.mux.Unlock()
|
||||
|
|
Loading…
Reference in New Issue