dont re-read whole db to calculate file size (#658)

This commit is contained in:
Alex Sharov 2020-06-13 19:41:38 +07:00 committed by GitHub
parent 99b9c0fa99
commit b78a6336d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -203,11 +203,7 @@ func (db *LmdbKV) Close() {
}
func (db *LmdbKV) DiskSize(_ context.Context) (common.StorageSize, error) {
stats, err := db.env.Stat()
if err != nil {
return 0, fmt.Errorf("could not read database size: %w", err)
}
return common.StorageSize(uint64(stats.PSize) * (stats.LeafPages + stats.BranchPages + stats.OverflowPages)), nil
return common.StorageSize(0), nil
}
func (db *LmdbKV) BucketsStat(_ context.Context) (map[string]common.StorageBucketWriteStats, error) {