TiKV java client batchput is not in region key range

为提高效率,请提供以下信息,问题描述清晰能够更快得到解决:

【TiKV 版本】
4.0.11
【问题描述】
use tikv-java-client 3.0 batchput to load data into TiKV, got this error:

Caused by: java.util.concurrent.ExecutionException: shade.io.grpc.StatusRuntimeException: UNKNOWN: message: “key 646966666572656E742062696F6C6F676963616C206F7264657273 is not in region key range [646966666572656E742068656C70, 646973706C6561736564) for region 310”
key_not_in_region {
key: “different biological orders”
region_id: 310
start_key: “different help”
end_key: “displeased”
}

但是用tikv-java-client 2.0 snapshot 是可以的, 想问一下,这是tikv-java-client 的问题吗?为什么会 key not in region 呢?

谢谢


若提问为性能优化、故障排查类问题,请下载脚本运行。终端输出的打印结果,请务必全选并复制粘贴上传。

导入数据的程序是怎么样的?

在spark 的导入

df.filter($"batchNum" === i).repartition 20000).foreachPartition((p: Iterator[Row]) => {

val conf = TiConfiguration.createRawDefault(s"${tikvIP}:2379")
val session = TiSession.create(conf)
val rawClient = session.createRawClient()
p.grouped(5000).foreach(w => {
  val batchPutMap = mutable.HashMap[ByteString, ByteString]()
  var javaBatchPutMap = batchPutMap.asJava
  w.foreach(r => {
    val aOWord = r.getAs[String]("key")
    val proto = "value"

    javaBatchPutMap.put(aKey, ByteString.copyFrom(proto.toByteArray))
  })
rawClient.batchPut(javaBatchPutMap)

https://github.com/tikv/client-java/issues/101

看起来像是一个已经修复的问题,可以尝试使用最新版本试试么?