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
09590071
Commit
09590071
authored
1 year ago
by
Egor Ivkov
Committed by
Егор Ивков
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
fix: speed up instance join
parent
0e4de781
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!645
test: check cas conflicts number on join
Pipeline
#22595
passed
1 year ago
Stage: test
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/rpc/join.rs
+2
-0
2 additions, 0 deletions
src/rpc/join.rs
src/rpc/update_instance.rs
+2
-0
2 additions, 0 deletions
src/rpc/update_instance.rs
src/traft/node.rs
+5
-0
5 additions, 0 deletions
src/traft/node.rs
test/manual/test_scaling.py
+3
-2
3 additions, 2 deletions
test/manual/test_scaling.py
with
12 additions
and
2 deletions
src/rpc/join.rs
+
2
−
0
View file @
09590071
...
...
@@ -66,6 +66,7 @@ pub fn handle_join_request_and_wait(req: Request, timeout: Duration) -> Result<R
let
cluster_id
=
node
.raft_storage
.cluster_id
()
?
;
let
storage
=
&
node
.storage
;
let
raft_storage
=
&
node
.raft_storage
;
let
guard
=
node
.instances_update
.lock
();
if
req
.cluster_id
!=
cluster_id
{
return
Err
(
Error
::
ClusterIdMismatch
{
...
...
@@ -147,6 +148,7 @@ pub fn handle_join_request_and_wait(req: Request, timeout: Duration) -> Result<R
// A joined instance needs to communicate with other nodes.
// TODO: limit the number of entries sent to reduce response size.
let
peer_addresses
=
node
.storage.peer_addresses
.iter
()
?
.collect
();
drop
(
guard
);
return
Ok
(
Response
{
instance
:
instance
.into
(),
peer_addresses
,
...
...
This diff is collapsed.
Click to expand it.
src/rpc/update_instance.rs
+
2
−
0
View file @
09590071
...
...
@@ -87,6 +87,7 @@ pub fn handle_update_instance_request_and_wait(req: Request, timeout: Duration)
let
cluster_id
=
node
.raft_storage
.cluster_id
()
?
;
let
storage
=
&
node
.storage
;
let
raft_storage
=
&
node
.raft_storage
;
let
guard
=
node
.instances_update
.lock
();
if
req
.cluster_id
!=
cluster_id
{
return
Err
(
Error
::
ClusterIdMismatch
{
...
...
@@ -136,6 +137,7 @@ pub fn handle_update_instance_request_and_wait(req: Request, timeout: Duration)
}
}
node
.main_loop
.wakeup
();
drop
(
guard
);
return
Ok
(());
}
}
...
...
This diff is collapsed.
Click to expand it.
src/traft/node.rs
+
5
−
0
View file @
09590071
...
...
@@ -143,6 +143,10 @@ pub struct Node {
pub
(
crate
)
governor_loop
:
governor
::
Loop
,
status
:
watch
::
Receiver
<
Status
>
,
watchers
:
Rc
<
Mutex
<
StorageWatchers
>>
,
/// Should be locked during join and update instance request
/// to avoid costly cas conflicts during concurrent requests.
pub
instances_update
:
Mutex
<
()
>
,
}
impl
std
::
fmt
::
Debug
for
Node
{
...
...
@@ -187,6 +191,7 @@ impl Node {
raft_storage
,
status
,
watchers
,
instances_update
:
Mutex
::
new
(()),
};
// Wait for the node to enter the main loop
...
...
This diff is collapsed.
Click to expand it.
test/manual/test_scaling.py
+
3
−
2
View file @
09590071
# mypy: disable-error-code="import"
import
funcy
# type: ignore
import
time
from
matplotlib
import
pyplot
# type: ignore
import
matplotlib
# type: ignore
from
matplotlib
import
pyplot
import
matplotlib
from
conftest
import
(
Cluster
,
...
...
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