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
3f56d450
Commit
3f56d450
authored
1 year ago
by
Georgy Moshkin
Browse files
Options
Downloads
Patches
Plain Diff
test: _pico_* space renaming blast from the past
parent
bc308b56
No related branches found
No related tags found
1 merge request
!516
OpDdl create space
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/conftest.py
+1
-1
1 addition, 1 deletion
test/conftest.py
test/int/test_ddl.py
+26
-24
26 additions, 24 deletions
test/int/test_ddl.py
with
27 additions
and
25 deletions
test/conftest.py
+
1
−
1
View file @
3f56d450
...
...
@@ -525,7 +525,7 @@ class Instance:
return
self
.
call
(
"
.proc_cas
"
,
self
.
cluster_id
,
predicate
,
dml
)[
0
][
"
index
"
]
def
next_schema_version
(
self
)
->
int
:
t
=
self
.
call
(
"
box.space._pico
data
_property:get
"
,
"
next_schema_version
"
)
t
=
self
.
call
(
"
box.space._pico_property:get
"
,
"
next_schema_version
"
)
if
t
is
None
:
return
1
...
...
This diff is collapsed.
Click to expand it.
test/int/test_ddl.py
+
26
−
24
View file @
3f56d450
...
...
@@ -7,8 +7,8 @@ def test_ddl_create_space_bulky(cluster: Cluster):
i1
,
i2
=
cluster
.
deploy
(
instance_count
=
2
,
init_replication_factor
=
2
)
# At cluster boot schema version is 0
assert
i1
.
call
(
"
box.space._pico
data
_property:get
"
,
"
current_schema_version
"
)[
1
]
==
0
assert
i2
.
call
(
"
box.space._pico
data
_property:get
"
,
"
current_schema_version
"
)[
1
]
==
0
assert
i1
.
call
(
"
box.space._pico_property:get
"
,
"
current_schema_version
"
)[
1
]
==
0
assert
i2
.
call
(
"
box.space._pico_property:get
"
,
"
current_schema_version
"
)[
1
]
==
0
# Propose a space creation which will fail
op
=
dict
(
...
...
@@ -27,15 +27,14 @@ def test_ddl_create_space_bulky(cluster: Cluster):
i1
.
call
(
"
pico.raft_propose
"
,
op
)
# No space was created
assert
i1
.
call
(
"
box.space._pico
data
_space:get
"
,
666
)
is
None
assert
i1
.
call
(
"
box.space._pico_space:get
"
,
666
)
is
None
assert
i1
.
call
(
"
box.space._space:get
"
,
666
)
is
None
assert
i2
.
call
(
"
box.space._pico
data
_space:get
"
,
666
)
is
None
assert
i2
.
call
(
"
box.space._pico_space:get
"
,
666
)
is
None
assert
i2
.
call
(
"
box.space._space:get
"
,
666
)
is
None
# Schema version hasn't changed
# XXX: This seems weird
assert
i1
.
call
(
"
box.space._picodata_property:get
"
,
"
current_schema_version
"
)[
1
]
==
0
assert
i2
.
call
(
"
box.space._picodata_property:get
"
,
"
current_schema_version
"
)[
1
]
==
0
assert
i1
.
call
(
"
box.space._pico_property:get
"
,
"
current_schema_version
"
)[
1
]
==
0
assert
i2
.
call
(
"
box.space._pico_property:get
"
,
"
current_schema_version
"
)[
1
]
==
0
# Propose a space creation which will succeed
op
=
dict
(
...
...
@@ -51,16 +50,19 @@ def test_ddl_create_space_bulky(cluster: Cluster):
),
)
# TODO: rewrite the test using pico.cas, when it supports ddl
i1
.
call
(
"
pico.raft_propose
"
,
op
)
index
=
i1
.
call
(
"
pico.raft_propose
"
,
op
)
i1
.
call
(
"
.proc_sync_raft
"
,
index
,
(
3
,
0
))
i2
.
call
(
"
.proc_sync_raft
"
,
index
,
(
3
,
0
))
# Schema version was updated
assert
i1
.
call
(
"
box.space._pico
data
_property:get
"
,
"
current_schema_version
"
)[
1
]
==
2
assert
i2
.
call
(
"
box.space._pico
data
_property:get
"
,
"
current_schema_version
"
)[
1
]
==
2
assert
i1
.
call
(
"
box.space._pico_property:get
"
,
"
current_schema_version
"
)[
1
]
==
2
assert
i2
.
call
(
"
box.space._pico_property:get
"
,
"
current_schema_version
"
)[
1
]
==
2
# Space was created and is operable
space_info
=
[
666
,
"
stuff
"
,
[
"
global
"
],
[[
"
id
"
,
"
unsigned
"
,
False
]],
2
,
True
]
assert
i1
.
call
(
"
box.space._pico
data
_space:get
"
,
666
)
==
space_info
assert
i2
.
call
(
"
box.space._pico
data
_space:get
"
,
666
)
==
space_info
assert
i1
.
call
(
"
box.space._pico_space:get
"
,
666
)
==
space_info
assert
i2
.
call
(
"
box.space._pico_space:get
"
,
666
)
==
space_info
space_meta
=
[
666
,
...
...
@@ -76,7 +78,7 @@ def test_ddl_create_space_bulky(cluster: Cluster):
# Primary index was also created
# TODO: maybe we want to replace these `None`s with the default values when
# inserting the index definition into _pico
data
_index?
# inserting the index definition into _pico_index?
index_info
=
[
666
,
0
,
...
...
@@ -86,8 +88,8 @@ def test_ddl_create_space_bulky(cluster: Cluster):
2
,
True
,
]
assert
i1
.
call
(
"
box.space._pico
data
_index:get
"
,
[
666
,
0
])
==
index_info
assert
i2
.
call
(
"
box.space._pico
data
_index:get
"
,
[
666
,
0
])
==
index_info
assert
i1
.
call
(
"
box.space._pico_index:get
"
,
[
666
,
0
])
==
index_info
assert
i2
.
call
(
"
box.space._pico_index:get
"
,
[
666
,
0
])
==
index_info
index_meta
=
[
666
,
...
...
@@ -104,9 +106,9 @@ def test_ddl_create_space_bulky(cluster: Cluster):
i3
=
cluster
.
add_instance
(
wait_online
=
True
,
replicaset_id
=
"
r2
"
)
# It's schema was updated automatically
assert
i3
.
call
(
"
box.space._pico
data
_property:get
"
,
"
current_schema_version
"
)[
1
]
==
2
assert
i3
.
call
(
"
box.space._pico
data
_space:get
"
,
666
)
==
space_info
assert
i3
.
call
(
"
box.space._pico
data
_index:get
"
,
[
666
,
0
])
==
index_info
assert
i3
.
call
(
"
box.space._pico_property:get
"
,
"
current_schema_version
"
)[
1
]
==
2
assert
i3
.
call
(
"
box.space._pico_space:get
"
,
666
)
==
space_info
assert
i3
.
call
(
"
box.space._pico_index:get
"
,
[
666
,
0
])
==
index_info
# TODO: this fails
assert
i3
.
call
(
"
box.space._space:get
"
,
666
)
==
space_meta
assert
i3
.
call
(
"
box.space._index:get
"
,
[
666
,
0
])
==
index_meta
...
...
@@ -115,9 +117,9 @@ def test_ddl_create_space_bulky(cluster: Cluster):
i4
=
cluster
.
add_instance
(
wait_online
=
True
,
replicaset_id
=
"
r2
"
)
# It's schema was updated automatically as well
assert
i4
.
call
(
"
box.space._pico
data
_property:get
"
,
"
current_schema_version
"
)[
1
]
==
2
assert
i4
.
call
(
"
box.space._pico
data
_space:get
"
,
666
)
==
space_info
assert
i4
.
call
(
"
box.space._pico
data
_index:get
"
,
[
666
,
0
])
==
index_info
assert
i4
.
call
(
"
box.space._pico_property:get
"
,
"
current_schema_version
"
)[
1
]
==
2
assert
i4
.
call
(
"
box.space._pico_space:get
"
,
666
)
==
space_info
assert
i4
.
call
(
"
box.space._pico_index:get
"
,
[
666
,
0
])
==
index_info
assert
i4
.
call
(
"
box.space._space:get
"
,
666
)
==
space_meta
assert
i4
.
call
(
"
box.space._index:get
"
,
[
666
,
0
])
==
index_meta
...
...
@@ -151,11 +153,11 @@ def test_ddl_create_space_partial_failure(cluster: Cluster):
i3
.
call
(
"
.proc_sync_raft
"
,
abort_index
,
(
3
,
0
))
# No space was created
assert
i1
.
call
(
"
box.space._pico
data
_space:get
"
,
666
)
is
None
assert
i1
.
call
(
"
box.space._pico_space:get
"
,
666
)
is
None
assert
i1
.
call
(
"
box.space._space:get
"
,
666
)
is
None
assert
i2
.
call
(
"
box.space._pico
data
_space:get
"
,
666
)
is
None
assert
i2
.
call
(
"
box.space._pico_space:get
"
,
666
)
is
None
assert
i2
.
call
(
"
box.space._space:get
"
,
666
)
is
None
assert
i3
.
call
(
"
box.space._pico
data
_space:get
"
,
666
)
is
None
assert
i3
.
call
(
"
box.space._pico_space:get
"
,
666
)
is
None
assert
i3
.
call
(
"
box.space._space:get
"
,
666
)
is
None
# TODO: add instance which will conflict with this ddl and make sure it
...
...
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