-
Notifications
You must be signed in to change notification settings - Fork 123
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
[CBRD-25700] Modify the behavior to retain the session when automatically restarting due to the CAS memory size limit #5717
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -8986,14 +8986,16 @@ void | |||||
ssession_end_session (THREAD_ENTRY * thread_p, unsigned int rid, char *request, int reqlen) | ||||||
{ | ||||||
int err = NO_ERROR; | ||||||
int is_keep_session; | ||||||
SESSION_ID id; | ||||||
OR_ALIGNED_BUF (OR_INT_SIZE) a_reply; | ||||||
char *reply = OR_ALIGNED_BUF_START (a_reply); | ||||||
char *ptr = NULL; | ||||||
|
||||||
(void) or_unpack_int (request, (int *) &id); | ||||||
ptr = or_unpack_int (request, (int *) &id); | ||||||
ptr = or_unpack_int (ptr, (int *) &is_keep_session); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
err = xsession_end_session (thread_p, id); | ||||||
err = xsession_end_session (thread_p, id, (bool) is_keep_session); | ||||||
|
||||||
ptr = or_pack_int (reply, err); | ||||||
css_send_data_to_client (thread_p->conn_entry, rid, reply, OR_ALIGNED_BUF_SIZE (a_reply)); | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,7 @@ struct valcnv_buffer | |
}; | ||
|
||
SESSION_ID db_Session_id = DB_EMPTY_SESSION; | ||
bool db_Keep_session = false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cas의 FN_KEEP_SESS 처리를 위해 필요한 전역 변수가 이곳에 선언될 필요가 있는지 의문입니다. 혹시 어떤 기준으로 이곳에 선언했는지 추가 설명 가능할까요? 추가적으로 다음 부분 역시 의견드립니다.
|
||
|
||
int db_Row_count = DB_ROW_COUNT_NOT_SET; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,6 +118,7 @@ struct session_state | |
pthread_mutex_t mutex; /* state mutex */ | ||
UINT64 del_id; /* delete transaction ID (for lock free) */ | ||
|
||
bool is_keep_session; | ||
bool is_trigger_involved; | ||
bool is_last_insert_id_generated; | ||
bool auto_commit; | ||
|
@@ -302,6 +303,7 @@ session_state_init (void *st) | |
/* initialize fields */ | ||
db_make_null (&session_p->cur_insert_id); | ||
db_make_null (&session_p->last_insert_id); | ||
session_p->is_keep_session = false; | ||
session_p->is_trigger_involved = false; | ||
session_p->is_last_insert_id_generated = false; | ||
session_p->row_count = -1; | ||
|
@@ -743,9 +745,10 @@ session_state_create (THREAD_ENTRY * thread_p, SESSION_ID * id) | |
* session_state_destroy () - close a session state | ||
* return : NO_ERROR or error code | ||
* id(in) : the identifier for the session | ||
* is_keep_session(in) : whether to keep the session | ||
*/ | ||
int | ||
session_state_destroy (THREAD_ENTRY * thread_p, const SESSION_ID id) | ||
session_state_destroy (THREAD_ENTRY * thread_p, const SESSION_ID id, bool is_keep_session) | ||
{ | ||
SESSION_STATE *session_p; | ||
int error = NO_ERROR, success = 0; | ||
|
@@ -762,6 +765,13 @@ session_state_destroy (THREAD_ENTRY * thread_p, const SESSION_ID id) | |
return ER_SES_SESSION_EXPIRED; | ||
} | ||
|
||
if (is_keep_session == true) | ||
{ | ||
session_p->is_keep_session = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. true로 설정된 이후 다시 client와 연결되었을 때 언제 false로 리셋되나요? |
||
pthread_mutex_unlock (&session_p->mutex); | ||
return NO_ERROR; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 기존과 동일한 처리를 위해 이곳에서 return 하는 것으로 알고 있습니다. 다만, session 정보는 유지되지만 연결은 끊어진 상태인데 ref_count 등을 처리하지 않아도 문제가 되지 않는지 검증 되었나요? session_remove_expired_sessions() 함수에서 if (state->is_keep_session == true) 검사 이전에 assert (state->ref_count == 0); 조건이 검사되어 지고 있습니다. 참고하세요. |
||
} | ||
|
||
#if defined (SERVER_MODE) | ||
assert (session_p->ref_count > 0); | ||
|
||
|
@@ -934,10 +944,19 @@ session_remove_expired_sessions (THREAD_ENTRY * thread_p) | |
/* Now we can destroy this session */ | ||
assert (state->ref_count == 0); | ||
|
||
expired_sid_buffer[n_expired_sids++] = state->id; | ||
if (state->is_keep_session == true) | ||
{ | ||
/* keep session */ | ||
pthread_mutex_unlock (&state->mutex); | ||
continue; | ||
} | ||
else | ||
{ | ||
expired_sid_buffer[n_expired_sids++] = state->id; | ||
|
||
/* Destroy the session related resources like session parameters */ | ||
(void) session_state_uninit (state); | ||
/* Destroy the session related resources like session parameters */ | ||
(void) session_state_uninit (state); | ||
} | ||
|
||
if (n_expired_sids == EXPIRED_SESSION_BUFFER_SIZE) | ||
{ | ||
|
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.
여기서 db_set_keep_session(true)를 호출해 주어야 하는 이유가 뭔가요?