Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions pom.xml
Original file line numberDiff line numberDiff 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 DownExpand 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
7 changes: 5 additions & 2 deletions src/main/java/org/tikv/common/PDClient.java
Original file line numberDiff line numberDiff line change
Expand Up@@ -841,8 +841,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));
} else {
this.blockingStub = PDGrpc.newBlockingStub(clientChannel);
this.asyncStub = PDGrpc.newFutureStub(clientChannel);
Expand Down
Original file line numberDiff line numberDiff 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 DownExpand 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
8 changes: 6 additions & 2 deletions src/main/java/org/tikv/common/region/RegionStoreClient.java
Original file line numberDiff line numberDiff line change
Expand Up@@ -1395,8 +1395,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));
} else {
channel = channelFactory.getChannel(addressStr, pdClient.getHostMapping());
blockingStub = TikvGrpc.newBlockingStub(channel);
Expand Down