From e7dd9fa2a1dd276d526dacd51c615021caaea70c Mon Sep 17 00:00:00 2001 From: Eao3piq4e Date: Fri, 5 Aug 2022 09:09:08 +0800 Subject: [PATCH 1/6] Update comm_common.cpp --- .../cbb/communication/comm_proxy/comm_common.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gausskernel/cbb/communication/comm_proxy/comm_common.cpp b/src/gausskernel/cbb/communication/comm_proxy/comm_common.cpp index b48600d5..bf6bbb14 100644 --- a/src/gausskernel/cbb/communication/comm_proxy/comm_common.cpp +++ b/src/gausskernel/cbb/communication/comm_proxy/comm_common.cpp @@ -279,6 +279,15 @@ IPAddrType CommLibNetGetIPType(unsigned int ip) #define CMD_STR_MAX 512 #define CMD_OUTPUT_BUFFER_SIZE 1024 +/* +function name: CommCheckLtranProcess +description: The function check if the process currently working has loaded transactions. +arguments: void +return value: 0 or 1, if 1, then at least one loaded transcation exists, if 0, no one. +note: none +date: 2022/8/4 +contact: 18720816902 +*/ int CommCheckLtranProcess() { AutoContextSwitch commContext(g_instance.comm_cxt.comm_global_mem_cxt); From 8902cfd59aeaad64e3219e8e933cc8d937621256 Mon Sep 17 00:00:00 2001 From: Eao3piq4e Date: Fri, 5 Aug 2022 10:40:56 +0800 Subject: [PATCH 2/6] Update comm_common.cpp --- .../cbb/communication/comm_proxy/comm_common.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/gausskernel/cbb/communication/comm_proxy/comm_common.cpp b/src/gausskernel/cbb/communication/comm_proxy/comm_common.cpp index bf6bbb14..8353fb86 100644 --- a/src/gausskernel/cbb/communication/comm_proxy/comm_common.cpp +++ b/src/gausskernel/cbb/communication/comm_proxy/comm_common.cpp @@ -405,6 +405,21 @@ static T GetCommProxySubParameter(const char* str_attr, const char* key) return res; } +/* +function name: ParseCommProxyNumaBind +description: Get the ids of CPU to bind process with specific CPU. +arguments: The first argument is a pointer of type const char* to a string that indicating + the id of CPUs below NUMA, not necessarily all CPUs. + The second argument is an integer telling us we will get CPUs' id from which position + of array str_attr. + The third argument tells us the number of NUMA system framework. + The fourth argument is a pointer to an integer array used to store CPUs' id gotten + from string str_attr, we can use these ids to bind specific CPU. +return value: void +note: none +date: 2022/8/4 +contact: 18720816902 +*/ static void ParseCommProxyNumaBind( const char* str_attr, const int pos, const int numa_num, int* numa_bind) { From 3c1a1c2bef60b34fe7e2fa5cd6566b7ecef30b68 Mon Sep 17 00:00:00 2001 From: Eao3piq4e Date: Fri, 5 Aug 2022 11:49:40 +0800 Subject: [PATCH 3/6] Update comm_common.cpp --- .../communication/comm_proxy/comm_common.cpp | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/gausskernel/cbb/communication/comm_proxy/comm_common.cpp b/src/gausskernel/cbb/communication/comm_proxy/comm_common.cpp index 8353fb86..b8436388 100644 --- a/src/gausskernel/cbb/communication/comm_proxy/comm_common.cpp +++ b/src/gausskernel/cbb/communication/comm_proxy/comm_common.cpp @@ -285,7 +285,7 @@ description: The function check if the process currently working has loaded tran arguments: void return value: 0 or 1, if 1, then at least one loaded transcation exists, if 0, no one. note: none -date: 2022/8/4 +date: 2022/8/5 contact: 18720816902 */ int CommCheckLtranProcess() @@ -417,7 +417,7 @@ arguments: The first argument is a pointer of type const char* to a string that from string str_attr, we can use these ids to bind specific CPU. return value: void note: none -date: 2022/8/4 +date: 2022/8/5 contact: 18720816902 */ static void ParseCommProxyNumaBind( @@ -520,6 +520,22 @@ bool ParseCommProxyAttr(CommProxyConfig* config) return true; } +/* +function name: CommCheckFilterMatch +description: This function compare the ip and port allowed with ip and port gotten from + Filter, if they are correspondingly same, it will return true value. +arguments: The first argument is a pointer of type const char* to a string that indicating + the id and port of the request been sent to Filter, the id and port have been + separated by character ':'. + The second argument is an integer telling us we the length of the string first + argument directs. + The third argument tells us the ip allowed. + The fourth argument tells us the port allowed. +return value: static bool +note: none +date: 2022/8/4 +contact: 18720816902 +*/ static bool CommCheckFilterMatch(const char *filter, int len, const char *ip, int port) { char *str_ip = NULL; From bab8f82a0e7e571268f9f77f1b8745bc94814f97 Mon Sep 17 00:00:00 2001 From: Eao3piq4e Date: Fri, 5 Aug 2022 11:52:39 +0800 Subject: [PATCH 4/6] Update comm_common.cpp --- src/gausskernel/cbb/communication/comm_proxy/comm_common.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gausskernel/cbb/communication/comm_proxy/comm_common.cpp b/src/gausskernel/cbb/communication/comm_proxy/comm_common.cpp index b8436388..eea7ded5 100644 --- a/src/gausskernel/cbb/communication/comm_proxy/comm_common.cpp +++ b/src/gausskernel/cbb/communication/comm_proxy/comm_common.cpp @@ -51,7 +51,7 @@ description: The function set the affinity of CPU or CPUs destined by argument c arguments: An integer representing the id of one CPU or more. return value: void note: none -date: 2022/8/4 +date: 2022/8/5 contact: 18720816902 */ void SetCPUAffinity(int cpu_id) From a7af1741d244d9e4976d225dddc79c433cb8f0ee Mon Sep 17 00:00:00 2001 From: Eao3piq4e Date: Fri, 5 Aug 2022 18:42:54 +0800 Subject: [PATCH 6/6] Update comm_dfx.cpp --- .../cbb/communication/comm_proxy/comm_dfx.cpp | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/gausskernel/cbb/communication/comm_proxy/comm_dfx.cpp b/src/gausskernel/cbb/communication/comm_proxy/comm_dfx.cpp index 153ed79a..7336dee1 100644 --- a/src/gausskernel/cbb/communication/comm_proxy/comm_dfx.cpp +++ b/src/gausskernel/cbb/communication/comm_proxy/comm_dfx.cpp @@ -175,6 +175,24 @@ void UpdateTxRxStats(int msg_level) last_rx_nbytes = current_rx_nbytes; } +/* +function name: parse_monitor_sock_queue +description: Compare the string recv_buffer with "sockqueue fd:fd", the "fd" + after character ':' is an integer indicating file descriptor. If recv_buffer + accords with the format, the function will takes next action to see if + fd is 0, which represents stdin, so the function ends with returned value 0. + If fd isn't 0, compare the third argument type with ParseMonitorTypeSet, + if equal, then get a structure variable including socket descriptor + destined by the fd gotten from the first argument, if it's NULL, we can + write "fd:[%d], type:[normal fd], no sock queue" into send_buffer. +arguments: The first argument is a pointer to a string indicating request infomation. + The second argument is a pointer to a string to store sent infomation. + The third argument tells the kind of socket request. +return value: 0 or 1. +note: none +date: 2022/8/5 +contact tel: 18720816902 +*/ int parse_monitor_sock_queue(char* recv_buffer, char* send_buffer, ParseMonitorType type) { int length; @@ -205,6 +223,25 @@ int parse_monitor_sock_queue(char* recv_buffer, char* send_buffer, ParseMonitorT return 0; } +/* +function name: parse_monitor_fd +description: Compare the string recv_buffer with "query fd:fd", the "fd" + after character ':' is an integer indicating file descriptor. If recv_buffer + accords with the format, the function will takes next action to see if + fd is 0, which represents stdin, so the function ends with returned value 0. + If fd isn't 0, compare the third argument type with ParseMonitorTypeSet, + if equal, then get a structure variable including socket descriptor + destined by the fd gotten from the first argument, if it's NULL, we can + write "fd:[%d], type:[normal fd]"(%d--fd) into send_buffer, else write + "fd:[%d], type:[%d]"(%d--fd,%d--sock_desc->m_fd_type). +arguments: The first argument is a pointer to a string indicating request infomation. + The second argument is a pointer to a string to store sent infomation. + The third argument tells the kind of socket request. +return value: 0 or 1. +note: none +date: 2022/8/5 +contact tel: 18720816902 +*/ int parse_monitor_fd(char* recv_buffer, char* send_buffer, ParseMonitorType type) { int length;