Skip to content

Instantly share code, notes, and snippets.

View ochaton's full-sized avatar

Vladislav Grubov ochaton

  • Tarantool
  • Moscow, Russia
View GitHub Profile
@ochaton
ochaton / gist:8e3739ed220d306da08bff72e7b2e490
Created August 20, 2023 20:06
Tarantool checksums benchmarks
tarantool> require'tarantool'
---
- build: &0
target: Darwin-arm64-Release
options: cmake . -DCMAKE_INSTALL_PREFIX=/opt/homebrew/Cellar/tarantool/2.11.0_1
-DENABLE_BACKTRACE=TRUE
linking: dynamic
mod_format: dylib
flags: ' -fexceptions -funwind-tables -fasynchronous-unwind-tables -fno-common
-fopenmp -Wformat -Wformat-security -Werror=format-security -fstack-protector-strong
@ochaton
ochaton / scanner.lua
Created July 5, 2023 18:46
Index scanner for Tarantool
local msgpack = require 'msgpack'
local base64_encode = require 'digest'.base64_encode
local base64_decode = require 'digest'.base64_decode
---@alias scan.cursor string
---Encodes cursor to string
---@param index boxIndex
---@param tuple box.tuple
---@return string
@ochaton
ochaton / rmean.lua
Created July 1, 2023 17:57
Plain Lua implementation of Tarantool's rmean_collect
---Class rmean is plain-Lua implementation of Tarantool's rmean collector
---
---rmean provides window function mean with specified window size (default=5s)
---rmean well tested on 10K parallel running collectors
---
---rmean:collect(value) is lightning fast ≈ 1B calls per second with jit.on
---and ≈ 15M with jit.off
---
---rmean:mean() makes 10M calls per second with jit.off() and ≈50M calls with jit.on
---
@ochaton
ochaton / space_data_dumper.lua
Created June 26, 2023 16:25
PoC: all spaces dumper to jsonl file
#!/usr/bin/env tarantool
-- Fill address here
local ADDR = "10.0.1.21:7402"
--- Main script goes here
local log = require 'log'
local json = require 'json'
@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'