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

Benjamin Lerer commented on CASSANDRA-16192:
--------------------------------------------

[~marcuse], [~jjirsa] while looking into the {{pendingTasks}} metric I 
discovered that it relies on 
{{AbstractCompactionStrategy.getEstimatedRemainingTasks()}} to determine the 
amount of compactions remaining to perform.
I found out that the way {{getEstimatedRemainingTasks()}} work is different 
depending on the strategy. {{LeveledCompactionStrategy}} will recompute the 
number of remaining tasks each time it is called while other strategies will 
compute the number of remaining tasks in {{getNextBackgroundSSTables}} and will 
cache the value. That value will be the one returned by 
{{getEstimatedRemainingTasks()}} until {{getNextBackgroundSSTables}} is called 
again.

That approach of caching the number of remaining tasks makes the 
{{pendingTasks}} metric inaccurate as it does not take into account newly 
flushed SSTables or compacted ones until {{getNextBackgroundSSTables}} is 
called again.
It also look that the cached number of remaining tasks is not modified when we 
force a major compaction and that by consequence the number of remaining tasks 
will only be updated once the major compaction it completely done, and the 
automatic compactions are renabled

It is not clear to me how accurate we want the {{pendingTasks}} metric to be 
and I would like to have your opinion on that point.  

Another point, I wanted to raise is that due to the way 
{{getEstimatedRemainingTasks()}} works, it looks that we base our compactions 
prioritisation on outdated estimations (see 
https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/db/compaction/CompactionStrategyHolder.java#L109).
     


> Add more tests to cover compaction metrics
> ------------------------------------------
>
>                 Key: CASSANDRA-16192
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-16192
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Test/unit
>            Reporter: Benjamin Lerer
>            Assignee: Adam Holmberg
>            Priority: Normal
>             Fix For: 4.0-beta
>
>
> Some compaction metrics do not seems to be tested.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to