-
-
Notifications
You must be signed in to change notification settings - Fork 490
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
Update optimize #2530
Merged
Merged
Update optimize #2530
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`debug pause 'name' on` `debug pause 'name' off` solely for development When named pause is 'on', call to PauseCheck("name") will sleep until pause is release with 'off'. That is true sleep, without switching coroutine context. During pause you can perform otherwise seldom actions
Narrow case is: update grabs snapshot of RAM segments, then merge segments happens, and remove segments with updatable docs into new one (merged). Then update resumes and vanishes, as segments in snapshot are no more belong to current index.
That is - we don't perform whole optimize action with r-locked index, but instead just start the action and return. That unlock blob updates, as they no more wait whole optimize action finished. That is related to #2361 (1-st subtask). Notice, it doesn't work for optimize... sync=1.
to be called from r-locked area to determine if the only w-lock is waiting now
That is, request for update during running optimize pass will be injected into running merge instead of waiting the last for completed. That eliminates blocking of updates by optimize. However, that is not the final commit; some checks also need to be performed first. That is related to #2361 (2-nd subtask)
That is, if update happened over already passed part of a chunk - it was lost in final merged chunk
clt👎 CLT tests in test/clt-tests/core/test-skipping-plugin-loading.rec––– input –––
rm -f /var/log/manticore/searchd.log; searchd --stopwait > /dev/null; searchd; if timeout 10 grep -qm1 '\[BUDDY\] started' <(tail -n 1000 -f /var/log/manticore/searchd.log); then echo 'Buddy started!'; else echo 'Timeout or failed!'; cat /var/log/manticore/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 '/etc/manticoresearch/manticore.conf' (%{NUMBER} chars)...
starting daemon version '%{SEMVER} %{COMMITDATE}#!/(\sdev)?\s/!#(columnar %{SEMVER} %{COMMITDATE}) (secondary %{SEMVER} %{COMMITDATE}) (knn %{SEMVER} %{COMMITDATE})' ...
listening on %{IPADDR}:9312 for sphinx and http(s)
listening on %{IPADDR}:9306 for mysql
listening on %{IPADDR}:9308 for sphinx and http(s)
Buddy started!
––– input –––
mysql -h0 -P9306 -e "SHOW BUDDY PLUGINS\G;" | grep "manticoresoftware/buddy-plugin-replace"
––– output –––
Package: manticoresoftware/buddy-plugin-replace
––– input –––
mysql -h0 -P9306 -e "DROP TABLE IF EXISTS tbl;"
––– output –––
––– input –––
mysql -h0 -P9306 -e "CREATE TABLE tbl (id BIGINT, model TEXT, storage_capacity INTEGER, color string, release_year INTEGER, price FLOAT, discounted_price FLOAT, sold BOOL, date_added TIMESTAMP, product_codes MULTI, values MULTI64, additional_info JSON, vector float_vector knn_type='hnsw' knn_dims='4' hnsw_similarity='l2');"
––– output –––
––– input –––
mysql -h0 -P9306 -e "SHOW TABLES;"
––– output –––
+-------+------+
| Index | Type |
+-------+------+
| tbl | rt |
+-------+------+
––– input –––
./test/clt-tests/scripts/generate-1mln-records.sh 1000
––– output –––
+-------+------+
| Index | Type |
+-------+------+
| tbl | rt |
+-------+------+
+----------+
| count(*) |
+----------+
| 1000 |
+----------+
––– input –––
mysql -h0 -P9306 -e "REPLACE INTO tbl SET model ='iPhone 15 PRO' WHERE id = 101; SELECT * FROM tbl WHERE id = 101\G"
––– output –––
*************************** 1. row ***************************
id: 101
model: iPhone 15 PRO
storage_capacity: 256
color: silver
release_year: 2021
price: 1099.989990
discounted_price: 989.989990
sold: 1
date_added: 2224442480
product_codes: 1,2,3
values: 523456764345678976,9223372036854775807
additional_info: {"features":["ProMotion display","A15 Bionic chip","Ceramic Shield front cover"]}
vector: 0.773448,0.312478,0.137971,0.459821
––– input –––
searchd --stopwait
––– 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 '/etc/manticoresearch/manticore.conf' (%{NUMBER} chars)...
[#!/[0-9]{2}:[0-9]{2}.[0-9]{3}/!#] [#!/[0-9]+/!#] stop: successfully sent SIGTERM to pid %{NUMBER}
––– input –––
sed -i '/data_dir = \/var\/lib\/manticore/a\ buddy_path = manticore-executor -n /usr/share/manticore/modules/manticore-buddy/src/main.php --debugv --skip=manticoresoftware/buddy-plugin-replace' /etc/manticoresearch/manticore.conf
––– output –––
––– input –––
rm -f /var/log/manticore/searchd.log; searchd --stopwait > /dev/null; searchd | grep -v precach; if timeout 10 grep -qm1 '\[BUDDY\] started' <(tail -n 1000 -f /var/log/manticore/searchd.log); then echo 'Buddy started!'; else echo 'Timeout or failed!'; cat /var/log/manticore/searchd.log;fi
––– output –––
- [#!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!#] [%{NUMBER}] using config file '%{PATH}' (%{NUMBER} chars)...
+ [Mon Sep 2 08:16:50.165 2024] [64] using config file '/etc/manticoresearch/manticore.conf' (425 chars)...
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)
starting daemon version '%{SEMVER} %{COMMITDATE}#!/(\sdev)?\s/!#(columnar %{SEMVER} %{COMMITDATE}) (secondary %{SEMVER} %{COMMITDATE}) (knn %{SEMVER} %{COMMITDATE})' ...
listening on 127.0.0.1:9312 for sphinx and http(s)
listening on 127.0.0.1:9306 for mysql
listening on 127.0.0.1:9308 for sphinx and http(s)
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)
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)
Buddy started!
––– input –––
mysql -h0 -P9306 -e "REPLACE INTO tbl SET price =15000.99 WHERE id = 117; select * from tbl WHERE id = 117;"
––– output –––
ERROR 1064 (42000) at line 1: P01: syntax error, unexpected SET, expecting VALUES near 'SET price =15000.99 WHERE id = 117'
––– input –––
mysql -h0 -P9306 -e "SHOW BUDDY PLUGINS\G;" | grep "manticoresoftware/buddy-plugin-replace"
––– output –––
––– input –––
mysql -h0 -P9306 -e "SHOW BUDDY PLUGINS\G;" | grep "manticoresoftware/buddy-plugin-alter-rename-table"
––– output –––
Package: manticoresoftware/buddy-plugin-alter-rename-table
––– input –––
mysql -h0 -P9306 -e "CREATE TABLE index2001(f text, s string); insert into index2001 values(01,'abc','string');"
––– output –––
––– input –––
mysql -h0 -P9306 -e "SHOW TABLES"
––– output –––
+-----------+------+
| Index | Type |
+-----------+------+
| index2001 | rt |
| tbl | rt |
+-----------+------+
––– input –––
mysql -h0 -P9306 -e "ALTER TABLE index2001 RENAME new_index2001;"
––– output –––
––– input –––
mysql -h0 -P9306 -e "SHOW TABLES"
––– output –––
+---------------+------+
| Index | Type |
+---------------+------+
| new_index2001 | rt |
| tbl | rt |
+---------------+------+
––– input –––
searchd --stopwait
––– 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 '/etc/manticoresearch/manticore.conf' (%{NUMBER} chars)...
[#!/[0-9]{2}:[0-9]{2}.[0-9]{3}/!#] [#!/[0-9]+/!#] stop: successfully sent SIGTERM to pid %{NUMBER}
––– input –––
sed -i '/buddy_path =/c\ buddy_path = manticore-executor -n /usr/share/manticore/modules/manticore-buddy/src/main.php --debugv --skip=manticoresoftware/buddy-plugin-alter-rename-table --skip=manticoresoftware/buddy-plugin-replace' /etc/manticoresearch/manticore.conf
––– output –––
––– input –––
rm -f /var/log/manticore/searchd.log; searchd --stopwait > /dev/null; searchd | grep -v precach; if timeout 10 grep -qm1 '\[BUDDY\] started' <(tail -n 1000 -f /var/log/manticore/searchd.log); then echo 'Buddy started!'; else echo 'Timeout or failed!'; cat /var/log/manticore/searchd.log;fi
––– output –––
- [#!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!#] [%{NUMBER}] using config file '%{PATH}' (%{NUMBER} chars)...
+ [Mon Sep 2 08:16:51.256 2024] [103] using config file '/etc/manticoresearch/manticore.conf' (482 chars)...
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)
starting daemon version '%{SEMVER} %{COMMITDATE}#!/(\sdev)?\s/!#(columnar %{SEMVER} %{COMMITDATE}) (secondary %{SEMVER} %{COMMITDATE}) (knn %{SEMVER} %{COMMITDATE})' ...
listening on 127.0.0.1:9312 for sphinx and http(s)
listening on 127.0.0.1:9306 for mysql
listening on 127.0.0.1:9308 for sphinx and http(s)
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)
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)
Buddy started!
––– input –––
mysql -h0 -P9306 -e "SHOW BUDDY PLUGINS\G;" | grep "manticoresoftware/buddy-plugin-alter-rename-table"
––– output –––
––– input –––
mysql -h0 -P9306 -e "ALTER TABLE new_index2001 RENAME new_index2002;"
––– output –––
ERROR 1064 (42000) at line 1: P03: syntax error, unexpected tablename, expecting '=' near 'new_index2002'
––– input –––
mysql -h0 -P9306 -e "SHOW TABLES"
––– output –––
+---------------+------+
| Index | Type |
+---------------+------+
| new_index2001 | rt |
| tbl | rt |
+---------------+------+
––– input –––
searchd --stopwait
––– 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 '/etc/manticoresearch/manticore.conf' (%{NUMBER} chars)...
[#!/[0-9]{2}:[0-9]{2}.[0-9]{3}/!#] [#!/[0-9]+/!#] stop: successfully sent SIGTERM to pid %{NUMBER}
––– input –––
sed -i '/buddy_path =/c\ buddy_path = manticore-executor -n /usr/share/manticore/modules/manticore-buddy/src/main.php --debugv' /etc/manticoresearch/manticore.conf
––– output –––
––– input –––
rm -f /var/log/manticore/searchd.log; searchd --stopwait > /dev/null; searchd | grep -v precach; if timeout 10 grep -qm1 '\[BUDDY\] started' <(tail -n 1000 -f /var/log/manticore/searchd.log); then echo 'Buddy started!'; else echo 'Timeout or failed!'; cat /var/log/manticore/searchd.log;fi
––– output –––
- [#!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!#] [%{NUMBER}] using config file '%{PATH}' (%{NUMBER} chars)...
+ [Mon Sep 2 08:16:52.355 2024] [137] using config file '/etc/manticoresearch/manticore.conf' (379 chars)...
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)
starting daemon version '%{SEMVER} %{COMMITDATE}#!/(\sdev)?\s/!#(columnar %{SEMVER} %{COMMITDATE}) (secondary %{SEMVER} %{COMMITDATE}) (knn %{SEMVER} %{COMMITDATE})' ...
listening on 127.0.0.1:9312 for sphinx and http(s)
listening on 127.0.0.1:9306 for mysql
listening on 127.0.0.1:9308 for sphinx and http(s)
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)
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)
Buddy started!
––– input –––
mysql -h0 -P9306 -e "SHOW BUDDY PLUGINS\G;" | grep "manticoresoftware/buddy-plugin-alter-rename-table"
––– output –––
Package: manticoresoftware/buddy-plugin-alter-rename-table
––– input –––
mysql -h0 -P9306 -e "ALTER TABLE new_index2001 RENAME new_index2002;"
––– output –––
––– input –––
mysql -h0 -P9306 -e "SHOW TABLES"
––– output –––
+---------------+------+
| Index | Type |
+---------------+------+
| new_index2002 | rt |
| tbl | rt |
+---------------+------+
|
`show table status` now include 'optimizing' key, expressing how many optimize are running right now (typically 1 or 0, but if we implement parallel merging of >2 chunks, it might be >1 also). Documented. Need proofread. That is related to #2361
now we always just start optimization and release the index. If sync=1 is requested, we then periodically (twice a sec) poll when optimizing finished. That is related to #2361
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Branch for work with #2361