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/07/23 15:56:11 UTC

[GitHub] [incubator-druid] leventov commented on a change in pull request #8114: Fix race between canHandle() and addSegment() in StorageLocation

leventov commented on a change in pull request #8114: Fix race between canHandle() and addSegment() in StorageLocation
URL: https://github.com/apache/incubator-druid/pull/8114#discussion_r306396261
 
 

 ##########
 File path: server/src/main/java/org/apache/druid/segment/loading/StorageLocation.java
 ##########
 @@ -19,28 +19,39 @@
 
 package org.apache.druid.segment.loading;
 
+import com.google.common.annotations.VisibleForTesting;
 import org.apache.commons.io.FileUtils;
-import org.apache.druid.java.util.common.ISE;
 import org.apache.druid.java.util.common.logger.Logger;
 import org.apache.druid.timeline.DataSegment;
+import org.apache.druid.timeline.SegmentId;
 
 import javax.annotation.Nullable;
 import java.io.File;
 import java.util.HashSet;
 import java.util.Set;
 
 /**
+ * This class is a very simple logical representation of a local path. It keeps track of files stored under the
+ * {@link #path} via {@link #reserve}, so that the total size of stored files doesn't exceed the {@link #maxSize} and
+ * available space is always kept smaller than {@link #freeSpaceToKeep}.
+ *
+ * This class is thread-safe, so that multiple threads can update its state at the same time.
+ * One example usage is that a historical can use multiple threads to load different segments in parallel
+ * from deep storage.
 */
 public class StorageLocation
 {
   private static final Logger log = new Logger(StorageLocation.class);
 
   private final File path;
-  private final long maxSize;
+  private final long maxSize; // in bytes
 
 Review comment:
   Can call this field `maxSizeBytes`

----------------------------------------------------------------
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