Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into CBRD-25709
Browse files Browse the repository at this point in the history
  • Loading branch information
kangmin5505 committed Dec 11, 2024
2 parents 1ff21f5 + e560ed5 commit 03a16cf
Show file tree
Hide file tree
Showing 32 changed files with 1,373 additions and 306 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ jobs:
sudo apt-get -yq install astyle
# indent 2.2.11, the lastest version (2.2.12) make a different result
wget https://ftp.gnu.org/gnu/indent/indent-2.2.11.tar.gz
wget https://github.com/CUBRID/3rdparty/raw/develop/indent/indent-2.2.11.tar.gz
tar xf indent-2.2.11.tar.gz
cd indent-2.2.11
./configure
sudo make -j install
cd ..
# download google-java-format-1.7-all-deps.jar
wget https://github.com/google/google-java-format/releases/download/google-java-format-1.7/google-java-format-1.7-all-deps.jar
wget https://github.com/CUBRID/3rdparty/raw/develop/google-java-format/google-java-format-1.7-all-deps.jar
working-directory: ${{ env.working-directory }}
- uses: actions/setup-java@v3
with:
Expand Down Expand Up @@ -140,7 +140,7 @@ jobs:
# Download cppcheck-2.4.1 source
wd=`pwd`
cd ..
wget https://github.com/danmar/cppcheck/archive/2.4.1.tar.gz
wget https://github.com/CUBRID/3rdparty/raw/develop/cppcheck/2.4.1.tar.gz
tar xf 2.4.1.tar.gz
# build cppcheck-2.4.1
Expand Down
16 changes: 8 additions & 8 deletions 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
# limitations under the License.
#

set(WITH_FLEX_URL "https://github.com/westes/flex/files/981163/flex-2.6.4.tar.gz") # flex
set(WITH_BISON_URL "https://ftp.gnu.org/gnu/bison/bison-3.4.1.tar.gz") # bison
set(WITH_LIBEXPAT_URL "https://github.com/libexpat/libexpat/releases/download/R_2_2_5/expat-2.2.5.tar.bz2") # expat library sources URL
set(WITH_LIBJANSSON_URL "https://github.com/akheron/jansson/releases/download/v2.10/jansson-2.10.tar.gz") # jansson library sources URL
set(WITH_FLEX_URL "https://github.com/CUBRID/3rdparty/raw/develop/flex/flex-2.6.4.tar.gz") # flex
set(WITH_BISON_URL "https://github.com/CUBRID/3rdparty/raw/develop/bison/bison-3.4.1.tar.gz") # bison
set(WITH_LIBEXPAT_URL "https://github.com/CUBRID/3rdparty/raw/develop/expat/expat-2.2.5.tar.bz2") # expat library sources URL
set(WITH_LIBJANSSON_URL "https://github.com/CUBRID/3rdparty/raw/develop/jansson/jansson-2.10.tar.gz") # jansson library sources URL
set(WITH_LIBEDIT_URL "https://github.com/CUBRID/libedit/archive/refs/tags/csql_v1.1.tar.gz") # editline library sources URL
set(WITH_RAPIDJSON_URL "https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz") # rapidjson library sources URL
set(WITH_LIBOPENSSL_URL "https://www.openssl.org/source/old/1.1.1/openssl-1.1.1f.tar.gz") # openssl library sources URL
set(WITH_LIBUNIXODBC_URL "https://ftp.osuosl.org/pub/blfs/conglomeration/unixODBC/unixODBC-2.3.9.tar.gz") # unixODBC library sources URL
set(WITH_LIBTBB_URL "https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.11.0.tar.gz") # intel oneTBB library sources URL
set(WITH_RAPIDJSON_URL "https://github.com/CUBRID/3rdparty/raw/develop/rapidjson/v1.1.0.tar.gz") # rapidjson library sources URL
set(WITH_LIBOPENSSL_URL "https://github.com/CUBRID/3rdparty/raw/develop/openssl/openssl-1.1.1f.tar.gz") # openssl library sources URL
set(WITH_LIBUNIXODBC_URL "https://github.com/CUBRID/3rdparty/raw/develop/unixODBC/unixODBC-2.3.9.tar.gz") # unixODBC library sources URL
set(WITH_LIBTBB_URL "https://github.com/CUBRID/3rdparty/raw/develop/tbb/v2021.11.0.tar.gz") # intel oneTBB library sources URL

# URL_HASH is a hash value used to verify the integrity of a file downloaded from a specified URL.
# It is optional but highly recommended to set this value. If not set, the file will be downloaded
Expand Down
5 changes: 4 additions & 1 deletion msg/en_US.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,9 @@ Check the path of the key file (_keys) and make sure that it includes proper key

1361 Invalid result cache for subquery.

1362 Last Error
1362 Locale '%1$s' is unavailable.

1363 Last Error

$set 6 MSGCAT_SET_INTERNAL
1 Error in error subsystem (line %1$d):
Expand Down Expand Up @@ -1945,6 +1947,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
322 Table column '%1$s.%2$s' has not been defined
323 Stored procedure/function '%1$s' has OUT or IN OUT arguments
324 '%1$s' is not a record variable.
325 The argument specifying the language must be a string literal.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 Out of virtual memory: unable to allocate %1$d bytes.
Expand Down
5 changes: 4 additions & 1 deletion msg/ko_KR.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,9 @@ $ LOADDB

1361 부질의 캐시가 잘못되었습니다.

1362 마지막 에러
1362 언어 '%1$s'에 대한 로캘은 사용 가능하지 않습니다.

1363 마지막 에러

$set 6 MSGCAT_SET_INTERNAL
1 에러 서브 시스템에 에러 발생(라인 %1$d):
Expand Down Expand Up @@ -1945,6 +1947,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
322 테이블 컬럼 '%1$s.%2$s'이 정의되지 않았습니다
323 Stored procedure/function '%1$s' 이(가) OUT 또는 IN OUT 인수를 가지고 있습니다.
324 '%1$s'은 레코드 변수가 아닙니다.
325 언어를 지정하는 인수는 문자열 리터럴이어야 합니다.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 가상 메모리 없음: %1$d 바이트를 할당할 수 없습니다.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

public class TypeChar extends Type {

public static final int MAX_LEN = 268435455;
public static final int MAX_LEN = 2048;

public final int length;

Expand Down
4 changes: 3 additions & 1 deletion src/base/error_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -1741,7 +1741,9 @@

#define ER_QPROC_RESULT_CACHE_INVALID -1361

#define ER_LAST_ERROR -1362
#define ER_LOCALE_LANG_NOT_AVAILABLE -1362

#define ER_LAST_ERROR -1363

/*
* CAUTION!
Expand Down
43 changes: 8 additions & 35 deletions src/base/language_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -2311,36 +2311,6 @@ lang_set_flag_from_lang (const char *lang_str, bool has_user_format, bool has_us
status = lang_get_lang_id_from_name (lang_str, &lang);
}

if (lang_set_flag_from_lang_id (lang, has_user_format, has_user_lang, flag) == 0)
{
return status;
}

assert (lang == INTL_LANG_ENGLISH);

return 1;
}

/*
* lang_set_flag_from_lang - set a flag according to language identifier
*
* return: 0 if language string OK and flag was set, non-zero otherwise
* lang(in): language identier
* has_user_format(in): true if user has given a format, false otherwise
* has_user_lang(in): true if user has given a language, false otherwise
* flag(out): bit flag : bits 0 and 1 are user flags, bits 2 - 31 are for
* language identification
* Bit 0 : if set, the format was given by user
* Bit 1 : if set, the language was given by user
* Bit 2 - 31 : INTL_LANG
* Consider change this flag to store the language as value
* instead of as bit map
*
* Note : function is used in context of some date-string functions.
*/
int
lang_set_flag_from_lang_id (const INTL_LANG lang, bool has_user_format, bool has_user_lang, int *flag)
{
int lang_val = (int) lang;

*flag = 0;
Expand All @@ -2351,13 +2321,15 @@ lang_set_flag_from_lang_id (const INTL_LANG lang, bool has_user_format, bool has
if (lang_val >= lang_Count_locales)
{
lang_val = (int) INTL_LANG_ENGLISH;
*flag |= lang_val << 2;
return 1;
status = 1;
}

*flag |= lang_val << 2;
*flag |= (lang_val << 2);

return 0;
assert (((*flag) & LANG_LOADED_LOCALES_PARITY_MASK) == 0);
*flag |= LANG_LOADED_LOCALES_PARITY;

return status;
}

/*
Expand All @@ -2378,7 +2350,8 @@ lang_get_lang_id_from_flag (const int flag, bool * has_user_format, bool * has_u
*has_user_format = ((flag & 0x1) == 0x1) ? true : false;
*has_user_lang = ((flag & 0x2) == 0x2) ? true : false;

lang_val = flag >> 2;
assert ((flag & LANG_LOADED_LOCALES_PARITY_MASK) == LANG_LOADED_LOCALES_PARITY);
lang_val = (flag & ~LANG_LOADED_LOCALES_PARITY_MASK) >> 2;

if (lang_val >= 0 && lang_val < lang_Count_locales)
{
Expand Down
3 changes: 2 additions & 1 deletion src/base/language_support.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
#define LANG_MAX_COLLATIONS 256
#define LANG_MAX_BUILTIN_COLLATIONS 32
#define LANG_MAX_LOADED_LOCALES 32
#define LANG_LOADED_LOCALES_PARITY_MASK 0xFFFFF000
#define LANG_LOADED_LOCALES_PARITY 0x75A5C000

#define LANG_COERCIBLE_COLL LANG_SYS_COLLATION
#define LANG_COERCIBLE_CODESET LANG_SYS_CODESET
Expand Down Expand Up @@ -300,7 +302,6 @@ extern "C"
extern int lang_get_lang_id_from_name (const char *lang_name, INTL_LANG * lang_id);
extern const char *lang_get_lang_name_from_id (const INTL_LANG lang_id);
extern int lang_set_flag_from_lang (const char *lang_str, bool has_user_format, bool has_user_lang, int *flag);
extern int lang_set_flag_from_lang_id (const INTL_LANG lang, bool has_user_format, bool has_user_lang, int *flag);
extern INTL_LANG lang_get_lang_id_from_flag (const int flag, bool * has_user_format, bool * has_user_lang);
extern const char *lang_date_format_parse (const INTL_LANG lang_id, const INTL_CODESET codeset, const DB_TYPE type,
INTL_CODESET * format_codeset);
Expand Down
2 changes: 1 addition & 1 deletion src/base/system_parameter.c
Original file line number Diff line number Diff line change
Expand Up @@ -3626,7 +3626,7 @@ SYSPRM_PARAM prm_Def[] = {
(DUP_PRM_FUNC) NULL},
{PRM_ID_AUTO_RESTART_SERVER,
PRM_NAME_AUTO_RESTART_SERVER,
(PRM_FOR_SERVER | PRM_USER_CHANGE),
(PRM_FOR_CLIENT | PRM_USER_CHANGE),
PRM_BOOLEAN,
&prm_auto_restart_server_flag,
(void *) &prm_auto_restart_server_default,
Expand Down
7 changes: 4 additions & 3 deletions src/compat/dbtype_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -537,10 +537,11 @@ extern "C"
/* The lower limit for a number that can be represented by a numeric type */
#define DB_NUMERIC_UNDERFLOW_LIMIT 1e-38

/* The maximum precision of CHAR(n) domain that can be specified for an INTL_UTF8_MAX_CHAR_SIZE.
* We may need to define this functionally as the maximum precision will depend on the size multiplier of the codeset.
/*
* Change the maximum length of CHAR type to 2048 for memory allocation and performance.
* Refer to CBRD-25713
*/
#define DB_MAX_CHAR_PRECISION (DB_MAX_STRING_LENGTH/4)
#define DB_MAX_CHAR_PRECISION 2048

/* The maximum precision that can be specified for a CHARACTER VARYING domain.*/
#define DB_MAX_VARCHAR_PRECISION DB_MAX_STRING_LENGTH
Expand Down
1 change: 1 addition & 0 deletions src/connection/connection_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ enum css_client_request
CANCEL_SHUTDOWN = 15,
GET_SHUTDOWN_TIME = 16,
KILL_SERVER_IMMEDIATE = 17,
SHUTDOWN_REVIVING_SERVER = 18,
GET_REPL_LIST = 20, /* REPL: get the info. for a process */
GET_ALL_LIST = 21, /* REPL: get the info. for all processes */
GET_REPL_COUNT = 22, /* REPL: get the # of repl processes */
Expand Down
22 changes: 22 additions & 0 deletions src/connection/connection_globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

#define CSS_MAX_CLIENT_COUNT 4000

#define CSS_SERVER_PROC_REGISTER_INITIALIZER {-1, "", 0, "", ""}

typedef bool (*CSS_CHECK_CLIENT_TYPE) (BOOT_CLIENT_TYPE client_type);
typedef int (*CSS_GET_MAX_CONN_NUM) (void);

Expand All @@ -57,6 +59,26 @@ typedef struct css_conn_rule_info
int num_curr_conn;
} CSS_CONN_RULE_INFO;

/*
* server register resource message body
*/

/* process register */
typedef struct css_server_proc_register CSS_SERVER_PROC_REGISTER;
struct css_server_proc_register
{
static constexpr int CSS_SERVER_MAX_SZ_SERVER_NAME = 256;
static constexpr int CSS_SERVER_MAX_SZ_PROC_EXEC_PATH = 128;
static constexpr int CSS_SERVER_MAX_SZ_PROC_ARGS = 1024;

int pid;
char server_name[CSS_SERVER_MAX_SZ_SERVER_NAME];
int server_name_length;

char exec_path[CSS_SERVER_MAX_SZ_PROC_EXEC_PATH];
char args[CSS_SERVER_MAX_SZ_PROC_ARGS];
};

extern int css_Service_id;
extern const char *css_Service_name;

Expand Down
69 changes: 68 additions & 1 deletion src/connection/connection_sr.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ CSS_THREAD_FN css_Request_handler = NULL;
/* This will handle closed connection errors */
CSS_THREAD_FN css_Connection_error_handler = NULL;

static char css_Server_exec_path[PATH_MAX];
static char **css_Server_argv;

#define CSS_CONN_IDX(conn_arg) ((conn_arg) - css_Conn_array)

#define CSS_FREE_CONN_MSG "Free count = %d, head = %d"
Expand Down Expand Up @@ -1073,6 +1076,32 @@ css_common_connect (CSS_CONN_ENTRY * conn, unsigned short *rid,
return NULL;
}

/*
* css_set_proc_register() - make a server proc register.
* return:
* server_name(in):
* server_name_lenth(in):
* proc_register(out):
*/
static void
css_set_proc_register (const char *server_name, int server_name_length, CSS_SERVER_PROC_REGISTER * proc_register)
{
char *p, *last;
char **argv;

memcpy (proc_register->server_name, server_name, server_name_length);
proc_register->server_name_length = server_name_length;
proc_register->pid = getpid ();
strncpy_bufsize (proc_register->exec_path, css_Server_exec_path);

p = (char *) proc_register->args;
last = p + proc_register->CSS_SERVER_MAX_SZ_PROC_ARGS;
for (argv = css_Server_argv; *argv; argv++)
{
p += snprintf (p, MAX ((last - p), 0), "%s ", *argv);
}
}

/*
* css_connect_to_master_server() - Connect to the master from the server.
* return: connection entry if success, or NULL
Expand All @@ -1093,6 +1122,9 @@ css_connect_to_master_server (int master_port_id, const char *server_name, int n
std::string pname;
int datagram_fd, socket_fd;
#endif
const char *data;
int data_length;
CSS_SERVER_PROC_REGISTER proc_register = CSS_SERVER_PROC_REGISTER_INITIALIZER;

css_Service_id = master_port_id;
if (GETHOSTNAME (hname, CUB_MAXHOSTNAMELEN) != 0)
Expand All @@ -1108,18 +1140,27 @@ css_connect_to_master_server (int master_port_id, const char *server_name, int n
}

/* select the connection protocol */

// TODO : When supporting the Windows environment, It will be modified to send the same data
// (proc_register) for the Windows protocol (SERVER_REQUEST_NEW) as well.

if (css_Server_use_new_connection_protocol)
{
// Windows
connection_protocol = SERVER_REQUEST_NEW;
data = server_name;
data_length = name_length;
}
else
{
// Linux and Unix
connection_protocol = SERVER_REQUEST;
css_set_proc_register (server_name, name_length, &proc_register);
data = (const char *) &proc_register;
data_length = sizeof (proc_register);
}

if (css_common_connect (conn, &rid, hname, connection_protocol, server_name, name_length, master_port_id) == NULL)
if (css_common_connect (conn, &rid, hname, connection_protocol, data, data_length, master_port_id) == NULL)
{
goto fail_end;
}
Expand Down Expand Up @@ -3122,3 +3163,29 @@ css_free_user_access_status (void)

return;
}

/*
* css_set_exec_path () -
* return: none
*
* exec_path(in):
*/
void
css_set_exec_path (char *exec_path)
{
assert (exec_path != NULL);
strncpy (css_Server_exec_path, exec_path, sizeof (css_Server_exec_path) - 1);
}

/*
* css_set_argv () -
* return: none
*
* argv(in):
*/
void
css_set_argv (char **argv)
{
assert (argv != NULL);
css_Server_argv = argv;
}
3 changes: 3 additions & 0 deletions src/connection/connection_sr.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,7 @@ extern void css_set_user_access_status (const char *db_user, const char *host, c
extern void css_get_user_access_status (int num_user, LAST_ACCESS_STATUS ** access_status_array);
extern void css_free_user_access_status (void);

extern void css_set_exec_path (char *exec_path);
extern void css_set_argv (char **argv);

#endif /* _CONNECTION_SR_H_ */
Loading

0 comments on commit 03a16cf

Please sign in to comment.