Skip to content

Commit

Permalink
Fix some comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
hengfengli committed May 16, 2024
1 parent 826bca0 commit 853b149
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 38 deletions.
24 changes: 12 additions & 12 deletions benchmarks/tpcc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ mvn spring-boot:run -Dspring-boot.run.arguments="
--tpcc.run-benchmark=false
--tpcc.use-read-only-transactions=false
--tpcc.lock-scanned-ranges=false
--spanner.project=appdev-soda-spanner-staging
--spanner.instance=knut-test-ycsb
--spanner.database=tpcc2
--pgadapter.credentials=/home/loite/appdev-soda-spanner-staging.json
--spanner.project=my-project
--spanner.instance=my-instance
--spanner.database=my-database
--pgadapter.credentials=/path/to/credentials.json
--pgadapter.disable-internal-retries=false
"
```
Expand All @@ -57,10 +57,10 @@ mvn spring-boot:run -Dspring-boot.run.arguments="
--tpcc.benchmark-runner=pgadapter
--tpcc.use-read-only-transactions=true
--tpcc.lock-scanned-ranges=false
--spanner.project=appdev-soda-spanner-staging
--spanner.instance=knut-test-ycsb
--spanner.database=tpcc2
--pgadapter.credentials=/home/loite/appdev-soda-spanner-staging.json
--spanner.project=my-project
--spanner.instance=my-instance
--spanner.database=my-database
--pgadapter.credentials=/path/to/credentials.json
--pgadapter.disable-internal-retries=true
"
```
Expand All @@ -78,10 +78,10 @@ mvn spring-boot:run -Dspring-boot.run.arguments="
--tpcc.benchmark-runner=spanner_jdbc
--tpcc.use-read-only-transactions=true
--tpcc.lock-scanned-ranges=false
--spanner.project=appdev-soda-spanner-staging
--spanner.instance=knut-test-ycsb
--spanner.database=tpcc2
--pgadapter.credentials=/home/loite/appdev-soda-spanner-staging.json
--spanner.project=my-project
--spanner.instance=my-instance
--spanner.database=my-database
--pgadapter.credentials=/path/to/credentials.json
--pgadapter.disable-internal-retries=true
"
```
3 changes: 1 addition & 2 deletions benchmarks/tpcc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,12 @@
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-spanner-jdbc</artifactId>
<version>2.17.0</version>
</dependency>
<!-- Add PGAdapter as a dependency, so we can start it in-process -->
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-spanner-pgadapter</artifactId>
<version>0.33.1-SNAPSHOT</version>
<version>0.33.1</version>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,11 @@ public BenchmarkApplication(
@Override
public void run(String... args) throws Exception {
ProxyServer server = pgAdapterConfiguration.isInProcess() ? startPGAdapter() : null;
String pgadapterConnectionUrl =
server == null
? pgAdapterConfiguration.getConnectionUrl()
: String.format(
"jdbc:postgresql://localhost:%d/tpcc?preferQueryMode=simple",
server.getLocalPort());
String pgadapterConnectionUrl = server == null
? pgAdapterConfiguration.getConnectionUrl()
: String.format(
"jdbc:postgresql://localhost:%d/tpcc",
server.getLocalPort());
String spannerConnectionUrl =
String.format(
"jdbc:cloudspanner:/projects/%s/instances/%s/databases/%s?numChannels=%d;minSessions=%d;maxSessions=%d"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ public static class Builder {
private DdlTransactionMode ddlTransactionMode;
private String credentialsFile;
private Credentials credentials;
private boolean disableInternalRetries;
private boolean requireAuthentication;
private boolean enableOpenTelemetry;
private boolean enableOpenTelemetryMetrics;
Expand Down Expand Up @@ -231,12 +230,6 @@ public Builder setCredentials(Credentials credentials) {
return this;
}

/** Disables internal retries of aborted read/write transactions. */
public Builder setDisableInternalRetries() {
this.disableInternalRetries = true;
return this;
}

/**
* Require PostgreSQL clients that connect to PGAdapter to authenticate. The PostgreSQL client
* should provide the serialized credentials that PGAdapter should use to connect to Cloud
Expand Down Expand Up @@ -454,8 +447,7 @@ private String[] toCommandLineArguments() {
|| databaseRole != null
|| autoConfigEmulator
|| useVirtualThreads
|| useVirtualGrpcTransportThreads
|| disableInternalRetries) {
|| useVirtualGrpcTransportThreads) {
StringBuilder jdbcOptionBuilder = new StringBuilder();
if (usePlainText) {
jdbcOptionBuilder.append("usePlainText=true;");
Expand All @@ -479,9 +471,6 @@ private String[] toCommandLineArguments() {
.append(ConnectionOptions.USE_VIRTUAL_GRPC_TRANSPORT_THREADS_PROPERTY_NAME)
.append("=true;");
}
if (disableInternalRetries) {
jdbcOptionBuilder.append("retryAbortsInternally=false;");
}
addOption(args, OPTION_JDBC_PROPERTIES, jdbcOptionBuilder.toString());
}
if (debugMode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,17 +261,15 @@ private final class Execute extends BufferedStatement<StatementResult> {
String command,
ParsedStatement parsedStatement,
Statement statement,
Function<Statement, Statement> statementBinder,
DatabaseId databaseId) {
this(command, parsedStatement, statement, statementBinder, databaseId, false);
Function<Statement, Statement> statementBinder) {
this(command, parsedStatement, statement, statementBinder, false);
}

Execute(
String command,
ParsedStatement parsedStatement,
Statement statement,
Function<Statement, Statement> statementBinder,
DatabaseId databaseId,
boolean analyze) {
super(parsedStatement, statement);
this.command = command;
Expand Down Expand Up @@ -972,15 +970,15 @@ public Future<StatementResult> execute(
ParsedStatement parsedStatement,
Statement statement,
Function<Statement, Statement> statementBinder) {
Execute execute = new Execute(command, parsedStatement, statement, statementBinder, databaseId);
Execute execute = new Execute(command, parsedStatement, statement, statementBinder);
bufferedStatements.add(execute);
return execute.result;
}

public ListenableFuture<StatementResult> analyze(
String command, ParsedStatement parsedStatement, Statement statement) {
Execute execute =
new Execute(command, parsedStatement, statement, Function.identity(), databaseId, true);
new Execute(command, parsedStatement, statement, Function.identity(), true);
bufferedStatements.add(execute);
return execute.result;
}
Expand Down

0 comments on commit 853b149

Please sign in to comment.