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 "Jeff Mckenzie (JIRA)" <ji...@apache.org> on 2010/03/18 08:16:27 UTC

[jira] Created: (DERBY-4589) Corrupted database prevents startup and should be automatically repaired perhaps

Corrupted database prevents startup and should be automatically repaired perhaps
--------------------------------------------------------------------------------

                 Key: DERBY-4589
                 URL: https://issues.apache.org/jira/browse/DERBY-4589
             Project: Derby
          Issue Type: Improvement
    Affects Versions: 10.5.3.0
         Environment: Windows 2000, SP4. J2SE 1.6
            Reporter: Jeff Mckenzie


I have found a database in my application that prevents startup due to it being corrupted. 
The driver reports that the database does not exist, even though it does. Then when my app tries to create the database using ;create=true; on the URL it fails.

I think this happened due to the app being killed in Task Manager while it was creating the database.

I have the database saved so that you can reproduce the problem. (I'm not sure if I can attach it yet)



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


[jira] Commented: (DERBY-4589) Corrupted database prevents startup and should be automatically repaired perhaps

Posted by "Jeff Mckenzie (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12849361#action_12849361 ] 

Jeff Mckenzie commented on DERBY-4589:
--------------------------------------

If it is possible to determine that the database is half-created, then
either option 1 or 2 would be good. Otherwise, your app must make a guess.
At the moment my app renames the database to DB_NAME_corrupted, and carries
on making a new database (but it has no way of knowing whether there was any
data in the corrupted database, and no way of recovering it).

In any case the current behaviour (driver says the DB does not exist, and
then fails to create a new one), is not really correct. At least it should
know that there is a partially created database so the app can do something
about it, and is not guessing.

The main issue is that Derby should tell you whether there is any data in
the database, or that it is just a half-created database. I suppose writing
a creation completed flag to the database somewhere would be helpful.
Database creation should be atomic like a transaction - all or nothing. If
that creation completed flag is missing on next startup, then Derby could
safely assume that the creation was not completed and finish it off or
rebuild the DB from scratch. I'd favour option 1, because it gives the app
the chance to cancel the operation.

I've only encountered one other corrupt database, but that one had 20 MB of
data in it. All other problems I've seen were related to this DB creation
issue.

Thanks for your comments.




> Corrupted database prevents startup and should be automatically repaired perhaps
> --------------------------------------------------------------------------------
>
>                 Key: DERBY-4589
>                 URL: https://issues.apache.org/jira/browse/DERBY-4589
>             Project: Derby
>          Issue Type: Improvement
>    Affects Versions: 10.5.3.0
>         Environment: Windows 2000, SP4. J2SE 1.6
>            Reporter: Jeff Mckenzie
>         Attachments: 2010-03.zip
>
>
> I have found a database in my application that prevents startup due to it being corrupted. 
> The driver reports that the database does not exist, even though it does. Then when my app tries to create the database using ;create=true; on the URL it fails.
> I think this happened due to the app being killed in Task Manager while it was creating the database.
> I have the database saved so that you can reproduce the problem. (I'm not sure if I can attach it yet)

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


[jira] Updated: (DERBY-4589) Corrupted database prevents startup and should be automatically repaired perhaps

Posted by "Jeff Mckenzie (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4589?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeff Mckenzie updated DERBY-4589:
---------------------------------

    Attachment: 2010-03.zip

This is a database that is empty, but is corrupted somehow. 

Derby tries to create a new database because it doesn't see this database, but fails to create a new database, thus preventing the app from ever using it.



> Corrupted database prevents startup and should be automatically repaired perhaps
> --------------------------------------------------------------------------------
>
>                 Key: DERBY-4589
>                 URL: https://issues.apache.org/jira/browse/DERBY-4589
>             Project: Derby
>          Issue Type: Improvement
>    Affects Versions: 10.5.3.0
>         Environment: Windows 2000, SP4. J2SE 1.6
>            Reporter: Jeff Mckenzie
>         Attachments: 2010-03.zip
>
>
> I have found a database in my application that prevents startup due to it being corrupted. 
> The driver reports that the database does not exist, even though it does. Then when my app tries to create the database using ;create=true; on the URL it fails.
> I think this happened due to the app being killed in Task Manager while it was creating the database.
> I have the database saved so that you can reproduce the problem. (I'm not sure if I can attach it yet)

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


[jira] Updated: (DERBY-4589) Corrupted database prevents startup and should be automatically repaired perhaps

Posted by "Mike Matrigali (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4589?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Matrigali updated DERBY-4589:
----------------------------------

    Component/s: Store

> Corrupted database prevents startup and should be automatically repaired perhaps
> --------------------------------------------------------------------------------
>
>                 Key: DERBY-4589
>                 URL: https://issues.apache.org/jira/browse/DERBY-4589
>             Project: Derby
>          Issue Type: Improvement
>          Components: Store
>    Affects Versions: 10.5.3.0
>         Environment: Windows 2000, SP4. J2SE 1.6
>            Reporter: Jeff Mckenzie
>         Attachments: 2010-03.zip
>
>
> I have found a database in my application that prevents startup due to it being corrupted. 
> The driver reports that the database does not exist, even though it does. Then when my app tries to create the database using ;create=true; on the URL it fails.
> I think this happened due to the app being killed in Task Manager while it was creating the database.
> I have the database saved so that you can reproduce the problem. (I'm not sure if I can attach it yet)

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


[jira] Issue Comment Edited: (DERBY-4589) Corrupted database prevents startup and should be automatically repaired perhaps

Posted by "Jeff Mckenzie (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12849361#action_12849361 ] 

Jeff Mckenzie edited comment on DERBY-4589 at 3/25/10 6:20 AM:
---------------------------------------------------------------

If it is possible to determine that the database is half-created, then
either option 1 or 2 would be good. Otherwise, your app must make a guess.
At the moment my app renames the database to DB_NAME_corrupted, and carries
on making a new database (but it has no way of knowing whether there was any
data in the corrupted database, and no way of recovering it).

The main issue is that Derby should tell you whether there is any data in
the database, or that it is just a half-created database. I suppose writing
a creation completed flag to the database somewhere would be helpful.
Database creation should be atomic like a transaction - all or nothing. If
that creation completed flag is missing on next startup, then Derby could
safely assume that the creation was not completed and finish it off or
rebuild the DB from scratch. I'd favour option 1, because it gives the app
the chance to cancel the operation.

I've only encountered one other corrupt database, but that one had 20 MB of
data in it. All other problems I've seen were related to this DB creation
issue.

Thanks for your comments.




      was (Author: swagman):
    If it is possible to determine that the database is half-created, then
either option 1 or 2 would be good. Otherwise, your app must make a guess.
At the moment my app renames the database to DB_NAME_corrupted, and carries
on making a new database (but it has no way of knowing whether there was any
data in the corrupted database, and no way of recovering it).

In any case the current behaviour (driver says the DB does not exist, and
then fails to create a new one), is not really correct. At least it should
know that there is a partially created database so the app can do something
about it, and is not guessing.

The main issue is that Derby should tell you whether there is any data in
the database, or that it is just a half-created database. I suppose writing
a creation completed flag to the database somewhere would be helpful.
Database creation should be atomic like a transaction - all or nothing. If
that creation completed flag is missing on next startup, then Derby could
safely assume that the creation was not completed and finish it off or
rebuild the DB from scratch. I'd favour option 1, because it gives the app
the chance to cancel the operation.

I've only encountered one other corrupt database, but that one had 20 MB of
data in it. All other problems I've seen were related to this DB creation
issue.

Thanks for your comments.



  
> Corrupted database prevents startup and should be automatically repaired perhaps
> --------------------------------------------------------------------------------
>
>                 Key: DERBY-4589
>                 URL: https://issues.apache.org/jira/browse/DERBY-4589
>             Project: Derby
>          Issue Type: Improvement
>    Affects Versions: 10.5.3.0
>         Environment: Windows 2000, SP4. J2SE 1.6
>            Reporter: Jeff Mckenzie
>         Attachments: 2010-03.zip
>
>
> I have found a database in my application that prevents startup due to it being corrupted. 
> The driver reports that the database does not exist, even though it does. Then when my app tries to create the database using ;create=true; on the URL it fails.
> I think this happened due to the app being killed in Task Manager while it was creating the database.
> I have the database saved so that you can reproduce the problem. (I'm not sure if I can attach it yet)

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


[jira] Commented: (DERBY-4589) Corrupted database prevents startup and should be automatically repaired perhaps

Posted by "Rick Hillegas (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12849258#action_12849258 ] 

Rick Hillegas commented on DERBY-4589:
--------------------------------------

Other people have been confused by this behavior it seems.

Various tasks have to be performed before the database exists. For instance, service.properties must be written and the system tables must be created. What should happen if you try to connect to a partially created database?

1) Should you get a message saying that the database is unusable rather than a message saying that the database does not exist?

2) Should Derby raise an error saying that it is deleting or renaming the half-created database so that you can retry database creation?

Thanks.

> Corrupted database prevents startup and should be automatically repaired perhaps
> --------------------------------------------------------------------------------
>
>                 Key: DERBY-4589
>                 URL: https://issues.apache.org/jira/browse/DERBY-4589
>             Project: Derby
>          Issue Type: Improvement
>    Affects Versions: 10.5.3.0
>         Environment: Windows 2000, SP4. J2SE 1.6
>            Reporter: Jeff Mckenzie
>         Attachments: 2010-03.zip
>
>
> I have found a database in my application that prevents startup due to it being corrupted. 
> The driver reports that the database does not exist, even though it does. Then when my app tries to create the database using ;create=true; on the URL it fails.
> I think this happened due to the app being killed in Task Manager while it was creating the database.
> I have the database saved so that you can reproduce the problem. (I'm not sure if I can attach it yet)

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