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/04/20 16:44:41 UTC

[GitHub] [incubator-pinot] chenboat opened a new pull request #5277: [Part 2] Deepstore by-pass in LLC: introduce segment uploader for segment split commit.

chenboat opened a new pull request #5277:
URL: https://github.com/apache/incubator-pinot/pull/5277


   Refactor the current LLC code to introduce segment uploader. 
    (1) It allows segment upload to configurable locations during a split commit:
    (2) A controller vip uploader is refactored out which has the exactly same behavior as the current uploader.
   
   No behavior difference is expected from this refactoring -- a new BestEffortSegmentUploader will be added soon. 


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


[GitHub] [incubator-pinot] chenboat commented on a change in pull request #5277: [Part 2] Deepstore by-pass in LLC: introduce segment uploader for segment split commit.

Posted by GitBox <gi...@apache.org>.
chenboat commented on a change in pull request #5277:
URL: https://github.com/apache/incubator-pinot/pull/5277#discussion_r414126054



##########
File path: pinot-core/src/main/java/org/apache/pinot/core/util/SegmentCompletionProtocolUtils.java
##########
@@ -0,0 +1,103 @@
+/**
+ * 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.util;
+
+import java.io.File;
+import java.net.URI;
+import org.apache.pinot.common.metrics.ServerMeter;
+import org.apache.pinot.common.metrics.ServerMetrics;
+import org.apache.pinot.common.protocols.SegmentCompletionProtocol;
+import org.apache.pinot.common.utils.FileUploadDownloadClient;
+import org.apache.pinot.server.realtime.ControllerLeaderLocator;
+import org.slf4j.Logger;
+
+
+/**
+ * Util methods related to low level consumers' segment completion protocols. 
+ */
+public class SegmentCompletionProtocolUtils {
+  public static SegmentCompletionProtocol.Response uploadSegmentWithFileUploadDownloadClient(
+      FileUploadDownloadClient fileUploadDownloadClient, File segmentFile, String controllerVipUrl, String segmentName,
+      int segmentUploadRequestTimeoutMs, Logger logger) {
+    SegmentCompletionProtocol.Response response;
+    try {
+      String responseStr = fileUploadDownloadClient
+          .uploadSegment(new URI(controllerVipUrl), segmentName, segmentFile, null, null, segmentUploadRequestTimeoutMs)
+          .getResponse();
+      response = SegmentCompletionProtocol.Response.fromJsonString(responseStr);
+      logger.info("Controller response {} for {}", response.toJsonString(), controllerVipUrl);
+      if (response.getStatus().equals(SegmentCompletionProtocol.ControllerResponseStatus.NOT_LEADER)) {
+        ControllerLeaderLocator.getInstance().invalidateCachedControllerLeader();
+      }
+    } catch (Exception e) {
+      // Catch all exceptions, we want the protocol to handle the case assuming the request was never sent.
+      response = SegmentCompletionProtocol.RESP_NOT_SENT;
+      logger.error("Could not send request {}", controllerVipUrl, e);
+      // Invalidate controller leader cache, as exception could be because of leader being down (deployment/failure) and hence unable to send {@link SegmentCompletionProtocol.ControllerResponseStatus.NOT_LEADER}
+      // If cache is not invalidated, we will not recover from exceptions until the controller comes back up
+      ControllerLeaderLocator.getInstance().invalidateCachedControllerLeader();

Review comment:
       Done.

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/util/SegmentCompletionProtocolUtils.java
##########
@@ -0,0 +1,103 @@
+/**
+ * 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.util;
+
+import java.io.File;
+import java.net.URI;
+import org.apache.pinot.common.metrics.ServerMeter;
+import org.apache.pinot.common.metrics.ServerMetrics;
+import org.apache.pinot.common.protocols.SegmentCompletionProtocol;
+import org.apache.pinot.common.utils.FileUploadDownloadClient;
+import org.apache.pinot.server.realtime.ControllerLeaderLocator;
+import org.slf4j.Logger;
+
+
+/**
+ * Util methods related to low level consumers' segment completion protocols. 
+ */
+public class SegmentCompletionProtocolUtils {
+  public static SegmentCompletionProtocol.Response uploadSegmentWithFileUploadDownloadClient(
+      FileUploadDownloadClient fileUploadDownloadClient, File segmentFile, String controllerVipUrl, String segmentName,
+      int segmentUploadRequestTimeoutMs, Logger logger) {
+    SegmentCompletionProtocol.Response response;
+    try {
+      String responseStr = fileUploadDownloadClient
+          .uploadSegment(new URI(controllerVipUrl), segmentName, segmentFile, null, null, segmentUploadRequestTimeoutMs)
+          .getResponse();
+      response = SegmentCompletionProtocol.Response.fromJsonString(responseStr);
+      logger.info("Controller response {} for {}", response.toJsonString(), controllerVipUrl);
+      if (response.getStatus().equals(SegmentCompletionProtocol.ControllerResponseStatus.NOT_LEADER)) {
+        ControllerLeaderLocator.getInstance().invalidateCachedControllerLeader();

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:
users@infra.apache.org



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


[GitHub] [incubator-pinot] chenboat commented on a change in pull request #5277: [Part 2] Deepstore by-pass in LLC: introduce segment uploader for segment split commit.

Posted by GitBox <gi...@apache.org>.
chenboat commented on a change in pull request #5277:
URL: https://github.com/apache/incubator-pinot/pull/5277#discussion_r414126241



##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/ControllerVipBasedSegmentUploader.java
##########
@@ -0,0 +1,65 @@
+/**
+ * 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.realtime;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import org.apache.pinot.common.metrics.ServerMetrics;
+import org.apache.pinot.common.protocols.SegmentCompletionProtocol;
+import org.apache.pinot.common.utils.FileUploadDownloadClient;
+import org.apache.pinot.core.util.SegmentCompletionProtocolUtils;
+import org.slf4j.Logger;
+
+import static org.apache.pinot.common.protocols.SegmentCompletionProtocol.ControllerResponseStatus.UPLOAD_SUCCESS;
+
+
+// A segment uploader which uploads segments to the controller via the controller's segmentCommitUpload end point
+// point.
+public class ControllerVipBasedSegmentUploader implements SegmentUploader {

Review comment:
       Renamed.




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


[GitHub] [incubator-pinot] chenboat commented on a change in pull request #5277: [Part 2] Deepstore by-pass in LLC: introduce segment uploader for segment split commit.

Posted by GitBox <gi...@apache.org>.
chenboat commented on a change in pull request #5277:
URL: https://github.com/apache/incubator-pinot/pull/5277#discussion_r414216827



##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/Server2ControllerSegmentUploader.java
##########
@@ -0,0 +1,92 @@
+/**
+ * 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.realtime;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import org.apache.pinot.common.metrics.ServerMetrics;
+import org.apache.pinot.common.protocols.SegmentCompletionProtocol;
+import org.apache.pinot.common.utils.FileUploadDownloadClient;
+import org.apache.pinot.core.util.SegmentCompletionProtocolUtils;
+import org.apache.pinot.server.realtime.ControllerLeaderLocator;
+import org.slf4j.Logger;
+
+import static org.apache.pinot.common.protocols.SegmentCompletionProtocol.ControllerResponseStatus.UPLOAD_SUCCESS;

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:
users@infra.apache.org



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


[GitHub] [incubator-pinot] mcvsubbu commented on a change in pull request #5277: [Part 2] Deepstore by-pass in LLC: introduce segment uploader for segment split commit.

Posted by GitBox <gi...@apache.org>.
mcvsubbu commented on a change in pull request #5277:
URL: https://github.com/apache/incubator-pinot/pull/5277#discussion_r411585980



##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/SegmentUploader.java
##########
@@ -0,0 +1,26 @@
+/**
+ * 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.realtime;
+
+import java.io.File;
+
+
+public interface SegmentUploader {
+  SegmentUploadStatus segmentUpload(File segmentFile);

Review comment:
       ```suggestion
     SegmentUploadStatus uploadSegment(File segmentFile);
   ```

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/SegmentUploadStatus.java
##########
@@ -0,0 +1,47 @@
+/**
+ * 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.realtime;
+
+public class SegmentUploadStatus {
+  // True if and only if the upload is successful.
+  private boolean uploadSuccessful;

Review comment:
       ```suggestion
     private boolean _uploadSuccessful;
   ```

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/SegmentUploader.java
##########
@@ -0,0 +1,26 @@
+/**
+ * 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.realtime;
+
+import java.io.File;
+
+
+public interface SegmentUploader {
+  SegmentUploadStatus segmentUpload(File segmentFile);

Review comment:
       why not just return the URL here?

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/SegmentUploadStatus.java
##########
@@ -0,0 +1,47 @@
+/**
+ * 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.realtime;
+
+public class SegmentUploadStatus {
+  // True if and only if the upload is successful.
+  private boolean uploadSuccessful;
+  // Segment location uri string when the upload is successful.
+  private String segmentLocation;

Review comment:
       ```suggestion
     private String _segmentLocation;
   ```

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/ControllerVipBasedSegmentUploader.java
##########
@@ -0,0 +1,54 @@
+/**
+ * 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.realtime;
+
+import java.io.File;
+import org.apache.pinot.common.protocols.SegmentCompletionProtocol;
+import org.apache.pinot.server.realtime.ServerSegmentCompletionProtocolHandler;
+import org.slf4j.Logger;
+
+
+// A segment uploader which uploads segments to the controller via the controller's segmentCommitUpload end point
+// point.
+public class ControllerVipBasedSegmentUploader implements SegmentUploader {
+  private final SegmentCompletionProtocol.Request.Params _params;
+  private final ServerSegmentCompletionProtocolHandler _protocolHandler;
+  private final Logger _segmentLogger;
+  private final String _controllerVipUrl;
+
+  public ControllerVipBasedSegmentUploader(Logger segmentLogger, ServerSegmentCompletionProtocolHandler protocolHandler,
+      SegmentCompletionProtocol.Request.Params params, String controllerVipUrl) {
+    _segmentLogger = segmentLogger;
+    _protocolHandler = protocolHandler;
+    _params = params;
+    _controllerVipUrl = controllerVipUrl;
+  }
+
+  @Override
+  public SegmentUploadStatus segmentUpload(File segmentFile) {
+    SegmentCompletionProtocol.Response segmentCommitUploadResponse =
+        _protocolHandler.segmentCommitUpload(_params, segmentFile, _controllerVipUrl);

Review comment:
       you should not be using the protocol handler here. Instead, you need to introduce a method to upload the segment to contrller vip. Copy/paste protocolHandler.uploadSegment. Refactor the protocol handler to use this method. 

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/SegmentUploadStatus.java
##########
@@ -0,0 +1,47 @@
+/**
+ * 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.realtime;
+
+public class SegmentUploadStatus {

Review comment:
       You dont need this class. If return values turn out to be more complex, we can introduce a status class then




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


[GitHub] [incubator-pinot] chenboat commented on a change in pull request #5277: [Part 2] Deepstore by-pass in LLC: introduce segment uploader for segment split commit.

Posted by GitBox <gi...@apache.org>.
chenboat commented on a change in pull request #5277:
URL: https://github.com/apache/incubator-pinot/pull/5277#discussion_r414125969



##########
File path: pinot-core/src/main/java/org/apache/pinot/core/util/SegmentCompletionProtocolUtils.java
##########
@@ -0,0 +1,103 @@
+/**
+ * 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.util;
+
+import java.io.File;
+import java.net.URI;
+import org.apache.pinot.common.metrics.ServerMeter;
+import org.apache.pinot.common.metrics.ServerMetrics;
+import org.apache.pinot.common.protocols.SegmentCompletionProtocol;
+import org.apache.pinot.common.utils.FileUploadDownloadClient;
+import org.apache.pinot.server.realtime.ControllerLeaderLocator;
+import org.slf4j.Logger;
+
+
+/**
+ * Util methods related to low level consumers' segment completion protocols. 
+ */
+public class SegmentCompletionProtocolUtils {
+  public static SegmentCompletionProtocol.Response uploadSegmentWithFileUploadDownloadClient(

Review comment:
       Moved the method inside uploader.




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


[GitHub] [incubator-pinot] chenboat commented on a change in pull request #5277: [Part 2] Deepstore by-pass in LLC: introduce segment uploader for segment split commit.

Posted by GitBox <gi...@apache.org>.
chenboat commented on a change in pull request #5277:
URL: https://github.com/apache/incubator-pinot/pull/5277#discussion_r414216285



##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/Server2ControllerSegmentUploader.java
##########
@@ -0,0 +1,92 @@
+/**
+ * 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.realtime;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import org.apache.pinot.common.metrics.ServerMetrics;
+import org.apache.pinot.common.protocols.SegmentCompletionProtocol;
+import org.apache.pinot.common.utils.FileUploadDownloadClient;
+import org.apache.pinot.core.util.SegmentCompletionProtocolUtils;
+import org.apache.pinot.server.realtime.ControllerLeaderLocator;
+import org.slf4j.Logger;
+
+import static org.apache.pinot.common.protocols.SegmentCompletionProtocol.ControllerResponseStatus.UPLOAD_SUCCESS;
+
+
+// A segment uploader which uploads segments to the controller via the controller's segmentCommitUpload end point
+// point.

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:
users@infra.apache.org



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


[GitHub] [incubator-pinot] mcvsubbu commented on a change in pull request #5277: [Part 2] Deepstore by-pass in LLC: introduce segment uploader for segment split commit.

Posted by GitBox <gi...@apache.org>.
mcvsubbu commented on a change in pull request #5277:
URL: https://github.com/apache/incubator-pinot/pull/5277#discussion_r413185035



##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/SegmentUploader.java
##########
@@ -0,0 +1,30 @@
+/**
+ * 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.realtime;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+
+public interface SegmentUploader {
+  // Returns the URI of the uploaded segment. null if the upload fails.
+  URI uploadSegment(File segmentFile)
+      throws URISyntaxException;

Review comment:
       Why does this throw URISyntax exception? We are providing a File handle, it does not seem correct to let the upper layer handle the URI syntax failure. The uploader, when constructed, should verify the URIs right?

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/util/SegmentCompletionProtocolUtils.java
##########
@@ -0,0 +1,103 @@
+/**
+ * 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.util;
+
+import java.io.File;
+import java.net.URI;
+import org.apache.pinot.common.metrics.ServerMeter;
+import org.apache.pinot.common.metrics.ServerMetrics;
+import org.apache.pinot.common.protocols.SegmentCompletionProtocol;
+import org.apache.pinot.common.utils.FileUploadDownloadClient;
+import org.apache.pinot.server.realtime.ControllerLeaderLocator;
+import org.slf4j.Logger;
+
+
+/**
+ * Util methods related to low level consumers' segment completion protocols. 
+ */
+public class SegmentCompletionProtocolUtils {
+  public static SegmentCompletionProtocol.Response uploadSegmentWithFileUploadDownloadClient(

Review comment:
       can we just call this method `uploadSegment`? The file part is implied since the first argument is the `FileUploadDownloadClient`

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/util/SegmentCompletionProtocolUtils.java
##########
@@ -0,0 +1,103 @@
+/**
+ * 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.util;
+
+import java.io.File;
+import java.net.URI;
+import org.apache.pinot.common.metrics.ServerMeter;
+import org.apache.pinot.common.metrics.ServerMetrics;
+import org.apache.pinot.common.protocols.SegmentCompletionProtocol;
+import org.apache.pinot.common.utils.FileUploadDownloadClient;
+import org.apache.pinot.server.realtime.ControllerLeaderLocator;
+import org.slf4j.Logger;
+
+
+/**
+ * Util methods related to low level consumers' segment completion protocols. 
+ */
+public class SegmentCompletionProtocolUtils {
+  public static SegmentCompletionProtocol.Response uploadSegmentWithFileUploadDownloadClient(
+      FileUploadDownloadClient fileUploadDownloadClient, File segmentFile, String controllerVipUrl, String segmentName,
+      int segmentUploadRequestTimeoutMs, Logger logger) {
+    SegmentCompletionProtocol.Response response;
+    try {
+      String responseStr = fileUploadDownloadClient
+          .uploadSegment(new URI(controllerVipUrl), segmentName, segmentFile, null, null, segmentUploadRequestTimeoutMs)
+          .getResponse();
+      response = SegmentCompletionProtocol.Response.fromJsonString(responseStr);
+      logger.info("Controller response {} for {}", response.toJsonString(), controllerVipUrl);
+      if (response.getStatus().equals(SegmentCompletionProtocol.ControllerResponseStatus.NOT_LEADER)) {
+        ControllerLeaderLocator.getInstance().invalidateCachedControllerLeader();

Review comment:
       can this logic be moved to the ControllerVip Uploader?

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/util/SegmentCompletionProtocolUtils.java
##########
@@ -0,0 +1,103 @@
+/**
+ * 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.util;
+
+import java.io.File;
+import java.net.URI;
+import org.apache.pinot.common.metrics.ServerMeter;
+import org.apache.pinot.common.metrics.ServerMetrics;
+import org.apache.pinot.common.protocols.SegmentCompletionProtocol;
+import org.apache.pinot.common.utils.FileUploadDownloadClient;
+import org.apache.pinot.server.realtime.ControllerLeaderLocator;
+import org.slf4j.Logger;
+
+
+/**
+ * Util methods related to low level consumers' segment completion protocols. 
+ */
+public class SegmentCompletionProtocolUtils {
+  public static SegmentCompletionProtocol.Response uploadSegmentWithFileUploadDownloadClient(

Review comment:
       Or, maybe just inline the logic of this method inside the uploader. The logic for  a different uploader is going to be different anyway.

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/util/SegmentCompletionProtocolUtils.java
##########
@@ -0,0 +1,103 @@
+/**
+ * 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.util;
+
+import java.io.File;
+import java.net.URI;
+import org.apache.pinot.common.metrics.ServerMeter;
+import org.apache.pinot.common.metrics.ServerMetrics;
+import org.apache.pinot.common.protocols.SegmentCompletionProtocol;
+import org.apache.pinot.common.utils.FileUploadDownloadClient;
+import org.apache.pinot.server.realtime.ControllerLeaderLocator;
+import org.slf4j.Logger;
+
+
+/**
+ * Util methods related to low level consumers' segment completion protocols. 
+ */
+public class SegmentCompletionProtocolUtils {
+  public static SegmentCompletionProtocol.Response uploadSegmentWithFileUploadDownloadClient(
+      FileUploadDownloadClient fileUploadDownloadClient, File segmentFile, String controllerVipUrl, String segmentName,
+      int segmentUploadRequestTimeoutMs, Logger logger) {
+    SegmentCompletionProtocol.Response response;
+    try {
+      String responseStr = fileUploadDownloadClient
+          .uploadSegment(new URI(controllerVipUrl), segmentName, segmentFile, null, null, segmentUploadRequestTimeoutMs)
+          .getResponse();
+      response = SegmentCompletionProtocol.Response.fromJsonString(responseStr);
+      logger.info("Controller response {} for {}", response.toJsonString(), controllerVipUrl);
+      if (response.getStatus().equals(SegmentCompletionProtocol.ControllerResponseStatus.NOT_LEADER)) {
+        ControllerLeaderLocator.getInstance().invalidateCachedControllerLeader();
+      }
+    } catch (Exception e) {
+      // Catch all exceptions, we want the protocol to handle the case assuming the request was never sent.
+      response = SegmentCompletionProtocol.RESP_NOT_SENT;
+      logger.error("Could not send request {}", controllerVipUrl, e);
+      // Invalidate controller leader cache, as exception could be because of leader being down (deployment/failure) and hence unable to send {@link SegmentCompletionProtocol.ControllerResponseStatus.NOT_LEADER}
+      // If cache is not invalidated, we will not recover from exceptions until the controller comes back up
+      ControllerLeaderLocator.getInstance().invalidateCachedControllerLeader();

Review comment:
       Can this logic be moved into `ControllerVipBasedSegmentUploader`?

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/ControllerVipBasedSegmentUploader.java
##########
@@ -0,0 +1,65 @@
+/**
+ * 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.realtime;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import org.apache.pinot.common.metrics.ServerMetrics;
+import org.apache.pinot.common.protocols.SegmentCompletionProtocol;
+import org.apache.pinot.common.utils.FileUploadDownloadClient;
+import org.apache.pinot.core.util.SegmentCompletionProtocolUtils;
+import org.slf4j.Logger;
+
+import static org.apache.pinot.common.protocols.SegmentCompletionProtocol.ControllerResponseStatus.UPLOAD_SUCCESS;
+
+
+// A segment uploader which uploads segments to the controller via the controller's segmentCommitUpload end point
+// point.
+public class ControllerVipBasedSegmentUploader implements SegmentUploader {

Review comment:
       Maybe call it `Server2ControllerSegmentUploader`? I think we should omit Vip in the name, there is nothing in here that says we should go through vip

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/ControllerVipBasedSegmentUploader.java
##########
@@ -0,0 +1,65 @@
+/**
+ * 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.realtime;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import org.apache.pinot.common.metrics.ServerMetrics;
+import org.apache.pinot.common.protocols.SegmentCompletionProtocol;
+import org.apache.pinot.common.utils.FileUploadDownloadClient;
+import org.apache.pinot.core.util.SegmentCompletionProtocolUtils;
+import org.slf4j.Logger;
+
+import static org.apache.pinot.common.protocols.SegmentCompletionProtocol.ControllerResponseStatus.UPLOAD_SUCCESS;
+
+
+// A segment uploader which uploads segments to the controller via the controller's segmentCommitUpload end point
+// point.
+public class ControllerVipBasedSegmentUploader implements SegmentUploader {
+  private final Logger _segmentLogger;
+  private final String _controllerVipUrl;
+  private final FileUploadDownloadClient _fileUploadDownloadClient;
+  private final String _segmentName;
+  private final int _segmentUploadRequestTimeoutMs;
+  private final ServerMetrics _serverMetrics;
+
+  public ControllerVipBasedSegmentUploader(Logger segmentLogger, FileUploadDownloadClient fileUploadDownloadClient,
+      String controllerVipUrl, String segmentName, int segmentUploadRequestTimeoutMs, ServerMetrics serverMetrics) {
+    _segmentLogger = segmentLogger;
+    _fileUploadDownloadClient = fileUploadDownloadClient;
+    _controllerVipUrl = controllerVipUrl;
+    _segmentName = segmentName;

Review comment:
       Can construct URI here and throw exception if it fails




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


[GitHub] [incubator-pinot] codecov-io edited a comment on pull request #5277: [Part 2] Deepstore by-pass in LLC: introduce segment uploader for segment split commit.

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #5277:
URL: https://github.com/apache/incubator-pinot/pull/5277#issuecomment-617495300


   # [Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/5277?src=pr&el=h1) Report
   > Merging [#5277](https://codecov.io/gh/apache/incubator-pinot/pull/5277?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-pinot/commit/1f1baf85fb318caa48b3b207e032946ddd5de11c&el=desc) will **increase** coverage by `0.18%`.
   > The diff coverage is `75.30%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-pinot/pull/5277/graphs/tree.svg?width=650&height=150&src=pr&token=4ibza2ugkz)](https://codecov.io/gh/apache/incubator-pinot/pull/5277?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #5277      +/-   ##
   ============================================
   + Coverage     65.90%   66.09%   +0.18%     
   ============================================
     Files          1052     1069      +17     
     Lines         54170    54571     +401     
     Branches       8078     8131      +53     
   ============================================
   + Hits          35702    36068     +366     
   - Misses        15819    15869      +50     
   + Partials       2649     2634      -15     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-pinot/pull/5277?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...e/pinot/broker/api/resources/PinotBrokerDebug.java](https://codecov.io/gh/apache/incubator-pinot/pull/5277/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvYXBpL3Jlc291cmNlcy9QaW5vdEJyb2tlckRlYnVnLmphdmE=) | `76.66% <ø> (ø)` | `0.00 <0.00> (ø)` | |
   | [.../BrokerResourceOnlineOfflineStateModelFactory.java](https://codecov.io/gh/apache/incubator-pinot/pull/5277/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvYnJva2VyL2hlbGl4L0Jyb2tlclJlc291cmNlT25saW5lT2ZmbGluZVN0YXRlTW9kZWxGYWN0b3J5LmphdmE=) | `55.81% <ø> (ø)` | `0.00 <0.00> (ø)` | |
   | [.../pinot/broker/broker/helix/HelixBrokerStarter.java](https://codecov.io/gh/apache/incubator-pinot/pull/5277/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvYnJva2VyL2hlbGl4L0hlbGl4QnJva2VyU3RhcnRlci5qYXZh) | `71.97% <ø> (ø)` | `0.00 <0.00> (ø)` | |
   | [...thandler/SingleConnectionBrokerRequestHandler.java](https://codecov.io/gh/apache/incubator-pinot/pull/5277/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvcmVxdWVzdGhhbmRsZXIvU2luZ2xlQ29ubmVjdGlvbkJyb2tlclJlcXVlc3RIYW5kbGVyLmphdmE=) | `92.68% <ø> (ø)` | `0.00 <0.00> (ø)` | |
   | [...ting/instanceselector/InstanceSelectorFactory.java](https://codecov.io/gh/apache/incubator-pinot/pull/5277/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvcm91dGluZy9pbnN0YW5jZXNlbGVjdG9yL0luc3RhbmNlU2VsZWN0b3JGYWN0b3J5LmphdmE=) | `71.42% <ø> (ø)` | `0.00 <0.00> (ø)` | |
   | [...er/routing/segmentpruner/SegmentPrunerFactory.java](https://codecov.io/gh/apache/incubator-pinot/pull/5277/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvcm91dGluZy9zZWdtZW50cHJ1bmVyL1NlZ21lbnRQcnVuZXJGYWN0b3J5LmphdmE=) | `83.33% <ø> (ø)` | `0.00 <0.00> (ø)` | |
   | [...outing/segmentselector/SegmentSelectorFactory.java](https://codecov.io/gh/apache/incubator-pinot/pull/5277/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvcm91dGluZy9zZWdtZW50c2VsZWN0b3IvU2VnbWVudFNlbGVjdG9yRmFjdG9yeS5qYXZh) | `60.00% <ø> (ø)` | `0.00 <0.00> (ø)` | |
   | [...oker/routing/timeboundary/TimeBoundaryManager.java](https://codecov.io/gh/apache/incubator-pinot/pull/5277/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvcm91dGluZy90aW1lYm91bmRhcnkvVGltZUJvdW5kYXJ5TWFuYWdlci5qYXZh) | `87.50% <ø> (ø)` | `0.00 <0.00> (ø)` | |
   | [...mmon/assignment/InstanceAssignmentConfigUtils.java](https://codecov.io/gh/apache/incubator-pinot/pull/5277/diff?src=pr&el=tree#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vYXNzaWdubWVudC9JbnN0YW5jZUFzc2lnbm1lbnRDb25maWdVdGlscy5qYXZh) | `67.50% <ø> (ø)` | `0.00 <0.00> (?)` | |
   | [...not/common/assignment/InstancePartitionsUtils.java](https://codecov.io/gh/apache/incubator-pinot/pull/5277/diff?src=pr&el=tree#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vYXNzaWdubWVudC9JbnN0YW5jZVBhcnRpdGlvbnNVdGlscy5qYXZh) | `73.17% <ø> (ø)` | `0.00 <0.00> (ø)` | |
   | ... and [360 more](https://codecov.io/gh/apache/incubator-pinot/pull/5277/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/5277?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/5277?src=pr&el=footer). Last update [a8a0a75...45cf75d](https://codecov.io/gh/apache/incubator-pinot/pull/5277?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


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


[GitHub] [incubator-pinot] chenboat commented on a change in pull request #5277: [Part 2] Deepstore by-pass in LLC: introduce segment uploader for segment split commit.

Posted by GitBox <gi...@apache.org>.
chenboat commented on a change in pull request #5277:
URL: https://github.com/apache/incubator-pinot/pull/5277#discussion_r414126415



##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/ControllerVipBasedSegmentUploader.java
##########
@@ -0,0 +1,65 @@
+/**
+ * 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.realtime;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import org.apache.pinot.common.metrics.ServerMetrics;
+import org.apache.pinot.common.protocols.SegmentCompletionProtocol;
+import org.apache.pinot.common.utils.FileUploadDownloadClient;
+import org.apache.pinot.core.util.SegmentCompletionProtocolUtils;
+import org.slf4j.Logger;
+
+import static org.apache.pinot.common.protocols.SegmentCompletionProtocol.ControllerResponseStatus.UPLOAD_SUCCESS;
+
+
+// A segment uploader which uploads segments to the controller via the controller's segmentCommitUpload end point
+// point.
+public class ControllerVipBasedSegmentUploader implements SegmentUploader {
+  private final Logger _segmentLogger;
+  private final String _controllerVipUrl;
+  private final FileUploadDownloadClient _fileUploadDownloadClient;
+  private final String _segmentName;
+  private final int _segmentUploadRequestTimeoutMs;
+  private final ServerMetrics _serverMetrics;
+
+  public ControllerVipBasedSegmentUploader(Logger segmentLogger, FileUploadDownloadClient fileUploadDownloadClient,
+      String controllerVipUrl, String segmentName, int segmentUploadRequestTimeoutMs, ServerMetrics serverMetrics) {
+    _segmentLogger = segmentLogger;
+    _fileUploadDownloadClient = fileUploadDownloadClient;
+    _controllerVipUrl = controllerVipUrl;
+    _segmentName = segmentName;

Review comment:
       Done. Good point.




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


[GitHub] [incubator-pinot] chenboat commented on a change in pull request #5277: [Part 2] Deepstore by-pass in LLC: introduce segment uploader for segment split commit.

Posted by GitBox <gi...@apache.org>.
chenboat commented on a change in pull request #5277:
URL: https://github.com/apache/incubator-pinot/pull/5277#discussion_r414125612



##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/SegmentUploader.java
##########
@@ -0,0 +1,30 @@
+/**
+ * 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.realtime;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+
+public interface SegmentUploader {
+  // Returns the URI of the uploaded segment. null if the upload fails.
+  URI uploadSegment(File segmentFile)
+      throws URISyntaxException;

Review comment:
       Removed the exception.




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


[GitHub] [incubator-pinot] chenboat commented on a change in pull request #5277: [Part 2] Deepstore by-pass in LLC: introduce segment uploader for segment split commit.

Posted by GitBox <gi...@apache.org>.
chenboat commented on a change in pull request #5277:
URL: https://github.com/apache/incubator-pinot/pull/5277#discussion_r414221803



##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/Server2ControllerSegmentUploader.java
##########
@@ -0,0 +1,92 @@
+/**
+ * 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.realtime;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import org.apache.pinot.common.metrics.ServerMetrics;
+import org.apache.pinot.common.protocols.SegmentCompletionProtocol;
+import org.apache.pinot.common.utils.FileUploadDownloadClient;
+import org.apache.pinot.core.util.SegmentCompletionProtocolUtils;
+import org.apache.pinot.server.realtime.ControllerLeaderLocator;
+import org.slf4j.Logger;
+
+import static org.apache.pinot.common.protocols.SegmentCompletionProtocol.ControllerResponseStatus.UPLOAD_SUCCESS;
+
+
+// A segment uploader which uploads segments to the controller via the controller's segmentCommitUpload end point
+// point.
+public class Server2ControllerSegmentUploader implements SegmentUploader {
+  private final Logger _segmentLogger;
+  // The controller segment upload url.
+  private final String _controllerSegmentUploadCommitUrl;
+  private final FileUploadDownloadClient _fileUploadDownloadClient;
+  private final String _segmentName;
+  private final int _segmentUploadRequestTimeoutMs;
+  private final ServerMetrics _serverMetrics;
+
+  public Server2ControllerSegmentUploader(Logger segmentLogger, FileUploadDownloadClient fileUploadDownloadClient,
+      String controllerSegmentUploadCommitUrl, String segmentName, int segmentUploadRequestTimeoutMs,
+      ServerMetrics serverMetrics) {
+    _segmentLogger = segmentLogger;
+    _fileUploadDownloadClient = fileUploadDownloadClient;
+    _controllerSegmentUploadCommitUrl = controllerSegmentUploadCommitUrl;

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:
users@infra.apache.org



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


[GitHub] [incubator-pinot] chenboat commented on a change in pull request #5277: [Part 2] Deepstore by-pass in LLC: introduce segment uploader for segment split commit.

Posted by GitBox <gi...@apache.org>.
chenboat commented on a change in pull request #5277:
URL: https://github.com/apache/incubator-pinot/pull/5277#discussion_r412592261



##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/ControllerVipBasedSegmentUploader.java
##########
@@ -0,0 +1,54 @@
+/**
+ * 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.realtime;
+
+import java.io.File;
+import org.apache.pinot.common.protocols.SegmentCompletionProtocol;
+import org.apache.pinot.server.realtime.ServerSegmentCompletionProtocolHandler;
+import org.slf4j.Logger;
+
+
+// A segment uploader which uploads segments to the controller via the controller's segmentCommitUpload end point
+// point.
+public class ControllerVipBasedSegmentUploader implements SegmentUploader {
+  private final SegmentCompletionProtocol.Request.Params _params;
+  private final ServerSegmentCompletionProtocolHandler _protocolHandler;
+  private final Logger _segmentLogger;
+  private final String _controllerVipUrl;
+
+  public ControllerVipBasedSegmentUploader(Logger segmentLogger, ServerSegmentCompletionProtocolHandler protocolHandler,
+      SegmentCompletionProtocol.Request.Params params, String controllerVipUrl) {
+    _segmentLogger = segmentLogger;
+    _protocolHandler = protocolHandler;
+    _params = params;
+    _controllerVipUrl = controllerVipUrl;
+  }
+
+  @Override
+  public SegmentUploadStatus segmentUpload(File segmentFile) {
+    SegmentCompletionProtocol.Response segmentCommitUploadResponse =
+        _protocolHandler.segmentCommitUpload(_params, segmentFile, _controllerVipUrl);

Review comment:
       Done the refactoring. Please take a look.

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/SegmentUploadStatus.java
##########
@@ -0,0 +1,47 @@
+/**
+ * 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.realtime;
+
+public class SegmentUploadStatus {

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:
users@infra.apache.org



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


[GitHub] [incubator-pinot] codecov-io commented on issue #5277: [Part 2] Deepstore by-pass in LLC: introduce segment uploader for segment split commit.

Posted by GitBox <gi...@apache.org>.
codecov-io commented on issue #5277:
URL: https://github.com/apache/incubator-pinot/pull/5277#issuecomment-617495300


   # [Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/5277?src=pr&el=h1) Report
   > Merging [#5277](https://codecov.io/gh/apache/incubator-pinot/pull/5277?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-pinot/commit/1f1baf85fb318caa48b3b207e032946ddd5de11c&el=desc) will **decrease** coverage by `8.96%`.
   > The diff coverage is `61.97%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-pinot/pull/5277/graphs/tree.svg?width=650&height=150&src=pr&token=4ibza2ugkz)](https://codecov.io/gh/apache/incubator-pinot/pull/5277?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #5277      +/-   ##
   ============================================
   - Coverage     65.90%   56.93%   -8.97%     
   ============================================
     Files          1052     1069      +17     
     Lines         54170    54556     +386     
     Branches       8078     8129      +51     
   ============================================
   - Hits          35702    31064    -4638     
   - Misses        15819    21070    +5251     
   + Partials       2649     2422     -227     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-pinot/pull/5277?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...e/pinot/broker/api/resources/PinotBrokerDebug.java](https://codecov.io/gh/apache/incubator-pinot/pull/5277/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvYXBpL3Jlc291cmNlcy9QaW5vdEJyb2tlckRlYnVnLmphdmE=) | `0.00% <ø> (-76.67%)` | `0.00 <0.00> (ø)` | |
   | [...pinot/broker/api/resources/PinotClientRequest.java](https://codecov.io/gh/apache/incubator-pinot/pull/5277/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvYXBpL3Jlc291cmNlcy9QaW5vdENsaWVudFJlcXVlc3QuamF2YQ==) | `0.00% <0.00%> (-23.41%)` | `0.00 <0.00> (ø)` | |
   | [.../BrokerResourceOnlineOfflineStateModelFactory.java](https://codecov.io/gh/apache/incubator-pinot/pull/5277/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvYnJva2VyL2hlbGl4L0Jyb2tlclJlc291cmNlT25saW5lT2ZmbGluZVN0YXRlTW9kZWxGYWN0b3J5LmphdmE=) | `41.86% <ø> (-13.96%)` | `0.00 <0.00> (ø)` | |
   | [.../pinot/broker/broker/helix/HelixBrokerStarter.java](https://codecov.io/gh/apache/incubator-pinot/pull/5277/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvYnJva2VyL2hlbGl4L0hlbGl4QnJva2VyU3RhcnRlci5qYXZh) | `70.70% <ø> (-1.28%)` | `0.00 <0.00> (ø)` | |
   | [...thandler/SingleConnectionBrokerRequestHandler.java](https://codecov.io/gh/apache/incubator-pinot/pull/5277/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvcmVxdWVzdGhhbmRsZXIvU2luZ2xlQ29ubmVjdGlvbkJyb2tlclJlcXVlc3RIYW5kbGVyLmphdmE=) | `12.19% <ø> (-80.49%)` | `0.00 <0.00> (ø)` | |
   | [...ting/instanceselector/InstanceSelectorFactory.java](https://codecov.io/gh/apache/incubator-pinot/pull/5277/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvcm91dGluZy9pbnN0YW5jZXNlbGVjdG9yL0luc3RhbmNlU2VsZWN0b3JGYWN0b3J5LmphdmE=) | `71.42% <ø> (ø)` | `0.00 <0.00> (ø)` | |
   | [...er/routing/segmentpruner/SegmentPrunerFactory.java](https://codecov.io/gh/apache/incubator-pinot/pull/5277/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvcm91dGluZy9zZWdtZW50cHJ1bmVyL1NlZ21lbnRQcnVuZXJGYWN0b3J5LmphdmE=) | `83.33% <ø> (ø)` | `0.00 <0.00> (ø)` | |
   | [...outing/segmentselector/SegmentSelectorFactory.java](https://codecov.io/gh/apache/incubator-pinot/pull/5277/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvcm91dGluZy9zZWdtZW50c2VsZWN0b3IvU2VnbWVudFNlbGVjdG9yRmFjdG9yeS5qYXZh) | `60.00% <ø> (ø)` | `0.00 <0.00> (ø)` | |
   | [...oker/routing/timeboundary/TimeBoundaryManager.java](https://codecov.io/gh/apache/incubator-pinot/pull/5277/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvcm91dGluZy90aW1lYm91bmRhcnkvVGltZUJvdW5kYXJ5TWFuYWdlci5qYXZh) | `87.50% <ø> (ø)` | `0.00 <0.00> (ø)` | |
   | [...mmon/assignment/InstanceAssignmentConfigUtils.java](https://codecov.io/gh/apache/incubator-pinot/pull/5277/diff?src=pr&el=tree#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vYXNzaWdubWVudC9JbnN0YW5jZUFzc2lnbm1lbnRDb25maWdVdGlscy5qYXZh) | `67.50% <ø> (ø)` | `0.00 <0.00> (?)` | |
   | ... and [602 more](https://codecov.io/gh/apache/incubator-pinot/pull/5277/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/5277?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/5277?src=pr&el=footer). Last update [a8a0a75...30830a9](https://codecov.io/gh/apache/incubator-pinot/pull/5277?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


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


[GitHub] [incubator-pinot] mcvsubbu commented on a change in pull request #5277: [Part 2] Deepstore by-pass in LLC: introduce segment uploader for segment split commit.

Posted by GitBox <gi...@apache.org>.
mcvsubbu commented on a change in pull request #5277:
URL: https://github.com/apache/incubator-pinot/pull/5277#discussion_r414200501



##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/Server2ControllerSegmentUploader.java
##########
@@ -0,0 +1,92 @@
+/**
+ * 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.realtime;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import org.apache.pinot.common.metrics.ServerMetrics;
+import org.apache.pinot.common.protocols.SegmentCompletionProtocol;
+import org.apache.pinot.common.utils.FileUploadDownloadClient;
+import org.apache.pinot.core.util.SegmentCompletionProtocolUtils;
+import org.apache.pinot.server.realtime.ControllerLeaderLocator;
+import org.slf4j.Logger;
+
+import static org.apache.pinot.common.protocols.SegmentCompletionProtocol.ControllerResponseStatus.UPLOAD_SUCCESS;
+
+
+// A segment uploader which uploads segments to the controller via the controller's segmentCommitUpload end point
+// point.

Review comment:
       remove this line

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/Server2ControllerSegmentUploader.java
##########
@@ -0,0 +1,92 @@
+/**
+ * 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.realtime;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import org.apache.pinot.common.metrics.ServerMetrics;
+import org.apache.pinot.common.protocols.SegmentCompletionProtocol;
+import org.apache.pinot.common.utils.FileUploadDownloadClient;
+import org.apache.pinot.core.util.SegmentCompletionProtocolUtils;
+import org.apache.pinot.server.realtime.ControllerLeaderLocator;
+import org.slf4j.Logger;
+
+import static org.apache.pinot.common.protocols.SegmentCompletionProtocol.ControllerResponseStatus.UPLOAD_SUCCESS;

Review comment:
       can we avoid the static import please

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/Server2ControllerSegmentUploader.java
##########
@@ -0,0 +1,92 @@
+/**
+ * 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.realtime;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import org.apache.pinot.common.metrics.ServerMetrics;
+import org.apache.pinot.common.protocols.SegmentCompletionProtocol;
+import org.apache.pinot.common.utils.FileUploadDownloadClient;
+import org.apache.pinot.core.util.SegmentCompletionProtocolUtils;
+import org.apache.pinot.server.realtime.ControllerLeaderLocator;
+import org.slf4j.Logger;
+
+import static org.apache.pinot.common.protocols.SegmentCompletionProtocol.ControllerResponseStatus.UPLOAD_SUCCESS;
+
+
+// A segment uploader which uploads segments to the controller via the controller's segmentCommitUpload end point
+// point.
+public class Server2ControllerSegmentUploader implements SegmentUploader {
+  private final Logger _segmentLogger;
+  // The controller segment upload url.
+  private final String _controllerSegmentUploadCommitUrl;
+  private final FileUploadDownloadClient _fileUploadDownloadClient;
+  private final String _segmentName;
+  private final int _segmentUploadRequestTimeoutMs;
+  private final ServerMetrics _serverMetrics;
+
+  public Server2ControllerSegmentUploader(Logger segmentLogger, FileUploadDownloadClient fileUploadDownloadClient,
+      String controllerSegmentUploadCommitUrl, String segmentName, int segmentUploadRequestTimeoutMs,
+      ServerMetrics serverMetrics) {
+    _segmentLogger = segmentLogger;
+    _fileUploadDownloadClient = fileUploadDownloadClient;
+    _controllerSegmentUploadCommitUrl = controllerSegmentUploadCommitUrl;

Review comment:
       Please parse the URI here and save it as a member, throw exception if URI does not parse.




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


[GitHub] [incubator-pinot] mcvsubbu commented on a change in pull request #5277: [Part 2] Deepstore by-pass in LLC: introduce segment uploader for segment split commit.

Posted by GitBox <gi...@apache.org>.
mcvsubbu commented on a change in pull request #5277:
URL: https://github.com/apache/incubator-pinot/pull/5277#discussion_r414698216



##########
File path: pinot-core/src/main/java/org/apache/pinot/server/realtime/ServerSegmentCompletionProtocolHandler.java
##########
@@ -131,7 +140,15 @@ public ServerSegmentCompletionProtocolHandler(ServerMetrics serverMetrics, Strin
       return SegmentCompletionProtocol.RESP_NOT_SENT;
     }
 
-    return uploadSegment(url, params.getSegmentName(), segmentTarFile);
+    Server2ControllerSegmentUploader segmentUploader= null;
+    try {
+      segmentUploader = new Server2ControllerSegmentUploader(LOGGER,

Review comment:
       I looked up the code, and it seems that we sanitize the url returned by the controller, but then we pass strings around. We need to clean this up, but it can be in a later PR.




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