From 0c771b3201aebb76c10d03803c309f3425617762 Mon Sep 17 00:00:00 2001 From: Pavel_Shilin Date: Mon, 2 Dec 2024 04:12:38 +0100 Subject: [PATCH 01/12] Added a new case that SELECT does not wait for FREEZE + UPDATE --- test/clt-tests/core/test-freeze-unfreeze-update.rec | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/clt-tests/core/test-freeze-unfreeze-update.rec b/test/clt-tests/core/test-freeze-unfreeze-update.rec index 16900d10d7..4827778405 100644 --- a/test/clt-tests/core/test-freeze-unfreeze-update.rec +++ b/test/clt-tests/core/test-freeze-unfreeze-update.rec @@ -75,3 +75,10 @@ mysql -P9315 -h0 -e "DESCRIBE t" mysql -P9315 -h0 -e "UPDATE t SET s='с' WHERE id=1; FLUSH RAMCHUNK t"; echo $? ––– output ––– 0 +––– input ––– +mysql -P9315 -h0 -e "drop table if exists t; create table t(a string); insert into t values(1, 'a'); flush ramchunk t; freeze t; update t set a='b' where id = 1;" & +––– output ––– +[%{NUMBER}] %{NUMBER} +––– input ––– +mysql -P9315 -h0 -e "select * from t" +––– output ––– From 9fdabe6c56ca02c6c3ac17a80d262ab23ea9ee9f Mon Sep 17 00:00:00 2001 From: Pavel_Shilin Date: Mon, 2 Dec 2024 10:01:36 +0100 Subject: [PATCH 02/12] Update test-freeze-unfreeze-update.rec --- .../core/test-freeze-unfreeze-update.rec | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/test/clt-tests/core/test-freeze-unfreeze-update.rec b/test/clt-tests/core/test-freeze-unfreeze-update.rec index 4827778405..60299fda78 100644 --- a/test/clt-tests/core/test-freeze-unfreeze-update.rec +++ b/test/clt-tests/core/test-freeze-unfreeze-update.rec @@ -76,9 +76,27 @@ mysql -P9315 -h0 -e "UPDATE t SET s='с' WHERE id=1; FLUSH RAMCHUNK t"; echo $? ––– output ––– 0 ––– input ––– -mysql -P9315 -h0 -e "drop table if exists t; create table t(a string); insert into t values(1, 'a'); flush ramchunk t; freeze t; update t set a='b' where id = 1;" & -––– output ––– -[%{NUMBER}] %{NUMBER} -––– input ––– -mysql -P9315 -h0 -e "select * from t" +mysql -P9315 -h0 -e "drop table if exists t;" && timeout 5 bash -c '[ -d /tmp/data/t ] && rm -rf /tmp/data/t' && mysql -P9315 -h0 -e "create table t(a string); insert into t values(1, 'a'); flush ramchunk t; freeze t; unfreeze t; update t set a='b' where id = 1;" && timeout 3 bash -c 'mysql -P9315 -h0 -e "select * from t;"' ––– output ––– ++------------------------+------------------------+ +| file | normalized | ++------------------------+------------------------+ +| /tmp/data/t/t.0.spa | /tmp/data/t/t.0.spa | +| /tmp/data/t/t.0.spb | /tmp/data/t/t.0.spb | +| /tmp/data/t/t.0.spd | /tmp/data/t/t.0.spd | +| /tmp/data/t/t.0.spe | /tmp/data/t/t.0.spe | +| /tmp/data/t/t.0.sph | /tmp/data/t/t.0.sph | +| /tmp/data/t/t.0.sphi | /tmp/data/t/t.0.sphi | +| /tmp/data/t/t.0.spi | /tmp/data/t/t.0.spi | +| /tmp/data/t/t.0.spidx | /tmp/data/t/t.0.spidx | +| /tmp/data/t/t.0.spm | /tmp/data/t/t.0.spm | +| /tmp/data/t/t.0.spp | /tmp/data/t/t.0.spp | +| /tmp/data/t/t.0.spt | /tmp/data/t/t.0.spt | +| /tmp/data/t/t.meta | /tmp/data/t/t.meta | +| /tmp/data/t/t.settings | /tmp/data/t/t.settings | ++------------------------+------------------------+ ++------+------+ +| id | a | ++------+------+ +| 1 | b | ++------+------+ From daa96a1248457b48cc1962ea78be57f59592d83c Mon Sep 17 00:00:00 2001 From: Pavel_Shilin Date: Mon, 2 Dec 2024 13:17:12 +0100 Subject: [PATCH 03/12] Added set +b to silence notifications --- .../core/test-freeze-unfreeze-update.rec | 24 ++++--------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/test/clt-tests/core/test-freeze-unfreeze-update.rec b/test/clt-tests/core/test-freeze-unfreeze-update.rec index 60299fda78..2300de1d9e 100644 --- a/test/clt-tests/core/test-freeze-unfreeze-update.rec +++ b/test/clt-tests/core/test-freeze-unfreeze-update.rec @@ -76,27 +76,13 @@ mysql -P9315 -h0 -e "UPDATE t SET s='с' WHERE id=1; FLUSH RAMCHUNK t"; echo $? ––– output ––– 0 ––– input ––– -mysql -P9315 -h0 -e "drop table if exists t;" && timeout 5 bash -c '[ -d /tmp/data/t ] && rm -rf /tmp/data/t' && mysql -P9315 -h0 -e "create table t(a string); insert into t values(1, 'a'); flush ramchunk t; freeze t; unfreeze t; update t set a='b' where id = 1;" && timeout 3 bash -c 'mysql -P9315 -h0 -e "select * from t;"' +(set +b; mysql -P9315 -h0 -e "drop table if exists t;" && timeout 5 bash -c '[ -d /tmp/data/t ] && rm -rf /tmp/data/t' && mysql -P9315 -h0 -e "create table t(a string); insert into t values(1, 'a'); flush ramchunk t; freeze t;" 2>&1 &) &>/dev/null +––– output ––– +––– input ––– +sleep 1; mysql -P9315 -h0 -e "select * from t;" ––– output ––– -+------------------------+------------------------+ -| file | normalized | -+------------------------+------------------------+ -| /tmp/data/t/t.0.spa | /tmp/data/t/t.0.spa | -| /tmp/data/t/t.0.spb | /tmp/data/t/t.0.spb | -| /tmp/data/t/t.0.spd | /tmp/data/t/t.0.spd | -| /tmp/data/t/t.0.spe | /tmp/data/t/t.0.spe | -| /tmp/data/t/t.0.sph | /tmp/data/t/t.0.sph | -| /tmp/data/t/t.0.sphi | /tmp/data/t/t.0.sphi | -| /tmp/data/t/t.0.spi | /tmp/data/t/t.0.spi | -| /tmp/data/t/t.0.spidx | /tmp/data/t/t.0.spidx | -| /tmp/data/t/t.0.spm | /tmp/data/t/t.0.spm | -| /tmp/data/t/t.0.spp | /tmp/data/t/t.0.spp | -| /tmp/data/t/t.0.spt | /tmp/data/t/t.0.spt | -| /tmp/data/t/t.meta | /tmp/data/t/t.meta | -| /tmp/data/t/t.settings | /tmp/data/t/t.settings | -+------------------------+------------------------+ +------+------+ | id | a | +------+------+ -| 1 | b | +| 1 | a | +------+------+ From df776b04a3af0bf78d989afa6d21528d45519f87 Mon Sep 17 00:00:00 2001 From: Pavel_Shilin Date: Mon, 2 Dec 2024 15:13:55 +0100 Subject: [PATCH 04/12] Fix test-freeze-unfreeze-update.rec --- test/clt-tests/core/test-freeze-unfreeze-update.rec | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/clt-tests/core/test-freeze-unfreeze-update.rec b/test/clt-tests/core/test-freeze-unfreeze-update.rec index 2300de1d9e..7fce82852f 100644 --- a/test/clt-tests/core/test-freeze-unfreeze-update.rec +++ b/test/clt-tests/core/test-freeze-unfreeze-update.rec @@ -76,10 +76,11 @@ mysql -P9315 -h0 -e "UPDATE t SET s='с' WHERE id=1; FLUSH RAMCHUNK t"; echo $? ––– output ––– 0 ––– input ––– -(set +b; mysql -P9315 -h0 -e "drop table if exists t;" && timeout 5 bash -c '[ -d /tmp/data/t ] && rm -rf /tmp/data/t' && mysql -P9315 -h0 -e "create table t(a string); insert into t values(1, 'a'); flush ramchunk t; freeze t;" 2>&1 &) &>/dev/null +(set +b; mysql -P9315 -h0 -e "drop table if exists t;" && timeout 5 bash -c '[ -d /tmp/data/t ] && rm -rf /tmp/data/t' && mysql -P9315 -h0 -e "create table t(a string); insert into t values(1, 'a'); flush ramchunk t; freeze t; update t set a='b' where id = 1;" > /dev/null 2>&1) & ––– output ––– +[%{NUMBER}] %{NUMBER} ––– input ––– -sleep 1; mysql -P9315 -h0 -e "select * from t;" +sleep 5; mysql -P9315 -h0 -e "select * from t;" ––– output ––– +------+------+ | id | a | From ddb544ebe5d0a410ef48bbdcb9bf756447ae630a Mon Sep 17 00:00:00 2001 From: Pavel_Shilin Date: Sun, 8 Dec 2024 21:45:21 +0100 Subject: [PATCH 05/12] Update test-freeze-unfreeze-update.rec --- test/clt-tests/core/test-freeze-unfreeze-update.rec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/clt-tests/core/test-freeze-unfreeze-update.rec b/test/clt-tests/core/test-freeze-unfreeze-update.rec index 7fce82852f..08612e7a4f 100644 --- a/test/clt-tests/core/test-freeze-unfreeze-update.rec +++ b/test/clt-tests/core/test-freeze-unfreeze-update.rec @@ -30,7 +30,7 @@ rm -f /tmp/update.sql; for n in `seq 1 10000`; do echo "update t set s='b' where ––– output ––– [#!/[0-9]{1}/!#] %{NUMBER} ––– input ––– -sleep 30; mysql -P9315 -h0 -e "select * from t;" +sleep 3; mysql -P9315 -h0 -e "select * from t;" ––– output ––– +------+------+ | id | s | @@ -76,11 +76,11 @@ mysql -P9315 -h0 -e "UPDATE t SET s='с' WHERE id=1; FLUSH RAMCHUNK t"; echo $? ––– output ––– 0 ––– input ––– -(set +b; mysql -P9315 -h0 -e "drop table if exists t;" && timeout 5 bash -c '[ -d /tmp/data/t ] && rm -rf /tmp/data/t' && mysql -P9315 -h0 -e "create table t(a string); insert into t values(1, 'a'); flush ramchunk t; freeze t; update t set a='b' where id = 1;" > /dev/null 2>&1) & +(mysql -P9315 -h0 -e "drop table if exists t;" && mysql -P9315 -h0 -e "create table t(a string); insert into t values(1, 'a'); flush ramchunk t; freeze t"; mysql -P9315 -h0 -e "update t set a='b' where id = 1" 2>&1 &) ––– output ––– [%{NUMBER}] %{NUMBER} ––– input ––– -sleep 5; mysql -P9315 -h0 -e "select * from t;" +sleep 1; mysql -P9315 -h0 -e "select * from t;" ––– output ––– +------+------+ | id | a | From b8913988e2b634004205754322e82908a4b1389d Mon Sep 17 00:00:00 2001 From: Pavel_Shilin Date: Mon, 9 Dec 2024 09:54:28 +0100 Subject: [PATCH 06/12] Added removing /tmp/data/t --- .../core/test-freeze-unfreeze-update.rec | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/test/clt-tests/core/test-freeze-unfreeze-update.rec b/test/clt-tests/core/test-freeze-unfreeze-update.rec index 08612e7a4f..d3ad4f2614 100644 --- a/test/clt-tests/core/test-freeze-unfreeze-update.rec +++ b/test/clt-tests/core/test-freeze-unfreeze-update.rec @@ -76,9 +76,28 @@ mysql -P9315 -h0 -e "UPDATE t SET s='с' WHERE id=1; FLUSH RAMCHUNK t"; echo $? ––– output ––– 0 ––– input ––– -(mysql -P9315 -h0 -e "drop table if exists t;" && mysql -P9315 -h0 -e "create table t(a string); insert into t values(1, 'a'); flush ramchunk t; freeze t"; mysql -P9315 -h0 -e "update t set a='b' where id = 1" 2>&1 &) +rm -rf /tmp/data/t ––– output ––– -[%{NUMBER}] %{NUMBER} +––– input ––– +(sleep 1; mysql -P9315 -h0 -e "drop table if exists t;" && mysql -P9315 -h0 -e "create table t(a string); insert into t values(1, 'a'); flush ramchunk t; freeze t"; mysql -P9315 -h0 -e "update t set a='b' where id = 1" 2>&1 &) +––– output ––– ++------------------------+------------------------+ +| file | normalized | ++------------------------+------------------------+ +| /tmp/data/t/t.0.spa | /tmp/data/t/t.0.spa | +| /tmp/data/t/t.0.spb | /tmp/data/t/t.0.spb | +| /tmp/data/t/t.0.spd | /tmp/data/t/t.0.spd | +| /tmp/data/t/t.0.spe | /tmp/data/t/t.0.spe | +| /tmp/data/t/t.0.sph | /tmp/data/t/t.0.sph | +| /tmp/data/t/t.0.sphi | /tmp/data/t/t.0.sphi | +| /tmp/data/t/t.0.spi | /tmp/data/t/t.0.spi | +| /tmp/data/t/t.0.spidx | /tmp/data/t/t.0.spidx | +| /tmp/data/t/t.0.spm | /tmp/data/t/t.0.spm | +| /tmp/data/t/t.0.spp | /tmp/data/t/t.0.spp | +| /tmp/data/t/t.0.spt | /tmp/data/t/t.0.spt | +| /tmp/data/t/t.meta | /tmp/data/t/t.meta | +| /tmp/data/t/t.settings | /tmp/data/t/t.settings | ++------------------------+------------------------+ ––– input ––– sleep 1; mysql -P9315 -h0 -e "select * from t;" ––– output ––– From 68a2b91a9303d108d73edd3d28fd918b1e7188a5 Mon Sep 17 00:00:00 2001 From: Pavel_Shilin Date: Tue, 10 Dec 2024 20:06:53 +0100 Subject: [PATCH 07/12] Update test-freeze-unfreeze-update.rec --- test/clt-tests/core/test-freeze-unfreeze-update.rec | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/test/clt-tests/core/test-freeze-unfreeze-update.rec b/test/clt-tests/core/test-freeze-unfreeze-update.rec index d3ad4f2614..8078981384 100644 --- a/test/clt-tests/core/test-freeze-unfreeze-update.rec +++ b/test/clt-tests/core/test-freeze-unfreeze-update.rec @@ -26,11 +26,10 @@ mysql -P9315 -h0 -e "select * from t;" | 1 | a | +------+------+ ––– input ––– -rm -f /tmp/update.sql; for n in `seq 1 10000`; do echo "update t set s='b' where id=1;" >> /tmp/update.sql; done; while true; do mysql -P9315 -h0 < /tmp/update.sql | break; done & +(rm -f /tmp/update.sql; for n in `seq 1 10000`; do echo "update t set s='b' where id=1;" >> /tmp/update.sql; done; for i in `seq 1 10`; do mysql -P9315 -h0 < /tmp/update.sql; done 2>&1 &) ––– output ––– -[#!/[0-9]{1}/!#] %{NUMBER} ––– input ––– -sleep 3; mysql -P9315 -h0 -e "select * from t;" +sleep 30; mysql -P9315 -h0 -e "select * from t;" ––– output ––– +------+------+ | id | s | @@ -76,10 +75,7 @@ mysql -P9315 -h0 -e "UPDATE t SET s='с' WHERE id=1; FLUSH RAMCHUNK t"; echo $? ––– output ––– 0 ––– input ––– -rm -rf /tmp/data/t -––– output ––– -––– input ––– -(sleep 1; mysql -P9315 -h0 -e "drop table if exists t;" && mysql -P9315 -h0 -e "create table t(a string); insert into t values(1, 'a'); flush ramchunk t; freeze t"; mysql -P9315 -h0 -e "update t set a='b' where id = 1" 2>&1 &) +(sleep 1; mysql -P9315 -h0 -e "drop table if exists t; create table t(a string); insert into t values(1, 'a'); flush ramchunk t; freeze t; update t set a='b' where id = 1" 2>&1 &) ––– output ––– +------------------------+------------------------+ | file | normalized | From cc78a37a28ee4292ca3e535ade501585392a4b15 Mon Sep 17 00:00:00 2001 From: Pavel_Shilin Date: Tue, 10 Dec 2024 22:38:16 +0100 Subject: [PATCH 08/12] Return of unfreeze, query optimization --- test/clt-tests/core/test-freeze-unfreeze-update.rec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/clt-tests/core/test-freeze-unfreeze-update.rec b/test/clt-tests/core/test-freeze-unfreeze-update.rec index 8078981384..35e2cc7e4e 100644 --- a/test/clt-tests/core/test-freeze-unfreeze-update.rec +++ b/test/clt-tests/core/test-freeze-unfreeze-update.rec @@ -26,7 +26,7 @@ mysql -P9315 -h0 -e "select * from t;" | 1 | a | +------+------+ ––– input ––– -(rm -f /tmp/update.sql; for n in `seq 1 10000`; do echo "update t set s='b' where id=1;" >> /tmp/update.sql; done; for i in `seq 1 10`; do mysql -P9315 -h0 < /tmp/update.sql; done 2>&1 &) +(rm -f /tmp/update.sql; for n in `seq 1 10000`; do echo "update t set s='b' where id=1;" >> /tmp/update.sql; done; for i in `seq 1 10`; do mysql -P9315 -h0 < /tmp/update.sql; done; wait; 2>&1 &) ––– output ––– ––– input ––– sleep 30; mysql -P9315 -h0 -e "select * from t;" @@ -37,7 +37,7 @@ sleep 30; mysql -P9315 -h0 -e "select * from t;" | 1 | b | +------+------+ ––– input ––– -stdbuf -oL mysql -P9315 -h0 -e "freeze t" +mysql -P9315 -h0 -e "freeze t" ––– output ––– +------------------------+------------------------+ | file | normalized | @@ -75,7 +75,7 @@ mysql -P9315 -h0 -e "UPDATE t SET s='с' WHERE id=1; FLUSH RAMCHUNK t"; echo $? ––– output ––– 0 ––– input ––– -(sleep 1; mysql -P9315 -h0 -e "drop table if exists t; create table t(a string); insert into t values(1, 'a'); flush ramchunk t; freeze t; update t set a='b' where id = 1" 2>&1 &) +(sleep 1; mysql -P9315 -h0 -e "drop table if exists t; create table t(a string); insert into t values(1, 'a'); flush ramchunk t; freeze t"; mysql -P9315 -h0 -e "update t set a='b' where id = 1" 2>&1 &) ––– output ––– +------------------------+------------------------+ | file | normalized | From 7d12c813d9ab767196817a0e1092ffa3c334ba59 Mon Sep 17 00:00:00 2001 From: Pavel_Shilin Date: Tue, 10 Dec 2024 23:20:45 +0100 Subject: [PATCH 09/12] Deleted "wait" --- test/clt-tests/core/test-freeze-unfreeze-update.rec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/clt-tests/core/test-freeze-unfreeze-update.rec b/test/clt-tests/core/test-freeze-unfreeze-update.rec index 35e2cc7e4e..9a196cee1a 100644 --- a/test/clt-tests/core/test-freeze-unfreeze-update.rec +++ b/test/clt-tests/core/test-freeze-unfreeze-update.rec @@ -26,7 +26,7 @@ mysql -P9315 -h0 -e "select * from t;" | 1 | a | +------+------+ ––– input ––– -(rm -f /tmp/update.sql; for n in `seq 1 10000`; do echo "update t set s='b' where id=1;" >> /tmp/update.sql; done; for i in `seq 1 10`; do mysql -P9315 -h0 < /tmp/update.sql; done; wait; 2>&1 &) +(rm -f /tmp/update.sql; for n in `seq 1 10000`; do echo "update t set s='b' where id=1;" >> /tmp/update.sql; done; for i in `seq 1 10`; do mysql -P9315 -h0 < /tmp/update.sql; done; 2>&1 &) ––– output ––– ––– input ––– sleep 30; mysql -P9315 -h0 -e "select * from t;" From 9be416d2b24025cbeca6355138c0ca1cc426772d Mon Sep 17 00:00:00 2001 From: Pavel Shilin <143797001+PavelShilin89@users.noreply.github.com> Date: Thu, 12 Dec 2024 00:36:12 +0100 Subject: [PATCH 10/12] Update test-freeze-unfreeze-update.rec Updated sleep --- test/clt-tests/core/test-freeze-unfreeze-update.rec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/clt-tests/core/test-freeze-unfreeze-update.rec b/test/clt-tests/core/test-freeze-unfreeze-update.rec index 9a196cee1a..83956889d4 100644 --- a/test/clt-tests/core/test-freeze-unfreeze-update.rec +++ b/test/clt-tests/core/test-freeze-unfreeze-update.rec @@ -29,7 +29,7 @@ mysql -P9315 -h0 -e "select * from t;" (rm -f /tmp/update.sql; for n in `seq 1 10000`; do echo "update t set s='b' where id=1;" >> /tmp/update.sql; done; for i in `seq 1 10`; do mysql -P9315 -h0 < /tmp/update.sql; done; 2>&1 &) ––– output ––– ––– input ––– -sleep 30; mysql -P9315 -h0 -e "select * from t;" +sleep 1; mysql -P9315 -h0 -e "select * from t;" ––– output ––– +------+------+ | id | s | From ed5a13bd5b4e5ba1dcd9424554484e72ab3db8ae Mon Sep 17 00:00:00 2001 From: Pavel_Shilin Date: Tue, 17 Dec 2024 10:29:42 +0100 Subject: [PATCH 11/12] Update test-freeze-unfreeze-update --- .../core/test-freeze-unfreeze-update.rec | 37 ++++++++++++++----- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/test/clt-tests/core/test-freeze-unfreeze-update.rec b/test/clt-tests/core/test-freeze-unfreeze-update.rec index 83956889d4..6a045695dd 100644 --- a/test/clt-tests/core/test-freeze-unfreeze-update.rec +++ b/test/clt-tests/core/test-freeze-unfreeze-update.rec @@ -14,27 +14,44 @@ listening on all interfaces for mysql, port=9315 listening on all interfaces for sphinx and http(s), port=9316 Buddy started! ––– input ––– -mysql -P9315 -h0 -e "drop table if exists t; create table t(s string); insert into t values(1, 'a'); flush ramchunk t"; echo $? +mysql -P9315 -h0 -e "DROP TABLE IF EXISTS t; CREATE TABLE t(id INT, s STRING);" ––– output ––– -0 ––– input ––– -mysql -P9315 -h0 -e "select * from t;" +for n in `seq 1 100000`; do echo "INSERT INTO t VALUES($n, 'a');" >> /tmp/insert.sql; done; mysql -P9315 -h0 < /tmp/insert.sql; mysql -P9315 -h0 -e "FLUSH RAMCHUNK t;" ––– output ––– -+------+------+ -| id | s | -+------+------+ -| 1 | a | -+------+------+ ––– input ––– -(rm -f /tmp/update.sql; for n in `seq 1 10000`; do echo "update t set s='b' where id=1;" >> /tmp/update.sql; done; for i in `seq 1 10`; do mysql -P9315 -h0 < /tmp/update.sql; done; 2>&1 &) +mysql -P9315 -h0 -e "SELECT COUNT(*) AS total FROM t;" ––– output ––– ++---------+ +| total | ++---------+ +| 100000 | ++---------+ ––– input ––– -sleep 1; mysql -P9315 -h0 -e "select * from t;" +rm -f /tmp/update.sql; for n in `seq 1 100000`; do echo "UPDATE t SET s='b' WHERE id=$n;" >> /tmp/update.sql; done; (for i in `seq 1 10`; do mysql -P9315 -h0 < /tmp/update.sql; done) & UPDATE_PID=$! +––– output ––– +––– input ––– +sleep 5; mysql -P9315 -h0 -e "SELECT COUNT(*) AS updates FROM t WHERE s='b';" +––– output ––– ++---------+ +| updates | ++---------+ +| 100000 | ++---------+ +––– input ––– +kill $UPDATE_PID; wait $UPDATE_PID 2>/dev/null +––– output ––– +––– input ––– +mysql -P9315 -h0 -e "SELECT * FROM t LIMIT 5;" ––– output ––– +------+------+ | id | s | +------+------+ | 1 | b | +| 2 | b | +| 3 | b | +| 4 | b | +| 5 | b | +------+------+ ––– input ––– mysql -P9315 -h0 -e "freeze t" From 3ade90adcebb23df96f62453c93cbefca8ec1c57 Mon Sep 17 00:00:00 2001 From: Pavel_Shilin Date: Wed, 18 Dec 2024 09:14:53 +0100 Subject: [PATCH 12/12] Added timeouts and result control --- .../core/test-freeze-unfreeze-update.rec | 72 +++++-------------- 1 file changed, 19 insertions(+), 53 deletions(-) diff --git a/test/clt-tests/core/test-freeze-unfreeze-update.rec b/test/clt-tests/core/test-freeze-unfreeze-update.rec index 6a045695dd..c9fcfcff9a 100644 --- a/test/clt-tests/core/test-freeze-unfreeze-update.rec +++ b/test/clt-tests/core/test-freeze-unfreeze-update.rec @@ -1,60 +1,38 @@ ––– input ––– -echo -e "searchd {\n listen = 9315:mysql\n listen = 9316\n log = /tmp/searchd.log\n pid_file = /tmp/searchd.pid\n data_dir = /tmp/data\n watchdog = 0\n}" > /tmp/116.conf +echo -e "searchd {\n listen = 9306:mysql\n listen = 9316\n log = /tmp/searchd.log\n pid_file = /tmp/searchd.pid\n data_dir = /tmp/data\n watchdog = 0\n}" > /tmp/watchdog-off.conf ––– output ––– ––– input ––– -mkdir -p /tmp/data; rm -f /tmp/searchd.log; searchd --stopwait > /dev/null; searchd -c /tmp/116.conf; if timeout 10 grep -qm1 '\[BUDDY\] started' <(tail -n 1000 -f /tmp/searchd.log); then echo 'Buddy started!'; else echo 'Timeout or failed!'; cat /tmp/searchd.log;fi +mkdir -p /tmp/data; rm -f /tmp/searchd.log; searchd --stopwait > /dev/null; searchd -c /tmp/watchdog-off.conf; if timeout 10 grep -qm1 '\[BUDDY\] started' <(tail -n 1000 -f /tmp/searchd.log); then echo 'Buddy started!'; else echo 'Timeout or failed!'; cat /tmp/searchd.log;fi ––– output ––– Manticore %{SEMVER} %{COMMITDATE}#!/(\sdev)?\s/!#(columnar %{SEMVER} %{COMMITDATE}) (secondary %{SEMVER} %{COMMITDATE}) (knn %{SEMVER} %{COMMITDATE}) Copyright (c) 2001-2016, Andrew Aksyonoff Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com) Copyright (c) 2017-%{YEAR}, Manticore Software LTD (https://manticoresearch.com) -[#!/[0-9]{2}:[0-9]{2}.[0-9]{3}/!#] [#!/[0-9]+/!#] using config file '/tmp/116.conf' (%{NUMBER} chars)... +[#!/[0-9]{2}:[0-9]{2}.[0-9]{3}/!#] [#!/[0-9]+/!#] using config file '/tmp/watchdog-off.conf' (%{NUMBER} chars)... starting daemon version '%{SEMVER} %{COMMITDATE}#!/(\sdev)?\s/!#(columnar %{SEMVER} %{COMMITDATE}) (secondary %{SEMVER} %{COMMITDATE}) (knn %{SEMVER} %{COMMITDATE})' ... -listening on all interfaces for mysql, port=9315 +listening on all interfaces for mysql, port=9306 listening on all interfaces for sphinx and http(s), port=9316 Buddy started! ––– input ––– -mysql -P9315 -h0 -e "DROP TABLE IF EXISTS t; CREATE TABLE t(id INT, s STRING);" +mysql -P9306 -h0 -e "DROP TABLE IF EXISTS t;"; rm -rf /tmp/data/t; mysql -P9306 -h0 -e "CREATE TABLE t(id INT, s STRING);" ––– output ––– ––– input ––– -for n in `seq 1 100000`; do echo "INSERT INTO t VALUES($n, 'a');" >> /tmp/insert.sql; done; mysql -P9315 -h0 < /tmp/insert.sql; mysql -P9315 -h0 -e "FLUSH RAMCHUNK t;" +for n in `seq 1 100000`; do echo "INSERT INTO t VALUES($n, 'a');" >> /tmp/insert.sql; done; mysql -P9306 -h0 < /tmp/insert.sql; mysql -P9306 -h0 -e "FLUSH RAMCHUNK t;" ––– output ––– ––– input ––– -mysql -P9315 -h0 -e "SELECT COUNT(*) AS total FROM t;" +mysql -P9306 -h0 -e "SELECT COUNT(*) FROM t;" ––– output ––– -+---------+ -| total | -+---------+ -| 100000 | -+---------+ ++----------+ +| count(*) | ++----------+ +| 100000 | ++----------+ ––– input ––– -rm -f /tmp/update.sql; for n in `seq 1 100000`; do echo "UPDATE t SET s='b' WHERE id=$n;" >> /tmp/update.sql; done; (for i in `seq 1 10`; do mysql -P9315 -h0 < /tmp/update.sql; done) & UPDATE_PID=$! +rm -f /tmp/update.sql; for n in `seq 1 100`; do echo "UPDATE t SET s='b' WHERE id=$n;" >> /tmp/update.sql; done; while true; do mysql -P9306 -h0 < /tmp/update.sql; done & UPDATE_PID=$! ––– output ––– +[%{NUMBER}] %{NUMBER} ––– input ––– -sleep 5; mysql -P9315 -h0 -e "SELECT COUNT(*) AS updates FROM t WHERE s='b';" -––– output ––– -+---------+ -| updates | -+---------+ -| 100000 | -+---------+ -––– input ––– -kill $UPDATE_PID; wait $UPDATE_PID 2>/dev/null -––– output ––– -––– input ––– -mysql -P9315 -h0 -e "SELECT * FROM t LIMIT 5;" -––– output ––– -+------+------+ -| id | s | -+------+------+ -| 1 | b | -| 2 | b | -| 3 | b | -| 4 | b | -| 5 | b | -+------+------+ -––– input ––– -mysql -P9315 -h0 -e "freeze t" +sleep 1; mysql -P9306 -h0 -e "freeze t" ––– output ––– +------------------------+------------------------+ | file | normalized | @@ -75,24 +53,11 @@ mysql -P9315 -h0 -e "freeze t" | /tmp/data/t/t.settings | /tmp/data/t/t.settings | +------------------------+------------------------+ ––– input ––– -mysql -P9315 -h0 -e "unfreeze t"; echo $? -––– output ––– -0 -––– input ––– -mysql -P9315 -h0 -e "DESCRIBE t" -––– output ––– -+-------+--------+------------+ -| Field | Type | Properties | -+-------+--------+------------+ -| id | bigint | | -| s | string | | -+-------+--------+------------+ -––– input ––– -mysql -P9315 -h0 -e "UPDATE t SET s='с' WHERE id=1; FLUSH RAMCHUNK t"; echo $? +sleep 1; kill $UPDATE_PID; wait $UPDATE_PID 2>/dev/null; mysql -P9306 -h0 -e "unfreeze t"; echo $? ––– output ––– 0 ––– input ––– -(sleep 1; mysql -P9315 -h0 -e "drop table if exists t; create table t(a string); insert into t values(1, 'a'); flush ramchunk t; freeze t"; mysql -P9315 -h0 -e "update t set a='b' where id = 1" 2>&1 &) +(sleep 1; mysql -P9306 -h0 -e "drop table if exists t;" && mysql -P9306 -h0 -e "CREATE TABLE t(a string); insert into t values(1, 'a'); flush ramchunk t; freeze t"; mysql -P9306 -h0 -e "update t set a='b' where id = 1" 2>&1 &) ––– output ––– +------------------------+------------------------+ | file | normalized | @@ -112,10 +77,11 @@ mysql -P9315 -h0 -e "UPDATE t SET s='с' WHERE id=1; FLUSH RAMCHUNK t"; echo $? | /tmp/data/t/t.settings | /tmp/data/t/t.settings | +------------------------+------------------------+ ––– input ––– -sleep 1; mysql -P9315 -h0 -e "select * from t;" +if timeout 5 mysql -P9306 -h0 -e 'SELECT * FROM t'; then echo 'Query executed'; else echo 'Query not executed'; fi ––– output ––– +------+------+ | id | a | +------+------+ | 1 | a | +------+------+ +Query executed