fix: skip ProcessUtility hook in databases without the extension (whole-DB ANALYZE) - #3
Merged
Merged
Conversation
(cherry picked from commit 8ff22d4)
packaging.mk requires Cargo.toml version == git tag. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XGCecJYCz8dMTNPadEbeRf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On the OVH cluster (
pg_deltaxinshared_preload_libraries), a whole-databaseANALYZE;fails in every database that never ranCREATE EXTENSION pg_deltax— i.e. all 40+ dotCMS tenant DBs:Per-table
ANALYZE public.foo;works; only therels = NIL(whole-DB) form breaks.Root cause
restore_compressed_partition_stats()(src/copy.rs) runs after a whole-DBVACUUM/ANALYZEand queriesdeltax.deltax_partitionunconditionally.dotcms-0.2.0guards the DDL path only —lookup_target()insrc/ddl.rs(307bf31, issue xataio#24 follow-up) — soALTER TABLEis safe but the vacuum path is not.Upstream fixed this generally in xataio#25 by bailing out at the top of the ProcessUtility hook. That commit is not an ancestor of
dotcms-0.2.0.Fix
Cherry-pick upstream
8ff22d4(xataio#25) verbatim:catalog::catalog_present()— two syscache lookups (get_namespace_oid(missing_ok)+get_relname_relid), no SPI.deltax_process_utility()bails tochain_to_prev()when it returns false, beforerestore_stats_after_vacuumis computed — so it covers bothrestore_compressed_partition_stats()call sites and every other interception path (COPY, RENAME, GRANT, ALTER SCHEMA).tests/test_no_extension_db.py— 4 regression tests, includingtest_vacuum_analyze_without_extension, which exercises exactly the failingANALYZE(rels = NIL) form.Syscache lookups do no schema-ACL check, so this also sidesteps the
permission denied for schema deltaxfailure mode that forced 307bf31 (tenant roles lackingUSAGEon adeltaxschema inherited fromtemplate1).src/ddl.rs's existing guard is left in place — now redundant, but harmless and out of scope.Verification
cargo fmt -- --checkclean.get_namespace_oid/get_relname_relidare already used on this branch (src/scan/hook.rs,src/scan/cost.rs,src/scan/exec/segments.rs) with the same pgrx 0.17 signatures.tests/conftest.pyon this branch exports every symbol the new test imports (HOST_PORT,PG_USER,PG_PASSWORD,_admin_conn,pg_container).Next steps (not done here)
v0.2.0-dotcms.6on the merge commit →release.ymlbuilds the 4.debs.ovh-k8s-cluster, bumpARG PG_DELTAX_VERSIONinpostgres-cnpg/Dockerfile— its validate check races the fork release, so re-run it once the assets exist.postgres-ovh-eastby patching the live ClusterimageNameto the new digest.🤖 Generated with Claude Code
https://claude.ai/code/session_01XGCecJYCz8dMTNPadEbeRf