|
2 | 2 | -SKIP_IN_MEM
|
3 | 3 | --
|
4 | 4 |
|
5 |
| --CASE FSMInfoRecovery |
6 |
| -# TODO(Royi) enable this test once FSM works on dropped tables |
7 |
| --SKIP |
| 5 | +-CASE FSMReuseFreePageForNewNodeGroup |
| 6 | +-STATEMENT create node table person(value uint64, primary key (value)); |
| 7 | +---- ok |
| 8 | +-STATEMENT call threads=1 |
| 9 | +---- ok |
8 | 10 | -STATEMENT call checkpoint_threshold=0
|
9 | 11 | ---- ok
|
10 |
| --STATEMENT create node table person(id int64, primary key (id)) |
| 12 | +-STATEMENT COPY person FROM (unwind range(1, 200000) as i return 1000000000 * i) |
11 | 13 | ---- ok
|
12 |
| --STATEMENT create (:person{id: 0}), (:person{id: 1}) |
| 14 | +# fill up the last node group, make sure to trigger recompression |
| 15 | +-STATEMENT copy person from ( |
| 16 | + call storage_info('person') where node_group_id = 0 with num_values as node_group_capacity limit 1 |
| 17 | + call storage_info('person') where data_type = 'UINT64' with node_group_capacity, cast(max as uint64) as max_val, num_values as last_node_group_size order by node_group_id desc limit 1 |
| 18 | + unwind range(1, node_group_capacity - last_node_group_size) as i return max_val + i |
| 19 | +) |
13 | 20 | ---- ok
|
14 |
| -# drop table here |
15 |
| --STATEMENT call fsm_info() return * |
| 21 | +-STATEMENT call fsm_info() return sum(num_pages) > 0 |
| 22 | +---- 1 |
| 23 | +True |
| 24 | +# check that the node groups are all filled |
| 25 | +-STATEMENT call storage_info('person') where node_group_id = 0 with num_values as node_group_capacity limit 1 |
| 26 | + call storage_info('person') return sum(case when num_values <> node_group_capacity then 1 else 0 end) |
16 | 27 | ---- 1
|
17 |
| -0|1 |
18 |
| --RELOADDB |
| 28 | +0 |
| 29 | +# append two values, check that the new node group uses the free page |
| 30 | +-STATEMENT create (:person{value: 1000000000 * 200001 + 1}), (:person{value: 1000000000 * 200001}) |
| 31 | +---- ok |
| 32 | +-STATEMENT call storage_info('person') where data_type = 'UINT64' with max(start_page_idx) as max_start_page_idx |
| 33 | + call storage_info('person') where data_type = 'UINT64' with max_start_page_idx, start_page_idx as last_start_page_idx order by node_group_id desc limit 1 |
| 34 | + return last_start_page_idx < max_start_page_idx |
| 35 | +---- 1 |
| 36 | +True |
| 37 | + |
| 38 | +-CASE FSMReuseFreePageForNewTable |
| 39 | +-STATEMENT create node table person (ID INt64, fName StRING, gender INT64, isStudent BoOLEAN, isWorker BOOLEAN, age INT64, eyeSight DOUBLE, birthdate DATE, registerTime TIMESTAMP, lastJobDuration interval, workedHours INT64[], usedNames STRING[], courseScoresPerTerm INT64[][], grades INT64[4], height float, u UUID, PRIMARY KEY (ID)); |
| 40 | +---- ok |
| 41 | +-STATEMENT create node table person1 (ID INt64, fName StRING, gender INT64, isStudent BoOLEAN, isWorker BOOLEAN, age INT64, eyeSight DOUBLE, birthdate DATE, registerTime TIMESTAMP, lastJobDuration interval, workedHours INT64[], usedNames STRING[], courseScoresPerTerm INT64[][], grades INT64[4], height float, u UUID, PRIMARY KEY (ID)); |
| 42 | +---- ok |
| 43 | +-STATEMENT call threads=1 |
| 44 | +---- ok |
| 45 | +-STATEMENT COPY person FROM "${KUZU_ROOT_DIRECTORY}/dataset/tinysnb/vPerson.csv"; |
| 46 | +---- ok |
| 47 | +# second copy should trigger recompression + free some pages |
| 48 | +-STATEMENT COPY person FROM "${KUZU_ROOT_DIRECTORY}/dataset/tinysnb/vPerson2.csv"; |
| 49 | +---- ok |
| 50 | +-STATEMENT CALL fsm_info() return sum(num_pages) > 0 |
| 51 | +---- 1 |
| 52 | +True |
| 53 | +# copy for new table should reuse the old pages |
| 54 | +-STATEMENT COPY person1 FROM "${KUZU_ROOT_DIRECTORY}/dataset/tinysnb/vPerson.csv"; |
| 55 | +---- ok |
| 56 | +-STATEMENT CALL fsm_info() return * |
| 57 | +---- 0 |
| 58 | + |
| 59 | +-CASE FSMEmptyAfterFirstCopy |
| 60 | +-STATEMENT create node table person (ID INt64, fName StRING, gender INT64, isStudent BoOLEAN, isWorker BOOLEAN, age INT64, eyeSight DOUBLE, birthdate DATE, registerTime TIMESTAMP, lastJobDuration interval, workedHours INT64[], usedNames STRING[], courseScoresPerTerm INT64[][], grades INT64[4], height float, u UUID, PRIMARY KEY (ID)); |
| 61 | +---- ok |
| 62 | +-STATEMENT create rel table knows (FROM person TO person, date DATE, meetTime TIMESTAMP, validInterval INTERVAL, comments STRING[], summary STRUCT(locations STRING[], transfer STRUCT(day DATE, amount INT64[])), notes UNION(firstmet DATE, type INT16, comment STRING), someMap MAP(STRING, STRING), MANY_MAnY); |
| 63 | +---- ok |
| 64 | +-STATEMENT COPY person FROM "${KUZU_ROOT_DIRECTORY}/dataset/tinysnb/vPerson.csv"; |
| 65 | +---- ok |
| 66 | +-STATEMENT COPY knows FROM "${KUZU_ROOT_DIRECTORY}/dataset/tinysnb/eKnows.csv"; |
| 67 | +---- ok |
19 | 68 | -STATEMENT call fsm_info() return *
|
| 69 | +---- 0 |
| 70 | + |
| 71 | +-CASE FSMReclaimRelNewTable |
| 72 | +-STATEMENT CALL threads=1 |
| 73 | +---- ok |
| 74 | +-STATEMENT create node table person (ID INt64, fName StRING, gender INT64, isStudent BoOLEAN, isWorker BOOLEAN, age INT64, eyeSight DOUBLE, birthdate DATE, registerTime TIMESTAMP, lastJobDuration interval, workedHours INT64[], usedNames STRING[], courseScoresPerTerm INT64[][], grades INT64[4], height float, u UUID, PRIMARY KEY (ID)); |
| 75 | +---- ok |
| 76 | +-STATEMENT create rel table knows (FROM person TO person, date DATE, meetTime TIMESTAMP, validInterval INTERVAL, comments STRING[], summary STRUCT(locations STRING[], transfer STRUCT(day DATE, amount INT64[])), notes UNION(firstmet DATE, type INT16, comment STRING), someMap MAP(STRING, STRING), MANY_MAnY); |
| 77 | +---- ok |
| 78 | +-STATEMENT create rel table knows1 (FROM person TO person, date DATE, meetTime TIMESTAMP, validInterval INTERVAL, comments STRING[], summary STRUCT(locations STRING[], transfer STRUCT(day DATE, amount INT64[])), notes UNION(firstmet DATE, type INT16, comment STRING), someMap MAP(STRING, STRING), MANY_MAnY); |
| 79 | +---- ok |
| 80 | +-STATEMENT copy person from ["${KUZU_ROOT_DIRECTORY}/dataset/tinysnb/vPerson.csv", "${KUZU_ROOT_DIRECTORY}/dataset/tinysnb/vPerson2.csv"](ignore_errors=true); |
| 81 | +---- ok |
| 82 | +-STATEMENT call fsm_info() return * |
| 83 | +---- 0 |
| 84 | +-STATEMENT COPY knows FROM "${KUZU_ROOT_DIRECTORY}/dataset/tinysnb/eKnows.csv"; |
| 85 | +---- ok |
| 86 | +# second copy should trigger space reclaiming |
| 87 | +-STATEMENT COPY knows FROM "${KUZU_ROOT_DIRECTORY}/dataset/tinysnb/eKnows_2.csv"; |
| 88 | +---- ok |
| 89 | +-STATEMENT CALL fsm_info() return sum(num_pages) > 0 |
20 | 90 | ---- 1
|
21 |
| -0|1 |
| 91 | +True |
| 92 | +# copying the same initial data to a new table should reuse the same pages |
| 93 | +-STATEMENT COPY knows1 FROM "${KUZU_ROOT_DIRECTORY}/dataset/tinysnb/eKnows.csv"; |
| 94 | +---- ok |
| 95 | +-STATEMENT call fsm_info() return * |
| 96 | +---- 0 |
0 commit comments