-
Notifications
You must be signed in to change notification settings - Fork 20.8k
cmd/workload: fixed filter test request error handling #31424
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,6 +71,9 @@ func filterGenCmd(ctx *cli.Context) error { | |
f.updateFinalizedBlock() | ||
query := f.newQuery() | ||
query.run(f.client, nil) | ||
if query.Err == errPrunedHistory { | ||
continue | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should error here. It's not really possible to generate meaningful tests on a pruned node. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed it so that the generator exits on errors instead of collecting them into a separate file. It also fails on history pruning errors. Now I think it doesn't make sense to collect errors into a file during generation as the test vectors should be generated in a correct environment. On the other hand it does make sense to collect errors during the performance test so I added it there (the |
||
} | ||
if query.Err != nil { | ||
f.errors = append(f.errors, query) | ||
continue | ||
|
@@ -82,6 +85,9 @@ func filterGenCmd(ctx *cli.Context) error { | |
break | ||
} | ||
extQuery.run(f.client, nil) | ||
if extQuery.Err == errPrunedHistory { | ||
break | ||
} | ||
if extQuery.Err == nil && len(extQuery.results) < len(query.results) { | ||
extQuery.Err = fmt.Errorf("invalid result length; old range %d %d; old length %d; new range %d %d; new length %d; address %v; Topics %v", | ||
query.FromBlock, query.ToBlock, len(query.results), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ var ( | |
} | ||
) | ||
|
||
const passCount = 1 | ||
const passCount = 3 | ||
|
||
func filterPerfCmd(ctx *cli.Context) error { | ||
cfg := testConfigFromCLI(ctx) | ||
|
@@ -61,7 +61,7 @@ func filterPerfCmd(ctx *cli.Context) error { | |
} | ||
|
||
// Run test queries. | ||
var failed, mismatch int | ||
var failed, pruned, mismatch int | ||
for i := 1; i <= passCount; i++ { | ||
fmt.Println("Performance test pass", i, "/", passCount) | ||
for len(queries) > 0 { | ||
|
@@ -71,6 +71,10 @@ func filterPerfCmd(ctx *cli.Context) error { | |
queries = queries[:len(queries)-1] | ||
start := time.Now() | ||
qt.query.run(cfg.client, cfg.historyPruneBlock) | ||
if qt.query.Err == errPrunedHistory { | ||
pruned++ | ||
continue | ||
} | ||
qt.runtime = append(qt.runtime, time.Since(start)) | ||
slices.Sort(qt.runtime) | ||
qt.medianTime = qt.runtime[len(qt.runtime)/2] | ||
|
@@ -80,18 +84,19 @@ func filterPerfCmd(ctx *cli.Context) error { | |
} | ||
if rhash := qt.query.calculateHash(); *qt.query.ResultHash != rhash { | ||
fmt.Printf("Filter query result mismatch: fromBlock: %d toBlock: %d addresses: %v topics: %v expected hash: %064x calculated hash: %064x\n", qt.query.FromBlock, qt.query.ToBlock, qt.query.Address, qt.query.Topics, *qt.query.ResultHash, rhash) | ||
mismatch++ | ||
continue | ||
} | ||
processed = append(processed, qt) | ||
if len(processed)%50 == 0 { | ||
fmt.Println(" processed:", len(processed), "remaining", len(queries), "failed:", failed, "result mismatch:", mismatch) | ||
fmt.Println(" processed:", len(processed), "remaining", len(queries), "failed:", failed, "pruned:", pruned, "result mismatch:", mismatch) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In general, we should replace |
||
} | ||
} | ||
queries, processed = processed, nil | ||
} | ||
|
||
// Show results and stats. | ||
fmt.Println("Performance test finished; processed:", len(queries), "failed:", failed, "result mismatch:", mismatch) | ||
fmt.Println("Performance test finished; processed:", len(queries), "failed:", failed, "pruned:", pruned, "result mismatch:", mismatch) | ||
stats := make([]bucketStats, len(f.queries)) | ||
var wildcardStats bucketStats | ||
for _, qt := range queries { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
crap. big oversight on my part.. whoops
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was correct at some point. I must have inadvertently broken it before my original PR was merged.