[ https://issues.apache.org/jira/browse/IGNITE-12911?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17369470#comment-17369470 ]
Ilya Kasnacheev commented on IGNITE-12911: ------------------------------------------ LGTM now, please merge [~sergeychugunov] > B+Tree Corrupted exception when using a key extracted from a BinaryObject > value object --- and SQL enabled. > ----------------------------------------------------------------------------------------------------------- > > Key: IGNITE-12911 > URL: https://issues.apache.org/jira/browse/IGNITE-12911 > Project: Ignite > Issue Type: Bug > Components: cache, sql > Reporter: Alexander Korenshteyn > Assignee: Sergey Chugunov > Priority: Blocker > Attachments: Employee.java, EmployeeId.java, ServerNode.java, > image-2020-04-21-17-10-55-797.png, image-2020-04-21-17-11-31-242.png, > image-2020-04-21-17-16-10-703.png, image-2020-04-21-17-16-29-107.png, > image-2020-04-21-17-16-46-381.png > > Time Spent: 10m > Remaining Estimate: 0h > > If a key is part of the value like so: > class key \{ ... } > class value > { private Key key getKey() } > cache = ignite.cache()*.withKeepBinary()* > the following scenario yields a B+ Tree exception: > 1. *Enable SQL via annotations or QueryEntities.* > key1= new Key() > value1 = new Value(key1) > cache.put(key1, value1) > BinaryObject val2 = cache.get(key1) > BinaryObject key2 = val2.field("key") > > *cache2.put(key2.toBuilder().build(), emp1); // OK!* > > *cache.put(key2, emp1); // CRASH!!! CorruptedTreeException: B+Tree > iscorrupted ...* > user list: > > [http://apache-ignite-users.70518.x6.nabble.com/Ignite-crashes-with-CorruptedTreeException-quot-B-Tree-is-corrupted-quot-on-a-composite-BinaryObjecto-tc32032.html] > *Reproducer – attached* > > his happens because: > CacheRowAdapter.readFullRow() reads the length > *int len = PageUtils.getInt(addr,off)* > *it returns 0 when val2.field("key") is used* > > *the data is written correctly in DataPageIO.writeDataPageIO():* > !image-2020-04-21-17-16-46-381.png! > > *but read incorrectly in CacheRowAdapter.readFullRow()* > !image-2020-04-21-17-16-29-107.png! > > > Exception: > [2020-04-17 11:24:33,475][ERROR][main][root] Critical system error detected. > Will be handled accordingly to configured handler > [hnd=StopNodeOrHaltFailureHandler [tryStop=false, timeout=0, > super=AbstractFailureHandler [ignoredFailureTypes=UnmodifiableSet > [SYSTEM_WORKER_BLOCKED, SYSTEM_CRITICAL_OPERATION_TIMEOUT]]], > failureCtx=FailureContext [type=CRITICAL_ERROR, err=class > o.a.i.i.processors.cache.persistence.tree.CorruptedTreeException: B+Tree is > corrupted [pages(groupId, pageId)=[IgniteBiTuple [val1=1258113742, > val2=844420635164673]], cacheId=1976096430, cacheName=EMPLOYEE, > indexName=_key_PK, msg=Runtime failure on row: Row@2233cac0[ key: > model.EmployeeId [idHash=1744523301, hash=674030145, employeeNumber=65348765, > departmentNumber=123], val: model.Employee [idHash=382762227, > hash=1627745429, firstName=John, lastName=Smith, id=model.EmployeeId > [idHash=2021540695, hash=674030145, employeeNumber=65348765, > departmentNumber=123]] ][ John, Smith ]]]] > class > org.apache.ignite.internal.processors.cache.persistence.tree.CorruptedTreeException: > B+Tree is corrupted [pages(groupId, pageId)=[IgniteBiTuple [val1=1258113742, > val2=844420635164673]], cacheId=1976096430, cacheName=EMPLOYEE, > indexName=_key_PK, msg=Runtime failure on row: Row@2233cac0[ key: > model.EmployeeId [idHash=1744523301, hash=674030145, employeeNumber=65348765, > departmentNumber=123], val: model.Employee [idHash=382762227, > hash=1627745429, firstName=John, lastName=Smith, id=model.EmployeeId > [idHash=2021540695, hash=674030145, employeeNumber=65348765, > departmentNumber=123]] ][ John, Smith ]] > at > org.apache.ignite.internal.processors.query.h2.database.H2Tree.corruptedTreeException(H2Tree.java:836) > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree.doPut(BPlusTree.java:2447) > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree.putx(BPlusTree.java:2394) > at > org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex.putx(H2TreeIndex.java:437) > at > org.apache.ignite.internal.processors.query.h2.opt.GridH2Table.update(GridH2Table.java:756) > at > org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.store(IgniteH2Indexing.java:363) > at > org.apache.ignite.internal.processors.query.GridQueryProcessor.store(GridQueryProcessor.java:2016) > at > org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager.store(GridCacheQueryManager.java:401) > at > org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManagerImpl$CacheDataStoreImpl.finishUpdate(IgniteCacheOffheapManagerImpl.java:2555) > at > org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManagerImpl$CacheDataStoreImpl.invoke0(IgniteCacheOffheapManagerImpl.java:1664) > at > org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManagerImpl$CacheDataStoreImpl.invoke(IgniteCacheOffheapManagerImpl.java:1639) > at > org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManagerImpl.invoke(IgniteCacheOffheapManagerImpl.java:436) > at > org.apache.ignite.internal.processors.cache.GridCacheMapEntry.innerUpdate(GridCacheMapEntry.java:2311) > at > org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.updateSingle(GridDhtAtomicCache.java:2593) > at > org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.update(GridDhtAtomicCache.java:2053) > at > org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.updateAllAsyncInternal0(GridDhtAtomicCache.java:1871) > at > org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.updateAllAsyncInternal(GridDhtAtomicCache.java:1685) > at > org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicAbstractUpdateFuture.sendSingleRequest(GridNearAtomicAbstractUpdateFuture.java:299) > at > org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFuture.map(GridNearAtomicSingleUpdateFuture.java:486) > at > org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFuture.mapOnTopology(GridNearAtomicSingleUpdateFuture.java:446) > at > org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicAbstractUpdateFuture.map(GridNearAtomicAbstractUpdateFuture.java:248) > at > org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.update0(GridDhtAtomicCache.java:1172) > at > org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.put0(GridDhtAtomicCache.java:614) > at > org.apache.ignite.internal.processors.cache.GridCacheAdapter.put(GridCacheAdapter.java:2035) > at > org.apache.ignite.internal.processors.cache.GridCacheAdapter.put(GridCacheAdapter.java:2012) > at > org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.put(IgniteCacheProxyImpl.java:1296) > at > org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.put(GatewayProtectedCacheProxy.java:817) > at ServerNode.test1(ServerNode.java:90) > at ServerNode.main(ServerNode.java:51) > Caused by: > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTreeRuntimeException: > java.lang.IllegalArgumentException: Invalid object type: 46 > at > org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter.doInitFromLink(CacheDataRowAdapter.java:290) > at > org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter.initFromLink(CacheDataRowAdapter.java:160) > at > org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter.initFromLink(CacheDataRowAdapter.java:131) > at > org.apache.ignite.internal.processors.query.h2.database.H2Tree.createRow0(H2Tree.java:345) > at > org.apache.ignite.internal.processors.query.h2.database.H2Tree.createRow(H2Tree.java:330) > at > org.apache.ignite.internal.processors.query.h2.database.io.AbstractH2ExtrasLeafIO.getLookupRow(AbstractH2ExtrasLeafIO.java:154) > at > org.apache.ignite.internal.processors.query.h2.database.io.AbstractH2ExtrasLeafIO.getLookupRow(AbstractH2ExtrasLeafIO.java:36) > at > org.apache.ignite.internal.processors.query.h2.database.H2Tree.getRow(H2Tree.java:407) > at > org.apache.ignite.internal.processors.query.h2.database.H2Tree.getRow(H2Tree.java:71) > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree.getRow(BPlusTree.java:5391) > at > org.apache.ignite.internal.processors.query.h2.database.H2Tree.compare(H2Tree.java:520) > at > org.apache.ignite.internal.processors.query.h2.database.H2Tree.compare(H2Tree.java:71) > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree.compare(BPlusTree.java:5378) > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree.findInsertionPoint(BPlusTree.java:5298) > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree.access$1100(BPlusTree.java:98) > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$Search.run0(BPlusTree.java:305) > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$GetPageHandler.run(BPlusTree.java:5892) > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$Search.run(BPlusTree.java:285) > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$GetPageHandler.run(BPlusTree.java:5878) > at > org.apache.ignite.internal.processors.cache.persistence.tree.util.PageHandler.readPage(PageHandler.java:168) > at > org.apache.ignite.internal.processors.cache.persistence.DataStructure.read(DataStructure.java:363) > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree.read(BPlusTree.java:6079) > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree.putDown(BPlusTree.java:2778) > at > org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree.doPut(BPlusTree.java:2414) > ... 27 more > Caused by: java.lang.IllegalArgumentException: Invalid object type: 46 > at > org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl.toCacheObject(CacheObjectBinaryProcessorImpl.java:1195) > at > org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter.readFullRow(CacheDataRowAdapter.java:525) > at > org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter.readIncomplete(CacheDataRowAdapter.java:334) > at > org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter.doInitFromLink(CacheDataRowAdapter.java:261) > ... 50 more > [2020-04-17 11:24:33,490][ERROR][main][FailureProcessor] A critical problem > with persistence data structures was detected. Please make backup of > persistence storage and WAL files for further analysis. Persistence storage > path: null WAL path: db/wal WAL archive path: db/wal/archive > [2020-04-17 11:24:33,519][WARN ][main][CacheDiagnosticManager] Page locks > dump: -- This message was sent by Atlassian Jira (v8.3.4#803005)