Kylin Soong created TEIID-5070:
----------------------------------
Summary: SYSADMIN.loadMatView have risk in xa datasource
Key: TEIID-5070
URL:
https://issues.jboss.org/browse/TEIID-5070
Project: Teiid
Issue Type: Quality Risk
Components: Query Engine
Affects Versions: 8.12.10.6_3
Environment: * JDV 6.3 - teiid-engine-8.12.5.redhat-8.jar
Reporter: Kylin Soong
Assignee: Steven Hawkins
The main logic of *SYSADMIN.loadMatView* is insert data to stage table, then rename the
stage table to mat table. However, this logic has risk in XA Transaction, If an XA
transaction is in the ACTIVE state, you cannot issue any statements that cause an implicit
commit, The RENAME TABLE statement will cause an implicit commit, so if MATVIEW_
AFTER_LOAD_SCRIPT has these kinds of SQL will cause an error.
Below is the error I have hit in a test with Customer's Data, the Mat View come from 7
Oracle databases, the mat table use mysql, the error looks
{code}
TEIID11008:TEIID11004 Error executing statement(s): RENAME TABLE CD_WELL TO CD_WELL_TEMP
at
org.teiid.translator.jdbc.JDBCDirectQueryExecution.execute(JDBCDirectQueryExecution.java:95)
[translator-jdbc-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWorkItem.java:364)
at sun.reflect.GeneratedMethodAccessor162.invoke(Unknown Source) [:1.8.0_102]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[rt.jar:1.8.0_102]
at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_102]
at org.teiid.dqp.internal.datamgr.ConnectorManager$1.invoke(ConnectorManager.java:211)
at com.sun.proxy.$Proxy81.execute(Unknown Source)
at
org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTierTupleSource.java:306)
at
org.teiid.dqp.internal.process.DataTierTupleSource.nextTuple(DataTierTupleSource.java:142)
at org.teiid.query.processor.relational.AccessNode.nextBatchDirect(AccessNode.java:391)
at
org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:282)
at
org.teiid.query.processor.relational.ProjectNode.nextBatchDirect(ProjectNode.java:150)
at
org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:282)
at
org.teiid.query.processor.relational.RelationalPlan.nextBatch(RelationalPlan.java:145)
at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:151)
at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:114)
at org.teiid.query.processor.BatchIterator.finalRow(BatchIterator.java:69)
at
org.teiid.common.buffer.AbstractTupleSource.getCurrentTuple(AbstractTupleSource.java:70)
at org.teiid.query.processor.BatchIterator.getCurrentTuple(BatchIterator.java:84)
at org.teiid.common.buffer.AbstractTupleSource.hasNext(AbstractTupleSource.java:92)
at org.teiid.query.processor.proc.ProcedurePlan.executePlan(ProcedurePlan.java:608)
at
org.teiid.query.processor.proc.CreateCursorResultSetInstruction.process(CreateCursorResultSetInstruction.java:69)
at
org.teiid.query.processor.proc.ExecDynamicSqlInstruction$1.process(ExecDynamicSqlInstruction.java:218)
at org.teiid.query.processor.proc.ProcedurePlan.processProcedure(ProcedurePlan.java:389)
at org.teiid.query.processor.proc.ProcedurePlan.nextBatchDirect(ProcedurePlan.java:298)
at org.teiid.query.processor.proc.ProcedurePlan.nextBatch(ProcedurePlan.java:270)
at
org.teiid.query.processor.relational.PlanExecutionNode.nextBatchDirect(PlanExecutionNode.java:118)
at
org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:282)
at
org.teiid.query.processor.relational.ProjectNode.nextBatchDirect(ProjectNode.java:150)
at
org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:282)
at
org.teiid.query.processor.relational.RelationalPlan.nextBatch(RelationalPlan.java:145)
at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:151)
at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:114)
at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:164)
at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:146)
at org.teiid.dqp.internal.process.RequestWorkItem.processMore(RequestWorkItem.java:472)
at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:348)
at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:51)
at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:274)
at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:276)
at
org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119)
at
org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:210)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[rt.jar:1.8.0_102]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[rt.jar:1.8.0_102]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_102]
Caused by: java.sql.SQLException: XAER_RMFAIL: The command cannot be executed when global
transaction is in the ACTIVE state
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:998)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3835)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3771)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2531)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2489)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:848)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:742)
at com.mysql.jdbc.jdbc2.optional.StatementWrapper.execute(StatementWrapper.java:629)
at org.jboss.jca.adapters.jdbc.WrappedStatement.execute(WrappedStatement.java:157)
at
org.teiid.translator.jdbc.JDBCDirectQueryExecution.execute(JDBCDirectQueryExecution.java:83)
[translator-jdbc-8.12.5.redhat-8.jar:8.12.5.redhat-8]
... 44 more
{code}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)