[teiid-issues] [JBoss JIRA] (TEIID-5060) Infinispan Hotrod Translator UPDATE on primary key column
Jan Stastny (JIRA)
issues at jboss.org
Wed Sep 13 03:23:00 EDT 2017
[ https://issues.jboss.org/browse/TEIID-5060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13463189#comment-13463189 ]
Jan Stastny commented on TEIID-5060:
------------------------------------
I created sample VDB which reproduces the issue:
{code:xml|title=teiid5060-vdb.xml}
<vdb name="teiid5060" version="1">
<model name="Source" type="PHYSICAL" visible="false">
<source name="jdg7-source" translator-name="infinispan-hotrod" connection-jndi-name="java:/jdg71HotrodDS" />
<metadata type="DDL"><![CDATA[
CREATE FOREIGN TABLE SmallA (
StringNum string,
StringKey string PRIMARY KEY
) OPTIONS(UPDATABLE true, "teiid_ispn:cache" 'jdg71_crud_null');
]]>
</metadata>
<metadata type = "NATIVE"/>
</model>
<model name="CRUD" type="VIRTUAL">
<metadata type="DDL"><![CDATA[
CREATE VIEW SmallA(
StringNum string,
StringKey string PRIMARY KEY
) OPTIONS (UPDATABLE true) AS
SELECT
source.StringNum, source.StringKey FROM Source.SmallA as source;
]]>
</metadata>
</model>
</vdb>
{code}
Then steps to reproduce:
# {code:sql|title=SELECT query}SELECT * FROM SMallA{code} returns
|| StringNum || StringKey ||
(empty resultset)
# {code:sql|title=INSERT query}INSERT INTO SmallA(StringKey, StringNum) VALUES ('1','23'),('2','34');{code}
# {code:sql|title=SELECT query 2}SELECT * FROM SMallA{code} returns
|| StringNum || StringKey ||
| 34 | 2 |
| 23 | 1 |
# {code:sql|title=UPDATE query}UPDATE SmallA SET StringKey=5 WHERE StringNum>30{code}
# {code:sql|title=SELECT query 3}SELECT * FROM SMallA{code} returns
|| StringNum || StringKey ||
| 34 | 2 |
| 23 | 1 |
Note that 'SELECT query 2' and 'SELECT query 3' returns identical results.
> Infinispan Hotrod Translator UPDATE on primary key column
> ---------------------------------------------------------
>
> Key: TEIID-5060
> URL: https://issues.jboss.org/browse/TEIID-5060
> Project: Teiid
> Issue Type: Bug
> Components: JDG Connector, Misc. Connectors
> Reporter: Jan Stastny
> Assignee: Ramesh Reddy
> Priority: Blocker
> Fix For: 10.0
>
>
> UPDATE query where the PRIMARY KEY of the table is being changed succeeds, returns update count of corresponding rows, but the changes don't get promoted to actual cache.
> Consider
> {code:sql|title=UPDATE query}
> UPDATE SmallA SET StringKey = 100 WHERE IntKey > 25
> {code}
> where StringKey is set as PRIMARY KEY and 6 rows fulfill the filter on IntKey>25.
> When this UPDATE is performed, returned number of rows update is 6, but the contents of the cache don't change.
> There are several applicable resolutions:
> # There should be error thrown by Teiid, that this is not allowed operation
> # There should be update count 0 returned
> # There should be change in JDG cache, effectively squashing the 6 rows into single one
> # There should be error thrown by Teiid, that there is duplicate PK value (this is not something Teiid usually enforces)
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
More information about the teiid-issues
mailing list