db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DERBY-6398) SYSCS_FREEZE_DATABASE locks-up if there are large records that haven't been flushed to the disk
Date Thu, 07 Nov 2013 09:47:17 GMT

     [ https://issues.apache.org/jira/browse/DERBY-6398?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Knut Anders Hatlen updated DERBY-6398:

    Attachment: D6398.java

Thanks, got it!

The statement right before the freeze seems to have modified the table so that a long column
value (such as a CLOB) has been orphaned. When the transaction has been committed, Derby tries
to reclaim the space held by the orphaned CLOB value. This work happens in the top-level transaction,
and it is committed without syncing the log (presumably because this cleanup is just an optimization
and is not essential to redo in crash recovery).

Since the previous transaction did not sync the log file, the auto-commit after freeze will
try to sync it, but it is blocked from doing so because the database is frozen and doesn't
accept any writing.

I've reproduced the hang in my environment. See the attached D6398.java file. It inserts a
CLOB into a table, then overwrites it with a NULL value, before it finally calls SYSCS_FREEZE_DATABASE.
Setting the CLOB to NULL orphans the original CLOB value and makes Derby schedule post-commit
cleanup work, which is what causes the freeze call to hang.

> SYSCS_FREEZE_DATABASE locks-up if there are large records that haven't been flushed to
the disk
> -----------------------------------------------------------------------------------------------
>                 Key: DERBY-6398
>                 URL: https://issues.apache.org/jira/browse/DERBY-6398
>             Project: Derby
>          Issue Type: Bug
>          Components: Miscellaneous
>    Affects Versions:
>         Environment: Reliably demonstrated on Windows 7 with JDK 1.6.0_31
>            Reporter: Marty Backe
>             Fix For:
>         Attachments: D6398.java, report.txt
> If after writing a record that contains a large data column (>100KB), the FREEZE command
is issued, the command never returns (Derby appears to be dead-locked).
> E.g. sqlStatement.executeUpdate("CALL SYSCS_UTIL.SYSCS_FREEZE_DATABASE()");
> If the CALL SYSCS_UTIL.SYSCS_CHECKPOINT_DATABASE() command is first used before calling
FREEZE, it does not lock-up.
> It's my opinion that calling FREEZE should never result in a dead-locked Derby instance.

This message was sent by Atlassian JIRA

View raw message