You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Michael Dürig (JIRA)" <ji...@apache.org> on 2018/03/01 13:14:00 UTC

[jira] [Commented] (OAK-7057) Segment.toString: Record table should include an index into the hexdump

    [ https://issues.apache.org/jira/browse/OAK-7057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16381972#comment-16381972 ] 

Michael Dürig commented on OAK-7057:
------------------------------------

Proposed patch:

{noformat}
===================================================================
--- oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/Segment.java
+++ oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/Segment.java
@@ -562,7 +562,8 @@
                     writer.format("reference %02x: %s%n", i++, segmentId);
                 }
                 for (Entry entry : recordNumbers) {
-                    writer.format("%10s record %08x: %08x%n", entry.getType(), entry.getRecordNumber(), entry.getOffset());
+                    int offset = data.size() - (MAX_SEGMENT_SIZE - entry.getOffset());
+                    writer.format("%10s record %08x: %08x%n", entry.getType(), entry.getRecordNumber(), offset);
                 }
             }
             writer.println("--------------------------------------------------------------------------");
{noformat}

This changes the segment dump from

{noformat}
Segment c8013169-2c7c-42cf-a9ff-eac7e5eb16d0 (304 bytes)
Info: {"wid":"sys.0000","sno":2,"t":1519909675884}, Generation: GCGeneration{generation=0,fullGeneration=0,isCompacted=false}
--------------------------------------------------------------------------
     VALUE record 00000000: 0003ffd0
     VALUE record 00000001: 0003ffcc
     VALUE record 00000002: 0003ffc8
     VALUE record 00000003: 0003ffc4
    BUCKET record 00000004: 0003ffb0
  TEMPLATE record 00000005: 0003ffa0
     VALUE record 00000006: 0003ff9c
     VALUE record 00000007: 0003ff88
     VALUE record 00000008: 0003ff84
    BUCKET record 00000009: 0003ff70
      NODE record 0000000a: 0003ff5c
--------------------------------------------------------------------------
00000000 30 61 4B 0D 00 00 00 00 00 00 00 00 00 00 00 00 0aK.............
00000010 00 00 00 00 00 0B 00 00 00 00 00 00 00 00 00 00 ................
00000020 00 00 00 00 04 00 03 FF D0 00 00 00 01 04 00 03 ................
00000030 FF CC 00 00 00 02 04 00 03 FF C8 00 00 00 03 04 ................
00000040 00 03 FF C4 00 00 00 04 02 00 03 FF B0 00 00 00 ................
00000050 05 06 00 03 FF A0 00 00 00 06 04 00 03 FF 9C 00 ................
00000060 00 00 07 04 00 03 FF 88 00 00 00 08 04 00 03 FF ................
00000070 84 00 00 00 09 02 00 03 FF 70 00 00 00 0A 07 00 .........p......
00000080 03 FF 5C 00 00 00 00 00 00 00 00 00 00 00 00 00 ..\.............
00000090 00 0A 00 00 00 00 00 05 00 00 00 00 00 09 00 00 ................
000000A0 00 00 00 00 00 06 00 00 00 00 00 07 00 00 00 00 ................
000000B0 00 08 00 00 03 61 62 63 11 33 2E 31 34 31 35 39 .....abc.3.14159
000000C0 32 36 35 33 35 38 39 37 39 33 00 00 03 31 32 33 2653589793...123
000000D0 20 00 00 03 00 00 00 00 00 04 03 04 01 00 00 00  ...............
000000E0 00 00 00 00 00 01 00 00 00 00 00 02 00 00 00 00 ................
000000F0 00 03 00 00 03 66 6F 6F 03 62 61 7A 03 62 61 72 .....foo.baz.bar
00000100 2C 7B 22 77 69 64 22 3A 22 73 79 73 2E 30 30 30 ,{"wid":"sys.000
00000110 30 22 2C 22 73 6E 6F 22 3A 32 2C 22 74 22 3A 31 0","sno":2,"t":1
00000120 35 31 39 39 30 39 36 37 35 38 38 34 7D 00 00 00 519909675884}...
--------------------------------------------------------------------------
{noformat}

to 

{noformat}
Segment 04900e70-9f6e-46d2-a3cf-e1877760d2d3 (304 bytes)
Info: {"wid":"sys.0000","sno":2,"t":1519909591781}, Generation: GCGeneration{generation=0,fullGeneration=0,isCompacted=false}
--------------------------------------------------------------------------
     VALUE record 00000000: 00000100
     VALUE record 00000001: 000000fc
     VALUE record 00000002: 000000f8
     VALUE record 00000003: 000000f4
    BUCKET record 00000004: 000000e0
  TEMPLATE record 00000005: 000000d0
     VALUE record 00000006: 000000cc
     VALUE record 00000007: 000000b8
     VALUE record 00000008: 000000b4
    BUCKET record 00000009: 000000a0
      NODE record 0000000a: 0000008c
--------------------------------------------------------------------------
00000000 30 61 4B 0D 00 00 00 00 00 00 00 00 00 00 00 00 0aK.............
00000010 00 00 00 00 00 0B 00 00 00 00 00 00 00 00 00 00 ................
00000020 00 00 00 00 04 00 03 FF D0 00 00 00 01 04 00 03 ................
00000030 FF CC 00 00 00 02 04 00 03 FF C8 00 00 00 03 04 ................
00000040 00 03 FF C4 00 00 00 04 02 00 03 FF B0 00 00 00 ................
00000050 05 06 00 03 FF A0 00 00 00 06 04 00 03 FF 9C 00 ................
00000060 00 00 07 04 00 03 FF 88 00 00 00 08 04 00 03 FF ................
00000070 84 00 00 00 09 02 00 03 FF 70 00 00 00 0A 07 00 .........p......
00000080 03 FF 5C 00 00 00 00 00 00 00 00 00 00 00 00 00 ..\.............
00000090 00 0A 00 00 00 00 00 05 00 00 00 00 00 09 00 00 ................
000000A0 00 00 00 00 00 06 00 00 00 00 00 07 00 00 00 00 ................
000000B0 00 08 00 00 03 61 62 63 11 33 2E 31 34 31 35 39 .....abc.3.14159
000000C0 32 36 35 33 35 38 39 37 39 33 00 00 03 31 32 33 2653589793...123
000000D0 20 00 00 03 00 00 00 00 00 04 03 04 01 00 00 00  ...............
000000E0 00 00 00 00 00 01 00 00 00 00 00 02 00 00 00 00 ................
000000F0 00 03 00 00 03 66 6F 6F 03 62 61 7A 03 62 61 72 .....foo.baz.bar
00000100 2C 7B 22 77 69 64 22 3A 22 73 79 73 2E 30 30 30 ,{"wid":"sys.000
00000110 30 22 2C 22 73 6E 6F 22 3A 32 2C 22 74 22 3A 31 0","sno":2,"t":1
00000120 35 31 39 39 30 39 35 39 31 37 38 31 7D 00 00 00 519909591781}...
--------------------------------------------------------------------------


{noformat}

[~frm], WDYT? Alternatively we could offset the addresses in the hex dump not starting with 000000 when dealing with a truncated segment.


> Segment.toString: Record table should include an index into the hexdump
> -----------------------------------------------------------------------
>
>                 Key: OAK-7057
>                 URL: https://issues.apache.org/jira/browse/OAK-7057
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: segment-tar
>            Reporter: Michael Dürig
>            Assignee: Michael Dürig
>            Priority: Minor
>              Labels: tooling
>             Fix For: 1.9.0, 1.10
>
>
> Currently the Segment dump created in {{Segment.toString}} includes a list of records with their offsets. However these offsets do no match the ones in the subsequent raw byte dump of the segment. We should add a raw offsets to the list of records so finding the actual data that belongs to a record doesn't involve manually fiddling with logical / physical offset translation. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)