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

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

I suggest to change the {{Compact}} tool to use the same {{FileStore}} instance 
for compaction and cleanup. Previously it was necessary to use two instance in 
order for cleanup to be effective and not affected by in memory references 
retaining segments from the old generation. Since we now run gc by retention 
time and set that to a single generation for OffRC that problem should not 
exist any more. 

Proposed patch:
{code}
--- 
oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/Compact.java
   (date 1509379779000)
+++ 
oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/Compact.java
   (date 1509446878000)
@@ -134,10 +134,8 @@
     private void compact() throws IOException, 
InvalidFileStoreVersionException {
         try (FileStore store = newFileStore()) {
             store.compactFull();
-        }
 
-        System.out.println("    -> cleaning up");
-        try (FileStore store = newFileStore()) {
+            System.out.println("    -> cleaning up");
             store.cleanup();
             File journal = new File(path, "journal.log");
             String head;
{code}

[~frm], WDYT?

> OffRC alway logs 0 for the number of compacted nodes in gc.log
> --------------------------------------------------------------
>
>                 Key: OAK-6886
>                 URL: https://issues.apache.org/jira/browse/OAK-6886
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: segment-tar
>            Reporter: Michael Dürig
>            Assignee: Michael Dürig
>              Labels: compaction, gc
>             Fix For: 1.8, 1.7.12
>
>
> After an offline compaction the {{gc.log}} always contains 0 for the number 
> of compacted nodes. This is caused by 
> {{org.apache.jackrabbit.oak.segment.tool.Compact.compact()}} instantiating a 
> new {{FileStore}} to run cleanup. That file store has new {{GCMonitor}} 
> instance, which did no see any of the nodes written by the compaction that 
> was run on the previous {{FileStore}} instance. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to