rpuch commented on code in PR #1405:
URL: https://github.com/apache/ignite-3/pull/1405#discussion_r1049308112


##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/io/BlobFragmentIo.java:
##########
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.storage.pagememory.mv.io;
+
+import static org.apache.ignite.internal.pagememory.PageIdAllocator.FLAG_AUX;
+import static org.apache.ignite.internal.pagememory.util.PageUtils.getInt;
+import static org.apache.ignite.internal.pagememory.util.PageUtils.getLong;
+import static org.apache.ignite.internal.pagememory.util.PageUtils.putInt;
+import static org.apache.ignite.internal.pagememory.util.PageUtils.putLong;
+
+import org.apache.ignite.internal.pagememory.io.IoVersions;
+import org.apache.ignite.internal.pagememory.io.PageIo;
+import org.apache.ignite.internal.pagememory.util.PageUtils;
+import org.apache.ignite.lang.IgniteStringBuilder;
+
+/**
+ * Pages IO for blob fragments.
+ *
+ * <p>First, ID of the next page in the chain is stored (0 if current page is 
the last one in the chain).
+ * Then, if the page is the first in the chain, total blob length is stored as 
4 bytes.
+ * Finally, bytes of a blob fragment are stored.
+ */
+public class BlobFragmentIo extends PageIo {
+    /** Page IO type. */
+    public static final short T_BLOB_FRAGMENT_IO = 13;
+
+    private static final int NEXT_PAGE_ID_OFF = PageIo.COMMON_HEADER_END;
+
+    private static final int FRAGMENT_BYTES_OFF = NEXT_PAGE_ID_OFF + 
Long.BYTES;

Review Comment:
   Storing page IDs as 6 bytes will make the code more complex, but the gain is 
too little (2 bytes per page), so it does not seem worth the complexity.
   
   I made the way we calculate the offset more clear and clarified the page 
layout even more in the javadoc.



-- 
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