-
Notifications
You must be signed in to change notification settings - Fork 651
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
Add locking mechanism for tenant monitoring probabilistic approach #7026
Conversation
3e64a99
to
bc602c4
Compare
/* Set a good seed for random */ | ||
srandom((unsigned int) time(NULL)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need seed the random generator. It's already done by Postgres at process start.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the InitProcessGlobals
function in case you're interested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Realised this did not have test yet.
@@ -2473,12 +2473,12 @@ RegisterCitusConfigVariables(void) | |||
NULL, NULL, NULL); | |||
|
|||
|
|||
DefineCustomIntVariable( | |||
DefineCustomRealVariable( | |||
"citus.stat_tenants_sample_rate_for_new_tenants", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name needs some PM input.
012e259
to
bffa600
Compare
@@ -12,6 +12,7 @@ | |||
#include "unistd.h" | |||
|
|||
#include "access/hash.h" | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: unnecessary newline
Codecov Report
@@ Coverage Diff @@
## main #7026 +/- ##
==========================================
- Coverage 93.34% 93.32% -0.02%
==========================================
Files 273 273
Lines 58511 58514 +3
==========================================
- Hits 54618 54611 -7
- Misses 3893 3903 +10 |
2f6d7b6
to
13976e0
Compare
13976e0
to
34c9b69
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good, with the exception that we still need a decision on the name of the GUC.
…enants_untracked_sample_rate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but somehow the test is still a little bit flaky. I also don't see obvious reasons why that is happening though. The only thing that might help is adding a SELECT pg_sleep(0.1);
after the pg_reload_conf()
. We needed that in a few other tests because pg_reload_conf() is asynchronous. We already sleep here until the next period, but that might be to short if the new period is almost starting.
If that still doesn't help let's remove the final part of the test where the sample rate is 1. It's already tested earlier in this test file implicitly anyway.
5513f0a
to
20a2d17
Compare
This reverts commit 20a2d17.
16278e6
to
c39f851
Compare
c39f851
to
d64ff68
Compare
This PR
citus.stat_tenants_sample_rate_for_new_tenants
type to doublecitus.stat_tenants_sample_rate_for_new_tenants
tocitus.stat_tenants_untracked_sample_rate