Skip to content

Commit a3fd5b4

Browse files
committed
[PGD 6.2.0] Add degrade statistics documentation
BDR-6925
1 parent 544bc9d commit a3fd5b4

File tree

3 files changed

+49
-13
lines changed

3 files changed

+49
-13
lines changed

product_docs/docs/pgd/6.2/reference/commit-scopes/degrading.mdx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,34 @@ ALL (left_dc) CAMO DEGRADE ON (timeout=20ms, require_write_lead=true) TO ASYNC
6262

6363
Again, you should set the `timeout` parameter, as the default is `0`.
6464

65+
## Monitoring degrade events
66+
67+
Degrade events are tracked in the [bdr.stat_commit_scope](/pgd/latest/reference/tables-views-functions/catalogs-visible/#bdrstat_commit_scope) view. Three key metrics provide visibility into degrade behavior:
68+
69+
- **`ndegrades`**: Counts per-transaction degrade events. Each time a backend hits the degrade timeout during commit and successfully degrades that transaction, this counter is incremented. This shows how many individual transactions have experienced degradation.
70+
71+
- **`nconfig_degrades`**: Counts configuration-level state changes to degraded mode. This is incremented when the background worker (manager process) switches the commit scope's shared state to degraded based on node availability checks. This indicates how many times the commit scope configuration itself entered degraded state, which then affects all subsequent transactions until recovered.
72+
73+
- **`last_state_change_time`**: Records the timestamp of the last configuration-level state change (either entering or recovering from degraded state). This helps identify when the commit scope last transitioned between normal and degraded operation, useful for correlating degrade events with other system events or outages.
74+
75+
### Example monitoring query
76+
77+
```sql
78+
-- View commit scope statistics including degrade events and last state change
79+
SELECT
80+
commit_scope_name,
81+
ndegrades,
82+
nconfig_degrades,
83+
last_state_change_time,
84+
CASE
85+
WHEN last_state_change_time IS NULL THEN 'never degraded'
86+
WHEN age(now(), last_state_change_time) < interval '5 seconds' THEN 'recently changed'
87+
ELSE 'stable for ' || age(now(), last_state_change_time)::text
88+
END AS state_change_info
89+
FROM bdr.stat_commit_scope
90+
WHERE ndegrades > 0 OR nconfig_degrades > 0
91+
ORDER BY last_state_change_time DESC NULLS LAST;
92+
```
93+
94+
These metrics together provide complete visibility into both immediate per-transaction fallback and longer-term state management degrade behavior, along with temporal context for troubleshooting.
6595

product_docs/docs/pgd/6.2/reference/monitoring/sql.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,13 @@ Commit scopes are our durability and consistency configuration framework. As suc
367367

368368
Accordingly, these two views show relevant statistics about commit scopes:
369369

370-
- [bdr.stat_commit_scope](/pgd/latest/reference/tables-views-functions/catalogs-visible/#bdrstat_commit_scope) for cumulative statistics for each commit scope.
370+
- [bdr.stat_commit_scope](/pgd/latest/reference/tables-views-functions/catalogs-visible/#bdrstat_commit_scope) for cumulative statistics for each commit scope, including degrade event counters (`ndegrades`, `nconfig_degrades`) and the timestamp of the last configuration state change (`last_state_change_time`).
371371

372372
- [bdr.stat_commit_scope_state](/pgd/latest/reference/tables-views-functions/catalogs-visible/#bdrstat_commit_scope_state) for information about the current use of commit scopes by backend processes.
373373

374+
For more information about monitoring degrade events, see [Monitoring degrade events](/pgd/latest/reference/commit-scopes/degrading/#monitoring-degrade-events).
375+
376+
374377
## Monitoring global locks
375378

376379
The global lock, which is currently used only for DDL replication, is a heavyweight

product_docs/docs/pgd/6.2/reference/tables-views-functions/catalogs-visible.mdx

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -953,18 +953,21 @@ A view containing statistics for each commit scope.
953953

954954
#### `bdr.stat_commit_scope` columns
955955

956-
| Column | Type | Description |
957-
| ------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------- |
958-
| commit_scope_name | name | Name of the commit scope
959-
| group_name | name | Name of group for which the commit scope is defined
960-
| ncalls | bigint | The number of times the commit scope was used
961-
| ncommits | bigint | The number of successful commits were made with the commit scope
962-
| naborts | bigint | The number of times the commit scope used was eventually aborted
963-
| total_commit_time | double precision | Total time spent committing using the commit scope, in milliseconds
964-
| min_commit_time | double precision | Minimum time spent committing using the commit scope, in milliseconds
965-
| max_commit_time | double precision | Maximum time spend committing using the commit scope, in milliseconds
966-
| mean_commit_time | double precision | Mean time spent committing using the commit scope, in milliseconds
967-
| stats_reset | timestamp with time zone | Time at which all statistics in the view were last reset
956+
| Column | Type | Description |
957+
| ----------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------- |
958+
| commit_scope_name | name | Name of the commit scope
959+
| group_name | name | Name of group for which the commit scope is defined
960+
| ncalls | bigint | The number of times the commit scope was used
961+
| ncommits | bigint | The number of successful commits were made with the commit scope
962+
| naborts | bigint | The number of times the commit scope used was eventually aborted
963+
| ndegrades | bigint | The number of per-transaction degrade events where a backend hit the degrade timeout during commit
964+
| nconfig_degrades | bigint | The number of configuration-level state changes to degraded mode by the background worker
965+
| last_state_change_time | timestamp with time zone | The timestamp of the last configuration-level state change (entering or recovering from degraded state)
966+
| total_commit_time | double precision | Total time spent committing using the commit scope, in milliseconds
967+
| min_commit_time | double precision | Minimum time spent committing using the commit scope, in milliseconds
968+
| max_commit_time | double precision | Maximum time spend committing using the commit scope, in milliseconds
969+
| mean_commit_time | double precision | Mean time spent committing using the commit scope, in milliseconds
970+
| stats_reset | timestamp with time zone | Time at which all statistics in the view were last reset
968971

969972
### `bdr.stat_commit_scope_state`
970973

0 commit comments

Comments
 (0)