You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Myrna van Lunteren (JIRA)" <ji...@apache.org> on 2008/10/03 03:06:44 UTC

[jira] Commented: (DERBY-3875) Derby cannot replace a database after encountering corruption

    [ https://issues.apache.org/jira/browse/DERBY-3875?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12636508#action_12636508 ] 

Myrna van Lunteren commented on DERBY-3875:
-------------------------------------------

I thought I'd try making a test for this, and I've got something started, but the patch doesn't actually seem to fix the problem for me.

The repro attached gives this output for me, with, or without the patch applied:
Exception in thread "main" java.sql.SQLException: Failed to start database 'testDatabase', see the next exception for details.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
	at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:223)
	at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.java:2611)
	at org.apache.derby.impl.jdbc.EmbedConnection.<init>(EmbedConnection.java:365)
	at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(EmbedConnection30.java:73)
	at org.apache.derby.jdbc.Driver30.getNewEmbedConnection(Driver30.java:80)
	at org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:238)
	at org.apache.derby.jdbc.AutoloadedDriver.connect(AutoloadedDriver.java:119)
	at java.sql.DriverManager.getConnection(DriverManager.java:525)
	at java.sql.DriverManager.getConnection(DriverManager.java:193)
	at FileCloseBugDemo.main(FileCloseBugDemo.java:46)
Caused by: java.sql.SQLException: Directory database\<pathtomytestdir>\database\testDatabase cannot be removed.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
	at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:201)
	at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.java:2609)
	... 8 more
Caused by: ERROR XBM0I: Directory database\<pathtomytestdir>\database\testDatabase cannot be removed.
	at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:286)
	at org.apache.derby.impl.services.monitor.StorageFactoryService$9.run(StorageFactoryService.java:666)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.apache.derby.impl.services.monitor.StorageFactoryService.createServiceRoot(StorageFactoryService.java:650)
	at org.apache.derby.impl.services.monitor.StorageFactoryService.recreateServiceRoot(StorageFactoryService.java:582)
	at org.apache.derby.impl.services.monitor.StorageFactoryService.getServiceProperties(StorageFactoryService.java:248)
	at org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(BaseMonitor.java:1568)
	at org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(BaseMonitor.java:1021)
	at org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Monitor.java:550)
	at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.java:2572)
	... 8 more


> Derby cannot replace a database after encountering corruption
> -------------------------------------------------------------
>
>                 Key: DERBY-3875
>                 URL: https://issues.apache.org/jira/browse/DERBY-3875
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.4.2.0
>         Environment: ------------------ Java Information ------------------
> Java Version:    1.6.0_06
> Java Vendor:     Sun Microsystems Inc.
> Java home:       C:\Program Files\Java\jre1.6.0_06
> Java classpath:  C:\Working\Derby-fileclose-fix\bin;C:\Working\Derby-fileclose-fix\lib\derby.jar
> OS name:         Windows XP
> OS architecture: x86
> OS version:      5.1
> Java user name:  Administrator
> Java user home:  C:\Documents and Settings\Administrator
> Java user dir:   C:\Working\Derby-fileclose-fix
> java.specification.name: Java Platform API Specification
> java.specification.version: 1.6
> --------- Derby Information --------
> JRE - JDBC: Java SE 6 - JDBC 4.0
> [C:\Working\Derby-fileclose-fix\lib\derby.jar] 10.4.2.0 - (689064)
> ------------------------------------------------------
> ----------------- Locale Information -----------------
> ------------------------------------------------------
>            Reporter: Jason McLaurin
>         Attachments: FileCloseBugDemo.java, FileCloseBugDemo.java, RAFContainerPatch.txt
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> When Derby encounters a corrupt data file, it does not close the data file before throwing an exception to the caller.  If the user tries to replace the database with a backup in response to the corruption, Derby will first attempt to delete the contents of the corrupt database.  But since the corrupt file was never closed, it cannot be deleted, and Derby fails to start.
> The attached java code should reproduce the problem, and the attached patch should fix it.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.