You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2020/11/10 03:24:08 UTC

[GitHub] [incubator-pinot] Jackie-Jiang commented on a change in pull request #6250: Add server configuration to lazy load files from deep storage.

Jackie-Jiang commented on a change in pull request #6250:
URL: https://github.com/apache/incubator-pinot/pull/6250#discussion_r520249550



##########
File path: pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java
##########
@@ -379,6 +382,16 @@ public BrokerResponse handleRequest(JsonNode request, @Nullable RequesterIdentit
       return new BrokerResponseNative(QueryException.getException(QueryException.BROKER_TIMEOUT_ERROR, errorMessage));
     }
 
+    // Validate the request
+    try {
+      validateNumSegments(offlineRoutingTable, realtimeRoutingTable, _querySegmentLimit);

Review comment:
       Skip the validation when `_querySegmentLimit` is `Integer.MAX_VALUE` to prevent this overhead for default settings

##########
File path: pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java
##########
@@ -436,6 +449,17 @@ public BrokerResponse handleRequest(JsonNode request, @Nullable RequesterIdentit
     return brokerResponse;
   }
 
+  private void validateNumSegments(Map<ServerInstance, List<String>> offlineRoutingTable,
+      Map<ServerInstance, List<String>> realtimeRoutingTable, int querySegmentLimit) {
+    int numOffline = offlineRoutingTable == null ? 0 : offlineRoutingTable.values().stream().mapToInt(List::size).sum();

Review comment:
       Avoid using stream api for performance concern

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/recordtransformer/DataTypeTransformer.java
##########
@@ -109,7 +115,11 @@ public GenericRow transform(GenericRow record) {
         }
       }
       if (source != dest) {
-        value = dest.convert(value, source);
+        try {
+          value = dest.convert(value, source);
+        } catch (Exception e) {
+          throw new DataTypeConversionException(column, source, dest, e);

Review comment:
       Can we make this a separate PR? +1 on adding more information into the exception message, but maybe throwing `RuntimeException` to avoid the interface change?

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/SegmentDataManager.java
##########
@@ -62,6 +62,14 @@ public synchronized boolean decreaseReferenceCount() {
     }
   }
 
+  /**
+   * Indicates whether this segment is physically in memory or downloaded to disc.
+   * @return
+   */
+  public boolean hasLocalData() {

Review comment:
       `false` indicates the segment is downloaded to disc but not loaded into memory?

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/OfflineSegmentFetcherAndLoader.java
##########
@@ -16,64 +16,164 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.pinot.server.starter.helix;
+package org.apache.pinot.core.data.manager;
 
+import com.google.common.base.Preconditions;
 import java.io.File;
 import java.util.UUID;
+import java.util.concurrent.Semaphore;
 import java.util.concurrent.locks.Lock;
-
 import javax.annotation.Nullable;
-
 import org.apache.commons.io.FileUtils;
+import org.apache.helix.ZNRecord;
+import org.apache.helix.store.zk.ZkHelixPropertyStore;
 import org.apache.pinot.common.Utils;
 import org.apache.pinot.common.metadata.ZKMetadataProvider;
 import org.apache.pinot.common.metadata.segment.OfflineSegmentZKMetadata;
+import org.apache.pinot.common.metrics.ServerGauge;
 import org.apache.pinot.common.metrics.ServerMeter;
 import org.apache.pinot.common.metrics.ServerMetrics;
 import org.apache.pinot.common.utils.CommonConstants;
 import org.apache.pinot.common.utils.TarGzCompressionUtils;
 import org.apache.pinot.common.utils.fetcher.SegmentFetcherFactory;
-import org.apache.pinot.core.data.manager.InstanceDataManager;
+import org.apache.pinot.core.indexsegment.immutable.ImmutableSegment;
+import org.apache.pinot.core.indexsegment.immutable.ImmutableSegmentLoader;
+import org.apache.pinot.core.segment.index.loader.IndexLoadingConfig;
 import org.apache.pinot.core.segment.index.loader.LoaderUtils;
 import org.apache.pinot.core.segment.index.loader.V3RemoveIndexException;
 import org.apache.pinot.core.segment.index.metadata.SegmentMetadata;
 import org.apache.pinot.core.segment.index.metadata.SegmentMetadataImpl;
 import org.apache.pinot.spi.crypt.PinotCrypter;
 import org.apache.pinot.spi.crypt.PinotCrypterFactory;
+import org.apache.pinot.spi.data.Schema;
 import org.apache.pinot.spi.env.PinotConfiguration;
 import org.apache.pinot.spi.filesystem.PinotFSFactory;
 import org.apache.pinot.spi.utils.retry.AttemptsExceededException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Preconditions;
-
 
-public class SegmentFetcherAndLoader {
-  private static final Logger LOGGER = LoggerFactory.getLogger(SegmentFetcherAndLoader.class);
+public class OfflineSegmentFetcherAndLoader {

Review comment:
       Let's not rename this class? Segment fetcher and loader always fetches immutable segments. The segments are categorized into immutable and mutable (real-time consuming). We don't necessarily specify the type of segment to fetch as mutable segment cannot be fetched

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/offline/OfflineSegmentDataManager.java
##########
@@ -0,0 +1,116 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.core.data.manager.offline;
+
+import javax.annotation.Nullable;
+import org.apache.pinot.core.data.manager.OfflineSegmentFetcherAndLoader;
+import org.apache.pinot.core.data.manager.SegmentDataManager;
+import org.apache.pinot.core.indexsegment.immutable.ImmutableSegment;
+import org.apache.pinot.core.segment.index.loader.IndexLoadingConfig;
+
+
+/**
+ * Segment data manager for immutable segment.
+ */
+public class OfflineSegmentDataManager extends SegmentDataManager {

Review comment:
       This class should be merged into `ImmutableSegmentDataManager`

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/ImmutableSegmentDataManager.java
##########
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.pinot.core.data.manager.offline;
+package org.apache.pinot.core.data.manager.realtime;

Review comment:
       Immutable segment is for both OFFLINE table and completed segment of real-time table. We should not put it under real-time package

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/BaseTableDataManager.java
##########
@@ -32,7 +32,7 @@
 import org.apache.pinot.common.metrics.ServerMeter;
 import org.apache.pinot.common.metrics.ServerMetrics;
 import org.apache.pinot.core.data.manager.config.TableDataManagerConfig;
-import org.apache.pinot.core.data.manager.offline.ImmutableSegmentDataManager;
+import org.apache.pinot.core.data.manager.realtime.ImmutableSegmentDataManager;

Review comment:
       Why realtime?

##########
File path: pinot-spi/src/main/java/org/apache/pinot/spi/data/readers/BaseRecordExtractor.java
##########
@@ -187,6 +189,10 @@ protected Object convertSingleValue(Object value) {
     if (value instanceof Number || value instanceof byte[]) {
       return value;
     }
+    if (value instanceof GenericData.Fixed) {

Review comment:
       This is unrelated




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



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