tikv / tikv/pd

The `ScatterRegion` gRPC API fails to generate scatter operators when placement rules are disabled

Open
#10,235 1 comment 0 reactions 1 assignee Claimed by @rleungx View on GitHub
contribution type/enhancement
Dominant language
Go
Stars
1.2k
Forks
783
Avg merge
5d 21h
Merged PRs (30d)
36

Description

## Enhancement Task
## Description

When placement rules are disabled, the `scatterRegion` function cannot determine which peers are eligible to become leaders because:

1. `FitRegion()` returns a `RegionFit` with empty `RuleFits` (rule-fits-count=0)
2. All peers are marked as orphan peers (orphan-peers-count equals the number of peers)
3. The `allowLeader()` function returns `false` for all peers because `GetRuleFit(peerID)` returns `nil` when there are no rule fits
4. No leader candidates are available, causing `selectAvailableLeaderStore()` to return 0
5. The scatter operation fails and returns `nil` operator

## Steps to Reproduce

1. Start a PD cluster with placement rules disabled:
```toml
[replication]
enable-placement-rules = false
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.