bugfix: load cached UDF names during MetaStore initialization#1050
bugfix: load cached UDF names during MetaStore initialization#1050
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| /// Mark as ready | ||
| setReady(); | ||
|
|
||
| /// Load cached UDF names so UDF lookups work after restart | ||
| loadUserDefinedFunctions(); |
There was a problem hiding this comment.
Guard UDF cache loading with mutex
init() now calls loadUserDefinedFunctions() after flipping setReady(), but loadUserDefinedFunctions() inserts into udf_names without taking mutexes.udf_mu while later readers (e.g., listUserDefinedFunctions) hold that shared mutex. With ready set first, other threads unblocked by readiness can read the set under the lock while init() writes without one, leading to a data race/undefined behavior (or transient UNKNOWN_FUNCTION replies) during startup. Protect the load with the same mutex or perform it before setting ready.
Useful? React with 👍 / 👎.
PR checklist:
proton: starts/endsfor new code in existing community code base ?Please write user-readable short description of the changes:
fix #1049