15724757448 opened a new issue, #10640:
URL: https://github.com/apache/shardingsphere/issues/10640
----------------------code----------------------
public final List<Connection> getConnections(final ConnectionMode
connectionMode, final String dataSourceName, final int connectionSize) throws
SQLException {
DataSource dataSource = getDataSourceMap().get(dataSourceName);
Preconditions.checkState(null != dataSource, "Missing the data
source name: '%s'", dataSourceName);
Collection<Connection> connections;
synchronized (cachedConnections) {
connections = cachedConnections.get(dataSourceName);
}
List<Connection> result;
if (connections.size() >= connectionSize) {
result = new ArrayList<>(connections).subList(0, connectionSize);
} else if (!connections.isEmpty()) {
result = new ArrayList<>(connectionSize);
result.addAll(connections);
List<Connection> newConnections =
createConnections(dataSourceName, connectionMode, dataSource, connectionSize -
connections.size());
result.addAll(newConnections);
synchronized (cachedConnections) {
cachedConnections.putAll(dataSourceName, newConnections);
}
} else {
result = new ArrayList<>(createConnections(dataSourceName,
connectionMode, dataSource, connectionSize));
synchronized (cachedConnections) {
cachedConnections.putAll(dataSourceName, result);
}
}
return result;
}
----------------------question----------------------
When cachedconnections > = connectionsize, the data source is obtained from
cachedconnections. If the maximum number of connections of the data source is
greater than max.connections.size.per.query, will the maximum number of links
never be used?
for example
<bean id="druidDataSource" class="com.alibaba.druid.pool.DruidDataSource" >
<property name="maxActive" value="80"/>
</bean>
<bean class="xxxDataSourceBuilder" actory-method="buildShardingDataSource">
<constructor-arg name="dataSource" ref="druidDataSource"/>
<constructor-arg name="properties">
<props>
<prop key="sql.show">true</prop>
<prop key="max.connections.size.per.query">20</prop>
<prop key="executor.size">20</prop>
</props>
</constructor-arg>
</bean>
maxActive=80. max.connections.size.per.query=20
If this data source is only used by shardingDataSource, is maxactive limited
to 20 at most?
--
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]