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

ASF GitHub Bot commented on GEODE-8667:
---------------------------------------

jchen21 commented on pull request #5689:
URL: https://github.com/apache/geode/pull/5689#issuecomment-730682983


   > add unit test coverage of needsCompaction to OplogTest.
   > 
   > It seems like the only change you made was to say we don't need to compact 
if an Oplog has a totalCount == 0. I think totalCount == 0 means that the oplog 
is empty. This seems like something we should compact. Do you understand why 
offline compaction gave us an empty oplog? I'm concerned this change might 
cause us not to remove empty oplogs. Or maybe we say it has no need to compact 
but still do a check and remove it for being empty somewhere else?
   
   I have added a unit test in `OplogTest`. 
   
   `totalCount` == 0 does not necessarily mean the oplog is empty. You remind 
me of the case of an empty oplog. There is another field `totalLiveCount` to 
check. What I see in the persistent recovery immediately after an offline 
compaction is, the offline compacted oplog is non-empty. During the recovery, 
`totalCount` is `0`. However, `totalLiveCount` has the actual number of live 
entries in the oplog. Therefore I add one more condition to check 
`totalLiveCount`. 
   
   If `totalCount` == 0 and `totalLiveCount` > 0, such as the case of recovery 
after offline compaction, we don't need compaction again. Are there any other 
cases that need compaction, even though `totalCount` == 0 and `totalLiveCount` 
> 0?
   
   If `totalCount` == 0 and `totalLiveCount` <= 0, then the oplog is empty, 
which needs compaction. Please correct me if I am wrong.


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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Duplicate online Oplog compaction after offline Oplog compaction
> ----------------------------------------------------------------
>
>                 Key: GEODE-8667
>                 URL: https://issues.apache.org/jira/browse/GEODE-8667
>             Project: Geode
>          Issue Type: Bug
>            Reporter: Jianxia Chen
>            Assignee: Jianxia Chen
>            Priority: Major
>              Labels: GeodeOperationAPI, pull-request-available
>
> Use `compact offline-disk-store` command to compact the Oplogs offline. 
> Then restart the servers. 
> The logs show OplogCompactor thread is compacting Oplogs again when 
> restarting the servers, even though the Oplogs were just compacted offline. 
> For example:
> ```
> [info 2020/10/27 16:32:22.534 PDT <Idle OplogCompactor1> tid=0x35] Recovered 
> values for disk store DEFAULT with unique id 
> 76393d3c-dd10-4b89-b655-821d37631774
> [info 2020/10/27 16:32:22.535 PDT <OplogCompactor DEFAULT for oplog oplog#2> 
> tid=0x35] OplogCompactor for DEFAULT compaction oplog id(s): oplog#2
> [info 2020/10/27 16:32:22.537 PDT <OplogCompactor DEFAULT for oplog oplog#2> 
> tid=0x35] compaction did 2 creates and updates in 2 ms
> [info 2020/10/27 16:32:22.537 PDT <Oplog Delete Task1> tid=0x36] Deleted 
> oplog#2 crf for disk store DEFAULT.
> [info 2020/10/27 16:32:22.538 PDT <Oplog Delete Task1> tid=0x36] Deleted 
> oplog#2 krf for disk store DEFAULT.
> [info 2020/10/27 16:32:22.538 PDT <Oplog Delete Task1> tid=0x36] Deleted 
> oplog#2 drf for disk store DEFAULT.
> ```



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to