# [Known-Issues] Region can't split, reported no valid key found for split

## Key Words

TiKV, region split failed, no valid key found for split

## Description

There are some split failed error log in the tikv.log

```
[split_observer.rs:149] ["failed to handle split req"] [err=""no valid key found for split.""]
```

## Root Cause

When pd want to split this region, it will scan from the start_key of the region(the first mvcc key) but it will only scan 10 \* 96MB at most. If there were too many mvcc keys for the first key of this region, it may lead to split failed.

The reasons for too many mvcc keys include:

1. GC is too long
2. Update too frequently, even the GC is working normally, it can't clean up mvcc in time

## Diagnostic Steps

1. Check the tikv.log, if there are some logs like  

    [ERROR] [split_observer.rs:149] [&quot;failed to handle split req&quot;] [err=&quot;&quot;no valid key found for split.

2. Use the tikv-ctl to check the region reported by tikv.log, need to pay attention to the size of the region, and the mvcc.num_rows, using this command:

    tiup ctl:v5.0.3 tikv --host ${tikv_ip}:${tikv_port} size -r ${region_id}

    tiup ctl:v5.0.3 tikv --host ${tikv_ip}:${tikv_port} region-properties -r ${region_id}

3. Check the GC setting, using this command when connecting the tidb-server

    select VARIABLE_NAME, VARIABLE_VALUE from mysql.tidb where VARIABLE_NAME like "tikv_gc%";

## Resolution

1. Change the setting of GC, using this command when connecting the tidb-server

    update mysql.tidb set VARIABLE_VALUE="10min" where VARIABLE_NAME="tikv_gc_life_time";

2. Split this region manually, using this command

    tiup ctl:v5.0.3 pd -u ${pd_ip}:${pd_port} operator add split-region region-id --policy=scan

3. If the split doesn't work, please compact the TiKV, note that this operation need IO & CPU resource, it may have impaction to the performance

    tiup ctl:v5.0.3 tikv --pd {pd_ip}:{pd_port} compact-cluster --bottommost force -d kv -c write

## Workaround

N/A

## Comments

If this error reported by BR, it also may caused by the version of BR is not as the same as the TiDB.
