diff --git a/Snowflake.Data/Core/Authenticator/OktaAuthenticator.cs b/Snowflake.Data/Core/Authenticator/OktaAuthenticator.cs index 6ec4843d4..04bdee97e 100644 --- a/Snowflake.Data/Core/Authenticator/OktaAuthenticator.cs +++ b/Snowflake.Data/Core/Authenticator/OktaAuthenticator.cs @@ -174,6 +174,8 @@ private void HandleAuthenticatorException(Exception ex, HttpResponseMessage saml // Get the current retry count and timeout elapsed from the response headers retryCount += int.Parse(samlRawResponse.Content.Headers.GetValues(RetryCountHeader).First()); + var timeoutElapsedHeader = int.Parse(samlRawResponse.Content.Headers.GetValues(TimeoutElapsedHeader).First()); + s_logger.Warn($"HandleAuthenticatorException - timeoutElapsedHeader = {timeoutElapsedHeader} !!!"); timeoutElapsed += int.Parse(samlRawResponse.Content.Headers.GetValues(TimeoutElapsedHeader).First()); } else @@ -275,7 +277,13 @@ private void VerifyPostbackUrl() private bool RetryLimitIsNotReached(int retryCount, int timeoutElapsed) { var elapsedMillis = timeoutElapsed * 1000; - return retryCount < session._maxRetryCount && !TimeoutHelper.IsExpired(elapsedMillis, session._maxRetryTimeout); + var result = retryCount < session._maxRetryCount && !TimeoutHelper.IsExpired(elapsedMillis, session._maxRetryTimeout); + if (!result) + { + s_logger.Warn($"Reached retry timeout: {timeoutElapsed} - !!!"); + } + + return result; } private bool IsPostbackUrlNotFound(Exception ex) diff --git a/Snowflake.Data/Core/SFStatement.cs b/Snowflake.Data/Core/SFStatement.cs index 05e905263..6e9eb6683 100644 --- a/Snowflake.Data/Core/SFStatement.cs +++ b/Snowflake.Data/Core/SFStatement.cs @@ -122,8 +122,8 @@ class SFStatement private readonly IRestRequester _restRequester; private CancellationTokenSource _timeoutTokenSource; - - // Merged cancellation token source for all cancellation signal. + + // Merged cancellation token source for all cancellation signal. // Cancel callback will be registered under token issued by this source. private CancellationTokenSource _linkedCancellationTokenSource; @@ -153,7 +153,7 @@ private void AssignQueryRequestId() { lock (_requestIdLock) { - + if (_requestId != null) { logger.Info("Another query is running."); @@ -296,7 +296,7 @@ private void SetTimeout(int timeout) this._timeoutTokenSource = timeout > 0 ? new CancellationTokenSource(timeout * 1000) : new CancellationTokenSource(Timeout.InfiniteTimeSpan); } - + /// /// Register cancel callback. Two factors: either external cancellation token passed down from upper /// layer or timeout reached. Whichever comes first would trigger query cancellation. @@ -342,7 +342,7 @@ internal async Task ExecuteAsync(int timeout, string sql, Dicti } registerQueryCancellationCallback(timeout, cancellationToken); - + int arrayBindingThreshold = 0; if (SfSession.ParameterMap.ContainsKey(SFSessionParameter.CLIENT_STAGE_ARRAY_BINDING_THRESHOLD)) { @@ -486,7 +486,7 @@ private SFBaseResultSet ExecuteSqlWithPutGet(int timeout, string sql, Dictionary throw new SnowflakeDbException(ex, SFError.INTERNAL_ERROR); } } - + private SFBaseResultSet ExecuteSqlOtherThanPutGet(int timeout, string sql, Dictionary bindings, bool describeOnly, bool asyncExec) { try @@ -541,7 +541,7 @@ private SFBaseResultSet ExecuteSqlOtherThanPutGet(int timeout, string sql, Dicti throw; } } - + internal async Task GetResultWithIdAsync(string resultId, CancellationToken cancellationToken) { var req = BuildResultRequestWithId(resultId); @@ -660,7 +660,7 @@ internal T ExecuteHelper( if (SessionExpired(response)) { - logger.Info("Ping pong request failed with session expired, trying to renew the session."); + logger.Warn("Ping pong request failed with session expired, trying to renew the session. !!!"); // it was info previously SfSession.renewSession(); } else @@ -1033,7 +1033,7 @@ internal SFBaseResultSet ExecuteTransfer(string sql) false); PutGetStageInfo stageInfo = new PutGetStageInfo(); - + SFFileTransferAgent fileTransferAgent = new SFFileTransferAgent(sql, SfSession, response.data, ref _uploadStream, _destFilename, _stagePath, CancellationToken.None);