Skip to content

Commit

Permalink
Tests: make sure all tables files are backed up (#104)
Browse files Browse the repository at this point in the history
Co-authored-by: Pavel_Shilin <[email protected]>
  • Loading branch information
PavelShilin89 and Pavel_Shilin authored Feb 26, 2024
1 parent e5ea97f commit f2b89f3
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 7 deletions.
45 changes: 45 additions & 0 deletions tests/backup-all-ok.rec
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ mysql -h0 -P9306 -e 'show tables'
| distributed_index | distributed |
| rt_with_columnar | rt |
| rt_without_columnar | rt |
| test | rt |
+---------------------+-------------+
––– input –––
mysql -h0 -P9306 -e 'show create table distributed_index'
Expand Down Expand Up @@ -55,6 +56,28 @@ ls -lt /tmp/backup-*
––– output –––
ls: cannot access '/tmp/backup-*': No such file or directory
––– input –––
mysql -h0 -P9306 -e "flush ramchunk test; select * from test.@files;"
––– output –––
+------+---------------------------------------+---------------------------------------+--------+
| id | file | normalized | size |
+------+---------------------------------------+---------------------------------------+--------+
| 2 | /var/lib/manticore/test/test.settings | /var/lib/manticore/test/test.settings | 3 |
| 3 | /var/lib/manticore/test/test.0.sph | /var/lib/manticore/test/test.0.sph | 715 |
| 4 | /var/lib/manticore/test/test.0.spd | /var/lib/manticore/test/test.0.spd | 20 |
| 5 | /var/lib/manticore/test/test.0.spp | /var/lib/manticore/test/test.0.spp | 1 |
| 6 | /var/lib/manticore/test/test.0.spe | /var/lib/manticore/test/test.0.spe | 1 |
| 7 | /var/lib/manticore/test/test.0.spi | /var/lib/manticore/test/test.0.spi | 59 |
| 8 | /var/lib/manticore/test/test.0.spm | /var/lib/manticore/test/test.0.spm | 4 |
| 9 | /var/lib/manticore/test/test.0.sphi | /var/lib/manticore/test/test.0.sphi | 82 |
| 10 | /var/lib/manticore/test/test.0.spds | /var/lib/manticore/test/test.0.spds | 64 |
| 11 | /var/lib/manticore/test/test.0.spknn | /var/lib/manticore/test/test.0.spknn | 456 |
| 12 | /var/lib/manticore/test/test.0.spt | /var/lib/manticore/test/test.0.spt | 41 |
| 13 | /var/lib/manticore/test/test.0.spidx | /var/lib/manticore/test/test.0.spidx | 309 |
| 14 | /var/lib/manticore/test/test.0.spa | /var/lib/manticore/test/test.0.spa | 96 |
| 15 | /var/lib/manticore/test/test.0.spb | /var/lib/manticore/test/test.0.spb | 131116 |
| 1 | /var/lib/manticore/test/test.meta | /var/lib/manticore/test/test.meta | 741 |
+------+---------------------------------------+---------------------------------------+--------+
––– input –––
manticore-backup --backup-dir=/tmp
––– output –––
Copyright (c) %{YEAR}-%{YEAR}, Manticore Software LTD (https://manticoresearch.com)
Expand All @@ -81,6 +104,8 @@ buddy: %{SEMVER}
%{DATETIME} [Info] OK
%{DATETIME} [Info] rt_without_columnar (rt) [2.789K]...
%{DATETIME} [Info] OK
%{DATETIME} [Info] test (rt) [130.574K]...
%{DATETIME} [Info] OK
%{DATETIME} [Info] Running sync
%{DATETIME} [Info] OK
%{DATETIME} [Info] You can find backup here: /tmp/backup-#!/[0-9]{14}/!#
Expand All @@ -94,6 +119,8 @@ Unfreezing all tables...
%{DATETIME} [Info] OK
%{DATETIME} [Info] rt_without_columnar...
%{DATETIME} [Info] OK
%{DATETIME} [Info] test...
%{DATETIME} [Info] OK
––– input –––
ls -lh /tmp/backup-*
––– output –––
Expand All @@ -102,3 +129,21 @@ total 16K
%{FILEPERMS} %{NUMBER} root root 4.0K #!/[a-zA-Z]{3}/!# #!/[0-9]{1,2}/!# #!/[0-9]{2}:[0-9]{2}/!# data
%{FILEPERMS} %{NUMBER} root root 4.0K #!/[a-zA-Z]{3}/!# #!/[0-9]{1,2}/!# #!/[0-9]{2}:[0-9]{2}/!# state
%{FILEPERMS} %{NUMBER} root root %{NUMBER} #!/[a-zA-Z]{3}/!# #!/[0-9]{1,2}/!# #!/[0-9]{2}:[0-9]{2}/!# versions.json
––– input –––
ls -1v /tmp/backup-*/data/test/
––– output –––
test.meta
test.settings
test.0.spa
test.0.spb
test.0.spd
test.0.spds
test.0.spe
test.0.sph
test.0.sphi
test.0.spi
test.0.spidx
test.0.spknn
test.0.spm
test.0.spp
test.0.spt
1 change: 1 addition & 0 deletions tests/backup-fails.rec
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ mysql -h0 -P9306 -e 'show tables'
| distributed_index | distributed |
| rt_with_columnar | rt |
| rt_without_columnar | rt |
| test | rt |
+---------------------+-------------+
––– input –––
mysql -h0 -P9306 -e 'show create table distributed_index'
Expand Down
13 changes: 10 additions & 3 deletions tests/backup-restore-ok.rec
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ mysql -h0 -P9306 -e 'show tables'
| distributed_index | distributed |
| rt_with_columnar | rt |
| rt_without_columnar | rt |
| test | rt |
+---------------------+-------------+
––– input –––
manticore-backup --backup-dir=/tmp
Expand Down Expand Up @@ -37,10 +38,12 @@ buddy: %{SEMVER}
%{DATETIME} [Info] OK
%{DATETIME} [Info] rt_without_columnar (rt) [2.789K]...
%{DATETIME} [Info] OK
%{DATETIME} [Info] test (rt) [956B]...
%{DATETIME} [Info] OK
%{DATETIME} [Info] Running sync
%{DATETIME} [Info] OK
%{DATETIME} [Info] You can find backup here: /tmp/backup-#!/[0-9]{14}/!#
%{DATETIME} [Info] Elapsed time: #!/[0-9]+/!#.#!/[0-9]+/!#s
%{DATETIME} [Info] You can find backup here: /tmp/backup-%{NUMBER}
%{DATETIME} [Info] Elapsed time: #!/([0-9]+\.[0-9]+|0)/!#s
%{DATETIME} [Info] Done
%{DATETIME} [Info]
Unfreezing all tables...
Expand All @@ -50,6 +53,8 @@ Unfreezing all tables...
%{DATETIME} [Info] OK
%{DATETIME} [Info] rt_without_columnar...
%{DATETIME} [Info] OK
%{DATETIME} [Info] test...
%{DATETIME} [Info] OK
––– input –––
mv /tmp/backup-* /tmp/backup-111
––– output –––
Expand Down Expand Up @@ -138,8 +143,9 @@ listening on %{IPADDR}:9306 for mysql
listening on %{IPADDR}:9308 for sphinx and http(s)
precaching table 'rt_with_columnar'
precaching table 'rt_without_columnar'
precaching table 'test'
WARNING: table 'distributed_index': ha_strategy defined, but no ha agents in the table
precached 2 tables in 0.#!/[0-9]{3}/!# sec
precached 3 tables in #!/([0-9]+\.[0-9]+|0)/!# sec
––– input –––
mysql -h0 -P9306 -e 'show tables'
––– output –––
Expand All @@ -149,4 +155,5 @@ mysql -h0 -P9306 -e 'show tables'
| distributed_index | distributed |
| rt_with_columnar | rt |
| rt_without_columnar | rt |
| test | rt |
+---------------------+-------------+
8 changes: 6 additions & 2 deletions tests/backup-shebang-config-ok.rec
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ buddy: %{SEMVER}
%{DATETIME} [Info] OK
%{DATETIME} [Info] rt_without_columnar (rt) [2.789K]...
%{DATETIME} [Info] OK
%{DATETIME} [Info] test (rt) [956B]...
%{DATETIME} [Info] OK
%{DATETIME} [Info] Running sync
%{DATETIME} [Info] OK
%{DATETIME} [Info] You can find backup here: /tmp/backup-#!/[0-9]{14}/!#
%{DATETIME} [Info] Elapsed time: #!/[0-9]+/!#.#!/[0-9]+/!#s
%{DATETIME} [Info] You can find backup here: /tmp/backup-%{NUMBER}
%{DATETIME} [Info] Elapsed time: #!/([0-9]+\.[0-9]+|0)/!#s
%{DATETIME} [Info] Done
%{DATETIME} [Info]
Unfreezing all tables...
Expand All @@ -64,6 +66,8 @@ Unfreezing all tables...
%{DATETIME} [Info] OK
%{DATETIME} [Info] rt_without_columnar...
%{DATETIME} [Info] OK
%{DATETIME} [Info] test...
%{DATETIME} [Info] OK
––– input –––
ls -lh /tmp/backup-*
––– output –––
Expand Down
3 changes: 3 additions & 0 deletions tests/backup-single-table-ok.rec
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ mysql -h0 -P9306 -e 'show tables'
| distributed_index | distributed |
| rt_with_columnar | rt |
| rt_without_columnar | rt |
| test | rt |
+---------------------+-------------+
––– input –––
mysql -h0 -P9306 -e 'show create table distributed_index'
Expand Down Expand Up @@ -88,6 +89,8 @@ Unfreezing all tables...
%{DATETIME} [Info] OK
%{DATETIME} [Info] rt_without_columnar...
%{DATETIME} [Info] OK
%{DATETIME} [Info] test...
%{DATETIME} [Info] OK
––– input –––
ls -lh /tmp/backup-*
––– output –––
Expand Down
7 changes: 5 additions & 2 deletions tests/backup-works-with-max-connections.rec
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ mysql -h0 -P9307 -e 'show tables'
| distributed_index | distributed |
| rt_with_columnar | rt |
| rt_without_columnar | rt |
| test | rt |
+---------------------+-------------+
––– input –––
mysql -h0 -P9307 -e 'show create table distributed_index'
Expand Down Expand Up @@ -106,10 +107,12 @@ buddy: %{SEMVER}
%{DATETIME} [Info] OK
%{DATETIME} [Info] rt_without_columnar (rt) [2.789K]...
%{DATETIME} [Info] OK
%{DATETIME} [Info] test (rt) [956B]...
%{DATETIME} [Info] OK
%{DATETIME} [Info] Running sync
%{DATETIME} [Info] OK
%{DATETIME} [Info] You can find backup here: /tmp/backup-#!/[0-9]{14}/!#
%{DATETIME} [Info] Elapsed time: #!/[0-9]+/!#.#!/[0-9]+/!#s
%{DATETIME} [Info] You can find backup here: /tmp/backup-%{NUMBER}
%{DATETIME} [Info] Elapsed time: #!/([0-9]+\.[0-9]+|0)/!#s
%{DATETIME} [Info] Done
––– input –––
ls -lh /tmp/backup-*
Expand Down
6 changes: 6 additions & 0 deletions tests/dumps/tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ CREATE TABLE rt_without_columnar (
attributes JSON
);

CREATE TABLE test ( title text, image_vector float_vector knn_type='hnsw' knn_dims='4' hnsw_similarity='l2' );

-- table distributed_index
CREATE TABLE distributed_index type='distributed' local='rt_with_columnar, rt_without_columanr' AGENT='127.0.0.1:9312:plain_with_columnar, plain_without_columnar';

Expand Down Expand Up @@ -54,3 +56,7 @@ INSERT INTO rt_without_columnar (id, title, category_id, price, description, tag
(11, 'Manticore Backpack', 7, 49.99, 'Spacious Manticore Backpack', (201, 202), '{"color": "black", "capacity": "20L"}'),
(12, 'Manticore Phone Case', 8, 15.99, 'Protective Manticore Phone Case', (201, 203), '{"color": "clear", "model": "iPhone 13"}'),
(13, 'Manticore Socks', 1, 7.99, 'Comfy Manticore Socks', (202, 204), '{"color": "white", "size": "M"}');

INSERT INTO test VALUES
( 1, 'yellow bag', (0.653448,0.192478,0.017971,0.339821) ),
( 2, 'white bag', (0.148894,0.748278,0.091892,0.095406) );

0 comments on commit f2b89f3

Please sign in to comment.