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
bc308b56
Commit
bc308b56
authored
1 year ago
by
Georgy Moshkin
Browse files
Options
Downloads
Patches
Plain Diff
feat: implement the monotonically increasing next_schema_version pico property
parent
605accc2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!516
OpDdl create space
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/storage.rs
+25
-0
25 additions, 0 deletions
src/storage.rs
src/traft/node.rs
+3
-0
3 additions, 0 deletions
src/traft/node.rs
test/conftest.py
+7
-0
7 additions, 0 deletions
test/conftest.py
test/int/test_ddl.py
+4
-8
4 additions, 8 deletions
test/int/test_ddl.py
with
39 additions
and
8 deletions
src/storage.rs
+
25
−
0
View file @
bc308b56
...
...
@@ -622,10 +622,35 @@ pub trait TClusterwideSpaceIndex {
pub
enum
PropertyName
{
ReplicationFactor
=
"replication_factor"
,
VshardBootstrapped
=
"vshard_bootstrapped"
,
// TODO: remove this
DesiredSchemaVersion
=
"desired_schema_version"
,
/// Pending ddl operation which is to be either committed or aborted.
///
/// Is only present during the time between the last ddl prepare
/// operation and the corresponding ddl commit or abort operation.
PendingSchemaChange
=
"pending_schema_change"
,
/// Schema version of the pending ddl prepare operation.
/// This will be the current schema version if the next entry is a ddl
/// commit operation.
///
/// Is only present during the time between the last ddl prepare
/// operation and the corresponding ddl commit or abort operation.
PendingSchemaVersion
=
"pending_schema_version"
,
/// Current schema version. Increases with every ddl commit operation.
///
/// This is equal to [`pico_schema_version`] during the time between
/// the last ddl commit or abort operation and the next ddl prepare
/// operation.
CurrentSchemaVersion
=
"current_schema_version"
,
/// Schema version which should be used for the next ddl prepare
/// operation. This increases with every ddl prepare operation in the
/// log no matter if it is committed or aborted.
/// This guards us from some painfull corner cases.
NextSchemaVersion
=
"next_schema_version"
,
}
}
...
...
This diff is collapsed.
Click to expand it.
src/traft/node.rs
+
3
−
0
View file @
bc308b56
...
...
@@ -1001,6 +1001,9 @@ impl NodeImpl {
self
.storage
.properties
.put
(
PropertyName
::
PendingSchemaVersion
,
&
schema_version
)
?
;
self
.storage
.properties
.put
(
PropertyName
::
NextSchemaVersion
,
&
(
schema_version
+
1
))
?
;
Ok
(())
}
...
...
This diff is collapsed.
Click to expand it.
test/conftest.py
+
7
−
0
View file @
bc308b56
...
...
@@ -524,6 +524,13 @@ class Instance:
eprint
(
f
"
CaS:
\n
{
predicate
=
}
\n
{
dml
=
}
"
)
return
self
.
call
(
"
.proc_cas
"
,
self
.
cluster_id
,
predicate
,
dml
)[
0
][
"
index
"
]
def
next_schema_version
(
self
)
->
int
:
t
=
self
.
call
(
"
box.space._picodata_property:get
"
,
"
next_schema_version
"
)
if
t
is
None
:
return
1
return
t
[
1
]
def
assert_raft_status
(
self
,
state
,
leader_id
=
None
):
status
=
self
.
_raft_status
()
...
...
This diff is collapsed.
Click to expand it.
test/int/test_ddl.py
+
4
−
8
View file @
bc308b56
...
...
@@ -13,7 +13,7 @@ def test_ddl_create_space_bulky(cluster: Cluster):
# Propose a space creation which will fail
op
=
dict
(
kind
=
"
ddl_prepare
"
,
schema_version
=
1
,
schema_version
=
i1
.
next_schema_version
()
,
ddl
=
dict
(
kind
=
"
create_space
"
,
id
=
666
,
...
...
@@ -40,11 +40,7 @@ def test_ddl_create_space_bulky(cluster: Cluster):
# Propose a space creation which will succeed
op
=
dict
(
kind
=
"
ddl_prepare
"
,
# This version number must not be equal to the version of the aborted
# change, otherwise all of the instances joined after this request was
# committed will be blocked during the attempt to apply the previous
# DdlAbort
schema_version
=
2
,
schema_version
=
i1
.
next_schema_version
(),
ddl
=
dict
(
kind
=
"
create_space
"
,
id
=
666
,
...
...
@@ -136,7 +132,7 @@ def test_ddl_create_space_partial_failure(cluster: Cluster):
# Propose a space creation which will fail
op
=
dict
(
kind
=
"
ddl_prepare
"
,
schema_version
=
1
,
schema_version
=
i1
.
next_schema_version
()
,
ddl
=
dict
(
kind
=
"
create_space
"
,
id
=
666
,
...
...
@@ -176,7 +172,7 @@ def test_ddl_from_snapshot(cluster: Cluster):
# Propose a space creation which will succeed
op
=
dict
(
kind
=
"
ddl_prepare
"
,
schema_version
=
1
,
schema_version
=
i1
.
next_schema_version
()
,
ddl
=
dict
(
kind
=
"
create_space
"
,
id
=
666
,
...
...
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