diff --git a/test/vinyl/upsert.result b/test/vinyl/upsert.result index 32f5105c3eacdd894347e02e59ca835a4024b753..9f48d6136ae3d50926d0a27902015fcd976e83c2 100644 --- a/test/vinyl/upsert.result +++ b/test/vinyl/upsert.result @@ -673,7 +673,7 @@ space:drop() s = box.schema.space.create('test', {engine = 'vinyl'}) --- ... -i = s:create_index('test') +i = s:create_index('test', { run_count_per_level = 20 }) --- ... s:replace({1, 1}) @@ -694,6 +694,56 @@ s:select() --both upserts are ignored due to primary key change --- - - [1, 1] ... +-- gh-2520 use cache as a hint for upserts applying. +old_stat = box.info.vinyl().performance["iterator"].run.lookup_count +--- +... +s:upsert({100}, {{'=', 2, 200}}) +--- +... +box.snapshot() +--- +- ok +... +s:get{100} +--- +- [100] +... +new_stat = box.info.vinyl().performance["iterator"].run.lookup_count +--- +... +new_stat - old_stat +--- +- 1 +... +old_stat = new_stat +--- +... +box.snapshot() +--- +- ok +... +s:upsert({100}, {{'=', 2, 300}}) +--- +... +box.snapshot() +--- +- ok +... +s:get{100} +--- +- [100, 300] +... +new_stat = box.info.vinyl().performance["iterator"].run.lookup_count +--- +... +new_stat - old_stat +--- +- 2 +... +old_stat = new_stat +--- +... s:drop() --- ... diff --git a/test/vinyl/upsert.test.lua b/test/vinyl/upsert.test.lua index 82af24a698a94f42d752ae4ba8d1685cf9ad10b1..1a73be48dabdd77619a6cd22a16425776d6dabb3 100644 --- a/test/vinyl/upsert.test.lua +++ b/test/vinyl/upsert.test.lua @@ -272,7 +272,7 @@ space:drop() -- fix behaviour after https://github.com/tarantool/tarantool/issues/2104 s = box.schema.space.create('test', {engine = 'vinyl'}) -i = s:create_index('test') +i = s:create_index('test', { run_count_per_level = 20 }) s:replace({1, 1}) box.snapshot() @@ -280,4 +280,20 @@ s:upsert({1, 1}, {{'+', 1, 1}}) s:upsert({1, 1}, {{'+', 2, 1}}) s:select() --both upserts are ignored due to primary key change +-- gh-2520 use cache as a hint for upserts applying. +old_stat = box.info.vinyl().performance["iterator"].run.lookup_count +s:upsert({100}, {{'=', 2, 200}}) +box.snapshot() +s:get{100} +new_stat = box.info.vinyl().performance["iterator"].run.lookup_count +new_stat - old_stat +old_stat = new_stat +box.snapshot() +s:upsert({100}, {{'=', 2, 300}}) +box.snapshot() +s:get{100} +new_stat = box.info.vinyl().performance["iterator"].run.lookup_count +new_stat - old_stat +old_stat = new_stat + s:drop()