diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 33e583a..9da4363 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -9,7 +9,7 @@ jobs: version-check: # We need this job to run only on push with tag. if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Check module version uses: tarantool/actions/check-module-version@master @@ -18,9 +18,9 @@ jobs: publish-scm-1: if: github.ref == 'refs/heads/master' - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 - uses: tarantool/rocks.tarantool.org/github-action@master with: auth: ${{ secrets.ROCKS_AUTH }} @@ -29,13 +29,13 @@ jobs: publish-tag: if: startsWith(github.ref, 'refs/tags/') needs: version-check - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 - - uses: tarantool/setup-tarantool@v1 + - uses: tarantool/setup-tarantool@v4 with: - tarantool-version: '2.8' + tarantool-version: '2.11' - run: cmake . - run: echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV diff --git a/.github/workflows/test_on_push.yaml b/.github/workflows/test_on_push.yaml index 8ed6f1a..6f07ce1 100644 --- a/.github/workflows/test_on_push.yaml +++ b/.github/workflows/test_on_push.yaml @@ -4,7 +4,7 @@ on: [push] jobs: all: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 timeout-minutes: 20 env: DOWNLOAD_TOKEN: ${{ secrets.DOWNLOAD_TOKEN }} @@ -12,10 +12,10 @@ jobs: ROCKS_PASSWORD: ${{ secrets.ROCKS_PASSWORD }} steps: - name: Checkout sources - uses: actions/checkout@v2 - - uses: tarantool/setup-tarantool@v1 + uses: actions/checkout@v6 + - uses: tarantool/setup-tarantool@v4 with: - tarantool-version: '2.8' + tarantool-version: '2.11' - name: CMAKE run: cmake . diff --git a/CMakeLists.txt b/CMakeLists.txt index 7894e7d..0311d78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12 FATAL_ERROR) +cmake_minimum_required(VERSION 3.10...3.31 FATAL_ERROR) project(graphqlapi NONE) diff --git a/examples/cartridge-simple/app/test_data.lua b/examples/cartridge-simple/app/test_data.lua index 96a22f3..d0b12e5 100644 --- a/examples/cartridge-simple/app/test_data.lua +++ b/examples/cartridge-simple/app/test_data.lua @@ -1,11 +1,4 @@ -local ddl -local ok, rc = pcall(require, 'ddl-ee') -if ok then - ddl = rc -else - ddl = require('ddl') -end - +local ddl = require('ddl') local log = require('log') local function fill() @@ -17,33 +10,33 @@ local function fill() is_local = false, temporary = false, format = { - { name = 'customer_id', is_nullable = false, type = 'unsigned' }, - { name = 'bucket_id', is_nullable = false, type = 'unsigned' }, - { name = 'fullname', is_nullable = false, type = 'string' }, + {name = 'customer_id', is_nullable = false, type = 'unsigned'}, + {name = 'bucket_id', is_nullable = false, type = 'unsigned'}, + {name = 'fullname', is_nullable = false, type = 'string'}, }, - indexes = { { + indexes = {{ name = 'customer_id', type = 'TREE', unique = true, parts = { - { path = 'customer_id', is_nullable = false, type = 'unsigned' } + {path = 'customer_id', is_nullable = false, type = 'unsigned'} } }, { name = 'bucket_id', type = 'TREE', unique = false, parts = { - { path = 'bucket_id', is_nullable = false, type = 'unsigned' } + {path = 'bucket_id', is_nullable = false, type = 'unsigned'} } }, { name = 'fullname', type = 'TREE', unique = true, parts = { - { path = 'fullname', is_nullable = false, type = 'string' } + {path = 'fullname', is_nullable = false, type = 'string'} } - } }, - sharding_key = { 'customer_id' }, + }}, + sharding_key = {'customer_id'}, } } } @@ -60,8 +53,8 @@ local function fill() if box.space['customer'] ~= nil then for id = 1, 250 do - local bucket_id = ddl.bucket_id('customer', { id }) - crud.replace('customer', { id, bucket_id, 'Test Customer ' .. tostring(id) }) + local bucket_id = ddl.bucket_id('customer', {id}) + crud.replace('customer', {id, bucket_id, 'Test Customer '..tostring(id)}) end end end diff --git a/graphqlapi/cluster.lua b/graphqlapi/cluster.lua index d536c09..7a15d81 100644 --- a/graphqlapi/cluster.lua +++ b/graphqlapi/cluster.lua @@ -1,5 +1,6 @@ local argparse = require('cartridge.argparse') local cartridge = require('cartridge') +local ddl = require('ddl') local errors = require('errors') local membership = require('membership') local pool = require('cartridge.pool') @@ -7,14 +8,6 @@ local vshard = require('vshard') local utils = require('graphqlapi.utils') -local ddl -local ok, rc = pcall(require, 'ddl-ee') -if ok then - ddl = rc -else - ddl = require('ddl') -end - local _replicas = {} local e_cluster_api = errors.new_class('cluster API error', { capture_stack = false }) @@ -38,7 +31,7 @@ local function get_servers() table.insert(servers, { alias = alias, conn = conn }) else connect_errors = connect_errors or {} - table.insert(connect_errors, e_cluster_api:new('instance \'%s\' error: %s', alias, err)) + table.insert(connect_errors, e_cluster_api:new('instance \'%s\' error: %s', alias, err)) end end return servers, connect_errors @@ -54,7 +47,7 @@ local function get_masters() table.insert(servers, { alias = alias, conn = conn }) else connect_errors = connect_errors or {} - table.insert(connect_errors, e_cluster_api:new('instance \'%s\' error: %s', alias, err)) + table.insert(connect_errors, e_cluster_api:new('instance \'%s\' error: %s', alias, err)) end end return servers, connect_errors @@ -79,7 +72,7 @@ local function get_storages_instances(mode, prefer_replica, balance) _replicas[uuid] = conn.peer_uuid else if prefer_replica == false and balance == false then - conn = replicaset.master.next_by_priority.conn + conn = replicaset.master.next_by_priority.conn _replicas[uuid] = conn.peer_uuid elseif prefer_replica == false and balance == true then local prev_uuid = _replicas[uuid] or replicaset.priority_list[1].uuid @@ -175,7 +168,7 @@ local function get_servers_by_list(instances) table.insert(servers, { replicaset_uuid = replicaset_uuid, alias = alias, conn = conn, }) else connect_errors = connect_errors or {} - table.insert(connect_errors, e_cluster_api:new('instance \'%s\' error: %s', alias, err)) + table.insert(connect_errors, e_cluster_api:new('instance \'%s\' error: %s', alias, err)) end end end @@ -186,7 +179,7 @@ local function get_existing_spaces() local spaces = {} local schema = ddl.get_schema() for space in pairs(schema.spaces) do - spaces[space] = space + spaces[space]=space end return spaces end