From 2a7a3ec7859b36e4375b705779c67b0b52ca7aae Mon Sep 17 00:00:00 2001 From: Vladimir Steshin Date: Fri, 6 Mar 2026 15:24:08 +0300 Subject: [PATCH 1/5] raw --- ...geEvictionPutLargeObjectsAbstractTest.java | 69 ++++++++++++++++--- 1 file changed, 60 insertions(+), 9 deletions(-) diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionPutLargeObjectsAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionPutLargeObjectsAbstractTest.java index b141fa82bb357..f2dbed0b817df 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionPutLargeObjectsAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionPutLargeObjectsAbstractTest.java @@ -16,6 +16,8 @@ */ package org.apache.ignite.internal.processors.cache.eviction.paged; +import java.util.Random; +import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; import org.apache.ignite.configuration.DataRegionConfiguration; import org.apache.ignite.configuration.DataStorageConfiguration; @@ -30,21 +32,72 @@ /** */ public abstract class PageEvictionPutLargeObjectsAbstractTest extends GridCommonAbstractTest { /** Offheap size for memory policy. */ - private static final int SIZE = 1024 * 1024 * 1024; + private static final int SIZE = 90 * 1024 * 1024; + + /** Offheap size for memory policy. */ + private static final long MAX_SIZE = 10L * 1024 * 1024 * 1024; /** Record size. */ - private static final int RECORD_SIZE = 80 * 1024 * 1024; + private static final int RECORD_SIZE = 24 * 1024 * 1024; /** Number of entries. */ static final int ENTRIES = 50; + /** + -Xms15g + -Xmx15g + -ea + -server + -XX:+ScavengeBeforeFullGC + -XX:+AlwaysPreTouch + -XX:+UnlockDiagnosticVMOptions + -XX:+ExitOnOutOfMemoryError + -XX:+HeapDumpOnOutOfMemoryError + -XX:ErrorFile=/home/fmj/tmp/ignite/logs/crash-dump-%p.err + -XX:HeapDumpPath=/home/fmj/tmp/ignite/logs + -XX:+PerfDisableSharedMem + -XX:+UnlockExperimentalVMOptions + -XX:-OmitStackTraceInFastThrow + -XX:+LogVMOutput + -XX:LogFile=/home/fmj/tmp/ignite/logs/hotspot_pid%p.log + -Dfile.encoding=UTF-8 + -Djava.io.tmpdir=/home/fmj/tmp/ignite/tmp + -Djava.net.preferIPv4Stack=true + -Dnetworkaddress.cache.ttl=-1 + -DIGNITE_CLUSTER_NAME=ignite + -DIGNITE_CLUSTER_TYPE=prom + -DIGNITE_QUIET=false + -DIGNITE.DEPLOYMENT.ADDITIONAL.CHECK=true + -DIGNITE_EXCHANGE_HISTORY_SIZE=100 + -DIGNITE_TO_STRING_INCLUDE_SENSITIVE=true + -DIGNITE_MBEAN_APPEND_CLASS_LOADER_ID=false + -DIGNITE_REUSE_MEMORY_ON_DEACTIVATE=true + -DIGNITE_DISCOVERY_DISABLE_CACHE_METRICS_UPDATE=true + -DIGNITE_USE_ASYNC_FILE_IO_FACTORY=true + -DIGNITE_EXCHANGE_HISTORY_SIZE=100 + -DIGNITE_AFFINITY_HISTORY_SIZE=50 + -DIGNITE_ENABLE_EXTRA_INDEX_REBUILD_LOGGING=true + -DIGNITE_DUMP_THREADS_ON_FAILURE=false + -DIGNITE_ENABLE_FORCIBLE_NODE_KILL=true + -DIGNITE_DIAGNOSTIC_ENABLED=false + -DIGNITE_UPDATE_NOTIFIER=false + --add-opens + jdk.management/com.sun.management.internal=ALL-UNNAMED + -Xlog:gc*=debug,safepoint:file=/home/fmj/tmp/ignite/logs/gc-safepoint.log:time,uptime,tags:filecount=50,filesize=50M + -Dlog4j2.formatMsgNoLookups=true + */ + /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { return super.getConfiguration(gridName) .setDataStorageConfiguration(new DataStorageConfiguration() .setDefaultDataRegionConfiguration(new DataRegionConfiguration() .setInitialSize(SIZE) - .setMaxSize(SIZE) + .setMaxSize(MAX_SIZE) + .setEmptyPagesPoolSize(1000) + .setPersistenceEnabled(false) + .setMetricsEnabled(true) + .setEvictionThreshold(0.8) ) .setPageSize(DFLT_PAGE_SIZE) ); @@ -61,15 +114,13 @@ public abstract class PageEvictionPutLargeObjectsAbstractTest extends GridCommon @Test @WithSystemProperty(key = "IGNITE_DUMP_THREADS_ON_FAILURE", value = "false") public void testPutLargeObjects() throws Exception { - IgniteEx ignite = startGrids(2); + Ignite ignite = startGridsMultiThreaded(2); IgniteCache cache = ignite.createCache(DEFAULT_CACHE_NAME); - Object val = new byte[RECORD_SIZE]; - - for (Integer key : primaryKeys(grid(1).cache(DEFAULT_CACHE_NAME), ENTRIES)) - cache.put(key, val); + Random rnd = new Random(); - assertTrue(cache.size() < ENTRIES); + while(true) + cache.put(rnd.nextInt(), new TestObject(RECORD_SIZE)); } } From 4e38d8800e378051dd1893c221bfb1874e281f8c Mon Sep 17 00:00:00 2001 From: Vladimir Steshin Date: Fri, 6 Mar 2026 16:22:47 +0300 Subject: [PATCH 2/5] raw --- .../evict/RandomLruPageEvictionTracker.java | 2 +- ...geEvictionPutLargeObjectsAbstractTest.java | 46 ++++++++++++++++--- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/RandomLruPageEvictionTracker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/RandomLruPageEvictionTracker.java index cd690e0af7314..fd97ffa554880 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/RandomLruPageEvictionTracker.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/RandomLruPageEvictionTracker.java @@ -190,7 +190,7 @@ public RandomLruPageEvictionTracker( @Override protected int getFragmentLink(int pageTrackingIdx) { int link = GridUnsafe.getIntVolatile(null, trackingArrPtr + pageTrackingIdx * 4L); - assert link <= 0 : "[link=" + link + "]"; + assert link <= 0 : "[link=" + link + ", ptr=" + trackingArrPtr + ", idx=" + pageTrackingIdx + ']'; return -link; } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionPutLargeObjectsAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionPutLargeObjectsAbstractTest.java index f2dbed0b817df..dba48194f2dfc 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionPutLargeObjectsAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionPutLargeObjectsAbstractTest.java @@ -17,28 +17,35 @@ package org.apache.ignite.internal.processors.cache.eviction.paged; import java.util.Random; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicLong; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; import org.apache.ignite.configuration.DataRegionConfiguration; import org.apache.ignite.configuration.DataStorageConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.configuration.WALMode; import org.apache.ignite.internal.IgniteEx; +import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.testframework.junits.WithSystemProperty; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_PAGE_SIZE; +import static org.apache.ignite.testframework.GridTestUtils.runAsync; +import static org.apache.ignite.testframework.GridTestUtils.runMultiThreadedAsync; /** */ public abstract class PageEvictionPutLargeObjectsAbstractTest extends GridCommonAbstractTest { /** Offheap size for memory policy. */ - private static final int SIZE = 90 * 1024 * 1024; + private static final int SIZE = 150 * 1024 * 1024; /** Offheap size for memory policy. */ - private static final long MAX_SIZE = 10L * 1024 * 1024 * 1024; + private static final long MAX_SIZE = 2L * 1024 * 1024 * 1024; /** Record size. */ - private static final int RECORD_SIZE = 24 * 1024 * 1024; + private static final int RECORD_SIZE = 5 * 4096; /** Number of entries. */ static final int ENTRIES = 50; @@ -94,12 +101,17 @@ public abstract class PageEvictionPutLargeObjectsAbstractTest extends GridCommon .setDefaultDataRegionConfiguration(new DataRegionConfiguration() .setInitialSize(SIZE) .setMaxSize(MAX_SIZE) - .setEmptyPagesPoolSize(1000) +// .setEmptyPagesPoolSize(1000) .setPersistenceEnabled(false) .setMetricsEnabled(true) .setEvictionThreshold(0.8) ) .setPageSize(DFLT_PAGE_SIZE) + .setCheckpointFrequency(60000) + .setMaxWalArchiveSize(10737418240L) + .setWalMode(WALMode.LOG_ONLY) + .setWalBufferSize(5242880) + .setWalCompactionEnabled(true) ); } @@ -116,11 +128,31 @@ public abstract class PageEvictionPutLargeObjectsAbstractTest extends GridCommon public void testPutLargeObjects() throws Exception { Ignite ignite = startGridsMultiThreaded(2); - IgniteCache cache = ignite.createCache(DEFAULT_CACHE_NAME); + IgniteCache cache = ignite.createCache(DEFAULT_CACHE_NAME); Random rnd = new Random(); - while(true) - cache.put(rnd.nextInt(), new TestObject(RECORD_SIZE)); + AtomicBoolean run = new AtomicBoolean(true); + AtomicLong idx = new AtomicLong(); + boolean sleep = false; + + IgniteInternalFuture fut = runMultiThreadedAsync(() -> { + try { + while (run.get()) { + if (rnd.nextInt(100) < 50) + cache.put(idx.incrementAndGet(), new TestObject(RECORD_SIZE)); + else if (idx.get() > 0) + cache.get(idx.get()); + + if (sleep) + Thread.sleep(rnd.nextInt(10)); + } + } + catch (InterruptedException ignored) { + // No-op. + } + }, 8, "ldr"); + + fut.get(getTestTimeout(), TimeUnit.MILLISECONDS); } } From 09e76bca5bae193415e6c28cf4e16fa1de12a487 Mon Sep 17 00:00:00 2001 From: Vladimir Steshin Date: Mon, 9 Mar 2026 19:10:17 +0300 Subject: [PATCH 3/5] raw --- .../cache/IgniteCacheOffheapManagerImpl.java | 4 +- ...geEvictionPutLargeObjectsAbstractTest.java | 84 ++++++++++++------- 2 files changed, 56 insertions(+), 32 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java index 47671d01a462c..55c97b0b91d9e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java @@ -61,6 +61,7 @@ import org.apache.ignite.internal.processors.cache.persistence.partstorage.PartitionMetaStorage; import org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree; import org.apache.ignite.internal.processors.cache.persistence.tree.reuse.ReuseList; +import org.apache.ignite.internal.processors.cache.persistence.tree.util.PageHandler; import org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager; import org.apache.ignite.internal.processors.cache.tree.CacheDataRowStore; import org.apache.ignite.internal.processors.cache.tree.CacheDataTree; @@ -1799,7 +1800,8 @@ private void afterRowFound(@Nullable CacheDataRow row, KeyCacheObject key) throw if (row != null) { row.key(key); - grp.dataRegion().evictionTracker().touchPage(row.link()); + for (int i = 0; i < 100000; ++i) + grp.dataRegion().evictionTracker().touchPage(row.link()); } } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionPutLargeObjectsAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionPutLargeObjectsAbstractTest.java index dba48194f2dfc..7a3a1884325d1 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionPutLargeObjectsAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionPutLargeObjectsAbstractTest.java @@ -17,6 +17,8 @@ package org.apache.ignite.internal.processors.cache.eviction.paged; import java.util.Random; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; @@ -28,6 +30,9 @@ import org.apache.ignite.configuration.WALMode; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.IgniteInternalFuture; +import org.apache.ignite.internal.processors.cache.CacheEvictionManager; +import org.apache.ignite.internal.processors.cache.GridCacheEvictionManager; +import org.apache.ignite.internal.processors.cache.GridCacheSharedManager; import org.apache.ignite.testframework.junits.WithSystemProperty; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -39,13 +44,13 @@ /** */ public abstract class PageEvictionPutLargeObjectsAbstractTest extends GridCommonAbstractTest { /** Offheap size for memory policy. */ - private static final int SIZE = 150 * 1024 * 1024; + private static final int SIZE = 128 * 1024 * 1024; /** Offheap size for memory policy. */ - private static final long MAX_SIZE = 2L * 1024 * 1024 * 1024; + private static final long MAX_SIZE = 256 * 1024 * 1024; /** Record size. */ - private static final int RECORD_SIZE = 5 * 4096; + private static final int RECORD_SIZE = 50 * 4096; /** Number of entries. */ static final int ENTRIES = 50; @@ -101,17 +106,17 @@ public abstract class PageEvictionPutLargeObjectsAbstractTest extends GridCommon .setDefaultDataRegionConfiguration(new DataRegionConfiguration() .setInitialSize(SIZE) .setMaxSize(MAX_SIZE) -// .setEmptyPagesPoolSize(1000) + .setEmptyPagesPoolSize(1000) .setPersistenceEnabled(false) .setMetricsEnabled(true) .setEvictionThreshold(0.8) ) - .setPageSize(DFLT_PAGE_SIZE) - .setCheckpointFrequency(60000) - .setMaxWalArchiveSize(10737418240L) - .setWalMode(WALMode.LOG_ONLY) - .setWalBufferSize(5242880) - .setWalCompactionEnabled(true) +// .setPageSize(DFLT_PAGE_SIZE) +// .setCheckpointFrequency(60000) +// .setMaxWalArchiveSize(10737418240L) +// .setWalMode(WALMode.LOG_ONLY) +// .setWalBufferSize(5242880) +// .setWalCompactionEnabled(true) ); } @@ -126,33 +131,50 @@ public abstract class PageEvictionPutLargeObjectsAbstractTest extends GridCommon @Test @WithSystemProperty(key = "IGNITE_DUMP_THREADS_ON_FAILURE", value = "false") public void testPutLargeObjects() throws Exception { - Ignite ignite = startGridsMultiThreaded(2); + IgniteEx ignite = startGrids(1); IgniteCache cache = ignite.createCache(DEFAULT_CACHE_NAME); + AtomicLong idx = new AtomicLong(); + AtomicBoolean run = new AtomicBoolean(true); - Random rnd = new Random(); + IgniteInternalFuture getFut = runMultiThreadedAsync(() -> { + Random rnd = new Random(); - AtomicBoolean run = new AtomicBoolean(true); - AtomicLong idx = new AtomicLong(); - boolean sleep = false; - - IgniteInternalFuture fut = runMultiThreadedAsync(() -> { - try { - while (run.get()) { - if (rnd.nextInt(100) < 50) - cache.put(idx.incrementAndGet(), new TestObject(RECORD_SIZE)); - else if (idx.get() > 0) - cache.get(idx.get()); - - if (sleep) - Thread.sleep(rnd.nextInt(10)); - } + while (run.get()) { + if (idx.get() > 0) + cache.get(rnd.nextLong(idx.get())); + } + }, 4, "get"); + + TestObject loadObj = new TestObject(RECORD_SIZE); + Set loadedKeys = ConcurrentHashMap.newKeySet(); + + IgniteInternalFuture ldrFut = runMultiThreadedAsync(() -> { + while (run.get()) { + Long k = idx.incrementAndGet(); + + cache.put(k, loadObj); + + //loadedKeys.add(k); } - catch (InterruptedException ignored) { - // No-op. + + }, 2, "ldr"); + + IgniteInternalFuture evicFut = runAsync(() -> { + CacheEvictionManager evictMgr = grid(0).cachex(DEFAULT_CACHE_NAME).context().evicts(); + + while (run.get()) { + if (loadedKeys.isEmpty()) + continue; + + evictMgr.batchEvict(loadedKeys, null); + + loadedKeys.clear(); } - }, 8, "ldr"); + }); - fut.get(getTestTimeout(), TimeUnit.MILLISECONDS); + ldrFut.get(getTestTimeout(), TimeUnit.MILLISECONDS); + getFut.get(getTestTimeout(), TimeUnit.MILLISECONDS); + evicFut.get(getTestTimeout(), TimeUnit.MILLISECONDS); } } From 169d548b1c45d1248639309c410fb0d1cb5e8f63 Mon Sep 17 00:00:00 2001 From: Vladimir Steshin Date: Tue, 10 Mar 2026 14:53:51 +0300 Subject: [PATCH 4/5] with fix --- .../index/sorted/inline/InlineIndexImpl.java | 2 +- .../cache/IgniteCacheOffheapManagerImpl.java | 31 ++++++------ .../evict/FairFifoPageEvictionTracker.java | 4 +- .../evict/NoOpPageEvictionTracker.java | 9 ++-- .../evict/PageAbstractEvictionTracker.java | 2 +- .../evict/PageEvictionTracker.java | 9 ++-- .../evict/Random2LruPageEvictionTracker.java | 2 +- .../evict/RandomLruPageEvictionTracker.java | 4 +- .../cache/persistence/tree/BPlusTree.java | 48 ++++++++++-------- ...geEvictionPutLargeObjectsAbstractTest.java | 49 +++++++++---------- ...gniteCacheAbstractFieldsQuerySelfTest.java | 8 +-- 11 files changed, 87 insertions(+), 81 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/sorted/inline/InlineIndexImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/sorted/inline/InlineIndexImpl.java index a31a9cf8b713f..ade4c4d10a74d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/sorted/inline/InlineIndexImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/sorted/inline/InlineIndexImpl.java @@ -109,7 +109,7 @@ public InlineIndexImpl(GridCacheContext cctx, SortedIndexDefinition def, I try { // If it is known that only one row will be returned an optimization is employed if (isSingleRowLookup(lower, upper)) { - IndexRowImpl row = segments[segment].findOne(lower, closure, null); + IndexRowImpl row = segments[segment].findOne(lower, closure, null, null); if (row == null || isExpired(row)) return IndexValueCursor.EMPTY; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java index 55c97b0b91d9e..097de78d6b76c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java @@ -61,7 +61,6 @@ import org.apache.ignite.internal.processors.cache.persistence.partstorage.PartitionMetaStorage; import org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree; import org.apache.ignite.internal.processors.cache.persistence.tree.reuse.ReuseList; -import org.apache.ignite.internal.processors.cache.persistence.tree.util.PageHandler; import org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager; import org.apache.ignite.internal.processors.cache.tree.CacheDataRowStore; import org.apache.ignite.internal.processors.cache.tree.CacheDataTree; @@ -1784,25 +1783,29 @@ private void clearPendingEntries(GridCacheContext cctx, CacheDataRow oldRow) int cacheId = grp.sharedGroup() ? cctx.cacheId() : CU.UNDEFINED_CACHE_ID; - CacheDataRow row = dataTree.findOne(new SearchRow(cacheId, key), CacheDataRowAdapter.RowData.NO_KEY); + CacheDataRow row = dataTree.findOne(new SearchRow(cacheId, key), null, CacheDataRowAdapter.RowData.NO_KEY, null); - afterRowFound(row, key); - - return row; - } - - /** - * @param row Row. - * @param key Key. - * @throws IgniteCheckedException If failed. - */ - private void afterRowFound(@Nullable CacheDataRow row, KeyCacheObject key) throws IgniteCheckedException { if (row != null) { row.key(key); - for (int i = 0; i < 100000; ++i) + for(int i=0; i<1000000; ++i) grp.dataRegion().evictionTracker().touchPage(row.link()); } + + return row; + +// return dataTree.findOne( +// new SearchRow(cacheId, key), +// null, +// CacheDataRowAdapter.RowData.NO_KEY, +// (pageId, row) -> { +// if (row != null) { +// grp.dataRegion().evictionTracker().touchPage(row.link()); +// +// ((CacheDataRow)row).key(key); +// } +// } +// ); } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/FairFifoPageEvictionTracker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/FairFifoPageEvictionTracker.java index 84fd0188de32f..4678df41eedfe 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/FairFifoPageEvictionTracker.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/FairFifoPageEvictionTracker.java @@ -55,7 +55,7 @@ public FairFifoPageEvictionTracker( } /** {@inheritDoc} */ - @Override public synchronized void touchPage(long pageId) throws IgniteCheckedException { + @Override public synchronized void touchPage(long pageId) { pageUsageList.addLast(PageIdUtils.pageIndex(pageId)); } @@ -65,7 +65,7 @@ public FairFifoPageEvictionTracker( } /** {@inheritDoc} */ - @Override public synchronized void forgetPage(long pageId) throws IgniteCheckedException { + @Override public synchronized void forgetPage(long pageId) { // No-op. } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/NoOpPageEvictionTracker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/NoOpPageEvictionTracker.java index d212fcec88b5a..4409e35e7446b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/NoOpPageEvictionTracker.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/NoOpPageEvictionTracker.java @@ -16,7 +16,6 @@ */ package org.apache.ignite.internal.processors.cache.persistence.evict; -import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteException; /** @@ -34,17 +33,17 @@ public class NoOpPageEvictionTracker implements PageEvictionTracker { } /** {@inheritDoc} */ - @Override public void touchPage(long pageId) throws IgniteCheckedException { + @Override public void touchPage(long pageId) { // No-op. } /** {@inheritDoc} */ - @Override public void evictDataPage() throws IgniteCheckedException { + @Override public void evictDataPage() { // No-op. } /** {@inheritDoc} */ - @Override public void forgetPage(long pageId) throws IgniteCheckedException { + @Override public void forgetPage(long pageId) { // No-op. } @@ -54,7 +53,7 @@ public class NoOpPageEvictionTracker implements PageEvictionTracker { } /** {@inheritDoc} */ - @Override public void trackFragmentPage(long pageId, long prevPageId, boolean isHeadPage) throws IgniteCheckedException { + @Override public void trackFragmentPage(long pageId, long prevPageId, boolean isHeadPage) { // No-op. } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/PageAbstractEvictionTracker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/PageAbstractEvictionTracker.java index 07a97e8e4fbbd..e5795a80f1e1c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/PageAbstractEvictionTracker.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/PageAbstractEvictionTracker.java @@ -185,7 +185,7 @@ int pageIdx(int trackingIdx) { } /** {@inheritDoc} */ - @Override public void trackFragmentPage(long pageId, long prevPageId, boolean isHeadPage) throws IgniteCheckedException { + @Override public void trackFragmentPage(long pageId, long prevPageId, boolean isHeadPage) { // Do nothing if called for tail page. if (prevPageId == 0) return; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/PageEvictionTracker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/PageEvictionTracker.java index 5954137fc40a7..82970fb52521c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/PageEvictionTracker.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/PageEvictionTracker.java @@ -28,9 +28,8 @@ public interface PageEvictionTracker extends LifecycleAware { * Call this method when data page is accessed. * * @param pageId Page id. - * @throws IgniteCheckedException In case of page memory error. */ - public void touchPage(long pageId) throws IgniteCheckedException; + public void touchPage(long pageId); /** * Check if page eviction is required according to the configured policy. @@ -53,9 +52,8 @@ public interface PageEvictionTracker extends LifecycleAware { * Call this method when last entry is removed from data page. * * @param pageId Page id. - * @throws IgniteCheckedException In case of page memory error. */ - public void forgetPage(long pageId) throws IgniteCheckedException; + public void forgetPage(long pageId); /** * Call this method when data page containing fragment of row is written. @@ -63,7 +61,6 @@ public interface PageEvictionTracker extends LifecycleAware { * @param pageId Page id. * @param prevPageId Page id of previous fragment. 0 if called for the tail fragment (written first). * @param isHeadPage True if head fragment (written last) of row is written, False otherwise. - * @throws IgniteCheckedException In case of page memory error. */ - public void trackFragmentPage(long pageId, long prevPageId, boolean isHeadPage) throws IgniteCheckedException; + public void trackFragmentPage(long pageId, long prevPageId, boolean isHeadPage); } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/Random2LruPageEvictionTracker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/Random2LruPageEvictionTracker.java index 80634ed878f5a..47cc49702cfac 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/Random2LruPageEvictionTracker.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/Random2LruPageEvictionTracker.java @@ -80,7 +80,7 @@ public Random2LruPageEvictionTracker( } /** {@inheritDoc} */ - @Override public void touchPage(long pageId) throws IgniteCheckedException { + @Override public void touchPage(long pageId) { int pageIdx = PageIdUtils.pageIndex(pageId); long latestTs = compactTimestamp(U.currentTimeMillis()); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/RandomLruPageEvictionTracker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/RandomLruPageEvictionTracker.java index fd97ffa554880..bc4f3de6bc470 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/RandomLruPageEvictionTracker.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/RandomLruPageEvictionTracker.java @@ -82,7 +82,7 @@ public RandomLruPageEvictionTracker( } /** {@inheritDoc} */ - @Override public void touchPage(long pageId) throws IgniteCheckedException { + @Override public void touchPage(long pageId) { int pageIdx = PageIdUtils.pageIndex(pageId); long res = compactTimestamp(U.currentTimeMillis()); @@ -190,7 +190,7 @@ public RandomLruPageEvictionTracker( @Override protected int getFragmentLink(int pageTrackingIdx) { int link = GridUnsafe.getIntVolatile(null, trackingArrPtr + pageTrackingIdx * 4L); - assert link <= 0 : "[link=" + link + ", ptr=" + trackingArrPtr + ", idx=" + pageTrackingIdx + ']'; + assert link <= 0 : "[link=" + link + "]"; return -link; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java index 782724dd5f414..301743337fe97 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java @@ -26,6 +26,7 @@ import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; +import java.util.function.BiConsumer; import java.util.function.Supplier; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteSystemProperties; @@ -1501,7 +1502,7 @@ public T findLast(final TreeRowClosure c) throws IgniteCheckedException { if (c == null) { g = new GetOne(null, null, null, true); - doFind(g); + doFind(g, null); return (T)g.row; } @@ -1533,27 +1534,24 @@ public T findLast(final TreeRowClosure c) throws IgniteCheckedException { /** * @param row Lookup row for exact match. + * @param c Filter closure. * @param x Implementation specific argument, {@code null} always means that we need to return full detached data row. - * @return Found result or {@code null} - * @throws IgniteCheckedException If failed. - */ - public final R findOne(L row, Object x) throws IgniteCheckedException { - return findOne(row, null, x); - } - - /** - * @param row Lookup row for exact match. - * @param x Implementation specific argument, {@code null} always means that we need to return full detached data row. + * @param foundPageLsnr Found data listener. * @return Found result or {@code null}. * @throws IgniteCheckedException If failed. */ - public final R findOne(L row, TreeRowClosure c, Object x) throws IgniteCheckedException { + public final R findOne( + L row, + @Nullable TreeRowClosure c, + Object x, + @Nullable BiConsumer foundPageLsnr + ) throws IgniteCheckedException { checkDestroyed(); GetOne g = new GetOne(row, c, x, false); try { - doFind(g); + doFind(g, foundPageLsnr); return (R)g.row; } @@ -1577,20 +1575,21 @@ public final R findOne(L row, TreeRowClosure c, Object x) throws Ignit * @throws IgniteCheckedException If failed. */ @Override public final T findOne(L row) throws IgniteCheckedException { - return findOne(row, null, null); + return findOne(row, null, null, null); } /** * @param g Get. + * @param foundPageLsnr Found data fistener. * @throws IgniteCheckedException If failed. */ - private void doFind(Get g) throws IgniteCheckedException { + private void doFind(Get g, @Nullable BiConsumer foundPageLsnr) throws IgniteCheckedException { assert !sequentialWriteOptsEnabled; for (;;) { // Go down with retries. g.init(); - switch (findDown(g, g.rootId, 0L, g.rootLvl)) { + switch (findDown(g, g.rootId, 0L, g.rootLvl, foundPageLsnr)) { case RETRY: case RETRY_ROOT: checkDestroyed(); @@ -1609,10 +1608,11 @@ private void doFind(Get g) throws IgniteCheckedException { * @param pageId Page ID. * @param fwdId Expected forward page ID. * @param lvl Level. + * @param foundLsnr Found row listener. * @return Result code. * @throws IgniteCheckedException If failed. */ - private Result findDown(final Get g, final long pageId, final long fwdId, final int lvl) + private Result findDown(Get g, long pageId, long fwdId, int lvl, @Nullable BiConsumer foundLsnr) throws IgniteCheckedException { long page = acquirePage(pageId); @@ -1633,7 +1633,7 @@ private Result findDown(final Get g, final long pageId, final long fwdId, final assert g.fwdId != fwdId || fwdId == 0; // Go down recursively. - res = findDown(g, g.pageId, g.fwdId, lvl - 1); + res = findDown(g, g.pageId, g.fwdId, lvl - 1, foundLsnr); switch (res) { case RETRY: @@ -1652,6 +1652,12 @@ private Result findDown(final Get g, final long pageId, final long fwdId, final return res; + case FOUND: + if (foundLsnr != null) + foundLsnr.accept(pageId, g.row); + + return res; + default: return res; } @@ -3460,7 +3466,7 @@ public T find() throws IgniteCheckedException { while (retry) { row = row0; - doFind(this); + doFind(this, null); } return row0; @@ -3703,7 +3709,7 @@ private L insertWithSplit(long pageId, long page, long pageAddr, BPlusIO io, cnt = io.getCount(pageAddr); // Last item from backward row goes up. - L moveUpRow = io.getLookupRow(BPlusTree.this, pageAddr, cnt - 1); + L moveUpRow = io.getLookupRow(BPlusTree.this, pageAddr, cnt - 1); if (!io.isLeaf()) { // Leaf pages must contain all the links, inner pages remove moveUpLink. io.setCount(pageAddr, cnt - 1); @@ -5558,7 +5564,7 @@ private boolean fillFromBuffer(long pageAddr, BPlusIO io, int startIdx, int c final void find() throws IgniteCheckedException { assert lowerBound != null; - doFind(getCursor = new GetCursor(lowerBound, lowerShift, this)); + doFind(getCursor = new GetCursor(lowerBound, lowerShift, this), null); } /** diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionPutLargeObjectsAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionPutLargeObjectsAbstractTest.java index 08fce6a46c423..d8dc2807c77cb 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionPutLargeObjectsAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionPutLargeObjectsAbstractTest.java @@ -22,22 +22,16 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; -import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; import org.apache.ignite.configuration.DataRegionConfiguration; import org.apache.ignite.configuration.DataStorageConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.configuration.WALMode; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.internal.processors.cache.CacheEvictionManager; -import org.apache.ignite.internal.processors.cache.GridCacheEvictionManager; -import org.apache.ignite.internal.processors.cache.GridCacheSharedManager; import org.apache.ignite.testframework.junits.WithSystemProperty; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; -import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_PAGE_SIZE; import static org.apache.ignite.testframework.GridTestUtils.runAsync; import static org.apache.ignite.testframework.GridTestUtils.runMultiThreadedAsync; @@ -64,12 +58,6 @@ public abstract class PageEvictionPutLargeObjectsAbstractTest extends GridCommon .setMetricsEnabled(true) .setEvictionThreshold(0.8) ) -// .setPageSize(DFLT_PAGE_SIZE) -// .setCheckpointFrequency(60000) -// .setMaxWalArchiveSize(10737418240L) -// .setWalMode(WALMode.LOG_ONLY) -// .setWalBufferSize(5242880) -// .setWalCompactionEnabled(true) ); } @@ -100,7 +88,7 @@ public void testPutLargeObjects() throws Exception { }, 4, "get"); TestObject loadObj = new TestObject(RECORD_SIZE); - Set loadedKeys = ConcurrentHashMap.newKeySet(); +// Set loadedKeys = ConcurrentHashMap.newKeySet(); IgniteInternalFuture ldrFut = runMultiThreadedAsync(() -> { while (run.get()) { @@ -113,21 +101,32 @@ public void testPutLargeObjects() throws Exception { }, 2, "ldr"); - IgniteInternalFuture evicFut = runAsync(() -> { - CacheEvictionManager evictMgr = grid(0).cachex(DEFAULT_CACHE_NAME).context().evicts(); - - while (run.get()) { - if (loadedKeys.isEmpty()) - continue; - - evictMgr.batchEvict(loadedKeys, null); - - loadedKeys.clear(); - } +// IgniteInternalFuture evicFut = runAsync(() -> { +// CacheEvictionManager evictMgr = grid(0).cachex(DEFAULT_CACHE_NAME).context().evicts(); +// +// while (run.get()) { +// if (loadedKeys.isEmpty()) +// continue; +// +// evictMgr.batchEvict(loadedKeys, null); +// +// loadedKeys.clear(); +// } +// }); + + runAsync(() -> { + Thread.sleep(getTestTimeout() / 2); + + run.set(false); }); ldrFut.get(getTestTimeout(), TimeUnit.MILLISECONDS); getFut.get(getTestTimeout(), TimeUnit.MILLISECONDS); - evicFut.get(getTestTimeout(), TimeUnit.MILLISECONDS); +// evicFut.get(getTestTimeout(), TimeUnit.MILLISECONDS); + } + + /** {@inheritDoc} */ + @Override protected long getTestTimeout() { + return 45L * 1000; } } diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java index 400d24d993ca7..cfbb96456e0e9 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java @@ -30,6 +30,7 @@ import java.util.Set; import java.util.UUID; import java.util.concurrent.Callable; +import java.util.function.Consumer; import javax.cache.CacheException; import com.google.common.collect.ImmutableMap; import org.apache.ignite.IgniteCache; @@ -782,7 +783,8 @@ public void testEmptyResult() throws Exception { /** * Verifies that exactly one record is found when we have equality comparison in where clause (which is supposed - * to use {@link BPlusTree#findOne(Object, Object)} instead of {@link BPlusTree#find(Object, Object, Object)}. + * to use {@link BPlusTree#findOne(Object, BPlusTree.TreeRowClosure, Object, Consumer)} instead of + * {@link BPlusTree#find(Object, Object, Object)}. * * @throws Exception If failed. */ @@ -801,8 +803,8 @@ public void testSingleResultUsesFindOne() throws Exception { /** * Verifies that zero records are found when we have equality comparison in where clause (which is supposed - * to use {@link BPlusTree#findOne(Object, Object)} instead of {@link BPlusTree#find(Object, Object, Object)} - * and the key is not in the cache. + * to use {@link BPlusTree#findOne(Object, BPlusTree.TreeRowClosure, Object, Consumer)} instead of + * {@link BPlusTree#find(Object, Object, Object)} and the key is not in the cache. * * @throws Exception If failed. */ From 03e92a9199cca04c532508a60069f8e2db8a6a4c Mon Sep 17 00:00:00 2001 From: Vladimir Steshin Date: Tue, 10 Mar 2026 15:55:17 +0300 Subject: [PATCH 5/5] impl --- .../cache/IgniteCacheOffheapManagerImpl.java | 35 +++----- .../cache/persistence/tree/BPlusTree.java | 30 ++++--- ...geEvictionPutLargeObjectsAbstractTest.java | 85 +++---------------- ...gniteCacheAbstractFieldsQuerySelfTest.java | 6 +- 4 files changed, 48 insertions(+), 108 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java index 097de78d6b76c..52c470d3dfbf0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java @@ -1783,29 +1783,18 @@ private void clearPendingEntries(GridCacheContext cctx, CacheDataRow oldRow) int cacheId = grp.sharedGroup() ? cctx.cacheId() : CU.UNDEFINED_CACHE_ID; - CacheDataRow row = dataTree.findOne(new SearchRow(cacheId, key), null, CacheDataRowAdapter.RowData.NO_KEY, null); - - if (row != null) { - row.key(key); - - for(int i=0; i<1000000; ++i) - grp.dataRegion().evictionTracker().touchPage(row.link()); - } - - return row; - -// return dataTree.findOne( -// new SearchRow(cacheId, key), -// null, -// CacheDataRowAdapter.RowData.NO_KEY, -// (pageId, row) -> { -// if (row != null) { -// grp.dataRegion().evictionTracker().touchPage(row.link()); -// -// ((CacheDataRow)row).key(key); -// } -// } -// ); + return dataTree.findOne( + new SearchRow(cacheId, key), + null, + CacheDataRowAdapter.RowData.NO_KEY, + (pageId, row) -> { + if (row != null) { + grp.dataRegion().evictionTracker().touchPage(row.link()); + + ((CacheDataRow)row).key(key); + } + } + ); } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java index 301743337fe97..1ac799c57d116 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java @@ -1502,7 +1502,7 @@ public T findLast(final TreeRowClosure c) throws IgniteCheckedException { if (c == null) { g = new GetOne(null, null, null, true); - doFind(g, null); + doFind(g); return (T)g.row; } @@ -1536,7 +1536,7 @@ public T findLast(final TreeRowClosure c) throws IgniteCheckedException { * @param row Lookup row for exact match. * @param c Filter closure. * @param x Implementation specific argument, {@code null} always means that we need to return full detached data row. - * @param foundPageLsnr Found data listener. + * @param foundLsnr Found row listener. If not {@code null}, is called when a row is found under a page-read-lock. * @return Found result or {@code null}. * @throws IgniteCheckedException If failed. */ @@ -1544,14 +1544,14 @@ public final R findOne( L row, @Nullable TreeRowClosure c, Object x, - @Nullable BiConsumer foundPageLsnr + @Nullable BiConsumer foundLsnr ) throws IgniteCheckedException { checkDestroyed(); GetOne g = new GetOne(row, c, x, false); try { - doFind(g, foundPageLsnr); + doFind(g, foundLsnr); return (R)g.row; } @@ -1580,16 +1580,24 @@ public final R findOne( /** * @param g Get. - * @param foundPageLsnr Found data fistener. * @throws IgniteCheckedException If failed. */ - private void doFind(Get g, @Nullable BiConsumer foundPageLsnr) throws IgniteCheckedException { + private void doFind(Get g) throws IgniteCheckedException { + doFind(g, null); + } + + /** + * @param g Get. + * @param foundLsnr Found row listener. If not {@code null}, is called when a row is found under a page-read-lock. + * @throws IgniteCheckedException If failed. + */ + private void doFind(Get g, @Nullable BiConsumer foundLsnr) throws IgniteCheckedException { assert !sequentialWriteOptsEnabled; for (;;) { // Go down with retries. g.init(); - switch (findDown(g, g.rootId, 0L, g.rootLvl, foundPageLsnr)) { + switch (findDown(g, g.rootId, 0L, g.rootLvl, foundLsnr)) { case RETRY: case RETRY_ROOT: checkDestroyed(); @@ -1608,7 +1616,7 @@ private void doFind(Get g, @Nullable BiConsumer foundPageLsnr) throws I * @param pageId Page ID. * @param fwdId Expected forward page ID. * @param lvl Level. - * @param foundLsnr Found row listener. + * @param foundLsnr Found row listener. If not {@code null}, is called when a row is found under a page-read-lock. * @return Result code. * @throws IgniteCheckedException If failed. */ @@ -3466,7 +3474,7 @@ public T find() throws IgniteCheckedException { while (retry) { row = row0; - doFind(this, null); + doFind(this); } return row0; @@ -3709,7 +3717,7 @@ private L insertWithSplit(long pageId, long page, long pageAddr, BPlusIO io, cnt = io.getCount(pageAddr); // Last item from backward row goes up. - L moveUpRow = io.getLookupRow(BPlusTree.this, pageAddr, cnt - 1); + L moveUpRow = io.getLookupRow(BPlusTree.this, pageAddr, cnt - 1); if (!io.isLeaf()) { // Leaf pages must contain all the links, inner pages remove moveUpLink. io.setCount(pageAddr, cnt - 1); @@ -5564,7 +5572,7 @@ private boolean fillFromBuffer(long pageAddr, BPlusIO io, int startIdx, int c final void find() throws IgniteCheckedException { assert lowerBound != null; - doFind(getCursor = new GetCursor(lowerBound, lowerShift, this), null); + doFind(getCursor = new GetCursor(lowerBound, lowerShift, this)); } /** diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionPutLargeObjectsAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionPutLargeObjectsAbstractTest.java index d8dc2807c77cb..b141fa82bb357 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionPutLargeObjectsAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionPutLargeObjectsAbstractTest.java @@ -16,35 +16,27 @@ */ package org.apache.ignite.internal.processors.cache.eviction.paged; -import java.util.Random; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicLong; import org.apache.ignite.IgniteCache; import org.apache.ignite.configuration.DataRegionConfiguration; import org.apache.ignite.configuration.DataStorageConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.testframework.junits.WithSystemProperty; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; -import static org.apache.ignite.testframework.GridTestUtils.runAsync; -import static org.apache.ignite.testframework.GridTestUtils.runMultiThreadedAsync; +import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_PAGE_SIZE; /** */ public abstract class PageEvictionPutLargeObjectsAbstractTest extends GridCommonAbstractTest { /** Offheap size for memory policy. */ - private static final int SIZE = 128 * 1024 * 1024; - - /** Offheap size for memory policy. */ - private static final long MAX_SIZE = 256 * 1024 * 1024; + private static final int SIZE = 1024 * 1024 * 1024; /** Record size. */ - private static final int RECORD_SIZE = 50 * 4096; + private static final int RECORD_SIZE = 80 * 1024 * 1024; + + /** Number of entries. */ + static final int ENTRIES = 50; /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { @@ -52,12 +44,9 @@ public abstract class PageEvictionPutLargeObjectsAbstractTest extends GridCommon .setDataStorageConfiguration(new DataStorageConfiguration() .setDefaultDataRegionConfiguration(new DataRegionConfiguration() .setInitialSize(SIZE) - .setMaxSize(MAX_SIZE) - .setEmptyPagesPoolSize(1000) - .setPersistenceEnabled(false) - .setMetricsEnabled(true) - .setEvictionThreshold(0.8) + .setMaxSize(SIZE) ) + .setPageSize(DFLT_PAGE_SIZE) ); } @@ -72,61 +61,15 @@ public abstract class PageEvictionPutLargeObjectsAbstractTest extends GridCommon @Test @WithSystemProperty(key = "IGNITE_DUMP_THREADS_ON_FAILURE", value = "false") public void testPutLargeObjects() throws Exception { - IgniteEx ignite = startGrids(1); - - IgniteCache cache = ignite.createCache(DEFAULT_CACHE_NAME); - AtomicLong idx = new AtomicLong(); - AtomicBoolean run = new AtomicBoolean(true); - - IgniteInternalFuture getFut = runMultiThreadedAsync(() -> { - Random rnd = new Random(); - - while (run.get()) { - if (idx.get() > 0) - cache.get(rnd.nextLong(idx.get())); - } - }, 4, "get"); - - TestObject loadObj = new TestObject(RECORD_SIZE); -// Set loadedKeys = ConcurrentHashMap.newKeySet(); + IgniteEx ignite = startGrids(2); - IgniteInternalFuture ldrFut = runMultiThreadedAsync(() -> { - while (run.get()) { - Long k = idx.incrementAndGet(); + IgniteCache cache = ignite.createCache(DEFAULT_CACHE_NAME); - cache.put(k, loadObj); + Object val = new byte[RECORD_SIZE]; - //loadedKeys.add(k); - } + for (Integer key : primaryKeys(grid(1).cache(DEFAULT_CACHE_NAME), ENTRIES)) + cache.put(key, val); - }, 2, "ldr"); - -// IgniteInternalFuture evicFut = runAsync(() -> { -// CacheEvictionManager evictMgr = grid(0).cachex(DEFAULT_CACHE_NAME).context().evicts(); -// -// while (run.get()) { -// if (loadedKeys.isEmpty()) -// continue; -// -// evictMgr.batchEvict(loadedKeys, null); -// -// loadedKeys.clear(); -// } -// }); - - runAsync(() -> { - Thread.sleep(getTestTimeout() / 2); - - run.set(false); - }); - - ldrFut.get(getTestTimeout(), TimeUnit.MILLISECONDS); - getFut.get(getTestTimeout(), TimeUnit.MILLISECONDS); -// evicFut.get(getTestTimeout(), TimeUnit.MILLISECONDS); - } - - /** {@inheritDoc} */ - @Override protected long getTestTimeout() { - return 45L * 1000; + assertTrue(cache.size() < ENTRIES); } } diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java index cfbb96456e0e9..24ba05017a40f 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java @@ -30,7 +30,7 @@ import java.util.Set; import java.util.UUID; import java.util.concurrent.Callable; -import java.util.function.Consumer; +import java.util.function.BiConsumer; import javax.cache.CacheException; import com.google.common.collect.ImmutableMap; import org.apache.ignite.IgniteCache; @@ -783,7 +783,7 @@ public void testEmptyResult() throws Exception { /** * Verifies that exactly one record is found when we have equality comparison in where clause (which is supposed - * to use {@link BPlusTree#findOne(Object, BPlusTree.TreeRowClosure, Object, Consumer)} instead of + * to use {@link BPlusTree#findOne(Object, BPlusTree.TreeRowClosure, Object, BiConsumer)} instead of * {@link BPlusTree#find(Object, Object, Object)}. * * @throws Exception If failed. @@ -803,7 +803,7 @@ public void testSingleResultUsesFindOne() throws Exception { /** * Verifies that zero records are found when we have equality comparison in where clause (which is supposed - * to use {@link BPlusTree#findOne(Object, BPlusTree.TreeRowClosure, Object, Consumer)} instead of + * to use {@link BPlusTree#findOne(Object, BPlusTree.TreeRowClosure, Object, BiConsumer)} instead of * {@link BPlusTree#find(Object, Object, Object)} and the key is not in the cache. * * @throws Exception If failed.