Skip to content

Commit

Permalink
disable retries by default in YDB GRPC channel
Browse files Browse the repository at this point in the history
disable retry in YDB GRPC channel by default due to grpc/grpc-java#9340
  • Loading branch information
egorlitvinenk committed Sep 20, 2022
1 parent 477eb5d commit 49bd266
Show file tree
Hide file tree
Showing 23 changed files with 54 additions and 22 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.14.7 ##

* Disabled grpc retry https://github.com/grpc/grpc-java/issues/9340

## 1.14.6 ##

* SnapshotReadOnly transactions support
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ dependencies:
<dependency>
<groupId>com.yandex.ydb</groupId>
<artifactId>ydb-sdk-core</artifactId>
<version>1.14.6</version>
<version>1.14.7</version>
</dependency>
<dependency>
<groupId>com.yandex.ydb</groupId>
<artifactId>ydb-sdk-table</artifactId>
<version>1.14.6</version>
<version>1.14.7</version>
</dependency>
<dependency>
<groupId>com.yandex.ydb</groupId>
<artifactId>ydb-sdk-auth-iam</artifactId>
<version>1.14.6</version>
<version>1.14.7</version>
</dependency>
</dependencies>
```
Expand Down
2 changes: 1 addition & 1 deletion auth-iam/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>com.yandex.ydb</groupId>
<artifactId>ydb-sdk-parent</artifactId>
<version>1.14.6</version>
<version>1.14.7</version>
</parent>

<artifactId>ydb-sdk-auth-iam</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>com.yandex.ydb</groupId>
<artifactId>ydb-sdk-parent</artifactId>
<version>1.14.6</version>
<version>1.14.7</version>
</parent>

<artifactId>ydb-sdk-core</artifactId>
Expand Down
22 changes: 22 additions & 0 deletions core/src/main/java/com/yandex/ydb/core/grpc/GrpcTransport.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import io.grpc.ClientInterceptor;
import io.grpc.ClientInterceptors;
import io.grpc.ConnectivityState;
import io.grpc.ExperimentalApi;
import io.grpc.ManagedChannel;
import io.grpc.Metadata;
import io.grpc.MethodDescriptor;
Expand Down Expand Up @@ -480,6 +481,11 @@ public static final class Builder extends RpcTransportBuilder<GrpcTransport, Bui
private DiscoveryMode discoveryMode = DiscoveryMode.SYNC;
private TransportImplType transportImplType = TransportImplType.GRPC_TRANSPORT_IMPL;
private BalancingSettings balancingSettings;
/**
* can cause leaks
* https://github.com/grpc/grpc-java/issues/9340
*/
private boolean enableRetry = false;

private Builder(@Nullable String endpoint, @Nullable String database, @Nullable List<HostAndPort> hosts) {
this.endpoint = endpoint;
Expand Down Expand Up @@ -583,6 +589,22 @@ public Builder withBalancingSettings(BalancingSettings balancingSettings) {
return this;
}

public boolean isEnableRetry() {
return enableRetry;
}

@ExperimentalApi("https://github.com/grpc/grpc-java/issues/9340")
public Builder enableRetry() {
this.enableRetry = true;
return this;
}

@ExperimentalApi("https://github.com/grpc/grpc-java/issues/9340")
public Builder disableRetry() {
this.enableRetry = false;
return this;
}

@Override
public GrpcTransport build() {
switch (transportImplType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ private static ManagedChannel createChannel(GrpcTransport.Builder builder, Chann
.maxInboundMessageSize(64 << 20) // 64 MiB
.withOption(ChannelOption.ALLOCATOR, ByteBufAllocator.DEFAULT);

if (builder.isEnableRetry()) {
channelBuilder.enableRetry();
} else {
channelBuilder.disableRetry();
}

builder.getChannelInitializer().accept(channelBuilder);
return channelBuilder.build();
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/version.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=1.14.6
version=1.14.7
2 changes: 1 addition & 1 deletion examples/auth/access_token_credentials/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.yandex.ydb.examples</groupId>
<artifactId>ydb-sdk-auth-examples</artifactId>
<version>1.14.6</version>
<version>1.14.7</version>
</parent>

<artifactId>ydb-java-example-auth-access-token</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/auth/anonymous_credentials/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.yandex.ydb.examples</groupId>
<artifactId>ydb-sdk-auth-examples</artifactId>
<version>1.14.6</version>
<version>1.14.7</version>
</parent>

<artifactId>ydb-java-example-auth-anonymous-credentials</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/auth/environ/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.yandex.ydb.examples</groupId>
<artifactId>ydb-sdk-auth-examples</artifactId>
<version>1.14.6</version>
<version>1.14.7</version>
</parent>

<artifactId>ydb-java-example-auth-environ</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/auth/metadata_credentials/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.yandex.ydb.examples</groupId>
<artifactId>ydb-sdk-auth-examples</artifactId>
<version>1.14.6</version>
<version>1.14.7</version>
</parent>

<artifactId>ydb-java-example-auth-metadata-credentials</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/auth/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>com.yandex.ydb.examples</groupId>
<artifactId>ydb-sdk-examples</artifactId>
<version>1.14.6</version>
<version>1.14.7</version>
</parent>

<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion examples/auth/service_account_credentials/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.yandex.ydb.examples</groupId>
<artifactId>ydb-sdk-auth-examples</artifactId>
<version>1.14.6</version>
<version>1.14.7</version>
</parent>

<artifactId>ydb-java-example-auth-service-account-credentials</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/basic_example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.yandex.ydb.examples</groupId>
<artifactId>ydb-sdk-examples</artifactId>
<version>1.14.6</version>
<version>1.14.7</version>
</parent>

<artifactId>ydb-basic-example</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>com.yandex.ydb.examples</groupId>
<artifactId>ydb-sdk-examples</artifactId>
<version>1.14.6</version>
<version>1.14.7</version>

<packaging>pom</packaging>

Expand Down
2 changes: 1 addition & 1 deletion examples/secondary_index/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.yandex.ydb.examples</groupId>
<artifactId>ydb-sdk-examples</artifactId>
<version>1.14.6</version>
<version>1.14.7</version>
</parent>

<artifactId>ydb-secondary-index-project</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/url-shortener-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>com.yandex.ydb.examples</groupId>
<artifactId>ydb-sdk-examples</artifactId>
<version>1.14.6</version>
<version>1.14.7</version>
</parent>

<artifactId>url-shortener-demo</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/ydb-cookbook/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>com.yandex.ydb.examples</groupId>
<artifactId>ydb-sdk-examples</artifactId>
<version>1.14.6</version>
<version>1.14.7</version>
</parent>

<artifactId>ydb-cookbook</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>com.yandex.ydb</groupId>
<artifactId>ydb-sdk-parent</artifactId>
<version>1.14.6</version>
<version>1.14.7</version>
</parent>

<artifactId>ydb-sdk-jdbc</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jdbc/uberjar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>com.yandex.ydb</groupId>
<artifactId>ydb-sdk-parent</artifactId>
<version>1.14.6</version>
<version>1.14.7</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<groupId>com.yandex.ydb</groupId>
<artifactId>ydb-sdk-parent</artifactId>
<version>1.14.6</version>
<version>1.14.7</version>

<name>Java SDK for Yandex Datatabase (YDB)</name>
<description>Java SDK for Yandex Datatabase (YDB)</description>
Expand Down
2 changes: 1 addition & 1 deletion protobuf-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>com.yandex.ydb</groupId>
<artifactId>ydb-sdk-parent</artifactId>
<version>1.14.6</version>
<version>1.14.7</version>
</parent>

<artifactId>ydb-sdk-proto</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion table/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>com.yandex.ydb</groupId>
<artifactId>ydb-sdk-parent</artifactId>
<version>1.14.6</version>
<version>1.14.7</version>
</parent>

<artifactId>ydb-sdk-table</artifactId>
Expand Down

0 comments on commit 49bd266

Please sign in to comment.