Skip to content

Commit

Permalink
remove oldest kept epoch metric
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdan-rosianu committed Sep 26, 2022
1 parent 9168a6b commit d6260e4
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 70 deletions.
3 changes: 0 additions & 3 deletions common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,6 @@ const MetricTotalFees = "erd_total_fees"
// MetricEpochForEconomicsData holds the epoch for which economics data are computed
const MetricEpochForEconomicsData = "erd_epoch_for_economics_data"

// MetricOldestKeptEpoch holds the earliest epoch that exists in the node's configuration
const MetricOldestKeptEpoch = "erd_oldest_kept_epoch"

// MetachainShardId will be used to identify a shard ID as metachain
const MetachainShardId = uint32(0xFFFFFFFF)

Expand Down
2 changes: 0 additions & 2 deletions epochStart/bootstrap/metaStorageHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ func NewMetaStorageHandler(
currentEpoch uint32,
uint64Converter typeConverters.Uint64ByteSliceConverter,
nodeTypeProvider NodeTypeProviderHandler,
statusHandler core.AppStatusHandler,
) (*metaStorageHandler, error) {
epochStartNotifier := &disabled.EpochStartNotifier{}
storageFactory, err := factory.NewStorageServiceFactory(
Expand All @@ -48,7 +47,6 @@ func NewMetaStorageHandler(
EpochStartNotifier: epochStartNotifier,
NodeTypeProvider: nodeTypeProvider,
CurrentEpoch: currentEpoch,
StatusHandler: statusHandler,
CreateTrieEpochRootHashStorer: false,
},
)
Expand Down
20 changes: 6 additions & 14 deletions epochStart/bootstrap/metaStorageHandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/ElrondNetwork/elrond-go/testscommon"
"github.com/ElrondNetwork/elrond-go/testscommon/hashingMocks"
"github.com/ElrondNetwork/elrond-go/testscommon/nodeTypeProviderMock"
"github.com/ElrondNetwork/elrond-go/testscommon/statusHandler"
"github.com/stretchr/testify/assert"
)

Expand All @@ -27,9 +26,8 @@ func TestNewMetaStorageHandler_InvalidConfigErr(t *testing.T) {
hasher := &hashingMocks.HasherMock{}
uit64Cvt := &mock.Uint64ByteSliceConverterMock{}
nodeTypeProvider := &nodeTypeProviderMock.NodeTypeProviderStub{}
statusHandlerMock := &statusHandler.AppStatusHandlerMock{}

mtStrHandler, err := NewMetaStorageHandler(gCfg, prefsConfig, coordinator, pathManager, marshalizer, hasher, 1, uit64Cvt, nodeTypeProvider, statusHandlerMock)
mtStrHandler, err := NewMetaStorageHandler(gCfg, prefsConfig, coordinator, pathManager, marshalizer, hasher, 1, uit64Cvt, nodeTypeProvider)
assert.True(t, check.IfNil(mtStrHandler))
assert.NotNil(t, err)
}
Expand All @@ -47,9 +45,7 @@ func TestNewMetaStorageHandler_CreateForMetaErr(t *testing.T) {
hasher := &hashingMocks.HasherMock{}
uit64Cvt := &mock.Uint64ByteSliceConverterMock{}
nodeTypeProvider := &nodeTypeProviderMock.NodeTypeProviderStub{}
statusHandlerMock := &statusHandler.AppStatusHandlerMock{}

mtStrHandler, err := NewMetaStorageHandler(gCfg, prefsConfig, coordinator, pathManager, marshalizer, hasher, 1, uit64Cvt, nodeTypeProvider, statusHandlerMock)
mtStrHandler, err := NewMetaStorageHandler(gCfg, prefsConfig, coordinator, pathManager, marshalizer, hasher, 1, uit64Cvt, nodeTypeProvider)
assert.False(t, check.IfNil(mtStrHandler))
assert.Nil(t, err)
}
Expand All @@ -67,9 +63,8 @@ func TestMetaStorageHandler_saveLastHeader(t *testing.T) {
hasher := &hashingMocks.HasherMock{}
uit64Cvt := &mock.Uint64ByteSliceConverterMock{}
nodeTypeProvider := &nodeTypeProviderMock.NodeTypeProviderStub{}
statusHandlerMock := &statusHandler.AppStatusHandlerMock{}

mtStrHandler, _ := NewMetaStorageHandler(gCfg, prefsConfig, coordinator, pathManager, marshalizer, hasher, 1, uit64Cvt, nodeTypeProvider, statusHandlerMock)
mtStrHandler, _ := NewMetaStorageHandler(gCfg, prefsConfig, coordinator, pathManager, marshalizer, hasher, 1, uit64Cvt, nodeTypeProvider)

header := &block.MetaBlock{Nonce: 0}

Expand All @@ -96,9 +91,8 @@ func TestMetaStorageHandler_saveLastCrossNotarizedHeaders(t *testing.T) {
hasher := &hashingMocks.HasherMock{}
uit64Cvt := &mock.Uint64ByteSliceConverterMock{}
nodeTypeProvider := &nodeTypeProviderMock.NodeTypeProviderStub{}
statusHandlerMock := &statusHandler.AppStatusHandlerMock{}

mtStrHandler, _ := NewMetaStorageHandler(gCfg, prefsConfig, coordinator, pathManager, marshalizer, hasher, 1, uit64Cvt, nodeTypeProvider, statusHandlerMock)
mtStrHandler, _ := NewMetaStorageHandler(gCfg, prefsConfig, coordinator, pathManager, marshalizer, hasher, 1, uit64Cvt, nodeTypeProvider)

hdr1 := &block.Header{Nonce: 1}
hdr2 := &block.Header{Nonce: 2}
Expand Down Expand Up @@ -131,9 +125,8 @@ func TestMetaStorageHandler_saveTriggerRegistry(t *testing.T) {
hasher := &hashingMocks.HasherMock{}
uit64Cvt := &mock.Uint64ByteSliceConverterMock{}
nodeTypeProvider := &nodeTypeProviderMock.NodeTypeProviderStub{}
statusHandlerMock := &statusHandler.AppStatusHandlerMock{}

mtStrHandler, _ := NewMetaStorageHandler(gCfg, prefsConfig, coordinator, pathManager, marshalizer, hasher, 1, uit64Cvt, nodeTypeProvider, statusHandlerMock)
mtStrHandler, _ := NewMetaStorageHandler(gCfg, prefsConfig, coordinator, pathManager, marshalizer, hasher, 1, uit64Cvt, nodeTypeProvider)

components := &ComponentsNeededForBootstrap{
EpochStartMetaBlock: &block.MetaBlock{Nonce: 3},
Expand All @@ -157,9 +150,8 @@ func TestMetaStorageHandler_saveDataToStorage(t *testing.T) {
hasher := &hashingMocks.HasherMock{}
uit64Cvt := &mock.Uint64ByteSliceConverterMock{}
nodeTypeProvider := &nodeTypeProviderMock.NodeTypeProviderStub{}
statusHandlerMock := &statusHandler.AppStatusHandlerMock{}

mtStrHandler, _ := NewMetaStorageHandler(gCfg, prefsConfig, coordinator, pathManager, marshalizer, hasher, 1, uit64Cvt, nodeTypeProvider, statusHandlerMock)
mtStrHandler, _ := NewMetaStorageHandler(gCfg, prefsConfig, coordinator, pathManager, marshalizer, hasher, 1, uit64Cvt, nodeTypeProvider)

components := &ComponentsNeededForBootstrap{
EpochStartMetaBlock: &block.MetaBlock{Nonce: 3},
Expand Down
3 changes: 0 additions & 3 deletions epochStart/bootstrap/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,6 @@ func (e *epochStartBootstrap) requestAndProcessForMeta(peerMiniBlocks []*block.M
e.epochStartMeta.GetEpoch(),
e.coreComponentsHolder.Uint64ByteSliceConverter(),
e.coreComponentsHolder.NodeTypeProvider(),
e.coreComponentsHolder.StatusHandler(),
)
if err != nil {
return err
Expand Down Expand Up @@ -914,7 +913,6 @@ func (e *epochStartBootstrap) requestAndProcessForShard(peerMiniBlocks []*block.
e.baseData.lastEpoch,
e.coreComponentsHolder.Uint64ByteSliceConverter(),
e.coreComponentsHolder.NodeTypeProvider(),
e.coreComponentsHolder.StatusHandler(),
)
if err != nil {
return err
Expand Down Expand Up @@ -1090,7 +1088,6 @@ func (e *epochStartBootstrap) createStorageService(
EpochStartNotifier: epochStartNotifier,
NodeTypeProvider: e.coreComponentsHolder.NodeTypeProvider(),
CurrentEpoch: startEpoch,
StatusHandler: e.coreComponentsHolder.StatusHandler(),
CreateTrieEpochRootHashStorer: createTrieEpochRootHashStorer,
})
if err != nil {
Expand Down
2 changes: 0 additions & 2 deletions epochStart/bootstrap/shardStorageHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func NewShardStorageHandler(
currentEpoch uint32,
uint64Converter typeConverters.Uint64ByteSliceConverter,
nodeTypeProvider core.NodeTypeProviderHandler,
statusHandler core.AppStatusHandler,
) (*shardStorageHandler, error) {
epochStartNotifier := &disabled.EpochStartNotifier{}
storageFactory, err := factory.NewStorageServiceFactory(
Expand All @@ -52,7 +51,6 @@ func NewShardStorageHandler(
EpochStartNotifier: epochStartNotifier,
NodeTypeProvider: nodeTypeProvider,
CurrentEpoch: currentEpoch,
StatusHandler: statusHandler,
CreateTrieEpochRootHashStorer: false,
},
)
Expand Down
Loading

0 comments on commit d6260e4

Please sign in to comment.