menghaoranss opened a new pull request, #38672:
URL: https://github.com/apache/shardingsphere/pull/38672
Fixes #ISSUSE_ID.
Changes proposed in this pull request:
This PR refactors table identifier matching to support heterogeneous
protocol/storage database combinations while keeping existing behavior for
homogeneous deployments.
### What changed
1. Added LOGICAL_TABLE to IdentifierScope.
2. Moved logical-table matching rules into IdentifierCaseRuleSet (instead of
storing a separate logical rule in DatabaseIdentifierContext).
3. Kept TABLE scope aligned with storage-side identifier rules (physical
table matching).
4. Added heterogeneous lookup flag in DatabaseIdentifierContext and enabled
fallback initialization only when protocol type differs from storage type.
5. Updated ShardingSphereSchema table lookup flow:
- primary lookup: LOGICAL_TABLE index (protocol rule, heterogeneous only)
- fallback lookup: TABLE index (storage rule)
6. Kept physical metadata loading normalized by storage-side rules.
### Why
In heterogeneous scenarios (for example, MySQL protocol with Oracle
storage), logical table names and physical table names require different
identifier rules:
- logical names should follow protocol semantics
- physical names should follow storage semantics
This change provides both without requiring callers to know whether a name
is logical or physical.
### Scope / compatibility
- Homogeneous protocol/storage: no extra logical fallback index is
initialized.
- Heterogeneous protocol/storage: logical fallback index is initialized and
used.
- No table metadata object duplication; only additional index/mapping
references.
### Tests
Added/updated tests to cover:
- LOGICAL_TABLE rule wiring and heterogeneous flag behavior in
DatabaseIdentifierContextFactoryTest
- schema lookup behavior with logical-first fallback in heterogeneous mode
in ShardingSphereSchemaIdentifierTest
- existing infra/common targeted tests pass after changes.
---
Before committing this PR, I'm sure that I have checked the following
options:
- [ ] My code follows the [code of
conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/)
of this project.
- [ ] I have self-reviewed the commit code.
- [ ] I have (or in comment I request) added corresponding labels for the
pull request.
- [ ] I have passed maven check locally : `./mvnw clean install -B -T1C
-Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
- [ ] I have made corresponding changes to the documentation.
- [ ] I have added corresponding unit tests for my changes.
- [ ] I have updated the Release Notes of the current development version.
For more details, see [Update Release
Note](https://shardingsphere.apache.org/community/en/involved/contribute/contributor/)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]