mirror of
https://github.com/percona/pg_stat_monitor.git
synced 2026-02-04 14:06:20 +00:00
PG-228: Fix hash table creation flags on PG <= 13.
Before PostgreSQL 14, HASH_STRINGS flag was not available when creating a hash table with ShmemInitHash(). Use HASH_BLOBS for previous PostgreSQL versions.
This commit is contained in:
@@ -47,6 +47,12 @@ static HTAB *pgsm_errors_ht = NULL;
|
|||||||
void psgm_errors_init(void)
|
void psgm_errors_init(void)
|
||||||
{
|
{
|
||||||
HASHCTL info;
|
HASHCTL info;
|
||||||
|
#if PG_VERSION_NUM >= 140000
|
||||||
|
int flags = HASH_ELEM | HASH_STRINGS;
|
||||||
|
#else
|
||||||
|
int flags = HASH_ELEM | HASH_BLOBS;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
memset(&info, 0, sizeof(info));
|
memset(&info, 0, sizeof(info));
|
||||||
info.keysize = ERROR_MSG_MAX_LEN;
|
info.keysize = ERROR_MSG_MAX_LEN;
|
||||||
@@ -55,7 +61,7 @@ void psgm_errors_init(void)
|
|||||||
PSGM_ERRORS_MAX, /* initial size */
|
PSGM_ERRORS_MAX, /* initial size */
|
||||||
PSGM_ERRORS_MAX, /* maximum size */
|
PSGM_ERRORS_MAX, /* maximum size */
|
||||||
&info,
|
&info,
|
||||||
HASH_ELEM | HASH_STRINGS);
|
flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t pgsm_errors_size(void)
|
size_t pgsm_errors_size(void)
|
||||||
|
|||||||
Reference in New Issue
Block a user