Repository navigation
Conversation
Assisted-by: OpenAI:gpt-5
📝 WalkthroughWalkthroughThe package cache cleanup paths now invalidate dependent functions and clear stale relation lists. Package-backed ChangesPackage cache safety
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/oracle_test/modules/test_package_reset/sql/test_discard_function_cache.sql`:
- Around line 25-26: Replace each EXPLAIN ANALYZE wrapper around EXECUTE
discard_package_call in
src/oracle_test/modules/test_package_reset/sql/test_discard_function_cache.sql
at lines 25-26, 31-32, and 37-38 with a direct EXECUTE discard_package_call;
statement so the returned value is verified. Update the corresponding expected
output in test_discard_function_cache.out to assert the returned row values,
including 42, instead of query-plan output.
In `@src/pl/plisql/src/pl_package.c`:
- Line 2499: Before resetting func->pkgcachelist, call list_free on the existing
list to release its cells, then assign NIL as the reset value. Update the
cleanup logic containing func->pkgcachelist and preserve the existing reset
behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 139ec27b-4f9f-485a-bbc8-fac78297a9f7
📒 Files selected for processing (4)
src/oracle_test/modules/test_package_reset/Makefilesrc/oracle_test/modules/test_package_reset/expected/test_discard_function_cache.outsrc/oracle_test/modules/test_package_reset/sql/test_discard_function_cache.sqlsrc/pl/plisql/src/pl_package.c
| EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) | ||
| EXECUTE discard_package_call; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Remove EXPLAIN ANALYZE to verify actual query results.
Wrapping the EXECUTE statement in EXPLAIN ANALYZE executes the plan but discards the query result from the output. To verify that the cached function correctly evaluates to 42 after DISCARD PACKAGE without silently returning null or garbage, simply EXECUTE the statement and assert the returned value.
As per path instructions, review tests for the correctness of query results. Note that applying this change will require updating the expected output in test_discard_function_cache.out to match the returned row values instead of the query plan.
src/oracle_test/modules/test_package_reset/sql/test_discard_function_cache.sql#L25-L26: replaceEXPLAIN (ANALYZE, ...)and the execution with justEXECUTE discard_package_call;src/oracle_test/modules/test_package_reset/sql/test_discard_function_cache.sql#L31-L32: replaceEXPLAIN (ANALYZE, ...)and the execution with justEXECUTE discard_package_call;src/oracle_test/modules/test_package_reset/sql/test_discard_function_cache.sql#L37-L38: replaceEXPLAIN (ANALYZE, ...)and the execution with justEXECUTE discard_package_call;
📍 Affects 1 file
src/oracle_test/modules/test_package_reset/sql/test_discard_function_cache.sql#L25-L26(this comment)src/oracle_test/modules/test_package_reset/sql/test_discard_function_cache.sql#L31-L32src/oracle_test/modules/test_package_reset/sql/test_discard_function_cache.sql#L37-L38
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@src/oracle_test/modules/test_package_reset/sql/test_discard_function_cache.sql`
around lines 25 - 26, Replace each EXPLAIN ANALYZE wrapper around EXECUTE
discard_package_call in
src/oracle_test/modules/test_package_reset/sql/test_discard_function_cache.sql
at lines 25-26, 31-32, and 37-38 with a direct EXECUTE discard_package_call;
statement so the returned value is verified. Update the corresponding expected
output in test_discard_function_cache.out to assert the returned row values,
including 42, instead of query-plan output.
Source: Path instructions
|
|
||
| plisql_remove_function_references(func, refcache); | ||
| } | ||
| func->pkgcachelist = NIL; |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Free the list before resetting to avoid a memory leak.
Setting the pkgcachelist to NIL abandons the memory allocated for the List and its cells. In PostgreSQL, this results in a memory leak if the list was allocated in a long-lived context. Use list_free to release the memory before resetting the pointer.
♻️ Proposed fix
- func->pkgcachelist = NIL;
+ list_free(func->pkgcachelist);
+ func->pkgcachelist = NIL;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| func->pkgcachelist = NIL; | |
| list_free(func->pkgcachelist); | |
| func->pkgcachelist = NIL; |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/pl/plisql/src/pl_package.c` at line 2499, Before resetting
func->pkgcachelist, call list_free on the existing list to release its cells,
then assign NIL as the reset value. Update the cleanup logic containing
func->pkgcachelist and preserve the existing reset behavior.
|
Thanks for your work! This fix is crucial for IvorySQL's stability. We'll discuss it further in our review meeting. |
|
Hi @Z95-cmyk, This pull request has been waiting for your response for about 106 days. Reason: Unresolved review comment exists (waiting about 106 days) Please:
This is an automated reminder. The label Thank you! |
Summary
DISCARD PACKAGEoperationsThis correctness fix was split from #1422 at the maintainer’s request so the crash fix can be reviewed independently from the performance optimization.
Fixes #1452
Verification
make -C src/oracle_test/modules/test_package_reset oracle-check— 5/5 tests passedDISCARD PACKAGEAI assistance disclosure
This contribution was prepared with OpenAI Codex using GPT-5. The agent assisted with source and test inspection, issue scoping, drafting code and tests, running verification, reproducing the pre-fix crash, and preparing the PR description. I directed the scope, reviewed the resulting changes against the source and test results, and remain responsible for the submission.
Summary by CodeRabbit
Bug Fixes
DISCARD PACKAGEoperations.Tests