ShenFeng312 commented on issue #37183: URL: https://github.com/apache/shardingsphere/issues/37183#issuecomment-3594632843
I understand the issue you mentioned, but it seems difficult to verify. Based on the existing JDBC code, when autoCommit is not set to false (this is the prerequisite), JDBC will load all results into the ResultSet at once. The size of the result set is controlled by JDBC’s maxRows; if it is 0, it means “fetch all”. When autoCommit = false and setFetchSize = xx are configured, JDBC will fetch data in batches according to the fetch size. Here, fetchSize is essentially equivalent to our maxRows in the ExecutePacket. If it is 0, it will fetch everything. To solve the problem, we might need to properly manage the transaction state. It’s very likely that before executing EXECUTE, we need to explicitly set autoCommit = false (if it was previously true), then perform streaming fetches using a reasonable fetch size. I’m not sure whether the proxy can handle this properly. After the fetch is completed, we should restore autoCommit = true (if it was originally true). Because indeed, blindly changing the fetch size will not take effect. The complexity here seems to exceed my expectations. Also note that the default behavior of JDBC is always to fetch all data, which is still dangerous for a gateway. @terrymanu -- 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]
