Skip to content

Commit 3edaf29

Browse files
author
Amit Kapila
committed
Rename two columns in pg_stat_subscription_stats.
This patch renames the sync_error_count column to sync_table_error_count in the pg_stat_subscription_stats view. The new name makes the purpose explicit now that a separate column exists to track sequence synchronization errors. Additionally, the column seq_sync_error_count is renamed to sync_seq_error_count to maintain a consistent naming pattern, making it easier for users to group, and query synchronization related counters. Author: Vignesh C <vignesh21@gmail.com> Reviewed-by: Peter Smith <smithpb2250@gmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Discussion: https://postgr.es/m/CALDaNm3WwJmz=-4ybTkhniB-Nf3qmFG9Zx1uKjyLLoPF5NYYXA@mail.gmail.com
1 parent c677f2b commit 3edaf29

File tree

9 files changed

+34
-34
lines changed

9 files changed

+34
-34
lines changed

doc/src/sgml/monitoring.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2195,7 +2195,7 @@ description | Waiting for a newly initialized WAL file to reach durable storage
21952195

21962196
<row>
21972197
<entry role="catalog_table_entry"><para role="column_definition">
2198-
<structfield>seq_sync_error_count</structfield> <type>bigint</type>
2198+
<structfield>sync_seq_error_count</structfield> <type>bigint</type>
21992199
</para>
22002200
<para>
22012201
Number of times an error occurred in the sequence synchronization
@@ -2206,7 +2206,7 @@ description | Waiting for a newly initialized WAL file to reach durable storage
22062206

22072207
<row>
22082208
<entry role="catalog_table_entry"><para role="column_definition">
2209-
<structfield>sync_error_count</structfield> <type>bigint</type>
2209+
<structfield>sync_table_error_count</structfield> <type>bigint</type>
22102210
</para>
22112211
<para>
22122212
Number of times an error occurred during the initial table

src/backend/catalog/system_views.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,8 +1415,8 @@ CREATE VIEW pg_stat_subscription_stats AS
14151415
ss.subid,
14161416
s.subname,
14171417
ss.apply_error_count,
1418-
ss.seq_sync_error_count,
1419-
ss.sync_error_count,
1418+
ss.sync_seq_error_count,
1419+
ss.sync_table_error_count,
14201420
ss.confl_insert_exists,
14211421
ss.confl_update_origin_differs,
14221422
ss.confl_update_exists,

src/backend/utils/activity/pgstat_subscription.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ pgstat_report_subscription_error(Oid subid, LogicalRepWorkerType wtype)
4141
break;
4242

4343
case WORKERTYPE_SEQUENCESYNC:
44-
pending->seq_sync_error_count++;
44+
pending->sync_seq_error_count++;
4545
break;
4646

4747
case WORKERTYPE_TABLESYNC:
48-
pending->sync_error_count++;
48+
pending->sync_table_error_count++;
4949
break;
5050

5151
default:
@@ -131,8 +131,8 @@ pgstat_subscription_flush_cb(PgStat_EntryRef *entry_ref, bool nowait)
131131

132132
#define SUB_ACC(fld) shsubent->stats.fld += localent->fld
133133
SUB_ACC(apply_error_count);
134-
SUB_ACC(seq_sync_error_count);
135-
SUB_ACC(sync_error_count);
134+
SUB_ACC(sync_seq_error_count);
135+
SUB_ACC(sync_table_error_count);
136136
for (int i = 0; i < CONFLICT_NUM_TYPES; i++)
137137
SUB_ACC(conflict_count[i]);
138138
#undef SUB_ACC

src/backend/utils/adt/pgstatfuncs.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2221,9 +2221,9 @@ pg_stat_get_subscription_stats(PG_FUNCTION_ARGS)
22212221
OIDOID, -1, 0);
22222222
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "apply_error_count",
22232223
INT8OID, -1, 0);
2224-
TupleDescInitEntry(tupdesc, (AttrNumber) 3, "seq_sync_error_count",
2224+
TupleDescInitEntry(tupdesc, (AttrNumber) 3, "sync_seq_error_count",
22252225
INT8OID, -1, 0);
2226-
TupleDescInitEntry(tupdesc, (AttrNumber) 4, "sync_error_count",
2226+
TupleDescInitEntry(tupdesc, (AttrNumber) 4, "sync_table_error_count",
22272227
INT8OID, -1, 0);
22282228
TupleDescInitEntry(tupdesc, (AttrNumber) 5, "confl_insert_exists",
22292229
INT8OID, -1, 0);
@@ -2258,11 +2258,11 @@ pg_stat_get_subscription_stats(PG_FUNCTION_ARGS)
22582258
/* apply_error_count */
22592259
values[i++] = Int64GetDatum(subentry->apply_error_count);
22602260

2261-
/* seq_sync_error_count */
2262-
values[i++] = Int64GetDatum(subentry->seq_sync_error_count);
2261+
/* sync_seq_error_count */
2262+
values[i++] = Int64GetDatum(subentry->sync_seq_error_count);
22632263

2264-
/* sync_error_count */
2265-
values[i++] = Int64GetDatum(subentry->sync_error_count);
2264+
/* sync_table_error_count */
2265+
values[i++] = Int64GetDatum(subentry->sync_table_error_count);
22662266

22672267
/* conflict count */
22682268
for (int nconflict = 0; nconflict < CONFLICT_NUM_TYPES; nconflict++)

src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@
5757
*/
5858

5959
/* yyyymmddN */
60-
#define CATALOG_VERSION_NO 202511101
60+
#define CATALOG_VERSION_NO 202511181
6161

6262
#endif

src/include/catalog/pg_proc.dat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5706,7 +5706,7 @@
57065706
proparallel => 'r', prorettype => 'record', proargtypes => 'oid',
57075707
proallargtypes => '{oid,oid,int8,int8,int8,int8,int8,int8,int8,int8,int8,int8,int8,timestamptz}',
57085708
proargmodes => '{i,o,o,o,o,o,o,o,o,o,o,o,o,o}',
5709-
proargnames => '{subid,subid,apply_error_count,seq_sync_error_count,sync_error_count,confl_insert_exists,confl_update_origin_differs,confl_update_exists,confl_update_deleted,confl_update_missing,confl_delete_origin_differs,confl_delete_missing,confl_multiple_unique_conflicts,stats_reset}',
5709+
proargnames => '{subid,subid,apply_error_count,sync_seq_error_count,sync_table_error_count,confl_insert_exists,confl_update_origin_differs,confl_update_exists,confl_update_deleted,confl_update_missing,confl_delete_origin_differs,confl_delete_missing,confl_multiple_unique_conflicts,stats_reset}',
57105710
prosrc => 'pg_stat_get_subscription_stats' },
57115711
{ oid => '6118', descr => 'statistics: information about subscription',
57125712
proname => 'pg_stat_get_subscription', prorows => '10', proisstrict => 'f',

src/include/pgstat.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ typedef struct PgStat_FunctionCallUsage
109109
typedef struct PgStat_BackendSubEntry
110110
{
111111
PgStat_Counter apply_error_count;
112-
PgStat_Counter seq_sync_error_count;
113-
PgStat_Counter sync_error_count;
112+
PgStat_Counter sync_seq_error_count;
113+
PgStat_Counter sync_table_error_count;
114114
PgStat_Counter conflict_count[CONFLICT_NUM_TYPES];
115115
} PgStat_BackendSubEntry;
116116

@@ -418,8 +418,8 @@ typedef struct PgStat_SLRUStats
418418
typedef struct PgStat_StatSubEntry
419419
{
420420
PgStat_Counter apply_error_count;
421-
PgStat_Counter seq_sync_error_count;
422-
PgStat_Counter sync_error_count;
421+
PgStat_Counter sync_seq_error_count;
422+
PgStat_Counter sync_table_error_count;
423423
PgStat_Counter conflict_count[CONFLICT_NUM_TYPES];
424424
TimestampTz stat_reset_timestamp;
425425
} PgStat_StatSubEntry;

src/test/regress/expected/rules.out

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2191,8 +2191,8 @@ pg_stat_subscription| SELECT su.oid AS subid,
21912191
pg_stat_subscription_stats| SELECT ss.subid,
21922192
s.subname,
21932193
ss.apply_error_count,
2194-
ss.seq_sync_error_count,
2195-
ss.sync_error_count,
2194+
ss.sync_seq_error_count,
2195+
ss.sync_table_error_count,
21962196
ss.confl_insert_exists,
21972197
ss.confl_update_origin_differs,
21982198
ss.confl_update_exists,
@@ -2203,7 +2203,7 @@ pg_stat_subscription_stats| SELECT ss.subid,
22032203
ss.confl_multiple_unique_conflicts,
22042204
ss.stats_reset
22052205
FROM pg_subscription s,
2206-
LATERAL pg_stat_get_subscription_stats(s.oid) ss(subid, apply_error_count, seq_sync_error_count, sync_error_count, confl_insert_exists, confl_update_origin_differs, confl_update_exists, confl_update_deleted, confl_update_missing, confl_delete_origin_differs, confl_delete_missing, confl_multiple_unique_conflicts, stats_reset);
2206+
LATERAL pg_stat_get_subscription_stats(s.oid) ss(subid, apply_error_count, sync_seq_error_count, sync_table_error_count, confl_insert_exists, confl_update_origin_differs, confl_update_exists, confl_update_deleted, confl_update_missing, confl_delete_origin_differs, confl_delete_missing, confl_multiple_unique_conflicts, stats_reset);
22072207
pg_stat_sys_indexes| SELECT relid,
22082208
indexrelid,
22092209
schemaname,

src/test/subscription/t/026_stats.pl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ sub create_sub_pub_w_errors
7979
$db,
8080
qq[
8181
SELECT count(1) = 1 FROM pg_stat_subscription_stats
82-
WHERE subname = '$sub_name' AND seq_sync_error_count > 0 AND sync_error_count > 0
82+
WHERE subname = '$sub_name' AND sync_seq_error_count > 0 AND sync_table_error_count > 0
8383
])
8484
or die
8585
qq(Timed out while waiting for sequencesync errors and tablesync errors for subscription '$sub_name');
@@ -175,8 +175,8 @@ sub create_sub_pub_w_errors
175175
is( $node_subscriber->safe_psql(
176176
$db,
177177
qq(SELECT apply_error_count > 0,
178-
seq_sync_error_count > 0,
179-
sync_error_count > 0,
178+
sync_seq_error_count > 0,
179+
sync_table_error_count > 0,
180180
confl_insert_exists > 0,
181181
confl_delete_missing > 0,
182182
stats_reset IS NULL
@@ -197,8 +197,8 @@ sub create_sub_pub_w_errors
197197
is( $node_subscriber->safe_psql(
198198
$db,
199199
qq(SELECT apply_error_count = 0,
200-
seq_sync_error_count = 0,
201-
sync_error_count = 0,
200+
sync_seq_error_count = 0,
201+
sync_table_error_count = 0,
202202
confl_insert_exists = 0,
203203
confl_delete_missing = 0,
204204
stats_reset IS NOT NULL
@@ -242,8 +242,8 @@ sub create_sub_pub_w_errors
242242
is( $node_subscriber->safe_psql(
243243
$db,
244244
qq(SELECT apply_error_count > 0,
245-
seq_sync_error_count > 0,
246-
sync_error_count > 0,
245+
sync_seq_error_count > 0,
246+
sync_table_error_count > 0,
247247
confl_insert_exists > 0,
248248
confl_delete_missing > 0,
249249
stats_reset IS NULL
@@ -263,8 +263,8 @@ sub create_sub_pub_w_errors
263263
is( $node_subscriber->safe_psql(
264264
$db,
265265
qq(SELECT apply_error_count = 0,
266-
seq_sync_error_count = 0,
267-
sync_error_count = 0,
266+
sync_seq_error_count = 0,
267+
sync_table_error_count = 0,
268268
confl_insert_exists = 0,
269269
confl_delete_missing = 0,
270270
stats_reset IS NOT NULL
@@ -278,8 +278,8 @@ sub create_sub_pub_w_errors
278278
is( $node_subscriber->safe_psql(
279279
$db,
280280
qq(SELECT apply_error_count = 0,
281-
seq_sync_error_count = 0,
282-
sync_error_count = 0,
281+
sync_seq_error_count = 0,
282+
sync_table_error_count = 0,
283283
confl_insert_exists = 0,
284284
confl_delete_missing = 0,
285285
stats_reset IS NOT NULL

0 commit comments

Comments
 (0)