Commit Graph

2 Commits (6f353a5596e62b1afff58f783281cd3d2d6ab49e)

Author SHA1 Message Date
Diego Fronza 6f353a5596 PG-228: Add severity to the internal message logging API.
Add support to include the severity of messages added to the
pg_stat_monitor_errors view.
2021-12-30 09:46:15 -03:00
Diego Fronza c37713b9d5 PG-228: Add new view, pg_stat_monitor_errors.
The pg_stat_monitor_errors view was created in order to help inspecting
internal errors that may occur in pg_stat_monitor module itself, it
contains the error message, its severity, the last time the error occurred
and the number of times that any given error ocurred.

Implementation details:
 - A new lwlock was added to the pgssSharedState structure in order to
   control access to the errors hash table.
 - Increased RequestNamedLWLockTranche() no. of locks requested to 2.
 - The function GetNamedLWLockTranche() returns an array of locks, we
   use the first lock for controlling access to the usual buckets hash
   table, and the second one to control access to the errors hash table.
 - During module initialization (_PG_init) we increased the amount of
   shared memory space requested to include space to the new errors hash
   table: RequestAddinShmemSpace(... + pgsm_errors_size())
 - The implementation in pgsm_errors.c simple uses a hash table to track
   error messages, the message is also used as the key.
2021-12-30 09:46:12 -03:00