Skip to content

Commit 0df1863

Browse files
committed
Remove support of Tarantool wo tuple-keydef support (WIP)
and revert changes in 7413c6a
1 parent dbb8e1e commit 0df1863

File tree

2 files changed

+10
-37
lines changed

2 files changed

+10
-37
lines changed

.github/workflows/test_on_push.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ jobs:
5656
if: github.event_name == 'push'
5757
strategy:
5858
matrix:
59-
# We need 1.10.6 here to check that module works with
60-
# old Tarantool versions that don't have "tuple-keydef"/"tuple-merger" support.
61-
bundle_version: [ "1.10.6-1-g52c786b", "1.10.10-0-gaea7ae77a-r399", "2.7.2-0-g4d8c06890-r399" ]
59+
bundle_version: [ "1.10.11-0-gf0b0e7ecf-r422", "2.7.3-0-gdddf926c3-r422" ]
6260
fail-fast: false
6361
runs-on: [ ubuntu-latest ]
6462
steps:

crud/borders.lua

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ local dev_checks = require('crud.common.dev_checks')
66
local call = require('crud.common.call')
77
local utils = require('crud.common.utils')
88
local schema = require('crud.common.schema')
9-
local has_keydef, Keydef = pcall(require, 'crud.compare.keydef')
10-
local select_comparators = require('crud.compare.comparators')
9+
local Keydef = require('crud.compare.keydef')
1110

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

@@ -45,25 +44,14 @@ function borders.init()
4544
_G._crud.get_border_on_storage = get_border_on_storage
4645
end
4746

48-
local is_closer
49-
50-
if has_keydef then
51-
is_closer = function (compare_sign, keydef, tuple, res_tuple)
52-
if res_tuple == nil then
53-
return true
54-
end
47+
local is_closer = function (compare_sign, keydef, tuple, res_tuple)
48+
if res_tuple == nil then
49+
return true
50+
end
5551

56-
local cmp = keydef:compare(tuple, res_tuple)
52+
local cmp = keydef:compare(tuple, res_tuple)
5753

58-
return cmp * compare_sign > 0
59-
end
60-
else
61-
is_closer = function (_, comparator, tuple, res_tuple)
62-
if res_tuple == nil then
63-
return true
64-
end
65-
return comparator(tuple, res_tuple)
66-
end
54+
return cmp * compare_sign > 0
6755
end
6856

6957
local function call_get_border_on_router(border_name, space_name, index_name, opts)
@@ -112,20 +100,7 @@ local function call_get_border_on_router(border_name, space_name, index_name, op
112100
end
113101

114102
local compare_sign = border_name == 'max' and 1 or -1
115-
local comparator
116-
if has_keydef then
117-
comparator = Keydef.new(space, field_names, index.id)
118-
else
119-
local tarantool_iter
120-
if compare_sign > 0 then
121-
tarantool_iter = box.index.GT
122-
else
123-
tarantool_iter = box.index.LT
124-
end
125-
local key_parts = utils.merge_primary_key_parts(index.parts, primary_index.parts)
126-
local cmp_operator = select_comparators.get_cmp_operator(tarantool_iter)
127-
comparator = select_comparators.gen_tuples_comparator(cmp_operator, key_parts, field_names, space:format())
128-
end
103+
local keydef = Keydef.new(space, field_names, index.id)
129104

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

138113
local tuple = storage_result.res
139-
if tuple ~= nil and is_closer(compare_sign, comparator, tuple, res_tuple) then
114+
if tuple ~= nil and is_closer(compare_sign, keydef, tuple, res_tuple) then
140115
res_tuple = tuple
141116
end
142117
end

0 commit comments

Comments
 (0)