Skip to content

Commit

Permalink
bump grpc to 1.60.0
Browse files Browse the repository at this point in the history
Signed-off-by: iosmanthus <[email protected]>
  • Loading branch information
iosmanthus committed Mar 28, 2024
1 parent 0af4384 commit 81ba2f3
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 23 deletions.
18 changes: 2 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@
<protobuf.version>3.18.0</protobuf.version>
<log4j.version>1.2.17</log4j.version>
<slf4j.version>1.7.16</slf4j.version>
<grpc.version>1.48.0</grpc.version>
<grpc.version>1.60.0</grpc.version>
<netty.tcnative.version>2.0.34.Final</netty.tcnative.version>
<gson.version>2.8.9</gson.version>
<powermock.version>1.6.6</powermock.version>
<jackson-annotations.version>2.13.2</jackson-annotations.version>
<jackson.version>2.13.4.2</jackson.version>
<trove4j.version>3.0.1</trove4j.version>
<jetcd.version>0.4.1</jetcd.version>
<jetcd.version>0.7.7</jetcd.version>
<joda-time.version>2.9.9</joda-time.version>
<joda-convert.version>1.9.2</joda-convert.version>
<proto.folder>${basedir}/proto</proto.folder>
Expand Down Expand Up @@ -188,20 +188,6 @@
<dependency>
<groupId>io.etcd</groupId>
<artifactId>jetcd-core</artifactId>
<exclusions>
<exclusion>
<groupId>io.etcd</groupId>
<artifactId>jetcd-resolver</artifactId>
</exclusion>
<exclusion>
<groupId>io.etcd</groupId>
<artifactId>jetcd-common</artifactId>
</exclusion>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>grpc-grpclb</artifactId>
</exclusion>
</exclusions>
<version>${jetcd.version}</version>
</dependency>
<dependency>
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/org/tikv/common/PDClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@

public class PDClient extends AbstractGRPCClient<PDBlockingStub, PDFutureStub>
implements ReadOnlyPDClient {

private static final String TIFLASH_TABLE_SYNC_PROGRESS_PATH = "/tiflash/table/sync";
private static final long MIN_TRY_UPDATE_DURATION = 50;
private static final int PAUSE_CHECKER_TIMEOUT = 300; // in seconds
Expand Down Expand Up @@ -829,6 +830,7 @@ private void initCluster() {
}

static class PDClientWrapper {

private final String leaderInfo;
private final PDBlockingStub blockingStub;
private final PDFutureStub asyncStub;
Expand All @@ -841,8 +843,11 @@ static class PDClientWrapper {
Metadata header = new Metadata();
header.put(TiConfiguration.PD_FORWARD_META_DATA_KEY, addrToUri(leaderInfo).toString());
this.blockingStub =
MetadataUtils.attachHeaders(PDGrpc.newBlockingStub(clientChannel), header);
this.asyncStub = MetadataUtils.attachHeaders(PDGrpc.newFutureStub(clientChannel), header);
PDGrpc.newBlockingStub(clientChannel)
.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(header));
this.asyncStub =
PDGrpc.newFutureStub(clientChannel)
.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(header));

Check warning on line 850 in src/main/java/org/tikv/common/PDClient.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/tikv/common/PDClient.java#L846-L850

Added lines #L846 - L850 were not covered by tests
} else {
this.blockingStub = PDGrpc.newBlockingStub(clientChannel);
this.asyncStub = PDGrpc.newFutureStub(clientChannel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,9 @@ private void updateClientStub() {
if (store.getProxyStore() != null) {
Metadata header = new Metadata();
header.put(TiConfiguration.FORWARD_META_DATA_KEY, store.getStore().getAddress());
blockingStub = MetadataUtils.attachHeaders(blockingStub, header);
asyncStub = MetadataUtils.attachHeaders(asyncStub, header);
blockingStub =
blockingStub.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(header));
asyncStub = asyncStub.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(header));
}
}

Expand Down Expand Up @@ -371,7 +372,8 @@ private TiStore switchProxyStore(BackOffer backOffer) {
.setKey(codec.encodeKey(key))
.build();
ListenableFuture<Kvrpcpb.RawGetResponse> task =
MetadataUtils.attachHeaders(stub, header).rawGet(rawGetRequest);
stub.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(header))
.rawGet(rawGetRequest);
responses.add(new ForwardCheckTask(task, peerStore.getStore()));
} catch (Exception e) {
logger.warn(
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/org/tikv/common/region/RegionStoreClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@

/** Note that RegionStoreClient itself is not thread-safe */
public class RegionStoreClient extends AbstractRegionStoreClient {

private static final Logger logger = LoggerFactory.getLogger(RegionStoreClient.class);
@VisibleForTesting public final AbstractLockResolverClient lockResolverClient;
private final TiStoreType storeType;
Expand Down Expand Up @@ -1395,8 +1396,12 @@ public RegionStoreClient build(TiRegion region, TiStore store, TiStoreType store
channelFactory.getChannel(addressStr, regionManager.getPDClient().getHostMapping());
Metadata header = new Metadata();
header.put(TiConfiguration.FORWARD_META_DATA_KEY, store.getStore().getAddress());
blockingStub = MetadataUtils.attachHeaders(TikvGrpc.newBlockingStub(channel), header);
asyncStub = MetadataUtils.attachHeaders(TikvGrpc.newFutureStub(channel), header);
blockingStub =
TikvGrpc.newBlockingStub(channel)
.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(header));
asyncStub =
TikvGrpc.newFutureStub(channel)
.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(header));

Check warning on line 1404 in src/main/java/org/tikv/common/region/RegionStoreClient.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/tikv/common/region/RegionStoreClient.java#L1399-L1404

Added lines #L1399 - L1404 were not covered by tests
} else {
channel = channelFactory.getChannel(addressStr, pdClient.getHostMapping());
blockingStub = TikvGrpc.newBlockingStub(channel);
Expand Down

0 comments on commit 81ba2f3

Please sign in to comment.