Skip to content

Instantly share code, notes, and snippets.

@negasus
Created December 14, 2018 06:50
Show Gist options
  • Save negasus/13c358607efc8821649bc5f3f4ec878e to your computer and use it in GitHub Desktop.
Save negasus/13c358607efc8821649bc5f3f4ec878e to your computer and use it in GitHub Desktop.
Script for tarantool 1.10.2-60 and above for get error XlogError: tx checksum mismatch
require('strict').on()
local fio = require('fio')
local instanceName = fio.basename(arg[0], '.lua')
local log = require('log')
local instancesData = {
['test_1'] = {port = 3301, read_only = false},
['test_2'] = {port = 3302, read_only = true},
['test_3'] = {port = 3303, read_only = true},
['test_4'] = {port = 3304, read_only = true},
}
local instanceData = instancesData[instanceName]
if instanceData == nil then
log.Error("instanceData for " .. instanceName .. " not found")
ox.Exit(1)
end
local cfg = {}
cfg.replication = {
'replicator:secret@127.0.0.1:3301',
};
cfg.read_only = instanceData.read_only
cfg.listen = instanceData.port
box.cfg(cfg)
function create_users()
box.schema.user.create('user', { password = 'secret' })
box.schema.user.grant('user', 'read,write,execute', 'universe')
box.schema.user.create('replicator', {password = 'secret'})
box.schema.user.grant('replicator', 'replication')
end
box.once('create_users', create_users)
function init_db()
log.info('init db')
box.schema.create_space('data')
box.space['data']:create_index('primary', {parts = {1, 'unsigned', 2, 'string'}})
end
box.once('init_db', init_db)
function store()
box.space['data']:truncate()
for i = 1, 10000, 1 do
box.space['data']:insert({i, tostring(i)})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment