[
https://issues.apache.org/jira/browse/CASSANDRA-17575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17570030#comment-17570030
]
Andres de la Peña commented on CASSANDRA-17575:
-----------------------------------------------
Ok, it seems that the problem is that {{CompactionManager.sstablesInBounds}}
does't correctly use the half-open token intervals to select the sstable closed
intervals,
[here|https://github.com/apache/cassandra/blob/ab9ab903fa590409251e97fe075e02a64c8aa4f3/src/java/org/apache/cassandra/db/compaction/CompactionManager.java#L982]
and
[here|https://github.com/apache/cassandra/blob/ab9ab903fa590409251e97fe075e02a64c8aa4f3/src/java/org/apache/cassandra/db/compaction/CompactionManager.java#L991].
That indeed translates the token range {{(32, 31]}} to a selection of {{{}[32,
31]{}}}, which means the entire token range.
Also, the test uses the range {{(32, 32]}} to compact only the sstables
containing the token {{{}32{}}}. That incidentally works because the range is
somehow translated to {{{}[32, 32]{}}}. However, I think that the meaning of
{{(32, 32]}} is that it's a wrapping range that selects all the tokens. So the
way of compacting just the token {{32}} should be using the previous token, as
in {{{}(31, 32]{}}}. This is suggested by [this
comment|https://github.com/apache/cassandra/blob/ab9ab903fa590409251e97fe075e02a64c8aa4f3/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java#L446].
Note that currently {{nodetool compact -st 32 -et 32}} compacts only the token
{{{}32{}}}. If we fix {{CompactionManager.sstablesInBounds}} to properly
interpret the token ranges, that command would change to compact the entire
ring, which is dramatically different.
The proposed patch modifies the behaviour of
{{CompactionManager.sstablesInBounds}} to properly interpret token ranges. It
accordingly changes the expectations of
{{{}LeveledCompactionStrategyTest#testTokenRangeCompaction{}}}. I have also
updated the help of {{nodetool compact}} to document when a token is inclusive
or exclusive, similarly to what was done in CASSANDRA-15545. Maybe we should
also add a note on {{{}NEWS.txt{}}}.
||PR||CI||
|[3.11
|https://github.com/apache/cassandra/pull/1742]|[j8|https://app.circleci.com/pipelines/github/adelapena/cassandra/1948/workflows/65b64c73-adb0-4fb7-bf7d-e3fdce9577f4]|
|[4.0
|https://github.com/apache/cassandra/pull/1743]|[j8|https://app.circleci.com/pipelines/github/adelapena/cassandra/1947/workflows/8ad79cc7-2656-4afb-917b-9fd890418995]
[j11|https://app.circleci.com/pipelines/github/adelapena/cassandra/1947/workflows/e775dd2f-5733-4b1c-8e11-3970daafe7c6]|
|[4.1
|https://github.com/apache/cassandra/pull/1744]|[j8|https://app.circleci.com/pipelines/github/adelapena/cassandra/1946/workflows/71fc99c5-994d-4133-bf4f-57aa712c6542]
[j11|https://app.circleci.com/pipelines/github/adelapena/cassandra/1946/workflows/49d782ac-e162-419b-bd3e-a5f3086d474c]|
|[trunk|https://github.com/apache/cassandra/pull/1745]|[j8|https://app.circleci.com/pipelines/github/adelapena/cassandra/1945/workflows/3ae3bcec-301e-440d-a55f-20b99890c57b]
[j11|https://app.circleci.com/pipelines/github/adelapena/cassandra/1945/workflows/716c2a1f-8eea-4fb9-9109-278d74e1b276]|
An alternative approach would be just preserving the current behaviour and add
documentation about how the token ranges used in manual compaction are
interpreted as closed. That would have the problem doing an odd use of the
{{Range}} class across the codebase, and been inconsistent with other tools
such as repair.
> forceCompactionForTokenRange when using a wrapped range may include sstables
> not within that range
> --------------------------------------------------------------------------------------------------
>
> Key: CASSANDRA-17575
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17575
> Project: Cassandra
> Issue Type: Bug
> Components: Local/Compaction
> Reporter: David Capwell
> Assignee: Andres de la Peña
> Priority: Normal
> Fix For: 4.1-beta, 4.1.x
>
>
> This was found in CASSANDRA-17537
> When you compact the range (32, 31] this should include everything BUT 32,
> but in the test
> org.apache.cassandra.db.compaction.LeveledCompactionStrategyTest#testTokenRangeCompaction
> it found that SSTables with the bounds (32, 32) were getting included in the
> set of SSTables to compact
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]