-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
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:
- first off
importa table into a temporary table (may take time since we copy the files here) - then if all is ok, truncate the table being restored
- then move chunks from the temporary table to the new one (should be instant as the chunks are in the same data dir and we move them). Use
ATTACHfor that (available for RT since manticoresoftware/manticoresearch@af5812c)
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
--restore --tables=tbl1,tbl2restorestbl1andtbl2--restore --tables=tbl*restores alltbl*. Let's support wildcards%and*
We'll also need to cover the new functionality with CLT tests.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels