mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-23 04:03:49 +00:00
log db size if stage took longer than 1Minute (#1378)
* log db size * log db size
This commit is contained in:
parent
9a233da93d
commit
ed2b36ff04
@ -309,11 +309,11 @@ func (db *LmdbKV) Close() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (db *LmdbKV) DiskSize(_ context.Context) (uint64, error) {
|
func (db *LmdbKV) DiskSize(_ context.Context) (uint64, error) {
|
||||||
stats, err := db.env.Stat()
|
fileInfo, err := os.Stat(path.Join(db.opts.path, "data.mdb"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, fmt.Errorf("could not read database size: %w", err)
|
return 0, err
|
||||||
}
|
}
|
||||||
return uint64(stats.PSize) * (stats.LeafPages + stats.BranchPages + stats.OverflowPages), nil
|
return uint64(fileInfo.Size()), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *LmdbKV) Begin(_ context.Context, parent Tx, flags TxFlags) (Tx, error) {
|
func (db *LmdbKV) Begin(_ context.Context, parent Tx, flags TxFlags) (Tx, error) {
|
||||||
|
@ -269,11 +269,11 @@ func (db *MdbxKV) NewDbWithTheSameParameters() *ObjectDatabase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (db *MdbxKV) DiskSize(_ context.Context) (uint64, error) {
|
func (db *MdbxKV) DiskSize(_ context.Context) (uint64, error) {
|
||||||
stats, err := db.env.Stat()
|
fileInfo, err := os.Stat(path.Join(db.opts.path, "mdbx.dat"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, fmt.Errorf("could not read database size: %w", err)
|
return 0, err
|
||||||
}
|
}
|
||||||
return uint64(stats.PSize) * (stats.LeafPages + stats.BranchPages + stats.OverflowPages), nil
|
return uint64(fileInfo.Size()), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *MdbxKV) Begin(_ context.Context, parent Tx, flags TxFlags) (Tx, error) {
|
func (db *MdbxKV) Begin(_ context.Context, parent Tx, flags TxFlags) (Tx, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user