Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfc69509

Browse files
author
Amit Kapila
committed
Fix tests for replication slots stats.
Some of the tests were not considering that the slot's spill stats could bereceived by the stats collector after we have reset the stats. Removethose tests and don't check total bytes decoded and sent to output pluginin the spilled stats test as we can send the spilled stats to the statscollector before actually sending the changes to output plugin.Reported-by: Tom Lane as per buildfarmAuthor: Vignesh C, Sawada MasahikoReviewed-by: Amit KapilaDiscussion:https://postgr.es/m/20210319185247.ldebgpdaxsowiflw@alap3.anarazel.de
1 parentb35f827 commitfc69509

File tree

2 files changed

+5
-53
lines changed

2 files changed

+5
-53
lines changed

‎contrib/test_decoding/expected/stats.out

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -111,48 +111,10 @@ SELECT wait_for_decode_stats(false, true);
111111

112112
(1 row)
113113

114-
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;
115-
slot_name | spill_txns | spill_count | total_txns | total_bytes
116-
-----------------------+------------+-------------+------------+-------------
117-
regression_slot_stats | t | t | t | t
118-
(1 row)
119-
120-
-- reset the slot stats, and wait for stats collector to reset
121-
SELECT pg_stat_reset_replication_slot('regression_slot_stats');
122-
pg_stat_reset_replication_slot
123-
--------------------------------
124-
125-
(1 row)
126-
127-
SELECT wait_for_decode_stats(true, true);
128-
wait_for_decode_stats
129-
-----------------------
130-
131-
(1 row)
132-
133-
SELECT slot_name, spill_txns, spill_count, total_txns, total_bytes FROM pg_stat_replication_slots;
134-
slot_name | spill_txns | spill_count | total_txns | total_bytes
135-
-----------------------+------------+-------------+------------+-------------
136-
regression_slot_stats | 0 | 0 | 0 | 0
137-
(1 row)
138-
139-
-- decode and check stats again.
140-
SELECT count(*) FROM pg_logical_slot_peek_changes('regression_slot_stats', NULL, NULL, 'skip-empty-xacts', '1');
141-
count
142-
-------
143-
5002
144-
(1 row)
145-
146-
SELECT wait_for_decode_stats(false, true);
147-
wait_for_decode_stats
148-
-----------------------
149-
150-
(1 row)
151-
152-
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;
153-
slot_name | spill_txns | spill_count | total_txns | total_bytes
154-
-----------------------+------------+-------------+------------+-------------
155-
regression_slot_stats | t | t | t | t
114+
SELECT slot_name, spill_txns > 0 AS spill_txns, spill_count > 0 AS spill_count FROM pg_stat_replication_slots;
115+
slot_name | spill_txns | spill_count
116+
-----------------------+------------+-------------
117+
regression_slot_stats | t | t
156118
(1 row)
157119

158120
-- Ensure stats can be repeatedly accessed using the same stats snapshot. See

‎contrib/test_decoding/sql/stats.sql

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,7 @@ SELECT count(*) FROM pg_logical_slot_peek_changes('regression_slot_stats', NULL,
7373
-- exact stats count as that can vary if any background transaction (say by
7474
-- autovacuum) happens in parallel to the main transaction.
7575
SELECT wait_for_decode_stats(false, true);
76-
SELECT slot_name, spill_txns>0AS spill_txns, spill_count>0AS spill_count, total_txns>0AS total_txns, total_bytes>0AS total_bytesFROM pg_stat_replication_slots;
77-
78-
-- reset the slot stats, and wait for stats collector to reset
79-
SELECT pg_stat_reset_replication_slot('regression_slot_stats');
80-
SELECT wait_for_decode_stats(true, true);
81-
SELECT slot_name, spill_txns, spill_count, total_txns, total_bytesFROM pg_stat_replication_slots;
82-
83-
-- decode and check stats again.
84-
SELECTcount(*)FROM pg_logical_slot_peek_changes('regression_slot_stats',NULL,NULL,'skip-empty-xacts','1');
85-
SELECT wait_for_decode_stats(false, true);
86-
SELECT slot_name, spill_txns>0AS spill_txns, spill_count>0AS spill_count, total_txns>0AS total_txns, total_bytes>0AS total_bytesFROM pg_stat_replication_slots;
76+
SELECT slot_name, spill_txns>0AS spill_txns, spill_count>0AS spill_countFROM pg_stat_replication_slots;
8777

8878
-- Ensure stats can be repeatedly accessed using the same stats snapshot. See
8979
-- https://postgr.es/m/20210317230447.c7uc4g3vbs4wi32i%40alap3.anarazel.de

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp