| 1 |
setup |
| 2 |
{ |
| 3 |
CREATE TABLE test_stat_oid(name text NOT NULL, oid oid); |
| 4 |
|
| 5 |
CREATE TABLE test_stat_tab(key text not null, value int); |
| 6 |
INSERT INTO test_stat_tab(key, value) VALUES('k0', 1); |
| 7 |
INSERT INTO test_stat_oid(name, oid) VALUES('test_stat_tab', 'test_stat_tab'::regclass); |
| 8 |
|
| 9 |
-- include 10us sleep to ensure that runtime measures as more than zero |
| 10 |
CREATE FUNCTION test_stat_func() RETURNS VOID LANGUAGE plpgsql AS |
| 11 |
$$BEGIN PERFORM pg_sleep(10e-6); END;$$; |
| 12 |
INSERT INTO test_stat_oid(name, oid) VALUES('test_stat_func', 'test_stat_func'::regproc); |
| 13 |
|
| 14 |
CREATE FUNCTION test_stat_func2() RETURNS VOID LANGUAGE plpgsql AS |
| 15 |
$$BEGIN PERFORM pg_sleep(10e-6); END;$$; |
| 16 |
INSERT INTO test_stat_oid(name, oid) VALUES('test_stat_func2', 'test_stat_func2'::regproc); |
| 17 |
|
| 18 |
CREATE TABLE test_slru_stats(slru TEXT, stat TEXT, value INT); |
| 19 |
|
| 20 |
-- calls test_stat_func, but hides error if it doesn't exist |
| 21 |
CREATE FUNCTION test_stat_func_ifexists() RETURNS VOID LANGUAGE plpgsql AS $$ |
| 22 |
BEGIN |
| 23 |
PERFORM test_stat_func(); |
| 24 |
EXCEPTION WHEN undefined_function THEN |
| 25 |
END;$$; |
| 26 |
|
| 27 |
SELECT pg_stat_force_next_flush(); |
| 28 |
} |
| 29 |
|
| 30 |
teardown |
| 31 |
{ |
| 32 |
DROP TABLE test_stat_oid; |
| 33 |
DROP TABLE test_slru_stats; |
| 34 |
|
| 35 |
DROP TABLE IF EXISTS test_stat_tab; |
| 36 |
DROP FUNCTION IF EXISTS test_stat_func(); |
| 37 |
DROP FUNCTION IF EXISTS test_stat_func2(); |
| 38 |
DROP FUNCTION test_stat_func_ifexists(); |
| 39 |
} |
| 40 |
|
| 41 |
session s1 |
| 42 |
setup { SET stats_fetch_consistency = 'none'; } |
| 43 |
step s1_fetch_consistency_none { SET stats_fetch_consistency = 'none'; } |
| 44 |
step s1_fetch_consistency_cache { SET stats_fetch_consistency = 'cache'; } |
| 45 |
step s1_fetch_consistency_snapshot { SET stats_fetch_consistency = 'snapshot'; } |
| 46 |
step s1_clear_snapshot { SELECT pg_stat_clear_snapshot(); } |
| 47 |
step s1_begin { BEGIN; } |
| 48 |
step s1_commit { COMMIT; } |
| 49 |
step s1_rollback { ROLLBACK; } |
| 50 |
step s1_prepare_a { PREPARE TRANSACTION 'a'; } |
| 51 |
step s1_commit_prepared_a { COMMIT PREPARED 'a'; } |
| 52 |
step s1_rollback_prepared_a { ROLLBACK PREPARED 'a'; } |
| 53 |
|
| 54 |
# Function stats steps |
| 55 |
step s1_ff { SELECT pg_stat_force_next_flush(); } |
| 56 |
step s1_track_funcs_all { SET track_functions = 'all'; } |
| 57 |
step s1_track_funcs_none { SET track_functions = 'none'; } |
| 58 |
step s1_func_call { SELECT test_stat_func(); } |
| 59 |
step s1_func_drop { DROP FUNCTION test_stat_func(); } |
| 60 |
step s1_func_stats_reset { SELECT pg_stat_reset_single_function_counters('test_stat_func'::regproc); } |
| 61 |
step s1_func_stats_reset_nonexistent { SELECT pg_stat_reset_single_function_counters(12000); } |
| 62 |
step s1_reset { SELECT pg_stat_reset(); } |
| 63 |
step s1_func_stats { |
| 64 |
SELECT |
| 65 |
tso.name, |
| 66 |
pg_stat_get_function_calls(tso.oid), |
| 67 |
pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, |
| 68 |
pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero |
| 69 |
FROM test_stat_oid AS tso |
| 70 |
WHERE tso.name = 'test_stat_func' |
| 71 |
} |
| 72 |
step s1_func_stats2 { |
| 73 |
SELECT |
| 74 |
tso.name, |
| 75 |
pg_stat_get_function_calls(tso.oid), |
| 76 |
pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, |
| 77 |
pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero |
| 78 |
FROM test_stat_oid AS tso |
| 79 |
WHERE tso.name = 'test_stat_func2' |
| 80 |
} |
| 81 |
step s1_func_stats_nonexistent { |
| 82 |
SELECT pg_stat_get_function_calls(12000); |
| 83 |
} |
| 84 |
|
| 85 |
# Relation stats steps |
| 86 |
step s1_track_counts_on { SET track_counts = on; } |
| 87 |
step s1_track_counts_off { SET track_counts = off; } |
| 88 |
step s1_table_select { SELECT * FROM test_stat_tab ORDER BY key, value; } |
| 89 |
step s1_table_insert { INSERT INTO test_stat_tab(key, value) VALUES('k1', 1), ('k2', 1), ('k3', 1);} |
| 90 |
step s1_table_insert_k1 { INSERT INTO test_stat_tab(key, value) VALUES('k1', 1);} |
| 91 |
step s1_table_update_k1 { UPDATE test_stat_tab SET value = value + 1 WHERE key = 'k1';} |
| 92 |
step s1_table_update_k2 { UPDATE test_stat_tab SET value = value + 1 WHERE key = 'k2';} |
| 93 |
step s1_table_delete_k1 { DELETE FROM test_stat_tab WHERE key = 'k1';} |
| 94 |
step s1_table_truncate { TRUNCATE test_stat_tab; } |
| 95 |
step s1_table_drop { DROP TABLE test_stat_tab; } |
| 96 |
|
| 97 |
step s1_table_stats { |
| 98 |
SELECT |
| 99 |
pg_stat_get_numscans(tso.oid) AS seq_scan, |
| 100 |
pg_stat_get_tuples_returned(tso.oid) AS seq_tup_read, |
| 101 |
pg_stat_get_tuples_inserted(tso.oid) AS n_tup_ins, |
| 102 |
pg_stat_get_tuples_updated(tso.oid) AS n_tup_upd, |
| 103 |
pg_stat_get_tuples_deleted(tso.oid) AS n_tup_del, |
| 104 |
pg_stat_get_live_tuples(tso.oid) AS n_live_tup, |
| 105 |
pg_stat_get_dead_tuples(tso.oid) AS n_dead_tup, |
| 106 |
pg_stat_get_vacuum_count(tso.oid) AS vacuum_count |
| 107 |
FROM test_stat_oid AS tso |
| 108 |
WHERE tso.name = 'test_stat_tab' |
| 109 |
} |
| 110 |
|
| 111 |
# SLRU stats steps |
| 112 |
step s1_slru_save_stats { |
| 113 |
INSERT INTO test_slru_stats VALUES('notify', 'blks_zeroed', |
| 114 |
(SELECT blks_zeroed FROM pg_stat_slru WHERE name = 'notify')); |
| 115 |
} |
| 116 |
step s1_listen { LISTEN stats_test_nothing; } |
| 117 |
step s1_big_notify { SELECT pg_notify('stats_test_use', |
| 118 |
repeat(i::text, current_setting('block_size')::int / 2)) FROM generate_series(1, 3) g(i); |
| 119 |
} |
| 120 |
|
| 121 |
step s1_slru_check_stats { |
| 122 |
SELECT current.blks_zeroed > before.value |
| 123 |
FROM test_slru_stats before |
| 124 |
INNER JOIN pg_stat_slru current |
| 125 |
ON before.slru = current.name |
| 126 |
WHERE before.stat = 'blks_zeroed'; |
| 127 |
} |
| 128 |
|
| 129 |
|
| 130 |
session s2 |
| 131 |
setup { SET stats_fetch_consistency = 'none'; } |
| 132 |
step s2_begin { BEGIN; } |
| 133 |
step s2_commit { COMMIT; } |
| 134 |
step s2_commit_prepared_a { COMMIT PREPARED 'a'; } |
| 135 |
step s2_rollback_prepared_a { ROLLBACK PREPARED 'a'; } |
| 136 |
step s2_ff { SELECT pg_stat_force_next_flush(); } |
| 137 |
|
| 138 |
# Function stats steps |
| 139 |
step s2_track_funcs_all { SET track_functions = 'all'; } |
| 140 |
step s2_track_funcs_none { SET track_functions = 'none'; } |
| 141 |
step s2_func_call { SELECT test_stat_func() } |
| 142 |
step s2_func_call_ifexists { SELECT test_stat_func_ifexists(); } |
| 143 |
step s2_func_call2 { SELECT test_stat_func2() } |
| 144 |
step s2_func_stats { |
| 145 |
SELECT |
| 146 |
tso.name, |
| 147 |
pg_stat_get_function_calls(tso.oid), |
| 148 |
pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, |
| 149 |
pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero |
| 150 |
FROM test_stat_oid AS tso |
| 151 |
WHERE tso.name = 'test_stat_func' |
| 152 |
} |
| 153 |
|
| 154 |
# Relation stats steps |
| 155 |
step s2_table_select { SELECT * FROM test_stat_tab ORDER BY key, value; } |
| 156 |
step s2_table_update_k1 { UPDATE test_stat_tab SET value = value + 1 WHERE key = 'k1';} |
| 157 |
|
| 158 |
# SLRU stats steps |
| 159 |
step s2_big_notify { SELECT pg_notify('stats_test_use', |
| 160 |
repeat(i::text, current_setting('block_size')::int / 2)) FROM generate_series(1, 3) g(i); |
| 161 |
} |
| 162 |
|
| 163 |
|
| 164 |
###################### |
| 165 |
# Function stats tests |
| 166 |
###################### |
| 167 |
|
| 168 |
# check that stats are collected iff enabled |
| 169 |
permutation |
| 170 |
s1_track_funcs_none s1_func_stats s1_func_call s1_func_call s1_ff s1_func_stats |
| 171 |
permutation |
| 172 |
s1_track_funcs_all s1_func_stats s1_func_call s1_func_call s1_ff s1_func_stats |
| 173 |
|
| 174 |
# multiple function calls are accurately reported, across separate connections |
| 175 |
permutation |
| 176 |
s1_track_funcs_all s2_track_funcs_all s1_func_stats s2_func_stats |
| 177 |
s1_func_call s2_func_call s1_func_call s2_func_call s2_func_call s1_ff s2_ff s1_func_stats s2_func_stats |
| 178 |
permutation |
| 179 |
s1_track_funcs_all s2_track_funcs_all s1_func_stats s2_func_stats |
| 180 |
s1_func_call s1_ff s2_func_call s2_func_call s2_ff s1_func_stats s2_func_stats |
| 181 |
permutation |
| 182 |
s1_track_funcs_all s2_track_funcs_all s1_func_stats s2_func_stats |
| 183 |
s1_begin s1_func_call s1_func_call s1_commit s1_ff s1_func_stats s2_func_stats |
| 184 |
|
| 185 |
|
| 186 |
### Check interaction between dropping and stats reporting |
| 187 |
|
| 188 |
# Some of these tests try to test behavior in cases where no invalidation |
| 189 |
# processing is triggered. To prevent output changes when |
| 190 |
# debug_discard_caches, CATCACHE_FORCE_RELEASE or RELCACHE_FORCE_RELEASE are |
| 191 |
# used (which trigger invalidation processing in paths that normally don't), |
| 192 |
# test_stat_func_ifexists() can be used, which tries to call test_stat_func(), |
| 193 |
# but doesn't raise an error if the function doesn't exist. |
| 194 |
|
| 195 |
# dropping a table remove stats iff committed |
| 196 |
permutation |
| 197 |
s1_track_funcs_all s2_track_funcs_all s1_func_stats s2_func_stats |
| 198 |
s1_begin s1_func_call s2_func_call s1_func_drop s2_func_call s2_ff s2_func_stats s1_commit s1_ff s1_func_stats s2_func_stats |
| 199 |
permutation |
| 200 |
s1_track_funcs_all s2_track_funcs_all s1_func_stats s2_func_stats |
| 201 |
s1_begin s1_func_call s2_func_call s1_func_drop s2_func_call s2_ff s2_func_stats s1_rollback s1_ff s1_func_stats s2_func_stats |
| 202 |
|
| 203 |
# Verify that pending stats from before a drop do not lead to |
| 204 |
# reviving stats for a dropped object |
| 205 |
permutation |
| 206 |
s1_track_funcs_all s2_track_funcs_all |
| 207 |
s2_func_call s2_ff # this access increments refcount, preventing the shared entry from being dropped |
| 208 |
s2_begin s2_func_call_ifexists s1_func_drop s1_func_stats s2_commit s2_ff s1_func_stats s2_func_stats |
| 209 |
permutation |
| 210 |
s1_track_funcs_all s2_track_funcs_all |
| 211 |
s2_begin s2_func_call_ifexists s1_func_drop s1_func_stats s2_commit s2_ff s1_func_stats s2_func_stats |
| 212 |
permutation |
| 213 |
s1_track_funcs_all s2_track_funcs_all |
| 214 |
s1_func_call s2_begin s2_func_call_ifexists s1_func_drop s2_func_call_ifexists s2_commit s2_ff s1_func_stats s2_func_stats |
| 215 |
|
| 216 |
# Function calls don't necessarily trigger cache invalidation processing. The |
| 217 |
# default handling of dropped stats could therefore end up with stats getting |
| 218 |
# revived by a function call done after stats processing - but |
| 219 |
# pgstat_init_function_usage() protects against that if track_functions is |
| 220 |
# on. Verify that the stats are indeed dropped, and document the behavioral |
| 221 |
# difference between track_functions settings. |
| 222 |
permutation |
| 223 |
s1_track_funcs_all s2_track_funcs_none |
| 224 |
s1_func_call s2_begin s2_func_call_ifexists s1_ff s1_func_stats s1_func_drop s2_track_funcs_none s1_func_stats s2_func_call_ifexists s2_commit s2_ff s1_func_stats s2_func_stats |
| 225 |
permutation |
| 226 |
s1_track_funcs_all s2_track_funcs_none |
| 227 |
s1_func_call s2_begin s2_func_call_ifexists s1_ff s1_func_stats s1_func_drop s2_track_funcs_all s1_func_stats s2_func_call_ifexists s2_commit s2_ff s1_func_stats s2_func_stats |
| 228 |
|
| 229 |
# test pg_stat_reset_single_function_counters |
| 230 |
permutation |
| 231 |
s1_track_funcs_all s2_track_funcs_all |
| 232 |
s1_func_call |
| 233 |
s2_func_call |
| 234 |
s2_func_call2 |
| 235 |
s1_ff s2_ff |
| 236 |
s1_func_stats |
| 237 |
s2_func_call s2_func_call2 s2_ff |
| 238 |
s1_func_stats s1_func_stats2 s1_func_stats |
| 239 |
s1_func_stats_reset |
| 240 |
s1_func_stats s1_func_stats2 s1_func_stats |
| 241 |
|
| 242 |
# test pg_stat_reset_single_function_counters of non-existing function |
| 243 |
permutation |
| 244 |
s1_func_stats_nonexistent |
| 245 |
s1_func_stats_reset_nonexistent |
| 246 |
s1_func_stats_nonexistent |
| 247 |
|
| 248 |
# test pg_stat_reset |
| 249 |
permutation |
| 250 |
s1_track_funcs_all s2_track_funcs_all |
| 251 |
s1_func_call |
| 252 |
s2_func_call |
| 253 |
s2_func_call2 |
| 254 |
s1_ff s2_ff |
| 255 |
s1_func_stats s1_func_stats2 s1_func_stats |
| 256 |
s1_reset |
| 257 |
s1_func_stats s1_func_stats2 s1_func_stats |
| 258 |
|
| 259 |
|
| 260 |
### Check the different snapshot consistency models |
| 261 |
|
| 262 |
# First just some dead-trivial test verifying each model doesn't crash |
| 263 |
permutation |
| 264 |
s1_track_funcs_all s1_fetch_consistency_none s1_func_call s1_ff s1_func_stats |
| 265 |
permutation |
| 266 |
s1_track_funcs_all s1_fetch_consistency_cache s1_func_call s1_ff s1_func_stats |
| 267 |
permutation |
| 268 |
s1_track_funcs_all s1_fetch_consistency_snapshot s1_func_call s1_ff s1_func_stats |
| 269 |
|
| 270 |
# with stats_fetch_consistency=none s1 should see flushed changes in s2, despite being in a transaction |
| 271 |
permutation |
| 272 |
s1_track_funcs_all s2_track_funcs_all |
| 273 |
s1_fetch_consistency_none |
| 274 |
s2_func_call s2_ff |
| 275 |
s1_begin |
| 276 |
s1_func_stats |
| 277 |
s2_func_call s2_ff |
| 278 |
s1_func_stats |
| 279 |
s1_commit |
| 280 |
|
| 281 |
# with stats_fetch_consistency=cache s1 should not see concurrent |
| 282 |
# changes to the same object after the first access, but a separate |
| 283 |
# object should show changes |
| 284 |
permutation |
| 285 |
s1_track_funcs_all s2_track_funcs_all |
| 286 |
s1_fetch_consistency_cache |
| 287 |
s2_func_call s2_func_call2 s2_ff |
| 288 |
s1_begin |
| 289 |
s1_func_stats |
| 290 |
s2_func_call s2_func_call2 s2_ff |
| 291 |
s1_func_stats s1_func_stats2 |
| 292 |
s1_commit |
| 293 |
|
| 294 |
# with stats_fetch_consistency=snapshot s1 should not see any |
| 295 |
# concurrent changes after the first access |
| 296 |
permutation |
| 297 |
s1_track_funcs_all s2_track_funcs_all |
| 298 |
s1_fetch_consistency_snapshot |
| 299 |
s2_func_call s2_func_call2 s2_ff |
| 300 |
s1_begin |
| 301 |
s1_func_stats |
| 302 |
s2_func_call s2_func_call2 s2_ff |
| 303 |
s1_func_stats s1_func_stats2 |
| 304 |
s1_commit |
| 305 |
|
| 306 |
# Check access to non-existing stats works correctly and repeatedly |
| 307 |
permutation |
| 308 |
s1_fetch_consistency_none |
| 309 |
s1_begin |
| 310 |
s1_func_stats_nonexistent |
| 311 |
s1_func_stats_nonexistent |
| 312 |
s1_commit |
| 313 |
permutation |
| 314 |
s1_fetch_consistency_cache |
| 315 |
s1_begin |
| 316 |
s1_func_stats_nonexistent |
| 317 |
s1_func_stats_nonexistent |
| 318 |
s1_commit |
| 319 |
permutation |
| 320 |
s1_fetch_consistency_snapshot |
| 321 |
s1_begin |
| 322 |
s1_func_stats_nonexistent |
| 323 |
s1_func_stats_nonexistent |
| 324 |
s1_commit |
| 325 |
|
| 326 |
|
| 327 |
### Check 2PC handling of stat drops |
| 328 |
|
| 329 |
# S1 prepared, S1 commits prepared |
| 330 |
permutation |
| 331 |
s1_track_funcs_all s2_track_funcs_all |
| 332 |
s1_begin |
| 333 |
s1_func_call |
| 334 |
s2_func_call |
| 335 |
s1_func_drop |
| 336 |
s2_func_call |
| 337 |
s2_ff |
| 338 |
s1_prepare_a |
| 339 |
s2_func_call |
| 340 |
s2_ff |
| 341 |
s1_func_call |
| 342 |
s1_ff |
| 343 |
s1_func_stats |
| 344 |
s1_commit_prepared_a |
| 345 |
s1_func_stats |
| 346 |
|
| 347 |
# S1 prepared, S1 aborts prepared |
| 348 |
permutation |
| 349 |
s1_track_funcs_all s2_track_funcs_all |
| 350 |
s1_begin |
| 351 |
s1_func_call |
| 352 |
s2_func_call |
| 353 |
s1_func_drop |
| 354 |
s2_func_call |
| 355 |
s2_ff |
| 356 |
s1_prepare_a |
| 357 |
s2_func_call |
| 358 |
s2_ff |
| 359 |
s1_func_call |
| 360 |
s1_ff |
| 361 |
s1_func_stats |
| 362 |
s1_rollback_prepared_a |
| 363 |
s1_func_stats |
| 364 |
|
| 365 |
# S1 prepares, S2 commits prepared |
| 366 |
permutation |
| 367 |
s1_track_funcs_all s2_track_funcs_all |
| 368 |
s1_begin |
| 369 |
s1_func_call |
| 370 |
s2_func_call |
| 371 |
s1_func_drop |
| 372 |
s2_func_call |
| 373 |
s2_ff |
| 374 |
s1_prepare_a |
| 375 |
s2_func_call |
| 376 |
s2_ff |
| 377 |
s1_func_call |
| 378 |
s1_ff |
| 379 |
s1_func_stats |
| 380 |
s2_commit_prepared_a |
| 381 |
s1_func_stats |
| 382 |
|
| 383 |
# S1 prepared, S2 aborts prepared |
| 384 |
permutation |
| 385 |
s1_track_funcs_all s2_track_funcs_all |
| 386 |
s1_begin |
| 387 |
s1_func_call |
| 388 |
s2_func_call |
| 389 |
s1_func_drop |
| 390 |
s2_func_call |
| 391 |
s2_ff |
| 392 |
s1_prepare_a |
| 393 |
s2_func_call |
| 394 |
s2_ff |
| 395 |
s1_func_call |
| 396 |
s1_ff |
| 397 |
s1_func_stats |
| 398 |
s2_rollback_prepared_a |
| 399 |
s1_func_stats |
| 400 |
|
| 401 |
|
| 402 |
###################### |
| 403 |
# Table stats tests |
| 404 |
###################### |
| 405 |
|
| 406 |
# Most of the stats handling mechanism has already been tested in the function |
| 407 |
# stats tests above - that's cheaper than testing with relations. But |
| 408 |
# particularly for 2PC there are special cases |
| 409 |
|
| 410 |
|
| 411 |
### Verify that pending stats from before a drop do not lead to reviving |
| 412 |
### of stats for a dropped object |
| 413 |
|
| 414 |
permutation |
| 415 |
s1_table_select |
| 416 |
s1_table_insert |
| 417 |
s2_table_select |
| 418 |
s2_table_update_k1 |
| 419 |
s1_ff |
| 420 |
s2_table_update_k1 |
| 421 |
s1_table_drop |
| 422 |
s2_ff |
| 423 |
s1_table_stats |
| 424 |
|
| 425 |
permutation |
| 426 |
s1_table_select |
| 427 |
s1_table_insert |
| 428 |
s2_table_select |
| 429 |
s2_table_update_k1 |
| 430 |
s2_table_update_k1 |
| 431 |
s1_table_drop |
| 432 |
s1_table_stats |
| 433 |
|
| 434 |
|
| 435 |
### Check that we don't count changes with track counts off, but allow access |
| 436 |
### to prior stats |
| 437 |
|
| 438 |
# simple read access with stats off |
| 439 |
permutation |
| 440 |
s1_track_counts_off |
| 441 |
s1_table_stats |
| 442 |
s1_track_counts_on |
| 443 |
|
| 444 |
# simple read access with stats off, previously accessed |
| 445 |
permutation |
| 446 |
s1_table_select |
| 447 |
s1_track_counts_off |
| 448 |
s1_ff |
| 449 |
s1_table_stats |
| 450 |
s1_track_counts_on |
| 451 |
permutation |
| 452 |
s1_table_select |
| 453 |
s1_ff |
| 454 |
s1_track_counts_off |
| 455 |
s1_table_stats |
| 456 |
s1_track_counts_on |
| 457 |
|
| 458 |
# ensure we don't count anything with stats off |
| 459 |
permutation |
| 460 |
s1_track_counts_off |
| 461 |
s1_table_select |
| 462 |
s1_table_insert_k1 |
| 463 |
s1_table_update_k1 |
| 464 |
s2_table_select |
| 465 |
s1_track_counts_on |
| 466 |
s1_ff s2_ff |
| 467 |
s1_table_stats |
| 468 |
# but can count again after |
| 469 |
s1_table_select |
| 470 |
s1_table_update_k1 |
| 471 |
s1_ff |
| 472 |
s1_table_stats |
| 473 |
permutation |
| 474 |
s1_table_select |
| 475 |
s1_table_insert_k1 |
| 476 |
s1_table_delete_k1 |
| 477 |
s1_track_counts_off |
| 478 |
s1_table_select |
| 479 |
s1_table_insert_k1 |
| 480 |
s1_table_update_k1 |
| 481 |
s2_table_select |
| 482 |
s1_track_counts_on |
| 483 |
s1_ff s2_ff |
| 484 |
s1_table_stats |
| 485 |
s1_table_select |
| 486 |
s1_table_update_k1 |
| 487 |
s1_ff |
| 488 |
s1_table_stats |
| 489 |
|
| 490 |
|
| 491 |
### 2PC: transactional and non-transactional counters work correctly |
| 492 |
|
| 493 |
# S1 prepares, S2 commits prepared |
| 494 |
permutation |
| 495 |
s1_begin |
| 496 |
s1_table_insert s1_table_update_k1 s1_table_update_k1 s1_table_update_k2 s1_table_update_k2 s1_table_update_k2 s1_table_delete_k1 |
| 497 |
s1_table_select |
| 498 |
s1_prepare_a |
| 499 |
s1_table_select |
| 500 |
s1_commit_prepared_a |
| 501 |
s1_table_select |
| 502 |
s1_ff |
| 503 |
s1_table_stats |
| 504 |
|
| 505 |
# S1 prepares, S2 commits prepared |
| 506 |
permutation |
| 507 |
s1_begin |
| 508 |
s1_table_insert s1_table_update_k1 s1_table_update_k1 s1_table_update_k2 s1_table_update_k2 s1_table_update_k2 s1_table_delete_k1 |
| 509 |
s1_table_select |
| 510 |
s1_prepare_a |
| 511 |
s1_table_select |
| 512 |
s2_commit_prepared_a |
| 513 |
s1_table_select |
| 514 |
s1_ff s2_ff |
| 515 |
s1_table_stats |
| 516 |
|
| 517 |
# S1 prepares, S2 commits prepared |
| 518 |
permutation |
| 519 |
s1_begin |
| 520 |
s1_table_insert s1_table_update_k1 s1_table_update_k1 s1_table_update_k2 s1_table_update_k2 s1_table_update_k2 s1_table_delete_k1 |
| 521 |
s1_table_select |
| 522 |
s1_prepare_a |
| 523 |
s1_table_select |
| 524 |
s1_rollback_prepared_a |
| 525 |
s1_table_select |
| 526 |
s1_ff |
| 527 |
s1_table_stats |
| 528 |
|
| 529 |
# S1 prepares, S1 aborts prepared |
| 530 |
permutation |
| 531 |
s1_begin |
| 532 |
s1_table_insert s1_table_update_k1 s1_table_update_k1 s1_table_update_k2 s1_table_update_k2 s1_table_update_k2 s1_table_delete_k1 |
| 533 |
s1_table_select |
| 534 |
s1_prepare_a |
| 535 |
s1_table_select |
| 536 |
s2_rollback_prepared_a |
| 537 |
s1_table_select |
| 538 |
s1_ff s2_ff |
| 539 |
s1_table_stats |
| 540 |
|
| 541 |
|
| 542 |
### 2PC: truncate handling |
| 543 |
|
| 544 |
# S1 prepares, S1 commits prepared |
| 545 |
permutation |
| 546 |
s1_table_insert |
| 547 |
s1_begin |
| 548 |
s1_table_update_k1 # should *not* be counted, different rel |
| 549 |
s1_table_update_k1 # ditto |
| 550 |
s1_table_truncate |
| 551 |
s1_table_insert_k1 # should be counted |
| 552 |
s1_table_update_k1 # ditto |
| 553 |
s1_prepare_a |
| 554 |
s1_commit_prepared_a |
| 555 |
s1_ff |
| 556 |
s1_table_stats |
| 557 |
|
| 558 |
# S1 prepares, S2 commits prepared |
| 559 |
permutation |
| 560 |
s1_table_insert |
| 561 |
s1_begin |
| 562 |
s1_table_update_k1 # should *not* be counted, different rel |
| 563 |
s1_table_update_k1 # ditto |
| 564 |
s1_table_truncate |
| 565 |
s1_table_insert_k1 # should be counted |
| 566 |
s1_table_update_k1 # ditto |
| 567 |
s1_prepare_a |
| 568 |
s1_ff # flush out non-transactional stats, might happen anyway |
| 569 |
s2_commit_prepared_a |
| 570 |
s2_ff |
| 571 |
s1_table_stats |
| 572 |
|
| 573 |
# S1 prepares, S1 aborts prepared |
| 574 |
permutation |
| 575 |
s1_table_insert |
| 576 |
s1_begin |
| 577 |
s1_table_update_k1 # should be counted |
| 578 |
s1_table_update_k1 # ditto |
| 579 |
s1_table_truncate |
| 580 |
s1_table_insert_k1 # should *not* be counted, different rel |
| 581 |
s1_table_update_k1 # ditto |
| 582 |
s1_prepare_a |
| 583 |
s1_rollback_prepared_a |
| 584 |
s1_ff |
| 585 |
s1_table_stats |
| 586 |
|
| 587 |
# S1 prepares, S2 aborts prepared |
| 588 |
permutation |
| 589 |
s1_table_insert |
| 590 |
s1_begin |
| 591 |
s1_table_update_k1 # should be counted |
| 592 |
s1_table_update_k1 # ditto |
| 593 |
s1_table_truncate |
| 594 |
s1_table_insert_k1 # should *not* be counted, different rel |
| 595 |
s1_table_update_k1 # ditto |
| 596 |
s1_prepare_a |
| 597 |
s2_rollback_prepared_a |
| 598 |
s1_ff s2_ff |
| 599 |
s1_table_stats |
| 600 |
|
| 601 |
|
| 602 |
### 2PC: rolled back drop maintains live / dead counters |
| 603 |
|
| 604 |
# S1 prepares, S1 aborts prepared |
| 605 |
permutation |
| 606 |
s1_table_insert |
| 607 |
s1_table_update_k1 |
| 608 |
s1_begin |
| 609 |
# should all be counted |
| 610 |
s1_table_delete_k1 |
| 611 |
s1_table_insert_k1 |
| 612 |
s1_table_update_k1 |
| 613 |
s1_table_update_k1 |
| 614 |
s1_table_drop |
| 615 |
s1_prepare_a |
| 616 |
s1_rollback_prepared_a |
| 617 |
s1_ff |
| 618 |
s1_table_stats |
| 619 |
|
| 620 |
# S1 prepares, S1 aborts prepared |
| 621 |
permutation |
| 622 |
s1_table_insert |
| 623 |
s1_table_update_k1 |
| 624 |
s1_begin |
| 625 |
# should all be counted |
| 626 |
s1_table_delete_k1 |
| 627 |
s1_table_insert_k1 |
| 628 |
s1_table_update_k1 |
| 629 |
s1_table_update_k1 |
| 630 |
s1_table_drop |
| 631 |
s1_prepare_a |
| 632 |
s2_rollback_prepared_a |
| 633 |
s1_ff s2_ff |
| 634 |
s1_table_stats |
| 635 |
|
| 636 |
|
| 637 |
###################### |
| 638 |
# SLRU stats tests |
| 639 |
###################### |
| 640 |
|
| 641 |
# Verify SLRU stats generated in own transaction |
| 642 |
permutation |
| 643 |
s1_slru_save_stats |
| 644 |
s1_listen |
| 645 |
s1_begin |
| 646 |
s1_big_notify |
| 647 |
s1_ff |
| 648 |
s1_slru_check_stats |
| 649 |
s1_commit |
| 650 |
s1_slru_check_stats |
| 651 |
|
| 652 |
# Verify SLRU stats generated in separate transaction |
| 653 |
permutation |
| 654 |
s1_slru_save_stats |
| 655 |
s1_listen |
| 656 |
s2_big_notify |
| 657 |
s2_ff |
| 658 |
s1_slru_check_stats |
| 659 |
|
| 660 |
# shouldn't see stats yet, not committed |
| 661 |
permutation |
| 662 |
s1_slru_save_stats |
| 663 |
s1_listen |
| 664 |
s2_begin |
| 665 |
s2_big_notify |
| 666 |
s2_ff |
| 667 |
s1_slru_check_stats |
| 668 |
s2_commit |
| 669 |
|
| 670 |
|
| 671 |
### Check the different snapshot consistency models for fixed-amount statistics |
| 672 |
|
| 673 |
permutation |
| 674 |
s1_fetch_consistency_none |
| 675 |
s1_slru_save_stats s1_listen |
| 676 |
s1_begin |
| 677 |
s1_slru_check_stats |
| 678 |
s2_big_notify |
| 679 |
s2_ff |
| 680 |
s1_slru_check_stats |
| 681 |
s1_commit |
| 682 |
s1_slru_check_stats |
| 683 |
permutation |
| 684 |
s1_fetch_consistency_cache |
| 685 |
s1_slru_save_stats s1_listen |
| 686 |
s1_begin |
| 687 |
s1_slru_check_stats |
| 688 |
s2_big_notify |
| 689 |
s2_ff |
| 690 |
s1_slru_check_stats |
| 691 |
s1_commit |
| 692 |
s1_slru_check_stats |
| 693 |
permutation |
| 694 |
s1_fetch_consistency_snapshot |
| 695 |
s1_slru_save_stats s1_listen |
| 696 |
s1_begin |
| 697 |
s1_slru_check_stats |
| 698 |
s2_big_notify |
| 699 |
s2_ff |
| 700 |
s1_slru_check_stats |
| 701 |
s1_commit |
| 702 |
s1_slru_check_stats |
| 703 |
|
| 704 |
# check that pg_stat_clear_snapshot(), well ... |
| 705 |
permutation |
| 706 |
s1_fetch_consistency_none |
| 707 |
s1_slru_save_stats s1_listen |
| 708 |
s1_begin |
| 709 |
s1_slru_check_stats |
| 710 |
s2_big_notify |
| 711 |
s2_ff |
| 712 |
s1_slru_check_stats |
| 713 |
s1_clear_snapshot |
| 714 |
s1_slru_check_stats |
| 715 |
s1_commit |
| 716 |
permutation |
| 717 |
s1_fetch_consistency_cache |
| 718 |
s1_slru_save_stats s1_listen |
| 719 |
s1_begin |
| 720 |
s1_slru_check_stats |
| 721 |
s2_big_notify |
| 722 |
s2_ff |
| 723 |
s1_slru_check_stats |
| 724 |
s1_clear_snapshot |
| 725 |
s1_slru_check_stats |
| 726 |
s1_commit |
| 727 |
permutation |
| 728 |
s1_fetch_consistency_snapshot |
| 729 |
s1_slru_save_stats s1_listen |
| 730 |
s1_begin |
| 731 |
s1_slru_check_stats |
| 732 |
s2_big_notify |
| 733 |
s2_ff |
| 734 |
s1_slru_check_stats |
| 735 |
s1_clear_snapshot |
| 736 |
s1_slru_check_stats |
| 737 |
s1_commit |
| 738 |
|
| 739 |
# check that a variable-amount stats access caches fixed-amount stat too |
| 740 |
permutation |
| 741 |
s1_fetch_consistency_snapshot |
| 742 |
s1_slru_save_stats s1_listen |
| 743 |
s1_begin |
| 744 |
s1_func_stats |
| 745 |
s2_big_notify |
| 746 |
s2_ff |
| 747 |
s1_slru_check_stats |
| 748 |
s1_commit |
| 749 |
|
| 750 |
# and the other way round |
| 751 |
permutation |
| 752 |
s1_fetch_consistency_snapshot |
| 753 |
s1_slru_save_stats s1_listen |
| 754 |
s1_begin |
| 755 |
s2_big_notify |
| 756 |
s2_ff |
| 757 |
s1_slru_check_stats |
| 758 |
s2_func_call |
| 759 |
s2_ff |
| 760 |
s1_func_stats |
| 761 |
s1_clear_snapshot |
| 762 |
s1_func_stats |
| 763 |
s1_commit |