-
Notifications
You must be signed in to change notification settings - Fork 30
SNOW-1737940: Support keepalive parameters in LibSfClient #841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…flakeclient into SNOW-1737940v2
| { | ||
| CXX_LOG_TRACE("sf::HeartbeatBackrgound::renew_session_sync::Failed to renew session"); | ||
| stop_heart_beat_for_this_session(sf); | ||
| return SF_BOOLEAN_FALSE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should return the curl to the pool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @sfc-gh-dstempniak, If you don’t mind, could you please elaborate on this? As far as I remember, the original return type of this function was void, and I only changed it to sf_bool for testing purposes. I’m not quite sure why we need to return the curl object here — could you clarify that?
| snowflake_connect(sf); | ||
| std::this_thread::sleep_for(std::chrono::milliseconds(20000)); | ||
| //Make sure renew_session_sync work well | ||
| *result = renew_session_sync(sf); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain/comment why do we sleep for 20s and why we call renew_session_sync?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn’t need to be 20 seconds. I updated it with 100 milliseconds. I used renew_session_sync to test the heartbeat with multiple connections
lib/connection.c
Outdated
|
|
||
| uint64 validate_client_session_keep_alive_heart_beat_frequency(int64 heart_beat_frequency) | ||
| { | ||
| int64 max = SF_DEFAULT_CLIENT_SESSION_ALIVE_HEARTBEAT_FREQUENCY; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we shouldn't use the default value to limit the heartbeat frequency. masterValidityInSeconds can be changed on server like here. If we get 60 from the server, we will set it to 900, which seems not good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this code to match the behavior of ODBC.
cpp/lib/HeartbeatBackground.cpp
Outdated
| if (m_worker == NULL) | ||
| { | ||
| this->m_master_token_validation_time = connection->master_token_validation_time; | ||
| this->m_heart_beat_interval = connection->client_session_keep_alive_heartbeat_frequency; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think m_master_token_validation_time is never used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since I removed validate_client_session_alive_heartbeat_frequency, I also removed m_heartbeat_interval and updated libsfclient to use m_master_token_validation_time to calculate the frequency.
| } | ||
| else | ||
| { | ||
| if (connection->master_token_validation_time < this->m_master_token_validation_time) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we use m_heart_beat_interval for sleeping, we should recalculate it as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same as above
No description provided.