File tree
9 files changed
+287
-5
lines changed- doc/src/sgml
- src
- backend
- catalog
- postmaster
- tcop
- utils/adt
- include
- catalog
- test/regress/expected
9 files changed
+287
-5
lines changedLines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1554 | 1554 |
| |
1555 | 1555 |
| |
1556 | 1556 |
| |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
1557 | 1564 |
| |
1558 | 1565 |
| |
1559 | 1566 |
| |
|
Lines changed: 53 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
278 | 278 |
| |
279 | 279 |
| |
280 | 280 |
| |
281 |
| - | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
282 | 294 |
| |
283 | 295 |
| |
284 | 296 |
| |
| |||
599 | 611 |
| |
600 | 612 |
| |
601 | 613 |
| |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
602 | 654 |
| |
603 | 655 |
| |
604 | 656 |
| |
|
Lines changed: 13 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
506 | 506 |
| |
507 | 507 |
| |
508 | 508 |
| |
509 |
| - | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
510 | 522 |
| |
511 | 523 |
| |
512 | 524 |
| |
|
Lines changed: 69 additions & 0 deletions
<
10000
table aria-label="Diff for: src/backend/postmaster/pgstat.c" class="tab-size width-full DiffLines-module__tableLayoutFixed--ZmaVx" data-diff-anchor="diff-6161d3e2403ae3e7c0e8434321221ec00f45b6e924eb0825651cb3352a882eaa" data-tab-size="8" data-paste-markdown-skip="true" role="grid" style="--line-number-cell-width:52px;--line-number-cell-width-unified:104px">Original file line number Diff line number Diff line change
@@ -57,6 +57,7 @@
57
57
#include "storage/ipc.h"
58
58
#include "storage/pg_shmem.h"
59
59
#include "storage/pmsignal.h"
60
+#include "storage/procsignal.h"
60
61
#include "utils/guc.h"
61
62
#include "utils/memutils.h"
62
63
#include "utils/ps_status.h"
@@ -278,6 +279,7 @@ static void pgstat_recv_analyze(PgStat_MsgAnalyze *msg, int len);
278
279
static void pgstat_recv_bgwriter(PgStat_MsgBgWriter *msg, int len);
279
280
static void pgstat_recv_funcstat(PgStat_MsgFuncstat *msg, int len);
280
281
static void pgstat_recv_funcpurge(PgStat_MsgFuncpurge *msg, int len);
282
+static void pgstat_recv_recoveryconflict(PgStat_MsgRecoveryConflict *msg, int len);
281
283
282
284
283
285
/* ------------------------------------------------------------
@@ -1314,6 +1316,25 @@ pgstat_report_analyze(Relation rel, bool adopt_counts,
1314
1316
pgstat_send(&msg, sizeof(msg));
1315
1317
}
1316
1318
1319
+/* --------
1320
+ * pgstat_report_recovery_conflict() -
1321
+ *
1322
+ * Tell the collector about a Hot Standby recovery conflict.
1323
+ * --------
1324
+ */
1325
+void
1326
+pgstat_report_recovery_conflict(int reason)
1327
+{
1328
+ PgStat_MsgRecoveryConflict msg;
1329
+
1330
+ if (pgStatSock == PGINVALID_SOCKET || !pgstat_track_counts)
1331
+ return;
1332
+
1333
+ pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_RECOVERYCONFLICT);
1334
+ msg.m_databaseid = MyDatabaseId;
1335
+ msg.m_reason = reason;
1336
+ pgstat_send(&msg, sizeof(msg));
1337
+}
1317
1338
1318
1339
/* ----------
1319
1340
* pgstat_ping() -
@@ -3053,6 +3074,10 @@ PgstatCollectorMain(int argc, char *argv[])
30
E377
53
3074
pgstat_recv_funcpurge((PgStat_MsgFuncpurge *) &msg, len);
3054
3075
break;
3055
3076
3077
+ case PGSTAT_MTYPE_RECOVERYCONFLICT:
3078
+ pgstat_recv_recoveryconflict((PgStat_MsgRecoveryConflict *) &msg, len);
3079
+ break;
3080
+
3056
3081
default:
3057
3082
break;
3058
3083
}
@@ -3129,6 +3154,11 @@ pgstat_get_db_entry(Oid databaseid, bool create)
3129
3154
result->n_tuples_updated = 0;
3130
3155
result->n_tuples_deleted = 0;
3131
3156
result->last_autovac_time = 0;
3157
+ result->n_conflict_tablespace = 0;
3158
+ result->n_conflict_lock = 0;
3159
+ result->n_conflict_snapshot = 0;
3160
+ result->n_conflict_bufferpin = 0;
3161
+ result->n_conflict_startup_deadlock = 0;
3132
3162
3133
3163
memset(&hash_ctl, 0, sizeof(hash_ctl));
3134
3164
hash_ctl.keysize = sizeof(Oid);
@@ -4203,6 +4233,45 @@ pgstat_recv_bgwriter(PgStat_MsgBgWriter *msg, int len)
4203
4233
globalStats.buf_alloc += msg->m_buf_alloc;
4204
4234
}
4205
4235
4236
+/* ----------
4237
+ * pgstat_recv_recoveryconflict() -
4238
+ *
4239
+ * Process as RECOVERYCONFLICT message.
4240
+ * ----------
4241
+ */
4242
+static void
4243
+pgstat_recv_recoveryconflict(PgStat_MsgRecoveryConflict *msg, int len)
4244
+{
4245
+ PgStat_StatDBEntry *dbentry;
4246
+ dbentry = pgstat_get_db_entry(msg->m_databaseid, true);
4247
+
4248
+ switch (msg->m_reason)
4249
+ {
4250
+ case PROCSIG_RECOVERY_CONFLICT_DATABASE:
4251
+ /*
4252
+ * Since we drop the information about the database as soon
4253
+ * as it replicates, there is no point in counting these
4254
+ * conflicts.
4255
+ */
4256
+ break;
4257
+ case PROCSIG_RECOVERY_CONFLICT_TABLESPACE:
4258
+ dbentry->n_conflict_tablespace++;
4259
+ break;
4260
+ case PROCSIG_RECOVERY_CONFLICT_LOCK:
4261
+ dbentry->n_conflict_lock++;
4262
+ break;
4263
+ case PROCSIG_RECOVERY_CONFLICT_SNAPSHOT:
4264
+ dbentry->n_conflict_snapshot++;
4265
+ break;
4266
+ case PROCSIG_RECOVERY_CONFLICT_BUFFERPIN:
4267
+ dbentry->n_conflict_bufferpin++;
4268
+ break;
4269
+ case PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK:
4270
+ dbentry->n_conflict_startup_deadlock++;
4271
+ break;
4272
+ }
4273
+}
4274
+
4206
4275
/* ----------
4207
4276
* pgstat_recv_funcstat() -
4208
4277
*
Lines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2903 | 2903 |
| |
2904 | 2904 |
| |
2905 | 2905 |
| |
| 2906 | + | |
| 2907 | + | |
2906 | 2908 |
| |
2907 | 2909 |
| |
2908 | 2910 |
| |
2909 | 2911 |
| |
| 2912 | + | |
2910 | 2913 |
| |
| 2914 | + | |
| 2915 | + | |
2911 | 2916 |
| |
2912 | 2917 |
| |
2913 | 2918 |
| |
2914 | 2919 |
| |
| 2920 | + | |
2915 | 2921 |
| |
2916 | 2922 |
| |
2917 | 2923 |
| |
| |||
2956 | 2962 |
| |
2957 | 2963 |
| |
2958 | 2964 |
| |
| 2965 | + | |
2959 | 2966 |
| |
2960 | 2967 |
| |
2961 | 2968 |
| |
|
Lines changed: 101 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
71 | 71 |
| |
72 | 72 |
| |
73 | 73 |
| |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
74 | 80 |
| |
75 | 81 |
| |
76 | 82 |
| |
| |||
1129 | 1135 |
| |
1130 | 1136 |
| |
1131 | 1137 |
| |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
1132 | 1233 |
| |
1133 | 1234 |
| |
1134 | 1235 |
| |
|
Lines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3117 | 3117 |
| |
3118 | 3118 |
| |
3119 | 3119 |
| |
| 3120 | + | |
| 3121 | + | |
| 3122 | + | |
| 3123 | + | |
| 3124 | + | |
| 3125 | + | |
| 3126 | + | |
| 3127 | + | |
| 3128 | + | |
| 3129 | + | |
| 3130 | + | |
| 3131 | + | |
3120 | 3132 |
| |
3121 | 3133 |
| |
3122 | 3134 |
| |
|
0 commit comments