简体   繁体   中英

Grails changes for MySQL upgrade from 5.6 to 5.7

We are grails 2.3.11 and have been using MySQL 5.6 (AWS RDS) with Hibernate

The existing runtime dependency for MySQL and hibernate is following

dependencies {
        runtime 'mysql:mysql-connector-java:5.1.27'
...
...
...
plugins {
       runtime ":hibernate:3.6.10.19"

And Datasource is configured the following way. (Note we never set the dialect here)

dataSource {
    pooled = true
    jmxExport = true
    url = myjdbcURL
    driverClassName = "com.mysql.jdbc.Driver"
    username = myjdbcUserName
    password = myJdbcPassword
    properties {
        jmxEnabled = true
        initialSize = System.getenv("DB_INITIAL_SIZE")
        maxActive = System.getenv("DB_MAX_ACTIVE")
        minIdle = 5
        maxIdle = 25
        maxWait = 10000
        maxAge = 10 * 60000
        timeBetweenEvictionRunsMillis = 5000
        minEvictableIdleTimeMillis = 60000
        validationQuery = "SELECT 1"
        validationQueryTimeout = 3
        validationInterval = 15000
        testOnBorrow = true
        testWhileIdle = true
        testOnReturn = false
        ignoreExceptionOnPreLoad = true
        // http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#JDBC_interceptors
        jdbcInterceptors = "ConnectionState;StatementCache(max=200)"
        defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED // safe default
        // controls for leaked connections
        abandonWhenPercentageFull = 100 // settings are active only when pool is full
        removeAbandonedTimeout = 120
        removeAbandoned = true
        // use JMX console to change this setting at runtime
        logAbandoned = false // causes stacktrace recording overhead, use only for debugging
    }
}
hibernate {
    cache.use_second_level_cache = true
    cache.use_query_cache = false
    cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' // Hibernate 3
    show_sql = false
    format_sql = false
    use_sql_comments = false
}

Now we are looking to upgrade MySQL to 5.7 and am trying to find any documentation for grails to do so but cannot find it.

One thing I could see was the MySQL connector that we have been using only support 5.6 so that would be the first step would be to update this to mysql-connector-java:5.1.49 as I see that is the latest version and grails is running jdk 7, I cannot switch to connector 8.

I couldnt find anything related to hibernate as the Hibernate gorm plugin that we have been using with grails is the only one I could find https://mvnrepository.com/artifact/org.grails.plugins/hibernate/3.6.10.19

Finally we never had set Dialect for MySQL till now so was not sure if we should set a dialect explicitly.

We are looking for least downtime, hence our plan was make Grails app support MySQL 5.7 first and keep backward compatibility with MySQL 5.6 and then upgrade MySQL to 5.7 and should still work.

Has anyone done such upgrade? Your inputs would be very valuable to me.

I have been using an instance of Grails 2.3.11 with MySQL 5.7 via MySQL connector version 5.1.45 for a long time. So I would say that your general approach should work out fine, it is a valid and working combination.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM