Skip to content

Commit

Permalink
Use vshard-ee if available
Browse files Browse the repository at this point in the history
  • Loading branch information
yngvar-antonsson committed May 15, 2024
1 parent b869dbb commit f27f303
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Added
- GraphQL API to enable previously disabled instances:
``mutation { cluster { enable_servers(uuids: [...]) { } } }``.

- VShard version is displayed in the WebUI.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Changed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -34,6 +36,8 @@ Changed

- Update ``vshard`` dependency to `0.1.27 <https://github.com/tarantool/vshard/releases/tag/0.1.27>`_.

- Cartridge now uses ``vshard-ee`` instead of ``vshard`` if available.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fixed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
10 changes: 9 additions & 1 deletion cartridge/lua-api/boxinfo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,15 @@ local function get_info(uri)
local membership_myself = require('membership').myself()
local membership_options = require('membership.options')

local vshard, vshard_version
if package.loaded['vshard-ee'] ~= nil then
vshard = package.loaded['vshard-ee']
vshard_version = vshard._VERSION .. ' EE'
else
vshard = package.loaded.vshard
vshard_version = vshard._VERSION
end

local vshard = package.loaded.vshard

local routers = vshard and vshard.router.internal.routers or {}
local router_info = {}
Expand Down Expand Up @@ -193,6 +200,7 @@ local function get_info(uri)
},
cartridge = {
version = require('cartridge').VERSION,
vshard_version = vshard_version,
state = server_state,
error = server_error,
},
Expand Down
7 changes: 6 additions & 1 deletion cartridge/roles/vshard-router.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
local log = require('log')
local vshard = require('vshard')

local ok, vshard = pcall(require, 'vshard-ee')
if not ok then
vshard = require('vshard')
end

local checks = require('checks')
local errors = require('errors')

Expand Down
7 changes: 6 additions & 1 deletion cartridge/roles/vshard-storage.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
local log = require('log')
local vshard = require('vshard')

local ok, vshard = pcall(require, 'vshard-ee')
if not ok then
vshard = require('vshard')
end

local checks = require('checks')

local vars = require('cartridge.vars').new('cartridge.roles.vshard-storage')
Expand Down
6 changes: 5 additions & 1 deletion cartridge/webui/gql-boxinfo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,11 @@ local boxinfo_schema = {
description =
'Error details if instance is in' ..
' failure state',
}
},
vshard_version = {
kind = gql_types.string,
description = 'VShard version',
},
}
}).nonNull,
membership = gql_types.object({
Expand Down
5 changes: 4 additions & 1 deletion doc/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# source: http://127.0.0.1:8081/admin/api
# timestamp: Thu Apr 25 2024 14:01:07 GMT+0300 (Moscow Standard Time)
# timestamp: Tue May 14 2024 20:35:31 GMT+0300 (Moscow Standard Time)

"""Custom scalar specification."""
directive @specifiedBy(
Expand Down Expand Up @@ -728,6 +728,9 @@ type ServerInfoCartridge {
"""Current instance state"""
state: String!

"""VShard version"""
vshard_version: String

"""Cartridge version"""
version: String!

Expand Down
8 changes: 5 additions & 3 deletions webui/src/generated/graphql-typing-flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,8 @@ export type ServerInfoCartridge = {|
state: $ElementType<Scalars, 'String'>,
/** Cartridge version */
version: $ElementType<Scalars, 'String'>,
/** VShard version */
vshard_version?: $ElementType<Scalars, 'String'>,
|};

export type ServerInfoGeneral = {|
Expand Down Expand Up @@ -1061,7 +1063,7 @@ export type ServerDetailsFieldsFragment = ({
...{ __typename?: 'ServerInfo' },
...{| cartridge: ({
...{ __typename?: 'ServerInfoCartridge' },
...$Pick<ServerInfoCartridge, {| version: * |}>
...$Pick<ServerInfoCartridge, {| version: *, vshard_version?: * |}>
}), membership: ({
...{ __typename?: 'ServerInfoMembership' },
...$Pick<ServerInfoMembership, {| status?: *, incarnation?: *, PROTOCOL_PERIOD_SECONDS?: *, ACK_TIMEOUT_SECONDS?: *, ANTI_ENTROPY_PERIOD_SECONDS?: *, SUSPECT_TIMEOUT_SECONDS?: *, NUM_FAILURE_DETECTION_SUBGROUPS?: * |}>
Expand Down Expand Up @@ -1118,7 +1120,7 @@ export type InstanceDataQuery = ({
...{ __typename?: 'ServerInfo' },
...{| cartridge: ({
...{ __typename?: 'ServerInfoCartridge' },
...$Pick<ServerInfoCartridge, {| version: * |}>
...$Pick<ServerInfoCartridge, {| version: *, vshard_version?: * |}>
}), membership: ({
...{ __typename?: 'ServerInfoMembership' },
...$Pick<ServerInfoMembership, {| status?: *, incarnation?: *, PROTOCOL_PERIOD_SECONDS?: *, ACK_TIMEOUT_SECONDS?: *, ANTI_ENTROPY_PERIOD_SECONDS?: *, SUSPECT_TIMEOUT_SECONDS?: *, NUM_FAILURE_DETECTION_SUBGROUPS?: * |}>
Expand Down Expand Up @@ -1224,7 +1226,7 @@ export type BoxInfoQuery = ({
...{ __typename?: 'ServerInfo' },
...{| cartridge: ({
...{ __typename?: 'ServerInfoCartridge' },
...$Pick<ServerInfoCartridge, {| version: * |}>
...$Pick<ServerInfoCartridge, {| version: *, vshard_version?: * |}>
}), membership: ({
...{ __typename?: 'ServerInfoMembership' },
...$Pick<ServerInfoMembership, {| status?: *, incarnation?: *, PROTOCOL_PERIOD_SECONDS?: *, ACK_TIMEOUT_SECONDS?: *, ANTI_ENTROPY_PERIOD_SECONDS?: *, SUSPECT_TIMEOUT_SECONDS?: *, NUM_FAILURE_DETECTION_SUBGROUPS?: * |}>
Expand Down
8 changes: 5 additions & 3 deletions webui/src/generated/graphql-typing-ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,8 @@ export type ServerInfoCartridge = {
state: Scalars['String'];
/** Cartridge version */
version: Scalars['String'];
/** VShard version */
vshard_version?: Maybe<Scalars['String']>;
};

export type ServerInfoGeneral = {
Expand Down Expand Up @@ -1168,7 +1170,7 @@ export type ServerDetailsFieldsFragment = {
labels?: Array<{ __typename?: 'Label'; name: string; value: string } | null> | null;
boxinfo?: {
__typename?: 'ServerInfo';
cartridge: { __typename?: 'ServerInfoCartridge'; version: string };
cartridge: { __typename?: 'ServerInfoCartridge'; version: string; vshard_version: string | null };
membership: {
__typename?: 'ServerInfoMembership';
status?: string | null;
Expand Down Expand Up @@ -1296,7 +1298,7 @@ export type InstanceDataQuery = {
labels?: Array<{ __typename?: 'Label'; name: string; value: string } | null> | null;
boxinfo?: {
__typename?: 'ServerInfo';
cartridge: { __typename?: 'ServerInfoCartridge'; version: string };
cartridge: { __typename?: 'ServerInfoCartridge'; version: string; vshard_version: string | null };
membership: {
__typename?: 'ServerInfoMembership';
status?: string | null;
Expand Down Expand Up @@ -1457,7 +1459,7 @@ export type BoxInfoQuery = {
labels?: Array<{ __typename?: 'Label'; name: string; value: string } | null> | null;
boxinfo?: {
__typename?: 'ServerInfo';
cartridge: { __typename?: 'ServerInfoCartridge'; version: string };
cartridge: { __typename?: 'ServerInfoCartridge'; version: string; vshard_version: string | null };
membership: {
__typename?: 'ServerInfoMembership';
status?: string | null;
Expand Down
1 change: 1 addition & 0 deletions webui/src/store/request/queries.graphql.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export const serverDetailsFields = gql`
boxinfo {
cartridge {
version
vshard_version
}
membership {
status
Expand Down

0 comments on commit f27f303

Please sign in to comment.