diff --git a/src/gausskernel/cbb/communication/comm_proxy/comm_common.cpp b/src/gausskernel/cbb/communication/comm_proxy/comm_common.cpp index b48600d5..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) @@ -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/5 +contact: 18720816902 +*/ int CommCheckLtranProcess() { AutoContextSwitch commContext(g_instance.comm_cxt.comm_global_mem_cxt); @@ -396,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/5 +contact: 18720816902 +*/ static void ParseCommProxyNumaBind( const char* str_attr, const int pos, const int numa_num, int* numa_bind) { @@ -496,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; 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;