Skip to content

Use "merger" for fetch&sort tuples on router #38

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 20 commits into from
Mar 24, 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
2 changes: 2 additions & 0 deletions .github/workflows/test_on_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
run: |
curl -L https://tarantool.io/installer.sh | sudo VER=${{ matrix.tarantool-version }} bash
sudo apt install -y tarantool-dev
tarantool --version
./deps.sh

# This server starts and listen on 8084 port that is used for tests
Expand Down Expand Up @@ -50,6 +51,7 @@ jobs:
rm -f tarantool-enterprise-bundle-${{ matrix.bundle_version }}.tar.gz
sudo cp tarantool-enterprise/tarantool /usr/bin/tarantool
source tarantool-enterprise/env.sh
tarantool --version
./deps.sh

# This server starts and listen on 8084 port that is used for tests
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@ 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-merger 0.0.1"
)
14 changes: 7 additions & 7 deletions crud/common/call.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ local NotInitializedError = errors.new_class('NotInitialized')

local call = {}

local DEFAULT_VSHARD_CALL_TIMEOUT = 2
call.DEFAULT_VSHARD_CALL_TIMEOUT = 2

local function get_vshard_call_name(mode, prefer_replica, balance)
function call.get_vshard_call_name(mode, prefer_replica, balance)
dev_checks('string', '?boolean', '?boolean')

if mode == 'write' then
Expand Down Expand Up @@ -74,9 +74,9 @@ function call.map(func_name, func_args, opts)
})
opts = opts or {}

local vshard_call_name = get_vshard_call_name(opts.mode, opts.prefer_replica, opts.balance)
local vshard_call_name = call.get_vshard_call_name(opts.mode, opts.prefer_replica, opts.balance)

local timeout = opts.timeout or DEFAULT_VSHARD_CALL_TIMEOUT
local timeout = opts.timeout or call.DEFAULT_VSHARD_CALL_TIMEOUT

local replicasets, err
if opts.replicasets ~= nil then
Expand Down Expand Up @@ -112,7 +112,7 @@ function call.map(func_name, func_args, opts)
return nil, wrap_vshard_err(err, func_name, replicaset_uuid)
end

results[replicaset_uuid] = result[1]
results[replicaset_uuid] = result
end

return results
Expand All @@ -126,9 +126,9 @@ function call.single(bucket_id, func_name, func_args, opts)
timeout = '?number',
})

local vshard_call_name = get_vshard_call_name(opts.mode, opts.prefer_replica, opts.balance, opts.mode)
local vshard_call_name = call.get_vshard_call_name(opts.mode, opts.prefer_replica, opts.balance, opts.mode)

local timeout = opts.timeout or DEFAULT_VSHARD_CALL_TIMEOUT
local timeout = opts.timeout or call.DEFAULT_VSHARD_CALL_TIMEOUT

local res, err = vshard.router[vshard_call_name](bucket_id, func_name, func_args, {
timeout = timeout,
Expand Down
Loading