Skip to content

Instantly share code, notes, and snippets.

View ochaton's full-sized avatar

Vladislav Grubov ochaton

View GitHub Profile
@ochaton
ochaton / versions.txt
Last active May 1, 2024 16:23
Tarantool Binary and Schema Versions
1.6.9-11-gf4619d0e4 ['version', 1, 6, 8]
1.7.3-32-g0dd09b18b ['version', 1, 7, 2]
1.7.4-0-g927bd9c24 ['version', 1, 7, 2]
1.7.5-0-g24b70de10 ['version', 1, 7, 5]
1.7.6-0-g7b2945d6c ['version', 1, 7, 6]
1.7.6-27-g7ef5be2ee ['version', 1, 7, 6]
1.7.7 => 1.7.7 ???
1.8.1-0-g82bebd667 ['version', 1, 7, 2]
--- THIS IS JUST POC, DO NOT USE IT IN PRODUCTION!
local metrics = require 'metrics'
local INF = math.huge
local DEFAULT_BUCKETS = {.005, .01, .025, .05, .075, .1, .25, .5,
.75, 1.0, 2.5, 5.0, 7.5, 10.0, INF}
local Counter = require 'metrics.collectors.counter'
local Shared = require 'metrics.collectors.shared'
local FastHistogram = Shared:new_class('histogram', {})
@ochaton
ochaton / s3api.sh
Last active July 26, 2023 19:22
s3api.sh
#!/bin/bash
set -euo pipefail;
s3_url="${S3_ENDPOINT_URL:-hb.vkcs.cloud}"
PROFILE="${AWS_PROFILE:-default}"
ACCESS_KEY="${AWS_ACCESS_KEY_ID:-}"
SECRET_KEY="${AWS_SECRET_ACCESS_KEY:-}"
REGION="${AWS_REGION:-us-east-1}"
INI_FILE=~/.aws/credentials
@ochaton
ochaton / upgrade_1_10_14_2_10_5.lua
Created May 17, 2023 22:22
Trigger for upgrade from 1.10.x -> 2.10.x (disables hints)
local tt_version = {}
do
local maj,min,mic,bld = _TARANTOOL:match("(%d+)%.(%d+)%.(%d+)-(%d+)")
if not maj then
maj,min,mic,bld = _TARANTOOL:match("(%d+)%.(%d+)%.(%d+)-([%w%d]+%-%d+)")
end
if not maj then
maj,min,mic,bld = _TARANTOOL:match("(%d+)%.(%d+)%.(%d+)-([%w%d]+)")
end
assert(maj,"Failed to parse version ".._TARANTOOL)
@ochaton
ochaton / test-graphite.lua
Created March 10, 2023 19:22
Tarantool graphite test helper
local socket = require 'socket'
local fiber = require 'fiber'
local url = require 'uri'
local log = require 'log'
local M = {}
M.__index = M
---Creates new graphite object (by default space is temporary)
---@param space_name? string name of metrics space
@ochaton
ochaton / gist.lua
Last active December 27, 2022 17:23
Github gist loader
#!/usr/bin/tarantool
--[[
gists = assert(loadstring(require"json".decode(require"http.client".get("https://api.github.com/gists/22094b6c1b2f39403fe9d0a4df9d84cf",{headers={["User-Agent"]="curl/7.86.0"}}).body).files["gist.lua"].content))()
]]
local M = {}
local fio = require 'fio'
local fun = require 'fun'
local uri = require 'uri'
local json = require 'json'
--[[
This is handy module to set package.path and package.cpath
]]
local fio = require 'fio'
local soext = (jit.os == "OSX" and "dylib" or "so")
local ROCKS_LIB_PATH = '.rocks/lib/tarantool'
local ROCKS_LUA_PATH = '.rocks/share/tarantool'
require 'console'.listen('unix/:./tarantool.sock')
local fiber = require('fiber')
local log = require 'log'
local fun = require 'fun'
local fio = require 'fio'
local clock = require 'clock'
fun.grep('%.xlog', fio.listdir('.')):each(fio.unlink)
box.cfg{listen=3301, too_long_threshold=0.1,log_level=4}
#!/usr/bin/env tarantool
local fio = require 'fio'
local soext = (jit.os == "OSX" and "dylib" or "so")
local ROCKS_LIB_PATH = '.rocks/lib/tarantool'
local ROCKS_LUA_PATH = '.rocks/share/tarantool'
local LIB_TEMPLATES = { '?.'..soext, ROCKS_LIB_PATH .. '/?.'..soext }
local LUA_TEMPLATES = { '?.lua', '?/init.lua', ROCKS_LUA_PATH .. '/?.lua', ROCKS_LUA_PATH .. '/?/init.lua' }
@ochaton
ochaton / box.lua
Created September 28, 2022 11:00
EmmyLua for box.info
---@class BoxCfg
---@field listen string|number URI to bind tarantool
---@field read_only boolean (default: false) should this instance be RO
---@field replication_connect_quorum number (default: _cluster:len()) required number of connected replicas to start bootstrap
---@field replication_connect_timeout number (default: 30) timeout in seconds to expect replicas in replication to fail bootstrap
---@field replication string[] list of URI of replicas to connect to
---@field election_mode string (default: off) enables RAFT. Possible values: candidate, voter, off
---@field replication_synchro_quorum string|number (default: 1) number or formula of synchro quorum. possible: "N/2+1"
---@field wal_dir string path to dir with xlogs
---@field work_dir string path to work dir of tarantool