diff --git a/src/diskquota_utility.c b/src/diskquota_utility.c index e00f8b82..e1ccec5a 100644 --- a/src/diskquota_utility.c +++ b/src/diskquota_utility.c @@ -1691,19 +1691,22 @@ void * shm_hash_enter(HTAB *hashp, const void *keyPtr, bool *foundPtr, int max_size, const char *warning_message, TimestampTz *last_overflow_report, int guc_value) { - if (hash_get_num_entries(hashp) >= max_size) - { - return hash_search(hashp, keyPtr, HASH_FIND, foundPtr); - } - void *result = hash_search(hashp, keyPtr, HASH_ENTER, foundPtr); + void *result; + TimestampTz current_time; + + if (hash_get_num_entries(hashp) >= max_size) return hash_search(hashp, keyPtr, HASH_FIND, foundPtr); - TimestampTz current_time = GetCurrentTimestamp(); - if (hash_get_num_entries(hashp) >= max_size && - TimestampDifferenceExceeds(*last_overflow_report, current_time, - diskquota_hashmap_overflow_report_timeout * 1000)) + result = hash_search(hashp, keyPtr, HASH_ENTER, foundPtr); + + if (hash_get_num_entries(hashp) >= max_size) { - ereport(WARNING, (errmsg(warning_message, guc_value))); - *last_overflow_report = current_time; + current_time = GetCurrentTimestamp(); + if (TimestampDifferenceExceeds(*last_overflow_report, current_time, + diskquota_hashmap_overflow_report_timeout * 1000)) + { + ereport(WARNING, (errmsg(warning_message, guc_value))); + *last_overflow_report = current_time; + } } return result; } diff --git a/src/gp_activetable.c b/src/gp_activetable.c index 458fbbfe..0a78c64c 100644 --- a/src/gp_activetable.c +++ b/src/gp_activetable.c @@ -52,7 +52,7 @@ typedef struct DiskQuotaSetOFCache } DiskQuotaSetOFCache; HTAB *active_tables_map = NULL; // Set -time_t active_tables_last_overflow_report = 0; +TimestampTz active_tables_last_overflow_report = 0; #define ACTIVE_TABLE_ENTER(keyPtr, foundPtr) \ shm_hash_enter(active_tables_map, keyPtr, foundPtr, diskquota_max_active_tables, \