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

Marcus Eriksson commented on CASSANDRA-13830:
---------------------------------------------

the refactor looks good to me, just a few small nits

* we can remove everything but the constructor from TreeDifference - looks like 
nothing uses the size/rowsOnRight/Left etc. Keeping the class around at all 
could be nice to make it clear we are tracking differences
* {{detectDifferences}} could be private and have the {{@VisibleForTesting}} 
removed

It is a bit scary that the test coverage for {{MerkleTree.difference}} is 
minimal though, we should probably improve that before committing this.

> Simplify MerkleTree.difference/differenceHelper
> -----------------------------------------------
>
>                 Key: CASSANDRA-13830
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13830
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Blake Eggleston
>            Assignee: Blake Eggleston
>            Priority: Minor
>             Fix For: 4.x
>
>
> As brought up in CASSANDRA-13603, {{MerkleTree.differenceHelper}} is overly 
> complex and difficult to follow for what it's doing. It also shares some of 
> it's responsibilities with {{difference}}, and assumes that the trees it's 
> given have differences, which makes it a potential source of future bugs.
> Since we're just trying to recursively compare these trees and record the 
> largest contiguous out of sync ranges, I think this could be simplified a 
> bit. I propose that we refactor {{difference}} / {{differenceHelper}} so that 
> {{difference}} is only concerned with supplying the range, and dealing with 
> the {{FULLY_INCONSISTENT}} case, and move everything else into a recursable 
> helper method.
> I put together an alternate implementation 
> [here|https://github.com/bdeggleston/cassandra/tree/differencer-cleanup].



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to