New startup options and some cleanups

parent 440bff25
...@@ -391,3 +391,4 @@ support-files/mysql.spec ...@@ -391,3 +391,4 @@ support-files/mysql.spec
tags tags
tmp/* tmp/*
vio/viotest-ssl vio/viotest-ssl
=6
...@@ -218,4 +218,5 @@ ...@@ -218,4 +218,5 @@
#define ER_WRONG_USAGE 1215 #define ER_WRONG_USAGE 1215
#define ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT 1216 #define ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT 1216
#define ER_CANT_UPDATE_WITH_READLOCK 1217 #define ER_CANT_UPDATE_WITH_READLOCK 1217
#define ER_ERROR_MESSAGES 218 #define ER_MIXING_NOT_ALLOWED 1218
#define ER_ERROR_MESSAGES 219
...@@ -562,7 +562,7 @@ extern ulong keybuff_size,sortbuff_size,max_item_sort_length,table_cache_size, ...@@ -562,7 +562,7 @@ extern ulong keybuff_size,sortbuff_size,max_item_sort_length,table_cache_size,
extern ulong specialflag, current_pid; extern ulong specialflag, current_pid;
extern bool low_priority_updates, using_update_log; extern bool low_priority_updates, using_update_log;
extern bool opt_sql_bin_update, opt_safe_show_db, opt_warnings, extern bool opt_sql_bin_update, opt_safe_show_db, opt_warnings,
opt_safe_user_create; opt_safe_user_create, opt_no_mix_types;
extern char language[LIBLEN],reg_ext[FN_EXTLEN],blob_newline; extern char language[LIBLEN],reg_ext[FN_EXTLEN],blob_newline;
extern const char **errmesg; /* Error messages */ extern const char **errmesg; /* Error messages */
extern const char *default_tx_isolation_name; extern const char *default_tx_isolation_name;
......
...@@ -224,7 +224,7 @@ static bool opt_log,opt_update_log,opt_bin_log,opt_slow_log,opt_noacl, ...@@ -224,7 +224,7 @@ static bool opt_log,opt_update_log,opt_bin_log,opt_slow_log,opt_noacl,
opt_large_files=sizeof(my_off_t) > 4; opt_large_files=sizeof(my_off_t) > 4;
bool opt_sql_bin_update = 0, opt_log_slave_updates = 0, opt_safe_show_db=0, bool opt_sql_bin_update = 0, opt_log_slave_updates = 0, opt_safe_show_db=0,
opt_show_slave_auth_info = 0, opt_old_rpl_compat = 0, opt_show_slave_auth_info = 0, opt_old_rpl_compat = 0,
opt_safe_user_create = 0; opt_safe_user_create = 0, opt_no_mix_types = 0;
FILE *bootstrap_file=0; FILE *bootstrap_file=0;
int segfaulted = 0; // ensure we do not enter SIGSEGV handler twice int segfaulted = 0; // ensure we do not enter SIGSEGV handler twice
extern MASTER_INFO glob_mi; extern MASTER_INFO glob_mi;
...@@ -2521,7 +2521,7 @@ enum options { ...@@ -2521,7 +2521,7 @@ enum options {
OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL, OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL,
OPT_SHOW_SLAVE_AUTH_INFO, OPT_OLD_RPL_COMPAT, OPT_SHOW_SLAVE_AUTH_INFO, OPT_OLD_RPL_COMPAT,
OPT_SQL_MODE,OPT_SAFE_USER_CREATE, OPT_SQL_MODE,OPT_SAFE_USER_CREATE,
OPT_SLAVE_LOAD_TMPDIR}; OPT_SLAVE_LOAD_TMPDIR, OPT_NO_MIX_TYPE};
static struct option long_options[] = { static struct option long_options[] = {
{"ansi", no_argument, 0, 'a'}, {"ansi", no_argument, 0, 'a'},
...@@ -2613,6 +2613,7 @@ static struct option long_options[] = { ...@@ -2613,6 +2613,7 @@ static struct option long_options[] = {
{"safemalloc-mem-limit", required_argument, 0, (int) {"safemalloc-mem-limit", required_argument, 0, (int)
OPT_SAFEMALLOC_MEM_LIMIT}, OPT_SAFEMALLOC_MEM_LIMIT},
{"new", no_argument, 0, 'n'}, {"new", no_argument, 0, 'n'},
{"no-mix-table-types", no_argument, 0, (int)OPT_NO_MIX_TYPE},
{"old-protocol", no_argument, 0, 'o'}, {"old-protocol", no_argument, 0, 'o'},
{"old-rpl-compat", no_argument, 0, (int)OPT_OLD_RPL_COMPAT}, {"old-rpl-compat", no_argument, 0, (int)OPT_OLD_RPL_COMPAT},
#ifdef ONE_THREAD #ifdef ONE_THREAD
...@@ -3094,6 +3095,7 @@ static void usage(void) ...@@ -3094,6 +3095,7 @@ static void usage(void)
BACKUP or FORCE.\n\ BACKUP or FORCE.\n\
--memlock Lock mysqld in memory\n\ --memlock Lock mysqld in memory\n\
-n, --new Use very new possible 'unsafe' functions\n\ -n, --new Use very new possible 'unsafe' functions\n\
--no-mix-table-types Do not use transactional and non-transactional tables in a single query\n
-o, --old-protocol Use the old (3.20) protocol\n\ -o, --old-protocol Use the old (3.20) protocol\n\
-P, --port=... Port number to use for connection\n"); -P, --port=... Port number to use for connection\n");
#ifdef ONE_THREAD #ifdef ONE_THREAD
...@@ -3577,6 +3579,9 @@ static void get_options(int argc,char **argv) ...@@ -3577,6 +3579,9 @@ static void get_options(int argc,char **argv)
case (int) OPT_LONG_FORMAT: case (int) OPT_LONG_FORMAT:
opt_specialflag|=SPECIAL_LONG_LOG_FORMAT; opt_specialflag|=SPECIAL_LONG_LOG_FORMAT;
break; break;
case (int) OPT_NO_MIX_TYPE:
opt_no_mix_types = 1;
break;
case (int) OPT_SKIP_NETWORKING: case (int) OPT_SKIP_NETWORKING:
opt_disable_networking=1; opt_disable_networking=1;
mysql_port=0; mysql_port=0;
......
...@@ -219,3 +219,4 @@ ...@@ -219,3 +219,4 @@
"Wrong usage of %s and %s", "Wrong usage of %s and %s",
"The used SELECT statements have a different number of columns", "The used SELECT statements have a different number of columns",
"Can't execute the query because you have a conflicting read lock", "Can't execute the query because you have a conflicting read lock",
"Mixing transactional and non-transactional tables disabled by option",
\ No newline at end of file
...@@ -1368,6 +1368,18 @@ int open_tables(THD *thd,TABLE_LIST *start) ...@@ -1368,6 +1368,18 @@ int open_tables(THD *thd,TABLE_LIST *start)
tables->table->reginfo.lock_type=tables->lock_type; tables->table->reginfo.lock_type=tables->lock_type;
tables->table->grant= tables->grant; tables->table->grant= tables->grant;
} }
if (opt_no_mix_types && start)
{
bool checking; TABLE_LIST *tl;
for (tl=start, checking = tl->table->file->has_transactions(), tl=tl->next; tl ; tl=tl->next)
{
if (((tl->table->file->has_transactions()) ^ checking))
{
send_error(&thd->net,ER_MIXING_NOT_ALLOWED);
DBUG_RETURN(-1);
}
}
}
thd->proc_info=0; thd->proc_info=0;
DBUG_RETURN(result); DBUG_RETURN(result);
} }
......
...@@ -48,7 +48,6 @@ static void remove_escape(char *name); ...@@ -48,7 +48,6 @@ static void remove_escape(char *name);
static void refresh_status(void); static void refresh_status(void);
static bool append_file_to_dir(char **filename_ptr, char *table_name); static bool append_file_to_dir(char **filename_ptr, char *table_name);
static int create_total_list(THD *thd, LEX *lex, TABLE_LIST **result); static int create_total_list(THD *thd, LEX *lex, TABLE_LIST **result);
static int handle_create_select(THD *thd, LEX *lex, select_result *c_i);
const char *any_db="*any*"; // Special symbol for check_access const char *any_db="*any*"; // Special symbol for check_access
...@@ -1076,8 +1075,10 @@ mysql_execute_command(void) ...@@ -1076,8 +1075,10 @@ mysql_execute_command(void)
/* /*
Skip if we are in the slave thread, some table rules have been given Skip if we are in the slave thread, some table rules have been given
and the table list says the query should not be replicated and the table list says the query should not be replicated
TODO: UPDATE this for UNION TODO: UPDATE this for UNION. Updated by Sinisa !!!!!!!!!!!!!!!!!!!!!!
*/ */
if (lex->select_lex.next && tables && (res = create_total_list(thd,lex,&tables)))
DBUG_VOID_RETURN;
if (table_rules_on && thd->slave_thread && tables && !tables_ok(thd,tables)) if (table_rules_on && thd->slave_thread && tables && !tables_ok(thd,tables))
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
...@@ -1088,8 +1089,6 @@ mysql_execute_command(void) ...@@ -1088,8 +1089,6 @@ mysql_execute_command(void)
if (select_lex->options & SELECT_DESCRIBE) if (select_lex->options & SELECT_DESCRIBE)
lex->exchange=0; lex->exchange=0;
/* Save a call, as it's very uncomon that we use unions */ /* Save a call, as it's very uncomon that we use unions */
if (lex->select_lex.next && (res = create_total_list(thd,lex,&tables)))
break;
if (tables) if (tables)
{ {
res=check_table_access(thd, res=check_table_access(thd,
...@@ -1295,8 +1294,6 @@ mysql_execute_command(void) ...@@ -1295,8 +1294,6 @@ mysql_execute_command(void)
if (select_lex->item_list.elements) // With select if (select_lex->item_list.elements) // With select
{ {
select_result *result; select_result *result;
if ((res = create_total_list(thd,lex,&tables)))
break;
if (!(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) && if (!(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) &&
check_dup(thd,tables->db,tables->real_name,tables->next)) check_dup(thd,tables->db,tables->real_name,tables->next))
...@@ -1574,8 +1571,6 @@ mysql_execute_command(void) ...@@ -1574,8 +1571,6 @@ mysql_execute_command(void)
case SQLCOM_REPLACE_SELECT: case SQLCOM_REPLACE_SELECT:
case SQLCOM_INSERT_SELECT: case SQLCOM_INSERT_SELECT:
{ {
if ((res = create_total_list(thd,lex,&tables)))
break;
// Check that we have modify privileges for the first table and // Check that we have modify privileges for the first table and
// select privileges for the rest // select privileges for the rest
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment