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

Julian Sedding commented on OAK-9905:
-------------------------------------

[~piercarlo_s] Revision {{55db2d1f-ffb0-4c47-ab7f-eca779bb4e08}} references a 
previous root segment from your journal file. As far as I know the journal file 
is not truncated after a GC run. Instead, only the latest revision is appended. 
This means that the journal file may well reference revisions that no longer 
exist. Note: the journal is read backwards, thus the order of revisions in your 
output should be the reverse of the lines in your journal file.

The difference between your code and the code in oak-run is that your code 
performs "online-compaction" and oak-run performs "offline-compaction". During 
online-compaction two generations of segments are kept in order not to disrupt 
live code (otherwise you could see random SegmentNotFoundExceptions in your 
code). Offline-compaction doesn't need to deal with this complication and thus 
does not keep multiple generations. Also, it truncates the journal file.

In short: I think everything you observed works as designed.

If you disagree, please provide a failing test case that allows us to further 
analyse the issue.

> File Store GC leaves the Store in an unconsistent state
> -------------------------------------------------------
>
>                 Key: OAK-9905
>                 URL: https://issues.apache.org/jira/browse/OAK-9905
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: segment-tar, segmentmk
>    Affects Versions: 1.42.0
>            Reporter: Piercarlo Slavazza
>            Priority: Blocker
>         Attachments: full_gc.log
>
>
> I created a File Store using Jackrabbit Oak v. 1.42.0.
> I added some nodes, and then deleted some of them.
> I then inspect the "history" of the store, using the very same code used by 
> {{oak-run}} - but executed in my application (no OSGi):
> {code:java}
> Iterator<RevisionHistory.HistoryElement> history = new 
> RevisionHistory(fileStoreFolder).getHistory(
>         new LocalJournalFile(journal),
>         path);
> while (history.hasNext()) {
>     printWriter.println(history.next().toString(depth));
> } {code}
> I got the following output:
> {code:java}
> 7b35a984-cf56-4a6d-a571-db38ac0f12aa:6={"root":{}}
> c5b06947-64ea-48b9-a0c9-dbb65fdefb82:147={"root":{}}
> 8c0036ef-0160-4f6c-a408-a956f38b421d:7653={"root":{}}
> 55db2d1f-ffb0-4c47-ab7f-eca779bb4e08:450={"root":{}}
> daadf7ca-0183-4a93-a94a-0c2347c89443:302={"root":{}}
> fd234c75-9329-41f1-a9be-f7cef1d2ae7b:371={"root":{}}
> 3e86d6a1-76a5-4983-a779-48b3ee0e98fd:6={"root":{}}
> 5d05a2d8-f239-4fa0-a643-27bd281a6573:7102={"root":{}} {code}
> that is fine - as far as I can tell.
> Then, I run {{{}fileSto{}}}{{{}re.fullGC();{}}} - log attached [^full_gc.log].
> Then, I run again the code that inspect the history, and I got the following 
> output:
> {code:java}
> 10cedc98-86ed-4a48-a22b-18fe8c34ed3e:7424={"root":{}}
> 7b35a984-cf56-4a6d-a571-db38ac0f12aa:6={"root":{}}
> c5b06947-64ea-48b9-a0c9-dbb65fdefb82:147={"root":{}}
> 8c0036ef-0160-4f6c-a408-a956f38b421d:7653={"root":{}}
> Segment 55db2d1f-ffb0-4c47-ab7f-eca779bb4e08 not found{code}
> The expected behaviour is that:
>  * either revision {{55db2d1f-ffb0-4c47-ab7f-eca779bb4e08}} is no more 
> present in the history of the file store
>  * or revision is present and can be found
> Despite this issue, it _seems_ that everything is running smoothly, but I 
> cannot tell whether this issue will bug some thing at some point.
> Also note that, if I stop my application and run {{oak-run compact}} from the 
> command line, the troubled revision is removed and I end up with just one 
> revision:
> {code:java}
> Apache Jackrabbit Oak 1.42.0
> 07:53:00.534 [main] WARN  o.a.j.oak.segment.file.JournalReader - Skipping 
> invalid journal entry: 
> 07:53:00.549 [main] WARN  o.a.j.oak.segment.file.JournalReader - Skipping 
> invalid journal entry: 
> 635924e4-2e18-4bad-ac43-7347f4b1dfe0:7424={"root":{}}
>  {code}
> (Please also note the two warnings printed by {{{}oak-run{}}}…).
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to