Skip to content

Commit

Permalink
Reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
dzajkowski committed Jun 8, 2021
1 parent a7a62c7 commit e994ecf
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
Expand Up @@ -16,7 +16,7 @@ import scala.collection.mutable
import scala.util.control.NonFatal

class RocksDbDataSource(
private var db: RocksDB,
var db: RocksDB,
private val rocksDbConfig: RocksDbConfig,
private var readOptions: ReadOptions,
private var dbOptions: DBOptions,
Expand Down
29 changes: 29 additions & 0 deletions src/main/scala/io/iohk/ethereum/nodebuilder/StdNode.scala
Expand Up @@ -2,6 +2,7 @@ package io.iohk.ethereum.nodebuilder

import io.iohk.ethereum.blockchain.sync.SyncProtocol
import io.iohk.ethereum.consensus.StdConsensusBuilder
import io.iohk.ethereum.db.dataSource.RocksDbDataSource
import io.iohk.ethereum.metrics.{Metrics, MetricsConfig}
import io.iohk.ethereum.network.discovery.PeerDiscoveryManager
import io.iohk.ethereum.network.{PeerManagerActor, ServerActor}
Expand All @@ -26,6 +27,32 @@ abstract class BaseNode extends Node {
if (!Config.testmode) genesisDataLoader.loadGenesisData()
}

private[this] def reportDBState(): Unit = {
val bhs = storagesInstance.storages.blockHeadersStorage
val bbs = storagesInstance.storages.blockBodiesStorage
val bnms = storagesInstance.storages.blockNumberMappingStorage

implicit val sch = monix.execution.Scheduler.global

var a = 0L
bhs.storageContent.foreach { _ =>
a += 1
}
log.info("BHS size {}", a)

a = 0L
bbs.storageContent.foreach { _ =>
a += 1
}
log.info("BBS size {}", a)

a = 0L
bnms.storageContent.foreach { _ =>
a += 1
}
log.info("BNMS size {}", a)
}

private[this] def startPeerManager(): Unit = peerManager ! PeerManagerActor.StartConnecting

private[this] def startServer(): Unit = server ! ServerActor.StartServer(networkConfig.Server.listenAddress)
Expand Down Expand Up @@ -59,6 +86,8 @@ abstract class BaseNode extends Node {
def start(): Unit = {
startMetricsClient()

reportDBState()

loadGenesisData()

startPeerManager()
Expand Down

0 comments on commit e994ecf

Please sign in to comment.