snowflakedb / gosnowflake

Go Snowflake Driver
Apache License 2.0
294 stars 122 forks source link

SNOW-1346547: add check for session expiry when getting query result #1160

Closed sfc-gh-ext-simba-jl closed 3 months ago

sfc-gh-ext-simba-jl commented 3 months ago

Description

drivers issue 957: https://github.com/snowflakedb/snowflake-sdks-drivers-issues-teamwork/issues/957

The root cause is that the heartbeat process has renewed the session token here but the new token in the get query result request's header was not updated in getQueryResultWithRetriesForAsyncMode().

This PR adds a check for session expiry in getQueryResultWithRetriesForAsyncMode() and update the token in the header if needed. Similar to ODBC's implementation here, where there should be a check for the session expired code 390112 during the getting query result request and allows a retry after updating the session token.

Checklist

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 88.46154% with 3 lines in your changes missing coverage. Please review.

Project coverage is 71.63%. Comparing base (24ae28b) to head (2b6b0bb). Report is 1 commits behind head on master.

Files Patch % Lines
async.go 88.46% 3 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1160 +/- ## ========================================== + Coverage 71.60% 71.63% +0.03% ========================================== Files 54 54 Lines 12092 12117 +25 ========================================== + Hits 8658 8680 +22 - Misses 3434 3437 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.