Skip to content
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

Tuple merger incompatibility fixes needed for tarantool/tarantool#8147 #390

Merged
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
17 changes: 12 additions & 5 deletions .github/workflows/test_on_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ jobs:
tarantool-version: ["1.10.6", "1.10", "2.2", "2.3", "2.4", "2.5", "2.6", "2.7", "2.8", "2.10", "2.11"]
metrics-version: [""]
cartridge-version: ["2.8.0"]
remove-merger: [false]
external-tuple-merger-version: [""]
external-tuple-keydef-version: [""]
include:
- tarantool-version: "1.10"
metrics-version: "1.0.0"
cartridge-version: "2.8.0"
- tarantool-version: "2.7"
remove-merger: true
cartridge-version: "2.8.0"
- tarantool-version: "2.10"
metrics-version: "0.10.0"
Expand All @@ -38,6 +38,9 @@ jobs:
- tarantool-version: "2.11"
metrics-version: "1.0.0"
vshard-version: "0.1.24"
- tarantool-version: "2.11"
external-merger-version: "0.0.5"
external-keydef-version: "0.0.4"
- tarantool-version: "master"
metrics-version: "1.0.0"
vshard-version: "0.1.24"
Expand Down Expand Up @@ -102,9 +105,13 @@ jobs:
if: matrix.metrics-version != ''
run: tt rocks install metrics ${{ matrix.metrics-version }}

- name: Remove external merger if needed
if: ${{ matrix.remove-merger }}
run: rm .rocks/lib/tarantool/tuple/merger.so
- name: Install external tuple-merger
if: matrix.external-tuple-merger-version != ''
run: tt rocks install tuple-merger ${{ matrix.external-tuple-merger-version }}

- name: Install external tuple-keydef
if: matrix.external-tuple-keydef-version != ''
run: tt rocks install tuple-keydef ${{ matrix.external-tuple-keydef-version }}

# This server starts and listen on 8084 port that is used for tests
- name: Stop Mono server
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## Unreleased

### Changed
* Dropped external tuple merger and tuple keydef modules installation from the
package build (#390).

### Fixed
* Compatibility with Tarantool 3.0 binary protocol change (#390).
* Compatibility with Tarantool 3.0 tuple objects (#390).

## [1.4.0] - 16-10-23

### Added
Expand Down
10 changes: 0 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,3 @@ install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cartridge
DESTINATION ${TARANTOOL_INSTALL_LUADIR}
)

# Don't include to rockspec as some Tarantool versions (e.g. 2.2 and 2.3)
# don't have symbols required by "tuple-merger" and "tuple-keydef" modules.
execute_process(
COMMAND bash "-c" "tarantoolctl rocks install tuple-keydef 0.0.2"
)

execute_process(
COMMAND bash "-c" "tarantoolctl rocks install tuple-merger 0.0.2"
)
11 changes: 11 additions & 0 deletions crud/common/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,9 @@ local function determine_enabled_features()
or is_version_in_range(major, minor, patch, suffix,
1, 10, 8, nil,
1, 10, math.huge, nil)

enabled_tarantool_features.netbox_skip_header_option = is_version_ge(major, minor, patch, suffix,
2, 2, 0, nil)
end

function utils.tarantool_supports_fieldpaths()
Expand Down Expand Up @@ -681,6 +684,14 @@ function utils.tarantool_supports_external_merger()
return enabled_tarantool_features.external_merger
end

function utils.tarantool_supports_netbox_skip_header_option()
if enabled_tarantool_features.netbox_skip_header_option == nil then
determine_enabled_features()
end

return enabled_tarantool_features.netbox_skip_header_option
end

local function add_nullable_fields_recursive(operations, operations_map, space_format, tuple, id)
if id < 2 or tuple[id - 1] ~= box.NULL then
return operations
Expand Down
4 changes: 2 additions & 2 deletions crud/select.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ end

local function select_on_storage(space_name, index_id, conditions, opts)
dev_checks('string', 'number', '?table', {
scan_value = 'table',
after_tuple = '?table',
scan_value = 'table|cdata',
after_tuple = '?table|cdata',
tarantool_iter = 'number',
limit = 'number',
scan_condition_num = '?number',
Expand Down
4 changes: 2 additions & 2 deletions crud/select/executor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ end

function executor.execute(space, index, filter_func, opts)
dev_checks('table', 'table', 'function', {
scan_value = 'table',
after_tuple = '?table',
scan_value = 'table|cdata',
after_tuple = '?table|cdata',
tarantool_iter = 'number',
limit = '?number',
yield_every = '?number',
Expand Down
34 changes: 21 additions & 13 deletions crud/select/merger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,7 @@ end

local data = ffi.new('const unsigned char *[1]')

local function decode_response_headers(buf)
-- {48: [cursor, [tuple_1, tuple_2, ...]]} (exactly 1 pair of key-value)
data[0] = buf.rpos

-- 48 (key)
data[0] = data[0] + 1

-- [cursor, [tuple_1, tuple_2, ...]] (value)
data[0] = data[0] + 1

-- Decode array header
local function decode_response_array_header()
DifferentialOrange marked this conversation as resolved.
Show resolved Hide resolved
local c = data[0][0]
data[0] = data[0] + 1
if c == 0xdc then
Expand All @@ -80,6 +70,22 @@ local function decode_response_headers(buf)
return ffi.cast(char_ptr, data[0])
end

local function decode_response_headers(buf)
data[0] = buf.rpos

if not utils.tarantool_supports_netbox_skip_header_option() then
-- {48: [cursor, [tuple_1, tuple_2, ...]]} (exactly 1 pair of key-value)

-- 48 (key)
data[0] = data[0] + 1

-- [cursor, [tuple_1, tuple_2, ...]] (value)
data[0] = data[0] + 1
end

return decode_response_array_header()
end

local function decode_metainfo(buf)
-- Skip an array around a call return values.
buf.rpos = decode_response_headers(buf)
Expand Down Expand Up @@ -192,7 +198,8 @@ local function new(vshard_router, replicasets, space, index_id, func_name, func_
for _, replicaset in pairs(replicasets) do
-- Perform a request.
local buf = buffer.ibuf()
local net_box_opts = {is_async = true, buffer = buf, skip_header = false}
local net_box_opts = {is_async = true, buffer = buf,
skip_header = utils.tarantool_supports_netbox_skip_header_option() or nil}
local future = replicaset[vshard_call_name](replicaset, func_name, func_args,
net_box_opts)

Expand Down Expand Up @@ -249,7 +256,8 @@ local function new_readview(vshard_router, replicasets, readview_uuid, space, in
if replica_uuid == value.uuid then
-- Perform a request.
local buf = buffer.ibuf()
local net_box_opts = {is_async = true, buffer = buf, skip_header = false}
local net_box_opts = {is_async = true, buffer = buf,
skip_header = utils.tarantool_supports_netbox_skip_header_option() or nil}
func_args[4].readview_id = value.id
local future = replica.conn:call(func_name, func_args, net_box_opts)

Expand Down