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
4c63d09e
Commit
4c63d09e
authored
11 months ago
by
Georgy Moshkin
Browse files
Options
Downloads
Patches
Plain Diff
fix: use batch-dml when joining instances for robustness
parent
8907cbdc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!927
Gmoshkin/join using batch dml
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/rpc/join.rs
+2
-10
2 additions, 10 deletions
src/rpc/join.rs
src/traft/node.rs
+12
-8
12 additions, 8 deletions
src/traft/node.rs
test/int/test_snapshot.py
+2
-2
2 additions, 2 deletions
test/int/test_snapshot.py
with
16 additions
and
20 deletions
src/rpc/join.rs
+
2
−
10
View file @
4c63d09e
...
...
@@ -126,17 +126,9 @@ pub fn handle_join_request_and_wait(req: Request, timeout: Duration) -> Result<R
}
// Only in this order - so that when instance exists - address will always be there.
handle_result!
(
cas
::
compare_and_swap
(
Op
::
Dml
(
op_addr
),
cas
::
Predicate
{
index
:
raft_storage
.applied
()
?
,
term
:
raft_storage
.term
()
?
,
ranges
:
ranges
.clone
(),
Op
::
BatchDml
{
ops
:
vec!
[
op_addr
,
op_instance
],
},
ADMIN_ID
,
deadline
.duration_since
(
fiber
::
clock
()),
));
handle_result!
(
cas
::
compare_and_swap
(
Op
::
Dml
(
op_instance
),
cas
::
Predicate
{
index
:
raft_storage
.applied
()
?
,
term
:
raft_storage
.term
()
?
,
...
...
This diff is collapsed.
Click to expand it.
src/traft/node.rs
+
12
−
8
View file @
4c63d09e
...
...
@@ -727,18 +727,22 @@ impl NodeImpl {
fn
wake_governor_if_needed
(
&
self
,
op
:
&
Op
)
{
let
wake_governor
=
match
&
op
{
Op
::
Dml
(
op
)
=>
{
matches!
(
op
.space
()
.try_into
(),
Ok
(
ClusterwideTable
::
Property
|
ClusterwideTable
::
Replicaset
|
ClusterwideTable
::
Instance
)
)
}
Op
::
Dml
(
op
)
=>
dml_is_governor_wakeup_worthy
(
op
),
Op
::
BatchDml
{
ops
}
=>
ops
.iter
()
.any
(
dml_is_governor_wakeup_worthy
),
Op
::
DdlPrepare
{
..
}
=>
true
,
_
=>
false
,
};
#[inline(always)]
fn
dml_is_governor_wakeup_worthy
(
op
:
&
Dml
)
->
bool
{
matches!
(
op
.space
()
.try_into
(),
Ok
(
ClusterwideTable
::
Property
|
ClusterwideTable
::
Replicaset
|
ClusterwideTable
::
Instance
)
)
}
// NOTE: this may be premature, because the dml may fail to apply and/or
// the transaction may be rolled back, but we ignore this for the sake
// of simplicity, as nothing bad can happen if governor makes another
...
...
This diff is collapsed.
Click to expand it.
test/int/test_snapshot.py
+
2
−
2
View file @
4c63d09e
...
...
@@ -18,9 +18,9 @@ def test_bootstrap_from_snapshot(cluster: Cluster):
# Ensure i2 bootstraps from a snapshot
i2
=
cluster
.
add_instance
(
wait_online
=
True
)
# Whenever a snapshot is applied, all preceeding raft log is
# implicitly compacted. Adding an instance implies appending
3
# implicitly compacted. Adding an instance implies appending
2
# entries to the raft log. i2 catches them via a snapshot.
assert
i2
.
raft_first_index
()
==
i1
.
raft_first_index
()
+
3
assert
i2
.
raft_first_index
()
==
i1
.
raft_first_index
()
+
2
# Ensure new instance replicates the property
assert
i2
.
call
(
"
box.space._pico_property:get
"
,
"
animal
"
)
==
[
"
animal
"
,
"
horse
"
]
...
...
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