TiKV primary lock error: region does not exist

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: TiKV primary lock 报错的 region 不存在

| username: Leonadle

【 TiDB Version】

  • 7.1.3

【Encountered Issues】

  1. The TiKV logs frequently show warnings about primary lock.

  2. Unable to find the related region in the TIKV_REGION_STATUS table using the key from the error log.

SELECT
	* 
FROM
	TIKV_REGION_STATUS 
WHERE
	START_KEY = '7480000000000007535F698000000000000001016164646461633364FF6131383862306136FF6439643962663931FF6264363731396136FF0000000000000000F7' 
or 
  END_KEY = '7480000000000007535F698000000000000001016164646461633364FF6131383862306136FF6439643962663931FF6264363731396136FF0000000000000000F7'
| username: Leonadle | Original post link

To add:
The table related to the region key was previously deleted, but this error still exists, and the key indicated in the error is the same as the key of the previously deleted table!

| username: Billmay表妹 | Original post link

How many TiKVs are there?
[Resource Configuration] Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
Send it over for a look~
It seems to be caused by an abnormal TiKV~
You might consider scaling out first and then scaling in the problematic TiKV node~

| username: 小龙虾爱大龙虾 | Original post link

You definitely won’t find this in TIKV_REGION_STATUS. A Region is a range, and you’re using an equals condition. I suggest you use pd-ctl to check it out, or use the tidb_decode_key function to decode it.

| username: TiDBer_jYQINSnf | Original post link

You won’t be able to find it this way, the region has merged. Use pd-ctl to check:

pd-ctl region keys 7480000000000007535F698000000000000001016164646461633364FF6131383862306136FF6439643962663931FF6264363731396136FF0000000000000000F7

You will get several regions.

| username: Leonadle | Original post link

The table_id found by tidb_decode_key does not correspond to the previously deleted table, it should have already been merged.

| username: dba远航 | Original post link

The SQL syntax is inappropriate.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.