From 853b149b86dcf1eddfc4bfe5307c5e6707253aff Mon Sep 17 00:00:00 2001 From: Hengfeng Li Date: Thu, 16 May 2024 12:38:02 +1000 Subject: [PATCH] Fix some comments. --- benchmarks/tpcc/README.md | 24 +++++++++---------- benchmarks/tpcc/pom.xml | 3 +-- .../pgadapter/tpcc/BenchmarkApplication.java | 11 ++++----- .../pgadapter/metadata/OptionsMetadata.java | 13 +--------- .../statements/BackendConnection.java | 10 ++++---- 5 files changed, 23 insertions(+), 38 deletions(-) diff --git a/benchmarks/tpcc/README.md b/benchmarks/tpcc/README.md index 06cc1fa7e..3d08dfd14 100644 --- a/benchmarks/tpcc/README.md +++ b/benchmarks/tpcc/README.md @@ -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 " ``` @@ -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 " ``` @@ -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 " ``` diff --git a/benchmarks/tpcc/pom.xml b/benchmarks/tpcc/pom.xml index c2e57a927..6b7a03035 100644 --- a/benchmarks/tpcc/pom.xml +++ b/benchmarks/tpcc/pom.xml @@ -49,13 +49,12 @@ com.google.cloud google-cloud-spanner-jdbc - 2.17.0 com.google.cloud google-cloud-spanner-pgadapter - 0.33.1-SNAPSHOT + 0.33.1 io.opentelemetry diff --git a/benchmarks/tpcc/src/main/java/com/google/cloud/pgadapter/tpcc/BenchmarkApplication.java b/benchmarks/tpcc/src/main/java/com/google/cloud/pgadapter/tpcc/BenchmarkApplication.java index 43942cd13..9ea4e93b7 100644 --- a/benchmarks/tpcc/src/main/java/com/google/cloud/pgadapter/tpcc/BenchmarkApplication.java +++ b/benchmarks/tpcc/src/main/java/com/google/cloud/pgadapter/tpcc/BenchmarkApplication.java @@ -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" diff --git a/src/main/java/com/google/cloud/spanner/pgadapter/metadata/OptionsMetadata.java b/src/main/java/com/google/cloud/spanner/pgadapter/metadata/OptionsMetadata.java index a6729d38d..6ded913a2 100644 --- a/src/main/java/com/google/cloud/spanner/pgadapter/metadata/OptionsMetadata.java +++ b/src/main/java/com/google/cloud/spanner/pgadapter/metadata/OptionsMetadata.java @@ -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; @@ -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 @@ -454,8 +447,7 @@ private String[] toCommandLineArguments() { || databaseRole != null || autoConfigEmulator || useVirtualThreads - || useVirtualGrpcTransportThreads - || disableInternalRetries) { + || useVirtualGrpcTransportThreads) { StringBuilder jdbcOptionBuilder = new StringBuilder(); if (usePlainText) { jdbcOptionBuilder.append("usePlainText=true;"); @@ -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) { diff --git a/src/main/java/com/google/cloud/spanner/pgadapter/statements/BackendConnection.java b/src/main/java/com/google/cloud/spanner/pgadapter/statements/BackendConnection.java index da370e93e..06b334930 100644 --- a/src/main/java/com/google/cloud/spanner/pgadapter/statements/BackendConnection.java +++ b/src/main/java/com/google/cloud/spanner/pgadapter/statements/BackendConnection.java @@ -261,9 +261,8 @@ private final class Execute extends BufferedStatement { String command, ParsedStatement parsedStatement, Statement statement, - Function statementBinder, - DatabaseId databaseId) { - this(command, parsedStatement, statement, statementBinder, databaseId, false); + Function statementBinder) { + this(command, parsedStatement, statement, statementBinder, false); } Execute( @@ -271,7 +270,6 @@ private final class Execute extends BufferedStatement { ParsedStatement parsedStatement, Statement statement, Function statementBinder, - DatabaseId databaseId, boolean analyze) { super(parsedStatement, statement); this.command = command; @@ -972,7 +970,7 @@ public Future execute( ParsedStatement parsedStatement, Statement statement, Function statementBinder) { - Execute execute = new Execute(command, parsedStatement, statement, statementBinder, databaseId); + Execute execute = new Execute(command, parsedStatement, statement, statementBinder); bufferedStatements.add(execute); return execute.result; } @@ -980,7 +978,7 @@ public Future execute( public ListenableFuture 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; }