-
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-25743] Fix Heartbeat start failure due to the difference of packing server information between HA mode #5711
[CBRD-25743] Fix Heartbeat start failure due to the difference of packing server information between HA mode #5711
Conversation
@@ -32,7 +32,7 @@ | |||
|
|||
#define CSS_MAX_CLIENT_COUNT 4000 | |||
|
|||
#define CSS_SERVER_PROC_REGISTER_INITIALIZER {-1, "", 0, "", ""} | |||
#define CSS_SERVER_PROC_REGISTER_INITIALIZER {"", 0, -1, "", ""} |
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.
CSS_SERVER_PROC_REGISTER_INITIALIZER는 CSS_SERVER_PROC_REGISTER 타입의 초기화에 사용될 것인데, struct 순서가, int, char, int, char, char로 되어 있습니다.
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.
CSS_SERVER_PROC_REGISTER
type의 순서 또한 char, int, int, char, char
형태로 변경이 완료되어 있습니다.
length = (int) strlen (proc_register->server_name) + 1; | ||
server_name_length = proc_register->server_name_length; | ||
server_name = buffer; | ||
length = (int) strlen (server_name) + 1; | ||
|
||
assert (length <= DB_MAX_IDENTIFIER_LENGTH); |
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.
다음 두 정의 사이에 1byte 차이로 assert 발생 가능성 -> 별도 이슈화
#define DB_MAX_IDENTIFIER_LENGTH 255
static constexpr int CSS_SERVER_MAX_SZ_SERVER_NAME = 256;
src/executables/master.c
Outdated
@@ -350,23 +348,24 @@ css_accept_new_request (CSS_CONN_ENTRY * conn, unsigned short rid, char *buffer) | |||
#if defined(DEBUG) | |||
css_Active_server_count++; | |||
#endif | |||
css_add_request_to_socket_queue (datagram_conn, false, proc_register->server_name, server_fd, READ_WRITE, 0, | |||
css_add_request_to_socket_queue (datagram_conn, false, buffer, server_fd, READ_WRITE, 0, |
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.
NIT:
buffer를 넘기는 것보다는 기존 코드를 일부 원복하는 관점에서 순서를 바꾸는게 어떨까요?
server_name = buffer;
css_add_request_to_socket_queue (..., server_name, ...);
@@ -395,6 +394,7 @@ css_accept_new_request (CSS_CONN_ENTRY * conn, unsigned short rid, char *buffer) | |||
#if !defined(WINDOWS) | |||
if (auto_Restart_server) | |||
{ | |||
CSS_SERVER_PROC_REGISTER *proc_register = (CSS_SERVER_PROC_REGISTER *) buffer; |
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.
TODO 주석 추가 - 이슈화 필요
SERVER_REQUEST 요청의 프로토콜 포맷이 달라지면 안됩니다. 이는 수신하는 쪽에서 핸들링이 어려워 집니다.
- css_connect_to_master_server() in connection_sr.c
- | SERVER_REQUEST | CSS_SERVER_PROC_REGISTER |
- css_connect_to_master_server() in connection_cl.c
- | SERVER_REQUEST | server_name |
다음 2가지 처리 방안이 도입되어야 합니다.
- 별도의 요청(request)로 분리
- SERVER_REQUEST_FROM_SERVER
- SERVER_REQUEST_FROM_CLIENT
- 데이터 페이로드 포맷 변경
- | SERVER_REQUEST | 데이터 페이로드 구분 - 1 | CSS_SERVER_PROC_REGISTER |
- | SERVER_REQUEST | 데이터 페이로드 구분 - 2 | server_name |
dcbf192
into
CUBRID:feature/server_revive_2
http://jira.cubrid.org/browse/CBRD-25743
CSS_SERVER_PROC_REGISTER
에 담아 보내도록 변경하였는데, copylogdb, applylogdb는 해당 방식과 다른 packing을 사용함.connection_cl.c
의hb_pack_server_name
함수를 사용하고, 이는 packing된server_name
string만을 보냄CSS_SERVER_PROC_REGISTER
자료구조에 담아서 보냄css_accept_new_request
에서 두 case 구분 없이CSS_SERVER_PROC_REGISTER
로 변환해서 생긴 문제CSS_SERVER_PROC_REGISTER
의 가장 첫 멤버 변수로서 packing된server_name
string이 오도록 순서 변경CSS_SERVER_PROC_REGISTER
로 packing된 non-ha server에 경우에만 type conversion 진행 후, 해당 정보를 통해 server 등록하도록 변경