[
https://issues.apache.org/jira/browse/IGNITE-11219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16762416#comment-16762416
]
Ignite TC Bot commented on IGNITE-11219:
----------------------------------------
{panel:title=--> Run :: All: Possible
Blockers|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1}
{color:#d04437}Cache (Restarts) 1{color} [[tests 0 TIMEOUT , Exit Code
|https://ci.ignite.apache.org/viewLog.html?buildId=3022057]]
*
GridCachePartitionedNearDisabledOptimisticTxNodeRestartTest.testRestartWithTxSixNodesTwoBackups
(last started)
{panel}
[TeamCity *--> Run :: All*
Results|https://ci.ignite.apache.org/viewLog.html?buildId=3018444&buildTypeId=IgniteTests24Java8_RunAll]
> CREATE TABLE with template doesn't work properly with data inserted from KV
> API
> -------------------------------------------------------------------------------
>
> Key: IGNITE-11219
> URL: https://issues.apache.org/jira/browse/IGNITE-11219
> Project: Ignite
> Issue Type: Bug
> Affects Versions: 2.7
> Reporter: Evgenii Zhuravlev
> Assignee: Maxim Pudov
> Priority: Critical
> Time Spent: 10m
> Remaining Estimate: 0h
>
> When you use a template for your table, it takes the affinityMapper field
> from this template, which was set at the moment of creating a context for a
> different type without any keyConfigurations. This leads to the problem with
> accessing data from SQL if it was inserted using Key-value API
> Here is a code to reproduce the issue:
> {code:java}
> Ignition.setClientMode(true);
> Ignite ignite = Ignition.start("examples/config/example-ignite.xml");
> ignite.cluster().active(true);
> IgniteCache cache = ignite.getOrCreateCache("test");
> cache.query(new SqlFieldsQuery("CREATE TABLE IF NOT EXISTS TEST\n" +
> "(\n" +
> " TEST_ID NUMBER(15) NOT NULL,\n" +
> " TEST_FIELD VARCHAR2(100),\n" +
> " PRIMARY KEY (TEST_ID)\n" +
> ") with \"TEMPLATE=TEST_TEMPLATE,KEY_TYPE=TEST_KEY
> ,CACHE_NAME=TEST_CACHE ,
> VALUE_TYPE=TEST_VALUE,ATOMICITY=TRANSACTIONAL\";").setSchema("PUBLIC"));
> for (int i = 0; i < 100; i++) {
> BinaryObjectBuilder keyBuilder =
> ignite.binary().builder("TEST_KEY");
> keyBuilder.setField("TEST_ID", new BigDecimal(111111111111111l +
> i));
> BinaryObjectBuilder valueBuilder =
> ignite.binary().builder("TEST_VALUE");
> valueBuilder.setField("TEST_FIELD", "123123" + i);
>
> ignite.cache("TEST_CACHE").withKeepBinary().put(keyBuilder.build(),
> valueBuilder.build());
> }
> //returns 100 rows as we expect
> System.out.println("FOUND:" + ignite.cache("TEST_CACHE").query(new
> SqlFieldsQuery("Select * from TEST")).getAll().size());
> //returns 0 rows - should return 1
> System.out.println("FOUND:" + ignite.cache("TEST_CACHE").query(new
> SqlFieldsQuery("Select TEST_FIELD from TEST where TEST_ID =
> 111111111111111")).getAll());
> for (int i = 0; i < 100; i++)
> //returns 0 rows - should return 1
> System.out.println("FOUND:" +
> ignite.cache("TEST_CACHE").query(new SqlFieldsQuery("Select TEST_FIELD from
> TEST where TEST_ID = " + (111111111111111l + i))).getAll());
> {code}
> Here is a test template:
> {code:java}
> <bean
> class="org.apache.ignite.configuration.CacheConfiguration">
> <property name="name" value="TEST_TEMPLATE*"/>
> </bean>
> {code}
> Steps to reproduce:
> 1. Start a server node, for example, using ExampleNodeStartup.
> 2. Start a client node using the code provided above with the template in
> configuration.
> It will show that it can't find these rows in the cache.
> Possible quickfix:
> set affinityMapper to cfgTemplate in GridCacheProcessor.getConfigFromTemplate:
> cfgTemplate.setAffinityMapper(null)
> Also, interesting thing - if you replace = with IS, then everything works.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)