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

Kristian Waagan commented on DERBY-4849:
----------------------------------------

I'm investigating this issue, and found that it is the insert of a new entry 
that conflicts with the lookup of statistics.

Changing to read uncommitted is an option, but it looks like the code in the 
relevant code path (TableDescriptor and DataDictionaryImpl) isn't set up to 
return multiple rows when using read uncommitted. I have talked to Dag about 
this, which made some changes in that area of the code some years ago, and he 
believes the restriction was put there to be defensive (I think up until then 
all access was done using repeatable read).

A potentially simpler fix could be to access the statistics system table with 
the NO_WAIT flag and retry if the lock cannot be obtained immediately. Does 
anyone see any notable drawbacks with this approach?
I'll disable the test if it is clear that my efforts today won't be sufficient 
to fix it.

> Re-compilation may cause duplicate entries in the XPLAIN table
> --------------------------------------------------------------
>
>                 Key: DERBY-4849
>                 URL: https://issues.apache.org/jira/browse/DERBY-4849
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.6.2.1, 10.7.1.0
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>            Priority: Minor
>         Attachments: derby-4849-1a-narrow_fix.diff, 
> derby-4849-2a-broad_fix.diff, derby-4849-2b-broad_fix_with_test.diff, 
> derby-4849-2b-broad_fix_with_test.stat, 
> derby-4849-2c-broad_fix_with_test.diff, 
> derby-4849-xplain_duplicate_stacktrace.txt
>
>
> If happening at the right moment, a re-compilation request may cause 
> duplicate entries in the XPLAIN statement tables.
> I have only confirmed this for the SYSXPLAIN_STATEMENTS table, and I do not 
> know if the other XPLAIN tables are affected.
> The error is highly intermittent, and so far I have only been able to trigger 
> it when testing the automatic index statistics update prototype.
> See the attached stack-trace for some more details.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to