Skip to content

Commit a82e4e2

Browse files
author
Ritheesh Vedire
committed
WL#1697: Multisource replication
Merge from trunk
2 parents 66cf18f + 9fd1ffe commit a82e4e2

File tree

1,981 files changed

+115987
-64349
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,981 files changed

+115987
-64349
lines changed

CMakeLists.txt

+3-8
Original file line numberDiff line numberDiff line change
@@ -223,16 +223,14 @@ IF(DISABLE_SHARED)
223223
SET(WITHOUT_DYNAMIC_PLUGINS 1)
224224
ENDIF()
225225
OPTION(ENABLED_PROFILING "Enable profiling" ON)
226-
OPTION(CYBOZU "" OFF)
227-
OPTION(BACKUP_TEST "" OFF)
228226
OPTION(WITHOUT_SERVER OFF)
229227
IF(UNIX)
230228
OPTION(WITH_VALGRIND "Valgrind instrumentation" OFF)
231229
ENDIF()
232230
IF(NOT WITHOUT_SERVER)
233231
OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" ON)
234232
ENDIF()
235-
MARK_AS_ADVANCED(CYBOZU BACKUP_TEST WITHOUT_SERVER DISABLE_SHARED)
233+
MARK_AS_ADVANCED(WITHOUT_SERVER DISABLE_SHARED)
236234

237235

238236
include(CheckCSourceCompiles)
@@ -417,11 +415,8 @@ IF(NOT CMAKE_BUILD_TYPE
417415
AND NOT CMAKE_GENERATOR MATCHES "Xcode")
418416
# This is the case of no CMAKE_BUILD_TYPE choosen, typical for VS and Xcode
419417
# or if custom C flags are set. In VS and Xcode for non-Debug configurations
420-
# DBUG_OFF is already correctly set. Use DBUG_OFF for Makefile based projects
421-
# without build type too, unless user specifically requests DBUG.
422-
IF(NOT CMAKE_C_FLAGS MATCHES "-DDBUG_ON")
423-
ADD_DEFINITIONS(-DDBUG_OFF)
424-
ENDIF()
418+
# DBUG_OFF is already correctly set.
419+
ADD_DEFINITIONS(-DDBUG_OFF)
425420
ENDIF()
426421

427422
# Add safemutex for debug configurations

client/client_priv.h

+10-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ enum options_client
4646
OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, OPT_SSL_CAPATH,
4747
OPT_SSL_CIPHER, OPT_SHUTDOWN_TIMEOUT, OPT_LOCAL_INFILE,
4848
OPT_DELETE_MASTER_LOGS, OPT_COMPACT,
49-
OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION,OPT_MYSQL_PROTOCOL,
49+
OPT_PROMPT, OPT_IGN_LINES, OPT_TRANSACTION, OPT_MYSQL_PROTOCOL,
5050
OPT_SHARED_MEMORY_BASE_NAME, OPT_FRM, OPT_SKIP_OPTIMIZATION,
5151
OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH,
5252
OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_SET_GTID_PURGED, OPT_SERVER_ARG,
@@ -58,7 +58,7 @@ enum options_client
5858
OPT_USE_THREADS,
5959
OPT_IMPORT_USE_THREADS,
6060
OPT_MYSQL_NUMBER_OF_QUERY,
61-
OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE,
61+
OPT_IGNORE_TABLE, OPT_INSERT_IGNORE, OPT_SHOW_WARNINGS, OPT_DROP_DATABASE,
6262
OPT_TZ_UTC, OPT_CREATE_SLAP_SCHEMA,
6363
OPT_MYSQLDUMP_SLAVE_APPLY,
6464
OPT_MYSQLDUMP_SLAVE_DATA,
@@ -125,3 +125,11 @@ enum options_client
125125
*/
126126
#define PERFORMANCE_SCHEMA_DB_NAME "performance_schema"
127127

128+
129+
/**
130+
Client deprecation warnings
131+
*/
132+
#define CLIENT_WARN_DEPRECATED_NO_REPLACEMENT(opt) \
133+
printf("WARNING: " opt \
134+
" is deprecated and will be removed in a future version\n")
135+

client/mysql.cc

+27-16
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ extern "C" {
8080
#if defined(HAVE_TERMIOS_H)
8181
#include <termios.h>
8282
#include <unistd.h>
83-
#elif defined(HAVE_TERMBITS_H)
84-
#include <termbits.h>
8583
#elif defined(HAVE_ASM_TERMBITS_H) && (!defined __GLIBC__ || !(__GLIBC__ > 2 || __GLIBC__ == 2 && __GLIBC_MINOR__ > 0))
8684
#include <asm/termbits.h> // Standard linux
8785
#endif
@@ -670,7 +668,6 @@ static COMMANDS commands[] = {
670668
{ "NUMERIC", 0, 0, 0, ""},
671669
{ "NVARCHAR", 0, 0, 0, ""},
672670
{ "OFFSET", 0, 0, 0, ""},
673-
{ "OLD_PASSWORD", 0, 0, 0, ""},
674671
{ "ON", 0, 0, 0, ""},
675672
{ "ONE", 0, 0, 0, ""},
676673
{ "ONE_SHOT", 0, 0, 0, ""},
@@ -1124,7 +1121,7 @@ static void initialize_readline (char *name);
11241121

11251122
static COMMANDS *find_command(char *name);
11261123
static COMMANDS *find_command(char cmd_name);
1127-
static bool add_line(String &buffer, char *line, ulong line_length,
1124+
static bool add_line(String &buffer, char *line, size_t line_length,
11281125
char *in_string, bool *ml_comment, bool truncated);
11291126
static void remove_cntrl(String &buffer);
11301127
static void print_table_data(MYSQL_RES *result);
@@ -1410,13 +1407,22 @@ int main(int argc,char *argv[])
14101407
if (opt_outfile)
14111408
end_tee();
14121409
mysql_end(0);
1413-
#ifndef _lint
14141410
DBUG_RETURN(0); // Keep compiler happy
1415-
#endif
14161411
}
14171412

14181413
void mysql_end(int sig)
14191414
{
1415+
#ifndef _WIN32
1416+
/*
1417+
Ingnoring SIGQUIT, SIGINT and SIGHUP signals when cleanup process starts.
1418+
This will help in resolving the double free issues, which occures in case
1419+
the signal handler function is started in between the clean up function.
1420+
*/
1421+
signal(SIGQUIT, SIG_IGN);
1422+
signal(SIGINT, SIG_IGN);
1423+
signal(SIGHUP, SIG_IGN);
1424+
#endif
1425+
14201426
mysql_close(&mysql);
14211427
#ifdef HAVE_READLINE
14221428
if (!status.batch && !quick && !opt_html && !opt_xml &&
@@ -1806,8 +1812,8 @@ static struct my_option my_long_options[] =
18061812
&max_join_size, &max_join_size, 0, GET_ULONG, REQUIRED_ARG, 1000000L,
18071813
1, ULONG_MAX, 0, 1, 0},
18081814
{"secure-auth", OPT_SECURE_AUTH, "Refuse client connecting to server if it"
1809-
" uses old (pre-4.1.1) protocol.", &opt_secure_auth,
1810-
&opt_secure_auth, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
1815+
" uses old (pre-4.1.1) protocol. Deprecated. Always TRUE",
1816+
&opt_secure_auth, &opt_secure_auth, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
18111817
{"server-arg", OPT_SERVER_ARG, "Send embedded server this as a parameter.",
18121818
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
18131819
{"show-warnings", OPT_SHOW_WARNINGS, "Show warnings after every statement.",
@@ -1941,6 +1947,14 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
19411947
opt->name);
19421948
#endif
19431949
break;
1950+
case OPT_SECURE_AUTH:
1951+
CLIENT_WARN_DEPRECATED_NO_REPLACEMENT("--secure-auth");
1952+
if (!opt_secure_auth)
1953+
{
1954+
usage(0);
1955+
exit(1);
1956+
}
1957+
break;
19441958
case OPT_SERVER_ARG:
19451959
#ifdef EMBEDDED_LIBRARY
19461960
/*
@@ -2443,7 +2457,7 @@ static COMMANDS *find_command(char *name)
24432457
}
24442458

24452459

2446-
static bool add_line(String &buffer, char *line, ulong line_length,
2460+
static bool add_line(String &buffer, char *line, size_t line_length,
24472461
char *in_string, bool *ml_comment, bool truncated)
24482462
{
24492463
uchar inchar;
@@ -3845,10 +3859,10 @@ print_table_data(MYSQL_RES *result)
38453859
for (uint off=0; (field = mysql_fetch_field(result)) ; off++)
38463860
{
38473861
size_t name_length= strlen(field->name);
3848-
uint numcells= charset_info->cset->numcells(charset_info,
3849-
field->name,
3850-
field->name + name_length);
3851-
uint display_length= field->max_length + name_length - numcells;
3862+
size_t numcells= charset_info->cset->numcells(charset_info,
3863+
field->name,
3864+
field->name + name_length);
3865+
size_t display_length= field->max_length + name_length - numcells;
38523866
tee_fprintf(PAGER, " %-*s |",
38533867
min<int>(display_length, MAX_COLUMN_LENGTH),
38543868
field->name);
@@ -4966,9 +4980,6 @@ init_connection_options(MYSQL *mysql)
49664980
if (opt_compress)
49674981
mysql_options(mysql, MYSQL_OPT_COMPRESS, NullS);
49684982

4969-
if (!opt_secure_auth)
4970-
mysql_options(mysql, MYSQL_SECURE_AUTH, (char *) &opt_secure_auth);
4971-
49724983
if (using_opt_local_infile)
49734984
mysql_options(mysql, MYSQL_OPT_LOCAL_INFILE, (char*) &opt_local_infile);
49744985

client/mysql_secure_installation.cc

+1
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,7 @@ int get_root_password()
604604
the temporary password file.
605605
*/
606606
char *temp_pass;
607+
init_connection_options(&mysql);
607608
if (find_temporary_password(&temp_pass) == TRUE)
608609
{
609610
my_free(password);

client/mysqladmin.cc

+25-78
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ enum commands {
108108
ADMIN_FLUSH_HOSTS, ADMIN_FLUSH_TABLES, ADMIN_PASSWORD,
109109
ADMIN_PING, ADMIN_EXTENDED_STATUS, ADMIN_FLUSH_STATUS,
110110
ADMIN_FLUSH_PRIVILEGES, ADMIN_START_SLAVE, ADMIN_STOP_SLAVE,
111-
ADMIN_FLUSH_THREADS, ADMIN_OLD_PASSWORD
111+
ADMIN_FLUSH_THREADS
112112
};
113113
static const char *command_names[]= {
114114
"create", "drop", "shutdown",
@@ -118,7 +118,7 @@ static const char *command_names[]= {
118118
"flush-hosts", "flush-tables", "password",
119119
"ping", "extended-status", "flush-status",
120120
"flush-privileges", "start-slave", "stop-slave",
121-
"flush-threads","old-password",
121+
"flush-threads",
122122
NullS
123123
};
124124

@@ -194,8 +194,8 @@ static struct my_option my_long_options[] =
194194
&opt_relative, &opt_relative, 0, GET_BOOL, NO_ARG, 0, 0, 0,
195195
0, 0, 0},
196196
{"secure-auth", OPT_SECURE_AUTH, "Refuse client connecting to server if it"
197-
" uses old (pre-4.1.1) protocol.", &opt_secure_auth,
198-
&opt_secure_auth, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
197+
" uses old (pre-4.1.1) protocol. Deprecated. Always TRUE",
198+
&opt_secure_auth, &opt_secure_auth, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
199199
#if defined (_WIN32) && !defined (EMBEDDED_LIBRARY)
200200
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
201201
"Base name of shared memory.", &shared_memory_base_name, &shared_memory_base_name,
@@ -317,6 +317,14 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
317317
case OPT_ENABLE_CLEARTEXT_PLUGIN:
318318
using_opt_enable_cleartext_plugin= TRUE;
319319
break;
320+
case OPT_SECURE_AUTH:
321+
CLIENT_WARN_DEPRECATED_NO_REPLACEMENT("--secure-auth");
322+
if (!opt_secure_auth)
323+
{
324+
usage();
325+
exit(1);
326+
}
327+
break;
320328
}
321329
if (error)
322330
{
@@ -370,8 +378,6 @@ int main(int argc,char *argv[])
370378

371379
if (opt_bind_addr)
372380
mysql_options(&mysql,MYSQL_OPT_BIND,opt_bind_addr);
373-
if (!opt_secure_auth)
374-
mysql_options(&mysql, MYSQL_SECURE_AUTH,(char*)&opt_secure_auth);
375381
if (opt_compress)
376382
mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS);
377383
if (opt_connect_timeout)
@@ -403,8 +409,7 @@ int main(int argc,char *argv[])
403409
(char*) &opt_enable_cleartext_plugin);
404410

405411
first_command= find_type(argv[0], &command_typelib, FIND_TYPE_BASIC);
406-
can_handle_passwords=
407-
(first_command == ADMIN_PASSWORD || first_command == ADMIN_OLD_PASSWORD) ?
412+
can_handle_passwords= first_command == ADMIN_PASSWORD ?
408413
TRUE : FALSE;
409414
mysql_options(&mysql, MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS,
410415
&can_handle_passwords);
@@ -1008,16 +1013,12 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
10081013
}
10091014
break;
10101015
}
1011-
case ADMIN_OLD_PASSWORD:
10121016
case ADMIN_PASSWORD:
10131017
{
10141018
char buff[128],crypted_pw[64];
10151019
time_t start_time;
10161020
char *typed_password= NULL, *verified= NULL;
10171021
bool log_off= true, err= false;
1018-
int retry_count= 0; /* Attempts to SET PASSWORD */
1019-
1020-
bool old= (option == ADMIN_OLD_PASSWORD);
10211022

10221023
/* Do initialization the same way as we do in mysqld */
10231024
start_time=time((time_t*) 0);
@@ -1055,66 +1056,23 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
10551056
printf("Warning: single quotes were not trimmed from the password by"
10561057
" your command\nline client, as you might have expected.\n");
10571058
#endif
1058-
/*
1059-
If we don't already know to use an old-style password, see
1060-
(if possible) what the server is using.
1061-
*/
1062-
if (!old)
1059+
/* turn logging off if we can */
1060+
if (mysql_query(mysql, "set sql_log_off=1"))
10631061
{
1064-
if (mysql_query(mysql, "SHOW VARIABLES LIKE 'old_passwords'"))
1065-
{
1066-
bool fatal= (mysql_errno(mysql) != ER_MUST_CHANGE_PASSWORD);
1067-
if (fatal || opt_verbose)
1068-
my_printf_error(0, "Could not determine old_passwords setting "
1069-
"from server; error: '%s'.", error_flags,
1070-
mysql_error(mysql));
1071-
if (fatal)
1072-
{
1073-
err= true;
1074-
goto error;
1075-
}
1076-
}
1077-
else
1078-
{
1079-
MYSQL_RES *res= mysql_store_result(mysql);
1080-
if (!res)
1081-
{
1082-
my_printf_error(0,
1083-
"Could not get old_passwords setting from "
1084-
"server; error: '%s'.",
1085-
error_flags, mysql_error(mysql));
1086-
err= true;
1087-
goto error;
1088-
}
1089-
if (!mysql_num_rows(res))
1090-
old= 1;
1091-
else
1092-
{
1093-
MYSQL_ROW row= mysql_fetch_row(res);
1094-
old= (!strncmp(row[1], "ON", 2) || !strncmp(row[1], "1", 1));
1095-
}
1096-
mysql_free_result(res);
1097-
}
1062+
if (opt_verbose)
1063+
fprintf(stderr, "Note: Can't turn off logging; '%s'", mysql_error(mysql));
1064+
log_off= false;
10981065
}
1099-
/* turn logging off if we can */
1100-
if (mysql_query(mysql,"set sql_log_off=1"))
1101-
{
1102-
if (opt_verbose)
1103-
fprintf(stderr, "Note: Can't turn off logging; '%s'", mysql_error(mysql));
1104-
log_off= false;
1105-
}
11061066

1107-
retry:
11081067
/*
11091068
In case the password_expired flag is set ('Y'), then there is no way
1110-
to determine the password format. So, we first try to set the
1111-
password using native format. If it fails with ER_PASSWORD_LENGTH,
1112-
we will give one more try with old format.
1069+
to determine the password format. So, assume that setting the
1070+
password using the server's default authentication format
1071+
(mysql_native_password) will work.
1072+
TODO: make sure this always uses SSL and then let the server
1073+
calculate the scramble.
11131074
*/
1114-
if (old)
1115-
make_scrambled_password_323(crypted_pw, typed_password);
1116-
else
1117-
make_scrambled_password(crypted_pw, typed_password);
1075+
make_scrambled_password(crypted_pw, typed_password);
11181076
}
11191077
else
11201078
crypted_pw[0]=0; /* No password */
@@ -1123,16 +1081,6 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
11231081

11241082
if (mysql_query(mysql,buff))
11251083
{
1126-
if ((mysql_errno(mysql) == ER_PASSWD_LENGTH) &&
1127-
!(option == ADMIN_OLD_PASSWORD) && !retry_count)
1128-
{
1129-
/* Try to set the password using old format. */
1130-
memset(crypted_pw, 0, 64);
1131-
old= 0;
1132-
retry_count ++;
1133-
goto retry;
1134-
}
1135-
11361084
if (mysql_errno(mysql)!=1290)
11371085
{
11381086
my_printf_error(0,"unable to change password; error: '%s'",
@@ -1264,8 +1212,7 @@ static char **mask_password(int argc, char ***argv)
12641212
while (argc > 0)
12651213
{
12661214
temp_argv[argc]= my_strdup(PSI_NOT_INSTRUMENTED, (*argv)[argc], MYF(MY_FAE));
1267-
if (find_type((*argv)[argc - 1],&command_typelib, FIND_TYPE_BASIC) == ADMIN_PASSWORD ||
1268-
find_type((*argv)[argc - 1],&command_typelib, FIND_TYPE_BASIC) == ADMIN_OLD_PASSWORD)
1215+
if (find_type((*argv)[argc - 1],&command_typelib, FIND_TYPE_BASIC) == ADMIN_PASSWORD)
12691216
{
12701217
char *start= (*argv)[argc];
12711218
while (*start)

0 commit comments

Comments
 (0)