Skip to content

Commit 383f70d

Browse files
authored
When correcting yamsql metrics, only update queries with differences (#3563)
Without this change, if you add a new query and run the test with CORRECT_METRICS, it will update all the timings for all of the other queries. This is less important for the binp, but can make it hard to look at the metrics yaml diff, as there will be many lines to ignore. With this change, it will keep the original info for every query that did not result in a diffence. Here I have a demo of how this looks with this change: ScottDugas@b32570a And here is how it looks if I run it without this change: ScottDugas@8f0778f
1 parent 27846c0 commit 383f70d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/queryconfigs/CheckExplainConfig.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,16 @@ private void checkMetrics(final @Nonnull String currentQuery,
189189
final var actualCountersAndTimers = actualInfo.getCountersAndTimers();
190190
final var metricsDescriptor = expectedCountersAndTimers.getDescriptorForType();
191191

192-
executionContext.putMetrics(blockName, currentQuery, lineNumber, actualInfo, setups);
193192
if (areMetricsDifferent(expectedCountersAndTimers, actualCountersAndTimers, metricsDescriptor)) {
193+
executionContext.putMetrics(blockName, currentQuery, lineNumber, actualInfo, setups);
194194
if (executionContext.shouldCorrectMetrics()) {
195195
executionContext.markDirty();
196196
logger.debug(() -> "⭐️ Successfully updated planner metrics at line " + getLineNumber());
197197
} else {
198198
QueryCommand.reportTestFailure("‼️ Planner metrics have changed for line " + getLineNumber());
199199
}
200+
} else {
201+
executionContext.putMetrics(blockName, currentQuery, lineNumber, expectedPlannerMetricsInfo, setups);
200202
}
201203
}
202204
}

0 commit comments

Comments
 (0)