On 11.12.2011 19:42, Jean-Yves Linet wrote:
I am upgrading Derby to last version and I am stopped by what seams to be a bug.

After activation ot stats trace I get this :

Sun Dec 11 19:33:11 CET 2011 Thread[pool-3-thread-1,5,main] {istat} "PROXIFLEX"."IDAXX_RES": update scheduled, reason=[no stats, row-estimate=375] (queueSize=1)
Sun Dec 11 19:33:11 CET 2011 Thread[index-stat-thread,5,main] {istat,trace@26130360} worker thread started (xid=12049) [q/p/s=1/0/1,err:k/u/c=0/0/0,rej:f/d/o=0/0/0]
Sun Dec 11 19:33:11 CET 2011 Thread[index-stat-thread,5,main] {istat,trace@26130360}     processing "PROXIFLEX"."IDAXX_RES" 
Sun Dec 11 19:33:11 CET 2011 Thread[index-stat-thread,5,main] {istat} runtime exception during normal operation
at org.apache.derby.iapi.types.SQLChar.getCollationKey(Unknown Source)
at org.apache.derby.iapi.types.WorkHorseForCollatorDatatypes.stringCompare(Unknown Source)
at org.apache.derby.iapi.types.CollatorSQLVarchar.stringCompare(Unknown Source)
at org.apache.derby.iapi.types.SQLChar.compare(Unknown Source)
at org.apache.derby.impl.services.daemon.IndexStatisticsDaemonImpl$KeyComparator.compareWithPrevKey(Unknown Source)
at org.apache.derby.impl.services.daemon.IndexStatisticsDaemonImpl.updateIndexStatsMinion(Unknown Source)
at org.apache.derby.impl.services.daemon.IndexStatisticsDaemonImpl.generateStatistics(Unknown Source)
at org.apache.derby.impl.services.daemon.IndexStatisticsDaemonImpl.processingLoop(Unknown Source)
at org.apache.derby.impl.services.daemon.IndexStatisticsDaemonImpl.run(Unknown Source)
at java.lang.Thread.run(Thread.java:662)
Sun Dec 11 19:33:11 CET 2011 Thread[index-stat-thread,5,main] {istat,trace@26130360} worker thread exit [q/p/s=0/0/1,err:k/u/c=0/0/0,rej:f/d/o=0/0/0]

My JDBC connection url is : jdbc:derby:directory:db_name;territory=fr_FR;collation=TERRITORY_BASED:PRIMARY;create=true

If I remove territory and collation parameters I don't have the exception.

I didn't find bug report for this.
Should I make a JIRA entry or does a workaround exists ?

Hi Jean-Yves,

Yes, please create a JIRA issue to track this bug.

I also found undocumented property to disable the automatic statistics (derby.storage.indexStats.auto).
Can I set this property to false until the problem is solved without any side effect ?

Yes, you can disable the automatic statistics. This will basically make Derby 10.8 behave as older versions wrt index cardinality statistics. If you see performance drops on queries which involves tables that grow/shrink a lot, you should consider updating the statistics manually.
I believe work is in progress to document the istat feature properly. We're still looking for feedback from people on whether the feature is working satisfactory or not - in your case it obviously isn't due to what appears to be a bug related to collations.



Jean-Yves LINET