sashapolo commented on code in PR #3933:
URL: https://github.com/apache/ignite-3/pull/3933#discussion_r1642721333


##########
modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/VolatilePageMemoryMvTableStorageTest.java:
##########
@@ -57,10 +60,18 @@ public class VolatilePageMemoryMvTableStorageTest extends 
AbstractMvTableStorage
 
     @BeforeEach
     void setUp(
+            TestInfo testInfo,
             @InjectConfiguration VolatilePageMemoryStorageEngineConfiguration 
engineConfig,
             @InjectConfiguration("mock.profiles.default = {engine = 
\"aimem\"}")
             StorageConfiguration storageConfiguration
     ) {
+        if (testInfo.getTags().contains(LOW_MEMORY_TAG)) {

Review Comment:
   Where did this come from?



##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/PersistentPageMemoryTableStorage.java:
##########
@@ -164,7 +164,7 @@ private FreeListImpl createFreeList(
             boolean initNew = false;
 
             if (meta.freeListRootPageId() == 0) {
-                long rootPageId = pageMemory.allocatePage(getTableId(), 
partId, FLAG_AUX);
+                long rootPageId = pageMemory.allocatePageNoReuse(getTableId(), 
partId, FLAG_AUX);

Review Comment:
   Why no reuse here?



##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/PageIdAllocator.java:
##########
@@ -39,14 +48,85 @@ public interface PageIdAllocator {
     // TODO IGNITE-16350 Use constant from the table configuration.
     int MAX_PARTITION_ID = 65500;
 
+    /**
+     * Allocates a page from the space for the given partition ID and the 
given flags. Does not reuse pages.
+     *
+     * @param groupId Group ID.
+     * @param partitionId Partition ID.
+     * @return Allocated page ID.
+     */
+    long allocatePageNoReuse(int groupId, int partitionId, byte flags) throws 
IgniteInternalCheckedException;
+
+    /**
+     * Allocates a page from the space for the given partition ID and the 
given flags. If reuse list is provided, tries to reuse page.
+     *
+     * @param reuseList Reuse list to reuse pages from.
+     * @param groupId Group ID.
+     * @param partitionId Partition ID.
+     * @return Allocated page ID.
+     */
+    default long allocatePage(@Nullable ReuseList reuseList, int groupId, int 
partitionId, byte flags)
+            throws IgniteInternalCheckedException {
+        return allocatePage(reuseList, null, true, groupId, partitionId, 
flags);
+    }
+
     /**
      * Allocates a page from the space for the given partition ID and the 
given flags.
      *
+     * @param reuseList Reuse list to reuse pages from.
+     * @param bag Reuse Bag.
+     * @param useRecycled Use recycled page.
      * @param groupId Group ID.
      * @param partitionId Partition ID.
      * @return Allocated page ID.
      */
-    long allocatePage(int groupId, int partitionId, byte flags) throws 
IgniteInternalCheckedException;
+    default long allocatePage(
+            @Nullable ReuseList reuseList,
+            @Nullable ReuseBag bag,
+            boolean useRecycled,
+            int groupId,
+            int partitionId,
+            byte flags
+    ) throws IgniteInternalCheckedException {
+        long pageId = 0;
+
+        if (reuseList != null) {

Review Comment:
   Why did we start ignoring the `useRecycled` flag?



##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/IndexStorageFactory.java:
##########
@@ -274,7 +274,7 @@ private <T> IndexTreeAndMeta<T> 
createIndexTree(StorageIndexDescriptor descripto
         try {
             PageMemory pageMemory = tableStorage.dataRegion().pageMemory();
 
-            long metaPageId = 
pageMemory.allocatePage(tableStorage.getTableId(), partitionId, 
PageIdAllocator.FLAG_AUX);
+            long metaPageId = 
pageMemory.allocatePageNoReuse(tableStorage.getTableId(), partitionId, 
PageIdAllocator.FLAG_AUX);

Review Comment:
   Why don't we reuse pages here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to