You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2022/12/05 11:03:42 UTC

[accumulo] branch main updated: adds tablet id to compaction configurer and selector (#3088)

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

kturner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/main by this push:
     new ee4370ff7e adds tablet id to compaction configurer and selector (#3088)
ee4370ff7e is described below

commit ee4370ff7e2120142901979d3aeeba3869cbd586
Author: Keith Turner <kt...@apache.org>
AuthorDate: Mon Dec 5 11:03:35 2022 +0000

    adds tablet id to compaction configurer and selector (#3088)
---
 .../core/client/admin/compaction/CompactionConfigurer.java   |  7 +++++++
 .../core/client/admin/compaction/CompactionSelector.java     |  7 +++++++
 .../org/apache/accumulo/tserver/tablet/CompactableUtils.java | 12 ++++++++++++
 .../strategies/ConfigurableCompactionStrategyTest.java       |  6 ++++++
 4 files changed, 32 insertions(+)

diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/compaction/CompactionConfigurer.java b/core/src/main/java/org/apache/accumulo/core/client/admin/compaction/CompactionConfigurer.java
index 6a58704e54..6a7e48edd5 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/admin/compaction/CompactionConfigurer.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/admin/compaction/CompactionConfigurer.java
@@ -23,6 +23,7 @@ import java.util.Map;
 
 import org.apache.accumulo.core.client.PluginEnvironment;
 import org.apache.accumulo.core.data.TableId;
+import org.apache.accumulo.core.data.TabletId;
 
 /**
  * Enables dynamically overriding of per table properties used to create the output file for a
@@ -50,6 +51,12 @@ public interface CompactionConfigurer {
   public interface InputParameters {
     TableId getTableId();
 
+    /**
+     * @return the id of the tablet being compacted
+     * @since 3.0.0
+     */
+    TabletId getTabletId();
+
     public Collection<CompactableFile> getInputFiles();
 
     PluginEnvironment getEnvironment();
diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/compaction/CompactionSelector.java b/core/src/main/java/org/apache/accumulo/core/client/admin/compaction/CompactionSelector.java
index d54f612c16..281372d43d 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/admin/compaction/CompactionSelector.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/admin/compaction/CompactionSelector.java
@@ -30,6 +30,7 @@ import org.apache.accumulo.core.client.summary.SummarizerConfiguration;
 import org.apache.accumulo.core.client.summary.Summary;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.TableId;
+import org.apache.accumulo.core.data.TabletId;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
 
@@ -61,6 +62,12 @@ public interface CompactionSelector {
 
     TableId getTableId();
 
+    /**
+     * @return the tablet id of the tablet being compacted
+     * @since 3.0.0
+     */
+    TabletId getTabletId();
+
     Optional<SortedKeyValueIterator<Key,Value>> getSample(CompactableFile cf,
         SamplerConfiguration sc);
 
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactableUtils.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactableUtils.java
index 84b862f990..01cc399b85 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactableUtils.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactableUtils.java
@@ -52,8 +52,10 @@ import org.apache.accumulo.core.conf.ConfigurationTypeHelper;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.TableId;
+import org.apache.accumulo.core.data.TabletId;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.dataImpl.KeyExtent;
+import org.apache.accumulo.core.dataImpl.TabletIdImpl;
 import org.apache.accumulo.core.file.FileOperations;
 import org.apache.accumulo.core.file.FileSKVIterator;
 import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
@@ -262,6 +264,11 @@ public class CompactableUtils {
       public TableId getTableId() {
         return tablet.getExtent().tableId();
       }
+
+      @Override
+      public TabletId getTabletId() {
+        return new TabletIdImpl(tablet.getExtent());
+      }
     });
 
     if (overrides.getOverrides().isEmpty()) {
@@ -347,6 +354,11 @@ public class CompactableUtils {
         return tablet.getExtent().tableId();
       }
 
+      @Override
+      public TabletId getTabletId() {
+        return new TabletIdImpl(tablet.getExtent());
+      }
+
       @Override
       public Optional<SortedKeyValueIterator<Key,Value>> getSample(CompactableFile file,
           SamplerConfiguration sc) {
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/strategies/ConfigurableCompactionStrategyTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/strategies/ConfigurableCompactionStrategyTest.java
index 7567fbc815..90f6cdca08 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/strategies/ConfigurableCompactionStrategyTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/strategies/ConfigurableCompactionStrategyTest.java
@@ -36,6 +36,7 @@ import org.apache.accumulo.core.client.admin.compaction.CompactionConfigurer.Ove
 import org.apache.accumulo.core.compaction.CompactionSettings;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.TableId;
+import org.apache.accumulo.core.data.TabletId;
 import org.junit.jupiter.api.Test;
 
 public class ConfigurableCompactionStrategyTest {
@@ -80,6 +81,11 @@ public class ConfigurableCompactionStrategyTest {
         return null;
       }
 
+      @Override
+      public TabletId getTabletId() {
+        return null;
+      }
+
       @Override
       public Collection<CompactableFile> getInputFiles() {
         return files;