Issue Details (XML | Word | Printable)

Key: DERBY-3302
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Mamta A. Satoor
Reporter: Knut Anders Hatlen
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Derby

NullPointerException during recovery of database with territory-based collation

Created: 07/Jan/08 02:03 PM   Updated: 24/Jan/08 02:56 PM
Return to search
Component/s: Store
Affects Version/s: 10.3.1.4, 10.3.2.1, 10.4.1.3
Fix Version/s: 10.3.3.0, 10.4.1.3

Time Tracking:
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works npe.sql 2008-01-07 02:17 PM Knut Anders Hatlen 0.2 kB

Resolution Date: 11/Jan/08 08:57 PM


 Description  « Hide
When logical undo is performed on a database with territory-based collation, you may get a NullPointerException in SQLChar.getCollationKey() because SQLChar.getLocaleFinder() returns null.

This bug was reported on derby-user: http://thread.gmane.org/gmane.comp.apache.db.derby.user/8253

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #610846 Thu Jan 10 17:22:57 UTC 2008 mamta DERBY-3302 The user was running into null pointer exception at the time of database recovery
because Derby was trying to get the Collator object through database context. But the
Collator object is already available in the territory sensitive character classes and we
do not have to go to database context to get it. I changed the code to use that collator
object rather than look into database context. The reason for null pointer exception was
that database context was not loaded yet during database recovery.
Files Changed
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLLongvarchar.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLClob.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLVarchar.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLChar.java

Repository Revision Date User Message
ASF #611295 Fri Jan 11 20:42:38 UTC 2008 mamta Adding a test case for DERBY-3302. There are two sub-test case classes involved here,
col_rec1.java and col_rec2.java

The purpose of col_rec1 test and col_rec2 test is to create a territory based database and
create some objects with collation sensitive character types. Then, make the database crash
so that during the recovery, store engine has to do collation related operations. Those
collation related operations are going to require that we use correct Collator object.
DERBY-3302 demonstrated a npe during this operation because Derby was relying on database
context to get the correct Collator object. But database context is not available at this
point in the recovery. With the fix for DERBY-3302, the Collator object will now be
obtained from collation sensitive datatypes itself rather than looking at database context
which is not available at this point in recovery.

col_rec1 class will do the steps of create a territory based database and create some
objects with collation sensitive character types. Then, make the database crash.
col_rec2 class will do the part of rebooting the crashed db which will require store to go
through recovery.
Files Changed
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/storeCollationDBrecovery.properties
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/col_rec2_app.properties
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/storeCollationDBrecovery.runall
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/col_rec1_app.properties
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/col_rec2.java
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/col_rec1.java
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/col_rec1.out
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/col_rec2.out

Repository Revision Date User Message
ASF #611297 Fri Jan 11 20:48:34 UTC 2008 mamta Merging changes 610846 from trunk into 10.3 codeline. This is for DERBY-3302. Commit comments
for trunk 610846 were as follows

DERBY-3302 The user was running into null pointer exception at the time of database recovery
because Derby was trying to get the Collator object through database context. But the
Collator object is already available in the territory sensitive character classes and we
do not have to go to database context to get it. I changed the code to use that collator
object rather than look into database context. The reason for null pointer exception was
that database context was not loaded yet during database recovery.
Files Changed
MODIFY /db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/types/CollatorSQLVarchar.java
MODIFY /db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/types/CollatorSQLClob.java
MODIFY /db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/types/SQLChar.java
MODIFY /db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/types/CollatorSQLChar.java
MODIFY /db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/types/CollatorSQLLongvarchar.java

Repository Revision Date User Message
ASF #611298 Fri Jan 11 20:55:08 UTC 2008 mamta Mergeing test changes from trunk revision(611295) into 10.3 codeline. The commit coments
in trunk were as follows

Adding a test case for DERBY-3302. There are two sub-test case classes involved here, col_rec1.java and col_rec2.java

The purpose of col_rec1 test and col_rec2 test is to create a territory based database and create some objects with collation sensitive character types. Then, make the database crash so that during the recovery, store engine has to do collation related operations. Those collation related operations are going to require that we use correct Collator object. DERBY-3302 demonstrated a npe during this operation because Derby was relying on database context to get the correct Collator object. But database context is not available at this point in the recovery. With the fix for DERBY-3302, the Collator object will now be obtained from collation sensitive datatypes itself rather than looking at database context which is not available at this point in recovery.

col_rec1 class will do the steps of create a territory based database and create some objects with collation sensitive character types. Then, make the database crash. col_rec2 class will do the part of rebooting the crashed db which will require store to go through recovery.
Files Changed
ADD /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/col_rec2.out (from /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/col_rec2.out)
ADD /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/storeCollationDBrecovery.properties (from /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/storeCollationDBrecovery.properties)
ADD /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/storeCollationDBrecovery.runall (from /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/storeCollationDBrecovery.runall)
ADD /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/store/col_rec2_app.properties (from /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/col_rec2_app.properties)
ADD /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/store/col_rec2.java (from /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/col_rec2.java)
ADD /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/store/col_rec1_app.properties (from /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/col_rec1_app.properties)
ADD /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/store/col_rec1.java (from /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/col_rec1.java)
ADD /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/col_rec1.out (from /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/col_rec1.out)