Skip to content

Commit

Permalink
[Verifier] Add application-name config
Browse files Browse the repository at this point in the history
  • Loading branch information
palashgoel7 authored and shangxinli committed Nov 18, 2020
1 parent 734e8c4 commit 0132bf4
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 6 deletions.
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

0 comments on commit 0132bf4

Please sign in to comment.