Skip to content

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

Merged
merged 1 commit into from
Oct 30, 2023

Conversation

cbandy
Copy link
Member

@cbandy cbandy commented Oct 26, 2023

Checklist:

  • Have you added an explanation of what your changes do and why you'd like them to be included?
  • Have you updated or added documentation for the change, as applicable?
  • Have you tested your changes on all related environments with successful results, as applicable?
    • Have you added automated tests?

Type of Changes:

  • New feature

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)?

  • Breaking change (fix or feature that would cause existing functionality to change)

When included in user-defined libraries, citus is loaded first.

Other Information:

Fixes: #3194
Replaces: #3530
Resolves:#2915

Comment on lines -53 to -58
libraries := []string{"pg_stat_statements", "pgnodemx"}

defined, found := outParameters.Mandatory.Get("shared_preload_libraries")
if found {
libraries = append(libraries, defined)
}
Copy link
Contributor

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?

Copy link
Member Author

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.

Comment on lines +242 to +243
if strings.Contains(v, "citus") {
v = "citus," + v
Copy link
Contributor

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):

  1. we want citus to be first;
  2. citus can be present several times without side effect;
  3. removing citus from that list (from the non-first position) would be brittle

Is that a fair summation?

Copy link
Member Author

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.

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. :neckbeard:

@cbandy cbandy merged commit 0ed9fb9 into CrunchyData:master Oct 30, 2023
@cbandy cbandy deleted the citus-loading branch October 30, 2023 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Patroni dynamicConfiguration not working properly
2 participants