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 "Alexander Klimetschek (JIRA)" <ji...@apache.org> on 2018/10/14 01:47:00 UTC

[jira] [Commented] (OAK-7832) oak-run console export should handle exceptions such as missing segments

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

Alexander Klimetschek commented on OAK-7832:
--------------------------------------------

Attached is a  [^OAK-7832.patch] against the oak 1.8 branch that. Also attached a ready to use jar with the changes included: [^oak-run-1.8.9-SNAPSHOT.jar].

1. Changed the console {{export}} command to log exceptions and include them in the json, but then continue and produce a valid json.
Log output:
{noformat}
/content/some/folder> export
01:02:01.589 [main] ERROR o.a.j.oak.json.JsonSerializer - Cannot read property value /content/some/folder/mypage/jcr:content/cq:lastModifiedBy : org.apache.jackrabbit.oak.segment.SegmentNotFoundException: Segment dec74dbe-d24f-4f3d-a7ef-75374bca3572 not found
01:02:01.596 [main] ERROR o.a.j.oak.json.JsonSerializer - Cannot read node /content/some/folder/mypage/jcr:content/content/paragraph/par/component0 : org.apache.jackrabbit.oak.segment.SegmentNotFoundException: Segment e8c16c25-cc3c-4874-ab0b-f515d6523c24 not found
{noformat}
nodestates.json output:
{noformat}
...
        "cq:cssClass": "ERROR: Cannot read property value /content/some/folder/mypage/jcr:content/content/paragraph/par/component/cq:cssClass : org.apache.jackrabbit.oak.segment.SegmentNotFoundException: Segment e8c16c25-cc3c-4874-ab0b-f515d6523c24 not found"
...
       "component0": {
        "_error": "ERROR: Cannot read node /content/some/folder/mypage/jcr:content/content/paragraph/par/component0 : org.apache.jackrabbit.oak.segment.SegmentNotFoundException: Segment e8c16c25-cc3c-4874-ab0b-f515d6523c24 not found"
       },
{noformat}

2. Also maked the {{pn}} command handle exceptions.
{noformat}
/content/some/folder> pn
{ jcr:primaryType = cq:Page, jcr:createdBy = silcottl, jcr:created = 2018-09-20T15:05:43.264Z, :childOrder = [jcr:content, one, two, three, four, give], one = { ... }, two = { ... }, three = { ... }, jcr:content = { ... }, four = { ERROR on node: org.apache.jackrabbit.oak.segment.SegmentNotFoundException: Segment a9d9a87e-e452-452f-a3d3-d89228bef4d6 not found }, five = { ... } }
{noformat}

In both cases it catches on property value access and child node access, which at least with SegmentTar are the places where you'd get a SegmentNotFoundException if the segment storing that information is missing. For handling the getChildNodeEntries() case in the JsonSerializer I had to to a bit of a trick with a MemoryChildNodeEntry to get a nice json output with as much information as possible, without rewriting more of the JsonSerializer.

> oak-run console export should handle exceptions such as missing segments
> ------------------------------------------------------------------------
>
>                 Key: OAK-7832
>                 URL: https://issues.apache.org/jira/browse/OAK-7832
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: run, store-spi
>            Reporter: Alexander Klimetschek
>            Assignee: Alexander Klimetschek
>            Priority: Major
>         Attachments: OAK-7832.patch, oak-run-1.8.9-SNAPSHOT.jar
>
>
> Problem: When trying to look at data using "pn" or running "export" oak-run console currently will choke and abort the traversal on exceptions such as SegmentNotFoundException.
> Expected: It would be nice if it would be best-effort, log the issue or embed in the exported json, and just continue. This also ensures all missing segments for a subtree are listed with one command (if it fails right now you just see the first missing segment).



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