mirror of https://github.com/tikv/client-java.git
Signed-off-by: b.tian <b.tian@trip.com>
This commit is contained in:
parent
9eb11f734b
commit
cfe12d0bd9
18
pom.xml
18
pom.xml
|
@ -57,14 +57,14 @@
|
||||||
<protobuf.version>3.18.0</protobuf.version>
|
<protobuf.version>3.18.0</protobuf.version>
|
||||||
<log4j.version>1.2.17</log4j.version>
|
<log4j.version>1.2.17</log4j.version>
|
||||||
<slf4j.version>1.7.16</slf4j.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>
|
<netty.tcnative.version>2.0.34.Final</netty.tcnative.version>
|
||||||
<gson.version>2.8.9</gson.version>
|
<gson.version>2.8.9</gson.version>
|
||||||
<powermock.version>1.6.6</powermock.version>
|
<powermock.version>1.6.6</powermock.version>
|
||||||
<jackson-annotations.version>2.13.2</jackson-annotations.version>
|
<jackson-annotations.version>2.13.2</jackson-annotations.version>
|
||||||
<jackson.version>2.13.4.2</jackson.version>
|
<jackson.version>2.13.4.2</jackson.version>
|
||||||
<trove4j.version>3.0.1</trove4j.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-time.version>2.9.9</joda-time.version>
|
||||||
<joda-convert.version>1.9.2</joda-convert.version>
|
<joda-convert.version>1.9.2</joda-convert.version>
|
||||||
<proto.folder>${basedir}/proto</proto.folder>
|
<proto.folder>${basedir}/proto</proto.folder>
|
||||||
|
@ -188,20 +188,6 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.etcd</groupId>
|
<groupId>io.etcd</groupId>
|
||||||
<artifactId>jetcd-core</artifactId>
|
<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>
|
<version>${jetcd.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -841,8 +841,11 @@ public class PDClient extends AbstractGRPCClient<PDBlockingStub, PDFutureStub>
|
||||||
Metadata header = new Metadata();
|
Metadata header = new Metadata();
|
||||||
header.put(TiConfiguration.PD_FORWARD_META_DATA_KEY, addrToUri(leaderInfo).toString());
|
header.put(TiConfiguration.PD_FORWARD_META_DATA_KEY, addrToUri(leaderInfo).toString());
|
||||||
this.blockingStub =
|
this.blockingStub =
|
||||||
MetadataUtils.attachHeaders(PDGrpc.newBlockingStub(clientChannel), header);
|
PDGrpc.newBlockingStub(clientChannel)
|
||||||
this.asyncStub = MetadataUtils.attachHeaders(PDGrpc.newFutureStub(clientChannel), header);
|
.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(header));
|
||||||
|
this.asyncStub =
|
||||||
|
PDGrpc.newFutureStub(clientChannel)
|
||||||
|
.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(header));
|
||||||
} else {
|
} else {
|
||||||
this.blockingStub = PDGrpc.newBlockingStub(clientChannel);
|
this.blockingStub = PDGrpc.newBlockingStub(clientChannel);
|
||||||
this.asyncStub = PDGrpc.newFutureStub(clientChannel);
|
this.asyncStub = PDGrpc.newFutureStub(clientChannel);
|
||||||
|
|
|
@ -209,8 +209,9 @@ public abstract class AbstractRegionStoreClient
|
||||||
if (store.getProxyStore() != null) {
|
if (store.getProxyStore() != null) {
|
||||||
Metadata header = new Metadata();
|
Metadata header = new Metadata();
|
||||||
header.put(TiConfiguration.FORWARD_META_DATA_KEY, store.getStore().getAddress());
|
header.put(TiConfiguration.FORWARD_META_DATA_KEY, store.getStore().getAddress());
|
||||||
blockingStub = MetadataUtils.attachHeaders(blockingStub, header);
|
blockingStub =
|
||||||
asyncStub = MetadataUtils.attachHeaders(asyncStub, header);
|
blockingStub.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(header));
|
||||||
|
asyncStub = asyncStub.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(header));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,7 +372,8 @@ public abstract class AbstractRegionStoreClient
|
||||||
.setKey(codec.encodeKey(key))
|
.setKey(codec.encodeKey(key))
|
||||||
.build();
|
.build();
|
||||||
ListenableFuture<Kvrpcpb.RawGetResponse> task =
|
ListenableFuture<Kvrpcpb.RawGetResponse> task =
|
||||||
MetadataUtils.attachHeaders(stub, header).rawGet(rawGetRequest);
|
stub.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(header))
|
||||||
|
.rawGet(rawGetRequest);
|
||||||
responses.add(new ForwardCheckTask(task, peerStore.getStore()));
|
responses.add(new ForwardCheckTask(task, peerStore.getStore()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.warn(
|
logger.warn(
|
||||||
|
|
|
@ -1395,8 +1395,12 @@ public class RegionStoreClient extends AbstractRegionStoreClient {
|
||||||
channelFactory.getChannel(addressStr, regionManager.getPDClient().getHostMapping());
|
channelFactory.getChannel(addressStr, regionManager.getPDClient().getHostMapping());
|
||||||
Metadata header = new Metadata();
|
Metadata header = new Metadata();
|
||||||
header.put(TiConfiguration.FORWARD_META_DATA_KEY, store.getStore().getAddress());
|
header.put(TiConfiguration.FORWARD_META_DATA_KEY, store.getStore().getAddress());
|
||||||
blockingStub = MetadataUtils.attachHeaders(TikvGrpc.newBlockingStub(channel), header);
|
blockingStub =
|
||||||
asyncStub = MetadataUtils.attachHeaders(TikvGrpc.newFutureStub(channel), header);
|
TikvGrpc.newBlockingStub(channel)
|
||||||
|
.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(header));
|
||||||
|
asyncStub =
|
||||||
|
TikvGrpc.newFutureStub(channel)
|
||||||
|
.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(header));
|
||||||
} else {
|
} else {
|
||||||
channel = channelFactory.getChannel(addressStr, pdClient.getHostMapping());
|
channel = channelFactory.getChannel(addressStr, pdClient.getHostMapping());
|
||||||
blockingStub = TikvGrpc.newBlockingStub(channel);
|
blockingStub = TikvGrpc.newBlockingStub(channel);
|
||||||
|
|
Loading…
Reference in New Issue