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
384dbdf5
Commit
384dbdf5
authored
2 years ago
by
Georgy Moshkin
Browse files
Options
Downloads
Patches
Plain Diff
fix: panic Storage::active_learners when peer was rebootstrapped
parent
f963d99e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!188
fix: panic Storage::active_learners when peer was rebootstrapped
Pipeline
#9161
passed
2 years ago
Stage: build
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/traft/storage.rs
+2
-7
2 additions, 7 deletions
src/traft/storage.rs
test/conftest.py
+5
-4
5 additions, 4 deletions
test/conftest.py
test/int/test_joining.py
+3
-0
3 additions, 0 deletions
test/int/test_joining.py
with
10 additions
and
11 deletions
src/traft/storage.rs
+
2
−
7
View file @
384dbdf5
...
...
@@ -7,6 +7,7 @@ use ::raft::INVALID_ID;
use
::
tarantool
::
index
::
IteratorType
;
use
::
tarantool
::
space
::
Space
;
use
::
tarantool
::
tuple
::
Tuple
;
use
::
tarantool
::
unwrap_or
;
use
serde
::
de
::
DeserializeOwned
;
use
serde
::
Serialize
;
use
thiserror
::
Error
;
...
...
@@ -28,8 +29,6 @@ enum Error {
NoSuchSpace
(
String
),
#[error(
"no such index
\"
{1}
\"
in space
\"
{0}
\"
"
)]
NoSuchIndex
(
String
,
String
),
#[error(
"no peer with id {0}"
)]
NoSuchPeer
(
RaftId
),
}
macro_rules!
box_err
{
...
...
@@ -361,11 +360,7 @@ impl Storage {
let
learners
=
Storage
::
learners
()
?
;
let
mut
res
=
Vec
::
with_capacity
(
learners
.len
());
for
raft_id
in
learners
{
if
Storage
::
peer_by_raft_id
(
raft_id
)
?
.ok_or
(
Error
::
NoSuchPeer
(
raft_id
))
.map_err
(
box_err!
())
?
.is_active
()
{
if
unwrap_or!
(
Storage
::
peer_by_raft_id
(
raft_id
)
?
,
continue
)
.is_active
()
{
res
.push
(
raft_id
)
}
}
...
...
This diff is collapsed.
Click to expand it.
test/conftest.py
+
5
−
4
View file @
384dbdf5
...
...
@@ -235,11 +235,11 @@ class Instance:
eprint
(
f
"
{
self
}
killed
"
)
self
.
process
=
None
def
terminate
(
self
,
kill_after_seconds
=
10
):
def
terminate
(
self
,
kill_after_seconds
=
10
)
->
int
|
None
:
"""
Terminate the instance gracefully with SIGTERM
"""
if
self
.
process
is
None
:
# Be idempotent
return
return
None
with
suppress
(
ProcessLookupError
,
PermissionError
):
os
.
killpg
(
self
.
process
.
pid
,
signal
.
SIGCONT
)
...
...
@@ -247,8 +247,9 @@ class Instance:
self
.
process
.
terminate
()
try
:
self
.
process
.
wait
(
timeout
=
kill_after_seconds
)
eprint
(
f
"
{
self
}
terminated
"
)
rc
=
self
.
process
.
wait
(
timeout
=
kill_after_seconds
)
eprint
(
f
"
{
self
}
terminated: rc =
{
rc
}
"
)
return
rc
finally
:
self
.
kill
()
...
...
This diff is collapsed.
Click to expand it.
test/int/test_joining.py
+
3
−
0
View file @
384dbdf5
...
...
@@ -237,6 +237,9 @@ def test_rebootstrap_follower(cluster3: Cluster):
i3
.
wait_ready
()
i3
.
assert_raft_status
(
"
Follower
"
)
# git.picodata.io: #114
assert
i1
.
terminate
()
==
0
def
test_join_without_explicit_instance_id
(
cluster
:
Cluster
):
# Scenario: bootstrap single instance without explicitly given instance id
...
...
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