cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Petrov (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CASSANDRA-14869) Range.subtractContained produces incorrect results when used on full ring
Date Mon, 12 Nov 2018 10:02:00 GMT

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

Alex Petrov edited comment on CASSANDRA-14869 at 11/12/18 10:01 AM:
--------------------------------------------------------------------

Several remarks: 
  * I would extract [this check|https://github.com/Gerrrr/cassandra/commit/f92047ab378062e58d02d7f57e0694ba2e3c90a7#diff-b6aa8cb091f4de56555d650df9db6ca6R282]
to {{isFull}} method.
  * if you're already using {{return}} there's no need for {{else if}}
  * Maybe add tests for {{subtract}} also not only {{subtractAll}}
  * Make sure full range subtraction is covered, like {{range(0,0).subtract(range(1,1))}}
should be empty
  * Still mention of ArrayList [here|https://github.com/Gerrrr/cassandra/commit/f92047ab378062e58d02d7f57e0694ba2e3c90a7#diff-b6aa8cb091f4de56555d650df9db6ca6R277]


In summary, there are two cases that are broken right now: subtracting one full range from
another {{range(0,0).subtract(1,1)}} does not yield an empty range, and subtracting a non-wrapping
range from wrapping one: {{range(0,0).subtract(-1, 1)}} is yielding two ranges which wrap
incorrectly. Even though patch does fix both issues description does not fully elaborate on
issue and added if cases might use a small elaboration comment (same as issue description).


was (Author: ifesdjeen):
Several remarks: 
  * I would extract [this check|https://github.com/Gerrrr/cassandra/commit/f92047ab378062e58d02d7f57e0694ba2e3c90a7#diff-b6aa8cb091f4de56555d650df9db6ca6R282]
to {{isFull}} method.
  * if you're already using {{return}} there's no need for {{else if}}
  * Maybe add tests for {{subtract}} also not only {{subtractAll}}
  * Make sure full range subtraction is covered, like {{range(0,0).subtract(range(1,1))}}
should be empty
  * Still mention of ArrayList [here|https://github.com/Gerrrr/cassandra/commit/f92047ab378062e58d02d7f57e0694ba2e3c90a7#diff-b6aa8cb091f4de56555d650df9db6ca6R277]


> Range.subtractContained produces incorrect results when used on full ring
> -------------------------------------------------------------------------
>
>                 Key: CASSANDRA-14869
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-14869
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: Aleksandr Sorokoumov
>            Assignee: Aleksandr Sorokoumov
>            Priority: Major
>             Fix For: 3.0.x, 3.11.x, 4.0.x
>
>         Attachments: range bug.jpg
>
>
> The bug is in the way {{Range.subtractContained}} works if minuend range covers the
full ring and subtrahend range goes over 0 (see illustration). For example, {{(50, 50] - (10,
100]}} returns \{{{(50,10], (100,50]}}} instead of \{{(100,10]}}.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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


Mime
View raw message