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
44b28d1c
Commit
44b28d1c
authored
1 year ago
by
Georgy Moshkin
Browse files
Options
Downloads
Patches
Plain Diff
fix: unfinished ddl over snapshot
parent
e5a900d6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!570
Fix/unfinished ddl by snapshot
Pipeline
#19804
passed
1 year ago
Stage: test
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/storage.rs
+3
-7
3 additions, 7 deletions
src/storage.rs
test/int/test_ddl.py
+53
-0
53 additions, 0 deletions
test/int/test_ddl.py
with
56 additions
and
7 deletions
src/storage.rs
+
3
−
7
View file @
44b28d1c
...
...
@@ -596,13 +596,9 @@ impl Clusterwide {
for
space_def
in
self
.spaces
.iter
()
?
{
if
!
space_def
.operable
{
// This means a ddl operation wasn't committed yet. We probably
// don't want unfinished ddl artifacts comming over the snapshot
// so this will likely never happen.
// TODO: or do we actually want this working?
crate
::
warn_or_panic!
(
"unfinished ddl operation arrived via snapshot: {space_def:?}"
);
// If it so happens, that we receive an unfinished schema change via snapshot,
// which will somehow get finished without the governor sending us
// a proc_apply_schema_change rpc, it will be a very sad day.
continue
;
}
...
...
This diff is collapsed.
Click to expand it.
test/int/test_ddl.py
+
53
−
0
View file @
44b28d1c
...
...
@@ -369,6 +369,59 @@ def test_ddl_create_sharded_space(cluster: Cluster):
assert
i2
.
call
(
"
box.space._index:get
"
,
[
space_id
,
1
])
==
tt_bucket_id_def
def
test_ddl_create_space_unfinished_from_snapshot
(
cluster
:
Cluster
):
i1
,
i2
,
i3
=
cluster
.
deploy
(
instance_count
=
3
)
# Put i3 to sleep, so that schema change get's blocked.
i3
.
terminate
()
# Start schema change.
space_id
=
732
index
=
i1
.
propose_create_space
(
dict
(
id
=
space_id
,
name
=
"
some space name
"
,
format
=
[
dict
(
name
=
"
id
"
,
type
=
"
unsigned
"
,
is_nullable
=
False
)],
primary_key
=
[
dict
(
field
=
"
id
"
)],
distribution
=
dict
(
kind
=
"
sharded_implicitly
"
,
sharding_key
=
[
"
id
"
],
sharding_fn
=
"
murmur3
"
),
),
wait_index
=
False
,
)
# Schema change is blocked.
with
pytest
.
raises
(
ReturnError
,
match
=
"
timeout
"
):
i1
.
raft_wait_index
(
index
,
timeout
=
3
)
# Space is created but is not operable.
assert
i1
.
call
(
"
box.space._space:get
"
,
space_id
)
is
not
None
assert
not
i1
.
eval
(
"
return box.space._pico_space:get(...).operable
"
,
space_id
)
assert
i2
.
call
(
"
box.space._space:get
"
,
space_id
)
is
not
None
assert
not
i2
.
eval
(
"
return box.space._pico_space:get(...).operable
"
,
space_id
)
# Compact raft log to trigger snapshot with an unfinished schema change.
i1
.
raft_compact_log
()
i2
.
raft_compact_log
()
# Add a new replicaset who will boot from snapshot.
i4
=
cluster
.
add_instance
(
wait_online
=
True
)
# TODO: test readonly replica doing the same
# It has received an unfinished schema change.
assert
not
i4
.
eval
(
"
return box.space._pico_space:get(...).operable
"
,
space_id
)
# Wake the instance, who was blocking the schema change.
i3
.
start
()
i3
.
wait_online
()
# The schema change finalized.
for
i
in
cluster
.
instances
:
assert
i
.
call
(
"
box.space._space:get
"
,
space_id
)
is
not
None
assert
i
.
eval
(
"
return box.space._pico_space:get(...).operable
"
,
space_id
)
def
test_ddl_create_space_partial_failure
(
cluster
:
Cluster
):
# i2 & i3 are for quorum
i1
,
i2
,
i3
,
i4
,
i5
=
cluster
.
deploy
(
instance_count
=
5
)
...
...
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