Skip to content
Snippets Groups Projects
Commit f48faf05 authored by Eugine Blikh's avatar Eugine Blikh
Browse files

Add syncyng of all in tests

parent 883043c6
No related merge requests found
--# create server replica with configuration='replication/cfg/replica.cfg'
--# start server replica
--# set connection default
--# setopt delimiter ';'
--# set connection default, replica
do
begin_lsn = -1
function _set_pri_lsn(_lsn)
a = {}
begin_lsn = box.unpack('l', _lsn)
end
function _print_lsn()
return (box.info.lsn - begin_lsn + 1)
end
function _insert(_begin, _end, msg)
a = {}
for i = _begin, _end do
table.insert(a, box.insert(0, i, msg..' - '..i))
end
return unpack(a)
end
function _select(_begin, _end)
a = {}
while box.info.lsn < begin_lsn + _end + 2 do
box.fiber.sleep(0.001)
end
for i = _begin, _end do
table.insert(a, box.select(0, 0, i))
end
return unpack(a)
end
end;
---
...
--# setopt delimiter ''
--# set connection default
box.replace(box.schema.SPACE_ID, 0, 0, 'tweedledum');
-- set begin lsn on master and replica.
begin_lsn = box.info.lsn
---
- [0, 0, 'tweedledum']
...
box.replace(box.schema.INDEX_ID, 0, 0, 'primary', 'hash', 1, 1, 0, 'num');
a = box.net.box.new('127.0.0.1', 33113)
---
- [0, 0, 'primary', 1752392040, 1, 1, 0, 'num']
...
--# set connection default, replica
function _insert(_begin, _end, msg)
a = {}
for i = _begin, _end do
table.insert(a, box.insert(0, i, msg..' - '..i))
end
return unpack(a)
end;
a:call('_set_pri_lsn', box.info.lsn)
---
...
begin_lsn = box.info.lsn;
a:close()
---
- true
...
function _select(_begin, _end)
a = {}
while box.info.lsn < begin_lsn + _end do
box.fiber.sleep(0.001)
end
for i = _begin, _end do
table.insert(a, box.select(0, 0, i))
end
return unpack(a)
end;
box.replace(box.schema.SPACE_ID, 0, 0, 'tweedledum');
---
- [0, 0, 'tweedledum']
...
box.replace(box.schema.INDEX_ID, 0, 0, 'primary', 'hash', 1, 1, 0, 'num');
---
- [0, 0, 'primary', 1752392040, 1, 1, 0, 'num']
...
--# setopt delimiter ''
--# set connection default
_insert(1, 10, 'master')
---
- [1, 'master - 1']
......@@ -79,13 +98,13 @@ _select(1, 10)
...
--# set connection default
-- Master LSN:
box.info.lsn
_print_lsn()
---
- 13
...
--# set connection replica
-- Replica LSN:
box.info.lsn
_print_lsn()
---
- 13
...
......@@ -142,13 +161,13 @@ _select (11, 15)
...
--# set connection default
-- Master LSN:
box.info.lsn
_print_lsn()
---
- 23
...
--# set connection replica
-- Replica LSN:
box.info.lsn
_print_lsn()
---
- 18
...
......@@ -171,13 +190,13 @@ _select(11, 20)
...
--# set connection default
-- Master LSN:
box.info.lsn
_print_lsn()
---
- 23
...
--# set connection replica
-- Replica LSN:
box.info.lsn
_print_lsn()
---
- 23
...
......@@ -244,13 +263,13 @@ _select(21, 30)
...
--# set connection default
-- Master LSN:
box.info.lsn
_print_lsn()
---
- 33
...
--# set connection replica
-- Replica LSN:
box.info.lsn
_print_lsn()
---
- 33
...
......@@ -273,13 +292,13 @@ _select(21, 30)
...
--# set connection default
-- Master LSN:
box.info.lsn
_print_lsn()
---
- 33
...
--# set connection replica
-- Replica LSN:
box.info.lsn
_print_lsn()
---
- 33
...
......@@ -366,13 +385,13 @@ _select(31, 50)
...
--# set connection default
-- Master LSN:
box.info.lsn
_print_lsn()
---
- 43
...
--# set connection replica
-- Replica LSN:
box.info.lsn
_print_lsn()
---
- 53
...
......@@ -453,13 +472,13 @@ _select(41, 60)
...
--# set connection default
-- Master LSN:
box.info.lsn
_print_lsn()
---
- 63
...
--# set connection replica
-- Replica LSN:
box.info.lsn
_print_lsn()
---
- 63
...
......
--# create server replica with configuration='replication/cfg/replica.cfg'
--# start server replica
--# setopt delimiter ';'
--# set connection default
box.replace(box.schema.SPACE_ID, 0, 0, 'tweedledum');
box.replace(box.schema.INDEX_ID, 0, 0, 'primary', 'hash', 1, 1, 0, 'num');
--# setopt delimiter ';'
--# set connection default, replica
function _insert(_begin, _end, msg)
a = {}
for i = _begin, _end do
table.insert(a, box.insert(0, i, msg..' - '..i))
do
begin_lsn = -1
function _set_pri_lsn(_lsn)
a = {}
begin_lsn = box.unpack('l', _lsn)
end
return unpack(a)
end;
begin_lsn = box.info.lsn;
function _select(_begin, _end)
a = {}
while box.info.lsn < begin_lsn + _end do
box.fiber.sleep(0.001)
function _print_lsn()
return (box.info.lsn - begin_lsn + 1)
end
function _insert(_begin, _end, msg)
a = {}
for i = _begin, _end do
table.insert(a, box.insert(0, i, msg..' - '..i))
end
return unpack(a)
end
for i = _begin, _end do
table.insert(a, box.select(0, 0, i))
function _select(_begin, _end)
a = {}
while box.info.lsn < begin_lsn + _end + 2 do
box.fiber.sleep(0.001)
end
for i = _begin, _end do
table.insert(a, box.select(0, 0, i))
end
return unpack(a)
end
return unpack(a)
end;
--# setopt delimiter ''
--# set connection default
-- set begin lsn on master and replica.
begin_lsn = box.info.lsn
a = box.net.box.new('127.0.0.1', 33113)
a:call('_set_pri_lsn', box.info.lsn)
a:close()
box.replace(box.schema.SPACE_ID, 0, 0, 'tweedledum');
box.replace(box.schema.INDEX_ID, 0, 0, 'primary', 'hash', 1, 1, 0, 'num');
_insert(1, 10, 'master')
_select(1, 10)
--# set connection replica
......@@ -37,10 +49,11 @@ _select(1, 10)
--# set connection default
-- Master LSN:
box.info.lsn
_print_lsn()
--# set connection replica
-- Replica LSN:
box.info.lsn
_print_lsn()
-----------------------------
-- Master LSN > Replica LSN
......@@ -58,10 +71,10 @@ _select (11, 15)
--# set connection default
-- Master LSN:
box.info.lsn
_print_lsn()
--# set connection replica
-- Replica LSN:
box.info.lsn
_print_lsn()
-------------------
-- rollback Replica
......@@ -70,10 +83,10 @@ box.info.lsn
_select(11, 20)
--# set connection default
-- Master LSN:
box.info.lsn
_print_lsn()
--# set connection replica
-- Replica LSN:
box.info.lsn
_print_lsn()
------------------------------
-- Master LSN == Replica LSN
......@@ -91,10 +104,10 @@ _select(21, 30)
--# set connection default
-- Master LSN:
box.info.lsn
_print_lsn()
--# set connection replica
-- Replica LSN:
box.info.lsn
_print_lsn()
-------------------
-- rollback Replica
......@@ -104,10 +117,10 @@ _select(21, 30)
--# set connection default
-- Master LSN:
box.info.lsn
_print_lsn()
--# set connection replica
-- Replica LSN:
box.info.lsn
_print_lsn()
-----------------------------
-- Master LSN < Replica LSN
......@@ -125,10 +138,10 @@ _select(31, 50)
--# set connection default
-- Master LSN:
box.info.lsn
_print_lsn()
--# set connection replica
-- Replica LSN:
box.info.lsn
_print_lsn()
-------------------
-- rollback Replica
......@@ -142,10 +155,10 @@ _select(41, 60)
--# set connection default
-- Master LSN:
box.info.lsn
_print_lsn()
--# set connection replica
-- Replica LSN:
box.info.lsn
_print_lsn()
-- Test that a replica replies with master connection URL on update request
box.insert(0, 0, 'replica is RO')
......
......@@ -4,37 +4,69 @@
--# start server replica
--# setopt delimiter ';'
--# set connection default, hot_standby, replica
function _insert(_begin, _end)
a = {}
for i = _begin, _end do
table.insert(a, box.insert(0, i, 'the tuple '..i))
do
begin_lsn = box.info.lsn
function _set_pri_lsn(_lsn)
a = {}
begin_lsn = box.unpack('l', _lsn)
end
function _print_lsn()
return (box.info.lsn - begin_lsn + 1)
end
function _insert(_begin, _end)
a = {}
for i = _begin, _end do
table.insert(a, box.insert(0, i, 'the tuple '..i))
end
return unpack(a)
end
function _select(_begin, _end)
a = {}
for i = _begin, _end do
table.insert(a, box.select(0, 0, i))
end
return unpack(a)
end
function _wait_lsn(_lsnd)
while box.info.lsn < _lsnd + begin_lsn do
box.fiber.sleep(0.001)
end
begin_lsn = begin_lsn + _lsnd
end
return unpack(a)
end;
---
...
function _select(_begin, _end)
a = {}
for i = _begin, _end do
table.insert(a, box.select(0, 0, i))
end
return unpack(a)
end;
--# setopt delimiter ''
--# set connection default
-- set begin lsn on master, replica and hot_standby.
begin_lsn = box.info.lsn
---
...
begin_lsn = box.info.lsn;
a = box.net.box.new('127.0.0.1', 33114)
---
...
function _wait_lsn(_lsnd)
while box.info.lsn < _lsnd + begin_lsn do
box.fiber.sleep(0.001)
end
begin_lsn = begin_lsn + _lsnd
end;
a:call('_set_pri_lsn', box.info.lsn)
---
...
--# setopt delimiter ''
--# set connection default
a:close()
---
- true
...
a = box.net.box.new('127.0.0.1', 33024)
---
...
a:call('_set_pri_lsn', box.info.lsn)
---
...
a:close()
---
- true
...
box.replace(box.schema.SPACE_ID, 0, 0, 'tweedledum')
---
- [0, 0, 'tweedledum']
......
......@@ -5,29 +5,56 @@
--# setopt delimiter ';'
--# set connection default, hot_standby, replica
function _insert(_begin, _end)
a = {}
for i = _begin, _end do
table.insert(a, box.insert(0, i, 'the tuple '..i))
do
begin_lsn = box.info.lsn
function _set_pri_lsn(_lsn)
a = {}
begin_lsn = box.unpack('l', _lsn)
end
return unpack(a)
end;
function _select(_begin, _end)
a = {}
for i = _begin, _end do
table.insert(a, box.select(0, 0, i))
function _print_lsn()
return (box.info.lsn - begin_lsn + 1)
end
return unpack(a)
end;
begin_lsn = box.info.lsn;
function _wait_lsn(_lsnd)
while box.info.lsn < _lsnd + begin_lsn do
box.fiber.sleep(0.001)
function _insert(_begin, _end)
a = {}
for i = _begin, _end do
table.insert(a, box.insert(0, i, 'the tuple '..i))
end
return unpack(a)
end
function _select(_begin, _end)
a = {}
for i = _begin, _end do
table.insert(a, box.select(0, 0, i))
end
return unpack(a)
end
function _wait_lsn(_lsnd)
while box.info.lsn < _lsnd + begin_lsn do
box.fiber.sleep(0.001)
end
begin_lsn = begin_lsn + _lsnd
end
begin_lsn = begin_lsn + _lsnd
end;
--# setopt delimiter ''
--# set connection default
-- set begin lsn on master, replica and hot_standby.
begin_lsn = box.info.lsn
a = box.net.box.new('127.0.0.1', 33114)
a:call('_set_pri_lsn', box.info.lsn)
a:close()
a = box.net.box.new('127.0.0.1', 33024)
a:call('_set_pri_lsn', box.info.lsn)
a:close()
box.replace(box.schema.SPACE_ID, 0, 0, 'tweedledum')
box.replace(box.schema.INDEX_ID, 0, 0, 'primary', 'hash', 1, 1, 0, 'num')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment