manticoresoftware / manticoresearch-backup

Repository for Manticore Search backup scripts
GNU General Public License v3.0
3 stars 1 forks source link

Restore particular tables #58

Open sanikolaev opened 1 year ago

sanikolaev commented 1 year ago

It would be great to be able to restore a particular table. IMPORT can be automated for that, e.g.:

root@bb5278967f62:/# mysql -P9306 -h0 -e "insert into t(f) values('abc'); flush ramchunk t;"
root@bb5278967f62:/# mysql -P9306 -h0 -e "insert into t2(f) values('abc'); flush ramchunk t2;"
root@bb5278967f62:/# mysql -P9306 -h0 -e "backup table t to /tmp/"
+----------------------------+
| Path                       |
+----------------------------+
| /tmp/backup-20230222140126 |
+----------------------------+
root@bb5278967f62:/# mysql -P9306 -h0 -e "drop table t"
root@bb5278967f62:/# mysql -P9306 -h0 -e "import table t from '/tmp/backup-20230222140126/data/t/t'"
root@bb5278967f62:/# mysql -P9306 -h0 -e "select * from t"
+---------------------+------+
| id                  | f    |
+---------------------+------+
| 4901936465623121921 | abc  |
+---------------------+------+

UPDATE Jan 19th 2024

For the sake of data safety and high availabiliy it makes sense to:

This should protect from losing the table in the middle of importing a table due to an instance shutdown or smth else.

Let's also add support for wildcards in --tables, so

We'll also need to cover the new functionality with CLT tests.