Skip to content

Commit

Permalink
test: fix upgrade.test.lua not working on 3.0
Browse files Browse the repository at this point in the history
The test tried to call vshard.storage.cfg{} second time on 3.0
using an old vshard version. It won't work because the old
non-first cfg tried to compare box.info.cluster.uuid with the
replicaset UUID in the config. But box.info.cluster.uuid is nil in
3.0. It was moved to box.info.replicaset.uuid.

The patch makes the upgrade test use the first commit compatible
with 3.0 as the basic version, if the Tarantool executable is 3.0.

Note that on versions < 3.0 the vshard upgrade still works fine,
hence on old executables the basic version is kept as is.

Follow up #402

NO_DOC=test
  • Loading branch information
Gerold103 committed Mar 29, 2023
1 parent 0243bc6 commit 62929f0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 39 deletions.
48 changes: 20 additions & 28 deletions test/upgrade/upgrade.result
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,25 @@ git_util = require('git_util')
util = require('util')
| ---
| ...
vutil = require('vshard.util')
| ---
| ...

-- Commit "Improve compatibility with 1.9".
version_0_1_15_0 = '79a4dbfc4229e922cbfe4be259193a7b18dc089d'
oldest_version = nil
| ---
| ...
-- On 3.0 old vshard versions won't work. The users are supposed to update
-- vshard first, and then update Tarantool.
if vutil.version_is_at_least(3, 0, 0, 'entrypoint', 0, 0) then \
-- Commit 'Support 3.0'. \
oldest_version = '0243bc692fb6b34e26e89ea032214859f1ad53ea' \
else \
-- Commit 'Improve compatibility with 1.9'. \
oldest_version = '79a4dbfc4229e922cbfe4be259193a7b18dc089d' \
end
| ---
| ...
vshard_copy_path = util.git_checkout('vshard_git_tree_copy_0_1_15_0', \
version_0_1_15_0)
vshard_copy_path = util.git_checkout('vshard_git_tree_copy', oldest_version)
| ---
| ...

Expand Down Expand Up @@ -47,17 +59,9 @@ test_run:switch('storage_1_a')
| ---
| - true
| ...
box.space._schema:get({'oncevshard:storage:1'}) or box.space._schema:select()
| ---
| - ['oncevshard:storage:1']
| ...
vshard.storage.internal.schema_current_version
| ---
| - null
| ...
vshard.storage.internal.schema_latest_version
box.space._schema:get{'vshard_version'} or box.space._schema:select()
| ---
| - null
| - ['vshard_version', 0, 1, 16, 0]
| ...
bucket_count = vshard.consts.DEFAULT_BUCKET_COUNT / 2
| ---
Expand All @@ -80,21 +84,9 @@ test_run:switch('storage_2_a')
| ---
| - true
| ...
box.space._schema:get({'oncevshard:storage:1'}) or box.space._schema:select()
| ---
| - ['oncevshard:storage:1']
| ...
vshard.storage.internal.schema_current_version
| ---
| - null
| ...
vshard.storage.internal.schema_latest_version
| ---
| - null
| ...
vshard.storage._call == nil
box.space._schema:get{'vshard_version'} or box.space._schema:select()
| ---
| - true
| - ['vshard_version', 0, 1, 16, 0]
| ...
bucket_count = vshard.consts.DEFAULT_BUCKET_COUNT / 2
| ---
Expand Down
25 changes: 14 additions & 11 deletions test/upgrade/upgrade.test.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
test_run = require('test_run').new()
git_util = require('git_util')
util = require('util')
vutil = require('vshard.util')

-- Commit "Improve compatibility with 1.9".
version_0_1_15_0 = '79a4dbfc4229e922cbfe4be259193a7b18dc089d'
vshard_copy_path = util.git_checkout('vshard_git_tree_copy_0_1_15_0', \
version_0_1_15_0)
oldest_version = nil
-- On 3.0 old vshard versions won't work. The users are supposed to update
-- vshard first, and then update Tarantool.
if vutil.version_is_at_least(3, 0, 0, 'entrypoint', 0, 0) then \
-- Commit 'Support 3.0'. \
oldest_version = '0243bc692fb6b34e26e89ea032214859f1ad53ea' \
else \
-- Commit 'Improve compatibility with 1.9'. \
oldest_version = '79a4dbfc4229e922cbfe4be259193a7b18dc089d' \
end
vshard_copy_path = util.git_checkout('vshard_git_tree_copy', oldest_version)

REPLICASET_1 = { 'storage_1_a', 'storage_1_b' }
REPLICASET_2 = { 'storage_2_a', 'storage_2_b' }
Expand All @@ -17,9 +25,7 @@ util.wait_master(test_run, REPLICASET_2, 'storage_2_a')
util.map_evals(test_run, {REPLICASET_1, REPLICASET_2}, 'bootstrap_storage(\'memtx\')')

test_run:switch('storage_1_a')
box.space._schema:get({'oncevshard:storage:1'}) or box.space._schema:select()
vshard.storage.internal.schema_current_version
vshard.storage.internal.schema_latest_version
box.space._schema:get{'vshard_version'} or box.space._schema:select()
bucket_count = vshard.consts.DEFAULT_BUCKET_COUNT / 2
vshard.storage.bucket_force_create(1, bucket_count)
box.begin() \
Expand All @@ -28,10 +34,7 @@ box.commit()
box.space.test:count()

test_run:switch('storage_2_a')
box.space._schema:get({'oncevshard:storage:1'}) or box.space._schema:select()
vshard.storage.internal.schema_current_version
vshard.storage.internal.schema_latest_version
vshard.storage._call == nil
box.space._schema:get{'vshard_version'} or box.space._schema:select()
bucket_count = vshard.consts.DEFAULT_BUCKET_COUNT / 2
first_bucket = vshard.consts.DEFAULT_BUCKET_COUNT / 2 + 1
vshard.storage.bucket_force_create(first_bucket, bucket_count)
Expand Down

0 comments on commit 62929f0

Please sign in to comment.