From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp46.i.mail.ru (smtp46.i.mail.ru [94.100.177.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 0B74D469719 for ; Tue, 13 Oct 2020 13:18:40 +0300 (MSK) Date: Tue, 13 Oct 2020 10:18:39 +0000 From: Nikita Pettik Message-ID: <20201013101839.GA18306@tarantool.org> References: <0a5e175c-aeb1-a847-ebca-ba5cdbaaca11@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <0a5e175c-aeb1-a847-ebca-ba5cdbaaca11@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v3 0/2] vinyl: rework upsert operation List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy Cc: tarantool-patches@dev.tarantool.org On 11 Oct 17:35, Vladislav Shpilevoy wrote: > The patchset looks good except for not having a backward compatibility test. Here's a test: diff --git a/test/vinyl/upgrade/upsert/00000000000000000000.vylog b/test/vinyl/upgrade/upsert/00000000000000000000.vylog new file mode 100644 index 000000000..581ad9b53 Binary files /dev/null and b/test/vinyl/upgrade/upsert/00000000000000000000.vylog differ diff --git a/test/vinyl/upgrade/upsert/00000000000000000004.vylog b/test/vinyl/upgrade/upsert/00000000000000000004.vylog new file mode 100644 index 000000000..5194b1457 Binary files /dev/null and b/test/vinyl/upgrade/upsert/00000000000000000004.vylog differ diff --git a/test/vinyl/upgrade/upsert/00000000000000000004.xlog b/test/vinyl/upgrade/upsert/00000000000000000004.xlog new file mode 100644 index 000000000..5725d09ce Binary files /dev/null and b/test/vinyl/upgrade/upsert/00000000000000000004.xlog differ diff --git a/test/vinyl/upgrade/upsert/00000000000000000010.vylog b/test/vinyl/upgrade/upsert/00000000000000000010.vylog new file mode 100644 index 000000000..954a51a4c Binary files /dev/null and b/test/vinyl/upgrade/upsert/00000000000000000010.vylog differ diff --git a/test/vinyl/upgrade/upsert/00000000000000000010.xlog b/test/vinyl/upgrade/upsert/00000000000000000010.xlog new file mode 100644 index 000000000..f5921223d --- /dev/null +++ b/test/vinyl/upgrade/upsert/00000000000000000010.xlog @@ -0,0 +1,8 @@ +XLOG +0.13 +Version: 2.6.0-153-g3bc455f7d +Instance: 4b1aba36-0cbc-4d51-9968-53da3908a43d +VClock: {1: 10} +PrevVClock: {1: 4} + +^P \ No newline at end of file diff --git a/test/vinyl/upgrade/upsert/512/0/00000000000000000002.index b/test/vinyl/upgrade/upsert/512/0/00000000000000000002.index new file mode 100644 index 000000000..156c23dd7 Binary files /dev/null and b/test/vinyl/upgrade/upsert/512/0/00000000000000000002.index differ diff --git a/test/vinyl/upgrade/upsert/512/0/00000000000000000002.run b/test/vinyl/upgrade/upsert/512/0/00000000000000000002.run new file mode 100644 index 000000000..9757ea341 Binary files /dev/null and b/test/vinyl/upgrade/upsert/512/0/00000000000000000002.run differ diff --git a/test/vinyl/upgrade/upsert/512/0/00000000000000000004.index b/test/vinyl/upgrade/upsert/512/0/00000000000000000004.index new file mode 100644 index 000000000..1c3896547 Binary files /dev/null and b/test/vinyl/upgrade/upsert/512/0/00000000000000000004.index differ diff --git a/test/vinyl/upgrade/upsert/512/0/00000000000000000004.run b/test/vinyl/upgrade/upsert/512/0/00000000000000000004.run new file mode 100644 index 000000000..469e2abab Binary files /dev/null and b/test/vinyl/upgrade/upsert/512/0/00000000000000000004.run differ diff --git a/test/vinyl/upgrade/upsert/512/0/00000000000000000006.index b/test/vinyl/upgrade/upsert/512/0/00000000000000000006.index new file mode 100644 index 000000000..9202ec7e7 Binary files /dev/null and b/test/vinyl/upgrade/upsert/512/0/00000000000000000006.index differ diff --git a/test/vinyl/upgrade/upsert/512/0/00000000000000000006.run b/test/vinyl/upgrade/upsert/512/0/00000000000000000006.run new file mode 100644 index 000000000..d4fcd7599 Binary files /dev/null and b/test/vinyl/upgrade/upsert/512/0/00000000000000000006.run differ diff --git a/test/vinyl/upsert_upgrade.result b/test/vinyl/upsert_upgrade.result new file mode 100644 index 000000000..8882a8b63 --- /dev/null +++ b/test/vinyl/upsert_upgrade.result @@ -0,0 +1,59 @@ +-- test-run result file version 2 +test_run = require('test_run').new() + | --- + | ... + +-- Upsert's internal format have changed: now update operations are stored +-- with additional map package. Let's test backward compatibility. +-- Snapshot (i.e. run files) contain following statements: + +-- s = box.schema.create_space('test', {engine = 'vinyl'}) +-- pk = s:create_index('pk') +-- s:insert({1, 2}) +-- box.snapshot() +-- s:upsert({1, 0}, {{'+', 2, 1}}) +-- s:upsert({1, 0}, {{'-', 2, 2}}) +-- s:upsert({2, 0}, {{'+', 2, 1}}) +-- s:upsert({2, 0}, {{'-', 2, 2}}) +-- s:upsert({1, 0}, {{'=', 2, 2}}) +-- s:upsert({1, 0}, {{'-', 2, 2}}) +-- box.snapshot() +-- +-- Make sure that upserts will be parsed and squashed correctly. +-- + +dst_dir = 'vinyl/upgrade/upsert/' + | --- + | ... + +test_run:cmd('create server upgrade with script="vinyl/upgrade.lua", workdir="' .. dst_dir .. '"') + | --- + | - true + | ... +test_run:cmd('start server upgrade') + | --- + | - true + | ... +test_run:switch('upgrade') + | --- + | - true + | ... + +box.space.test:select() + | --- + | - - [1, 0] + | - [2, -2] + | ... + +test_run:switch('default') + | --- + | - true + | ... +test_run:cmd('stop server upgrade') + | --- + | - true + | ... +test_run:cmd('cleanup server upgrade') + | --- + | - true + | ... diff --git a/test/vinyl/upsert_upgrade.test.lua b/test/vinyl/upsert_upgrade.test.lua new file mode 100644 index 000000000..db409e2dd --- /dev/null +++ b/test/vinyl/upsert_upgrade.test.lua @@ -0,0 +1,32 @@ +test_run = require('test_run').new() + +-- Upsert's internal format have changed: now update operations are stored +-- with additional map package. Let's test backward compatibility. +-- Snapshot (i.e. run files) contain following statements: + +-- s = box.schema.create_space('test', {engine = 'vinyl'}) +-- pk = s:create_index('pk') +-- s:insert({1, 2}) +-- box.snapshot() +-- s:upsert({1, 0}, {{'+', 2, 1}}) +-- s:upsert({1, 0}, {{'-', 2, 2}}) +-- s:upsert({2, 0}, {{'+', 2, 1}}) +-- s:upsert({2, 0}, {{'-', 2, 2}}) +-- s:upsert({1, 0}, {{'=', 2, 2}}) +-- s:upsert({1, 0}, {{'-', 2, 2}}) +-- box.snapshot() +-- +-- Make sure that upserts will be parsed and squashed correctly. +-- + +dst_dir = 'vinyl/upgrade/upsert/' + +test_run:cmd('create server upgrade with script="vinyl/upgrade.lua", workdir="' .. dst_dir .. '"') +test_run:cmd('start server upgrade') +test_run:switch('upgrade') + +box.space.test:select() + +test_run:switch('default') +test_run:cmd('stop server upgrade') +test_run:cmd('cleanup server upgrade')