Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SELECT does not wait for FREEZE + UPDATE #2805

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

PavelShilin89
Copy link
Contributor

Type of Change (select one):

  • Bug fix - There was a problem, when you update the blob attribute in a frozen table that has at least one chunk of RAM, any subsequent SELECT query will wait until the table is unfrozen before it can read from it.

Description of the Change:

  • SELECT works correctly without waiting for the table to unfreeze.

Related Issue (provide the link):

Copy link

github-actions bot commented Dec 2, 2024

clt

👎 CLT tests in test/clt-tests/core/ test/clt-tests/expected-errors/
✅ OK: 27
❌ Failed: 1
⏳ Duration: 343s
👉 Check Action Results for commit 649b356
Failed tests:

test/clt-tests/core/test-freeze-unfreeze-update.rec
––– 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
––– 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
––– 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)...
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 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 $?
––– output –––
0
––– input –––
mysql -P9315 -h0 -e "select * from 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; while true; do mysql -P9315 -h0 < /tmp/update.sql | break; done &
––– output –––
[#!/[0-9]{1}/!#] %{NUMBER}
––– input –––
sleep 30; mysql -P9315 -h0 -e "select * from t;"
––– output –––
+------+------+
| id   | s    |
+------+------+
|    1 | b    |
+------+------+
––– input –––
stdbuf -oL mysql -P9315 -h0 -e "freeze 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.ram      | /tmp/data/t/t.ram      |
| /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 $?
––– 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 –––
-
+ ERROR 1064 (42000) at line 1: error adding table 't': directory is not empty: /tmp/data/t
+ ERROR 1064 (42000) at line 1: unknown local table(s) 't' in search request
+ [2]+  Exit 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;"
+

@PavelShilin89 PavelShilin89 requested review from sanikolaev and removed request for klirichek December 2, 2024 12:17
Copy link

github-actions bot commented Dec 8, 2024

Windows test results

  3 files    3 suites   19m 27s ⏱️
994 tests 944 ✅ 50 💤 0 ❌
998 runs  948 ✅ 50 💤 0 ❌

Results for commit b891398.

♻️ This comment has been updated with latest results.

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 -P9306 -h0 -e "DROP TABLE IF EXISTS t;"; rm -rf /tmp/data/t; mysql -P9306 -h0 -e "CREATE TABLE t(id INT, s STRING);"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm -rf /tmp/data/t doesn't make sense to me here. If a table requires rm after drop, it's a bug. If you can reproduce it - pls create an issue about it. If it's not the case - what's the rm for?

––– input –––
sleep 30; mysql -P9315 -h0 -e "select * from t;"
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=$!
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm -f /tmp/update.sql seems redundant.

@@ -59,19 +53,35 @@ stdbuf -oL mysql -P9315 -h0 -e "freeze t"
| /tmp/data/t/t.settings | /tmp/data/t/t.settings |
+------------------------+------------------------+
––– input –––
mysql -P9315 -h0 -e "unfreeze t"; echo $?
sleep 1; kill $UPDATE_PID; wait $UPDATE_PID 2>/dev/null; mysql -P9306 -h0 -e "unfreeze t"; echo $?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you stop the update load before unfreezing?

––– input –––
mysql -P9315 -h0 -e "UPDATE t SET s='с' WHERE id=1; FLUSH RAMCHUNK t"; echo $?
if timeout 5 mysql -P9306 -h0 -e 'SELECT * FROM t'; then echo 'Query executed'; else echo 'Query not executed'; fi
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you make sure it failed on the version before the fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants