Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replica selector refactor #1142

Merged
merged 76 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
9920ba3
init
crazycs520 Jan 23, 2024
1a3f367
add ReplicaSelector interface
crazycs520 Jan 23, 2024
31f9f5d
add replica_selector_v2, todo: fix test
crazycs520 Jan 23, 2024
5e57170
fix all test
crazycs520 Jan 24, 2024
fc9b192
fix test in another way to compatible with old version about stale-re…
crazycs520 Jan 24, 2024
b60f4e1
tiny refactor
crazycs520 Jan 24, 2024
0df7353
refactor to remove duplicate code
crazycs520 Jan 24, 2024
42d67bd
add more test
crazycs520 Jan 25, 2024
36cd5c1
refine onServerIsBusy region error handing logic
crazycs520 Jan 25, 2024
3cf3cdd
support forwarding by proxy
crazycs520 Jan 25, 2024
3ff9542
support busyThreshold and tiny reractor code
crazycs520 Jan 25, 2024
1265452
add config
crazycs520 Jan 26, 2024
6a11f6e
Merge branch 'master' of https://github.com/tikv/client-go into cs-dev1
crazycs520 Jan 26, 2024
ce864de
fix test
crazycs520 Jan 26, 2024
2b7c636
fix proxy bug
crazycs520 Jan 26, 2024
fafb520
fix test and tiny refactor
crazycs520 Jan 29, 2024
d97a061
Merge branch 'master' of https://github.com/tikv/client-go into cs-dev1
crazycs520 Jan 29, 2024
c6a10bf
add some test
crazycs520 Feb 5, 2024
0309452
add more test
crazycs520 Feb 18, 2024
dc55c5b
tidy refine
crazycs520 Feb 18, 2024
055204f
address comment
crazycs520 Feb 18, 2024
6514588
fix test in v1
crazycs520 Feb 18, 2024
b411664
add backoff-cnt check and timeout test
crazycs520 Feb 18, 2024
a6bda0c
refine test
crazycs520 Feb 18, 2024
f03a51f
Merge branch 'master' of https://github.com/tikv/client-go into cs-dev1
crazycs520 Feb 18, 2024
62e52e0
refine code
crazycs520 Feb 19, 2024
190e0cb
refine code
crazycs520 Feb 19, 2024
6f5b52c
add benchmark test
crazycs520 Feb 19, 2024
29bed25
Merge branch 'master' of https://github.com/tikv/client-go into cs-dev1
crazycs520 Feb 19, 2024
e68e0b8
make test stale
crazycs520 Feb 19, 2024
5081684
fix golangci
crazycs520 Feb 19, 2024
49df8dc
add more test and refine code
crazycs520 Feb 19, 2024
c4c21ce
fix race test
crazycs520 Feb 19, 2024
b1b5287
add more comprehensive enumeration testing
crazycs520 Feb 19, 2024
2bed4c4
refine test
crazycs520 Feb 20, 2024
672ac8b
fix test
crazycs520 Feb 20, 2024
afdb532
fix accessFollower with label retry bug
crazycs520 Feb 20, 2024
6df5777
refine test and fix some bug
crazycs520 Feb 20, 2024
a186e4c
fix test and add more test
crazycs520 Feb 21, 2024
5b97db0
add more test
crazycs520 Feb 21, 2024
5e28c1d
refine test
crazycs520 Feb 21, 2024
26f4937
refine test
crazycs520 Feb 21, 2024
2c141f7
refine onNotLeader logic when new leader is not available
crazycs520 Feb 22, 2024
4db2bdf
refine calculateScore logic, if the replica already tried, decrease t…
crazycs520 Feb 23, 2024
4830c33
refine logic: replica-read request with mixed strategy and with label…
crazycs520 Feb 23, 2024
352cdb3
prefer-leader for mixed read with label for non stale-read req
crazycs520 Feb 23, 2024
9f299f2
add more test case
crazycs520 Feb 23, 2024
5625303
resolve conflict
crazycs520 Feb 28, 2024
08af745
refine code
crazycs520 Feb 28, 2024
2bdf1c8
resolve conflict
crazycs520 Feb 28, 2024
3098de4
remove some duplicate test
crazycs520 Feb 29, 2024
a3d37bf
Merge branch 'master' of https://github.com/tikv/client-go into cs-dev1
crazycs520 Feb 29, 2024
5d6acc3
refactor test
crazycs520 Feb 29, 2024
eb6cd73
refine code
crazycs520 Feb 29, 2024
4fe7925
refine test
crazycs520 Feb 29, 2024
1cddd00
add busy_threshold test and fix bug
crazycs520 Mar 1, 2024
d518ca3
fix proxy bug and add more test
crazycs520 Mar 4, 2024
50bb08d
Merge branch 'master' of https://github.com/tikv/client-go into cs-dev1
crazycs520 Mar 4, 2024
902f2ef
refine code and add test
crazycs520 Mar 4, 2024
f55e8df
add learner test
crazycs520 Mar 4, 2024
76b8162
add more test
crazycs520 Mar 4, 2024
2dca9f9
remove old test and refine test
crazycs520 Mar 4, 2024
88a19a1
move test
crazycs520 Mar 5, 2024
cd38d95
address comment
crazycs520 Mar 5, 2024
db60472
use new score calculation by flag bit
crazycs520 Mar 5, 2024
4fd6021
Merge branch 'master' into cs-dev1
crazycs520 Mar 5, 2024
fb0419f
make test stable
crazycs520 Mar 6, 2024
6f55235
refine comment,license and fix lint
crazycs520 Mar 6, 2024
b7f9933
refine comment
crazycs520 Mar 6, 2024
1225db1
Merge branch 'master' into cs-dev1
crazycs520 Mar 7, 2024
8557bfd
refine comment
crazycs520 Mar 7, 2024
e4d576c
fix race test timeout
crazycs520 Mar 7, 2024
da0b829
add flagNotAttemp in score
crazycs520 Mar 8, 2024
f98282c
Merge branch 'master' into cs-dev1
crazycs520 Mar 8, 2024
b92fc47
Merge branch 'master' of https://github.com/tikv/client-go into cs-dev1
crazycs520 Mar 11, 2024
6e64263
address comment
crazycs520 Mar 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,26 @@ type Config struct {
RegionsRefreshInterval uint64
// EnablePreload indicates whether to preload region info when initializing the client.
EnablePreload bool
// EnableReplicaSelectorV2 indicates whether to enable ReplicaSelectorV2.
EnableReplicaSelectorV2 bool
}

// DefaultConfig returns the default configuration.
func DefaultConfig() Config {
return Config{
CommitterConcurrency: 128,
MaxTxnTTL: 60 * 60 * 1000, // 1hour
TiKVClient: DefaultTiKVClient(),
PDClient: DefaultPDClient(),
TxnLocalLatches: DefaultTxnLocalLatches(),
StoresRefreshInterval: DefStoresRefreshInterval,
OpenTracingEnable: false,
Path: "",
EnableForwarding: false,
TxnScope: "",
EnableAsyncCommit: false,
Enable1PC: false,
CommitterConcurrency: 128,
MaxTxnTTL: 60 * 60 * 1000, // 1hour
TiKVClient: DefaultTiKVClient(),
PDClient: DefaultPDClient(),
TxnLocalLatches: DefaultTxnLocalLatches(),
StoresRefreshInterval: DefStoresRefreshInterval,
OpenTracingEnable: false,
Path: "",
EnableForwarding: false,
TxnScope: "",
EnableAsyncCommit: false,
Enable1PC: false,
EnableReplicaSelectorV2: true,
}
}

Expand Down
1 change: 1 addition & 0 deletions internal/locate/region_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -1310,6 +1310,7 @@ func (c *RegionCache) scheduleReloadRegion(region *Region) {
// async reload scheduled by other thread.
return
}
logutil.Logger(context.Background()).Info("schedule to reload region", zap.Uint64("regionID", region.GetID()), zap.Stack("stack"))
crazycs520 marked this conversation as resolved.
Show resolved Hide resolved
regionID := region.GetID()
if regionID > 0 {
c.regionsNeedReload.Lock()
Expand Down
Loading
Loading