|
45 | 45 | DELETE FROM vacuum_progress_ao_row where j % 2 = 0; |
46 | 46 | DELETE 50000 |
47 | 47 |
|
| 48 | +-- Lookup pg_class and collected stats view before VACUUM |
| 49 | +SELECT relpages, reltuples, relallvisible FROM pg_class where relname = 'vacuum_progress_ao_row'; |
| 50 | + relpages | reltuples | relallvisible |
| 51 | +----------+-----------+--------------- |
| 52 | + 0 | 0 | 0 |
| 53 | +(1 row) |
| 54 | +SELECT n_live_tup, n_dead_tup, last_vacuum, vacuum_count FROM pg_stat_all_tables WHERE relname = 'vacuum_progress_ao_row'; |
| 55 | + n_live_tup | n_dead_tup | last_vacuum | vacuum_count |
| 56 | +------------+------------+-------------+-------------- |
| 57 | + 100000 | 200000 | | 0 |
| 58 | +(1 row) |
| 59 | + |
48 | 60 | -- Perform VACUUM and observe the progress |
49 | 61 |
|
50 | 62 | -- Suspend execution at pre-cleanup phase after truncating both segfiles to their logical EOF. |
@@ -145,6 +157,23 @@ SELECT gp_inject_fault('vacuum_ao_post_cleanup_end', 'reset', dbid) FROM gp_segm |
145 | 157 | 1<: <... completed> |
146 | 158 | VACUUM |
147 | 159 |
|
| 160 | +-- pg_class and collected stats view should be updated after the 1st VACUUM |
| 161 | +1U: SELECT wait_until_dead_tup_change_to('vacuum_progress_ao_row'::regclass::oid, 0); |
| 162 | + wait_until_dead_tup_change_to |
| 163 | +------------------------------- |
| 164 | + OK |
| 165 | +(1 row) |
| 166 | +SELECT relpages, reltuples, relallvisible FROM pg_class where relname = 'vacuum_progress_ao_row'; |
| 167 | + relpages | reltuples | relallvisible |
| 168 | +----------+-----------+--------------- |
| 169 | + 83 | 50000 | 0 |
| 170 | +(1 row) |
| 171 | +SELECT n_live_tup, n_dead_tup, last_vacuum is not null as has_last_vacuum, vacuum_count FROM pg_stat_all_tables WHERE relname = 'vacuum_progress_ao_row'; |
| 172 | + n_live_tup | n_dead_tup | has_last_vacuum | vacuum_count |
| 173 | +------------+------------+-----------------+-------------- |
| 174 | + 50000 | 0 | t | 1 |
| 175 | +(1 row) |
| 176 | + |
148 | 177 | -- Perform VACUUM again to recycle the remaining awaiting drop segment marked by the previous run. |
149 | 178 | SELECT gp_inject_fault('vacuum_ao_after_index_delete', 'suspend', dbid) FROM gp_segment_configuration WHERE content = 1 AND role = 'p'; |
150 | 179 | gp_inject_fault |
@@ -201,12 +230,29 @@ SELECT gp_inject_fault('appendonly_after_truncate_segment_file', 'reset', dbid) |
201 | 230 | 1<: <... completed> |
202 | 231 | VACUUM |
203 | 232 |
|
204 | | --- Vacuum has finished, nothing should show up in the view. |
| 233 | +-- Vacuum has finished, nothing should show up in the progress view. |
205 | 234 | 1U: select relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from pg_stat_progress_vacuum; |
206 | 235 | relname | phase | heap_blks_total | heap_blks_scanned | heap_blks_vacuumed | index_vacuum_count | max_dead_tuples | num_dead_tuples |
207 | 236 | ---------+-------+-----------------+-------------------+--------------------+--------------------+-----------------+----------------- |
208 | 237 | (0 rows) |
209 | 238 |
|
| 239 | +-- pg_class and collected stats view should be updated after the 2nd VACUUM |
| 240 | +1U: SELECT wait_until_dead_tup_change_to('vacuum_progress_ao_row'::regclass::oid, 0); |
| 241 | + wait_until_dead_tup_change_to |
| 242 | +------------------------------- |
| 243 | + OK |
| 244 | +(1 row) |
| 245 | +SELECT relpages, reltuples, relallvisible FROM pg_class where relname = 'vacuum_progress_ao_row'; |
| 246 | + relpages | reltuples | relallvisible |
| 247 | +----------+-----------+--------------- |
| 248 | + 28 | 50000 | 0 |
| 249 | +(1 row) |
| 250 | +SELECT n_live_tup, n_dead_tup, last_vacuum is not null as has_last_vacuum, vacuum_count FROM pg_stat_all_tables WHERE relname = 'vacuum_progress_ao_row'; |
| 251 | + n_live_tup | n_dead_tup | has_last_vacuum | vacuum_count |
| 252 | +------------+------------+-----------------+-------------- |
| 253 | + 50000 | 0 | t | 2 |
| 254 | +(1 row) |
| 255 | + |
210 | 256 | -- Cleanup |
211 | 257 | SELECT gp_inject_fault_infinite('all', 'reset', dbid) FROM gp_segment_configuration; |
212 | 258 | gp_inject_fault_infinite |
|
0 commit comments