Skip to content

Commit

Permalink
Add an option to disable teardown for determinism analysis runs
Browse files Browse the repository at this point in the history
  • Loading branch information
caithagoras0 authored and mbasmanova committed Dec 4, 2019
1 parent 2d5ded9 commit d838c9b
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 32 deletions.
64 changes: 33 additions & 31 deletions presto-docs/src/main/sphinx/installation/verifier.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,34 +51,36 @@ make it executable with ``chmod +x``, then run it:
Configuration Reference
-----------------------

================================= =======================================================================
Name Description
================================= =======================================================================
``control.timeout`` The maximum execution time of the control queries.
``test.timeout`` The maximum execution time of the test queries.
``metadata.timeout`` The maximum execution time of the queries that are required for
obtaining table metadata or rewriting queries.
``checksum.timeout`` The maximum execution time of the queries that computes checksum for
the control and the test results.
``whitelist`` A comma-separated list that specifies names of the queries within the
suite to verify.
``blacklist`` A comma-separated list that specifies names of the queries to be
excluded from suite. ``blacklist`` is applied after ``whitelist``.
``source-query.table-name`` Specifies the MySQL table from which to read the source queries for
verification.
``event-clients`` A comma-separated list that specifies where the output events should be
emitted. Valid individual values are ``json`` and ``human-readable``.
``json.log-file`` Specifies the output files for JSON events. If ``json`` is specified in
``event-clients`` but this property is not set, JSON events are emitted
to ``stdout``.
``human-readable.log-file`` Specifies the output files for human readable events. If
``human-readable`` is specified in ``event-clients`` but this property
is not set, human readable events are emitted to ``stdout``.
``max-concurrency`` Specifies the maximum concurrent verification. Alternatively speaking,
the maximum concurrent queries that will be submitted to control and
test clusters combined.
``relative-error-margin`` Specified the maximum tolerable relative error between control and test
queries for floating point columns.
``max-determinism-analysis-runs`` Maximum number of reruns of the control queries in case of a result
mismatch to determine whether the query is deterministic.
================================= =======================================================================
=========================================== =======================================================================
Name Description
=========================================== =======================================================================
``control.timeout`` The maximum execution time of the control queries.
``test.timeout`` The maximum execution time of the test queries.
``metadata.timeout`` The maximum execution time of the queries that are required for
obtaining table metadata or rewriting queries.
``checksum.timeout`` The maximum execution time of the queries that computes checksum for
the control and the test results.
``whitelist`` A comma-separated list that specifies names of the queries within the
suite to verify.
``blacklist`` A comma-separated list that specifies names of the queries to be
excluded from suite. ``blacklist`` is applied after ``whitelist``.
``source-query.table-name`` Specifies the MySQL table from which to read the source queries for
verification.
``event-clients`` A comma-separated list that specifies where the output events should be
emitted. Valid individual values are ``json`` and ``human-readable``.
``json.log-file`` Specifies the output files for JSON events. If ``json`` is specified in
``event-clients`` but this property is not set, JSON events are emitted
to ``stdout``.
``human-readable.log-file`` Specifies the output files for human readable events. If
``human-readable`` is specified in ``event-clients`` but this property
is not set, human readable events are emitted to ``stdout``.
``max-concurrency`` Specifies the maximum concurrent verification. Alternatively speaking,
the maximum concurrent queries that will be submitted to control and
test clusters combined.
``relative-error-margin`` Specified the maximum tolerable relative error between control and test
queries for floating point columns.
``max-determinism-analysis-runs`` Maximum number of reruns of the control queries in case of a result
mismatch to determine whether the query is deterministic.
``run-teardown-for-determinism-analysis`` Whether temporary tables created in determinism analysis runs are
teared down.
=========================================== =======================================================================
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public class DataVerification
private final TypeManager typeManager;
private final ChecksumValidator checksumValidator;
private final LimitQueryDeterminismAnalyzer limitQueryDeterminismAnalyzer;
private final boolean runTeardownForDeterminismAnalysis;

private final int maxDeterminismAnalysisRuns;

Expand All @@ -79,6 +80,7 @@ public DataVerification(
this.typeManager = requireNonNull(typeManager, "typeManager is null");
this.checksumValidator = requireNonNull(checksumValidator, "checksumValidator is null");
this.limitQueryDeterminismAnalyzer = requireNonNull(limitQueryDeterminismAnalyzer, "limitQueryDeterminismAnalyzer is null");
this.runTeardownForDeterminismAnalysis = verifierConfig.isRunTeardownForDeterminismAnalysis();
this.maxDeterminismAnalysisRuns = verifierConfig.getMaxDeterminismAnalysisRuns();
}

Expand Down Expand Up @@ -151,7 +153,9 @@ protected DeterminismAnalysis analyzeDeterminism(QueryBundle control, ChecksumRe
return ANALYSIS_FAILED;
}
finally {
queryBundles.forEach(this::teardownSafely);
if (runTeardownForDeterminismAnalysis) {
queryBundles.forEach(this::teardownSafely);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public class VerifierConfig
private double relativeErrorMargin = 1e-4;
private double absoluteErrorMargin = 1e-12;
private boolean runTeardownOnResultMismatch;
private boolean runTeardownForDeterminismAnalysis;

private int maxDeterminismAnalysisRuns = 2;
private boolean enableLimitQueryDeterminismAnalyzer = true;
private int verificationResubmissionLimit = 2;
Expand Down Expand Up @@ -233,6 +235,19 @@ public VerifierConfig setRunTeardownOnResultMismatch(boolean runTeardownOnResult
return this;
}

public boolean isRunTeardownForDeterminismAnalysis()
{
return runTeardownForDeterminismAnalysis;
}

@ConfigDescription("When set to false, temporary tables are not dropped for determinism analysis runs")
@Config("run-teardown-for-determinism-analysis")
public VerifierConfig setRunTeardownForDeterminismAnalysis(boolean runTeardownForDeterminismAnalysis)
{
this.runTeardownForDeterminismAnalysis = runTeardownForDeterminismAnalysis;
return this;
}

@Min(0)
public int getMaxDeterminismAnalysisRuns()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public void testDefault()
.setRelativeErrorMargin(1e-4)
.setAbsoluteErrorMargin(1e-12)
.setRunTeardownOnResultMismatch(false)
.setRunTeardownForDeterminismAnalysis(false)
.setMaxDeterminismAnalysisRuns(2)
.setEnableLimitQueryDeterminismAnalyzer(true)
.setVerificationResubmissionLimit(2));
Expand All @@ -63,6 +64,7 @@ public void testExplicitPropertyMappings()
.put("relative-error-margin", "2e-5")
.put("absolute-error-margin", "1e-14")
.put("run-teardown-on-result-mismatch", "true")
.put("run-teardown-for-determinism-analysis", "true")
.put("max-determinism-analysis-runs", "3")
.put("enable-limit-query-determinism-analyzer", "false")
.put("verification-resubmission.limit", "1")
Expand All @@ -81,6 +83,7 @@ public void testExplicitPropertyMappings()
.setRelativeErrorMargin(2e-5)
.setAbsoluteErrorMargin(1e-14)
.setRunTeardownOnResultMismatch(true)
.setRunTeardownForDeterminismAnalysis(true)
.setMaxDeterminismAnalysisRuns(3)
.setEnableLimitQueryDeterminismAnalyzer(false)
.setVerificationResubmissionLimit(1);
Expand Down

0 comments on commit d838c9b

Please sign in to comment.