Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADBDEV-4648: Limit diskquota hash table's size according initial request #28

Merged
merged 34 commits into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d0b41d6
Merge remote-tracking branch 'origin/2.3.0-sync2' into 2.3.0-sync
red1452 Nov 23, 2023
f7b0ca1
Limit diskquota hash table's size according initial request
KnightMurloc Nov 27, 2023
705d2ca
using functions to work with time from gpdb instead of libc. add flag…
KnightMurloc Nov 28, 2023
2e1eed7
Revert "using functions to work with time from gpdb instead of libc. …
KnightMurloc Nov 29, 2023
645fd60
using functions to work with time from gpdb instead of libc
KnightMurloc Nov 29, 2023
1e3f233
unified logic for adding elements to hash tables in shared memory for…
KnightMurloc Nov 30, 2023
7158307
few fixes
KnightMurloc Nov 30, 2023
800adc1
remake shm_hash_enter
KnightMurloc Nov 30, 2023
7ff7717
use TimestampTz instead of time_t
KnightMurloc Nov 30, 2023
1d4a647
Merge branch 'gpdb' into ADBDEV-4648
KnightMurloc Dec 5, 2023
bcae9e1
fix formating
KnightMurloc Dec 5, 2023
9844e59
fix formating
KnightMurloc Dec 5, 2023
8af2777
make tests more stable
KnightMurloc Dec 5, 2023
edbda84
change guc description. fix warning message
KnightMurloc Dec 6, 2023
a94fd92
rework
KnightMurloc Dec 13, 2023
cdc9414
fix format
KnightMurloc Dec 13, 2023
db86b9b
change warning messages
KnightMurloc Dec 14, 2023
652c111
change macro names
KnightMurloc Dec 14, 2023
785fecd
use an external table to check warnings in the test.
KnightMurloc Dec 21, 2023
cb4e1bf
rename waribles. remove GUC value from warning messages.
KnightMurloc Dec 22, 2023
b8bbfc8
Add guc diskquota.max_reject_entries that control size of
KnightMurloc Dec 25, 2023
f650b93
fix format
KnightMurloc Dec 25, 2023
77e6caa
change default value of table_size_map_last_overflow_report from 0 to…
KnightMurloc Dec 25, 2023
a03e278
add comment.
KnightMurloc Dec 25, 2023
f65bddd
fix format
KnightMurloc Dec 25, 2023
58acb43
fix test
KnightMurloc Dec 26, 2023
a26964f
move quota_info_map_last_overflow_report size adding to diskquota_wor…
KnightMurloc Dec 26, 2023
a84787d
change warning messages. move size adding of quota_info_map to diskqu…
KnightMurloc Dec 26, 2023
2a2ed36
make tests more stable
KnightMurloc Dec 26, 2023
df6ef6f
add comment to tests. add new line at the end of new test
KnightMurloc Dec 27, 2023
e6e4033
Merge branch 'gpdb' into ADBDEV-4648
andr-sokolov Dec 28, 2023
4508501
change macro to const varibles.
KnightMurloc Dec 29, 2023
7f66cd5
make warning constats static
KnightMurloc Dec 29, 2023
7139176
add static to altered_reloid_cache_warning
KnightMurloc Dec 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions src/diskquota_utility.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
RekGRpth marked this conversation as resolved.
Show resolved Hide resolved

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)
RekGRpth marked this conversation as resolved.
Show resolved Hide resolved
{
ereport(WARNING, (errmsg(warning_message, guc_value)));
*last_overflow_report = current_time;
current_time = GetCurrentTimestamp();
RekGRpth marked this conversation as resolved.
Show resolved Hide resolved
if (TimestampDifferenceExceeds(*last_overflow_report, current_time,
RekGRpth marked this conversation as resolved.
Show resolved Hide resolved
diskquota_hashmap_overflow_report_timeout * 1000))
{
ereport(WARNING, (errmsg(warning_message, guc_value)));
RekGRpth marked this conversation as resolved.
Show resolved Hide resolved
*last_overflow_report = current_time;
}
}
RekGRpth marked this conversation as resolved.
Show resolved Hide resolved
return result;
}
2 changes: 1 addition & 1 deletion src/gp_activetable.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ typedef struct DiskQuotaSetOFCache
} DiskQuotaSetOFCache;

HTAB *active_tables_map = NULL; // Set<DiskQuotaActiveTableFileEntry>
time_t active_tables_last_overflow_report = 0;
TimestampTz active_tables_last_overflow_report = 0;
RekGRpth marked this conversation as resolved.
Show resolved Hide resolved

#define ACTIVE_TABLE_ENTER(keyPtr, foundPtr) \
shm_hash_enter(active_tables_map, keyPtr, foundPtr, diskquota_max_active_tables, \
RekGRpth marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Loading