Skip to content

Commit

Permalink
change warning messages
Browse files Browse the repository at this point in the history
  • Loading branch information
KnightMurloc committed Dec 14, 2023
1 parent cdc9414 commit db86b9b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
9 changes: 6 additions & 3 deletions src/diskquota_utility.c
Original file line number Diff line number Diff line change
Expand Up @@ -1686,20 +1686,23 @@ DiskquotaShmemInitHash(const char *name, /* table string name fo

/*
* Returns HASH_FIND if hash table is full and HASH_ENTER otherwise.
* It can be used only under lock.
*/
HASHACTION
check_hash_fullness(HTAB *hashp, int max_size, const char *warning_message, TimestampTz *last_overflow_report,
int guc_value)
{
if (hash_get_num_entries(hashp) < max_size) return HASH_ENTER;
long num_entries = hash_get_num_entries(hashp);

if (hash_get_num_entries(hashp) == max_size)
if (num_entries < max_size) return HASH_ENTER;

if (num_entries == max_size)
{
TimestampTz current_time = GetCurrentTimestamp();
if (TimestampDifferenceExceeds(*last_overflow_report, current_time,
diskquota_hashmap_overflow_report_timeout * 1000))
{
ereport(WARNING, (errmsg(warning_message, guc_value)));
ereport(WARNING, (errmsg("%s %d", warning_message, guc_value)));
*last_overflow_report = current_time;
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/gp_activetable.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ TimestampTz active_tables_last_overflow_report = 0;
#define ACTIVE_TABLE_WARNING \
"[diskquota] the number of active tables reached the limit, please increase " \
"the GUC value for diskquota.max_active_tables. Current " \
"diskquota.max_active_tables value: %d"
"diskquota.max_active_tables value:"

/*
* monitored_dbid_cache is a allow list for diskquota
Expand All @@ -72,7 +72,7 @@ TimestampTz altered_reloid_cache_last_overflow_report = 0;
#define ALTERED_RELOID_CACHE_WARNING \
"[diskquota] the number of altered reloid cache entries reached the limit, please increase " \
"the GUC value for diskquota.max_active_tables. Current " \
"diskquota.max_active_tables value: %d"
"diskquota.max_active_tables value:"

/* active table hooks which detect the disk file size change. */
static file_create_hook_type prev_file_create_hook = NULL;
Expand Down Expand Up @@ -865,7 +865,6 @@ get_active_tables_oid(void)
hash_seq_init(&iter, local_active_table_file_map);
while ((active_table_file_entry = (DiskQuotaActiveTableFileEntry *)hash_seq_search(&iter)) != NULL)
{
/* TODO: handle possible ERROR here so that the bgworker will not go down. */
HASHACTION action = check_hash_fullness(active_tables_map, diskquota_max_active_tables, ACTIVE_TABLE_WARNING,
&active_tables_last_overflow_report, diskquota_max_active_tables);
hash_search(active_tables_map, active_table_file_entry, action, NULL);
Expand Down
12 changes: 6 additions & 6 deletions src/quotamodel.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ TimestampTz quota_info_map_last_overflow_report = 0;
#define QUOTA_INFO_WARNING \
"[diskquota] the number of quota probe reached the limit, please " \
"increase the GUC value for diskquota.max_quota_probes. Current " \
"diskquota.max_quota_probes value: %d"
"diskquota.max_quota_probes value:"

/* global rejectmap for which exceed their quota limit */
struct RejectMapEntry
Expand Down Expand Up @@ -194,7 +194,7 @@ static TimestampTz table_size_last_overflow_report = 0;
#define TABLE_SIZE_WARNING \
"[diskquota] the number of tables reached the limit, please increase " \
"the GUC value for diskquota.max_table_segments. Current " \
"diskquota.max_table_segments value: %d"
"diskquota.max_table_segments value:"

/* rejectmap for database objects which exceed their quota limit */
static HTAB *disk_quota_reject_map = NULL;
Expand All @@ -203,11 +203,11 @@ static HTAB *local_disk_quota_reject_map = NULL;
static TimestampTz disk_quota_reject_last_overflow_report = 0;
static TimestampTz local_disk_quota_reject_last_overflow_report = 0;

#define REJECT_MAP_WARNING \
"[diskquota] Shared disk quota reject map size limit reached (%d). " \
"Some out-of-limit schemas or roles will be lost in rejectmap."
#define REJECT_MAP_WARNING \
"[diskquota] Shared disk quota reject map size limit reached. " \
"Some out-of-limit schemas or roles will be lost in rejectmap. Current limit:"

#define LOCAL_REJECT_MAP_WARNING "[diskquota] the number of local reject map entries reached the limit (%d)"
#define LOCAL_REJECT_MAP_WARNING "[diskquota] the number of local reject map entries reached the limit:"

static shmem_startup_hook_type prev_shmem_startup_hook = NULL;

Expand Down
4 changes: 2 additions & 2 deletions src/relation_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ extern TimestampTz active_tables_last_overflow_report;
#define RELATION_CACHE_WARNING \
"[diskquota] the number of relation cache entries reached the limit, please increase " \
"the GUC value for diskquota.max_active_tables. Current " \
"diskquota.max_active_tables value: %d"
"diskquota.max_active_tables value:"

#define RELID_CACHE_WARNING \
"[diskquota] the number of relation cache entries reached the limit, please increase " \
"the GUC value for diskquota.max_active_tables. Current " \
"diskquota.max_active_tables value: %d"
"diskquota.max_active_tables value:"

static void update_relation_entry(Oid relid, DiskQuotaRelationCacheEntry *relation_entry,
DiskQuotaRelidCacheEntry *relid_entry);
Expand Down

0 comments on commit db86b9b

Please sign in to comment.