-
Notifications
You must be signed in to change notification settings - Fork 616
When requested, load the "citus" library first #3761
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
Conversation
libraries := []string{"pg_stat_statements", "pgnodemx"} | ||
|
||
defined, found := outParameters.Mandatory.Get("shared_preload_libraries") | ||
if found { | ||
libraries = append(libraries, defined) | ||
} |
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.
Making sure I'm following: this code here would've prepended "pg_stat_statements", "pgnodemx" to the list -- and we don't want them prepended, we want them appended, yeah?
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.
Yeah, this is a change.
if strings.Contains(v, "citus") { | ||
v = "citus," + v |
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.
Making sure I've got this (though the test helps):
- we want citus to be first;
- citus can be present several times without side effect;
- removing citus from that list (from the non-first position) would be brittle
Is that a fair summation?
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.
Is that a fair summation?
Yep.
2. citus can be present several times without side effect;
There is a set of related parameters for loading libraries that amount to LOAD
statements at certain times.
- https://www.postgresql.org/docs/current/runtime-config-client.html#RUNTIME-CONFIG-CLIENT-PRELOAD
- https://www.postgresql.org/docs/current/sql-load.html
If the file has been loaded already, the command does nothing.
Postgres compares inodes to detect symlink chains as well.
3. removing citus from that list (from the non-first position) would be brittle
A variety of names can refer to the same library. As I recall, citus
, citus.so
, and a full path are acceptable. This does not handle the full path case, but in my experience that is quite unusual.
Being more deliberate with these names requires parsing, which #3530 did partially. Ultimately, matching on names is still a step removed from the issue: the Citus code that complains could be in a file with any name.
Issue: PGO-284 Issue: CrunchyData#3194
Checklist:
Type of Changes:
What is the current behavior (link to any open issues here)?
User-defined libraries are loaded last. #3194
What is the new behavior (if this is a feature change)?
When included in user-defined libraries,
citus
is loaded first.Other Information:
Fixes: #3194
Replaces: #3530
Resolves:#2915