[
https://issues.apache.org/jira/browse/DERBY-3870?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Knut Anders Hatlen updated DERBY-3870:
--------------------------------------
Attachment: d3870-2a.diff
Attaching a followup patch, d3870-2a.diff, which implements the following
optimization:
Instead of doing lazy initialization of the field that holds the SqlXmlUtil
instance, when the first row is accessed, the field is now initialized in the
activation's constructor. The code generated for the operator can therefore be
simplified, as it doesn't need to check if the field is initialized.
This change also allows us to remove the redundant compilation of the XML query
when the execution plan is created. That redundant compilation was left in the
code only to ensure that syntax errors in the XML query were reported at
compile-time. Since the activation is created when the statement is prepared,
exceptions raised in the activation's constructor will be reported at
compile-time (whereas the previous behaviour with lazy initialization would
have delayed the error until execution-time).
As a consequence, the XML query will now be compiled exactly once per
activation. Before this patch, it would be compiled once when creating the
plan, and then again once for each activation. Probably not much of an
optimization, but it's simpler and feels cleaner that way.
All the XML tests passed with the patch. I'll run the full regression test
suite too, just in case.
> Concurrent Inserts of rows with XML data results in an exception
> ----------------------------------------------------------------
>
> Key: DERBY-3870
> URL: https://issues.apache.org/jira/browse/DERBY-3870
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.4.1.3, 10.4.2.1, 10.5.2.0, 10.6.1.0
> Environment: System: MS windows server 2003 standard edition service
> pack 2. Derby is run as a server on port 1527.
> Reporter: Royi Ronen
> Assignee: Knut Anders Hatlen
> Labels: derby_triage10_5_2
> Fix For: 10.9.0.0
>
> Attachments: Copy of derby.log, DerbyMultiInsertXmlException.zip,
> d3870-1a.diff, d3870-1a.stat, d3870-2a.diff, d3870-junit.diff
>
>
> We insert rows into a table using the following prepared statement (through
> JDBC):
> INSERT INTO USER1.PSTORE values(?,?, XMLPARSE(document CAST (? AS CLOB)
> preserve whitespace))
> where each of the ?'s are replaced with a string.
> One thread runs fine. Two or more result in the following exception:
> org.apache.derby.client.am.SqlException: Java exception: 'FWK005 parse may
> not be called while parsing.: org.xml.sax.SAXException'.
> at org.apache.derby.client.am.SqlException.<init>(Unknown Source)
> at org.apache.derby.client.am.SqlException.<init>(Unknown Source)
> We believe that this comes from the dBuilder.parse(InputSource) method.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira