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/05/05 23:32:56 UTC

[GitHub] [incubator-pinot] mcvsubbu commented on a change in pull request #5336: [Part 4] Deep-store bypass for LLC: Add a peer to peer segment fetcher.

mcvsubbu commented on a change in pull request #5336:
URL: https://github.com/apache/incubator-pinot/pull/5336#discussion_r420452949



##########
File path: pinot-common/src/main/java/org/apache/pinot/common/utils/fetcher/PeerServerSegmentFetcher.java
##########
@@ -0,0 +1,149 @@
+/**
+ * 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.common.utils.fetcher;
+
+import java.io.File;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import org.apache.commons.configuration.Configuration;
+import org.apache.helix.HelixAdmin;
+import org.apache.helix.HelixManager;
+import org.apache.helix.model.ExternalView;
+import org.apache.helix.model.InstanceConfig;
+import org.apache.pinot.common.utils.CommonConstants;
+import org.apache.pinot.common.utils.LLCSegmentName;
+import org.apache.pinot.common.utils.StringUtil;
+import org.apache.pinot.common.utils.helix.HelixHelper;
+import org.apache.pinot.spi.config.table.TableType;
+import org.apache.pinot.spi.plugin.PluginManager;
+import org.apache.pinot.spi.utils.builder.TableNameBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * This segment fetcher downloads the segment by first discovering the server having the segment through external view
+ * of a Pinot table and then downloading the segment from the peer server using a configured http or https fetcher. By
+ * default, HttpSegmentFetcher is used.
+ * The format fo expected segment address uri is
+ *    server:///segment_name
+ * Note the host component is empty.
+ * To use this segment fetcher, servers need to put "server" in their segment fetcher protocol.
+ */
+public class PeerServerSegmentFetcher extends BaseSegmentFetcher {
+  private static final Logger LOGGER = LoggerFactory.getLogger(PeerServerSegmentFetcher.class);
+  private static final String PEER_2_PEER_PROTOCOL = "server";
+  private static final String DOWNLOADER_CLASS = ".downloader.class";
+  private HelixManager _helixManager;
+  private String _helixClusterName;
+  private HttpSegmentFetcher _httpSegmentFetcher;
+
+  public PeerServerSegmentFetcher(Configuration config, HelixManager helixManager, String helixClusterName) {
+    _helixManager = helixManager;
+    _helixClusterName = helixClusterName;
+    String segmentDownloaderClass = config.getString(PEER_2_PEER_PROTOCOL + DOWNLOADER_CLASS);

Review comment:
       nit: I would declare the DOWNLOADER_CLASS without the starting dot, and add the intermediate dot here.

##########
File path: pinot-common/src/main/java/org/apache/pinot/common/utils/fetcher/PeerServerSegmentFetcher.java
##########
@@ -0,0 +1,149 @@
+/**
+ * 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.common.utils.fetcher;
+
+import java.io.File;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import org.apache.commons.configuration.Configuration;
+import org.apache.helix.HelixAdmin;
+import org.apache.helix.HelixManager;
+import org.apache.helix.model.ExternalView;
+import org.apache.helix.model.InstanceConfig;
+import org.apache.pinot.common.utils.CommonConstants;
+import org.apache.pinot.common.utils.LLCSegmentName;
+import org.apache.pinot.common.utils.StringUtil;
+import org.apache.pinot.common.utils.helix.HelixHelper;
+import org.apache.pinot.spi.config.table.TableType;
+import org.apache.pinot.spi.plugin.PluginManager;
+import org.apache.pinot.spi.utils.builder.TableNameBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * This segment fetcher downloads the segment by first discovering the server having the segment through external view
+ * of a Pinot table and then downloading the segment from the peer server using a configured http or https fetcher. By
+ * default, HttpSegmentFetcher is used.
+ * The format fo expected segment address uri is
+ *    server:///segment_name
+ * Note the host component is empty.
+ * To use this segment fetcher, servers need to put "server" in their segment fetcher protocol.
+ */
+public class PeerServerSegmentFetcher extends BaseSegmentFetcher {
+  private static final Logger LOGGER = LoggerFactory.getLogger(PeerServerSegmentFetcher.class);

Review comment:
       We dont need this logger right? We can use `_logger` ?

##########
File path: pinot-common/src/main/java/org/apache/pinot/common/utils/fetcher/PeerServerSegmentFetcher.java
##########
@@ -0,0 +1,149 @@
+/**
+ * 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.common.utils.fetcher;
+
+import java.io.File;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import org.apache.commons.configuration.Configuration;
+import org.apache.helix.HelixAdmin;
+import org.apache.helix.HelixManager;
+import org.apache.helix.model.ExternalView;
+import org.apache.helix.model.InstanceConfig;
+import org.apache.pinot.common.utils.CommonConstants;
+import org.apache.pinot.common.utils.LLCSegmentName;
+import org.apache.pinot.common.utils.StringUtil;
+import org.apache.pinot.common.utils.helix.HelixHelper;
+import org.apache.pinot.spi.config.table.TableType;
+import org.apache.pinot.spi.plugin.PluginManager;
+import org.apache.pinot.spi.utils.builder.TableNameBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * This segment fetcher downloads the segment by first discovering the server having the segment through external view
+ * of a Pinot table and then downloading the segment from the peer server using a configured http or https fetcher. By
+ * default, HttpSegmentFetcher is used.
+ * The format fo expected segment address uri is
+ *    server:///segment_name
+ * Note the host component is empty.
+ * To use this segment fetcher, servers need to put "server" in their segment fetcher protocol.
+ */
+public class PeerServerSegmentFetcher extends BaseSegmentFetcher {
+  private static final Logger LOGGER = LoggerFactory.getLogger(PeerServerSegmentFetcher.class);
+  private static final String PEER_2_PEER_PROTOCOL = "server";
+  private static final String DOWNLOADER_CLASS = ".downloader.class";
+  private HelixManager _helixManager;
+  private String _helixClusterName;
+  private HttpSegmentFetcher _httpSegmentFetcher;
+
+  public PeerServerSegmentFetcher(Configuration config, HelixManager helixManager, String helixClusterName) {
+    _helixManager = helixManager;
+    _helixClusterName = helixClusterName;
+    String segmentDownloaderClass = config.getString(PEER_2_PEER_PROTOCOL + DOWNLOADER_CLASS);
+    try {
+      _httpSegmentFetcher = PluginManager.get().createInstance(segmentDownloaderClass);

Review comment:
       So, essentially we are saying that it can either be http or https segment fetcher (or some other class that extends from these), right? We need to get the config story right. Can we configure just the scheme and construct the rest of the url here and initialize the right fetcher? Do you anticipate any other class than these two being used?




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