Skip to content

Commit

Permalink
Expose forward and set it to false in default (#2641) (#2647)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Mar 15, 2023
1 parent 874ddc2 commit c2c70d7
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/src/main/scala/com/pingcap/tispark/TiConfigConst.scala
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ object TiConfigConst {
val REPLICA_READ_ADDRESS_BLACKLIST = "spark.tispark.replica_read.address_blacklist"
val REPLICA_READ_ADDRESS_DEFAULT = ""

// grpc forward
val ENABLE_GRPC_FORWARD: String = "spark.tispark.enable_grpc_forward"
// GC
val GC_MAX_WAIT_TIME: String = "spark.tispark.gc_max_wait_time"
val DEFAULT_GC_MAX_WAIT_TIME: Long = 24 * 60 * 60
Expand Down
5 changes: 5 additions & 0 deletions core/src/main/scala/com/pingcap/tispark/utils/TiUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,11 @@ object TiUtil {
TiConfigConst.REPLICA_READ_ADDRESS_BLACKLIST,
TiConfigConst.REPLICA_READ_ADDRESS_DEFAULT)
tiConf.setReplicaReadPolicy(ReplicaReadPolicy.create(role, label, whitelist, blacklist))

if (conf.contains(TiConfigConst.ENABLE_GRPC_FORWARD)) {
tiConf.setEnableGrpcForward(conf.get(TiConfigConst.ENABLE_GRPC_FORWARD).toBoolean)
}
tiConf
}

private def getIsolationReadEnginesFromString(str: String): List[TiStoreType] = {
Expand Down
5 changes: 5 additions & 0 deletions docs/userguide_3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ spark.sql("select t1.id,t2.id from spark_catalog.default.t t1 left join tidb_cat
| `spark.tispark.replica_read.label` | "" | Only select TiKV store match specified labels. Format: label_x=value_x,label_y=value_y |
| `spark.tispark.replica_read.address_whitelist` | "" | Only select TiKV store with given ip addresses. Split mutil addresses by `,` |
| `spark.tispark.replica_read.address_blacklist` | "" | Do not select TiKV store with given ip addresses. Split mutil addresses by `,` |
<<<<<<< HEAD
=======
| `spark.tispark.enable_grpc_forward` | false | Whether enable grpc forward. Set it to true to enable high available between TiKV. |
| `spark.tispark.gc_max_wait_time` | 86400 | The maximum time in seconds that TiSpark block the GC safe point |
>>>>>>> f2ab73e74 (Expose forward and set it to false in default (#2641))
### TLS Configuration

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ public TiConfiguration setCertReloadIntervalInSeconds(String interval) {
// follower read
private ReplicaReadPolicy replicaReadPolicy = ReplicaReadPolicy.DEFAULT;

private boolean enableGrpcForward = false;

private static Long getTimeAsSeconds(String key) {
return Utils.timeStringAsSec(key);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ public static org.tikv.common.TiConfiguration convertTiConfiguration(
tikvConf.setJksEnable(conf.isJksEnable());
// follower read
tikvConf.setReplicaSelector(conf.getReplicaReadPolicy());
// grpc forward
tikvConf.setEnableGrpcForward(conf.isEnableGrpcForward());
return tikvConf;
}

Expand Down

0 comments on commit c2c70d7

Please sign in to comment.