Repository navigation
[ISSUE #7520] Reuse PostgreSQL initialization for openGauss. - #7530
Conversation
wy471x
left a comment
There was a problem hiding this comment.
Reviewed locally at fcb6092, checked against the merge base with master (380afb5):
- CI scripts pass on this head:
test-native-sql-matrix.py(26 tests OK) andtest-agent-gateway-migrations.py(10 tests OK — all five seeds report 24 matching Agent Gateway rows). - Comparing the deleted
db/init/og/create-table.sqlwith the reconcileddb/init/pg/create-table.sql: the 40 openGauss-only grant pairs all reference resources that do not exist in the PostgreSQL resource table, and 15 further rows duplicate a(role, resource)grant that already exists under a different id — no effective grant is lost. - The openGauss-only
plugin_handlerows are exactly the intended cleanups: the stale DubboloadBalance/loadStrategyduplicate (the properloadBalancehandle remains), and two rows where PostgreSQL's copy is the correct one — basicAuth'sdefaultHandleJsonext_obj is unescaped/invalid JSON in the openGauss seed and properly escaped in PostgreSQL, andindexNamefor loggingElasticSearch carriesrequired:1. The cache plugin'scacheType/timeoutSecondsrows exist in both files (only the id prefixes differ), so nothing is dropped there.
Same two structural requests as the OceanBase sibling (#7529):
- Rebase needed.
git merge-tree --write-tree gh/master <head>reports a modify/delete conflict ondb/init/og/create-table.sql— master removed 68 orphan permission rows from that file after your base (same cleanup class, so this should resolve cleanly once you re-run the seed reconciliation on top of current master). - State the scope. The PR also edits
db/init/pg/create-table.sql, so it changes what a fresh PostgreSQL install gets, not only openGauss. Please say so in the description (or split it); that is the part of the diff a PostgreSQL user actually experiences.
Documenting each schema/seed decision in the initialization guide, and adding the duplicate-natural-key / invalid-JSON / grant checks to the native matrix, is the right call for this kind of consolidation — much easier to review than the deleted duplicate scripts were.
fcb6092 to
b491697
Compare
Aias00
left a comment
There was a problem hiding this comment.
Review: [ISSUE #7520] Reuse PostgreSQL initialization for openGauss
Approved. A clean and well-reasoned consolidation of the openGauss initialization onto the PostgreSQL schema.
What's good
- Fresh-install openGauss now reuses
db/init/pg/create-table.sql:native-sql-matrix.pynow mapsogto"db/init/pg/create-table.sql"(wasdb/init/og/create-table.sql), and the entire 2418-linedb/init/og/create-table.sqlis deleted. The e2e scriptstorage_init_opengauss.shis updated accordingly (cp db/init/pg/create-table.sql ...). - Upgrade compatibility is preserved correctly: the matrix's
og+upgradeflow still validates against the historicalgit show {BASELINE}:db/init/og/create-table.sql(the released openGauss schema), andtest-native-sql-matrix.pyexplicitly asserts the working-treedb/init/og/create-table.sqlno longer exists (assertFalse). This is the right design — fresh installs converge, but upgrade drift is still caught against the prior release. - The PostgreSQL file is brought to a superset of the two dialects: the additions add the plugin/plugin_handle/namespace_plugin_rel seeds (
aiProxy,paramMapping,modifyResponse,loggingKafka, default-namespace bindings) that openGauss previously carried, and the deletions remove duplicatepermissionseed rows to reconcile the two schemas. The schema now carries a "Shared fresh-install schema for PostgreSQL and openGauss" header. native-sql-matrix.mdand the newtest-native-sql-matrix.pydocument and validate the shared matrix;check-agent-gateway-migrations.pyandtest-agent-gateway-migrations.pyare adjusted in tandem.
Verification / CI
build, the fullshenyu-integrated-test-*matrix,agent_gateway_migrations, andCodeQLall pass. The native-sql-matrix is the gate for the pg/og seed reconciliation.- The
e2efailure shown (e2e-logging-rocketmq-compose) is the fleet-wide rocketmq-logging e2e job and is unrelated to this DB-init PR (no logging/rocketmq code is touched here). Not blocking.
Non-blocking follow-ups
- Please confirm the removed
permissionseed rows (consecutive-ID chunks, e.g.1529403932881850584..592,1572525965658820609..617) are genuine duplicates rather than intended distinct entries — they look like dedup, and the matrix validates seeds, but a second set of eyes on the content is worth it. - Same for the added plugin seeds (
aiProxy/paramMapping/modifyResponse/loggingKafka): ensure they are intended for both pg and og fresh installs (they now are, by construction).
ci: build + integrated-tests + migrations green; e2e infra failure unrelated. Merging.
|
Hi @yangjj-iso, this PR currently has merge conflicts with the |
Aias00
left a comment
There was a problem hiding this comment.
Reuses the PostgreSQL fresh-install schema for openGauss (deletes the duplicate db/init/og/create-table.sql and routes og fresh/upgrade validation to the shared PG source). The change genuinely removes duplication, leaves every other dialect untouched, preserves the og upgrade path via the git baseline, and ships meaningful CI checks — APPROVE with one pre-merge verification.
No blocking defects found
The PR does what it claims. Below are the non-blocking observations and the single item that must be green in CI before merge.
Notes
-
Pre-merge verification (critical, not a defect):
db/upgrade/2.7.1-upgrade-2.7.2-og.sqlis not part of this diff, yetcheck-agent-gateway-migrations.pynow validates theogdialect againstdb/init/pg/create-table.sql(schema) vsdb/upgrade/2.7.1-upgrade-2.7.2-og.sql(migration). The new testtest_opengauss_uses_shared_schema_and_its_own_upgradewrites the realpg/create-table.sqland the real og upgrade into a temp tree and assertsCHECK.check(root)passes (only a deliberately corrupted upgrade raisesog: fresh-install/upgrade mismatch). That test, together with the existingtest_all_dialects_match, is exactly the guard that would catch a reconciliation mismatch — so the design intent (pg fresh == og upgrade target) is verified by CI, not by inspection. Confirm the CI run for this PR passestest-agent-gateway-migrationsandtest-native-sql-matrix. I could not execute these locally (the provided repo snapshot contains no working tree andghis disallowed), so this is the one fact I could not personally confirm. -
SENTINELreference in the newcheck_fresh_postgres_seeds:check_fresh_postgres_seeds(native-sql-matrix.py) usesSENTINEL(e.g.p.id<>'{SENTINEL}'). ConfirmSENTINELis defined at module scope. An undefined name would break module import and fail all matrix tests. Low risk — the existingcheck_fresh_mysql_schemaalready relies on the same constant (verify by grepping the module). -
Residual on-disk references to
db/init/og/create-table.sql: The file is deleted from the working tree and now exists only at the immutable git baseline (mirroring the already-deleteddb/init/ob/schema.sqlpattern, which is read viagit show {BASELINE}:db/init/ob/schema.sql). Grep the repo (e2e scripts, docker/compose, docs, and any Java DB-init code that may resolveog/create-table.sqlfrom the classpath) to ensure nothing still expects it on disk. The two known references (storage_init_opengauss.shand both CI scripts) are already updated in this PR. -
nit: The
verify_index_rowschange fromcolumn.strip().strip('"')tocolumn.strip().split()[0].strip('"')correctly handles pg_catalog-decorated index columns (e.g.(plugin_id COLLATE pg_catalog."default" …)) and is exercised by the newtest_pg_and_og_catalogssub-case. No action needed.
What the review confirmed
-
Genuine de-duplication, not relocation:
db/init/og/create-table.sql(2,891 lines) is fully deleted; bothcheck-agent-gateway-migrations.py(schema_dialect = {"ob": "mysql", "og": "pg"}) andnative-sql-matrix.py(DIALECTS["og"][1] == DIALECTS["pg"][1], asserted bytest_opengauss_shares_current_postgres_schema_but_keeps_released_baseline) now resolve the og fresh-install schema todb/init/pg/create-table.sql. The sharedpg/create-table.sqlis then enriched to become the canonical PG+openGauss 2.7.2 fresh state (removed orphan permission seeds,ruleHandlePageTypefor paramMapping/modifyResponse,bootstrapServerfor loggingKafka,loadBalancespelling/default for Dubbo, uniquediscovery_upstream_discovery_handler_id_idx— fixing a previously non-unique-but-renamed index — and aiProxy fallback without the obsoletepromptfield). -
Other dialects untouched: Only
pg/ogpaths in the scripts and the twopg/ogSQL files changed.mysql,ob,oracle,h2init/upgrade paths and their CI wiring are unchanged. The og upgrade flow still reads its historicaldb/init/og/create-table.sqlviagit show {BASELINE}:…(same mechanism asob), so existing openGauss installations upgrading from 2.7.1 are unaffected. -
Tests are meaningful, not empty shells:
test_opengauss_uses_shared_schema_and_its_own_upgraderuns the realCHECK.checkand proves a one-character upgrade mutation is detected;test_opengauss_storage_initialization_copies_the_shared_schemaactually executes the k8s storage script (withmkdir/wget/cpmocked) and asserts the copied bytes equalpg/create-table.sql; the newcheck_fresh_postgres_schema/check_fresh_postgres_seeds/check_discovery_upstream_uniquenessperform real column/nullability/primary-key/index/JSON/orphan checks and a live duplicate-insert rejection against the engine. These exercise the exact behavior the PR changes.
Conclusion
APPROVE.
Key verified facts:
- The duplicate openGauss init script is genuinely removed and openGauss now shares PostgreSQL's
pg/create-table.sqlacross the CI matrix, the migration checker, the storage script, and the init guide. - MySQL/Oracle/OpenGauss-upgrade/H2 paths are not regressed; the og upgrade continues via the git baseline, identical to the existing
obconvention. - The added tests are substantive and directly exercise the new shared-schema contract (including a deliberate mismatch that must be caught).
One action before merge: ensure CI is green for test-agent-gateway-migrations / test-native-sql-matrix (the og-against-pg-fresh consistency is validated only by those tests, which I could not run locally).
|
Thanks. The requested checks passed on 4254922: Agent Gateway migrations, native-matrix runner tests, PostgreSQL native checks, and openGauss native checks. I also reran the 29 matrix tests, 11 migration tests and all five dialect seed checks locally today; they all pass. The remaining failures in that run were the PostgreSQL storage and ZooKeeper cluster HTTP E2E cases: the logs show public |
Fixes #7520.
Fresh PostgreSQL and openGauss installations now use
db/init/pg/create-table.sql. The native SQL matrix, Agent Gateway seed checker and storage E2E setup use this shared source, and the separate current openGauss initialization copy is removed. OpenGauss profiles, JDBC/MyBatis integration and dialect-specific upgrade scripts remain in place. Upgrade validation continues to load the released openGauss schema from the immutable 2.7.1 baseline.This changes fresh PostgreSQL installations as well as openGauss. The shared script removes orphan permissions, retains PostgreSQL's table definitions and effective resource grants, restores the intended custom rule-page defaults and Kafka selector handles, consolidates the Dubbo load-balance handle, and aligns loggingKafka/aiProxy plugin and default-namespace configurations. Existing installations continue using their version-specific upgrade scripts. The initialization guide documents the schema and seed decisions and installation commands.
The branch includes
apache/shenyu:masterata89459bf2. The conflict resolution preserves the merged MySQL/OceanBase consolidation from #7529 alongside the PostgreSQL/openGauss checks: each pair retains its own fresh-schema validator, while OceanBase and openGauss upgrade flows keep their separate released baseline paths. The documentation describes both shared initialization sources. Historical SQL upgrade scripts are unchanged.Validation:
Follow-up at
3d8693cc1: synchronized master ata89459bf2, with no shared PG/openGauss SQL change or merge conflicts. Re-ran 29 native-matrix runner tests, 11 migration tests and five dialect seed checks locally; all pass. On the preceding4254922e9head, GitHub native PostgreSQL/openGauss jobs, runner tests and migration checks also passed. The remaining HTTP E2E failures show externalhttpbin.orgHTTP 503/timeouts; new CI was triggered by this push.Latest update at
4254922e9: 115 WebSocket/dependency tests and 96 Admin mapper/service/import tests passed with zero failures/errors/skips. The upstream snapshot assertion now verifiesapplyPluginDataSnapshot(namespace, []), fixing the stale assertion that failed CI. The 29 native-matrix runner tests, 11 Agent Gateway migration tests and all five dialect seed checks passed; the affected 34-module dependency reactor passed Checkstyle and Apache RAT. Native database-engine checks below were previously run atb010fa094; this update does not alter the shared PostgreSQL/openGauss SQL. GitHub CI is rerunning on the updated head.PostgreSQL 15 and openGauss lite 5.0.1: all four fresh-install and 2.7.1 upgrade flows passed using the digest-pinned Linux amd64 images. Fresh checks cover columns/nullability, primary keys, indexes, duplicate natural keys, JSON, resource grants and namespace defaults. The duplicate discovery-upstream insert is rejected by the intended unique index.
Native SQL runner regressions: 29 tests passed, including both OceanBase and openGauss historical-baseline selection and the actual storage schema-copy path.
Agent Gateway migration regressions: 11 tests passed. The seed checker passes for all five dialects, with 24 matching rows per dialect.
Admin plugin mapper/service/controller and query-index contracts: 72 tests passed, no failures/errors/skips; Checkstyle and Apache RAT passed for the 34-module dependency reactor.
git diff --checkpassed; no unresolved merge entries remain. The updated branch contains current master, so it can merge without conflicts.python3 -B .github/scripts/test-native-sql-matrix.py python3 -B .github/scripts/test-agent-gateway-migrations.py python3 -B .github/scripts/check-agent-gateway-migrations.py python3 -B .github/scripts/native-sql-matrix.py --dialect pg --output /tmp/shenyu-7530-audit-pg python3 -B .github/scripts/native-sql-matrix.py --dialect og --output /tmp/shenyu-7530-audit-og ./mvnw -B -ntp -pl shenyu-admin -am \ -Dtest=PluginMapperTest,PluginServiceTest,PluginControllerTest,AdminQueryIndexTest,PluginIndexUpgradeContractTest \ -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false \ -Djacoco.skip=true -Dmaven.javadoc.skip=true test apache-rat:checkThe complete gateway/storage E2E suite and full repository install were not run locally. GitHub CI must validate the updated merge head.
./mvnw clean install -Dmaven.javadoc.skip=true.