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

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


The following commit(s) were added to refs/heads/master by this push:
     new 5e05b9cf062 Make segment-replace timeouts and endReplaceSegments 
convergence wait configurable (#19278)
5e05b9cf062 is described below

commit 5e05b9cf062e1ae04aac65bc8f7a594f37709810
Author: Shounak kulkarni <[email protected]>
AuthorDate: Mon Sep 7 11:45:11 2026 +0530

    Make segment-replace timeouts and endReplaceSegments convergence wait 
configurable (#19278)
    
    Expose the previously hard-coded socket/convergence timeouts on the minion
    segment-replace path as configuration, with backward-compatible defaults:
    
    - Controller: the endReplaceSegments IdealState -> ExternalView convergence
      wait, poll interval, and retry-attempt count are now read from controller
      config (controller.segment.replace.externalViewMaxWaitMs /
      .externalViewCheckIntervalMs / .maxRetryAttempts), defaulting to the prior
      hard-coded 10min / 1s / 5.
    - Minion: the startReplaceSegments and segment-upload socket timeouts are 
now
      configurable (pinot.minion.startReplaceSegments.timeoutMs and the
      segmentUploadRequestTimeoutMs task config); the endReplaceSegments timeout
      was already configurable.
    - HttpClient.sendRequest now sets an explicit connection-request (pool
      checkout) timeout instead of silently inheriting the Apache HttpClient
      default.
    
    Co-authored-by: Claude Opus 4.8 <[email protected]>
---
 .../apache/pinot/common/utils/http/HttpClient.java | 10 +++++++-
 .../apache/pinot/controller/ControllerConf.java    | 27 ++++++++++++++++++++++
 .../helix/core/PinotHelixResourceManager.java      | 25 ++++++++++++++++----
 .../pinot/controller/ControllerConfTest.java       | 24 +++++++++++++++++++
 .../apache/pinot/core/common/MinionConstants.java  |  4 ++++
 .../java/org/apache/pinot/minion/MinionConf.java   |  6 +++++
 .../org/apache/pinot/minion/MinionConfTest.java    | 14 +++++++++++
 .../BaseMultipleSegmentsConversionExecutor.java    |  3 ++-
 .../minion/tasks/SegmentConversionUtils.java       | 17 ++++++++++++--
 9 files changed, 122 insertions(+), 8 deletions(-)

diff --git 
a/pinot-common/src/main/java/org/apache/pinot/common/utils/http/HttpClient.java 
b/pinot-common/src/main/java/org/apache/pinot/common/utils/http/HttpClient.java
index 71feba034d0..5ed05f1d334 100644
--- 
a/pinot-common/src/main/java/org/apache/pinot/common/utils/http/HttpClient.java
+++ 
b/pinot-common/src/main/java/org/apache/pinot/common/utils/http/HttpClient.java
@@ -278,8 +278,16 @@ public class HttpClient implements AutoCloseable {
   public SimpleHttpResponse sendRequest(ClassicHttpRequest request, long 
socketTimeoutMs)
       throws IOException {
 
+    // Besides the per-request response (socket) timeout, explicitly bound the 
connection-request
+    // (pool checkout) wait instead of silently inheriting the Apache 
HttpClient default, so a
+    // saturated connection pool cannot block a replace/upload request 
unboundedly. The TCP connect
+    // timeout is applied at the connection-manager level and is tunable via
+    // http.client.connectionTimeoutMs (see HttpClientConfig).
     RequestConfig requestConfig =
-        
RequestConfig.custom().setResponseTimeout(Timeout.ofMilliseconds(socketTimeoutMs)).build();
+        RequestConfig.custom()
+            .setResponseTimeout(Timeout.ofMilliseconds(socketTimeoutMs))
+            
.setConnectionRequestTimeout(Timeout.ofMilliseconds(DEFAULT_CONNECTION_REQUEST_TIMEOUT_MS))
+            .build();
     HttpClientContext clientContext = HttpClientContext.create();
     clientContext.setRequestConfig(requestConfig);
 
diff --git 
a/pinot-controller/src/main/java/org/apache/pinot/controller/ControllerConf.java
 
b/pinot-controller/src/main/java/org/apache/pinot/controller/ControllerConf.java
index 747068a72fd..7cd5e737399 100644
--- 
a/pinot-controller/src/main/java/org/apache/pinot/controller/ControllerConf.java
+++ 
b/pinot-controller/src/main/java/org/apache/pinot/controller/ControllerConf.java
@@ -35,6 +35,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.helix.controller.rebalancer.strategy.AutoRebalanceStrategy;
 import org.apache.pinot.common.protocols.SegmentCompletionProtocol;
 import org.apache.pinot.common.restlet.resources.RebalanceConfig;
+import org.apache.pinot.controller.helix.core.PinotHelixResourceManager;
 import org.apache.pinot.spi.config.table.DisasterRecoveryMode;
 import org.apache.pinot.spi.env.PinotConfiguration;
 import org.apache.pinot.spi.filesystem.LocalPinotFS;
@@ -459,6 +460,18 @@ public class ControllerConf extends PinotConfiguration {
   public static final String CONFIG_OF_MAX_RELOAD_SEGMENT_JOBS_IN_ZK = 
"controller.reload.segment.maxJobsInZK";
   public static final String CONFIG_OF_MAX_FORCE_COMMIT_JOBS_IN_ZK = 
"controller.force.commit.maxJobsInZK";
 
+  // Knobs governing how long endReplaceSegments blocks while waiting for the 
new segments to become
+  // ONLINE in the ExternalView (IdealState -> ExternalView convergence). The 
per-attempt wait is
+  // retried up to the configured number of attempts, so the worst-case block 
is
+  // maxWaitMs * maxRetryAttempts. Defaults preserve the historical hard-coded 
values.
+  public static final String 
CONFIG_OF_SEGMENT_REPLACE_EXTERNAL_VIEW_MAX_WAIT_MS =
+      "controller.segment.replace.externalViewMaxWaitMs";
+  public static final String 
CONFIG_OF_SEGMENT_REPLACE_EXTERNAL_VIEW_CHECK_INTERVAL_MS =
+      "controller.segment.replace.externalViewCheckIntervalMs";
+  public static final String CONFIG_OF_SEGMENT_REPLACE_MAX_RETRY_ATTEMPTS =
+      "controller.segment.replace.maxRetryAttempts";
+  public static final int DEFAULT_SEGMENT_REPLACE_MAX_RETRY_ATTEMPTS = 5;
+
   private final Map<String, String> _invalidConfigs = new 
ConcurrentHashMap<>();
 
   public ControllerConf() {
@@ -1600,6 +1613,20 @@ public class ControllerConf extends PinotConfiguration {
     return getProperty(CONFIG_OF_MAX_FORCE_COMMIT_JOBS_IN_ZK, 
ControllerJob.DEFAULT_MAXIMUM_CONTROLLER_JOBS_IN_ZK);
   }
 
+  public long getSegmentReplaceExternalViewMaxWaitMs() {
+    return getProperty(CONFIG_OF_SEGMENT_REPLACE_EXTERNAL_VIEW_MAX_WAIT_MS,
+        PinotHelixResourceManager.EXTERNAL_VIEW_ONLINE_SEGMENTS_MAX_WAIT_MS);
+  }
+
+  public long getSegmentReplaceExternalViewCheckIntervalMs() {
+    return 
getProperty(CONFIG_OF_SEGMENT_REPLACE_EXTERNAL_VIEW_CHECK_INTERVAL_MS,
+        PinotHelixResourceManager.EXTERNAL_VIEW_CHECK_INTERVAL_MS);
+  }
+
+  public int getSegmentReplaceMaxRetryAttempts() {
+    return getProperty(CONFIG_OF_SEGMENT_REPLACE_MAX_RETRY_ATTEMPTS, 
DEFAULT_SEGMENT_REPLACE_MAX_RETRY_ATTEMPTS);
+  }
+
   /// Get the configured timeseries languages from controller configuration.
   /// @return List of enabled timeseries languages
   public List<String> getTimeseriesLanguages() {
diff --git 
a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
 
b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
index 06af564d024..2b2192ec0c4 100644
--- 
a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
+++ 
b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
@@ -226,7 +226,9 @@ public class PinotHelixResourceManager {
     START, END, REVERT
   }
 
-  // TODO: make this configurable
+  // Default values for the endReplaceSegments IdealState -> ExternalView 
convergence wait,
+  // overridable via controller config (see 
ControllerConf#getSegmentReplaceExternalView*). The
+  // resolved values live in the _segmentReplace* / 
_endReplaceSegmentsRetryPolicy fields.
   public static final long EXTERNAL_VIEW_ONLINE_SEGMENTS_MAX_WAIT_MS = 10 * 
60_000L; // 10 minutes
   public static final long EXTERNAL_VIEW_CHECK_INTERVAL_MS = 1_000L; // 1 
second
 
@@ -247,6 +249,11 @@ public class PinotHelixResourceManager {
   @Nullable
   private final ControllerConf _controllerConf;
   private final AuthProvider _serverAdminAuthProvider;
+  // endReplaceSegments IdealState -> ExternalView convergence knobs, resolved 
once from controller
+  // config (or the static defaults when no config is supplied).
+  private final long _segmentReplaceExternalViewMaxWaitMs;
+  private final long _segmentReplaceExternalViewCheckIntervalMs;
+  private final RetryPolicy _endReplaceSegmentsRetryPolicy;
 
   private HelixManager _helixZkManager;
   private HelixAdmin _helixAdmin;
@@ -279,6 +286,16 @@ public class PinotHelixResourceManager {
     _controllerConf = controllerConf;
     _serverAdminAuthProvider =
         AuthProviderUtils.extractAuthProvider(controllerConf, 
ControllerConf.CONTROLLER_SERVER_ADMIN_AUTH_PREFIX);
+    if (controllerConf != null) {
+      _segmentReplaceExternalViewMaxWaitMs = 
controllerConf.getSegmentReplaceExternalViewMaxWaitMs();
+      _segmentReplaceExternalViewCheckIntervalMs = 
controllerConf.getSegmentReplaceExternalViewCheckIntervalMs();
+      _endReplaceSegmentsRetryPolicy =
+          
RetryPolicies.exponentialBackoffRetryPolicy(controllerConf.getSegmentReplaceMaxRetryAttempts(),
 1000L, 2.0f);
+    } else {
+      _segmentReplaceExternalViewMaxWaitMs = 
EXTERNAL_VIEW_ONLINE_SEGMENTS_MAX_WAIT_MS;
+      _segmentReplaceExternalViewCheckIntervalMs = 
EXTERNAL_VIEW_CHECK_INTERVAL_MS;
+      _endReplaceSegmentsRetryPolicy = DEFAULT_RETRY_POLICY;
+    }
     _instanceAdminEndpointCache =
         
CacheBuilder.newBuilder().expireAfterWrite(CACHE_ENTRY_EXPIRE_TIME_HOURS, 
TimeUnit.HOURS)
             .build(new CacheLoader<>() {
@@ -4557,7 +4574,7 @@ public class PinotHelixResourceManager {
     long endReplaceSegmentsTs = System.currentTimeMillis();
     int attemptCount;
     try {
-      attemptCount = DEFAULT_RETRY_POLICY.attempt(() -> {
+      attemptCount = _endReplaceSegmentsRetryPolicy.attempt(() -> {
         long endReplaceSegmentsTsForAttempt = System.currentTimeMillis();
         // Fetch the segment lineage and look up the lineage entry based on 
the entry id.
         SegmentLineage segmentLineage = 
SegmentLineageAccessHelper.getSegmentLineage(_propertyStore, tableNameWithType);
@@ -4856,7 +4873,7 @@ public class PinotHelixResourceManager {
 
   private boolean waitForSegmentsBecomeOnline(String tableNameWithType, 
List<String> segmentsToCheck)
       throws InterruptedException {
-    long endTimeMs = System.currentTimeMillis() + 
EXTERNAL_VIEW_ONLINE_SEGMENTS_MAX_WAIT_MS;
+    long endTimeMs = System.currentTimeMillis() + 
_segmentReplaceExternalViewMaxWaitMs;
     String segmentNotOnline;
     do {
       segmentNotOnline = null;
@@ -4870,7 +4887,7 @@ public class PinotHelixResourceManager {
       if (segmentNotOnline == null) {
         return true;
       }
-      Thread.sleep(EXTERNAL_VIEW_CHECK_INTERVAL_MS);
+      Thread.sleep(_segmentReplaceExternalViewCheckIntervalMs);
     } while (System.currentTimeMillis() < endTimeMs);
     LOGGER.warn("Timed out while waiting for segment: {} to become ONLINE for 
table: {}", segmentNotOnline,
         tableNameWithType);
diff --git 
a/pinot-controller/src/test/java/org/apache/pinot/controller/ControllerConfTest.java
 
b/pinot-controller/src/test/java/org/apache/pinot/controller/ControllerConfTest.java
index 31e516ed3df..ab61aa277c4 100644
--- 
a/pinot-controller/src/test/java/org/apache/pinot/controller/ControllerConfTest.java
+++ 
b/pinot-controller/src/test/java/org/apache/pinot/controller/ControllerConfTest.java
@@ -24,6 +24,7 @@ import java.util.Map;
 import java.util.Random;
 import java.util.concurrent.TimeUnit;
 import org.apache.pinot.common.restlet.resources.RebalanceConfig;
+import org.apache.pinot.controller.helix.core.PinotHelixResourceManager;
 import org.apache.pinot.spi.config.table.DisasterRecoveryMode;
 import org.apache.pinot.spi.utils.Enablement;
 import org.apache.pinot.spi.utils.TimeUtils;
@@ -252,4 +253,27 @@ public class ControllerConfTest {
     
controllerConf.setProperty(ControllerConf.INGEST_FROM_URI_ALLOW_LOCAL_FILE_SYSTEM,
 true);
     Assert.assertTrue(controllerConf.isIngestFromUriLocalFileSystemAllowed());
   }
+
+  @Test
+  public void testSegmentReplaceConvergenceDefaults() {
+    ControllerConf conf = new ControllerConf();
+    Assert.assertEquals(conf.getSegmentReplaceExternalViewMaxWaitMs(),
+        PinotHelixResourceManager.EXTERNAL_VIEW_ONLINE_SEGMENTS_MAX_WAIT_MS);
+    Assert.assertEquals(conf.getSegmentReplaceExternalViewCheckIntervalMs(),
+        PinotHelixResourceManager.EXTERNAL_VIEW_CHECK_INTERVAL_MS);
+    Assert.assertEquals(conf.getSegmentReplaceMaxRetryAttempts(),
+        ControllerConf.DEFAULT_SEGMENT_REPLACE_MAX_RETRY_ATTEMPTS);
+  }
+
+  @Test
+  public void testSegmentReplaceConvergenceCustomValues() {
+    ControllerConf conf = new ControllerConf();
+    
conf.setProperty(ControllerConf.CONFIG_OF_SEGMENT_REPLACE_EXTERNAL_VIEW_MAX_WAIT_MS,
 45 * 60_000L);
+    
conf.setProperty(ControllerConf.CONFIG_OF_SEGMENT_REPLACE_EXTERNAL_VIEW_CHECK_INTERVAL_MS,
 500L);
+    
conf.setProperty(ControllerConf.CONFIG_OF_SEGMENT_REPLACE_MAX_RETRY_ATTEMPTS, 
2);
+
+    Assert.assertEquals(conf.getSegmentReplaceExternalViewMaxWaitMs(), 45 * 
60_000L);
+    Assert.assertEquals(conf.getSegmentReplaceExternalViewCheckIntervalMs(), 
500L);
+    Assert.assertEquals(conf.getSegmentReplaceMaxRetryAttempts(), 2);
+  }
 }
diff --git 
a/pinot-core/src/main/java/org/apache/pinot/core/common/MinionConstants.java 
b/pinot-core/src/main/java/org/apache/pinot/core/common/MinionConstants.java
index c175d66eec0..d439438924d 100644
--- a/pinot-core/src/main/java/org/apache/pinot/core/common/MinionConstants.java
+++ b/pinot-core/src/main/java/org/apache/pinot/core/common/MinionConstants.java
@@ -53,6 +53,10 @@ public class MinionConstants {
   public static final String INITIAL_RETRY_DELAY_MS_KEY = 
"initialRetryDelayMs";
   public static final String RETRY_SCALE_FACTOR_KEY = "retryScaleFactor";
 
+  /// Per-task socket timeout (ms) for the minion -> controller segment upload 
request. Defaults to
+  /// 
[org.apache.pinot.common.utils.http.HttpClient#DEFAULT_SOCKET_TIMEOUT_MS] when 
unset.
+  public static final String SEGMENT_UPLOAD_REQUEST_TIMEOUT_MS_KEY = 
"segmentUploadRequestTimeoutMs";
+
   /// Cluster level configs
   public static final String TIMEOUT_MS_KEY_SUFFIX = ".timeoutMs";
   public static final String NUM_CONCURRENT_TASKS_PER_INSTANCE_KEY_SUFFIX = 
".numConcurrentTasksPerInstance";
diff --git a/pinot-minion/src/main/java/org/apache/pinot/minion/MinionConf.java 
b/pinot-minion/src/main/java/org/apache/pinot/minion/MinionConf.java
index d905a695b26..2bf584e0736 100644
--- a/pinot-minion/src/main/java/org/apache/pinot/minion/MinionConf.java
+++ b/pinot-minion/src/main/java/org/apache/pinot/minion/MinionConf.java
@@ -28,8 +28,10 @@ import org.apache.pinot.spi.utils.NetUtils;
 
 public class MinionConf extends PinotConfiguration {
   public static final String END_REPLACE_SEGMENTS_TIMEOUT_MS_KEY = 
"pinot.minion.endReplaceSegments.timeoutMs";
+  public static final String START_REPLACE_SEGMENTS_TIMEOUT_MS_KEY = 
"pinot.minion.startReplaceSegments.timeoutMs";
   public static final String MINION_TASK_PROGRESS_MANAGER_CLASS = 
"pinot.minion.taskProgressManager.class";
   public static final int DEFAULT_END_REPLACE_SEGMENTS_SOCKET_TIMEOUT_MS = 10 
* 60 * 1000; // 10 mins
+  public static final int DEFAULT_START_REPLACE_SEGMENTS_SOCKET_TIMEOUT_MS = 
10 * 60 * 1000; // 10 mins
 
   /// The number of threads to use for downloading segments from the deepstore.
   /// This is a global setting that applies to all tasks of 
BaseMultipleSegmentsConversionExecutor class.
@@ -72,6 +74,10 @@ public class MinionConf extends PinotConfiguration {
     return getProperty(END_REPLACE_SEGMENTS_TIMEOUT_MS_KEY, 
DEFAULT_END_REPLACE_SEGMENTS_SOCKET_TIMEOUT_MS);
   }
 
+  public int getStartReplaceSegmentsTimeoutMs() {
+    return getProperty(START_REPLACE_SEGMENTS_TIMEOUT_MS_KEY, 
DEFAULT_START_REPLACE_SEGMENTS_SOCKET_TIMEOUT_MS);
+  }
+
   public boolean isAllowDownloadFromServer() {
     return 
Boolean.parseBoolean(getProperty(CommonConstants.Minion.CONFIG_OF_ALLOW_DOWNLOAD_FROM_SERVER,
         CommonConstants.Minion.DEFAULT_ALLOW_DOWNLOAD_FROM_SERVER));
diff --git 
a/pinot-minion/src/test/java/org/apache/pinot/minion/MinionConfTest.java 
b/pinot-minion/src/test/java/org/apache/pinot/minion/MinionConfTest.java
index 841cd5c24ae..3876a599992 100644
--- a/pinot-minion/src/test/java/org/apache/pinot/minion/MinionConfTest.java
+++ b/pinot-minion/src/test/java/org/apache/pinot/minion/MinionConfTest.java
@@ -72,4 +72,18 @@ public class MinionConfTest {
     Assert.assertEquals(subcfg.subset("class").getProperty("nooppinotcrypter"),
         "org.apache.pinot.core.crypt.NoOpPinotCrypter");
   }
+
+  @Test
+  public void testReplaceSegmentsTimeoutDefaultsAndOverrides() {
+    MinionConf conf = new MinionConf();
+    Assert.assertEquals(conf.getStartReplaceSegmentsTimeoutMs(),
+        MinionConf.DEFAULT_START_REPLACE_SEGMENTS_SOCKET_TIMEOUT_MS);
+    Assert.assertEquals(conf.getEndReplaceSegmentsTimeoutMs(),
+        MinionConf.DEFAULT_END_REPLACE_SEGMENTS_SOCKET_TIMEOUT_MS);
+
+    conf.setProperty(MinionConf.START_REPLACE_SEGMENTS_TIMEOUT_MS_KEY, 30 * 60 
* 1000);
+    conf.setProperty(MinionConf.END_REPLACE_SEGMENTS_TIMEOUT_MS_KEY, 45 * 60 * 
1000);
+    Assert.assertEquals(conf.getStartReplaceSegmentsTimeoutMs(), 30 * 60 * 
1000);
+    Assert.assertEquals(conf.getEndReplaceSegmentsTimeoutMs(), 45 * 60 * 1000);
+  }
 }
diff --git 
a/pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/BaseMultipleSegmentsConversionExecutor.java
 
b/pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/BaseMultipleSegmentsConversionExecutor.java
index 0554d9f3470..052dd2df721 100644
--- 
a/pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/BaseMultipleSegmentsConversionExecutor.java
+++ 
b/pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/BaseMultipleSegmentsConversionExecutor.java
@@ -141,7 +141,8 @@ public abstract class 
BaseMultipleSegmentsConversionExecutor extends BaseTaskExe
               .collect(Collectors.toList());
       String lineageEntryId =
           
SegmentConversionUtils.startSegmentReplace(context.getTableNameWithType(), 
context.getUploadURL(),
-              new StartReplaceSegmentsRequest(segmentsFrom, segmentsTo), 
context.getAuthProvider());
+              new StartReplaceSegmentsRequest(segmentsFrom, segmentsTo), 
context.getAuthProvider(), true,
+              _minionConf.getStartReplaceSegmentsTimeoutMs());
       context.setCustomContext(CUSTOM_SEGMENT_UPLOAD_CONTEXT_LINEAGE_ENTRY_ID, 
lineageEntryId);
     }
   }
diff --git 
a/pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/SegmentConversionUtils.java
 
b/pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/SegmentConversionUtils.java
index 751ab08f735..7d023335c25 100644
--- 
a/pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/SegmentConversionUtils.java
+++ 
b/pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/SegmentConversionUtils.java
@@ -126,6 +126,10 @@ public class SegmentConversionUtils {
         retryScaleFactorConfig != null ? 
Double.parseDouble(retryScaleFactorConfig) : DEFAULT_RETRY_SCALE_FACTOR;
     RetryPolicy retryPolicy =
         RetryPolicies.exponentialBackoffRetryPolicy(maxNumAttempts, 
initialRetryDelayMs, retryScaleFactor);
+    String socketTimeoutMsConfig = 
configs.get(MinionConstants.SEGMENT_UPLOAD_REQUEST_TIMEOUT_MS_KEY);
+    int socketTimeoutMs =
+        socketTimeoutMsConfig != null ? Integer.parseInt(socketTimeoutMsConfig)
+            : HttpClient.DEFAULT_SOCKET_TIMEOUT_MS;
 
     // Upload the segment with retry policy
     SSLContext sslContext = MinionContext.getInstance().getSSLContext();
@@ -143,7 +147,7 @@ public class SegmentConversionUtils {
         try {
           SimpleHttpResponse response =
               fileUploadDownloadClient.uploadSegment(uri, segmentName, 
fileToUpload, httpHeaders, parameters,
-                  HttpClient.DEFAULT_SOCKET_TIMEOUT_MS);
+                  socketTimeoutMs);
           LOGGER.info("Got response {}: {} while uploading table: {}, segment: 
{} with uploadURL: {}",
               response.getStatusCode(), response.getResponse(), 
tableNameWithType, segmentName, uploadURL);
           return true;
@@ -178,6 +182,14 @@ public class SegmentConversionUtils {
       StartReplaceSegmentsRequest startReplaceSegmentsRequest, @Nullable 
AuthProvider authProvider,
       boolean forceCleanup)
       throws Exception {
+    return startSegmentReplace(tableNameWithType, uploadURL, 
startReplaceSegmentsRequest, authProvider, forceCleanup,
+        HttpClient.DEFAULT_SOCKET_TIMEOUT_MS);
+  }
+
+  public static String startSegmentReplace(String tableNameWithType, String 
uploadURL,
+      StartReplaceSegmentsRequest startReplaceSegmentsRequest, @Nullable 
AuthProvider authProvider,
+      boolean forceCleanup, int socketTimeoutMs)
+      throws Exception {
     String rawTableName = 
TableNameBuilder.extractRawTableName(tableNameWithType);
     TableType tableType = 
TableNameBuilder.getTableTypeFromTableName(tableNameWithType);
     SSLContext sslContext = MinionContext.getInstance().getSSLContext();
@@ -185,7 +197,8 @@ public class SegmentConversionUtils {
       URI uri = FileUploadDownloadClient.getStartReplaceSegmentsURI(new 
URI(uploadURL), rawTableName, tableType.name(),
           forceCleanup);
       SimpleHttpResponse response =
-          fileUploadDownloadClient.startReplaceSegments(uri, 
startReplaceSegmentsRequest, authProvider);
+          fileUploadDownloadClient.startReplaceSegments(uri, 
startReplaceSegmentsRequest, authProvider,
+              socketTimeoutMs);
       String responseString = response.getResponse();
       LOGGER.info(
           "Got response {}: {} while sending start replace segment request for 
table: {}, uploadURL: {}, request: {}",


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to