manticoresoftware / manticoresearch

Easy to use open source fast database for search | Good alternative to Elasticsearch now | Drop-in replacement for E in the ELK soon
https://manticoresearch.com
GNU General Public License v3.0
9.07k stars 509 forks source link

Make SELECT not wait for FREEZE + UPDATE on blob #2737

Open sanikolaev opened 2 weeks ago

sanikolaev commented 2 weeks ago

Bug Description:

When you update a blob attribute in a frozen table that has at least one RAM chunk, any subsequent SELECT query will wait until the table is unfrozen before it can read from it.

MRE:

➜  ~ mysql -P9306 -h0 -v -e "unfreeze t; 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;" &
[3] 92689
➜  ~ --------------
unfreeze t
--------------

--------------
drop table if exists t
--------------

--------------
create table t(a string)
--------------

--------------
insert into t values(1, 'a')
--------------

--------------
flush ramchunk t
--------------

--------------
freeze t
--------------

+------------------------------------------+------------------------------------------+
| file                                     | normalized                               |
+------------------------------------------+------------------------------------------+
| /opt/homebrew/var/manticore/t/t.0.spa    | /opt/homebrew/var/manticore/t/t.0.spa    |
| /opt/homebrew/var/manticore/t/t.0.spb    | /opt/homebrew/var/manticore/t/t.0.spb    |
| /opt/homebrew/var/manticore/t/t.0.spd    | /opt/homebrew/var/manticore/t/t.0.spd    |
| /opt/homebrew/var/manticore/t/t.0.spe    | /opt/homebrew/var/manticore/t/t.0.spe    |
| /opt/homebrew/var/manticore/t/t.0.sph    | /opt/homebrew/var/manticore/t/t.0.sph    |
| /opt/homebrew/var/manticore/t/t.0.sphi   | /opt/homebrew/var/manticore/t/t.0.sphi   |
| /opt/homebrew/var/manticore/t/t.0.spi    | /opt/homebrew/var/manticore/t/t.0.spi    |
| /opt/homebrew/var/manticore/t/t.0.spidx  | /opt/homebrew/var/manticore/t/t.0.spidx  |
| /opt/homebrew/var/manticore/t/t.0.spm    | /opt/homebrew/var/manticore/t/t.0.spm    |
| /opt/homebrew/var/manticore/t/t.0.spp    | /opt/homebrew/var/manticore/t/t.0.spp    |
| /opt/homebrew/var/manticore/t/t.0.spt    | /opt/homebrew/var/manticore/t/t.0.spt    |
| /opt/homebrew/var/manticore/t/t.meta     | /opt/homebrew/var/manticore/t/t.meta     |
| /opt/homebrew/var/manticore/t/t.settings | /opt/homebrew/var/manticore/t/t.settings |
+------------------------------------------+------------------------------------------+
--------------
update t set a='b' where id = 1
--------------

➜  ~ mysql -P9306 -h0 -e "select * from t"
# waits here

Manticore Search Version:

Manticore 6.3.7 6aa68659d@24102222 dev (columnar 2.3.1 30ad2d6@24100914) (secondary 2.3.1 30ad2d6@24100914) (knn 2.3.1 30ad2d6@24100914)

Operating System Version:

macos

Have you tried the latest development version?

No

Internal Checklist:

To be completed by the assignee. Check off tasks that have been completed or are not applicable.

- [ ] Implementation completed - [ ] Tests developed - [ ] Documentation updated - [ ] Documentation reviewed - [ ] [Changelog](https://docs.google.com/spreadsheets/d/1mz_3dRWKs86FjRF7EIZUziUDK_2Hvhd97G0pLpxo05s/edit?pli=1&gid=1102439133) updated