Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix for GRAILS-8433 using H2 database: increase H2 lock timeout from …

…1000 ms to 10000 ms

Conflicts:

	grails-resources/src/grails/grails-app/conf/DataSource.groovy
  • Loading branch information...
commit 69b918c14f14d9e36bcc594466bc70560340888f 1 parent 8de8dab
@lhotari lhotari authored
View
2  ...c/main/groovy/org/codehaus/groovy/grails/plugins/datasource/DataSourceGrailsPlugin.groovy
@@ -117,7 +117,7 @@ class DataSourceGrailsPlugin {
defaultReadOnly = readOnly
}
- url = ds.url ?: "jdbc:h2:mem:grailsDB;MVCC=TRUE"
+ url = ds.url ?: "jdbc:h2:mem:grailsDB;MVCC=TRUE;LOCK_TIMEOUT=10000"
String theUsername = ds.username ?: (defaultDriver ? "sa" : null)
if (theUsername != null) {
View
7 grails-resources/src/grails/grails-app/conf/DataSource.groovy
@@ -14,19 +14,20 @@ environments {
development {
dataSource {
dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
- url = "jdbc:h2:mem:devDb;MVCC=TRUE"
+ url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
}
}
test {
dataSource {
dbCreate = "update"
- url = "jdbc:h2:mem:testDb;MVCC=TRUE"
+ url = "jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
}
}
production {
dataSource {
dbCreate = "update"
- url = "jdbc:h2:prodDb;MVCC=TRUE"
+ url = "jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
+ pooled = true
properties {
maxActive = -1
minEvictableIdleTimeMillis=1800000
View
6 ...t/groovy/org/codehaus/groovy/grails/plugins/datasource/DataSourceGrailsPluginTests.groovy
@@ -141,7 +141,7 @@ class DataSourceGrailsPluginTests extends AbstractGrailsMockTests {
assertEquals "org.h2.Driver", parentBeanDef.propertyValues.getPropertyValue('driverClassName').value
assertEquals "sa", parentBeanDef.propertyValues.getPropertyValue('username').value
assertEquals "", parentBeanDef.propertyValues.getPropertyValue('password').value
- assertEquals "jdbc:h2:mem:grailsDB;MVCC=TRUE", parentBeanDef.propertyValues.getPropertyValue('url').value
+ assertEquals "jdbc:h2:mem:grailsDB;MVCC=TRUE;LOCK_TIMEOUT=10000", parentBeanDef.propertyValues.getPropertyValue('url').value
}
void testDataSourcePluginPoolingOn() {
@@ -373,7 +373,7 @@ class DataSourceGrailsPluginTests extends AbstractGrailsMockTests {
def config = new ConfigSlurper().parse '''
dataSource {
driverClassName = "org.h2.Driver"
- url = "jdbc:h2:mem:devDb;MVCC=TRUE"
+ url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
username = "sa"
password = ""
pooled = true
@@ -391,7 +391,7 @@ class DataSourceGrailsPluginTests extends AbstractGrailsMockTests {
assertEquals "org.h2.Driver", parentBeanDef.propertyValues.getPropertyValue('driverClassName').value
assertEquals "sa", parentBeanDef.propertyValues.getPropertyValue('username').value
assertEquals "", parentBeanDef.propertyValues.getPropertyValue('password').value
- assertEquals "jdbc:h2:mem:devDb;MVCC=TRUE", parentBeanDef.propertyValues.getPropertyValue('url').value
+ assertEquals "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000", parentBeanDef.propertyValues.getPropertyValue('url').value
}
private createAppCtx(config) {
View
4 scripts/Upgrade.groovy
@@ -151,8 +151,8 @@ move it to the new location of '${basedir}/test/integration'. Please move the di
def dsFile = new File(baseFile, "grails-app/conf/DataSource.groovy")
if (dsFile.exists() && argsMap.'update-data-source') {
- replace file:dsFile, token:"jdbc:hsqldb:mem:devDB", value:"jdbc:h2:mem:devDb;MVCC=TRUE"
- replace file:dsFile, token:"jdbc:hsqldb:mem:testDb",value: "jdbc:h2:mem:testDb;MVCC=TRUE"
+ replace file:dsFile, token:"jdbc:hsqldb:mem:devDB", value:"jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
+ replace file:dsFile, token:"jdbc:hsqldb:mem:testDb",value: "jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
replace file:dsFile, token:"org.hsqldb.jdbcDriver", value:"org.h2.Driver"
}
// if Config.groovy exists and it does not contain values for
Please sign in to comment.
Something went wrong with that request. Please try again.