Skip to content

Update Tarantool versions in test matrix #198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/test_on_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
strategy:
matrix:
tarantool-version: ["1.10", "2.2", "2.3", "2.4", "2.5", "2.6", "2.7"]
tarantool-version: ["1.10", "2.2", "2.3", "2.7", "2.8"]
remove-merger: [false]
include:
- tarantool-version: "2.7"
Expand Down Expand Up @@ -56,9 +56,7 @@ jobs:
if: github.event_name == 'push'
strategy:
matrix:
# We need 1.10.6 here to check that module works with
# old Tarantool versions that don't have "tuple-keydef"/"tuple-merger" support.
bundle_version: [ "1.10.6-1-g52c786b", "1.10.10-0-gaea7ae77a-r399", "2.7.2-0-g4d8c06890-r399" ]
bundle_version: [ "1.10.11-0-gf0b0e7ecf-r422", "2.7.3-0-gdddf926c3-r422" ]
fail-fast: false
runs-on: [ ubuntu-latest ]
steps:
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Changed

* Remove support of Tarantool versions that have no builtin tuple-keydef
module.
* Tarantool versions 2.{4,5,6} have reached EOL and removed from regression
testing. It means that methods `crud.min()` and `crud.max` won't work for old
versions (< 1.10.8) anymore.
* Names of errors generated by CRUD operations have been unified.

### Added
Expand Down
43 changes: 9 additions & 34 deletions crud/borders.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ local dev_checks = require('crud.common.dev_checks')
local call = require('crud.common.call')
local utils = require('crud.common.utils')
local schema = require('crud.common.schema')
local has_keydef, Keydef = pcall(require, 'crud.compare.keydef')
local select_comparators = require('crud.compare.comparators')
local Keydef = require('crud.compare.keydef')

local BorderError = errors.new_class('BorderError', {capture_stack = false})

Expand Down Expand Up @@ -45,25 +44,14 @@ function borders.init()
_G._crud.get_border_on_storage = get_border_on_storage
end

local is_closer

if has_keydef then
is_closer = function (compare_sign, keydef, tuple, res_tuple)
if res_tuple == nil then
return true
end
local is_closer = function (compare_sign, keydef, tuple, res_tuple)
if res_tuple == nil then
return true
end

local cmp = keydef:compare(tuple, res_tuple)
local cmp = keydef:compare(tuple, res_tuple)

return cmp * compare_sign > 0
end
else
is_closer = function (_, comparator, tuple, res_tuple)
if res_tuple == nil then
return true
end
return comparator(tuple, res_tuple)
end
return cmp * compare_sign > 0
end

local function call_get_border_on_router(border_name, space_name, index_name, opts)
Expand Down Expand Up @@ -112,20 +100,7 @@ local function call_get_border_on_router(border_name, space_name, index_name, op
end

local compare_sign = border_name == 'max' and 1 or -1
local comparator
if has_keydef then
comparator = Keydef.new(space, field_names, index.id)
else
local tarantool_iter
if compare_sign > 0 then
tarantool_iter = box.index.GT
else
tarantool_iter = box.index.LT
end
local key_parts = utils.merge_primary_key_parts(index.parts, primary_index.parts)
local cmp_operator = select_comparators.get_cmp_operator(tarantool_iter)
comparator = select_comparators.gen_tuples_comparator(cmp_operator, key_parts, field_names, space:format())
end
local keydef = Keydef.new(space, field_names, index.id)

local res_tuple = nil
for _, storage_result in pairs(results) do
Expand All @@ -136,7 +111,7 @@ local function call_get_border_on_router(border_name, space_name, index_name, op
end

local tuple = storage_result.res
if tuple ~= nil and is_closer(compare_sign, comparator, tuple, res_tuple) then
if tuple ~= nil and is_closer(compare_sign, keydef, tuple, res_tuple) then
res_tuple = tuple
end
end
Expand Down