Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
picodata
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
picodata
Commits
d2473516
Commit
d2473516
authored
2 years ago
by
Georgy Moshkin
Browse files
Options
Downloads
Patches
Plain Diff
test: bucket rebalancing respects replication factor
parent
769b6119
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!361
Test/sharding is failsafe
Pipeline
#13532
passed
2 years ago
Stage: test
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/int/test_replication.py
+38
-0
38 additions, 0 deletions
test/int/test_replication.py
with
38 additions
and
0 deletions
test/int/test_replication.py
+
38
−
0
View file @
d2473516
...
...
@@ -165,3 +165,41 @@ def test_bucket_rebalancing(cluster: Cluster):
i3
=
cluster
.
add_instance
()
wait_has_buckets
(
i3
,
1000
)
def
test_bucket_rebalancing_respects_replication_factor
(
cluster
:
Cluster
):
peer
,
*
_
=
cluster
.
deploy
(
instance_count
=
4
,
init_replication_factor
=
2
)
# wait for buckets to be rebalanced between 2 replicasets 1500 each
for
i
in
cluster
.
instances
:
wait_has_buckets
(
i
,
1500
)
# check vshard routes requests to both replicasets
reached_instances
=
set
()
for
bucket_id
in
[
1
,
3000
]:
info
=
peer
.
call
(
"
vshard.router.callro
"
,
bucket_id
,
"
picolib.peer_info
"
)
reached_instances
.
add
(
info
[
"
instance_id
"
])
assert
len
(
reached_instances
)
==
2
# add an instance to a new replicaset
i5
=
cluster
.
add_instance
(
wait_online
=
True
)
# buckets do not start rebalancing until new replicaset is full
wait_has_buckets
(
i5
,
0
)
for
i
in
cluster
.
instances
:
if
i
.
instance_id
!=
i5
.
instance_id
:
wait_has_buckets
(
i
,
1500
)
# add another instance to new replicaset, it's now full
cluster
.
add_instance
(
wait_online
=
True
)
# buckets now must be rebalanced between 3 replicasets 1000 each
for
i
in
cluster
.
instances
:
wait_has_buckets
(
i
,
1000
)
# check vshard routes requests to all 3 replicasets
reached_instances
=
set
()
for
bucket_id
in
[
1
,
1500
,
3000
]:
info
=
peer
.
call
(
"
vshard.router.callro
"
,
bucket_id
,
"
picolib.peer_info
"
)
reached_instances
.
add
(
info
[
"
instance_id
"
])
assert
len
(
reached_instances
)
==
3
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment