Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: inconsistent index 不连续的索引问题
[TiDB Usage Environment] Test
[TiDB Version] 5.3
[Encountered Issue]
When querying data, the following error occurs: inconsistent index PRIMARY handle count 21 isn’t equal to value count 7
[Reproduction Path]
tispark writes to tidb
df.write.
format(“tidb”).
option(“tidb.addr”, “”).
option(“tidb.port”, “4000”).
option(“tidb.user”, “bdata”).
option(“tidb.password”, “”).
option(“database”, “bdata”).
option(“table”, tblName).
option(“replace”, true).
option(“isolationLevel”, “NONE”).
option(JDBCOptions.JDBC_BATCH_INSERT_SIZE, 1000).
mode(“append”).
save()
[Issue Phenomenon and Impact]
After each data write execution, select will encounter inconsistent index issues.
It looks similar to this issue:
What version of TiSpark are you using? This is a bug in TiSpark. Another critical bug in TiSpark is that the number of records written to TiKV and TiFlash is inconsistent. Therefore, it’s better not to use TiSpark for writing data; it can be used for reading.
Try upgrading to 2.4.2. It should be fixed in 2.4.2, but the changelog probably didn’t mention it.
Okay, thanks, I’ll give it a try.
But I’m using Scala 2.11.
Then don’t use TiSpark to write, the lower versions have serious bugs.
TiSpark has been updated to 3.0. For specific version information, see:
Today I encountered a serious issue while querying: my table has a composite primary key consisting of item_id and erpsource. When querying by delivery_id, duplicate composite primary keys appeared!
However, when querying by the item_id primary key, no duplicate composite primary keys appeared!
Open a new thread for different topics.