Debian Codegraph @

test/command/suite/defrag/pat/README.md

raw symbols SCIP
1 # Patricia trie defragmentation: Test cases
2
3 ## Common checkpoints
4
5 * Defragmentation should reduce `total_size`
6 * Test with data that includes the keys immediate=true and immediate=false
7 * immediate=true
8 * Key length is less than or equal to 4 bytes
9 * immediate=false
10 * Key length is greater than or equal to 5 bytes
11
12 ## Reduced of `total_size`
13
14 A simple defragmentation test to check if the size has been reduced.
15
16 * test/command/suite/defrag/pat/multiple_segments/remainder_in_segment.test
17 * Test with big data using multiple segments
18 * Test using the not full area per segment
19 * test/command/suite/defrag/pat/multiple_segments/use_full_segment.test
20 * Test with big data using multiple segments
21 * Test using the full area per segment
22
23 ## Zero data
24
25 If there are zero data, `defrag` should exit normally.
26
27 * test/command/suite/defrag/pat/empty/after_creation.test
28 * Defragmentation on tables with no registration
29 * test/command/suite/defrag/pat/empty/delete_all.test
30 * Defragmentation of a table with zero data after registering and deleting all data
31
32 ## Key buffer overlaps in defragmentation
33
34 * test/command/suite/defrag/pat/area_overlap.test
35 * When defragmenting, it overlaps itself with the area where it was originally located
36
37 Case where "James" is deleted from the "before:" state and the "Jason-TEST" area is overlapped and defragmented.
38
39 ```
40 before: |James|Jason-TEST|..|
41 after : |Jason-TEST|..|
42 ```
43
44 ## Load after `defrag`
45
46 Test if data is successfully added after defragmentation.
47
48 * test/command/suite/defrag/pat/after_load.test
49 * Test reduction with less data
50 * test/command/suite/defrag/pat/multiple_segments/after_load.test
51 * Test with big data using multiple segments
52
53 ## Defragment a few times
54
55 Defragmentation should succeed no matter how many times it is run.
56
57 * test/command/suite/defrag/pat/repeat_load_defrag_delete.test
58
59 ## `_id` reused
60
61 Defragmentation should succeed even if the `_id` is reused.
62
63 * test/command/suite/defrag/pat/reuse_id.test
64
65 FYI:
66 Reuse is a form of reusing a node that has already been deleted.
67 `_id` and key storage for that node is reuse as it is, so the key storage is in `_id` order.
68
69 ## No fragmentation
70
71 Defragmentation on a table with no fragmentation finishes successfully.
72
73 * test/command/suite/defrag/pat/no_fragmentation.test
74
75 ## The garbage is cleared after defragmentation
76
77 To avoid the incorrect reuse of the node, the garbage is cleared during defragmentation.
78 Test whether the garbage was successfully cleared after defragmentation
79 and whether it can be reused successfully after defragmentation.
80
81 ### With node reuse before defragmentation
82
83 All records in the target table are deleted and empty.
84
85 * test/command/suite/defrag/pat/clear_garbage/reuse_before_defrag/emtpy/not_reuse_after_defrag.test
86 * After defragmentation, there is no garbage and no reuse
87 * test/command/suite/defrag/pat/clear_garbage/reuse_before_defrag/emtpy/reuse_after_defrag.test
88 * Even after defragmentation, deleting more than 256 nodes occurs reuse
89
90 A few records remain.
91
92 * test/command/suite/defrag/pat/clear_garbage/reuse_before_defrag/not_reuse_after_defrag.test
93 * After defragmentation, there is no garbage and no reuse
94 * test/command/suite/defrag/pat/clear_garbage/reuse_before_defrag/reuse_after_defrag.test
95 * Even after defragmentation, deleting more than 256 nodes occurs reuse
96
97 ### Without node reuse before defragmentation
98
99 All records in the target table are deleted and empty.
100
101 * test/command/suite/defrag/pat/clear_garbage/no_reuse_before_defrag/emtpy/not_reuse_after_defrag.test
102 * After defragmentation, there is no garbage and no reuse
103 * test/command/suite/defrag/pat/clear_garbage/no_reuse_before_defrag/emtpy/reuse_after_defrag.test
104 * Even after defragmentation, deleting more than 256 nodes occurs reuse
105
106 A few records remain.
107
108 * test/command/suite/defrag/pat/clear_garbage/no_reuse_before_defrag/not_reuse_after_defrag.test
109 * After defragmentation, there is no garbage and no reuse
110 * test/command/suite/defrag/pat/clear_garbage/no_reuse_before_defrag/reuse_after_defrag.test
111 * Even after defragmentation, deleting more than 256 nodes occurs reuse
112
113 ## Overwrite the already created ID
114
115 If the max value of the created `_id` has already been deleted at the time of defragmentation, `_id` can be reused.
116
117 Example:
118
119 `_id=1~10` have been created.
120
121 * If `_id=1,3` have already been deleted
122 * `_id=1,3` cannot be reused
123 * Do not overwrite the already created record ID
124 * If `_id=10` have already been deleted
125 * `_id=10` can be reused
126 * Overwrite the already created ID with 9
127 * Before the overwrite, it was 10
128 * If `_id=9,10` have already been deleted
129 * `_id=9,10` can be reused
130 * Overwrite the already created ID with 8
131 * Before the overwrite, it was 10
132
133 Tests:
134
135 * test/command/suite/defrag/pat/overwrite_curr_rec/empty/after_creation.test
136 * Defragmentation on tables with no registration
137 * Overwrite the already created ID with 0
138 * test/command/suite/defrag/pat/overwrite_curr_rec/empty/delete_all.test
139 * Defragmentation of a table with zero data after registering and deleting all data
140 * Overwrite the already created ID with 0
141 * test/command/suite/defrag/pat/overwrite_curr_rec/max_id_active/immediate.test
142 * The max `_id` is active and will not be overwritten
143 * The max `_id` is immediate=true
144 * test/command/suite/defrag/pat/overwrite_curr_rec/max_id_active/not_immediate.test
145 * The max `_id` is active and will not be overwritten
146 * The max `_id` is immediate=false
147 * test/command/suite/defrag/pat/overwrite_curr_rec/max_id_deleted/immediate.test
148 * The max `_id` has already deleted
149 * The max `_id` is immediate=true
150 * Overwrite the already created ID with the max active `_id`
151 * test/command/suite/defrag/pat/overwrite_curr_rec/max_id_deleted/not_immediate.test
152 * The max `_id` has already deleted
153 * The max `_id` is immediate=false
154 * Overwrite the already created ID with the max active `_id`