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

curth pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new 4897d2f9b fix(csharp/src/Drivers/Databricks): Align ConnectionTimeout 
with TemporarilyUnavailableRetryTimeout (#3073)
4897d2f9b is described below

commit 4897d2f9b34e8637c02f1909d48b57b4edcd40c6
Author: Jacky Hu <[email protected]>
AuthorDate: Mon Jun 30 19:05:31 2025 -0700

    fix(csharp/src/Drivers/Databricks): Align ConnectionTimeout with 
TemporarilyUnavailableRetryTimeout (#3073)
    
    # PR Description
    
    ## Description
    
    This PR sets the `ConnectTimeoutMilliseconds ` of `DatabricksConnection`
    with `TemporarilyUnavailableRetryTimeout` when
    `TemporarilyUnavailableRetryTimeout` is greater than
    `ConnectTimeoutMilliseconds` to make sure it can continue the retry when
    `ConnectTimeoutMilliseconds` is lower than
    `TemporarilyUnavailableRetryTimeout`.
    
    ### Changes
    - Updated `DatabricksConnection:ValidateOptions` to set
    `ConnectTimeoutMilliseconds` with `TemporarilyUnavailableRetryTimeout`
    when `TemporarilyUnavailableRetryTimeout` is greater than
    `ConnectTimeoutMilliseconds` and `TemporarilyUnavailableRetry` is
    enabled
    
    ### Motivation
    
    The default value of `ConnectTimeoutMilliseconds` is 30 seconds (see
    
[here](https://github.com/apache/arrow-adbc/blob/main/csharp/src/Drivers/Apache/Hive2/HiveServer2Connection.cs#L43)),
    which is lower than the default value (900s) of
    `TemporarilyUnavailableRetryTimeout`. If client does not set this, it
    will timeout after 30s, this is normally lower than the Databricks
    cluster startup time, so the client/user may get the timeout error when
    opening a connection on an idle cluster.
    
    ### Testing
    
    - E2E test by opening a connection and run a query on a cluster that has
    been stopped
---
 csharp/src/Drivers/Databricks/DatabricksConnection.cs | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/csharp/src/Drivers/Databricks/DatabricksConnection.cs 
b/csharp/src/Drivers/Databricks/DatabricksConnection.cs
index 69809ce02..2ffa7b552 100644
--- a/csharp/src/Drivers/Databricks/DatabricksConnection.cs
+++ b/csharp/src/Drivers/Databricks/DatabricksConnection.cs
@@ -527,6 +527,13 @@ namespace Apache.Arrow.Adbc.Drivers.Databricks
                 }
                 TemporarilyUnavailableRetryTimeout = 
tempUnavailableRetryTimeoutValue;
             }
+
+            // When TemporarilyUnavailableRetry is enabled, we need to make 
sure connection timeout (which is used to cancel the HttpConnection) is equal
+            // or greater than TemporarilyUnavailableRetryTimeout so that it 
won't timeout before server startup timeout (TemporarilyUnavailableRetryTimeout)
+            if (TemporarilyUnavailableRetry && 
TemporarilyUnavailableRetryTimeout * 1000 > ConnectTimeoutMilliseconds)
+            {
+                ConnectTimeoutMilliseconds = 
TemporarilyUnavailableRetryTimeout * 1000;
+            }
         }
 
         protected override Task<TGetResultSetMetadataResp> 
GetResultSetMetadataAsync(TGetSchemasResp response, CancellationToken 
cancellationToken = default) =>

Reply via email to