manticoresearch icon indicating copy to clipboard operation
manticoresearch copied to clipboard

Missing documentation for ` select * from idx.files`

Open barryhunter opened this issue 2 years ago • 6 comments

In https://github.com/manticoresoftware/manticoresearch/issues/821 sanikolaev said:

use select * from idx.files to get list of index files (it works for plain/pq indexes too)

Wwhere is this documented? Not seen the .files table before? Are there any more of these? Dont find it listed here: https://manual.manticoresearch.com/Listing_indexes Seems it should be documented along side DESCRIBE

Also, seems liek this files listing would be could place to include the modification time too https://github.com/manticoresoftware/manticoresearch/issues/69

Second aside, really liked the single page sphinx documentation page. Could Ctrl-F to find anything. Can't do that with new docs. can sort of grep in the manual/ folder, but it not as convenient.

~/manticoresearch/manual$ find -type f -name "*.md" | xargs grep .files -F

doesn't find anything!

barryhunter avatar Jul 20 '22 12:07 barryhunter

Try use

# mysql --host 127.0.0.1 --port=9306 --prompt='Manticore> ' -e 'show tables;'

Use file listing for this is very bad solution

KarelWintersky avatar Jul 20 '22 12:07 KarelWintersky

That's good for listing the actual indexes. I think the point made in the other thread, is to use this .files table, to get the 'path' to the index files themselves.

mysql> SELECT * FROM testrt.files;
+------+--------------------------------------------------+------+
| id   | file                                             | size |
+------+--------------------------------------------------+------+
|    2 | /var/lib/manticore/data/1/testrt/testrt.ram      |   28 |
|    3 | /var/lib/manticore/data/1/testrt/testrt.settings |    3 |
|    1 | /var/lib/manticore/data/1/testrt/testrt.meta     |  579 |
+------+--------------------------------------------------+------+

Ie ultimately the backup script would be copying

rsync -ra /var/lib/manticore/data/1/testrt/testrt.* /backup/dest1/

sort of thing. this .files query seems a viable way of getting the 'path' to the files. Which otherwise the script will have to parse the 'path' directive, for each index from the config file. (or create one based on data_dir for RT-mode)

barryhunter avatar Jul 20 '22 12:07 barryhunter

RSYNC for backup is one possible strategy.

Personally, it seems to me more efficient and reasonable to generate a SQL file with a sequence

CREATE INDEX + multi-insert

Attached to this file are the word form files used for the index, stemmer settings, configuration files, and so on.

Everything you need for not just a backup, but for deploying an identical copy of the working index from scratch.

KarelWintersky avatar Jul 20 '22 13:07 KarelWintersky

See commit messages for:

db4c7e5f c429d536 da517746 3cdb59d4 (already non-actual) 3b88d616 d28d5cab 6a0ffc72 41415312

d9d42d90

These are not wide-used functions, and they might be changed. That is the reason why they're not documented. However they intended to be more stable than all kinds of 'debug' commands.

klirichek avatar Jul 20 '22 14:07 klirichek

@KarelWintersky that is really a discussion for the original ticket about the backup script. https://github.com/manticoresoftware/manticoresearch/issues/821

... this one, was just about the somewhat hidden function of getting a list of files for a index.

barryhunter avatar Jul 20 '22 14:07 barryhunter

@barryhunter

Second aside, really liked the single page sphinx documentation page. Could Ctrl-F to find anything. Can't do that with new docs. can sort of grep in the manual/ folder, but it not as convenient.

Specially for you - https://manual.manticoresearch.com/?sp=1

sanikolaev avatar Aug 29 '22 09:08 sanikolaev