You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the new test after resetting the stats, we were not waiting for the
stats message to be delivered. Also, we need to decode the results for
the new test, otherwise, it will show the old stats.
In passing,
a. Change docs added by commit f5fc2f5 as per suggestion by
Justin Pryzby.
b. Bump the PGSTAT_FILE_FORMAT_ID as commit f5fc2f5 changes the file
format of stats.
Reported-by: Tom Lane based on buildfarm reports
Author: Vignesh C, Justin Pryzby
Reviewed-by: Amit Kapila
Discussion: https://postgr.es/m/20210319185247.ldebgpdaxsowiflw@alap3.anarazel.de
Copy file name to clipboardExpand all lines: contrib/test_decoding/expected/stats.out
+38-19
Original file line number
Diff line number
Diff line change
@@ -51,39 +51,34 @@ BEGIN
51
51
extract(epoch from clock_timestamp() - start_time);
52
52
END
53
53
$$ LANGUAGE plpgsql;
54
-
-- spilling the xact
55
-
BEGIN;
56
-
INSERT INTO stats_test SELECT 'serialize-topbig--1:'||g.i FROM generate_series(1, 5000) g(i);
57
-
COMMIT;
58
-
SELECT count(*) FROM pg_logical_slot_peek_changes('regression_slot', NULL, NULL, 'skip-empty-xacts', '1');
54
+
-- non-spilled xact
55
+
INSERT INTO stats_test values(1);
56
+
SELECT count(*) FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'skip-empty-xacts', '1');
59
57
count
60
58
-------
61
-
5002
59
+
3
62
60
(1 row)
63
61
64
-
-- Check stats, wait for the stats collector to update. We can't test the
65
-
-- exact stats count as that can vary if any background transaction (say by
66
-
-- autovacuum) happens in parallel to the main transaction.
67
-
SELECT wait_for_decode_stats(false, true);
62
+
SELECT wait_for_decode_stats(false, false);
68
63
wait_for_decode_stats
69
64
-----------------------
70
65
71
66
(1 row)
72
67
73
-
SELECT slot_name, spill_txns > 0 AS spill_txns, spill_count > 0 AS spill_count, total_txns > 0 AS total_txns, total_bytes > 0 AS total_bytes FROM pg_stat_replication_slots;
68
+
SELECT slot_name, spill_txns = 0 AS spill_txns, spill_count = 0 AS spill_count, total_txns > 0 AS total_txns, total_bytes > 0 AS total_bytes FROM pg_stat_replication_slots;
INSERT INTO stats_test values(generate_series(1, 10));
125
-
SELECT wait_for_decode_stats(false, false);
125
+
SELECT wait_for_decode_stats(true, true);
126
126
wait_for_decode_stats
127
127
-----------------------
128
128
129
129
(1 row)
130
130
131
-
SELECT slot_name, spill_txns = 0 AS spill_txns, spill_count = 0 AS spill_count, total_txns > 0 AS total_txns, total_bytes > 0 AS total_bytes FROM pg_stat_replication_slots;
131
+
SELECT slot_name, spill_txns, spill_count, total_txns, total_bytes FROM pg_stat_replication_slots;
SELECT count(*) FROM pg_logical_slot_peek_changes('regression_slot', NULL, NULL, 'skip-empty-xacts', '1');
139
+
count
140
+
-------
141
+
5002
142
+
(1 row)
143
+
144
+
SELECT wait_for_decode_stats(false, true);
145
+
wait_for_decode_stats
146
+
-----------------------
147
+
148
+
(1 row)
149
+
150
+
SELECT slot_name, spill_txns > 0 AS spill_txns, spill_count > 0 AS spill_count, total_txns > 0 AS total_txns, total_bytes > 0 AS total_bytes FROM pg_stat_replication_slots;
0 commit comments