You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/03/29 01:01:29 UTC

[GitHub] [incubator-druid] jon-wei commented on a change in pull request #7368: maxTotalRows should be checked in DataSourceCompactionConfig before setting targetCompactionSizeBytes

jon-wei commented on a change in pull request #7368: maxTotalRows should be checked in DataSourceCompactionConfig before setting targetCompactionSizeBytes
URL: https://github.com/apache/incubator-druid/pull/7368#discussion_r270251320
 
 

 ##########
 File path: server/src/main/java/org/apache/druid/server/coordinator/DataSourceCompactionConfig.java
 ##########
 @@ -104,6 +100,43 @@ public DataSourceCompactionConfig(
     );
   }
 
+  /**
+   * Copied from CompactionTask#getValidTargetCompactionSizeBytes.
+   * Must be synced.
+   */
+  @Nullable
+  private static Long getValidTargetCompactionSizeBytes(
+      @Nullable Long targetCompactionSizeBytes,
+      @Nullable Integer maxRowsPerSegment,
+      @Nullable UserCompactTuningConfig tuningConfig
+  )
+  {
+    if (targetCompactionSizeBytes != null) {
+      Preconditions.checkArgument(
+          !hasPartitionConfig(maxRowsPerSegment, tuningConfig),
+          "targetCompactionSizeBytes[%s] cannot be used with maxRowsPerSegment[%s] and maxTotalRows[%s]",
+          targetCompactionSizeBytes,
+          maxRowsPerSegment,
+          tuningConfig == null ? null : tuningConfig.getMaxTotalRows()
+      );
+      return targetCompactionSizeBytes;
+    } else {
+      return hasPartitionConfig(maxRowsPerSegment, tuningConfig) ? null : DEFAULT_TARGET_COMPACTION_SIZE_BYTES;
+    }
+  }
+
+  /**
+   * Copied from CompactionTask#hasPartitionConfig.
+   * Must be synced.
 
 Review comment:
   Can you add a comment here and elsewhere explaining why it's copied and has to be synced?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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