[ https://issues.apache.org/jira/browse/IGNITE-13192?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Aleksey Plekhanov updated IGNITE-13192: --------------------------------------- Fix Version/s: 2.9 > Thin client with compactFooter: exception on get value after INSERT and put > --------------------------------------------------------------------------- > > Key: IGNITE-13192 > URL: https://issues.apache.org/jira/browse/IGNITE-13192 > Project: Ignite > Issue Type: Bug > Components: thin client > Reporter: Surkov Aleksandr > Assignee: Aleksey Plekhanov > Priority: Major > Fix For: 2.9 > > Time Spent: 10m > Remaining Estimate: 0h > > Start use thin client with compact footer equals true(setCompactFooter(true) > ). Create table through SQL. Then execut INSERT and put() with different > id/key. And then call method get() with id from INSERT. A > BinaryObjectException will occur. It is expected the value inserted through > INSERT. > 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} > > Decision: > {code:java} > +++ > modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpIgniteClient.java > (date 1593418365270) > @@ -365,6 +365,11 @@ > @Override public BinaryType metadata(int typeId, int schemaId) > throws BinaryObjectException { > BinaryType meta = metadata(typeId); > > + if (meta != null && > !((BinaryTypeImpl)meta).metadata().hasSchema(schemaId)) { > + cache.metadata().removeIf(t -> t.typeId() == typeId); > + meta = metadata(typeId); > + } > + > return meta != null && > ((BinaryTypeImpl)meta).metadata().hasSchema(schemaId) ? meta : null; > }{code} -- This message was sent by Atlassian Jira (v8.3.4#803005)