client-go icon indicating copy to clipboard operation
client-go copied to clipboard

presplit: send split_region request to PD instead of TiKV

Open AndreMouche opened this issue 1 year ago • 0 comments

When we find a transaction try to insert into a region with more than 100000 items, it will do split the region to avoid too much write workload into a single region:

https://github.com/tikv/client-go/blob/e30a3e6e3ac623f928191a2f83f1ebbf10d4bb6f/txnkv/transaction/2pc.go#L866-L877

However, here we send split request to TiKV.

https://github.com/tikv/client-go/blob/e30a3e6e3ac623f928191a2f83f1ebbf10d4bb6f/tikv/split_region.go#L144-L149

I think we should send the split-request to PD since PD will only apply one operator to a region each time, which will help use to avoid the issue(https://github.com/tikv/tikv/issues/12410) caused by two operators run on the same region concurrently.

AndreMouche avatar Oct 14 '24 04:10 AndreMouche