Repository navigation
fix(admin): add PostgreSQL and Oracle reservation SQL for AppAuth requests - #8185
Conversation
…uests Co-authored-by: markxu <[email protected]>
Aias00
left a comment
There was a problem hiding this comment.
Request changes: the new dialect branches do not yet provide working production lifecycle behavior. The main issues are state literals changed by the configured SQL interceptors, openGauss syntax/dialect selection, and the remaining Oracle concurrent-reservation failure.
Validation at head 99565ddd346aee3337bbda5911e51ac7ca29d0f8:
- Targeted
./mvnw -pl shenyu-admin -am testcompleted successfully: Maven reported 19 tests, 0 failures/errors, 2 skipped. The newly added test exercises six databaseIds through H2 modes; real-MySQL lifecycle suites requiring explicit JDBC properties were not enabled. - Additional probes used the actual mapper, production prepare interceptors, transaction-service body, driver metadata selection and facade. Sequential reservations preserve original id/hash/state/authId and their update-count differences are correctly ignored by the service.
- No native PostgreSQL, Oracle or openGauss service was available. H2-mode probes are not presented as native dialect certification; openGauss syntax was checked against the pinned engine's primary parser source, and Oracle concurrency against Oracle's published reproduction.
| (#{id,jdbcType=VARCHAR}, #{callerKey,jdbcType=VARCHAR}, #{namespaceId,jdbcType=VARCHAR}, | ||
| #{requestId,jdbcType=VARCHAR}, #{requestHash,jdbcType=VARCHAR}, #{authId,jdbcType=VARCHAR}, | ||
| #{state,jdbcType=VARCHAR}) | ||
| ON CONFLICT DO NOTHING |
There was a problem hiding this comment.
[P1] Use openGauss-supported conflict syntax and verify actual databaseId selection
ON CONFLICT DO NOTHING is PostgreSQL syntax, not a supported insert branch in the openGauss 5.0.1 engine pinned by this repository's native SQL matrix. Its versioned parser grammar accepts ON DUPLICATE KEY UPDATE (including NOTHING) and has no ON CONFLICT production; the official versioned INSERT reference matches that contract. The new H2 PostgreSQL-mode case cannot validate openGauss syntax.
There is also a selection issue: executing PgDatabaseMetaData.getDatabaseProductName() from the project's actual opengauss-jdbc:5.0.0-og dependency returns PostgreSQL. Passing that metadata through the real DataBaseConfiguration.databaseIdProvider() selects postgresql, so a normal openGauss deployment takes the other new branch, which contains the same unsupported clause; setting shenyu.database.dialect=opengauss only chooses the interceptor configuration. Please fix both the supported reservation statement and dialect selection, then verify the mapped operation on the claimed native openGauss version. Updating this explicit block alone will not fix the default driver path. I verified grammar/driver selection locally; no native openGauss server was available.
Co-authored-by: markxu <[email protected]>
|
@Aias00 Thanks for the detailed review. All three points are addressed in 0131a89. [P1] State literals and the prepare interceptors. The prepare interceptors still lowercase the SQL text. [P1] openGauss syntax and databaseId selection. openGauss now uses [P2] Oracle concurrent reservation. Oracle Testing. I don't have native PostgreSQL, Oracle or openGauss here, so the executable checks used H2 compatibility modes. H2 rejects |
Aias00
left a comment
There was a problem hiding this comment.
Reviewed 0131a89.
The prior dialect findings are addressed in source: lifecycle state values are bound parameters, configured openGauss selection is distinct from PostgreSQL vendor reporting and uses its own reservation syntax, and an Oracle duplicate-key reservation continues through the locked-row replay/conflict checks. Unrelated database failures still propagate.
Validation is limited to the mapped H2 compatibility and service/configuration regressions; one database-dependent case is skipped. H2 modes and mocked duplicate-key exceptions are not native PostgreSQL/Oracle/openGauss certification. The applicable native-sql-matrix jobs remain the merge gate.
Targeted test report: 10 cases, 0 failures, 0 errors, 1 skipped.
Validation used ./mvnw, Amazon Corretto 21 and project target Java 17. Targeted Checkstyle, separately executed Apache RAT and git diff --check pass. No full-repository or Docker E2E pass is claimed; required CI must succeed before merge.
Fixes #8133
What changed
AppAuthRequestMapper.reserveIfAbsentonly had MySQLINSERT ... ON DUPLICATE KEY UPDATE, so AppAuth apply/revoke failed when Admin's databaseId was PostgreSQL or Oracle.INSERT ... ON CONFLICT DO NOTHING.MERGEthat inserts only when(caller_key, namespace_id, request_id)is absent.MODE=MySQL), and OceanBase keep the existing statement. Nullable hash and auth id are bound asVARCHAR.The service still treats a locked row whose id differs from the candidate as a replay, so hash, state, and auth id are not overwritten.
Tests
AppAuthRequestReservationDialectTestruns the mapped statement for databaseIdsmysql,h2,oceanbase,postgresql,opengauss, andoracleon H2 compatibility modes. A second reserve leaves the original id, hash, andCREATEDstate, and a null-hashREVOKEDtombstone can be inserted. Checkstyle: 0 violations. RAT: Unapproved 0.H2 modes are not real PostgreSQL or Oracle. Two concurrent Oracle inserts of the same new key can still raise a unique-constraint error; MySQL
ON DUPLICATE KEYand PostgreSQLON CONFLICTabsorb that race.Make sure that:
./mvnw clean install -Dmaven.javadoc.skip=true.