From d838c9baa7e0922d9195abeb93657d5002a51221 Mon Sep 17 00:00:00 2001 From: Leiqing Cai Date: Sun, 1 Dec 2019 22:38:48 -0800 Subject: [PATCH] Add an option to disable teardown for determinism analysis runs --- .../src/main/sphinx/installation/verifier.rst | 64 ++++++++++--------- .../verifier/framework/DataVerification.java | 6 +- .../verifier/framework/VerifierConfig.java | 15 +++++ .../framework/TestVerifierConfig.java | 3 + 4 files changed, 56 insertions(+), 32 deletions(-) diff --git a/presto-docs/src/main/sphinx/installation/verifier.rst b/presto-docs/src/main/sphinx/installation/verifier.rst index 2fefdb2b5743..037324a4e55c 100644 --- a/presto-docs/src/main/sphinx/installation/verifier.rst +++ b/presto-docs/src/main/sphinx/installation/verifier.rst @@ -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. +=========================================== ======================================================================= diff --git a/presto-verifier/src/main/java/com/facebook/presto/verifier/framework/DataVerification.java b/presto-verifier/src/main/java/com/facebook/presto/verifier/framework/DataVerification.java index f4110c25348d..5aea0f1d289c 100644 --- a/presto-verifier/src/main/java/com/facebook/presto/verifier/framework/DataVerification.java +++ b/presto-verifier/src/main/java/com/facebook/presto/verifier/framework/DataVerification.java @@ -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; @@ -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(); } @@ -151,7 +153,9 @@ protected DeterminismAnalysis analyzeDeterminism(QueryBundle control, ChecksumRe return ANALYSIS_FAILED; } finally { - queryBundles.forEach(this::teardownSafely); + if (runTeardownForDeterminismAnalysis) { + queryBundles.forEach(this::teardownSafely); + } } } diff --git a/presto-verifier/src/main/java/com/facebook/presto/verifier/framework/VerifierConfig.java b/presto-verifier/src/main/java/com/facebook/presto/verifier/framework/VerifierConfig.java index 9bdf16f67038..dbdf05ec60d1 100644 --- a/presto-verifier/src/main/java/com/facebook/presto/verifier/framework/VerifierConfig.java +++ b/presto-verifier/src/main/java/com/facebook/presto/verifier/framework/VerifierConfig.java @@ -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; @@ -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() { diff --git a/presto-verifier/src/test/java/com/facebook/presto/verifier/framework/TestVerifierConfig.java b/presto-verifier/src/test/java/com/facebook/presto/verifier/framework/TestVerifierConfig.java index 088289ca0cba..bae405c84c73 100644 --- a/presto-verifier/src/test/java/com/facebook/presto/verifier/framework/TestVerifierConfig.java +++ b/presto-verifier/src/test/java/com/facebook/presto/verifier/framework/TestVerifierConfig.java @@ -41,6 +41,7 @@ public void testDefault() .setRelativeErrorMargin(1e-4) .setAbsoluteErrorMargin(1e-12) .setRunTeardownOnResultMismatch(false) + .setRunTeardownForDeterminismAnalysis(false) .setMaxDeterminismAnalysisRuns(2) .setEnableLimitQueryDeterminismAnalyzer(true) .setVerificationResubmissionLimit(2)); @@ -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") @@ -81,6 +83,7 @@ public void testExplicitPropertyMappings() .setRelativeErrorMargin(2e-5) .setAbsoluteErrorMargin(1e-14) .setRunTeardownOnResultMismatch(true) + .setRunTeardownForDeterminismAnalysis(true) .setMaxDeterminismAnalysisRuns(3) .setEnableLimitQueryDeterminismAnalyzer(false) .setVerificationResubmissionLimit(1);