keith-turner commented on code in PR #5026:
URL: https://github.com/apache/accumulo/pull/5026#discussion_r1834790097


##########
core/src/main/java/org/apache/accumulo/core/util/compaction/CompactionJobPrioritizer.java:
##########
@@ -19,42 +19,120 @@
 package org.apache.accumulo.core.util.compaction;
 
 import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
 
+import org.apache.accumulo.core.clientImpl.Namespace;
+import org.apache.accumulo.core.data.NamespaceId;
+import org.apache.accumulo.core.data.TableId;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.RootTable;
 import org.apache.accumulo.core.spi.compaction.CompactionJob;
 import org.apache.accumulo.core.spi.compaction.CompactionKind;
+import org.apache.accumulo.core.util.Pair;
+
+import com.google.common.base.Preconditions;
 
 public class CompactionJobPrioritizer {
 
   public static final Comparator<CompactionJob> JOB_COMPARATOR =
       Comparator.comparingInt(CompactionJob::getPriority)
           .thenComparingInt(job -> job.getFiles().size()).reversed();
 
-  public static short createPriority(CompactionKind kind, int totalFiles, int 
compactingFiles) {
+  private static final Map<Pair<TableId,CompactionKind>,Pair<Short,Short>> 
SYSTEM_TABLE_RANGES =
+      new HashMap<>();
+  private static final Map<Pair<NamespaceId,CompactionKind>,
+      Pair<Short,Short>> ACCUMULO_NAMESPACE_RANGES = new HashMap<>();
+
+  // Create ranges of possible priority values where each range has
+  // 2000 possible values. Give higher priority to tables where
+  // they have more files than allowed, user compactions over system
+  // compactions, root table over metadata table, metadata table over
+  // other system tables and user tables.
+  private static final Short TABLE_OVER_SIZE_MAX = Short.MAX_VALUE;
+  private static final Short ROOT_TABLE_USER_MAX = Short.MAX_VALUE - 2001;
+  private static final Short ROOT_TABLE_SYSTEM_MAX = (short) 
(ROOT_TABLE_USER_MAX - 2001);
+  private static final Short META_TABLE_USER_MAX = (short) 
(ROOT_TABLE_SYSTEM_MAX - 2001);
+  private static final Short META_TABLE_SYSTEM_MAX = (short) 
(META_TABLE_USER_MAX - 2001);
+  private static final Short SYSTEM_NS_USER_MAX = (short) 
(META_TABLE_SYSTEM_MAX - 2001);
+  private static final Short SYSTEM_NS_SYSTEM_MAX = (short) 
(SYSTEM_NS_USER_MAX - 2001);
+  private static final Short USER_TABLE_USER_MAX = (short) 
(SYSTEM_NS_SYSTEM_MAX - 2001);
+  private static final Short USER_TABLE_SYSTEM_MAX = 0;
+
+  static final Pair<Short,Short> TABLE_OVER_SIZE =

Review Comment:
   The latest changes have getMinimum and getMaximum which is much easier to 
read.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to