fudianchn commented on PR #39613: URL: https://github.com/apache/shardingsphere/pull/39613#issuecomment-5673910409
The reconciliation now runs once per metadata instance instead of per accessor; pushed in `bb1d6c0b`. **Per-instance layout.** `ClientVisibleColumnLayout` (package-private, in the `jdbc` result set package) computes the client-visible decision and, when the returned metadata is authoritative, the visible-index mapping once per `ShardingSphereResultSetMetaData` instance (lazily, volatile-published, immutable). `getColumnCount()`, `getColumnName()` and `getColumnLabel()` reuse it, so the proxy query-header loop and the MySQL prepare metadata loop perform one reconciliation and one visibility pass per result set and each header reads exactly its own column; header construction is linear in the number of columns again. **Passthrough preserved.** When nothing can append derived columns (non-select statements or no derived projections), the client ordinal is used as the returned-metadata index as-is and the column count still reads the returned metadata, so callers that already know their column count, e.g. `DatabaseAdminQueryProxyBackendHandler`, keep their previous behavior. **Focused verification.** `assertReadingAllColumnHeadersReconcilesReturnedMetadataOnce` reads a whole header row through the drift + appended-derived-column path with counting stubs: on `bd23a77d` a 6-column result costs 64 `getColumnCount()` calls; on `bb1d6c0b` the same read costs exactly 4 `getColumnCount()` and `2 × 6 + 5` `getColumnLabel()` calls — the decision pass, the visibility pass and one read per accessor. The removed `ShardingSphereResultSetUtils.getVisibleColumnCount/Index` had no callers outside `ShardingSphereResultSetMetaData` and were never released. Gates: jdbc 1242/0, proxy/backend/core 583/0, proxy/frontend/dialect/mysql 200/0, spotless:check + checkstyle:check on all three modules. -- 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]
