we are running Junit ans Selenium test cases from CI every midnight. We are pre populating the data using the Maven-SQL plugin as following.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>create-database-tables</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<autocommit>false</autocommit>
<onError>continue</onError>
<srcFiles>
<srcFile>../sql/delete_data.sql</srcFile>
<srcFile>../sql/load_data.sql</srcFile>
</srcFiles>
</configuration>
</execution>
</executions>
</plugin>
we are frequently facing the DB deadlocks due to simultaneous builds by different users. The solution we thought is to lock the database before running the DB scripts.
Can we lock the DB access before running the scripts and unlock it after running the scripts.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…