Skip to content
Snippets Groups Projects
Commit 09d4e13d authored by Konstantin Shulgin's avatar Konstantin Shulgin
Browse files

Implement blueprint: 'feature-feeder-in-core'.

Missed inotify even in the replicaor handler process was foxed.
replicaor_init was splited on two function:
  - replicaor_prefork -- create replicaor spawner process;
  - replicaor_init -- initialize replicaor fibers in the main tarantool
	                  process.

Test and test configuration files in box_replication soute was
clenupped and updated.
parent a5318c65
No related branches found
No related tags found
No related merge requests found
...@@ -52,17 +52,12 @@ struct replicator_process { ...@@ -52,17 +52,12 @@ struct replicator_process {
u32 child_count; u32 child_count;
}; };
static int replicator_socks[2];
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
/* replication accept/sender fibers */ /* replication accept/sender fibers */
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
/**
* Initialize replication fibers.
*/
static void
fibers_init(int sock);
/** /**
* Replication acceptor fiber handler. * Replication acceptor fiber handler.
*/ */
...@@ -201,13 +196,10 @@ void ...@@ -201,13 +196,10 @@ void
replicator_reload_config(struct tarantool_cfg *config __attribute__((unused))) replicator_reload_config(struct tarantool_cfg *config __attribute__((unused)))
{} {}
/** Intialize tarantool's replicator module. */ /** Pre-fork replicator spawner process. */
void void
replicator_init(void) replicator_prefork()
{ {
int socks[2];
pid_t pid = -1;
if (cfg.replication_port == 0) { if (cfg.replication_port == 0) {
/* replicator not needed, leave init function */ /* replicator not needed, leave init function */
return; return;
...@@ -218,35 +210,29 @@ replicator_init(void) ...@@ -218,35 +210,29 @@ replicator_init(void)
} }
/* create communication sockes between tarantool and replicator processes via UNIX sockets*/ /* create communication sockes between tarantool and replicator processes via UNIX sockets*/
if (socketpair(PF_LOCAL, SOCK_STREAM, 0, socks) != 0) { if (socketpair(PF_LOCAL, SOCK_STREAM, 0, replicator_socks) != 0) {
panic_syserror("socketpair"); panic_syserror("socketpair");
} }
/* create replicator process */ /* create replicator process */
pid = fork(); pid_t pid = fork();
if (pid == -1) { if (pid == -1) {
panic("fork"); panic_syserror("fork");
} }
if (pid != 0) { if (pid != 0) {
/* parent process: tarantool */ /* parent process: tarantool */
close(socks[1]); close(replicator_socks[1]);
fibers_init(socks[0]);
} else { } else {
/* child process: replicator */ /* child process: replicator */
close(socks[0]); close(replicator_socks[0]);
spawner_init(socks[1]); spawner_init(replicator_socks[1]);
} }
} }
/** Intialize tarantool's replicator module. */
/*-----------------------------------------------------------------------------*/ void
/* replication accept/sender fibers */ replicator_init()
/*-----------------------------------------------------------------------------*/
/** Initialize replication fibers. */
static void
fibers_init(int sock)
{ {
char fiber_name[FIBER_NAME_MAXLEN]; char fiber_name[FIBER_NAME_MAXLEN];
const size_t sender_inbox_size = 16 * sizeof(int); const size_t sender_inbox_size = 16 * sizeof(int);
...@@ -258,7 +244,7 @@ fibers_init(int sock) ...@@ -258,7 +244,7 @@ fibers_init(int sock)
panic("snprintf fail"); panic("snprintf fail");
} }
sender = fiber_create(fiber_name, sock, sender_inbox_size, sender_handler, NULL); sender = fiber_create(fiber_name, replicator_socks[0], sender_inbox_size, sender_handler, NULL);
if (sender == NULL) { if (sender == NULL) {
panic("create fiber fail"); panic("create fiber fail");
} }
...@@ -277,6 +263,11 @@ fibers_init(int sock) ...@@ -277,6 +263,11 @@ fibers_init(int sock)
fiber_call(sender); fiber_call(sender);
} }
/*-----------------------------------------------------------------------------*/
/* replication accept/sender fibers */
/*-----------------------------------------------------------------------------*/
/** Replication acceptor fiber handler. */ /** Replication acceptor fiber handler. */
static void static void
acceptor_handler(void *data) acceptor_handler(void *data)
......
...@@ -539,6 +539,9 @@ main(int argc, char **argv) ...@@ -539,6 +539,9 @@ main(int argc, char **argv)
say_logger_init(cfg.logger_nonblock); say_logger_init(cfg.logger_nonblock);
booting = false; booting = false;
initialize(cfg.slab_alloc_arena, cfg.slab_alloc_minimal, cfg.slab_alloc_factor);
replicator_prefork();
ev_default_loop(EVFLAG_AUTO); ev_default_loop(EVFLAG_AUTO);
ev_signal *ev_sig; ev_signal *ev_sig;
...@@ -546,7 +549,6 @@ main(int argc, char **argv) ...@@ -546,7 +549,6 @@ main(int argc, char **argv)
ev_signal_init(ev_sig, (void *)snapshot, SIGUSR1); ev_signal_init(ev_sig, (void *)snapshot, SIGUSR1);
ev_signal_start(ev_sig); ev_signal_start(ev_sig);
initialize(cfg.slab_alloc_arena, cfg.slab_alloc_minimal, cfg.slab_alloc_factor);
signal_init(); signal_init();
replicator_init(); replicator_init();
......
...@@ -46,13 +46,19 @@ replicator_check_config(struct tarantool_cfg *config); ...@@ -46,13 +46,19 @@ replicator_check_config(struct tarantool_cfg *config);
void void
replicator_reload_config(struct tarantool_cfg *config); replicator_reload_config(struct tarantool_cfg *config);
/**
* Pre-fork replicator spawner process.
*/
void
replicator_prefork();
/** /**
* Intialize tarantool's replicator module. * Intialize tarantool's replicator module.
* *
* @return On success, a zero is returned. On error, -1 is returned. * @return On success, a zero is returned. On error, -1 is returned.
*/ */
void void
replicator_init(void); replicator_init();
#endif // !defined(REPLICATOR_H_INCLUDED) #endif // !defined(REPLICATOR_H_INCLUDED)
pid_file = "tarantool.pid" pid_file = "tarantool.pid"
logger="tee -a tarantool.log" logger="cat - >> tarantool.log"
logger_nonblock=0
log_level = 5
bind_ipaddr="INADDR_ANY" bind_ipaddr="INADDR_ANY"
......
pid_file = "tarantool.pid" pid_file = "tarantool.pid"
logger="tee -a tarantool.log" logger="cat - >> tarantool.log"
logger_nonblock=0
log_level = 5 log_level = 5
bind_ipaddr="INADDR_ANY" bind_ipaddr="INADDR_ANY"
...@@ -16,3 +17,4 @@ namespace[0].index[0].type = "HASH" ...@@ -16,3 +17,4 @@ namespace[0].index[0].type = "HASH"
namespace[0].index[0].unique = 1 namespace[0].index[0].unique = 1
namespace[0].index[0].key_field[0].fieldno = 0 namespace[0].index[0].key_field[0].fieldno = 0
namespace[0].index[0].key_field[0].type = "NUM" namespace[0].index[0].key_field[0].type = "NUM"
pid_file = "tarantool.pid" pid_file = "tarantool.pid"
logger="tee -a tarantool.log" logger="cat - >> tarantool.log"
logger_nonblock=0
log_level = 5 log_level = 5
bind_ipaddr="INADDR_ANY" bind_ipaddr="INADDR_ANY"
......
pid_file = "tarantool.pid" pid_file = "tarantool.pid"
logger="tee -a tarantool.log" logger="cat - >> tarantool.log"
logger_nonblock=0
log_level = 5 log_level = 5
bind_ipaddr="INADDR_ANY" bind_ipaddr="INADDR_ANY"
......
pid_file = "tarantool.pid" pid_file = "tarantool.pid"
logger="tee -a tarantool.log" logger="cat - >> tarantool.log"
logger_nonblock=0
log_level = 5 log_level = 5
bind_ipaddr="INADDR_ANY" bind_ipaddr="INADDR_ANY"
......
...@@ -38,7 +38,7 @@ for i in range(id, id + 10): ...@@ -38,7 +38,7 @@ for i in range(id, id + 10):
print """ print """
# Select 10 tuples from replica # Select 10 tuples from replica
""" """
replica.wait_lsn(10) replica.wait_lsn(11)
for i in range(id, id + 10): for i in range(id, id + 10):
replica.sql.execute("select * from t0 where k0 = %d" % i, silent=False) replica.sql.execute("select * from t0 where k0 = %d" % i, silent=False)
...@@ -70,7 +70,7 @@ for i in range(id, id + 10): ...@@ -70,7 +70,7 @@ for i in range(id, id + 10):
print """ print """
# Select 10 tuples from replica # Select 10 tuples from replica
""" """
replica.wait_lsn(20) replica.wait_lsn(21)
for i in range(id, id + 10): for i in range(id, id + 10):
replica.sql.execute("select * from t0 where k0 = %d" % i, silent=False) replica.sql.execute("select * from t0 where k0 = %d" % i, silent=False)
......
...@@ -9,16 +9,6 @@ insert into t0 values (3, 'tuple 3') ...@@ -9,16 +9,6 @@ insert into t0 values (3, 'tuple 3')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (4, 'tuple 4') insert into t0 values (4, 'tuple 4')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (5, 'tuple 5')
Insert OK, 1 row affected
insert into t0 values (6, 'tuple 6')
Insert OK, 1 row affected
insert into t0 values (7, 'tuple 7')
Insert OK, 1 row affected
insert into t0 values (8, 'tuple 8')
Insert OK, 1 row affected
insert into t0 values (9, 'tuple 9')
Insert OK, 1 row affected
select * from t0 where k0 = 0 select * from t0 where k0 = 0
Found 1 tuple: Found 1 tuple:
[0, 'tuple 0'] [0, 'tuple 0']
...@@ -34,6 +24,16 @@ Found 1 tuple: ...@@ -34,6 +24,16 @@ Found 1 tuple:
select * from t0 where k0 = 4 select * from t0 where k0 = 4
Found 1 tuple: Found 1 tuple:
[4, 'tuple 4'] [4, 'tuple 4']
insert into t0 values (5, 'tuple 5')
Insert OK, 1 row affected
insert into t0 values (6, 'tuple 6')
Insert OK, 1 row affected
insert into t0 values (7, 'tuple 7')
Insert OK, 1 row affected
insert into t0 values (8, 'tuple 8')
Insert OK, 1 row affected
insert into t0 values (9, 'tuple 9')
Insert OK, 1 row affected
select * from t0 where k0 = 5 select * from t0 where k0 = 5
Found 1 tuple: Found 1 tuple:
[5, 'tuple 5'] [5, 'tuple 5']
...@@ -68,16 +68,6 @@ insert into t0 values (13, 'tuple 13') ...@@ -68,16 +68,6 @@ insert into t0 values (13, 'tuple 13')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (14, 'tuple 14') insert into t0 values (14, 'tuple 14')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (15, 'tuple 15')
Insert OK, 1 row affected
insert into t0 values (16, 'tuple 16')
Insert OK, 1 row affected
insert into t0 values (17, 'tuple 17')
Insert OK, 1 row affected
insert into t0 values (18, 'tuple 18')
Insert OK, 1 row affected
insert into t0 values (19, 'tuple 19')
Insert OK, 1 row affected
select * from t0 where k0 = 10 select * from t0 where k0 = 10
Found 1 tuple: Found 1 tuple:
[10, 'tuple 10'] [10, 'tuple 10']
...@@ -93,6 +83,16 @@ Found 1 tuple: ...@@ -93,6 +83,16 @@ Found 1 tuple:
select * from t0 where k0 = 14 select * from t0 where k0 = 14
Found 1 tuple: Found 1 tuple:
[14, 'tuple 14'] [14, 'tuple 14']
insert into t0 values (15, 'tuple 15')
Insert OK, 1 row affected
insert into t0 values (16, 'tuple 16')
Insert OK, 1 row affected
insert into t0 values (17, 'tuple 17')
Insert OK, 1 row affected
insert into t0 values (18, 'tuple 18')
Insert OK, 1 row affected
insert into t0 values (19, 'tuple 19')
Insert OK, 1 row affected
select * from t0 where k0 = 15 select * from t0 where k0 = 15
Found 1 tuple: Found 1 tuple:
[15, 'tuple 15'] [15, 'tuple 15']
...@@ -128,16 +128,6 @@ insert into t0 values (23, 'tuple 23') ...@@ -128,16 +128,6 @@ insert into t0 values (23, 'tuple 23')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (24, 'tuple 24') insert into t0 values (24, 'tuple 24')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (25, 'tuple 25')
Insert OK, 1 row affected
insert into t0 values (26, 'tuple 26')
Insert OK, 1 row affected
insert into t0 values (27, 'tuple 27')
Insert OK, 1 row affected
insert into t0 values (28, 'tuple 28')
Insert OK, 1 row affected
insert into t0 values (29, 'tuple 29')
Insert OK, 1 row affected
select * from t0 where k0 = 20 select * from t0 where k0 = 20
Found 1 tuple: Found 1 tuple:
[20, 'tuple 20'] [20, 'tuple 20']
...@@ -153,6 +143,16 @@ Found 1 tuple: ...@@ -153,6 +143,16 @@ Found 1 tuple:
select * from t0 where k0 = 24 select * from t0 where k0 = 24
Found 1 tuple: Found 1 tuple:
[24, 'tuple 24'] [24, 'tuple 24']
insert into t0 values (25, 'tuple 25')
Insert OK, 1 row affected
insert into t0 values (26, 'tuple 26')
Insert OK, 1 row affected
insert into t0 values (27, 'tuple 27')
Insert OK, 1 row affected
insert into t0 values (28, 'tuple 28')
Insert OK, 1 row affected
insert into t0 values (29, 'tuple 29')
Insert OK, 1 row affected
select * from t0 where k0 = 25 select * from t0 where k0 = 25
Found 1 tuple: Found 1 tuple:
[25, 'tuple 25'] [25, 'tuple 25']
...@@ -187,16 +187,6 @@ insert into t0 values (33, 'tuple 33') ...@@ -187,16 +187,6 @@ insert into t0 values (33, 'tuple 33')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (34, 'tuple 34') insert into t0 values (34, 'tuple 34')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (35, 'tuple 35')
Insert OK, 1 row affected
insert into t0 values (36, 'tuple 36')
Insert OK, 1 row affected
insert into t0 values (37, 'tuple 37')
Insert OK, 1 row affected
insert into t0 values (38, 'tuple 38')
Insert OK, 1 row affected
insert into t0 values (39, 'tuple 39')
Insert OK, 1 row affected
select * from t0 where k0 = 30 select * from t0 where k0 = 30
Found 1 tuple: Found 1 tuple:
[30, 'tuple 30'] [30, 'tuple 30']
...@@ -212,6 +202,16 @@ Found 1 tuple: ...@@ -212,6 +202,16 @@ Found 1 tuple:
select * from t0 where k0 = 34 select * from t0 where k0 = 34
Found 1 tuple: Found 1 tuple:
[34, 'tuple 34'] [34, 'tuple 34']
insert into t0 values (35, 'tuple 35')
Insert OK, 1 row affected
insert into t0 values (36, 'tuple 36')
Insert OK, 1 row affected
insert into t0 values (37, 'tuple 37')
Insert OK, 1 row affected
insert into t0 values (38, 'tuple 38')
Insert OK, 1 row affected
insert into t0 values (39, 'tuple 39')
Insert OK, 1 row affected
select * from t0 where k0 = 35 select * from t0 where k0 = 35
Found 1 tuple: Found 1 tuple:
[35, 'tuple 35'] [35, 'tuple 35']
...@@ -247,16 +247,6 @@ insert into t0 values (43, 'tuple 43') ...@@ -247,16 +247,6 @@ insert into t0 values (43, 'tuple 43')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (44, 'tuple 44') insert into t0 values (44, 'tuple 44')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (45, 'tuple 45')
Insert OK, 1 row affected
insert into t0 values (46, 'tuple 46')
Insert OK, 1 row affected
insert into t0 values (47, 'tuple 47')
Insert OK, 1 row affected
insert into t0 values (48, 'tuple 48')
Insert OK, 1 row affected
insert into t0 values (49, 'tuple 49')
Insert OK, 1 row affected
select * from t0 where k0 = 40 select * from t0 where k0 = 40
Found 1 tuple: Found 1 tuple:
[40, 'tuple 40'] [40, 'tuple 40']
...@@ -272,6 +262,16 @@ Found 1 tuple: ...@@ -272,6 +262,16 @@ Found 1 tuple:
select * from t0 where k0 = 44 select * from t0 where k0 = 44
Found 1 tuple: Found 1 tuple:
[44, 'tuple 44'] [44, 'tuple 44']
insert into t0 values (45, 'tuple 45')
Insert OK, 1 row affected
insert into t0 values (46, 'tuple 46')
Insert OK, 1 row affected
insert into t0 values (47, 'tuple 47')
Insert OK, 1 row affected
insert into t0 values (48, 'tuple 48')
Insert OK, 1 row affected
insert into t0 values (49, 'tuple 49')
Insert OK, 1 row affected
select * from t0 where k0 = 45 select * from t0 where k0 = 45
Found 1 tuple: Found 1 tuple:
[45, 'tuple 45'] [45, 'tuple 45']
...@@ -306,16 +306,6 @@ insert into t0 values (53, 'tuple 53') ...@@ -306,16 +306,6 @@ insert into t0 values (53, 'tuple 53')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (54, 'tuple 54') insert into t0 values (54, 'tuple 54')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (55, 'tuple 55')
Insert OK, 1 row affected
insert into t0 values (56, 'tuple 56')
Insert OK, 1 row affected
insert into t0 values (57, 'tuple 57')
Insert OK, 1 row affected
insert into t0 values (58, 'tuple 58')
Insert OK, 1 row affected
insert into t0 values (59, 'tuple 59')
Insert OK, 1 row affected
select * from t0 where k0 = 50 select * from t0 where k0 = 50
Found 1 tuple: Found 1 tuple:
[50, 'tuple 50'] [50, 'tuple 50']
...@@ -331,6 +321,16 @@ Found 1 tuple: ...@@ -331,6 +321,16 @@ Found 1 tuple:
select * from t0 where k0 = 54 select * from t0 where k0 = 54
Found 1 tuple: Found 1 tuple:
[54, 'tuple 54'] [54, 'tuple 54']
insert into t0 values (55, 'tuple 55')
Insert OK, 1 row affected
insert into t0 values (56, 'tuple 56')
Insert OK, 1 row affected
insert into t0 values (57, 'tuple 57')
Insert OK, 1 row affected
insert into t0 values (58, 'tuple 58')
Insert OK, 1 row affected
insert into t0 values (59, 'tuple 59')
Insert OK, 1 row affected
select * from t0 where k0 = 55 select * from t0 where k0 = 55
Found 1 tuple: Found 1 tuple:
[55, 'tuple 55'] [55, 'tuple 55']
...@@ -366,16 +366,6 @@ insert into t0 values (63, 'tuple 63') ...@@ -366,16 +366,6 @@ insert into t0 values (63, 'tuple 63')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (64, 'tuple 64') insert into t0 values (64, 'tuple 64')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (65, 'tuple 65')
Insert OK, 1 row affected
insert into t0 values (66, 'tuple 66')
Insert OK, 1 row affected
insert into t0 values (67, 'tuple 67')
Insert OK, 1 row affected
insert into t0 values (68, 'tuple 68')
Insert OK, 1 row affected
insert into t0 values (69, 'tuple 69')
Insert OK, 1 row affected
select * from t0 where k0 = 60 select * from t0 where k0 = 60
Found 1 tuple: Found 1 tuple:
[60, 'tuple 60'] [60, 'tuple 60']
...@@ -391,6 +381,16 @@ Found 1 tuple: ...@@ -391,6 +381,16 @@ Found 1 tuple:
select * from t0 where k0 = 64 select * from t0 where k0 = 64
Found 1 tuple: Found 1 tuple:
[64, 'tuple 64'] [64, 'tuple 64']
insert into t0 values (65, 'tuple 65')
Insert OK, 1 row affected
insert into t0 values (66, 'tuple 66')
Insert OK, 1 row affected
insert into t0 values (67, 'tuple 67')
Insert OK, 1 row affected
insert into t0 values (68, 'tuple 68')
Insert OK, 1 row affected
insert into t0 values (69, 'tuple 69')
Insert OK, 1 row affected
select * from t0 where k0 = 65 select * from t0 where k0 = 65
Found 1 tuple: Found 1 tuple:
[65, 'tuple 65'] [65, 'tuple 65']
...@@ -425,16 +425,6 @@ insert into t0 values (73, 'tuple 73') ...@@ -425,16 +425,6 @@ insert into t0 values (73, 'tuple 73')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (74, 'tuple 74') insert into t0 values (74, 'tuple 74')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (75, 'tuple 75')
Insert OK, 1 row affected
insert into t0 values (76, 'tuple 76')
Insert OK, 1 row affected
insert into t0 values (77, 'tuple 77')
Insert OK, 1 row affected
insert into t0 values (78, 'tuple 78')
Insert OK, 1 row affected
insert into t0 values (79, 'tuple 79')
Insert OK, 1 row affected
select * from t0 where k0 = 70 select * from t0 where k0 = 70
Found 1 tuple: Found 1 tuple:
[70, 'tuple 70'] [70, 'tuple 70']
...@@ -450,6 +440,16 @@ Found 1 tuple: ...@@ -450,6 +440,16 @@ Found 1 tuple:
select * from t0 where k0 = 74 select * from t0 where k0 = 74
Found 1 tuple: Found 1 tuple:
[74, 'tuple 74'] [74, 'tuple 74']
insert into t0 values (75, 'tuple 75')
Insert OK, 1 row affected
insert into t0 values (76, 'tuple 76')
Insert OK, 1 row affected
insert into t0 values (77, 'tuple 77')
Insert OK, 1 row affected
insert into t0 values (78, 'tuple 78')
Insert OK, 1 row affected
insert into t0 values (79, 'tuple 79')
Insert OK, 1 row affected
select * from t0 where k0 = 75 select * from t0 where k0 = 75
Found 1 tuple: Found 1 tuple:
[75, 'tuple 75'] [75, 'tuple 75']
...@@ -485,16 +485,6 @@ insert into t0 values (83, 'tuple 83') ...@@ -485,16 +485,6 @@ insert into t0 values (83, 'tuple 83')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (84, 'tuple 84') insert into t0 values (84, 'tuple 84')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (85, 'tuple 85')
Insert OK, 1 row affected
insert into t0 values (86, 'tuple 86')
Insert OK, 1 row affected
insert into t0 values (87, 'tuple 87')
Insert OK, 1 row affected
insert into t0 values (88, 'tuple 88')
Insert OK, 1 row affected
insert into t0 values (89, 'tuple 89')
Insert OK, 1 row affected
select * from t0 where k0 = 80 select * from t0 where k0 = 80
Found 1 tuple: Found 1 tuple:
[80, 'tuple 80'] [80, 'tuple 80']
...@@ -510,6 +500,16 @@ Found 1 tuple: ...@@ -510,6 +500,16 @@ Found 1 tuple:
select * from t0 where k0 = 84 select * from t0 where k0 = 84
Found 1 tuple: Found 1 tuple:
[84, 'tuple 84'] [84, 'tuple 84']
insert into t0 values (85, 'tuple 85')
Insert OK, 1 row affected
insert into t0 values (86, 'tuple 86')
Insert OK, 1 row affected
insert into t0 values (87, 'tuple 87')
Insert OK, 1 row affected
insert into t0 values (88, 'tuple 88')
Insert OK, 1 row affected
insert into t0 values (89, 'tuple 89')
Insert OK, 1 row affected
select * from t0 where k0 = 85 select * from t0 where k0 = 85
Found 1 tuple: Found 1 tuple:
[85, 'tuple 85'] [85, 'tuple 85']
...@@ -544,16 +544,6 @@ insert into t0 values (93, 'tuple 93') ...@@ -544,16 +544,6 @@ insert into t0 values (93, 'tuple 93')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (94, 'tuple 94') insert into t0 values (94, 'tuple 94')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (95, 'tuple 95')
Insert OK, 1 row affected
insert into t0 values (96, 'tuple 96')
Insert OK, 1 row affected
insert into t0 values (97, 'tuple 97')
Insert OK, 1 row affected
insert into t0 values (98, 'tuple 98')
Insert OK, 1 row affected
insert into t0 values (99, 'tuple 99')
Insert OK, 1 row affected
select * from t0 where k0 = 90 select * from t0 where k0 = 90
Found 1 tuple: Found 1 tuple:
[90, 'tuple 90'] [90, 'tuple 90']
...@@ -569,6 +559,16 @@ Found 1 tuple: ...@@ -569,6 +559,16 @@ Found 1 tuple:
select * from t0 where k0 = 94 select * from t0 where k0 = 94
Found 1 tuple: Found 1 tuple:
[94, 'tuple 94'] [94, 'tuple 94']
insert into t0 values (95, 'tuple 95')
Insert OK, 1 row affected
insert into t0 values (96, 'tuple 96')
Insert OK, 1 row affected
insert into t0 values (97, 'tuple 97')
Insert OK, 1 row affected
insert into t0 values (98, 'tuple 98')
Insert OK, 1 row affected
insert into t0 values (99, 'tuple 99')
Insert OK, 1 row affected
select * from t0 where k0 = 95 select * from t0 where k0 = 95
Found 1 tuple: Found 1 tuple:
[95, 'tuple 95'] [95, 'tuple 95']
...@@ -604,16 +604,6 @@ insert into t0 values (103, 'tuple 103') ...@@ -604,16 +604,6 @@ insert into t0 values (103, 'tuple 103')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (104, 'tuple 104') insert into t0 values (104, 'tuple 104')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (105, 'tuple 105')
Insert OK, 1 row affected
insert into t0 values (106, 'tuple 106')
Insert OK, 1 row affected
insert into t0 values (107, 'tuple 107')
Insert OK, 1 row affected
insert into t0 values (108, 'tuple 108')
Insert OK, 1 row affected
insert into t0 values (109, 'tuple 109')
Insert OK, 1 row affected
select * from t0 where k0 = 100 select * from t0 where k0 = 100
Found 1 tuple: Found 1 tuple:
[100, 'tuple 100'] [100, 'tuple 100']
...@@ -629,6 +619,16 @@ Found 1 tuple: ...@@ -629,6 +619,16 @@ Found 1 tuple:
select * from t0 where k0 = 104 select * from t0 where k0 = 104
Found 1 tuple: Found 1 tuple:
[104, 'tuple 104'] [104, 'tuple 104']
insert into t0 values (105, 'tuple 105')
Insert OK, 1 row affected
insert into t0 values (106, 'tuple 106')
Insert OK, 1 row affected
insert into t0 values (107, 'tuple 107')
Insert OK, 1 row affected
insert into t0 values (108, 'tuple 108')
Insert OK, 1 row affected
insert into t0 values (109, 'tuple 109')
Insert OK, 1 row affected
select * from t0 where k0 = 105 select * from t0 where k0 = 105
Found 1 tuple: Found 1 tuple:
[105, 'tuple 105'] [105, 'tuple 105']
...@@ -663,16 +663,6 @@ insert into t0 values (113, 'tuple 113') ...@@ -663,16 +663,6 @@ insert into t0 values (113, 'tuple 113')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (114, 'tuple 114') insert into t0 values (114, 'tuple 114')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (115, 'tuple 115')
Insert OK, 1 row affected
insert into t0 values (116, 'tuple 116')
Insert OK, 1 row affected
insert into t0 values (117, 'tuple 117')
Insert OK, 1 row affected
insert into t0 values (118, 'tuple 118')
Insert OK, 1 row affected
insert into t0 values (119, 'tuple 119')
Insert OK, 1 row affected
select * from t0 where k0 = 110 select * from t0 where k0 = 110
Found 1 tuple: Found 1 tuple:
[110, 'tuple 110'] [110, 'tuple 110']
...@@ -688,6 +678,16 @@ Found 1 tuple: ...@@ -688,6 +678,16 @@ Found 1 tuple:
select * from t0 where k0 = 114 select * from t0 where k0 = 114
Found 1 tuple: Found 1 tuple:
[114, 'tuple 114'] [114, 'tuple 114']
insert into t0 values (115, 'tuple 115')
Insert OK, 1 row affected
insert into t0 values (116, 'tuple 116')
Insert OK, 1 row affected
insert into t0 values (117, 'tuple 117')
Insert OK, 1 row affected
insert into t0 values (118, 'tuple 118')
Insert OK, 1 row affected
insert into t0 values (119, 'tuple 119')
Insert OK, 1 row affected
select * from t0 where k0 = 115 select * from t0 where k0 = 115
Found 1 tuple: Found 1 tuple:
[115, 'tuple 115'] [115, 'tuple 115']
...@@ -723,16 +723,6 @@ insert into t0 values (123, 'tuple 123') ...@@ -723,16 +723,6 @@ insert into t0 values (123, 'tuple 123')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (124, 'tuple 124') insert into t0 values (124, 'tuple 124')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (125, 'tuple 125')
Insert OK, 1 row affected
insert into t0 values (126, 'tuple 126')
Insert OK, 1 row affected
insert into t0 values (127, 'tuple 127')
Insert OK, 1 row affected
insert into t0 values (128, 'tuple 128')
Insert OK, 1 row affected
insert into t0 values (129, 'tuple 129')
Insert OK, 1 row affected
select * from t0 where k0 = 120 select * from t0 where k0 = 120
Found 1 tuple: Found 1 tuple:
[120, 'tuple 120'] [120, 'tuple 120']
...@@ -748,6 +738,16 @@ Found 1 tuple: ...@@ -748,6 +738,16 @@ Found 1 tuple:
select * from t0 where k0 = 124 select * from t0 where k0 = 124
Found 1 tuple: Found 1 tuple:
[124, 'tuple 124'] [124, 'tuple 124']
insert into t0 values (125, 'tuple 125')
Insert OK, 1 row affected
insert into t0 values (126, 'tuple 126')
Insert OK, 1 row affected
insert into t0 values (127, 'tuple 127')
Insert OK, 1 row affected
insert into t0 values (128, 'tuple 128')
Insert OK, 1 row affected
insert into t0 values (129, 'tuple 129')
Insert OK, 1 row affected
select * from t0 where k0 = 125 select * from t0 where k0 = 125
Found 1 tuple: Found 1 tuple:
[125, 'tuple 125'] [125, 'tuple 125']
...@@ -782,16 +782,6 @@ insert into t0 values (133, 'tuple 133') ...@@ -782,16 +782,6 @@ insert into t0 values (133, 'tuple 133')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (134, 'tuple 134') insert into t0 values (134, 'tuple 134')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (135, 'tuple 135')
Insert OK, 1 row affected
insert into t0 values (136, 'tuple 136')
Insert OK, 1 row affected
insert into t0 values (137, 'tuple 137')
Insert OK, 1 row affected
insert into t0 values (138, 'tuple 138')
Insert OK, 1 row affected
insert into t0 values (139, 'tuple 139')
Insert OK, 1 row affected
select * from t0 where k0 = 130 select * from t0 where k0 = 130
Found 1 tuple: Found 1 tuple:
[130, 'tuple 130'] [130, 'tuple 130']
...@@ -807,6 +797,16 @@ Found 1 tuple: ...@@ -807,6 +797,16 @@ Found 1 tuple:
select * from t0 where k0 = 134 select * from t0 where k0 = 134
Found 1 tuple: Found 1 tuple:
[134, 'tuple 134'] [134, 'tuple 134']
insert into t0 values (135, 'tuple 135')
Insert OK, 1 row affected
insert into t0 values (136, 'tuple 136')
Insert OK, 1 row affected
insert into t0 values (137, 'tuple 137')
Insert OK, 1 row affected
insert into t0 values (138, 'tuple 138')
Insert OK, 1 row affected
insert into t0 values (139, 'tuple 139')
Insert OK, 1 row affected
select * from t0 where k0 = 135 select * from t0 where k0 = 135
Found 1 tuple: Found 1 tuple:
[135, 'tuple 135'] [135, 'tuple 135']
...@@ -842,16 +842,6 @@ insert into t0 values (143, 'tuple 143') ...@@ -842,16 +842,6 @@ insert into t0 values (143, 'tuple 143')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (144, 'tuple 144') insert into t0 values (144, 'tuple 144')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (145, 'tuple 145')
Insert OK, 1 row affected
insert into t0 values (146, 'tuple 146')
Insert OK, 1 row affected
insert into t0 values (147, 'tuple 147')
Insert OK, 1 row affected
insert into t0 values (148, 'tuple 148')
Insert OK, 1 row affected
insert into t0 values (149, 'tuple 149')
Insert OK, 1 row affected
select * from t0 where k0 = 140 select * from t0 where k0 = 140
Found 1 tuple: Found 1 tuple:
[140, 'tuple 140'] [140, 'tuple 140']
...@@ -867,6 +857,16 @@ Found 1 tuple: ...@@ -867,6 +857,16 @@ Found 1 tuple:
select * from t0 where k0 = 144 select * from t0 where k0 = 144
Found 1 tuple: Found 1 tuple:
[144, 'tuple 144'] [144, 'tuple 144']
insert into t0 values (145, 'tuple 145')
Insert OK, 1 row affected
insert into t0 values (146, 'tuple 146')
Insert OK, 1 row affected
insert into t0 values (147, 'tuple 147')
Insert OK, 1 row affected
insert into t0 values (148, 'tuple 148')
Insert OK, 1 row affected
insert into t0 values (149, 'tuple 149')
Insert OK, 1 row affected
select * from t0 where k0 = 145 select * from t0 where k0 = 145
Found 1 tuple: Found 1 tuple:
[145, 'tuple 145'] [145, 'tuple 145']
...@@ -901,16 +901,6 @@ insert into t0 values (153, 'tuple 153') ...@@ -901,16 +901,6 @@ insert into t0 values (153, 'tuple 153')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (154, 'tuple 154') insert into t0 values (154, 'tuple 154')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (155, 'tuple 155')
Insert OK, 1 row affected
insert into t0 values (156, 'tuple 156')
Insert OK, 1 row affected
insert into t0 values (157, 'tuple 157')
Insert OK, 1 row affected
insert into t0 values (158, 'tuple 158')
Insert OK, 1 row affected
insert into t0 values (159, 'tuple 159')
Insert OK, 1 row affected
select * from t0 where k0 = 150 select * from t0 where k0 = 150
Found 1 tuple: Found 1 tuple:
[150, 'tuple 150'] [150, 'tuple 150']
...@@ -926,6 +916,16 @@ Found 1 tuple: ...@@ -926,6 +916,16 @@ Found 1 tuple:
select * from t0 where k0 = 154 select * from t0 where k0 = 154
Found 1 tuple: Found 1 tuple:
[154, 'tuple 154'] [154, 'tuple 154']
insert into t0 values (155, 'tuple 155')
Insert OK, 1 row affected
insert into t0 values (156, 'tuple 156')
Insert OK, 1 row affected
insert into t0 values (157, 'tuple 157')
Insert OK, 1 row affected
insert into t0 values (158, 'tuple 158')
Insert OK, 1 row affected
insert into t0 values (159, 'tuple 159')
Insert OK, 1 row affected
select * from t0 where k0 = 155 select * from t0 where k0 = 155
Found 1 tuple: Found 1 tuple:
[155, 'tuple 155'] [155, 'tuple 155']
...@@ -961,16 +961,6 @@ insert into t0 values (163, 'tuple 163') ...@@ -961,16 +961,6 @@ insert into t0 values (163, 'tuple 163')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (164, 'tuple 164') insert into t0 values (164, 'tuple 164')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (165, 'tuple 165')
Insert OK, 1 row affected
insert into t0 values (166, 'tuple 166')
Insert OK, 1 row affected
insert into t0 values (167, 'tuple 167')
Insert OK, 1 row affected
insert into t0 values (168, 'tuple 168')
Insert OK, 1 row affected
insert into t0 values (169, 'tuple 169')
Insert OK, 1 row affected
select * from t0 where k0 = 160 select * from t0 where k0 = 160
Found 1 tuple: Found 1 tuple:
[160, 'tuple 160'] [160, 'tuple 160']
...@@ -986,6 +976,16 @@ Found 1 tuple: ...@@ -986,6 +976,16 @@ Found 1 tuple:
select * from t0 where k0 = 164 select * from t0 where k0 = 164
Found 1 tuple: Found 1 tuple:
[164, 'tuple 164'] [164, 'tuple 164']
insert into t0 values (165, 'tuple 165')
Insert OK, 1 row affected
insert into t0 values (166, 'tuple 166')
Insert OK, 1 row affected
insert into t0 values (167, 'tuple 167')
Insert OK, 1 row affected
insert into t0 values (168, 'tuple 168')
Insert OK, 1 row affected
insert into t0 values (169, 'tuple 169')
Insert OK, 1 row affected
select * from t0 where k0 = 165 select * from t0 where k0 = 165
Found 1 tuple: Found 1 tuple:
[165, 'tuple 165'] [165, 'tuple 165']
...@@ -1020,16 +1020,6 @@ insert into t0 values (173, 'tuple 173') ...@@ -1020,16 +1020,6 @@ insert into t0 values (173, 'tuple 173')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (174, 'tuple 174') insert into t0 values (174, 'tuple 174')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (175, 'tuple 175')
Insert OK, 1 row affected
insert into t0 values (176, 'tuple 176')
Insert OK, 1 row affected
insert into t0 values (177, 'tuple 177')
Insert OK, 1 row affected
insert into t0 values (178, 'tuple 178')
Insert OK, 1 row affected
insert into t0 values (179, 'tuple 179')
Insert OK, 1 row affected
select * from t0 where k0 = 170 select * from t0 where k0 = 170
Found 1 tuple: Found 1 tuple:
[170, 'tuple 170'] [170, 'tuple 170']
...@@ -1045,6 +1035,16 @@ Found 1 tuple: ...@@ -1045,6 +1035,16 @@ Found 1 tuple:
select * from t0 where k0 = 174 select * from t0 where k0 = 174
Found 1 tuple: Found 1 tuple:
[174, 'tuple 174'] [174, 'tuple 174']
insert into t0 values (175, 'tuple 175')
Insert OK, 1 row affected
insert into t0 values (176, 'tuple 176')
Insert OK, 1 row affected
insert into t0 values (177, 'tuple 177')
Insert OK, 1 row affected
insert into t0 values (178, 'tuple 178')
Insert OK, 1 row affected
insert into t0 values (179, 'tuple 179')
Insert OK, 1 row affected
select * from t0 where k0 = 175 select * from t0 where k0 = 175
Found 1 tuple: Found 1 tuple:
[175, 'tuple 175'] [175, 'tuple 175']
...@@ -1080,16 +1080,6 @@ insert into t0 values (183, 'tuple 183') ...@@ -1080,16 +1080,6 @@ insert into t0 values (183, 'tuple 183')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (184, 'tuple 184') insert into t0 values (184, 'tuple 184')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (185, 'tuple 185')
Insert OK, 1 row affected
insert into t0 values (186, 'tuple 186')
Insert OK, 1 row affected
insert into t0 values (187, 'tuple 187')
Insert OK, 1 row affected
insert into t0 values (188, 'tuple 188')
Insert OK, 1 row affected
insert into t0 values (189, 'tuple 189')
Insert OK, 1 row affected
select * from t0 where k0 = 180 select * from t0 where k0 = 180
Found 1 tuple: Found 1 tuple:
[180, 'tuple 180'] [180, 'tuple 180']
...@@ -1105,6 +1095,16 @@ Found 1 tuple: ...@@ -1105,6 +1095,16 @@ Found 1 tuple:
select * from t0 where k0 = 184 select * from t0 where k0 = 184
Found 1 tuple: Found 1 tuple:
[184, 'tuple 184'] [184, 'tuple 184']
insert into t0 values (185, 'tuple 185')
Insert OK, 1 row affected
insert into t0 values (186, 'tuple 186')
Insert OK, 1 row affected
insert into t0 values (187, 'tuple 187')
Insert OK, 1 row affected
insert into t0 values (188, 'tuple 188')
Insert OK, 1 row affected
insert into t0 values (189, 'tuple 189')
Insert OK, 1 row affected
select * from t0 where k0 = 185 select * from t0 where k0 = 185
Found 1 tuple: Found 1 tuple:
[185, 'tuple 185'] [185, 'tuple 185']
...@@ -1139,16 +1139,6 @@ insert into t0 values (193, 'tuple 193') ...@@ -1139,16 +1139,6 @@ insert into t0 values (193, 'tuple 193')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (194, 'tuple 194') insert into t0 values (194, 'tuple 194')
Insert OK, 1 row affected Insert OK, 1 row affected
insert into t0 values (195, 'tuple 195')
Insert OK, 1 row affected
insert into t0 values (196, 'tuple 196')
Insert OK, 1 row affected
insert into t0 values (197, 'tuple 197')
Insert OK, 1 row affected
insert into t0 values (198, 'tuple 198')
Insert OK, 1 row affected
insert into t0 values (199, 'tuple 199')
Insert OK, 1 row affected
select * from t0 where k0 = 190 select * from t0 where k0 = 190
Found 1 tuple: Found 1 tuple:
[190, 'tuple 190'] [190, 'tuple 190']
...@@ -1164,6 +1154,16 @@ Found 1 tuple: ...@@ -1164,6 +1154,16 @@ Found 1 tuple:
select * from t0 where k0 = 194 select * from t0 where k0 = 194
Found 1 tuple: Found 1 tuple:
[194, 'tuple 194'] [194, 'tuple 194']
insert into t0 values (195, 'tuple 195')
Insert OK, 1 row affected
insert into t0 values (196, 'tuple 196')
Insert OK, 1 row affected
insert into t0 values (197, 'tuple 197')
Insert OK, 1 row affected
insert into t0 values (198, 'tuple 198')
Insert OK, 1 row affected
insert into t0 values (199, 'tuple 199')
Insert OK, 1 row affected
select * from t0 where k0 = 195 select * from t0 where k0 = 195
Found 1 tuple: Found 1 tuple:
[195, 'tuple 195'] [195, 'tuple 195']
......
# encoding: tarantool # encoding: tarantool
import os import os
import time
from lib.tarantool_box_server import TarantoolBoxServer from lib.tarantool_box_server import TarantoolBoxServer
REPEAT = 10 REPEAT = 10
ID_BEGIN = 0 ID_BEGIN = 0
ID_STEP = 10 ID_STEP = 5
def insert_tuples(server, begin, end, msg = "tuple"): def insert_tuples(server, begin, end, msg = "tuple"):
for i in range(begin, end): for i in range(begin, end):
...@@ -27,7 +28,6 @@ replica.deploy("box_replication/cfg/replica.cfg", ...@@ -27,7 +28,6 @@ replica.deploy("box_replication/cfg/replica.cfg",
id = ID_BEGIN id = ID_BEGIN
for i in range(REPEAT): for i in range(REPEAT):
summary = 0.0
print "test %d iteration" % i print "test %d iteration" % i
# insert to master # insert to master
...@@ -36,24 +36,35 @@ for i in range(REPEAT): ...@@ -36,24 +36,35 @@ for i in range(REPEAT):
select_tuples(replica, id, id + ID_STEP) select_tuples(replica, id, id + ID_STEP)
id += ID_STEP id += ID_STEP
# insert to master
insert_tuples(master, id, id + ID_STEP)
# select from replica
select_tuples(replica, id, id + ID_STEP)
id += ID_STEP
print "swap servers" print "swap servers"
# reconfigure replica to master # reconfigure replica to master
replica.reconfigure("box_replication/cfg/replica_to_master.cfg", silent = False) replica.reconfigure("box_replication/cfg/replica_to_master.cfg", silent = False)
# reconfigure master to replica # reconfigure master to replica
master.reconfigure("box_replication/cfg/master_to_replica.cfg", silent = False) master.reconfigure("box_replication/cfg/master_to_replica.cfg", silent = False)
# insert to replica
insert_tuples(replica, id, id + ID_STEP)
# select from master
select_tuples(master, id, id + ID_STEP)
id += ID_STEP
# insert to master # insert to replica
insert_tuples(replica, id, id + ID_STEP) insert_tuples(replica, id, id + ID_STEP)
# select from replica # select from master
select_tuples(master, id, id + ID_STEP) select_tuples(master, id, id + ID_STEP)
id += ID_STEP
print "rollback servers configuration" print "rollback servers configuration"
# reconfigure replica to master # reconfigure replica to master
master.reconfigure("box_replication/cfg/master.cfg", silent = False) master.reconfigure("box_replication/cfg/master.cfg", silent = False)
# reconfigure master to replica # reconfigure master to replica
replica.reconfigure("box_replication/cfg/replica.cfg", silent = False) replica.reconfigure("box_replication/cfg/replica.cfg", silent = False)
id += ID_STEP
# Cleanup. # Cleanup.
......
...@@ -41,10 +41,9 @@ class TarantoolBoxServer(TarantoolServer): ...@@ -41,10 +41,9 @@ class TarantoolBoxServer(TarantoolServer):
return info[param] return info[param]
def wait_lsn(self, lsn): def wait_lsn(self, lsn):
try_count = 0
while True: while True:
curr_lsn = int(self.get_param("lsn")) curr_lsn = int(self.get_param("lsn"))
if (curr_lsn >= lsn): if (curr_lsn >= lsn):
break break
try_count += 1
time.sleep(0.01) time.sleep(0.01)
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