matrei commented on code in PR #16803:
URL: https://github.com/apache/grails-core/pull/16803#discussion_r4458114452


##########
grails-doc/src/en/guide/conf/dataSource.adoc:
##########
@@ -44,11 +44,15 @@ Once you have the JAR resolved you need to get familiar 
with how Grails manages
 * `readOnly` - If `true` makes the DataSource read-only, which results in the 
connection pool calling `setReadOnly(true)` on each `Connection`
 * `transactional` - If `false` leaves the DataSource's transactionManager bean 
outside the chained BE1PC transaction manager implementation. This only applies 
to additional datasources.
 * `persistenceInterceptor` - The default datasource is automatically wired up 
to the persistence interceptor, other datasources are not wired up 
automatically unless this is set to `true`
-* `properties` - Extra properties to set on the DataSource bean. See the 
https://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#Common_Attributes[Tomcat
 Pool] documentation. There is also a Javadoc format 
https://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/tomcat/jdbc/pool/PoolConfiguration.html[documentation
 of the properties].
-* `jmxExport` - If `false`, will disable registration of JMX MBeans for all 
DataSources. By default JMX MBeans are added for DataSources with `jmxEnabled = 
true` in properties.
+* `properties` - Extra properties to set on the DataSource bean. The supported 
properties depend on the connection pool implementation. See the 
https://github.com/brettwooldridge/HikariCP#configuration-knobs-baby[HikariCP 
configuration documentation] for HikariCP, or the 
https://tomcat.apache.org/tomcat-9.0-doc/jdbc-pool.html#Common_Attributes[Tomcat
 JDBC Pool documentation] for Tomcat JDBC Pool.

Review Comment:
   Two link fixes:
   
   - The HikariCP README heading starts with the :gear: emoji, so its anchor is 
`#gear-configuration-knobs-baby`. With `#configuration-knobs-baby` the link 
opens at the top of the README.
   - Grails 7 manages `tomcat-jdbc` at Tomcat 10.1 (`tomcat.version` is 
`10.1.61` in `dependencies.gradle`), so the 10.1 docs are the ones to link.
   
   ```suggestion
   * `properties` - Extra properties to set on the DataSource bean. The 
supported properties depend on the connection pool implementation. See the 
https://github.com/brettwooldridge/HikariCP#gear-configuration-knobs-baby[HikariCP
 configuration documentation] for HikariCP, or the 
https://tomcat.apache.org/tomcat-10.1-doc/jdbc-pool.html#Common_Attributes[Tomcat
 JDBC Pool documentation] for Tomcat JDBC Pool.
   ```



##########
grails-doc/src/en/guide/conf/dataSource.adoc:
##########
@@ -44,11 +44,15 @@ Once you have the JAR resolved you need to get familiar 
with how Grails manages
 * `readOnly` - If `true` makes the DataSource read-only, which results in the 
connection pool calling `setReadOnly(true)` on each `Connection`
 * `transactional` - If `false` leaves the DataSource's transactionManager bean 
outside the chained BE1PC transaction manager implementation. This only applies 
to additional datasources.
 * `persistenceInterceptor` - The default datasource is automatically wired up 
to the persistence interceptor, other datasources are not wired up 
automatically unless this is set to `true`
-* `properties` - Extra properties to set on the DataSource bean. See the 
https://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#Common_Attributes[Tomcat
 Pool] documentation. There is also a Javadoc format 
https://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/tomcat/jdbc/pool/PoolConfiguration.html[documentation
 of the properties].
-* `jmxExport` - If `false`, will disable registration of JMX MBeans for all 
DataSources. By default JMX MBeans are added for DataSources with `jmxEnabled = 
true` in properties.
+* `properties` - Extra properties to set on the DataSource bean. The supported 
properties depend on the connection pool implementation. See the 
https://github.com/brettwooldridge/HikariCP#configuration-knobs-baby[HikariCP 
configuration documentation] for HikariCP, or the 
https://tomcat.apache.org/tomcat-9.0-doc/jdbc-pool.html#Common_Attributes[Tomcat
 JDBC Pool documentation] for Tomcat JDBC Pool.
+* `jmxExport` - If `true`, registers JMX MBeans for Tomcat JDBC Pool 
DataSources with `jmxEnabled = true` in their properties (defaults to false). 
For HikariCP, use `properties.registerMbeans = true` instead.
 * `type` - The connection pool class if you want to force Grails to use it 
when there are more than one available.
 
-A typical configuration for MySQL in `application.groovy` may be something 
like:
+The following examples explicitly select HikariCP. Pool properties are not 
portable between implementations: Grails does not translate Tomcat JDBC Pool 
settings such as `maxActive`, `minIdle`, `maxWait`, or `jdbcInterceptors` into 
HikariCP settings. Unsupported properties can be silently ignored. For 
HikariCP, use `maximumPoolSize`, `minimumIdle`, and `connectionTimeout` (in 
milliseconds); there is no direct equivalent for Tomcat's `maxIdle` or 
`jdbcInterceptors`.

Review Comment:
   "can be silently ignored" undersells it a bit. The `properties` block is 
bound with Spring's `DataBinder`, which skips any name the pool class has no 
setter for, so a Tomcat setting on HikariCP is always ignored and the pool 
keeps its default. I tried `maxActive`, `maxWait`, `jmxEnabled` and 
`jdbcInterceptors` on a `HikariDataSource`: no error or warning, and 
`maximumPoolSize` stayed at 10 and `connectionTimeout` at 30000. That is 
exactly the trap the issue describes, so I'd say it plainly:
   
   ```suggestion
   The following examples explicitly select HikariCP. Pool properties are not 
portable between implementations: Grails does not translate Tomcat JDBC Pool 
settings such as `maxActive`, `minIdle`, `maxWait`, or `jdbcInterceptors` into 
HikariCP settings, and properties that the selected pool does not have are 
ignored without a warning. For HikariCP, use `maximumPoolSize`, `minimumIdle`, 
and `connectionTimeout` (in milliseconds); there is no direct equivalent for 
Tomcat's `maxIdle` or `jdbcInterceptors`.
   ```



##########
grails-doc/src/en/guide/conf/dataSource.adoc:
##########
@@ -44,11 +44,15 @@ Once you have the JAR resolved you need to get familiar 
with how Grails manages
 * `readOnly` - If `true` makes the DataSource read-only, which results in the 
connection pool calling `setReadOnly(true)` on each `Connection`
 * `transactional` - If `false` leaves the DataSource's transactionManager bean 
outside the chained BE1PC transaction manager implementation. This only applies 
to additional datasources.
 * `persistenceInterceptor` - The default datasource is automatically wired up 
to the persistence interceptor, other datasources are not wired up 
automatically unless this is set to `true`
-* `properties` - Extra properties to set on the DataSource bean. See the 
https://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#Common_Attributes[Tomcat
 Pool] documentation. There is also a Javadoc format 
https://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/tomcat/jdbc/pool/PoolConfiguration.html[documentation
 of the properties].
-* `jmxExport` - If `false`, will disable registration of JMX MBeans for all 
DataSources. By default JMX MBeans are added for DataSources with `jmxEnabled = 
true` in properties.
+* `properties` - Extra properties to set on the DataSource bean. The supported 
properties depend on the connection pool implementation. See the 
https://github.com/brettwooldridge/HikariCP#configuration-knobs-baby[HikariCP 
configuration documentation] for HikariCP, or the 
https://tomcat.apache.org/tomcat-9.0-doc/jdbc-pool.html#Common_Attributes[Tomcat
 JDBC Pool documentation] for Tomcat JDBC Pool.
+* `jmxExport` - If `true`, registers JMX MBeans for Tomcat JDBC Pool 
DataSources with `jmxEnabled = true` in their properties (defaults to false). 
For HikariCP, use `properties.registerMbeans = true` instead.
 * `type` - The connection pool class if you want to force Grails to use it 
when there are more than one available.
 
-A typical configuration for MySQL in `application.groovy` may be something 
like:
+The following examples explicitly select HikariCP. Pool properties are not 
portable between implementations: Grails does not translate Tomcat JDBC Pool 
settings such as `maxActive`, `minIdle`, `maxWait`, or `jdbcInterceptors` into 
HikariCP settings. Unsupported properties can be silently ignored. For 
HikariCP, use `maximumPoolSize`, `minimumIdle`, and `connectionTimeout` (in 
milliseconds); there is no direct equivalent for Tomcat's `maxIdle` or 
`jdbcInterceptors`.
+
+To use Tomcat-specific properties instead, select `type = 
"org.apache.tomcat.jdbc.pool.DataSource"` and ensure Tomcat JDBC Pool is on the 
classpath.

Review Comment:
   New apps only get HikariCP, so it would help to show how to get Tomcat JDBC 
Pool onto the classpath. The Grails BOM manages its version:
   
   ```suggestion
   To use Tomcat-specific properties instead, add `runtimeOnly 
'org.apache.tomcat:tomcat-jdbc'` to your dependencies (the Grails BOM manages 
its version) and select `type = "org.apache.tomcat.jdbc.pool.DataSource"`.
   ```



-- 
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]

Reply via email to