This is an automated email from the ASF dual-hosted git repository.

adelapena pushed a commit to branch cassandra-4.1
in repository https://gitbox.apache.org/repos/asf/cassandra.git

commit 16be1ab073f6fac7df1ac838c7a89e862cf9f2e1
Merge: f5dc9a1c1e 174e0dc399
Author: Andrés de la Peña <[email protected]>
AuthorDate: Fri Aug 12 10:31:30 2022 +0100

    Merge branch 'cassandra-4.0' into cassandra-4.1

 CHANGES.txt                                        |  1 +
 .../cassandra/db/ColumnFamilyStoreMBean.java       | 12 +++++-
 .../cassandra/db/compaction/CompactionManager.java | 19 +++++++++-
 .../cassandra/service/StorageServiceMBean.java     |  8 +++-
 src/java/org/apache/cassandra/tools/NodeProbe.java |  8 ++++
 .../apache/cassandra/tools/nodetool/Compact.java   |  4 +-
 .../compaction/LeveledCompactionStrategyTest.java  | 44 +++++++++-------------
 7 files changed, 63 insertions(+), 33 deletions(-)

diff --cc CHANGES.txt
index 861a6f5358,be711d5c70..04d861d284
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -45,7 -6,8 +45,8 @@@ Merged from 4.0
   * Clean up ScheduledExecutors, CommitLog, and MessagingService shutdown for 
in-JVM dtests (CASSANDRA-17731)
   * Remove extra write to system table for prepared statements 
(CASSANDRA-17764)
  Merged from 3.11:
+  * Document usage of closed token intervals in manual compaction 
(CASSANDRA-17575)
 + * Creating of a keyspace on insufficient number of replicas should filter 
out gosspping-only members (CASSANDRA-17759)
  Merged from 3.0:
   * Fix restarting of services on gossipping-only member (CASSANDRA-17752)
  
diff --cc src/java/org/apache/cassandra/db/ColumnFamilyStoreMBean.java
index 5b6fd16fe1,59d1d5deac..de7c933e0c
--- a/src/java/org/apache/cassandra/db/ColumnFamilyStoreMBean.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilyStoreMBean.java
@@@ -52,17 -51,14 +52,25 @@@ public interface ColumnFamilyStoreMBea
      public void forceMajorCompaction(boolean splitOutput) throws 
ExecutionException, InterruptedException;
  
      /**
-      * force a major compaction of specified key range in this column family
+      * Forces a major compaction of specified token ranges in this column 
family.
+      * <p>
+      * The token ranges will be interpreted as closed intervals to match the 
closed interval defined by the first and
+      * last keys of a sstable, even though the {@link Range} class is 
suppossed to be half-open by definition.
+      *
+      * @param tokenRanges The token ranges to be compacted, interpreted as 
closed intervals.
       */
 +    @BreaksJMX("This API was released in 3.10 using a parameter that takes 
Range of Token, which can only be done IFF client has Cassandra binaries in the 
classpath")
 +    @Deprecated
      public void forceCompactionForTokenRange(Collection<Range<Token>> 
tokenRanges) throws ExecutionException, InterruptedException;
 +
 +    /**
-      * force a major compaction of specified key range in this column family
++     * Forces a major compaction of specified token ranges in this column 
family.
++     * <p>
++     * The token ranges will be interpreted as closed intervals to match the 
closed interval defined by the first and
++     * last keys of a sstable, even though the {@link Range} class is 
suppossed to be half-open by definition.
 +     */
 +    public void forceCompactionForTokenRanges(String... tokenRanges);
 +
      /**
       * Gets the minimum number of sstables in queue before compaction kicks 
off
       */
diff --cc src/java/org/apache/cassandra/db/compaction/CompactionManager.java
index 925d900ada,799eed3d0d..c601f39c55
--- a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
@@@ -976,11 -933,12 +976,28 @@@ public class CompactionManager implemen
          }
      }
  
++    /**
++     * Forces a major compaction of specified token ranges of the specified 
column family.
++     * <p>
++     * The token ranges will be interpreted as closed intervals to match the 
closed interval defined by the first and
++     * last keys of a sstable, even though the {@link Range} class is 
suppossed to be half-open by definition.
++     *
++     * @param cfStore The column family store to be compacted.
++     * @param ranges The token ranges to be compacted, interpreted as closed 
intervals.
++     */
 +    public void forceCompactionForTokenRange(ColumnFamilyStore cfStore, 
Collection<Range<Token>> ranges)
 +    {
-         forceCompaction(cfStore, () -> sstablesInBounds(cfStore, ranges), 
(sstable) -> new Bounds<>(sstable.first.getToken(), 
sstable.last.getToken()).intersects(ranges));
++        forceCompaction(cfStore,
++                        () -> sstablesInBounds(cfStore, ranges),
++                        sstable -> new Bounds<>(sstable.first.getToken(), 
sstable.last.getToken()).intersects(ranges));
 +    }
 +
+     /**
+      * Returns the sstables of the specified column family store that 
intersect with the specified token ranges.
+      * <p>
+      * The token ranges will be interpreted as closed intervals to match the 
closed interval defined by the first and
+      * last keys of a sstable, even though the {@link Range} class is 
suppossed to be half-open by definition.
+      */
      private static Collection<SSTableReader> 
sstablesInBounds(ColumnFamilyStore cfs, Collection<Range<Token>> 
tokenRangeCollection)
      {
          final Set<SSTableReader> sstables = new HashSet<>();
diff --cc src/java/org/apache/cassandra/tools/nodetool/Compact.java
index 23a8fb9d89,bf7f5f32fc..f5a83ed904
--- a/src/java/org/apache/cassandra/tools/nodetool/Compact.java
+++ b/src/java/org/apache/cassandra/tools/nodetool/Compact.java
@@@ -41,15 -41,12 +41,15 @@@ public class Compact extends NodeToolCm
      @Option(title = "user-defined", name = {"--user-defined"}, description = 
"Use --user-defined to submit listed files for user-defined compaction")
      private boolean userDefined = false;
  
-     @Option(title = "start_token", name = {"-st", "--start-token"}, 
description = "Use -st to specify a token at which the compaction range starts")
+     @Option(title = "start_token", name = {"-st", "--start-token"}, 
description = "Use -st to specify a token at which the compaction range starts 
(inclusive)")
      private String startToken = EMPTY;
  
-     @Option(title = "end_token", name = {"-et", "--end-token"}, description = 
"Use -et to specify a token at which compaction range ends")
+     @Option(title = "end_token", name = {"-et", "--end-token"}, description = 
"Use -et to specify a token at which compaction range ends (inclusive)")
      private String endToken = EMPTY;
  
 +    @Option(title = "partition_key", name = {"--partition"}, description = 
"String representation of the partition key")
 +    private String partitionKey = EMPTY;
 +
  
      @Override
      public void execute(NodeProbe probe)
diff --cc 
test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
index 4b9b527017,88ddb0b0c7..07a45e7803
--- 
a/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
+++ 
b/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
@@@ -30,7 -30,7 +30,6 @@@ import java.util.List
  import java.util.Map;
  import java.util.Random;
  import java.util.Set;
--import java.util.UUID;
  import java.util.stream.Collectors;
  
  import com.google.common.collect.Iterables;
@@@ -57,21 -57,17 +56,19 @@@ import org.apache.cassandra.io.sstable.
  import org.apache.cassandra.io.sstable.format.SSTableReader;
  import org.apache.cassandra.notifications.SSTableAddedNotification;
  import org.apache.cassandra.notifications.SSTableRepairStatusChanged;
 -import org.apache.cassandra.repair.RepairJobDesc;
  import org.apache.cassandra.repair.ValidationManager;
 +import org.apache.cassandra.repair.state.ValidationState;
 +import org.apache.cassandra.schema.MockSchema;
 +import org.apache.cassandra.streaming.PreviewKind;
 +import org.apache.cassandra.repair.RepairJobDesc;
- import org.apache.cassandra.repair.ValidationManager;
  import org.apache.cassandra.repair.Validator;
  import org.apache.cassandra.schema.CompactionParams;
  import org.apache.cassandra.schema.KeyspaceParams;
--import org.apache.cassandra.schema.MockSchema;
  import org.apache.cassandra.service.ActiveRepairService;
--import org.apache.cassandra.streaming.PreviewKind;
  import org.apache.cassandra.utils.FBUtilities;
  import org.apache.cassandra.utils.Pair;
 +import org.apache.cassandra.utils.TimeUUID;
+ import org.awaitility.Awaitility;
  
  import static java.util.Collections.singleton;
  import static org.assertj.core.api.Assertions.assertThat;


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

Reply via email to