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

mayanks pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 55b4ddc  Change default segment load mode to MMAP. (#5539)
55b4ddc is described below

commit 55b4ddc04319578cb47741e6ed181bbdaa138533
Author: Mayank Shrivastava <maya...@apache.org>
AuthorDate: Thu Jun 11 09:57:48 2020 -0700

    Change default segment load mode to MMAP. (#5539)
    
    The load mode for segments currently defaults to `heap`. This PR
    changes the load-mode to default to `mmap` instead. This is for
    two reasons:
    
    1. We have been primarly using and recommending `mmap` mode, so no
       reason why the default should be `heap`.
    2. Heap mode can lead to OOMs.
    
    Also added a log message upon successful loading of segments along
    with the load mode. This was because, in absence of the log message,
    we see the following misleading message:
    
    ```
            Instance Data Dir: ....
            Instance Segment Tar Dir: ....
            Bootstrap Segment Dir: null
            Read Mode: heap
    ```
---
 .../src/main/java/org/apache/pinot/common/segment/ReadMode.java  | 9 +++++++++
 .../main/java/org/apache/pinot/common/utils/CommonConstants.java | 2 +-
 .../core/indexsegment/immutable/ImmutableSegmentLoader.java      | 5 ++++-
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git 
a/pinot-common/src/main/java/org/apache/pinot/common/segment/ReadMode.java 
b/pinot-common/src/main/java/org/apache/pinot/common/segment/ReadMode.java
index 37252eb..e71904f 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/segment/ReadMode.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/segment/ReadMode.java
@@ -21,6 +21,15 @@ package org.apache.pinot.common.segment;
 import org.apache.pinot.common.utils.CommonConstants;
 
 
+/**
+ * Enum class for segment read mode:
+ * <ul>
+ *   <li> heap: Segments are loaded on direct-memory. Note, 'heap' here is a 
legacy misnomer, and it does not
+ *        imply JVM heap. This mode should only be used when we want faster 
performance than memory-mapped files,
+ *        and are also sure that we will never run into OOM. </li>
+ *   <li> mmap: Segments are loaded on memory-mapped file. This is the default 
mode. </li>
+ * </ul>
+ */
 public enum ReadMode {
   heap, mmap;
 
diff --git 
a/pinot-common/src/main/java/org/apache/pinot/common/utils/CommonConstants.java 
b/pinot-common/src/main/java/org/apache/pinot/common/utils/CommonConstants.java
index bff81f4..24c1267 100644
--- 
a/pinot-common/src/main/java/org/apache/pinot/common/utils/CommonConstants.java
+++ 
b/pinot-common/src/main/java/org/apache/pinot/common/utils/CommonConstants.java
@@ -191,7 +191,7 @@ public class CommonConstants {
     public static final int 
DEFAULT_STARTUP_REALTIME_CONSUMPTION_CATCHUP_WAIT_MS = 0;
 
     public static final int DEFAULT_ADMIN_API_PORT = 8097;
-    public static final String DEFAULT_READ_MODE = "heap";
+    public static final String DEFAULT_READ_MODE = "mmap";
     // Whether to reload consuming segment on scheme update. Will change 
default behavior to true when this feature is stabilized
     public static final boolean DEFAULT_RELOAD_CONSUMING_SEGMENT = false;
     public static final String DEFAULT_INSTANCE_BASE_DIR =
diff --git 
a/pinot-core/src/main/java/org/apache/pinot/core/indexsegment/immutable/ImmutableSegmentLoader.java
 
b/pinot-core/src/main/java/org/apache/pinot/core/indexsegment/immutable/ImmutableSegmentLoader.java
index 41e9c89..6ddaaa5 100644
--- 
a/pinot-core/src/main/java/org/apache/pinot/core/indexsegment/immutable/ImmutableSegmentLoader.java
+++ 
b/pinot-core/src/main/java/org/apache/pinot/core/indexsegment/immutable/ImmutableSegmentLoader.java
@@ -138,6 +138,9 @@ public class ImmutableSegmentLoader {
               indexContainerMap, readMode);
     }
 
-    return new ImmutableSegmentImpl(segmentDirectory, segmentMetadata, 
indexContainerMap, starTreeIndexContainer);
+    ImmutableSegmentImpl segment =
+        new ImmutableSegmentImpl(segmentDirectory, segmentMetadata, 
indexContainerMap, starTreeIndexContainer);
+    LOGGER.info("Successfully loaded segment {} with readMode: {}", 
segmentName, readMode);
+    return segment;
   }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to