66 #define PASSBUF_SIZE 12 67 #define SPACEDB_NUM_VOL_PURPOSE 2 68 #define MAX_KILLTRAN_INDEX_LIST_NUM 64 69 #define MAX_DELVOL_ID_LIST_NUM 64 71 #define VOL_PURPOSE_STRING(VOL_PURPOSE) \ 72 ((VOL_PURPOSE == DB_PERMANENT_DATA_PURPOSE) ? "PERMANENT DATA" \ 73 : (VOL_PURPOSE == DB_TEMPORARY_DATA_PURPOSE) ? "TEMPORARY DATA" \ 124 char er_msg_file[PATH_MAX];
126 const char *backup_path =
NULL;
127 bool remove_log_archives =
false;
129 const char *backup_verbose_file =
NULL;
130 bool no_check =
false;
132 int backup_num_threads;
138 bool skip_activelog =
false;
141 char real_pathbuf[PATH_MAX];
142 char verbose_file_realpath[PATH_MAX];
146 goto print_backup_usage;
150 if (database_name ==
NULL)
152 goto print_backup_usage;
165 skip_activelog =
false;
174 goto print_backup_usage;
177 if (sa_mode && backup_num_threads > 1)
185 goto print_backup_usage;
190 goto print_backup_usage;
205 if (backup_path !=
NULL)
207 memset (real_pathbuf, 0,
sizeof (real_pathbuf));
208 if (realpath (backup_path, real_pathbuf) !=
NULL)
210 backup_path = real_pathbuf;
214 if (stat (backup_path, &st_buf) != 0)
220 else if (!S_ISDIR (st_buf.st_mode))
222 #if !defined (WINDOWS) 224 if (!S_ISFIFO (st_buf.st_mode))
231 #if !defined (WINDOWS) 232 else if (separate_keys)
255 snprintf (er_msg_file,
sizeof (er_msg_file) - 1,
"%s_%s.err", database_name, arg->
command_name);
288 tmpname =
"/dev/null";
306 if (backup_verbose_file && *backup_verbose_file && *backup_verbose_file !=
'/')
311 if (getcwd (dirname, PATH_MAX) !=
NULL)
313 if (snprintf (verbose_file_realpath, PATH_MAX - 1,
"%s/%s", dirname, backup_verbose_file) < 0)
319 backup_verbose_file = verbose_file_realpath;
324 backup_num_threads, backup_zip_method, backup_zip_level, skip_activelog, sleep_msecs,
358 char er_msg_file[PATH_MAX];
361 UINT64 volext_max_writesize;
362 const char *volext_string_purpose =
NULL;
363 const char *volext_npages_string =
NULL;
364 const char *volext_size_str =
NULL;
365 const char *volext_max_writesize_in_sec_str =
NULL;
366 char real_volext_path_buf[PATH_MAX];
374 goto print_addvol_usage;
378 if (database_name ==
NULL)
380 goto print_addvol_usage;
384 if (volext_npages_string)
387 ext_info.
max_npages = atoi (volext_npages_string);
396 goto print_addvol_usage;
401 if (volext_max_writesize_in_sec_str)
405 goto print_addvol_usage;
418 memset (real_volext_path_buf, 0,
sizeof (real_volext_path_buf));
419 if (realpath (ext_info.
path, real_volext_path_buf) !=
NULL)
421 ext_info.
path = real_volext_path_buf;
426 if (volext_string_purpose ==
NULL)
428 volext_string_purpose =
"generic";
433 if (strcasecmp (volext_string_purpose,
"data") == 0)
437 else if (strcasecmp (volext_string_purpose,
"index") == 0)
441 else if (strcasecmp (volext_string_purpose,
"temp") == 0)
445 else if (strcasecmp (volext_string_purpose,
"generic") == 0)
452 volext_string_purpose);
472 snprintf (er_msg_file,
sizeof (er_msg_file) - 1,
"%s_%s.err", database_name, arg->
command_name);
484 if (volext_size == 0)
547 int num_tables =
da_size (darray);
550 oids = (
OID *) malloc (
sizeof (
OID) * num_tables);
558 for (i = 0; i < num_tables; i++)
567 if (table ==
NULL || table[0] ==
'\0')
575 obj = (
MOBJ *) & cls_sm;
584 cls_oid =
ws_oid (cls_mop);
596 if (index_name !=
NULL)
599 if (constraint ==
NULL)
624 char er_msg_file[PATH_MAX];
627 char *index_name =
NULL;
629 bool repair_plink =
false;
638 goto print_check_usage;
642 if (database_name ==
NULL)
644 goto print_check_usage;
709 if (index_name !=
NULL && num_tables != 1)
728 for (i = 0; i < num_tables; i++)
756 snprintf (er_msg_file,
sizeof (er_msg_file) - 1,
"%s_%s.err", database_name, arg->
command_name);
784 tmpname =
"/dev/null";
789 if (repair_plink || repair)
797 if (repair_plink || repair)
846 #define SPACEDB_TO_SIZE_ARG(no, npage) spacedb_get_size_str (size_str_##no, npage, size_unit_type) 849 char er_msg_file[PATH_MAX];
853 const char *size_unit;
856 bool summarize, purpose;
858 char io_size_str[64], log_size_str[64];
871 const char *file_type_strings[] = {
872 "INDEX",
"HEAP",
"SYSTEM",
"TEMP",
"-" 879 goto print_space_usage;
883 if (database_name ==
NULL)
885 goto print_space_usage;
895 if (size_unit !=
NULL)
897 if (strcasecmp (size_unit,
"page") == 0)
901 else if (strcasecmp (size_unit,
"m") == 0)
905 else if (strcasecmp (size_unit,
"g") == 0)
909 else if (strcasecmp (size_unit,
"t") == 0)
913 else if (strcasecmp (size_unit,
"h") != 0)
916 goto print_space_usage;
920 if (output_file ==
NULL)
926 outfp = fopen (output_file,
"w");
941 snprintf (er_msg_file,
sizeof (er_msg_file) - 1,
"%s_%s.err", database_name, arg->
command_name);
983 io_size_str, log_size_str);
984 fprintf (outfp,
"\n");
1006 fprintf (outfp,
"\n");
1051 fprintf (outfp,
"\n");
1077 file_type_strings[i], files[i].nfile,
1080 SPACEDB_TO_SIZE_ARG (4, files[i].npage_user + files[i].npage_ftab + files[i].npage_reserved));
1082 fprintf (outfp,
"\n");
1092 if (outfp != stdout)
1102 return EXIT_SUCCESS;
1110 if (outfp != stdout && outfp !=
NULL)
1118 return EXIT_FAILURE;
1120 #undef SPACEDB_TO_SIZE_ARG 1130 #if defined (CS_MODE) 1132 char er_msg_file[PATH_MAX];
1135 int ret_code = EXIT_SUCCESS;
1139 goto print_acl_usage;
1145 if (database_name ==
NULL)
1147 goto print_acl_usage;
1156 sprintf (er_msg_file,
"%s_%s.err", database_name, arg->
command_name);
1190 return EXIT_FAILURE;
1194 return EXIT_FAILURE;
1205 #if defined (CS_MODE) 1207 char er_msg_file[PATH_MAX];
1214 goto print_lock_usage;
1218 if (database_name ==
NULL)
1220 goto print_lock_usage;
1224 if (output_file ==
NULL)
1230 outfp = fopen (output_file,
"w");
1245 snprintf (er_msg_file,
sizeof (er_msg_file) - 1,
"%s_%s.err", database_name, arg->
command_name);
1264 if (outfp != stdout)
1269 return EXIT_SUCCESS;
1277 if (outfp != stdout && outfp !=
NULL)
1281 return EXIT_FAILURE;
1285 return EXIT_FAILURE;
1316 const char *hostname,
const char *
progname,
const char *sql_id)
1325 if ((username !=
NULL && strcmp (tran->
login_name, username) == 0)
1326 || (hostname !=
NULL && strcmp (tran->
host_name, hostname) == 0)
1333 for (i = 0; i < index_list_size; i++)
1410 fprintf (stdout,
"\n");
1421 for (j = i + 1; j < info->
num_trans; j++)
1432 fprintf (stdout,
"\n");
1472 const char *
progname,
const char *sql_id,
bool verify)
1475 int nkills = 0, nfailures = 0;
1536 if (ch ==
'Y' || ch ==
'y')
1608 char tmp_query_buf[32];
1610 if (tran_info ==
NULL)
1625 if (full_sqltext ==
true)
1632 tmp_query_buf[31] =
'\0';
1633 query_buf = tmp_query_buf;
1674 #if defined (CS_MODE) 1676 char er_msg_file[PATH_MAX];
1678 #if defined(NEED_PRIVILEGE_PASSWORD) 1679 const char *username;
1680 const char *password;
1682 char *passbuf =
NULL;
1685 bool is_summary, include_query_info, full_sqltext =
false;
1690 goto print_tranlist_usage;
1694 if (database_name ==
NULL)
1696 goto print_tranlist_usage;
1699 #if defined(NEED_PRIVILEGE_PASSWORD) 1708 #if defined(NEED_PRIVILEGE_PASSWORD) 1709 if (username ==
NULL)
1729 snprintf (er_msg_file,
sizeof (er_msg_file) - 1,
"%s_%s.err", database_name, arg->
command_name);
1732 #if defined(NEED_PRIVILEGE_PASSWORD) 1745 snprintf (msg_buf, 64,
1749 passbuf = getpass (msg_buf);
1751 if (passbuf[0] ==
'\0')
1753 passbuf = (
char *)
NULL;
1793 include_query_info = !is_summary;
1813 (void)
dump_trantb (info, dump_level, full_sqltext);
1821 return EXIT_SUCCESS;
1823 print_tranlist_usage:
1829 return EXIT_FAILURE;
1833 return EXIT_FAILURE;
1844 #if defined (CS_MODE) 1846 char er_msg_file[PATH_MAX];
1848 const char *kill_tran_index;
1849 const char *kill_progname;
1850 const char *kill_user;
1851 const char *kill_host;
1852 const char *kill_sql_id;
1853 const char *dba_password;
1854 bool dump_trantab_flag;
1857 char *passbuf =
NULL;
1860 bool include_query_exec_info;
1864 char delimiter =
',';
1870 goto print_killtran_usage;
1874 if (database_name ==
NULL)
1876 goto print_killtran_usage;
1897 if (kill_tran_index !=
NULL &&
strlen (kill_tran_index) != 0)
1901 if (kill_user !=
NULL &&
strlen (kill_user) != 0)
1905 if (kill_host !=
NULL &&
strlen (kill_host) != 0)
1909 if (kill_progname !=
NULL &&
strlen (kill_progname) != 0)
1913 if (kill_sql_id !=
NULL &&
strlen (kill_sql_id) != 0)
1925 snprintf (er_msg_file,
sizeof (er_msg_file) - 1,
"%s_%s.err", database_name, arg->
command_name);
1931 if (dba_password !=
NULL)
1933 goto print_killtran_usage;
1961 if (passbuf[0] ==
'\0')
1963 passbuf = (
char *)
NULL;
1965 dba_password = passbuf;
2001 if (dump_trantab_flag || include_query_exec_info
2002 || ((kill_tran_index ==
NULL ||
strlen (kill_tran_index) == 0) && (kill_user ==
NULL ||
strlen (kill_user) == 0)
2003 && (kill_host ==
NULL ||
strlen (kill_host) == 0) && (kill_progname ==
NULL ||
strlen (kill_progname) == 0)
2004 && (kill_sql_id ==
NULL ||
strlen (kill_sql_id) == 0)))
2013 if (kill_tran_index !=
NULL &&
strlen (kill_tran_index) > 0)
2017 ptr = kill_tran_index;
2019 tmp = (
char *) strchr (ptr, delimiter);
2020 while (*ptr !=
'\0' && tmp)
2029 if (result != 0 || value <= 0)
2041 tran_index_list[list_size++] = value;
2043 tmp = (
char *) strchr (ptr, delimiter);
2047 if (result != 0 || value <= 0)
2061 tran_index_list[list_size++] = value;
2066 if (
kill_transactions (info, tran_index_list, list_size, kill_user, kill_host, kill_progname, kill_sql_id, !force)
2084 return EXIT_SUCCESS;
2086 print_killtran_usage:
2092 return EXIT_FAILURE;
2096 return EXIT_FAILURE;
2107 #if defined (CS_MODE) 2109 char er_msg_file[PATH_MAX];
2112 bool drop_flag =
false;
2116 if (database_name ==
NULL)
2118 goto print_plandump_usage;
2126 goto print_plandump_usage;
2129 if (output_file ==
NULL)
2135 outfp = fopen (output_file,
"w");
2150 snprintf (er_msg_file,
sizeof (er_msg_file) - 1,
"%s_%s.err", database_name, arg->
command_name);
2176 if (outfp != stdout)
2181 return EXIT_SUCCESS;
2183 print_plandump_usage:
2189 if (outfp != stdout && outfp !=
NULL)
2193 return EXIT_FAILURE;
2197 return EXIT_FAILURE;
2209 char er_msg_file[PATH_MAX];
2212 bool both_flag =
false;
2217 goto print_dumpparam_usage;
2221 if (database_name ==
NULL)
2223 goto print_dumpparam_usage;
2229 if (output_file ==
NULL)
2235 outfp = fopen (output_file,
"w");
2250 snprintf (er_msg_file,
sizeof (er_msg_file) - 1,
"%s_%s.err", database_name, arg->
command_name);
2255 #if defined (CS_MODE) 2271 fprintf (outfp,
"\n");
2285 if (outfp != stdout)
2290 return EXIT_SUCCESS;
2292 print_dumpparam_usage:
2298 if (outfp != stdout && outfp !=
NULL)
2302 return EXIT_FAILURE;
2314 strftime (str, 80,
"%a %B %d %H:%M:%S %Z %Y", &tmloc);
2315 fprintf (outfp,
"\n\t%s\n", str);
2325 #if defined (CS_MODE) 2327 char er_msg_file[PATH_MAX];
2337 goto print_statdump_usage;
2341 if (database_name ==
NULL)
2343 goto print_statdump_usage;
2350 goto print_statdump_usage;
2360 if (output_file ==
NULL)
2366 outfp = fopen (output_file,
"w");
2381 snprintf (er_msg_file,
sizeof (er_msg_file) - 1,
"%s_%s.err", database_name, arg->
command_name);
2403 #if defined(WINDOWS) 2427 if (outfp != stdout)
2432 return EXIT_SUCCESS;
2434 print_statdump_usage:
2440 if (outfp != stdout && outfp !=
NULL)
2444 return EXIT_FAILURE;
2449 return EXIT_FAILURE;
2453 #if defined (ENABLE_UNUSED_FUNCTION) 2456 check_server_ha_mode (
void)
2458 char prm_buf[LINE_MAX], *prm_val;
2465 prm_val = strchr (prm_buf,
'=');
2466 if (prm_val ==
NULL)
2470 if (strcmp (prm_val + 1,
"y") != 0)
2488 #if defined (WINDOWS) 2492 return EXIT_FAILURE;
2494 #if defined (CS_MODE) 2496 char er_msg_file[PATH_MAX];
2506 goto print_changemode_usage;
2510 if (database_name ==
NULL)
2512 goto print_changemode_usage;
2530 if (mode_name !=
NULL)
2535 if (sscanf (mode_name,
"%d", &keyval) != 1)
2553 snprintf (er_msg_file,
sizeof (er_msg_file) - 1,
"%s_%s.err", database_name, arg->
command_name);
2577 if (mode_name ==
NULL)
2589 int keyval = (int) ha_state;
2594 (mode_name ? mode_name :
"unknown"));
2600 database_name, mode_name);
2611 return EXIT_SUCCESS;
2613 print_changemode_usage:
2619 return EXIT_FAILURE;
2623 return EXIT_FAILURE;
2635 #if defined (WINDOWS) 2638 return EXIT_FAILURE;
2640 #if defined (CS_MODE) 2642 char er_msg_file[PATH_MAX];
2644 const char *log_path;
2645 char log_path_buf[PATH_MAX];
2649 int retried = 0, sleep_nsecs = 1;
2650 bool need_er_reinit =
false;
2651 unsigned long num_db_restarted = 0;
2652 #if !defined(WINDOWS) 2656 INT64 start_pageid = 0;
2660 goto print_copylog_usage;
2664 if (database_name ==
NULL)
2666 goto print_copylog_usage;
2676 if (log_path !=
NULL)
2678 log_path = realpath (log_path, log_path_buf);
2680 if (log_path ==
NULL)
2682 goto print_copylog_usage;
2685 if (mode_name !=
NULL)
2689 if (sscanf (mode_name,
"%d", &mode) != 1)
2721 snprintf (er_msg_file,
sizeof (er_msg_file) - 1,
"%s_%s.err", database_name, arg->
command_name);
2731 #if !defined(WINDOWS) 2764 return EXIT_FAILURE;
2766 er_set_ignore_uninit (
true);
2774 if (retried % 10 == 0)
2780 num_db_restarted += 1;
2785 need_er_reinit =
false;
2809 return EXIT_SUCCESS;
2811 print_copylog_usage:
2816 return EXIT_FAILURE;
2819 #if !defined(WINDOWS) 2822 return EXIT_SUCCESS;
2830 (void) sleep (sleep_nsecs);
2832 if (num_db_restarted > 0)
2835 if (sleep_nsecs > 30)
2841 need_er_reinit =
true;
2848 return EXIT_FAILURE;
2852 return EXIT_FAILURE;
2864 #if defined (WINDOWS) 2868 return EXIT_FAILURE;
2870 #if defined (CS_MODE) 2872 char er_msg_file[PATH_MAX];
2874 const char *log_path =
NULL;
2875 char log_path_buf[PATH_MAX];
2876 char *log_path_base;
2877 int max_mem_size = 0;
2879 int retried = 0, sleep_nsecs = 1;
2880 bool need_er_reinit =
false;
2881 char *replica_time_bound_str;
2882 #if !defined(WINDOWS) 2889 goto print_applylog_usage;
2893 if (database_name ==
NULL)
2895 goto print_applylog_usage;
2905 if (log_path !=
NULL)
2907 log_path = realpath (log_path, log_path_buf);
2909 if (log_path ==
NULL)
2911 goto print_applylog_usage;
2919 log_path_base =
strdup (log_path);
2920 snprintf (er_msg_file,
sizeof (er_msg_file) - 1,
"%s_%s_%s.err", database_name, arg->
command_name,
2922 free (log_path_base);
2933 #if !defined(WINDOWS) 2960 return EXIT_FAILURE;
2962 er_set_ignore_uninit (
true);
2968 if (replica_time_bound_str !=
NULL)
2975 "(the correct format: YYYY-MM-DD hh:mm:ss)");
2976 return EXIT_FAILURE;
2996 need_er_reinit =
false;
3027 return EXIT_SUCCESS;
3029 print_applylog_usage:
3035 #if !defined(WINDOWS) 3038 return EXIT_SUCCESS;
3047 (void) sleep (sleep_nsecs);
3049 if ((sleep_nsecs *= 2) > 10)
3053 need_er_reinit =
true;
3058 return EXIT_FAILURE;
3064 return EXIT_FAILURE;
3083 #define UNIT_STR(un) (((un) == SPACEDB_SIZE_UNIT_MBYTES) ? 'M' : ((un) == SPACEDB_SIZE_UNIT_GBYTES) ? 'G' : 'T') 3091 sprintf (buf,
"%13llu", (
long long unsigned int) num_pages);
3096 size = pgsize * ((double) num_pages);
3109 sprintf (buf,
"%9.1f %c", size,
UNIT_STR (i));
3117 sprintf (buf,
"%9.1f %c", size,
UNIT_STR (size_unit));
3132 #if defined (WINDOWS) 3136 return EXIT_FAILURE;
3138 #if defined (CS_MODE) 3140 char er_msg_file[PATH_MAX];
3142 const char *master_node_name;
3145 bool check_applied_info, check_copied_info;
3146 bool check_master_info, check_replica_info;
3148 const char *log_path;
3149 char log_path_buf[PATH_MAX];
3153 float process_rate = 0.0f;
3154 char *replica_time_bound_str;
3156 LOG_LSA master_eof_lsa, applied_final_lsa;
3157 LOG_LSA copied_append_lsa, copied_eof_lsa;
3158 LOG_LSA initial_copied_append_lsa, initial_applied_final_lsa;
3161 start_time = time (
NULL);
3172 goto print_applyinfo_usage;
3175 check_applied_info = check_copied_info =
false;
3176 check_replica_info = check_master_info =
false;
3179 if (database_name ==
NULL)
3181 goto print_applyinfo_usage;
3188 return EXIT_FAILURE;
3192 if (master_node_name !=
NULL)
3194 check_master_info =
true;
3199 if (log_path !=
NULL)
3201 log_path = realpath (log_path, log_path_buf);
3203 if (log_path !=
NULL)
3205 check_copied_info =
true;
3208 if (check_applied_info && (log_path ==
NULL))
3210 goto print_applyinfo_usage;
3220 goto print_applyinfo_usage;
3223 if (check_replica_info)
3226 if (replica_time_bound_str !=
NULL)
3233 "(the correct format: YYYY-MM-DD hh:mm:ss)");
3234 return EXIT_FAILURE;
3243 sprintf (er_msg_file,
"%s_%s.err", database_name, arg->
command_name);
3247 #if defined(WINDOWS) 3256 if (check_applied_info)
3259 strcpy (local_database_name, database_name);
3260 strcat (local_database_name,
"@localhost");
3266 goto check_applied_info_end;
3270 goto check_applied_info_end;
3275 goto check_applied_info_end;
3282 goto check_applied_info_end;
3285 error =
la_log_page_check (local_database_name, log_path, pageid, check_applied_info, check_copied_info,
3286 check_replica_info, verbose, &copied_eof_lsa, &copied_append_lsa,
3287 &applied_final_lsa);
3290 else if (check_copied_info)
3293 strcpy (local_database_name, database_name);
3294 strcat (local_database_name,
"@localhost");
3296 error =
la_log_page_check (local_database_name, log_path, pageid, check_applied_info, check_copied_info,
3297 check_replica_info, verbose, &copied_eof_lsa, &copied_append_lsa,
3298 &applied_final_lsa);
3301 check_applied_info_end:
3308 if (check_master_info)
3311 strcpy (master_database_name, database_name);
3312 strcat (master_database_name,
"@");
3313 strcat (master_database_name, master_node_name);
3319 goto check_master_info_end;
3324 goto check_master_info_end;
3330 goto check_master_info_end;
3333 error = logwr_copy_log_header_check (master_database_name, verbose, &master_eof_lsa);
3336 goto check_master_info_end;
3342 check_master_info_end:
3350 cur_time = time (
NULL);
3351 if (check_copied_info && check_master_info)
3353 if (!
LSA_ISNULL (&initial_copied_append_lsa))
3360 initial_copied_append_lsa = copied_append_lsa;
3361 process_rate = 0.0f;
3364 printf (
"\n *** Delay in Copying Active Log *** \n");
3368 if (check_applied_info)
3370 if (!
LSA_ISNULL (&initial_applied_final_lsa))
3377 initial_applied_final_lsa = applied_final_lsa;
3378 process_rate = 0.0f;
3381 printf (
"\n *** Delay in Applying Copied Log *** \n");
3389 return EXIT_SUCCESS;
3391 print_applyinfo_usage:
3396 return EXIT_FAILURE;
3400 return EXIT_FAILURE;
3410 #if defined(WINDOWS) 3419 #if defined(WINDOWS) 3420 if (sig_no == CTRL_C_EVENT)
3439 const char *str_key1 =
NULL, *str_key2 =
NULL;
3440 double number_key1 = 0, number_key2 = 0;
3503 switch (column_type)
3508 if (number_key1 == number_key2)
3512 else if (number_key1 > number_key2)
3524 if (str_key1 ==
NULL && str_key2 ==
NULL)
3528 else if (str_key1 ==
NULL && str_key2 !=
NULL)
3532 else if (str_key1 !=
NULL && str_key2 ==
NULL)
3538 ret = strcmp (str_key1, str_key2);
3563 char er_msg_file[PATH_MAX];
3570 goto print_check_usage;
3574 if (database_name ==
NULL)
3576 goto print_check_usage;
3589 if (output_file ==
NULL)
3595 outfp = fopen (output_file,
"w");
3606 #if defined(SA_MODE) 3608 snprintf (er_msg_file,
sizeof (er_msg_file) - 1,
"%s_%s.err", database_name, arg->
command_name);
3632 if (outfp != stdout)
3641 const char *tmpname;
3645 tmpname =
"/dev/null";
3663 return EXIT_SUCCESS;
3668 snprintf (er_msg_file,
sizeof (er_msg_file) - 1,
"%s_%s.err", database_name, arg->
command_name);
3686 if (outfp != stdout)
3699 return EXIT_SUCCESS;
3708 return EXIT_FAILURE;
3719 char er_msg_file[PATH_MAX];
3720 char mk_path[PATH_MAX] = { 0, };
3722 const char *dba_password;
3735 goto print_tde_usage;
3739 if (database_name ==
NULL)
3741 goto print_tde_usage;
3760 if (change_op_idx != -1)
3764 if (delete_op_idx != -1)
3773 goto print_tde_usage;
3777 if (change_op_idx < -1)
3779 goto print_tde_usage;
3781 if (delete_op_idx < -1)
3783 goto print_tde_usage;
3793 snprintf (er_msg_file,
sizeof (er_msg_file) - 1,
"%s_%s.err", database_name, arg->
command_name);
3817 if (passbuf[0] ==
'\0')
3819 passbuf = (
char *)
NULL;
3821 dba_password = passbuf;
3847 printf (
"Key File: %s\n", mk_path);
3869 time_t created_time;
3884 ctime_r (&created_time, ctime_buf);
3885 printf (
"SUCCESS: ");
3897 time_t created_time, set_time;
3901 printf (
"The current key set on %s:\n", database_name);
3904 ctime_r (&created_time, ctime_buf1);
3905 ctime_r (&set_time, ctime_buf2);
3907 printf (
"Key Index: %d\n", mk_index);
3908 printf (
"Created on %s", ctime_buf1);
3909 printf (
"Set on %s", ctime_buf2);
3924 else if (change_op_idx != -1)
3927 time_t created_time, set_time;
3953 printf (
"SUCCESS: ");
3957 else if (delete_op_idx != -1)
3960 time_t created_time, set_time;
3968 if (mk_index == delete_op_idx)
3982 printf (
"SUCCESS: ");
3988 return EXIT_SUCCESS;
3994 return EXIT_FAILURE;
static int isvalid_transaction(const ONE_TRAN_INFO *tran)
#define KILLTRAN_KILL_TRANSACTION_INDEX_S
bool la_force_shutdown(void)
#define APPLYINFO_COPIED_LOG_PATH_S
#define TDE_GENERATE_KEY_S
static void print_timestamp(FILE *outfp)
void db_set_interrupt(int set)
int vacuumdb(UTIL_FUNCTION_ARG *arg)
char * dirname(const char *path)
static bool is_Sigint_caught
#define APPLYLOG_MAX_MEM_SIZE_S
#define KILLTRAN_DISPLAY_QUERY_INFO_S
#define CHECK_FILE_TRACKER_S
void db_set_client_type(int client_type)
#define PRINT_AND_LOG_ERR_MSG(...)
static bool tranlist_Sort_desc
int sysprm_set_force(const char *pname, const char *pvalue)
void util_redirect_stdout_to_null(void)
int util_size_string_to_byte(UINT64 *size_num, const char *size_str)
int db_login(const char *name, const char *password)
#define APPLYLOG_LOG_PATH_S
#define VACUUM_OUTPUT_FILE_S
int da_destroy(dynamic_array *da)
int tde_change_mk_on_server(int mk_index)
int applyinfo(UTIL_FUNCTION_ARG *arg)
int parse_int(int *ret_p, const char *str_p, int base)
const char * boot_get_lob_path(void)
#define AU_DISABLE_PASSWORDS
const char * tran_get_tranlist_state_name(TRAN_STATE state)
int thread_kill_tran_index(int kill_tran_index, char *kill_user, char *kill_host, int kill_pid)
static OID * util_get_class_oids_and_index_btid(dynamic_array *darray, const char *index_name, BTID *index_btid)
#define KILLTRAN_KILL_USER_NAME_S
int statdump(UTIL_FUNCTION_ARG *arg)
void qmgr_dump_query_plans(FILE *outfp)
#define assert_release(e)
int util_get_table_list_from_file(char *fname, dynamic_array *darray)
#define ER_NET_CANT_CONNECT_SERVER
#define SM_MAX_IDENTIFIER_LENGTH
#define CHANGEMODE_TIMEOUT_S
int util_byte_to_size_string(char *buf, size_t len, UINT64 size_num)
int qmgr_drop_all_query_plans(void)
TRANS_INFO * logtb_get_trans_info(bool include_query_exec_info)
int check_volume_name(const char *name)
bool au_is_dba_group_member(MOP user)
void hb_set_exec_path(char *exec_path)
#define KILLTRAN_KILL_PROGRAM_NAME_S
#define CHECK_HEAP_ALLHEAPS_S
#define BACKUP_SEPARATE_KEYS_S
#define COPYLOG_LOG_PATH_S
int lockdb(UTIL_FUNCTION_ARG *arg)
int check_database_name(const char *name)
#define OID_SET_NULL(oidp)
void sm_downcase_name(const char *name, char *buf, int maxlen)
int tde_get_mk_file_path(char *mk_path)
MOP locator_find_class(const char *classname)
#define TRANLIST_SORT_KEY_S
#define CHECK_LC_CLASSNAMES_S
static void intr_handler(int sig_no)
#define PARAMDUMP_OUTPUT_FILE_S
static const char * progname
#define BACKUP_REMOVE_ARCHIVE_S
#define TRANLIST_FULL_SQL_S
#define BACKUP_NO_CHECK_S
#define er_log_debug(...)
#define APPLYINFO_APPLIED_INFO_S
#define TDE_PRINT_KEY_VALUE_S
void vacuum_dump(FILE *outfp)
#define CHECK_BTREE_ALL_BTREES_S
int util_log_write_errid(int message_id,...)
int la_log_page_check(const char *database_name, const char *log_path, INT64 page_num, bool check_applied_info, bool check_copied_info, bool check_replica_info, bool verbose, LOG_LSA *copied_eof_lsa, LOG_LSA *copied_append_lsa, LOG_LSA *applied_final_lsa)
#define XASL_ID_EQ(X1, X2)
bool db_disable_trigger(void)
int db_set_lock_timeout(int seconds)
#define STATDUMP_CUMULATIVE_S
int er_init(const char *msglog_filename, int exit_ask)
#define FILEIO_BACKUP_SLEEP_MSECS_AUTO
#define CHECK_INPUT_FILE_S
#define STATDUMP_INTERVAL_S
int fileio_mount(THREAD_ENTRY *thread_p, const char *db_full_name_p, const char *vol_label_p, VOLID vol_id, int lock_wait, bool is_do_sync)
#define STATDUMP_OUTPUT_FILE_S
#define CHECK_INDEXNAME_S
int utility_get_option_int_value(UTIL_ARG_MAP *arg_map, int arg_ch)
int tde_get_mk_info(int *mk_index, time_t *created_time, time_t *set_time)
const char * er_get_msglog_filename(void)
int tde_delete_mk(int vdes, int mk_index)
void util_print_deprecated(const char *option)
void hb_set_argv(char **argv)
int db_get_system_parameters(char *data, int len)
static bool doesmatch_transaction(const ONE_TRAN_INFO *tran, int *tran_index_list, int index_list_size, const char *username, const char *hostname, const char *progname, const char *sql_id)
UINT64 prm_get_bigint_value(PARAM_ID prm_id)
#define CHECK_LC_ALLENTRIES_OF_ALLBTREES_S
int boot_check_db_consistency(int check_flag, OID *oids, int num_oids, BTID *index_btid)
INT64 utility_get_option_bigint_value(UTIL_ARG_MAP *arg_map, int arg_ch)
void acl_dump(FILE *outfp)
int db_restart(const char *program, int print_version, const char *volume)
int histo_print_global_stats(FILE *stream, bool cumulative, const char *substr)
void er_set(int severity, const char *file_name, const int line_no, int err_id, int num_args,...)
int db_restart_ex(const char *program, const char *db_name, const char *db_user, const char *db_password, const char *preferred_hosts, int client_type)
#define ERR_CSS_TCP_CONNECT_TIMEDOUT
bool utility_get_option_bool_value(UTIL_ARG_MAP *arg_map, int arg_ch)
int acldb(UTIL_FUNCTION_ARG *arg)
#define ER_LC_PARTIALLY_FAILED_TO_FLUSH
#define TRANLIST_SUMMARY_S
int paramdump(UTIL_FUNCTION_ARG *arg)
int spacedb(UTIL_FUNCTION_ARG *arg)
int da_get(dynamic_array *da, int pos, void *data)
static void dump_trantb(TRANS_INFO *info, TRANDUMP_LEVEL dump_level, bool full_sqltext)
int tde_add_mk(int vdes, const unsigned char *master_key, time_t created_time, int *mk_index)
#define SPACE_OUTPUT_FILE_S
static char executable_path[PATH_MAX]
static void backupdb_sig_interrupt_handler(int sig_no)
int sysprm_load_and_init(const char *db_name, const char *conf_file, const int load_flags)
int la_apply_log_file(const char *database_name, const char *log_path, const int max_mem_size)
void tde_print_mk(const unsigned char *master_key)
int applylogdb(UTIL_FUNCTION_ARG *arg)
int utility_localtime(const time_t *ts, struct tm *result)
char * wait_for_tran_index_string
int plandump(UTIL_FUNCTION_ARG *arg)
int killtran(UTIL_FUNCTION_ARG *arg)
const char * db_error_string(int level)
static enum scanner_mode mode
int da_size(dynamic_array *da)
char * envvar_bindir_file(char *path, size_t size, const char *filename)
int substr(std::string &result, bool &is_matched, const cub_regex_object ®, const std::string &src, const int position, const int occurrence, const INTL_CODESET codeset)
int tranlist(UTIL_FUNCTION_ARG *arg)
int tde_create_mk(unsigned char *master_key, time_t *created_time)
#define APPLYINFO_REMOTE_NAME_S
dynamic_array * da_create(int count, size_t len)
#define BACKUP_OUTPUT_FILE_S
static int kill_transactions(TRANS_INFO *info, int *tran_index_list, int list_size, const char *username, const char *hostname, const char *progname, const char *sql_id, bool verify)
#define strncpy_bufsize(buf, str)
#define KILLTRAN_DISPLAY_INFORMATION_S
#define ADDVOL_VOLUME_NAME_S
int addvoldb(UTIL_FUNCTION_ARG *arg)
#define BACKUP_SLEEP_MSECS_S
void db_clear_host_connected(void)
static int print_tran_entry(const ONE_TRAN_INFO *tran_info, TRANDUMP_LEVEL dump_level, bool full_sqltext)
int boot_backup(const char *backup_path, FILEIO_BACKUP_LEVEL backup_level, bool delete_unneeded_logarchives, const char *backup_verbose_file, int num_threads, FILEIO_ZIP_METHOD zip_method, FILEIO_ZIP_LEVEL zip_level, int skip_activelog, int sleep_msecs, bool separate_keys)
bool LSA_ISNULL(const log_lsa *lsa_ptr)
#define BTID_SET_NULL(btid)
void logtb_free_trans_info(TRANS_INFO *info)
#define CHANGEMODE_FORCE_S
int checkdb(UTIL_FUNCTION_ARG *arg)
void sysprm_dump_parameters(FILE *fp)
#define COPYLOG_START_PAGEID_S
int sysprm_set_to_default(const char *pname, bool set_to_force)
BTID * db_constraint_index(DB_CONSTRAINT *constraint, BTID *index)
static struct timeval start_time
int hb_process_init(const char *server_name, const char *log_path, HB_PROC_TYPE type)
int db_set_isolation(DB_TRAN_ISOLATION isolation)
int utility_get_option_string_table_size(UTIL_ARG_MAP *arg_map)
#define HA_CHANGE_MODE_DEFAULT_TIMEOUT_IN_SECS
#define BACKUP_DESTINATION_PATH_S
#define KILLTRAN_KILL_HOST_NAME_S
int util_log_write_warnstr(const char *format,...)
HA_SERVER_STATE boot_change_ha_mode(HA_SERVER_STATE state, bool force, int timeout)
static void error(const char *msg)
#define CHECK_CHECK_PREV_LINK_S
#define ER_AU_INVALID_PASSWORD
SM_CLASS_CONSTRAINT * classobj_find_class_index(SM_CLASS *class_, const char *name)
int histo_start(bool for_all_trans)
#define MAX_KILLTRAN_INDEX_LIST_NUM
int changemode_keyword(int *keyval_p, char **keystr_p)
static char database_name[MAX_HA_DBINFO_LENGTH]
STATIC_INLINE char * spacedb_get_size_str(char *buf, UINT64 num_pages, T_SPACEDB_SIZE_UNIT size_unit)
#define SPACEDB_TO_SIZE_ARG(no, npage)
const VOLID LOG_DBTDE_KEYS_VOLID
int db_add_volume_ex(DBDEF_VOL_EXT_INFO *ext_info)
#define ADDVOL_VOLUME_SIZE_S
int da_add(dynamic_array *da, void *data)
#define free_and_init(ptr)
char * prm_get_string_value(PARAM_ID prm_id)
void LSA_SET_NULL(log_lsa *lsa_ptr)
static int tranlist_cmp_f(const void *p1, const void *p2)
#define KILLTRAN_DBA_PASSWORD_S
#define CHECK_CAT_CONSISTENCY_S
#define ADDVOL_FILE_PATH_S
void lock_dump(FILE *outfp)
#define KILLTRAN_KILL_SQL_ID_S
int copylogdb(UTIL_FUNCTION_ARG *arg)
#define BACKUP_COMPRESS_S
int util_log_write_errstr(const char *format,...)
char * basename(const char *path)
#define LOCK_OUTPUT_FILE_S
#define SPACE_SUMMARIZE_S
char * msgcat_message(int cat_id, int set_id, int msg_id)
#define ERR_CSS_TCP_CANNOT_CONNECT_TO_MASTER
const char * prm_get_name(PARAM_ID prm_id)
#define ER_NET_SERVER_CRASHED
#define XASL_ID_IS_NULL(X)
bool logwr_force_shutdown(void)
#define ADDVOL_MAX_WRITESIZE_IN_SEC_S
#define PLANDUMP_OUTPUT_FILE_S
char * strdup(const char *str)
void sysprm_dump_server_parameters(FILE *fp)
#define OPTION_STRING_TABLE
enum ha_server_state HA_SERVER_STATE
time_t util_str_to_time_since_epoch(char *str)
#define TRANLIST_REVERSE_S
#define SPACE_SIZE_UNIT_S
int changemode(UTIL_FUNCTION_ARG *arg)
int copylogdb_keyword(int *keyval_p, char **keystr_p)
#define CHECKDB_ALL_CHECK_EXCEPT_PREV_LINK
static int tranlist_Sort_column
#define CUB_MAXHOSTNAMELEN
#define BACKUP_THREAD_COUNT_S
int ws_find(MOP mop, MOBJ *obj)
int backupdb(UTIL_FUNCTION_ARG *arg)
#define XASL_ID_SET_NULL(X)
#define FILEIO_BACKUP_NUM_THREADS_AUTO
int netcl_spacedb(SPACEDB_ALL *spaceall, SPACEDB_ONEVOL **spacevols, SPACEDB_FILES *spacefiles)
#define ER_NET_SERVER_COMM_ERROR
#define STATDUMP_SUBSTR_S
int logwr_copy_log_file(const char *db_name, const char *log_path, int mode, INT64 start_page_id)
int tde_dump_mks(int vdes, bool print_value)
void la_print_delay_info(LOG_LSA working_lsa, LOG_LSA target_lsa, float process_rate)
TRAN_QUERY_EXEC_INFO query_exec_info
const char * command_name
#define TDE_MASTER_KEY_LENGTH
SIGNAL_HANDLER_FUNCTION os_set_signal_handler(const int sig_no, SIGNAL_HANDLER_FUNCTION sig_handler)
int tde(UTIL_FUNCTION_ARG *arg)
#define APPLYINFO_INTERVAL_S
char * utility_get_option_string_value(UTIL_ARG_MAP *arg_map, int arg_ch, int index)
#define CHANGEMODE_MODE_S
int db_commit_transaction(void)
#define APPLYINFO_VERBOSE_S
#define CHECK_REPAIR_PREV_LINK_S
#define ER_BO_CONNECT_FAILED
#define MSGCAT_CATALOG_UTILS