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

[Verifier] Add application-name config #15191

Merged
merged 1 commit into from
Sep 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions presto-docs/src/main/sphinx/admin/verifier.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,16 @@ Next, create a ``config.properties`` file:

.. code-block:: none

source-query.suite=my_suite
source-query.database=jdbc:mysql://localhost:3306/my_database?user=my_username&password=my_password
control.gateway=jdbc:presto://localhost:8080
test.gateway=jdbc:presto://localhost:8081
source-query.suites=suite
source-query.database=jdbc:mysql://localhost:3306/mydb?user=my_username&password=my_password
control.hosts=127.0.0.1
control.http-port=8080
control.jdbc-port=8080
control.application-name=verifier-test
test.hosts=127.0.0.1
test.http-port=8081
test.jdbc-port=8081
test.application-name=verifier-test
test-id=1

Download :maven_download:`verifier` and rename it to ``verifier``. To run the Verifier:
Expand Down Expand Up @@ -274,6 +280,7 @@ Name Description
``control.query-timeout`` The execution time limit of the control and the test queries.
``control.metadata-timeout`` The execution time limit of ``DESC`` queries and ``LIMIT 0`` queries.
``control.checksum-timeout`` The execution time limit of checksum queries.
``control.application-name`` ApplicationName to be passed in ClientInfo. Can be used to set source.
=========================================== ===============================================================================

Determinism Analyzer Configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public class JdbcPrestoAction
private final Duration checksumTimeout;
private final String testId;
private final Optional<String> testName;
private final String applicationName;

private final RetryDriver<QueryException> networkRetry;
private final RetryDriver<QueryException> prestoRetry;
Expand All @@ -85,6 +86,7 @@ public JdbcPrestoAction(

this.jdbcUrls = requireNonNull(cycle(prestoActionConfig.getJdbcUrls()), "jdbcUrls is null");
this.queryTimeout = requireNonNull(prestoActionConfig.getQueryTimeout(), "queryTimeout is null");
this.applicationName = requireNonNull(prestoActionConfig.getApplicationName(), "applicationName is null");
this.metadataTimeout = requireNonNull(metadataTimeout, "metadataTimeout is null");
this.checksumTimeout = requireNonNull(checksumTimeout, "checksumTimeout is null");
this.testId = requireNonNull(verifierConfig.getTestId(), "testId is null");
Expand Down Expand Up @@ -154,7 +156,7 @@ private PrestoConnection getConnection(QueryStage queryStage, String clientInfo)
.unwrap(PrestoConnection.class);

try {
connection.setClientInfo("ApplicationName", "verifier-test");
connection.setClientInfo("ApplicationName", applicationName);
connection.setClientInfo("ClientInfo", clientInfo);
connection.setCatalog(queryConfiguration.getCatalog());
connection.setSchema(queryConfiguration.getSchema());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class PrestoActionConfig
private Optional<Integer> httpPort = Optional.empty();
private Map<String, String> jdbcUrlParameters = ImmutableMap.of();
private Duration queryTimeout = new Duration(60, MINUTES);
private String applicationName = "verifier-test";

@Override
@NotNull
Expand Down Expand Up @@ -126,4 +127,17 @@ public PrestoActionConfig setQueryTimeout(Duration queryTimeout)
this.queryTimeout = queryTimeout;
return this;
}

@NotNull
public String getApplicationName()
{
return applicationName;
}

@Config("application-name")
public PrestoActionConfig setApplicationName(String applicationName)
{
this.applicationName = applicationName;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public void testDefault()
.setJdbcPort(0)
.setHttpPort(null)
.setJdbcUrlParameters(null)
.setApplicationName("verifier-test")
.setQueryTimeout(new Duration(60, MINUTES)));
}

Expand All @@ -50,13 +51,15 @@ public void testExplicitPropertyMappings()
.put("http-port", "7777")
.put("jdbc-url-parameters", "{\"SSL\": false}")
.put("query-timeout", "2h")
.put("application-name", "verifier")
.build();
PrestoActionConfig expected = new PrestoActionConfig()
.setHosts("proxy.presto.fbinfra.net")
.setJdbcPort(7778)
.setHttpPort(7777)
.setJdbcUrlParameters("{\"SSL\": false}")
.setQueryTimeout(new Duration(2, HOURS));
.setQueryTimeout(new Duration(2, HOURS))
.setApplicationName("verifier");

assertFullMapping(properties, expected);
}
Expand Down