ibessonov commented on code in PR #818:
URL: https://github.com/apache/ignite-3/pull/818#discussion_r881421854


##########
modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java:
##########
@@ -265,13 +266,29 @@ public static String toHexString(long addr, int len) {
         StringBuilder sb = new StringBuilder(len * 2);
 
         for (int i = 0; i < len; i++) {
-            // Can not use getLong because on little-endian it produces bs.
+            // Can not use getLong because on little-endian it produces wrong 
result.
             addByteAsHex(sb, GridUnsafe.getByte(addr + i));
         }
 
         return sb.toString();
     }
 
+    /**
+     * Returns hex representation of memory region.
+     *
+     * @param buf Buffer which content should be converted to string.
+     */
+    public static String toHexString(ByteBuffer buf) {
+        StringBuilder sb = new StringBuilder(buf.capacity() * 2);
+
+        for (int i = 0; i < buf.capacity(); i++) {

Review Comment:
   Should't you start with position and end with limit? Please reflect in 
javadoc that position and limit are ignored and the whole data chunk is 
converted to string



##########
modules/page-memory/src/test/java/org/apache/ignite/internal/pagememory/persistence/store/FilePageStoreTest.java:
##########
@@ -498,8 +498,7 @@ private static ByteBuffer copyOf(ByteBuffer buffer) {
     private static ByteBuffer createPageByteBuffer() {
         ByteBuffer buffer = 
ByteBuffer.allocateDirect(PAGE_SIZE).order(nativeOrder());
 
-        PageIo.setType(bufferAddress(buffer), MAX_IO_TYPE);
-        PageIo.setVersion(bufferAddress(buffer), 1);
+        new TestPageIo().initNewPage(GridUnsafe.bufferAddress(buffer), 0, 
PAGE_SIZE);

Review Comment:
   I bet we already have a test io somewhere nearby, can we reuse it? Or 
they're all private?



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