Hi Andrey, It looks like you try to run "Select" sql query inside explicit transaction. Please, let us know if it is not true.
This was workable in 2.7 as SQL had no transactional support and query just ignored transactional context (however "Select for Update" wasn't). For now, SQL Select query supports transactions for TRANSACTIONAL_SNAPSHOT cache mode and tries to validate transaction context that causes exception you have faced. So, you have to use TRANSACTIONAL_SNAPSHOT atomicity mode as Ivan suggested or move Select query to outside of transaction. On Tue, Dec 11, 2018 at 5:53 PM Павлухин Иван <[email protected]> wrote: > Hi Andrey, > > It looks like your persisted data was read incorrectly by upgraded > Ignite. It would be great if you provide runnable reproducer. > > Regarding Optimistic Serializable transactions. They are still > supported by caches with TRANSACTIONAL atomicity mode. In your error > it looks like that your caches are treated as TRANSACTIONAL_SNAPSHOT > atomicity mode. You can read about that (experimental) mode in > documentation [1]. Briefly, this mode allows SQL transactions and > supports only PESSIMISTIC REPEATABLE_READ transaction configuration. > > [1] > https://apacheignite-sql.readme.io/v2.7/docs/multiversion-concurrency-control > пн, 10 дек. 2018 г. в 17:13, Андрей Григорьев <[email protected]>: > > > > Hello, when I tried to migrate to new version i had error. Optimistic > Serializable isn't supported? > > > > > > ``` > > Caused by: class > org.apache.ignite.internal.processors.query.IgniteSQLException: Only > pessimistic repeatable read transactions are supported at the moment. > > at > org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.tx(MvccUtils.java:690) > > at > org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.tx(MvccUtils.java:671) > > at > org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.runQueryTwoStep(IgniteH2Indexing.java:1793) > > at > org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.doRunDistributedQuery(IgniteH2Indexing.java:2610) > > at > org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.doRunPrepared(IgniteH2Indexing.java:2315) > > at > org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:2209) > > at > org.apache.ignite.internal.processors.query.GridQueryProcessor$4.applyx(GridQueryProcessor.java:2135) > > at > org.apache.ignite.internal.processors.query.GridQueryProcessor$4.applyx(GridQueryProcessor.java:2130) > > at > org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36) > > at > org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2707) > > at > org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2144) > > at > org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:685) > > ... 10 more > > ``` > > Enviroment: JDK 1.8, Apache Ignite 2.7 (clear install, persistence mode, > 3 nodes). Apache Ignite Client 2.7 from maven: > > > > <ignite.version>2.7.0</ignite.version> > > > > <dependency> > > <groupId>org.apache.ignite</groupId> > > <artifactId>ignite-core</artifactId> > > <version>${ignite.version}</version> > > </dependency> > > <dependency> > > <groupId>org.apache.ignite</groupId> > > <artifactId>ignite-indexing</artifactId> > > <version>${ignite.version}</version> > > </dependency> > > > > Cache configuration: > > > > CacheConfiguration<K, V> cfg = new CacheConfiguration<>(); > > cfg.setBackups(backupsCount); > > cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); > > > > Transaction configuration: > > > > TransactionConfiguration txCfg = new TransactionConfiguration(); > > txCfg.setDefaultTxConcurrency(TransactionConcurrency.OPTIMISTIC); > > txCfg.setDefaultTxIsolation(TransactionIsolation.SERIALIZABLE); > > cfg.setTransactionConfiguration(txCfg); > > > > And second exception from nodes, when i try to read persisted value from > cache (set transaction mode to pessimistic repetable). > > > > ``` > > [15:33:46,990][SEVERE][query-#278][GridMapQueryExecutor] Failed to > execute local query. > > class org.apache.ignite.IgniteCheckedException: Failed to execute SQL > query. Внутренняя ошибка: "class > org.apache.ignite.internal.processors.cache.persistence.tree.CorruptedTreeException: > Runtime failure on bounds: [lower=RowSimple [vals=[null, null, null, null, > null, null, null, 'e3f070fa-7888-4fbb-baac-a02d5338e217', 1]], > upper=RowSimple [vals=[null, null, null, null, null, null, null, > 'e3f070fa-7888-4fbb-baac-a02d5338e217', 1]]]" > > General error: "class > org.apache.ignite.internal.processors.cache.persistence.tree.CorruptedTreeException: > Runtime failure on bounds: [lower=RowSimple [vals=[null, null, null, null, > null, null, null, 'e3f070fa-7888-4fbb-baac-a02d5338e217', 1]], > upper=RowSimple [vals=[null, null, null, null, null, null, null, > 'e3f070fa-7888-4fbb-baac-a02d5338e217', 1]]]"; SQL statement: > > SELECT > > "HumanName".__Z0._KEY __C0_0, > > "HumanName".__Z0._VAL __C0_1 > > FROM "HumanName".HUMANNAMEMODEL __Z0 > > WHERE (__Z0.PARENTID = ?1) AND (__Z0.VERSION = ?2) [50000-197] > > at > org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeSqlQuery(IgniteH2Indexing.java:1428) > > at > org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeSqlQueryWithTimer(IgniteH2Indexing.java:1489) > > at > org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor.onQueryRequest0(GridMapQueryExecutor.java:930) > > at > org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor.onQueryRequest(GridMapQueryExecutor.java:705) > > at > org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor.onMessage(GridMapQueryExecutor.java:240) > > at > org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor$2.onMessage(GridMapQueryExecutor.java:200) > > at > org.apache.ignite.internal.managers.communication.GridIoManager$ArrayListener.onMessage(GridIoManager.java:2349) > > at > org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1569) > > at > org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:1197) > > at > org.apache.ignite.internal.managers.communication.GridIoManager.access$4200(GridIoManager.java:127) > > at > org.apache.ignite.internal.managers.communication.GridIoManager$9.run(GridIoManager.java:1093) > > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) > > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) > > at java.lang.Thread.run(Thread.java:748) > > Caused by: org.h2.jdbc.JdbcSQLException: Внутренняя ошибка: "class > org.apache.ignite.internal.processors.cache.persistence.tree.CorruptedTreeException: > Runtime failure on bounds: [lower=RowSimple [vals=[null, null, null, null, > null, null, null, 'e3f070fa-7888-4fbb-baac-a02d5338e217', 1]], > upper=RowSimple [vals=[null, null, null, null, null, null, null, > 'e3f070fa-7888-4fbb-baac-a02d5338e217', 1]]]" > > General error: "class > org.apache.ignite.internal.processors.cache.persistence.tree.CorruptedTreeException: > Runtime failure on bounds: [lower=RowSimple [vals=[null, null, null, null, > null, null, null, 'e3f070fa-7888-4fbb-baac-a02d5338e217', 1]], > upper=RowSimple [vals=[null, null, null, null, null, null, null, > 'e3f070fa-7888-4fbb-baac-a02d5338e217', 1]]]"; SQL statement: > > SELECT > > "HumanName".__Z0._KEY __C0_0, > > "HumanName".__Z0._VAL __C0_1 > > FROM "HumanName".HUMANNAMEMODEL __Z0 > > WHERE (__Z0.PARENTID = ?1) AND (__Z0.VERSION = ?2) [50000-197] > > at org.h2.message.DbException.getJdbcSQLException(DbException.java:357) > > at org.h2.message.DbException.get(DbException.java:168) > > at org.h2.message.DbException.convert(DbException.java:307) > > at > org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex.find(H2TreeIndex.java:263) > > at org.h2.index.BaseIndex.find(BaseIndex.java:130) > > at org.h2.index.IndexCursor.find(IndexCursor.java:176) > > at org.h2.table.TableFilter.next(TableFilter.java:471) > > at > org.h2.command.dml.Select$LazyResultQueryFlat.fetchNextRow(Select.java:1452) > > at org.h2.result.LazyResult.hasNext(LazyResult.java:79) > > at org.h2.result.LazyResult.next(LazyResult.java:59) > > at org.h2.command.dml.Select.queryFlat(Select.java:527) > > at org.h2.command.dml.Select.queryWithoutCache(Select.java:633) > > at org.h2.command.dml.Query.queryWithoutCacheLazyCheck(Query.java:114) > > at org.h2.command.dml.Query.query(Query.java:352) > > at org.h2.command.dml.Query.query(Query.java:333) > > at org.h2.command.CommandContainer.query(CommandContainer.java:114) > > at org.h2.command.Command.executeQuery(Command.java:202) > > at > org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:114) > > at > org.apache.ignite.internal.processors.query.h2.PreparedStatementExImpl.executeQuery(PreparedStatementExImpl.java:67) > > at > org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeSqlQuery(IgniteH2Indexing.java:1421) > > ... 13 more > > Caused by: class > org.apache.ignite.internal.processors.cache.persistence.tree.CorruptedTreeException: > Runtime failure on bounds: [lower=RowSimple [vals=[null, null, null, null, > null, null, null, 'e3f070fa-7888-4fbb-baac-a02d5338e217', 1]], > upper=RowSimple [vals=[null, null, null, null, null, null, null, > 'e3f070fa-7888-4fbb-baac-a02d5338e217', 1]]] > > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree.find(BPlusTree.java:1013) > > at > org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex.find(H2TreeIndex.java:258) > > ... 29 more > > Caused by: org.h2.message.DbException: Ошибка десериализации, причина: > "class org.apache.ignite.IgniteCheckedException: Not enough data to read > the value [position=1, requiredBytes=8, remainingBytes=6]" > > Deserialization failed, cause: "class > org.apache.ignite.IgniteCheckedException: Not enough data to read the value > [position=1, requiredBytes=8, remainingBytes=6]" [90027-197] > > at org.h2.message.DbException.get(DbException.java:168) > > at org.h2.util.JdbcUtils.deserialize(JdbcUtils.java:423) > > at org.h2.value.Value.convertTo(Value.java:1006) > > at org.h2.value.Value.convertTo(Value.java:617) > > at org.h2.value.Value.convertTo(Value.java:592) > > at org.h2.table.Table.compareTypeSafe(Table.java:1186) > > at > org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex$1.compareValues(H2TreeIndex.java:181) > > at > org.apache.ignite.internal.processors.query.h2.database.H2Tree$1.compare(H2Tree.java:92) > > at > org.apache.ignite.internal.processors.query.h2.database.H2Tree$1.compare(H2Tree.java:90) > > at > org.apache.ignite.internal.processors.query.h2.database.InlineIndexHelper.compare(InlineIndexHelper.java:381) > > at > org.apache.ignite.internal.processors.query.h2.database.H2Tree.compare(H2Tree.java:306) > > at > org.apache.ignite.internal.processors.query.h2.database.H2Tree.compare(H2Tree.java:55) > > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree.compare(BPlusTree.java:5105) > > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree.findInsertionPoint(BPlusTree.java:5025) > > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree.access$1300(BPlusTree.java:90) > > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$Search.run0(BPlusTree.java:291) > > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$GetPageHandler.run(BPlusTree.java:5615) > > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$Search.run(BPlusTree.java:271) > > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$GetPageHandler.run(BPlusTree.java:5600) > > at > org.apache.ignite.internal.processors.cache.persistence.tree.util.PageHandler.readPage(PageHandler.java:159) > > at > org.apache.ignite.internal.processors.cache.persistence.DataStructure.read(DataStructure.java:334) > > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree.findDown(BPlusTree.java:1309) > > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree.doFind(BPlusTree.java:1276) > > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree.access$8700(BPlusTree.java:90) > > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$AbstractForwardCursor.find(BPlusTree.java:5289) > > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree.find(BPlusTree.java:1005) > > ... 30 more > > Caused by: org.h2.jdbc.JdbcSQLException: Ошибка десериализации, причина: > "class org.apache.ignite.IgniteCheckedException: Not enough data to read > the value [position=1, requiredBytes=8, remainingBytes=6]" > > Deserialization failed, cause: "class > org.apache.ignite.IgniteCheckedException: Not enough data to read the value > [position=1, requiredBytes=8, remainingBytes=6]" [90027-197] > > at org.h2.message.DbException.getJdbcSQLException(DbException.java:357) > > ... 56 more > > Caused by: class org.apache.ignite.IgniteCheckedException: Not enough > data to read the value [position=1, requiredBytes=8, remainingBytes=6] > > at > org.apache.ignite.internal.util.IgniteUtils.unmarshal(IgniteUtils.java:10146) > > at > org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing$15.deserialize(IgniteH2Indexing.java:3417) > > at org.h2.util.JdbcUtils.deserialize(JdbcUtils.java:401) > > ... 54 more > > Caused by: class org.apache.ignite.binary.BinaryObjectException: Not > enough data to read the value [position=1, requiredBytes=8, > remainingBytes=6] > > at > org.apache.ignite.internal.binary.streams.BinaryAbstractInputStream.ensureEnoughData(BinaryAbstractInputStream.java:305) > > at > org.apache.ignite.internal.binary.streams.BinaryAbstractInputStream.readLong(BinaryAbstractInputStream.java:214) > > at > org.apache.ignite.internal.binary.BinaryUtils.doReadUuid(BinaryUtils.java:1305) > > at > org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1821) > > at > org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1716) > > at > org.apache.ignite.internal.binary.GridBinaryMarshaller.deserialize(GridBinaryMarshaller.java:313) > > at > org.apache.ignite.internal.binary.BinaryMarshaller.unmarshal0(BinaryMarshaller.java:102) > > at > org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.unmarshal(AbstractNodeNameAwareMarshaller.java:82) > > at > org.apache.ignite.internal.util.IgniteUtils.unmarshal(IgniteUtils.java:10140) > > ... 56 more > > ``` > > > > Entity class: > > > > public abstract class GenericChildModel<T extends Serializable, P > extends Serializable> implements Serializable { > > > > transient protected T id; > > protected transient AffinityKey<T> key; > > > > @QuerySqlField(notNull = true, orderedGroups = > {@QuerySqlField.Group(name = "parent_version_idx", order = 0)}) > > protected P parentId; > > > > @QuerySqlField(notNull = true, orderedGroups = > {@QuerySqlField.Group(name = "parent_version_idx", order = 1, descending = > true)}) > > protected Long version; > > > > transient protected P colocationId; > > > > public AffinityKey<T> key() { > > if (key == null) > > key = new AffinityKey<>(id, colocationId); > > return key; > > } > > > > public class HumanNameModel extends GenericChildModel<UUID, UUID> { > > > > @QuerySqlField > > private Byte use; > > @QuerySqlField(notNull = true, orderedGroups = > {@QuerySqlField.Group(name = "fullname_idx", order = 0)}) > > @NotNull > > @Name > > private String family; > > @QuerySqlField(orderedGroups = {@QuerySqlField.Group(name = > "fullname_idx", order = 1)}) > > @Name > > private String firstName; > > @QuerySqlField(index = true, orderedGroups = > {@QuerySqlField.Group(name = "fullname_idx", order = 2)}) > > @Name > > private String patronymic; > > > > -- > Best regards, > Ivan Pavlukhin > -- Best regards, Andrey V. Mashenkov
