[ 
https://issues.apache.org/jira/browse/IGNITE-13192?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Surkov Aleksandr updated IGNITE-13192:
--------------------------------------
    Description: 
Reproducer:
{code:java}
@Test
public void testSql() throws Exception {
    try (Ignite ignored = Ignition.start(Config.getServerConfiguration()); 
Ignite ignored2 = Ignition.start(Config.getServerConfiguration());
         IgniteClient client = Ignition.startClient(new 
ClientConfiguration().setBinaryConfiguration(new 
BinaryConfiguration().setCompactFooter(true)).setAddresses(Config.SERVER))
    ) {
        // 1. Create table
        client.query(
            new SqlFieldsQuery(String.format(
                "CREATE TABLE IF NOT EXISTS Person (id INT PRIMARY KEY, name 
VARCHAR) WITH \"VALUE_TYPE=%s,CACHE_NAME=%s\"",
                Person.class.getName(), "PersonCache"
            )).setSchema("PUBLIC")
        ).getAll();


        int key = 1;
        Person val = new Person(key, "Person " + key);
        
        // 2. INSERT value to cache
        client.query(new SqlFieldsQuery("INSERT INTO Person(id, name) VALUES(?, 
?)")
            .setArgs(val.getId(), val.getName())
            .setSchema("PUBLIC")
        )
        .getAll();
        
        // 4. Execute put(). The key must be different from what was in INSERT
        // Without this line, there will be no exception
        client.getOrCreateCache("PersonCache").put(2, val);

        // 5. Execute get(). There will be an exception: 
org.apache.ignite.binary.BinaryObjectException: Cannot find metadata for object 
with compact footer
        assertNotNull(client.getOrCreateCache("PersonCache").get(1));
    }
}{code}

  was:
Reproducer:
{code:java}
@Test
public void testSql() throws Exception {
    try (Ignite ignored = Ignition.start(Config.getServerConfiguration()); 
Ignite ignored2 = Ignition.start(Config.getServerConfiguration());
         IgniteClient client = Ignition.startClient(new 
ClientConfiguration().setBinaryConfiguration(new 
BinaryConfiguration().setCompactFooter(true)).setAddresses(Config.SERVER))
    ) {
        // 1. Create table
        client.query(
            new SqlFieldsQuery(String.format(
                "CREATE TABLE IF NOT EXISTS Person (id INT PRIMARY KEY, name 
VARCHAR) WITH \"VALUE_TYPE=%s,CACHE_NAME=%s\"",
                Person.class.getName(), "PersonCache"
            )).setSchema("PUBLIC")
        ).getAll();


        int key = 1;
        Person val = new Person(key, "Person " + key);
        
        // 2. INSERT value to cache
        client.query(new SqlFieldsQuery("INSERT INTO Person(id, name) VALUES(?, 
?)")
            .setArgs(val.getId(), val.getName())
            .setSchema("PUBLIC")
        )
        .getAll();
        
        // 4. Execute put()
        // Without this line, there will be no exception
        client.getOrCreateCache("PersonCache").put(2, val);

        // 5. Execute get(). There will be an exception: 
org.apache.ignite.binary.BinaryObjectException: Cannot find metadata for object 
with compact footer
        assertNotNull(client.getOrCreateCache("PersonCache").get(1));
    }
}{code}


> Get value after INSERT and put
> ------------------------------
>
>                 Key: IGNITE-13192
>                 URL: https://issues.apache.org/jira/browse/IGNITE-13192
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Surkov Aleksandr
>            Priority: Critical
>
> Reproducer:
> {code:java}
> @Test
> public void testSql() throws Exception {
>     try (Ignite ignored = Ignition.start(Config.getServerConfiguration()); 
> Ignite ignored2 = Ignition.start(Config.getServerConfiguration());
>          IgniteClient client = Ignition.startClient(new 
> ClientConfiguration().setBinaryConfiguration(new 
> BinaryConfiguration().setCompactFooter(true)).setAddresses(Config.SERVER))
>     ) {
>         // 1. Create table
>         client.query(
>             new SqlFieldsQuery(String.format(
>                 "CREATE TABLE IF NOT EXISTS Person (id INT PRIMARY KEY, name 
> VARCHAR) WITH \"VALUE_TYPE=%s,CACHE_NAME=%s\"",
>                 Person.class.getName(), "PersonCache"
>             )).setSchema("PUBLIC")
>         ).getAll();
>         int key = 1;
>         Person val = new Person(key, "Person " + key);
>         
>         // 2. INSERT value to cache
>         client.query(new SqlFieldsQuery("INSERT INTO Person(id, name) 
> VALUES(?, ?)")
>             .setArgs(val.getId(), val.getName())
>             .setSchema("PUBLIC")
>         )
>         .getAll();
>         
>         // 4. Execute put(). The key must be different from what was in INSERT
>         // Without this line, there will be no exception
>         client.getOrCreateCache("PersonCache").put(2, val);
>         // 5. Execute get(). There will be an exception: 
> org.apache.ignite.binary.BinaryObjectException: Cannot find metadata for 
> object with compact footer
>         assertNotNull(client.getOrCreateCache("PersonCache").get(1));
>     }
> }{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to