From 54c2c0b2bbe3f5c649446f40244be9c20ddfebf8 Mon Sep 17 00:00:00 2001 From: dvovk Date: Mon, 20 May 2024 22:36:49 +0100 Subject: [PATCH 01/11] test db --- diagnostics/setup.go | 8 ++-- erigon-lib/diagnostics/client.go | 52 +++++++++++++++++++++++- erigon-lib/diagnostics/snapshots_test.go | 11 +++-- erigon-lib/diagnostics/sys_info.go | 6 +++ erigon-lib/kv/kv_interface.go | 17 +++++--- erigon-lib/kv/tables.go | 18 ++++++++ 6 files changed, 99 insertions(+), 13 deletions(-) diff --git a/diagnostics/setup.go b/diagnostics/setup.go index 7ce8b3a6d53..8c3ca329bcf 100644 --- a/diagnostics/setup.go +++ b/diagnostics/setup.go @@ -48,10 +48,12 @@ func Setup(ctx *cli.Context, node *node.ErigonNode, metricsMux *http.ServeMux, p diagMux = SetupDiagnosticsEndpoint(nil, diagAddress) } - diagnostic := diaglib.NewDiagnosticClient(diagMux, node.Backend().DataDir()) - diagnostic.Setup() + diagnostic, err := diaglib.NewDiagnosticClient(ctx.Context, diagMux, node.Backend().DataDir()) + if err == nil { + diagnostic.Setup() - SetupEndpoints(ctx, node, diagMux, diagnostic) + SetupEndpoints(ctx, node, diagMux, diagnostic) + } } func SetupDiagnosticsEndpoint(metricsMux *http.ServeMux, addres string) *http.ServeMux { diff --git a/erigon-lib/diagnostics/client.go b/erigon-lib/diagnostics/client.go index 284e46c1498..78a3a7ff3d9 100644 --- a/erigon-lib/diagnostics/client.go +++ b/erigon-lib/diagnostics/client.go @@ -1,13 +1,24 @@ package diagnostics import ( + "context" + "encoding/json" + "fmt" "net/http" + "path/filepath" "sync" + "github.com/c2h5oh/datasize" "github.com/ledgerwatch/erigon-lib/common" + "github.com/ledgerwatch/erigon-lib/kv" + "github.com/ledgerwatch/erigon-lib/kv/mdbx" + "github.com/ledgerwatch/log/v3" + "golang.org/x/sync/semaphore" ) type DiagnosticClient struct { + ctx context.Context + db kv.RwDB metricsMux *http.ServeMux dataDirPath string @@ -26,8 +37,18 @@ type DiagnosticClient struct { networkSpeedMutex sync.Mutex } -func NewDiagnosticClient(metricsMux *http.ServeMux, dataDirPath string) *DiagnosticClient { +func NewDiagnosticClient(ctx context.Context, metricsMux *http.ServeMux, dataDirPath string) (*DiagnosticClient, error) { + + // Create a new DiagnosticClient + dirPath := filepath.Join(dataDirPath, "diagnostics") + db, err := createDb(ctx, dirPath) + if err != nil { + return nil, err + } + return &DiagnosticClient{ + ctx: ctx, + db: db, metricsMux: metricsMux, dataDirPath: dataDirPath, syncStats: SyncStatistics{}, @@ -38,7 +59,24 @@ func NewDiagnosticClient(metricsMux *http.ServeMux, dataDirPath string) *Diagnos MemoryUsage: []MemoryStats{}, }, peersStats: NewPeerStats(1000), // 1000 is the limit of peers; TODO: make it configurable through a flag + }, nil +} + +func createDb(ctx context.Context, dbDir string) (db kv.RwDB, err error) { + db, err = mdbx.NewMDBX(log.New()). + Label(kv.DiagnosticsDB). + WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg { return kv.DiagnosticsTablesCfg }). + GrowthStep(4 * datasize.MB). + MapSize(16 * datasize.GB). + PageSize(uint64(4 * datasize.KB)). + RoTxsLimiter(semaphore.NewWeighted(9_000)). + Path(dbDir). + Open(ctx) + if err != nil { + return nil, fmt.Errorf("failed to open diagnostics db: %w", err) } + + return db, nil } func (d *DiagnosticClient) Setup() { @@ -58,6 +96,18 @@ func (d *DiagnosticClient) Setup() { //d.logDiagMsgs() } +func TestUpdater(ram string) func(tx kv.RwTx) error { + return func(tx kv.RwTx) error { + ramBytes, err := json.Marshal(ram) + + if err != nil { + return err + } + + return tx.Put(kv.HardwareInfo, []byte("ram"), ramBytes) + } +} + /*func (d *DiagnosticClient) logDiagMsgs() { ticker := time.NewTicker(20 * time.Second) quit := make(chan struct{}) diff --git a/erigon-lib/diagnostics/snapshots_test.go b/erigon-lib/diagnostics/snapshots_test.go index 9f56f9f4364..54157250c5d 100644 --- a/erigon-lib/diagnostics/snapshots_test.go +++ b/erigon-lib/diagnostics/snapshots_test.go @@ -1,6 +1,7 @@ package diagnostics_test import ( + "context" "testing" "github.com/ledgerwatch/erigon-lib/diagnostics" @@ -8,7 +9,8 @@ import ( ) func TestUpdateFileDownloadingStats(t *testing.T) { - d := diagnostics.NewDiagnosticClient(nil, "test") + d, err := diagnostics.NewDiagnosticClient(context.TODO(), nil, "test") + require.NoError(t, err) d.UpdateFileDownloadedStatistics(nil, &segmentDownloadStatsMock) @@ -20,7 +22,8 @@ func TestUpdateFileDownloadingStats(t *testing.T) { } func TestUpdateFileDownloadedStats(t *testing.T) { - d := diagnostics.NewDiagnosticClient(nil, "test") + d, err := diagnostics.NewDiagnosticClient(context.TODO(), nil, "test") + require.NoError(t, err) d.UpdateFileDownloadedStatistics(&fileDownloadedUpdMock, nil) @@ -42,7 +45,9 @@ func TestUpdateFileDownloadedStats(t *testing.T) { } func TestUpdateFileFullStatsUpdate(t *testing.T) { - d := diagnostics.NewDiagnosticClient(nil, "test") + d, err := diagnostics.NewDiagnosticClient(context.TODO(), nil, "test") + + require.NoError(t, err) d.UpdateFileDownloadedStatistics(nil, &segmentDownloadStatsMock) diff --git a/erigon-lib/diagnostics/sys_info.go b/erigon-lib/diagnostics/sys_info.go index 6b12ce1b80b..d725b87a92f 100644 --- a/erigon-lib/diagnostics/sys_info.go +++ b/erigon-lib/diagnostics/sys_info.go @@ -1,6 +1,8 @@ package diagnostics import ( + "fmt" + "github.com/ledgerwatch/erigon-lib/diskutils" "github.com/shirou/gopsutil/v3/cpu" "github.com/shirou/gopsutil/v3/disk" @@ -10,6 +12,10 @@ import ( func (d *DiagnosticClient) setupSysInfoDiagnostics() { sysInfo := GetSysInfo(d.dataDirPath) + if err := d.db.Update(d.ctx, TestUpdater(fmt.Sprint(sysInfo.RAM.Total))); err != nil { + fmt.Println("Error updating sysinfo") + } + d.mu.Lock() d.hardwareInfo = sysInfo d.mu.Unlock() diff --git a/erigon-lib/kv/kv_interface.go b/erigon-lib/kv/kv_interface.go index 1399d2a97d0..6e4df44fb3a 100644 --- a/erigon-lib/kv/kv_interface.go +++ b/erigon-lib/kv/kv_interface.go @@ -149,12 +149,13 @@ type DBVerbosityLvl int8 type Label uint8 const ( - ChainDB Label = 0 - TxPoolDB Label = 1 - SentryDB Label = 2 - ConsensusDB Label = 3 - DownloaderDB Label = 4 - InMem Label = 5 + ChainDB Label = 0 + TxPoolDB Label = 1 + SentryDB Label = 2 + ConsensusDB Label = 3 + DownloaderDB Label = 4 + InMem Label = 5 + DiagnosticsDB Label = 6 ) func (l Label) String() string { @@ -171,6 +172,8 @@ func (l Label) String() string { return "downloader" case InMem: return "inMem" + case DiagnosticsDB: + return "diagnostics" default: return "unknown" } @@ -189,6 +192,8 @@ func UnmarshalLabel(s string) Label { return DownloaderDB case "inMem": return InMem + case "diagnostics": + return DiagnosticsDB default: panic(fmt.Sprintf("unexpected label: %s", s)) } diff --git a/erigon-lib/kv/tables.go b/erigon-lib/kv/tables.go index b47e8c042a7..5d7dbe78d4a 100644 --- a/erigon-lib/kv/tables.go +++ b/erigon-lib/kv/tables.go @@ -510,6 +510,9 @@ const ( Proposers = "BlockProposers" // epoch => proposers indicies StatesProcessingProgress = "StatesProcessingProgress" + + //Diagnostics tables + HardwareInfo = "HardwareInfo" ) // Keys @@ -750,6 +753,11 @@ var ChaindataDeprecatedTables = []string{ TransitionBlockKey, } +// Diagnostics tables +var DiagnosticsTables = []string{ + HardwareInfo, +} + type CmpFunc func(k1, k2, v1, v2 []byte) int type TableCfg map[string]TableCfgItem @@ -854,6 +862,7 @@ var BorTablesCfg = TableCfg{ var TxpoolTablesCfg = TableCfg{} var SentryTablesCfg = TableCfg{} var DownloaderTablesCfg = TableCfg{} +var DiagnosticsTablesCfg = TableCfg{} var ReconTablesCfg = TableCfg{ PlainStateD: {Flags: DupSort}, CodeD: {Flags: DupSort}, @@ -870,6 +879,8 @@ func TablesCfgByLabel(label Label) TableCfg { return SentryTablesCfg case DownloaderDB: return DownloaderTablesCfg + case DiagnosticsDB: + return DiagnosticsTablesCfg default: panic(fmt.Sprintf("unexpected label: %s", label)) } @@ -931,6 +942,13 @@ func reinit() { ReconTablesCfg[name] = TableCfgItem{} } } + + for _, name := range DiagnosticsTables { + _, ok := DiagnosticsTablesCfg[name] + if !ok { + DiagnosticsTablesCfg[name] = TableCfgItem{} + } + } } // Temporal From d30cfb772e16613dbf897b0937b23a04f34ac9d5 Mon Sep 17 00:00:00 2001 From: dvovk Date: Wed, 22 May 2024 16:38:09 +0100 Subject: [PATCH 02/11] updated sys info saving and reading --- diagnostics/setup.go | 2 ++ erigon-lib/diagnostics/client.go | 20 +++--------- erigon-lib/diagnostics/snapshots.go | 1 - erigon-lib/diagnostics/snapshots_test.go | 36 ---------------------- erigon-lib/diagnostics/sys_info.go | 39 ++++++++++++++++++++++-- 5 files changed, 43 insertions(+), 55 deletions(-) diff --git a/diagnostics/setup.go b/diagnostics/setup.go index 8c3ca329bcf..b29f6e585ab 100644 --- a/diagnostics/setup.go +++ b/diagnostics/setup.go @@ -53,6 +53,8 @@ func Setup(ctx *cli.Context, node *node.ErigonNode, metricsMux *http.ServeMux, p diagnostic.Setup() SetupEndpoints(ctx, node, diagMux, diagnostic) + } else { + log.Error("[Diagnostics] Failure in setting up diagnostics", "err", err) } } diff --git a/erigon-lib/diagnostics/client.go b/erigon-lib/diagnostics/client.go index 78a3a7ff3d9..71c78055a02 100644 --- a/erigon-lib/diagnostics/client.go +++ b/erigon-lib/diagnostics/client.go @@ -2,8 +2,6 @@ package diagnostics import ( "context" - "encoding/json" - "fmt" "net/http" "path/filepath" "sync" @@ -46,13 +44,15 @@ func NewDiagnosticClient(ctx context.Context, metricsMux *http.ServeMux, dataDir return nil, err } + hInfo := ReadSysInfo(db) + return &DiagnosticClient{ ctx: ctx, db: db, metricsMux: metricsMux, dataDirPath: dataDirPath, syncStats: SyncStatistics{}, - hardwareInfo: HardwareInfo{}, + hardwareInfo: hInfo, snapshotFileList: SnapshoFilesList{}, bodies: BodiesInfo{}, resourcesUsage: ResourcesUsage{ @@ -73,7 +73,7 @@ func createDb(ctx context.Context, dbDir string) (db kv.RwDB, err error) { Path(dbDir). Open(ctx) if err != nil { - return nil, fmt.Errorf("failed to open diagnostics db: %w", err) + return nil, err } return db, nil @@ -96,18 +96,6 @@ func (d *DiagnosticClient) Setup() { //d.logDiagMsgs() } -func TestUpdater(ram string) func(tx kv.RwTx) error { - return func(tx kv.RwTx) error { - ramBytes, err := json.Marshal(ram) - - if err != nil { - return err - } - - return tx.Put(kv.HardwareInfo, []byte("ram"), ramBytes) - } -} - /*func (d *DiagnosticClient) logDiagMsgs() { ticker := time.NewTicker(20 * time.Second) quit := make(chan struct{}) diff --git a/erigon-lib/diagnostics/snapshots.go b/erigon-lib/diagnostics/snapshots.go index 97f0941083e..2ae1cec03bf 100644 --- a/erigon-lib/diagnostics/snapshots.go +++ b/erigon-lib/diagnostics/snapshots.go @@ -264,7 +264,6 @@ func (d *DiagnosticClient) UpdateFileDownloadedStatistics(downloadedInfo *FileDo d.syncStats.SnapshotDownload.SegmentsDownloading[downloadingInfo.Name] = *downloadingInfo } } - } func (d *DiagnosticClient) SyncStatistics() SyncStatistics { diff --git a/erigon-lib/diagnostics/snapshots_test.go b/erigon-lib/diagnostics/snapshots_test.go index 54157250c5d..bf177edbe94 100644 --- a/erigon-lib/diagnostics/snapshots_test.go +++ b/erigon-lib/diagnostics/snapshots_test.go @@ -10,42 +10,6 @@ import ( func TestUpdateFileDownloadingStats(t *testing.T) { d, err := diagnostics.NewDiagnosticClient(context.TODO(), nil, "test") - require.NoError(t, err) - - d.UpdateFileDownloadedStatistics(nil, &segmentDownloadStatsMock) - - sd := d.SyncStatistics().SnapshotDownload.SegmentsDownloading - require.NotNil(t, sd) - require.NotEqual(t, len(sd), 0) - - require.Equal(t, sd["test"], segmentDownloadStatsMock) -} - -func TestUpdateFileDownloadedStats(t *testing.T) { - d, err := diagnostics.NewDiagnosticClient(context.TODO(), nil, "test") - require.NoError(t, err) - - d.UpdateFileDownloadedStatistics(&fileDownloadedUpdMock, nil) - - sd := d.SyncStatistics().SnapshotDownload.SegmentsDownloading - require.NotNil(t, sd) - require.NotEqual(t, len(sd), 0) - - require.Equal(t, sd["test"], diagnostics.SegmentDownloadStatistics{ - Name: "test", - TotalBytes: 0, - DownloadedBytes: 0, - Webseeds: make([]diagnostics.SegmentPeer, 0), - Peers: make([]diagnostics.SegmentPeer, 0), - DownloadedStats: diagnostics.FileDownloadedStatistics{ - TimeTook: 1.0, - AverageRate: 1, - }, - }) -} - -func TestUpdateFileFullStatsUpdate(t *testing.T) { - d, err := diagnostics.NewDiagnosticClient(context.TODO(), nil, "test") require.NoError(t, err) diff --git a/erigon-lib/diagnostics/sys_info.go b/erigon-lib/diagnostics/sys_info.go index d725b87a92f..746d7fddb79 100644 --- a/erigon-lib/diagnostics/sys_info.go +++ b/erigon-lib/diagnostics/sys_info.go @@ -1,9 +1,12 @@ package diagnostics import ( + "context" + "encoding/json" "fmt" "github.com/ledgerwatch/erigon-lib/diskutils" + "github.com/ledgerwatch/erigon-lib/kv" "github.com/shirou/gopsutil/v3/cpu" "github.com/shirou/gopsutil/v3/disk" "github.com/shirou/gopsutil/v3/mem" @@ -11,8 +14,7 @@ import ( func (d *DiagnosticClient) setupSysInfoDiagnostics() { sysInfo := GetSysInfo(d.dataDirPath) - - if err := d.db.Update(d.ctx, TestUpdater(fmt.Sprint(sysInfo.RAM.Total))); err != nil { + if err := d.db.Update(d.ctx, SystemInfoUpdater(sysInfo)); err != nil { fmt.Println("Error updating sysinfo") } @@ -112,3 +114,36 @@ func GetCPUInfo() CPUInfo { Mhz: mhz, } } + +func ReadSysInfo(db kv.RoDB) (info HardwareInfo) { + if err := db.View(context.Background(), func(tx kv.Tx) error { + infoBytes, err := tx.GetOne(kv.HardwareInfo, []byte("diagHardwareInfo")) + + if err != nil { + return err + } + + err = json.Unmarshal(infoBytes, &info) + + if err != nil { + return err + } + + return nil + }); err != nil { + return HardwareInfo{} + } + return info +} + +func SystemInfoUpdater(info HardwareInfo) func(tx kv.RwTx) error { + return func(tx kv.RwTx) error { + infoBytes, err := json.Marshal(info) + + if err != nil { + return err + } + + return tx.Put(kv.HardwareInfo, []byte("diagHardwareInfo"), infoBytes) + } +} From 95710e36ac87e1316df65f17e78fed050ed30731 Mon Sep 17 00:00:00 2001 From: dvovk Date: Wed, 22 May 2024 20:57:19 +0100 Subject: [PATCH 03/11] updated herdware info storing --- erigon-lib/diagnostics/snapshots.go | 33 ++++++++++ erigon-lib/diagnostics/sys_info.go | 96 +++++++++++++++++++++++++---- erigon-lib/kv/tables.go | 6 +- 3 files changed, 120 insertions(+), 15 deletions(-) diff --git a/erigon-lib/diagnostics/snapshots.go b/erigon-lib/diagnostics/snapshots.go index 2ae1cec03bf..fdba17a7a71 100644 --- a/erigon-lib/diagnostics/snapshots.go +++ b/erigon-lib/diagnostics/snapshots.go @@ -273,3 +273,36 @@ func (d *DiagnosticClient) SyncStatistics() SyncStatistics { func (d *DiagnosticClient) SnapshotFilesList() SnapshoFilesList { return d.snapshotFileList } + +/*func ReadSyncStagesInfo(db kv.RoDB) (info SyncStages) { + if err := db.View(context.Background(), func(tx kv.Tx) error { + infoBytes, err := tx.GetOne(kv.HardwareInfo, []byte("diagSyncInfo")) + + if err != nil { + return err + } + + err = json.Unmarshal(infoBytes, &info) + + if err != nil { + return err + } + + return nil + }); err != nil { + return HardwareInfo{} + } + return info +} + +func SyncStagesInfoUpdater(info SyncStages) func(tx kv.RwTx) error { + return func(tx kv.RwTx) error { + infoBytes, err := json.Marshal(info) + + if err != nil { + return err + } + + return tx.Put(kv.HardwareInfo, []byte("diagSyncInfo"), infoBytes) + } +}*/ diff --git a/erigon-lib/diagnostics/sys_info.go b/erigon-lib/diagnostics/sys_info.go index 746d7fddb79..658e98cbcbf 100644 --- a/erigon-lib/diagnostics/sys_info.go +++ b/erigon-lib/diagnostics/sys_info.go @@ -3,19 +3,33 @@ package diagnostics import ( "context" "encoding/json" - "fmt" "github.com/ledgerwatch/erigon-lib/diskutils" "github.com/ledgerwatch/erigon-lib/kv" + "github.com/ledgerwatch/log/v3" "github.com/shirou/gopsutil/v3/cpu" "github.com/shirou/gopsutil/v3/disk" "github.com/shirou/gopsutil/v3/mem" ) +var ( + SystemRamInfoKey = []byte("diagSystemRamInfo") + SystemCpuInfoKey = []byte("diagSystemCpuInfo") + SystemDiskInfoKey = []byte("diagSystemDiskInfo") +) + func (d *DiagnosticClient) setupSysInfoDiagnostics() { sysInfo := GetSysInfo(d.dataDirPath) - if err := d.db.Update(d.ctx, SystemInfoUpdater(sysInfo)); err != nil { - fmt.Println("Error updating sysinfo") + if err := d.db.Update(d.ctx, RAMInfoUpdater(sysInfo.RAM)); err != nil { + log.Error("[Diagnostics] Failed to update RAM info", "err", err) + } + + if err := d.db.Update(d.ctx, CPUInfoUpdater(sysInfo.CPU)); err != nil { + log.Error("[Diagnostics] Failed to update CPU info", "err", err) + } + + if err := d.db.Update(d.ctx, DiskInfoUpdater(sysInfo.Disk)); err != nil { + log.Error("[Diagnostics] Failed to update Disk info", "err", err) } d.mu.Lock() @@ -116,27 +130,83 @@ func GetCPUInfo() CPUInfo { } func ReadSysInfo(db kv.RoDB) (info HardwareInfo) { - if err := db.View(context.Background(), func(tx kv.Tx) error { - infoBytes, err := tx.GetOne(kv.HardwareInfo, []byte("diagHardwareInfo")) + ram := ReadRAMInfo(db) + cpu := ReadCPUInfo(db) + disk := ReadDickInfo(db) - if err != nil { - return err - } + return HardwareInfo{ + RAM: ram, + CPU: cpu, + Disk: disk, + } +} + +func ReadRAMInfo(db kv.RoDB) RAMInfo { + data := ReadInfoBytes(db, SystemRamInfoKey) + var info RAMInfo + err := json.Unmarshal(data, &info) + + if err != nil { + return RAMInfo{} + } else { + return info + } +} - err = json.Unmarshal(infoBytes, &info) +func ReadCPUInfo(db kv.RoDB) CPUInfo { + data := ReadInfoBytes(db, SystemCpuInfoKey) + var info CPUInfo + err := json.Unmarshal(data, &info) + + if err != nil { + return CPUInfo{} + } else { + return info + } +} + +func ReadDickInfo(db kv.RoDB) DiskInfo { + data := ReadInfoBytes(db, SystemDiskInfoKey) + var info DiskInfo + err := json.Unmarshal(data, &info) + + if err != nil { + return DiskInfo{} + } else { + return info + } +} + +func ReadInfoBytes(db kv.RoDB, key []byte) (data []byte) { + if err := db.View(context.Background(), func(tx kv.Tx) error { + bytes, err := tx.GetOne(kv.DiagSystemInfo, key) if err != nil { return err } + data = bytes + return nil }); err != nil { - return HardwareInfo{} + return []byte{} } - return info + return data +} + +func RAMInfoUpdater(info RAMInfo) func(tx kv.RwTx) error { + return UpdateDiagTable(kv.DiagSystemInfo, SystemRamInfoKey, info) +} + +func CPUInfoUpdater(info CPUInfo) func(tx kv.RwTx) error { + return UpdateDiagTable(kv.DiagSystemInfo, SystemCpuInfoKey, info) +} + +func DiskInfoUpdater(info DiskInfo) func(tx kv.RwTx) error { + return UpdateDiagTable(kv.DiagSystemInfo, SystemDiskInfoKey, info) } -func SystemInfoUpdater(info HardwareInfo) func(tx kv.RwTx) error { +func UpdateDiagTable(table string, key []byte, info any) func(tx kv.RwTx) error { return func(tx kv.RwTx) error { infoBytes, err := json.Marshal(info) @@ -144,6 +214,6 @@ func SystemInfoUpdater(info HardwareInfo) func(tx kv.RwTx) error { return err } - return tx.Put(kv.HardwareInfo, []byte("diagHardwareInfo"), infoBytes) + return tx.Put(table, key, infoBytes) } } diff --git a/erigon-lib/kv/tables.go b/erigon-lib/kv/tables.go index 5d7dbe78d4a..e5c024b1c01 100644 --- a/erigon-lib/kv/tables.go +++ b/erigon-lib/kv/tables.go @@ -512,7 +512,8 @@ const ( StatesProcessingProgress = "StatesProcessingProgress" //Diagnostics tables - HardwareInfo = "HardwareInfo" + DiagSystemInfo = "DiagSystemInfo" + DiagSyncStages = "DiagSyncStages" ) // Keys @@ -755,7 +756,8 @@ var ChaindataDeprecatedTables = []string{ // Diagnostics tables var DiagnosticsTables = []string{ - HardwareInfo, + DiagSystemInfo, + DiagSyncStages, } type CmpFunc func(k1, k2, v1, v2 []byte) int From a0745f1fc7dea261da0b1c97e52cabe43c95e47e Mon Sep 17 00:00:00 2001 From: dvovk Date: Wed, 22 May 2024 21:14:37 +0100 Subject: [PATCH 04/11] refactored --- erigon-lib/diagnostics/sys_info.go | 42 +++++------------------------- 1 file changed, 6 insertions(+), 36 deletions(-) diff --git a/erigon-lib/diagnostics/sys_info.go b/erigon-lib/diagnostics/sys_info.go index 658e98cbcbf..982bc5ca752 100644 --- a/erigon-lib/diagnostics/sys_info.go +++ b/erigon-lib/diagnostics/sys_info.go @@ -1,7 +1,6 @@ package diagnostics import ( - "context" "encoding/json" "github.com/ledgerwatch/erigon-lib/diskutils" @@ -142,7 +141,7 @@ func ReadSysInfo(db kv.RoDB) (info HardwareInfo) { } func ReadRAMInfo(db kv.RoDB) RAMInfo { - data := ReadInfoBytes(db, SystemRamInfoKey) + data := ReadDataFromTable(db, kv.DiagSystemInfo, SystemRamInfoKey) var info RAMInfo err := json.Unmarshal(data, &info) @@ -154,7 +153,7 @@ func ReadRAMInfo(db kv.RoDB) RAMInfo { } func ReadCPUInfo(db kv.RoDB) CPUInfo { - data := ReadInfoBytes(db, SystemCpuInfoKey) + data := ReadDataFromTable(db, kv.DiagSystemInfo, SystemCpuInfoKey) var info CPUInfo err := json.Unmarshal(data, &info) @@ -166,7 +165,7 @@ func ReadCPUInfo(db kv.RoDB) CPUInfo { } func ReadDickInfo(db kv.RoDB) DiskInfo { - data := ReadInfoBytes(db, SystemDiskInfoKey) + data := ReadDataFromTable(db, kv.DiagSystemInfo, SystemDiskInfoKey) var info DiskInfo err := json.Unmarshal(data, &info) @@ -177,43 +176,14 @@ func ReadDickInfo(db kv.RoDB) DiskInfo { } } -func ReadInfoBytes(db kv.RoDB, key []byte) (data []byte) { - if err := db.View(context.Background(), func(tx kv.Tx) error { - bytes, err := tx.GetOne(kv.DiagSystemInfo, key) - - if err != nil { - return err - } - - data = bytes - - return nil - }); err != nil { - return []byte{} - } - return data -} - func RAMInfoUpdater(info RAMInfo) func(tx kv.RwTx) error { - return UpdateDiagTable(kv.DiagSystemInfo, SystemRamInfoKey, info) + return PutDataToTable(kv.DiagSystemInfo, SystemRamInfoKey, info) } func CPUInfoUpdater(info CPUInfo) func(tx kv.RwTx) error { - return UpdateDiagTable(kv.DiagSystemInfo, SystemCpuInfoKey, info) + return PutDataToTable(kv.DiagSystemInfo, SystemCpuInfoKey, info) } func DiskInfoUpdater(info DiskInfo) func(tx kv.RwTx) error { - return UpdateDiagTable(kv.DiagSystemInfo, SystemDiskInfoKey, info) -} - -func UpdateDiagTable(table string, key []byte, info any) func(tx kv.RwTx) error { - return func(tx kv.RwTx) error { - infoBytes, err := json.Marshal(info) - - if err != nil { - return err - } - - return tx.Put(table, key, infoBytes) - } + return PutDataToTable(kv.DiagSystemInfo, SystemDiskInfoKey, info) } From 7f0111691dcceaa1af24e1248285cf430b3ca052 Mon Sep 17 00:00:00 2001 From: dvovk Date: Wed, 22 May 2024 21:33:54 +0100 Subject: [PATCH 05/11] added saving for stages list and current stage --- erigon-lib/diagnostics/client.go | 13 +++-- erigon-lib/diagnostics/stages.go | 93 ++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 5 deletions(-) diff --git a/erigon-lib/diagnostics/client.go b/erigon-lib/diagnostics/client.go index 71c78055a02..6aebf6fdf57 100644 --- a/erigon-lib/diagnostics/client.go +++ b/erigon-lib/diagnostics/client.go @@ -45,13 +45,16 @@ func NewDiagnosticClient(ctx context.Context, metricsMux *http.ServeMux, dataDir } hInfo := ReadSysInfo(db) + ss := ReadSyncStagesInfo(db) return &DiagnosticClient{ - ctx: ctx, - db: db, - metricsMux: metricsMux, - dataDirPath: dataDirPath, - syncStats: SyncStatistics{}, + ctx: ctx, + db: db, + metricsMux: metricsMux, + dataDirPath: dataDirPath, + syncStats: SyncStatistics{ + SyncStages: ss, + }, hardwareInfo: hInfo, snapshotFileList: SnapshoFilesList{}, bodies: BodiesInfo{}, diff --git a/erigon-lib/diagnostics/stages.go b/erigon-lib/diagnostics/stages.go index 7687dff135b..1cd7b6d744b 100644 --- a/erigon-lib/diagnostics/stages.go +++ b/erigon-lib/diagnostics/stages.go @@ -2,10 +2,17 @@ package diagnostics import ( "context" + "encoding/json" + "github.com/ledgerwatch/erigon-lib/kv" "github.com/ledgerwatch/log/v3" ) +var ( + StagesListKey = []byte("diagStagesList") + CurrentStageKey = []byte("diagCurrentStage") +) + func (d *DiagnosticClient) setupStagesDiagnostics(rootCtx context.Context) { d.runCurrentSyncStageListener(rootCtx) d.runSyncStagesListListener(rootCtx) @@ -22,6 +29,10 @@ func (d *DiagnosticClient) runSyncStagesListListener(rootCtx context.Context) { case <-rootCtx.Done(): return case info := <-ch: + if err := d.db.Update(d.ctx, StagesListUpdater(info.Stages)); err != nil { + log.Error("[Diagnostics] Failed to update stages list", "err", err) + } + d.mu.Lock() d.syncStats.SyncStages.StagesList = info.Stages d.mu.Unlock() @@ -42,6 +53,10 @@ func (d *DiagnosticClient) runCurrentSyncStageListener(rootCtx context.Context) case <-rootCtx.Done(): return case info := <-ch: + if err := d.db.Update(d.ctx, CurrentStageUpdater(info.Stage)); err != nil { + log.Error("[Diagnostics] Failed to update current stage", "err", err) + } + d.mu.Lock() d.syncStats.SyncStages.CurrentStage = info.Stage if int(d.syncStats.SyncStages.CurrentStage) >= len(d.syncStats.SyncStages.StagesList) { @@ -52,3 +67,81 @@ func (d *DiagnosticClient) runCurrentSyncStageListener(rootCtx context.Context) } }() } + +func ReadSyncStagesInfo(db kv.RoDB) (info SyncStages) { + stageesList := ReadStagesList(db) + currentStage := ReadCurrentStage(db) + + return SyncStages{ + StagesList: stageesList, + CurrentStage: currentStage, + } +} + +func ReadStagesList(db kv.RoDB) []string { + data := ReadDataFromTable(db, kv.DiagSyncStages, StagesListKey) + var info []string + err := json.Unmarshal(data, &info) + + if err != nil { + return []string{} + } else { + return info + } +} + +func ReadCurrentStage(db kv.RoDB) uint { + data := ReadDataFromTable(db, kv.DiagSyncStages, StagesListKey) + var info uint + err := json.Unmarshal(data, &info) + + if err != nil { + return 0 + } else { + return info + } +} + +func StagesListUpdater(info []string) func(tx kv.RwTx) error { + return PutDataToTable(kv.DiagSyncStages, StagesListKey, info) +} + +func CurrentStageUpdater(info uint) func(tx kv.RwTx) error { + return PutDataToTable(kv.DiagSyncStages, StagesListKey, info) +} + +/*func ReadCPUInfo(db kv.RoDB) CPUInfo { + data := ReadDataFromTable(db, kv.DiagSystemInfo, SystemCpuInfoKey) + var info CPUInfo + err := json.Unmarshal(data, &info) + + if err != nil { + return CPUInfo{} + } else { + return info + } +} + +func ReadDickInfo(db kv.RoDB) DiskInfo { + data := ReadDataFromTable(db, kv.DiagSystemInfo, SystemDiskInfoKey) + var info DiskInfo + err := json.Unmarshal(data, &info) + + if err != nil { + return DiskInfo{} + } else { + return info + } +} + +func RAMInfoUpdater(info RAMInfo) func(tx kv.RwTx) error { + return PutDataToTable(kv.DiagSystemInfo, SystemRamInfoKey, info) +} + +func CPUInfoUpdater(info CPUInfo) func(tx kv.RwTx) error { + return PutDataToTable(kv.DiagSystemInfo, SystemCpuInfoKey, info) +} + +func DiskInfoUpdater(info DiskInfo) func(tx kv.RwTx) error { + return PutDataToTable(kv.DiagSystemInfo, SystemDiskInfoKey, info) +}*/ From de64321e7faff6251d8ff04a9865e8d9d0ff3a0c Mon Sep 17 00:00:00 2001 From: dvovk Date: Wed, 22 May 2024 22:44:11 +0100 Subject: [PATCH 06/11] wp --- erigon-lib/diagnostics/speedtest.go | 1 + .../diagnostics/test/diagnostics/mdbx.dat | Bin 0 -> 16384 bytes .../diagnostics/test/diagnostics/mdbx.lck | Bin 0 -> 1032192 bytes erigon-lib/diagnostics/test/mdbx.dat | Bin 0 -> 16384 bytes erigon-lib/diagnostics/test/mdbx.lck | Bin 0 -> 1032192 bytes erigon-lib/diagnostics/utils.go | 37 ++++++++++++++++++ 6 files changed, 38 insertions(+) create mode 100644 erigon-lib/diagnostics/test/diagnostics/mdbx.dat create mode 100644 erigon-lib/diagnostics/test/diagnostics/mdbx.lck create mode 100644 erigon-lib/diagnostics/test/mdbx.dat create mode 100644 erigon-lib/diagnostics/test/mdbx.lck create mode 100644 erigon-lib/diagnostics/utils.go diff --git a/erigon-lib/diagnostics/speedtest.go b/erigon-lib/diagnostics/speedtest.go index ab9a04008bc..ed5421289cd 100644 --- a/erigon-lib/diagnostics/speedtest.go +++ b/erigon-lib/diagnostics/speedtest.go @@ -66,6 +66,7 @@ func (d *DiagnosticClient) runSpeedTest(rootCtx context.Context) NetworkSpeedTes } ctx, cancel := context.WithTimeout(rootCtx, time.Second*15) + defer cancel() _ = analyzer.RunWithContext(ctx, s.Host, func(pl *transport.PLoss) { packetLoss = pl.Loss() diff --git a/erigon-lib/diagnostics/test/diagnostics/mdbx.dat b/erigon-lib/diagnostics/test/diagnostics/mdbx.dat new file mode 100644 index 0000000000000000000000000000000000000000..7dcec833827e95fe7882b3e099f55a501d5be6a8 GIT binary patch literal 16384 zcmeI&Jx;?w5QgDl?ZO3;;TlvNffA%BJra#2ObN(MiX4F>MD*^sKrC?vYR-@x0d~9$ z{)57nkdX6klUaNJ{3y*QTf|yog+!-|ef6AQ$KO|c5la&K7rxZ4NIm03rw{{L2<5CH@bKmY**5I_I{1Q0-AoIvyK zyb~v7s#&^B$F0F=1Q0*~0R#|0009ILKmY**5coTRbHB8cW4X+V+f`QNSNC@hwwrzz LZ}m^Vmis>eAQxSA literal 0 HcmV?d00001 diff --git a/erigon-lib/diagnostics/test/diagnostics/mdbx.lck b/erigon-lib/diagnostics/test/diagnostics/mdbx.lck new file mode 100644 index 0000000000000000000000000000000000000000..a14cd80e03e8b4bd0a540cd9f4fab183750f91ca GIT binary patch literal 1032192 zcmeIvF%AJi6b9gx5Gn~LP`Usmg_h0=2XGIE(7J*fIEy1Fb=b9e$wm~LtgU=g%uHtf znY{U?Gg#g(r~U4_m`s!8kmRlX?wjpe&0b&m_U$@dMff->X63cmdq$g`?~iPrXTIek z-`@<=aksGSWs7k<#>mwj%QaM~fBsQ_{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-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ NfB*pk1PJ`6zzZ3MM=k&W literal 0 HcmV?d00001 diff --git a/erigon-lib/diagnostics/test/mdbx.dat b/erigon-lib/diagnostics/test/mdbx.dat new file mode 100644 index 0000000000000000000000000000000000000000..cafd6fcc23596be0e47759b33de24a5ea9e9b7f5 GIT binary patch literal 16384 zcmeI%u?fOJ6b9f^Q>4^2oWcQuydtS&f=EvB*N6RnLo9hA@d&wPG5=D~{^Zm$zT%_idZ@Nu$$e zoO~|I`TD-S+?L13?y$f1t@oY)0RjXF5FkK+009C72n?zCBXQ&(}Pzi_EuN z%J250@i7ab6F0iCr{if(xw>KI$*tq0U?U`hV(rI8T580RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*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AV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk Q1PBlyK!5-N0{ Date: Wed, 22 May 2024 22:44:44 +0100 Subject: [PATCH 07/11] wp --- .../diagnostics/test/diagnostics/mdbx.dat | Bin 16384 -> 0 bytes .../diagnostics/test/diagnostics/mdbx.lck | Bin 1032192 -> 0 bytes erigon-lib/diagnostics/test/mdbx.dat | Bin 16384 -> 0 bytes erigon-lib/diagnostics/test/mdbx.lck | Bin 1032192 -> 0 bytes 4 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 erigon-lib/diagnostics/test/diagnostics/mdbx.dat delete mode 100644 erigon-lib/diagnostics/test/diagnostics/mdbx.lck delete mode 100644 erigon-lib/diagnostics/test/mdbx.dat delete mode 100644 erigon-lib/diagnostics/test/mdbx.lck diff --git a/erigon-lib/diagnostics/test/diagnostics/mdbx.dat b/erigon-lib/diagnostics/test/diagnostics/mdbx.dat deleted file mode 100644 index 7dcec833827e95fe7882b3e099f55a501d5be6a8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmeI&Jx;?w5QgDl?ZO3;;TlvNffA%BJra#2ObN(MiX4F>MD*^sKrC?vYR-@x0d~9$ z{)57nkdX6klUaNJ{3y*QTf|yog+!-|ef6AQ$KO|c5la&K7rxZ4NIm03rw{{L2<5CH@bKmY**5I_I{1Q0-AoIvyK zyb~v7s#&^B$F0F=1Q0*~0R#|0009ILKmY**5coTRbHB8cW4X+V+f`QNSNC@hwwrzz LZ}m^Vmis>eAQxSA diff --git a/erigon-lib/diagnostics/test/diagnostics/mdbx.lck b/erigon-lib/diagnostics/test/diagnostics/mdbx.lck deleted file mode 100644 index a14cd80e03e8b4bd0a540cd9f4fab183750f91ca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1032192 zcmeIvF%AJi6b9gx5Gn~LP`Usmg_h0=2XGIE(7J*fIEy1Fb=b9e$wm~LtgU=g%uHtf znY{U?Gg#g(r~U4_m`s!8kmRlX?wjpe&0b&m_U$@dMff->X63cmdq$g`?~iPrXTIek z-`@<=aksGSWs7k<#>mwj%QaM~fBsQ_{ttEj;@9t~>)|{B0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UA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K+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ NfB*pk1PJ`6zzZ3MM=k&W diff --git a/erigon-lib/diagnostics/test/mdbx.dat b/erigon-lib/diagnostics/test/mdbx.dat deleted file mode 100644 index cafd6fcc23596be0e47759b33de24a5ea9e9b7f5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmeI%u?fOJ6b9f^Q>4^2oWcQuydtS&f=EvB*N6RnLo9hA@d&wPG5=D~{^Zm$zT%_idZ@Nu$$e zoO~|I`TD-S+?L13?y$f1t@oY)0RjXF5FkK+009C72n?zCBXQ&(}Pzi_EuN z%J250@i7ab6F0iCr{if(xw>KI$*tq0U?U`hV(rI8T580RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&U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NAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk Q1PBlyK!5-N0{ Date: Thu, 23 May 2024 16:23:54 +0100 Subject: [PATCH 08/11] added saving snapshot downloading --- erigon-lib/diagnostics/client.go | 4 ++- erigon-lib/diagnostics/snapshots.go | 50 +++++++++++++---------------- erigon-lib/diagnostics/stages.go | 41 ++--------------------- 3 files changed, 28 insertions(+), 67 deletions(-) diff --git a/erigon-lib/diagnostics/client.go b/erigon-lib/diagnostics/client.go index 6aebf6fdf57..5e6053014d2 100644 --- a/erigon-lib/diagnostics/client.go +++ b/erigon-lib/diagnostics/client.go @@ -46,6 +46,7 @@ func NewDiagnosticClient(ctx context.Context, metricsMux *http.ServeMux, dataDir hInfo := ReadSysInfo(db) ss := ReadSyncStagesInfo(db) + snpdwl := ReadSnapshotDownloadInfo(db) return &DiagnosticClient{ ctx: ctx, @@ -53,7 +54,8 @@ func NewDiagnosticClient(ctx context.Context, metricsMux *http.ServeMux, dataDir metricsMux: metricsMux, dataDirPath: dataDirPath, syncStats: SyncStatistics{ - SyncStages: ss, + SyncStages: ss, + SnapshotDownload: snpdwl, }, hardwareInfo: hInfo, snapshotFileList: SnapshoFilesList{}, diff --git a/erigon-lib/diagnostics/snapshots.go b/erigon-lib/diagnostics/snapshots.go index fdba17a7a71..06f0bc214f9 100644 --- a/erigon-lib/diagnostics/snapshots.go +++ b/erigon-lib/diagnostics/snapshots.go @@ -2,7 +2,9 @@ package diagnostics import ( "context" + "encoding/json" + "github.com/ledgerwatch/erigon-lib/kv" "github.com/ledgerwatch/log/v3" ) @@ -26,6 +28,7 @@ func (d *DiagnosticClient) runSnapshotListener(rootCtx context.Context) { case <-rootCtx.Done(): return case info := <-ch: + d.mu.Lock() d.syncStats.SnapshotDownload.Downloaded = info.Downloaded d.syncStats.SnapshotDownload.Total = info.Total @@ -39,6 +42,11 @@ func (d *DiagnosticClient) runSnapshotListener(rootCtx context.Context) { d.syncStats.SnapshotDownload.Sys = info.Sys d.syncStats.SnapshotDownload.DownloadFinished = info.DownloadFinished d.syncStats.SnapshotDownload.TorrentMetadataReady = info.TorrentMetadataReady + + if err := d.db.Update(d.ctx, SnapshotDownloadUpdater(d.syncStats.SnapshotDownload)); err != nil { + log.Error("[Diagnostics] Failed to update snapshot download info", "err", err) + } + d.mu.Unlock() if info.DownloadFinished { @@ -77,6 +85,10 @@ func (d *DiagnosticClient) runSegmentDownloadingListener(rootCtx context.Context d.syncStats.SnapshotDownload.SegmentsDownloading[info.Name] = info } + if err := d.db.Update(d.ctx, SnapshotDownloadUpdater(d.syncStats.SnapshotDownload)); err != nil { + log.Error("[Diagnostics] Failed to update snapshot download info", "err", err) + } + d.mu.Unlock() } } @@ -274,35 +286,17 @@ func (d *DiagnosticClient) SnapshotFilesList() SnapshoFilesList { return d.snapshotFileList } -/*func ReadSyncStagesInfo(db kv.RoDB) (info SyncStages) { - if err := db.View(context.Background(), func(tx kv.Tx) error { - infoBytes, err := tx.GetOne(kv.HardwareInfo, []byte("diagSyncInfo")) - - if err != nil { - return err - } - - err = json.Unmarshal(infoBytes, &info) +func ReadSnapshotDownloadInfo(db kv.RoDB) (info SnapshotDownloadStatistics) { + data := ReadDataFromTable(db, kv.DiagSyncStages, SnapshotDownloadStatisticsKey) + err := json.Unmarshal(data, &info) - if err != nil { - return err - } - - return nil - }); err != nil { - return HardwareInfo{} + if err != nil { + return SnapshotDownloadStatistics{} + } else { + return info } - return info } -func SyncStagesInfoUpdater(info SyncStages) func(tx kv.RwTx) error { - return func(tx kv.RwTx) error { - infoBytes, err := json.Marshal(info) - - if err != nil { - return err - } - - return tx.Put(kv.HardwareInfo, []byte("diagSyncInfo"), infoBytes) - } -}*/ +func SnapshotDownloadUpdater(info SnapshotDownloadStatistics) func(tx kv.RwTx) error { + return PutDataToTable(kv.DiagSyncStages, SnapshotDownloadStatisticsKey, info) +} diff --git a/erigon-lib/diagnostics/stages.go b/erigon-lib/diagnostics/stages.go index 1cd7b6d744b..c2f611c21f4 100644 --- a/erigon-lib/diagnostics/stages.go +++ b/erigon-lib/diagnostics/stages.go @@ -9,8 +9,9 @@ import ( ) var ( - StagesListKey = []byte("diagStagesList") - CurrentStageKey = []byte("diagCurrentStage") + StagesListKey = []byte("diagStagesList") + CurrentStageKey = []byte("diagCurrentStage") + SnapshotDownloadStatisticsKey = []byte("diagSnapshotDownloadStatistics") ) func (d *DiagnosticClient) setupStagesDiagnostics(rootCtx context.Context) { @@ -109,39 +110,3 @@ func StagesListUpdater(info []string) func(tx kv.RwTx) error { func CurrentStageUpdater(info uint) func(tx kv.RwTx) error { return PutDataToTable(kv.DiagSyncStages, StagesListKey, info) } - -/*func ReadCPUInfo(db kv.RoDB) CPUInfo { - data := ReadDataFromTable(db, kv.DiagSystemInfo, SystemCpuInfoKey) - var info CPUInfo - err := json.Unmarshal(data, &info) - - if err != nil { - return CPUInfo{} - } else { - return info - } -} - -func ReadDickInfo(db kv.RoDB) DiskInfo { - data := ReadDataFromTable(db, kv.DiagSystemInfo, SystemDiskInfoKey) - var info DiskInfo - err := json.Unmarshal(data, &info) - - if err != nil { - return DiskInfo{} - } else { - return info - } -} - -func RAMInfoUpdater(info RAMInfo) func(tx kv.RwTx) error { - return PutDataToTable(kv.DiagSystemInfo, SystemRamInfoKey, info) -} - -func CPUInfoUpdater(info CPUInfo) func(tx kv.RwTx) error { - return PutDataToTable(kv.DiagSystemInfo, SystemCpuInfoKey, info) -} - -func DiskInfoUpdater(info DiskInfo) func(tx kv.RwTx) error { - return PutDataToTable(kv.DiagSystemInfo, SystemDiskInfoKey, info) -}*/ From 01edfa7ab713010894a04648660230dc8bf63795 Mon Sep 17 00:00:00 2001 From: dvovk Date: Thu, 23 May 2024 16:33:09 +0100 Subject: [PATCH 09/11] added saving snapshot indexing --- erigon-lib/diagnostics/client.go | 2 ++ erigon-lib/diagnostics/snapshots.go | 28 ++++++++++++++++++++++++++++ erigon-lib/diagnostics/stages.go | 5 ++--- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/erigon-lib/diagnostics/client.go b/erigon-lib/diagnostics/client.go index 5e6053014d2..b25049936b0 100644 --- a/erigon-lib/diagnostics/client.go +++ b/erigon-lib/diagnostics/client.go @@ -47,6 +47,7 @@ func NewDiagnosticClient(ctx context.Context, metricsMux *http.ServeMux, dataDir hInfo := ReadSysInfo(db) ss := ReadSyncStagesInfo(db) snpdwl := ReadSnapshotDownloadInfo(db) + snpidx := ReadSnapshotIndexingInfo(db) return &DiagnosticClient{ ctx: ctx, @@ -56,6 +57,7 @@ func NewDiagnosticClient(ctx context.Context, metricsMux *http.ServeMux, dataDir syncStats: SyncStatistics{ SyncStages: ss, SnapshotDownload: snpdwl, + SnapshotIndexing: snpidx, }, hardwareInfo: hInfo, snapshotFileList: SnapshoFilesList{}, diff --git a/erigon-lib/diagnostics/snapshots.go b/erigon-lib/diagnostics/snapshots.go index 06f0bc214f9..c2977a202d2 100644 --- a/erigon-lib/diagnostics/snapshots.go +++ b/erigon-lib/diagnostics/snapshots.go @@ -8,6 +8,11 @@ import ( "github.com/ledgerwatch/log/v3" ) +var ( + SnapshotDownloadStatisticsKey = []byte("diagSnapshotDownloadStatistics") + SnapshotIndexingStatisticsKey = []byte("diagSnapshotIndexingStatistics") +) + func (d *DiagnosticClient) setupSnapshotDiagnostics(rootCtx context.Context) { d.runSnapshotListener(rootCtx) d.runSegmentDownloadingListener(rootCtx) @@ -107,6 +112,9 @@ func (d *DiagnosticClient) runSegmentIndexingListener(rootCtx context.Context) { return case info := <-ch: d.addOrUpdateSegmentIndexingState(info) + if err := d.db.Update(d.ctx, SnapshotIndexingUpdater(d.syncStats.SnapshotIndexing)); err != nil { + log.Error("[Diagnostics] Failed to update snapshot indexing info", "err", err) + } } } }() @@ -140,6 +148,11 @@ func (d *DiagnosticClient) runSegmentIndexingFinishedListener(rootCtx context.Co Sys: 0, }) } + + if err := d.db.Update(d.ctx, SnapshotIndexingUpdater(d.syncStats.SnapshotIndexing)); err != nil { + log.Error("[Diagnostics] Failed to update snapshot indexing info", "err", err) + } + d.mu.Unlock() } } @@ -297,6 +310,21 @@ func ReadSnapshotDownloadInfo(db kv.RoDB) (info SnapshotDownloadStatistics) { } } +func ReadSnapshotIndexingInfo(db kv.RoDB) (info SnapshotIndexingStatistics) { + data := ReadDataFromTable(db, kv.DiagSyncStages, SnapshotIndexingStatisticsKey) + err := json.Unmarshal(data, &info) + + if err != nil { + return SnapshotIndexingStatistics{} + } else { + return info + } +} + func SnapshotDownloadUpdater(info SnapshotDownloadStatistics) func(tx kv.RwTx) error { return PutDataToTable(kv.DiagSyncStages, SnapshotDownloadStatisticsKey, info) } + +func SnapshotIndexingUpdater(info SnapshotIndexingStatistics) func(tx kv.RwTx) error { + return PutDataToTable(kv.DiagSyncStages, SnapshotIndexingStatisticsKey, info) +} diff --git a/erigon-lib/diagnostics/stages.go b/erigon-lib/diagnostics/stages.go index c2f611c21f4..9e06e780293 100644 --- a/erigon-lib/diagnostics/stages.go +++ b/erigon-lib/diagnostics/stages.go @@ -9,9 +9,8 @@ import ( ) var ( - StagesListKey = []byte("diagStagesList") - CurrentStageKey = []byte("diagCurrentStage") - SnapshotDownloadStatisticsKey = []byte("diagSnapshotDownloadStatistics") + StagesListKey = []byte("diagStagesList") + CurrentStageKey = []byte("diagCurrentStage") ) func (d *DiagnosticClient) setupStagesDiagnostics(rootCtx context.Context) { From 621cb8bf5111fe86da60ddd95375f3da1be9dda7 Mon Sep 17 00:00:00 2001 From: dvovk Date: Thu, 23 May 2024 17:14:09 +0100 Subject: [PATCH 10/11] resolve conflicts --- erigon-lib/diagnostics/snapshots_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erigon-lib/diagnostics/snapshots_test.go b/erigon-lib/diagnostics/snapshots_test.go index bf177edbe94..cb1c13ec30a 100644 --- a/erigon-lib/diagnostics/snapshots_test.go +++ b/erigon-lib/diagnostics/snapshots_test.go @@ -9,7 +9,7 @@ import ( ) func TestUpdateFileDownloadingStats(t *testing.T) { - d, err := diagnostics.NewDiagnosticClient(context.TODO(), nil, "test") + d, err := diagnostics.NewDiagnosticClient(context.TODO(), nil, "test", true) require.NoError(t, err) From ea2e10d40a8e41816d8b4ba9c409cf0307832c1b Mon Sep 17 00:00:00 2001 From: dvovk Date: Fri, 24 May 2024 14:35:08 +0100 Subject: [PATCH 11/11] fix --- erigon-lib/diagnostics/snapshots.go | 2 ++ erigon-lib/diagnostics/stages.go | 2 ++ erigon-lib/diagnostics/sys_info.go | 3 +++ 3 files changed, 7 insertions(+) diff --git a/erigon-lib/diagnostics/snapshots.go b/erigon-lib/diagnostics/snapshots.go index c2977a202d2..f6080fc842b 100644 --- a/erigon-lib/diagnostics/snapshots.go +++ b/erigon-lib/diagnostics/snapshots.go @@ -304,6 +304,7 @@ func ReadSnapshotDownloadInfo(db kv.RoDB) (info SnapshotDownloadStatistics) { err := json.Unmarshal(data, &info) if err != nil { + log.Error("[Diagnostics] Failed to read snapshot download info", "err", err) return SnapshotDownloadStatistics{} } else { return info @@ -315,6 +316,7 @@ func ReadSnapshotIndexingInfo(db kv.RoDB) (info SnapshotIndexingStatistics) { err := json.Unmarshal(data, &info) if err != nil { + log.Error("[Diagnostics] Failed to read snapshot indexing info", "err", err) return SnapshotIndexingStatistics{} } else { return info diff --git a/erigon-lib/diagnostics/stages.go b/erigon-lib/diagnostics/stages.go index 9e06e780293..7754886e1d0 100644 --- a/erigon-lib/diagnostics/stages.go +++ b/erigon-lib/diagnostics/stages.go @@ -84,6 +84,7 @@ func ReadStagesList(db kv.RoDB) []string { err := json.Unmarshal(data, &info) if err != nil { + log.Error("[Diagnostics] Failed to read stages list", "err", err) return []string{} } else { return info @@ -96,6 +97,7 @@ func ReadCurrentStage(db kv.RoDB) uint { err := json.Unmarshal(data, &info) if err != nil { + log.Error("[Diagnostics] Failed to read current stage", "err", err) return 0 } else { return info diff --git a/erigon-lib/diagnostics/sys_info.go b/erigon-lib/diagnostics/sys_info.go index 982bc5ca752..92f295d931a 100644 --- a/erigon-lib/diagnostics/sys_info.go +++ b/erigon-lib/diagnostics/sys_info.go @@ -146,6 +146,7 @@ func ReadRAMInfo(db kv.RoDB) RAMInfo { err := json.Unmarshal(data, &info) if err != nil { + log.Error("[Diagnostics] Failed to read RAM info", "err", err) return RAMInfo{} } else { return info @@ -158,6 +159,7 @@ func ReadCPUInfo(db kv.RoDB) CPUInfo { err := json.Unmarshal(data, &info) if err != nil { + log.Error("[Diagnostics] Failed to read CPU info", "err", err) return CPUInfo{} } else { return info @@ -170,6 +172,7 @@ func ReadDickInfo(db kv.RoDB) DiskInfo { err := json.Unmarshal(data, &info) if err != nil { + log.Error("[Diagnostics] Failed to read Disk info", "err", err) return DiskInfo{} } else { return info