[
https://issues.apache.org/jira/browse/DERBY-5398?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rick Hillegas updated DERBY-5398:
---------------------------------
Attachment: derby-5398-01-aa-dummyTransaction.diff
Thanks for that observation, Knut. It makes some sense that there is no
LanguageConnectionContext during engine shutdown: there is no distinguished
database, so there is no connection, so there is no LCC.
The consequence of this bug is that sequences and identities leak values on
orderly engine shutdown (but not on orderly database shutdown).
The SequenceUpdater needs the LCC only in order to get its hands on a
transaction for flushing the unused values. I am attaching
derby-5398-01-aa-dummyTransaction.diff. This patch causes the SequenceUpdater
to create a transient transaction for its work in the event that an LCC does
not exist. This solution eliminates the NPE and causes the unused sequence
values to be flushed so that the sequence does not leak values after an orderly
engine shutdown.
I have verified that derby-5398.sql passes now and that unused values are not
leaked after the orderly engine shutdown. I have also verified that
SequenceGeneratorTest continues to run cleanly. I will run a full regression
suite now.
On orderly shutdown, the transient transaction does not wait for the locks it
needs in order to update the catalogs. If the transient transaction can't get
those locks, then the sequence/identity will leak unused values. This seems
better than delaying/hanging the engine shutdown. I would like to further
polish this patch by printing a diagnostic to derby.log when the locks can't be
obtained and values leak.
Let me know if this approach sounds reasonable. Thanks.
Touches the following file:
M java/engine/org/apache/derby/impl/sql/catalog/SequenceUpdater.java
> NullPointerException in storemore/bug3498.sql
> ---------------------------------------------
>
> Key: DERBY-5398
> URL: https://issues.apache.org/jira/browse/DERBY-5398
> Project: Derby
> Issue Type: Bug
> Components: Services
> Affects Versions: 10.9.0.0
> Reporter: Knut Anders Hatlen
> Attachments: derby-5398-01-aa-dummyTransaction.diff, derby-5398.sql
>
>
> The tinderbox failed when testing revision 1164361:
> Failure Details:
> ********* Diff file derbyall/storeall/storemore/bug3498.diff
> *** Start: bug3498 jdk1.6.0_24 storeall:storemore 2011-09-02 10:04:59 ***
> 322 del
> < ij>
> 322 add
> > ij> Exception in thread "main" java.lang.NullPointerException
> Test Failed.
> *** End: bug3498 jdk1.6.0_24 storeall:storemore 2011-09-02 10:05:02 ***
> Here's the full stack trace:
> Exception in thread "main" java.lang.NullPointerException
> at
> org.apache.derby.impl.sql.catalog.SequenceUpdater.updateCurrentValueOnDisk(Unknown
> Source)
> at org.apache.derby.impl.sql.catalog.SequenceUpdater.clean(Unknown
> Source)
> at
> org.apache.derby.impl.sql.catalog.SequenceUpdater.clearIdentity(Unknown
> Source)
> at
> org.apache.derby.impl.services.cache.ConcurrentCache.removeEntry(Unknown
> Source)
> at org.apache.derby.impl.services.cache.ConcurrentCache.ageOut(Unknown
> Source)
> at
> org.apache.derby.impl.sql.catalog.DataDictionaryImpl.clearSequenceCaches(Unknown
> Source)
> at org.apache.derby.impl.db.BasicDatabase.stop(Unknown Source)
> at org.apache.derby.impl.services.monitor.TopService.stop(Unknown
> Source)
> at org.apache.derby.impl.services.monitor.TopService.shutdown(Unknown
> Source)
> at org.apache.derby.impl.services.monitor.BaseMonitor.shutdown(Unknown
> Source)
> at org.apache.derby.impl.services.monitor.BaseMonitor.shutdown(Unknown
> Source)
> at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
> at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source)
> at java.sql.DriverManager.getConnection(DriverManager.java:582)
> at java.sql.DriverManager.getConnection(DriverManager.java:207)
> at org.apache.derby.impl.tools.ij.utilMain.cleanupGo(Unknown Source)
> at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
> at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
> at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
> at org.apache.derby.impl.tools.ij.Main.main(Unknown Source)
> at org.apache.derby.tools.ij.main(Unknown Source)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira