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] [Commented] (DERBY-2354) Unable to perform select query using DISTINCT on a read-only database
Date Wed, 13 Apr 2011 20:44:06 GMT

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

Knut Anders Hatlen commented on DERBY-2354:

Hi Bryan,

The patch fixes the problem by spilling to disk on a writable location. It uses the derby.storage.tempDirectory
if it's set. Otherwise, some system-defined location is used. On my system, the temporary
files end up in directories under /var/tmp.

One other thing that's fixed by the patch, is a regression after DERBY-2537. Read-only databases
that were not stored in a jar or a zip used to work even when the hash tables spilled to disk
(with one caveat: you had to set derby.storage.tempDirectory or make the database's tmp directory
writable, since it would not use the system temp dir automatically). In 10.3, it started raising
this "feature not implemented" error because of the checkVersion() calls in B2IFactory and
HeapConglomerateFactory. Since the patch makes read-only databases stop calling checkVersion()
in those factories, these databases will get their pre-10.3 behaviour back.

> Unable to perform select query using DISTINCT on a read-only database
> ---------------------------------------------------------------------
>                 Key: DERBY-2354
>                 URL: https://issues.apache.org/jira/browse/DERBY-2354
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions:
>         Environment: Reproduced in WinXP professional, Linux (Ubuntu 6.10) with Sun Java
>            Reporter: Thomas Kelder
>            Assignee: Knut Anders Hatlen
>              Labels: derby_triage10_5_2
>         Attachments: DerbyTest.java, d2354-createdb.sql, d2354-repro.sql, derby-2354-1a.diff,
derby-2354-1b.diff, derby-2354-1c.diff
> It is not possible to perform queries using DISTINCT on a read-only database packaged
in a zip file. This generates the following error:
> ERROR 40XD1: Container was opened in read-only mode.   
> 	at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
> 	at org.apache.derby.impl.store.raw.data.BaseContainer.use(Unknown Source)
> 	at org.apache.derby.impl.store.raw.data.BaseContainerHandle.useContainer(Unknown Source)
> 	at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openContainer(Unknown Source)
> 	at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openContainer(Unknown Source)
> 	at org.apache.derby.impl.store.raw.xact.Xact.openContainer(Unknown Source)
> 	at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.addContainer(Unknown Source)
> 	at org.apache.derby.impl.store.raw.xact.Xact.addContainer(Unknown Source)
> 	at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
> 	at org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
> 	at org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown Source)
> 	at org.apache.derby.iapi.store.access.DiskHashtable.<init>(Unknown Source)
> 	at org.apache.derby.iapi.store.access.BackingStoreHashtable.spillToDisk(Unknown Source)
> 	at org.apache.derby.iapi.store.access.BackingStoreHashtable.add_row_to_hash_table(Unknown
> 	at org.apache.derby.iapi.store.access.BackingStoreHashtable.put(Unknown Source)
> 	at org.apache.derby.impl.store.access.btree.BTreeForwardScan.fetchRows(Unknown Source)
> 	at org.apache.derby.impl.store.access.btree.BTreeScan.fetchSet(Unknown Source)
> 	at org.apache.derby.impl.store.access.BackingStoreHashTableFromScan.<init>(Unknown
> 	at org.apache.derby.impl.store.access.RAMTransaction.createBackingStoreHashtableFromScan(Unknown
> 	at org.apache.derby.impl.sql.execute.HashScanResultSet.openCore(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeQuery(Unknown Source)
> 	at DerbyTest.main(DerbyTest.java:29)
> The problem can be reproduced using the attached java program and the following database
> http://ftp2.bigcat.unimaas.nl/~thomas.kelder/derbytest/testdb.zip.
> Both the 'derby.storage.tempDirectory' and 'derby.stream.error.file' properties are set
to writable locations, as advised in the help file.
> Also see derby-user mailing list thread: http://article.gmane.org/gmane.comp.apache.db.derby.user/6123
> "This appears to be a bug, possibly a regression.  When I converted your
> DB to10.0 everything worked fine even when I did NOT set the properties
> for tempDirectory and error.file (hmmm..).  When I switched to using the
> 10.1  or 10.2 jars and accessed the very same database the 40XD1 ERROR
> happened." (Stanley Bradbury)

This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message