Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sprint 1.14 benchmark tests #3239

Open
wants to merge 9 commits into
base: sprint-1.14
Choose a base branch
from
16 changes: 11 additions & 5 deletions code/go/0chain.net/smartcontract/dbs/benchmark/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ func AddMockEvents(eventDb *event.EventDb) {
return
}

var events []event.Event
events := make([]event.Event, 0, viper.GetInt(benchmark.NumTransactionPerBlock))
for round := benchmark.GetOldestAggregateRound(); round < viper.GetInt64(benchmark.NumBlocks); round++ {
_ = eventDb.ManagePartitions(round)
if round % viper.GetInt64(benchmark.EventDbPartitionChangePeriod) == 0 {
_ = eventDb.ManagePartitions(round / viper.GetInt64(benchmark.EventDbPartitionChangePeriod))
}

for i := 0; i <= viper.GetInt(benchmark.NumTransactionPerBlock); i++ {
events = append(events, event.Event{
BlockNumber: round,
Expand All @@ -34,9 +37,12 @@ func AddMockEvents(eventDb *event.EventDb) {
})

}
}
if res := eventDb.Store.Get().Create(&events); res.Error != nil {
log.Fatal("adding mock events", res.Error)

if res := eventDb.Store.Get().Create(&events); res.Error != nil {
log.Fatal("adding mock events", res.Error)
}

events = events[:0]
}
}

Expand Down
2 changes: 2 additions & 0 deletions docker.local/config/benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ dbs:
slowtablespace: hdd_tablespace
settings:
debug: false
permanent_partition_change_period: 2000000
permanent_partition_keep_count: 1
aggregate_period: 10
partition_change_period: 100
partition_keep_count: 10
Expand Down