jihoonson 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_r306573933
##########
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
private final long freeSpaceToKeep;
+
+ // Set of files stored under the given path. All accesses must be
synchronized with currSize.
Review comment:
Done.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]