Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext

Conflicts:
	sql/table.cc
This commit is contained in:
Monty 2018-01-27 15:20:01 +02:00
commit 84514ec643
41 changed files with 230 additions and 106 deletions

View file

@ -308,3 +308,5 @@ gprof_compile_flags="-O2 -pg -g"
gprof_link_flags="--disable-shared $static_link"
disable_gprof_plugins="--with-zlib-dir=bundled --without-plugin-oqgraph --without-plugin-mroonga"
disable_asan_plugins="--without-plugin-rocksdb"

View file

@ -18,7 +18,7 @@ path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium64_cflags $debug_cflags -lasan -O -g -fsanitize=address"
extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_configs"
extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_configs $disable_asan_plugins"
export LDFLAGS="-ldl"
. "$path/FINISH.sh"

View file

@ -62,7 +62,7 @@ IF(FEATURE_SET)
SET(WITH_NONE ON)
ENDIF()
IF(num GREATER FEATURE_SET_xsmall)
IF(num GREATER FEATURE_SET_xsmall AND NOT WIN32)
SET(WITH_EMBEDDED_SERVER ON CACHE BOOL "")
ENDIF()
IF(num GREATER FEATURE_SET_small)
@ -88,7 +88,9 @@ ENDIF()
OPTION(ENABLED_LOCAL_INFILE "" ON)
SET(WITH_INNODB_SNAPPY OFF CACHE STRING "")
IF(WIN32)
SET(WITH_LIBARCHIVE STATIC CACHE STRING "")
SET(INSTALL_MYSQLTESTDIR "" CACHE STRING "")
SET(INSTALL_SQLBENCHDIR "" CACHE STRING "")
SET(INSTALL_SUPPORTFILESDIR "" CACHE STRING "")
ELSEIF(RPM)
SET(WITH_SSL system CACHE STRING "")
SET(WITH_ZLIB system CACHE STRING "")

View file

@ -86,8 +86,10 @@ IF(MSVC)
# Enable debug info also in Release build,
# and create PDB to be able to analyze crashes.
FOREACH(type EXE SHARED MODULE)
SET(CMAKE_{type}_LINKER_FLAGS_RELEASE
SET(CMAKE_${type}_LINKER_FLAGS_RELEASE
"${CMAKE_${type}_LINKER_FLAGS_RELEASE} /debug")
SET(CMAKE_${type}_LINKER_FLAGS_MINSIZEREL
"${CMAKE_${type}_LINKER_FLAGS_MINSIZEREL} /debug")
ENDFOREACH()
# Force static runtime libraries
@ -108,10 +110,15 @@ IF(MSVC)
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT)
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT
CMAKE_C_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_MINSIZEREL
)
STRING(REGEX REPLACE "/M[TD][d]?" "${MSVC_CRT_TYPE}" "${flag}" "${${flag}}" )
STRING(REGEX REPLACE "/D[ ]?_DEBUG" "" "${flag}" "${${flag}}")
STRING(REPLACE "/Zi" "/Z7" "${flag}" "${${flag}}")
IF(NOT "${${flag}}" MATCHES "/Z7")
STRING(APPEND ${flag} " /Z7")
ENDIF()
ENDFOREACH()
@ -139,9 +146,12 @@ IF(MSVC)
ENDIF()
#TODO: update the code and remove the disabled warnings
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996 /we4700 /we4311 /we4477 /we4302 /we4090 /wd4267 ")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /wd4291 /wd4577 /we4099 /we4700 /we4311 /we4477 /we4302 /we4090 /wd4267")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4805 /wd4996 /we4700 /we4311 /we4477 /we4302 /we4090")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4805 /wd4291 /wd4996 /we4099 /we4700 /we4311 /we4477 /we4302 /we4090")
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
# Temporarily disable size_t warnings, due to their amount
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267")
ENDIF()
IF(MYSQL_MAINTAINER_MODE MATCHES "ERR")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")

@ -1 +1 @@
Subproject commit f3944bbd36af729b2f13313587018679c57de67d
Subproject commit cfafbb6babf276a4f78db626d192c6d844a9b4d1

View file

@ -13,7 +13,16 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
IF (NOT INSTALL_MYSQLTESTDIR)
IF (WIN32)
ADD_EXECUTABLE(my_safe_process safe_process_win.cc)
ADD_EXECUTABLE(my_safe_kill safe_kill_win.cc)
TARGET_LINK_LIBRARIES(my_safe_kill dbghelp psapi)
ELSE()
ADD_EXECUTABLE(my_safe_process safe_process.cc)
ENDIF()
IF(NOT INSTALL_MYSQLTESTDIR)
RETURN()
ENDIF()
@ -22,14 +31,9 @@ SET(INSTALL_ARGS
COMPONENT Test
)
INSTALL(TARGETS my_safe_process ${INSTALL_ARGS})
IF (WIN32)
MYSQL_ADD_EXECUTABLE(my_safe_process safe_process_win.cc ${INSTALL_ARGS})
MYSQL_ADD_EXECUTABLE(my_safe_kill safe_kill_win.cc ${INSTALL_ARGS})
TARGET_LINK_LIBRARIES(my_safe_kill dbghelp psapi)
ELSE()
MYSQL_ADD_EXECUTABLE(my_safe_process safe_process.cc ${INSTALL_ARGS})
INSTALL(TARGETS my_safe_kill ${INSTALL_ARGS})
ENDIF()
INSTALL(FILES Base.pm
DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess" COMPONENT Test
)
INSTALL(FILES Base.pm ${INSTALL_ARGS})

View file

@ -0,0 +1,30 @@
include/master-slave.inc
[connection master]
connection master;
call mtr.add_suppression("Timeout waiting for reply of binlog");
SET @@GLOBAL.rpl_semi_sync_master_enabled = 1;
SET @@GLOBAL.rpl_semi_sync_master_timeout=100;
connection slave;
include/stop_slave.inc
SET @@GLOBAL.replicate_events_marked_for_skip=FILTER_ON_MASTER;
SET @@GLOBAL. rpl_semi_sync_slave_enabled = 1;
include/start_slave.inc
connection master;
CREATE TABLE t1 (a INT) ENGINE=innodb;
SET @@GLOBAL.debug_dbug= "d,dbug_master_binlog_over_2GB";
SET @@SESSION.skip_replication=1;
INSERT INTO t1 SET a=1;
SET @@SESSION.skip_replication=0;
INSERT INTO t1 SET a=0;
connection slave;
connection master;
SET @@GLOBAL.debug_dbug="";
SET @@GLOBAL. rpl_semi_sync_master_timeout = 10000;
SET @@GLOBAL. rpl_semi_sync_master_enabled = 0;
connection master;
DROP TABLE t1;
connection slave;
include/stop_slave.inc
SET @@GLOBAL. rpl_semi_sync_slave_enabled = 0;
SET @@GLOBAL.replicate_events_marked_for_skip = REPLICATE;
include/rpl_end.inc

View file

@ -0,0 +1,62 @@
# MDEV-14721 Big transaction events get lost on semisync master when
# replicate_events_marked_for_skip=FILTER_ON_MASTER
#
# When events of a big transaction are binlogged offsetting over 2GB from
# the beginning of the log the semisync master's dump thread
# lost such events.
# The test verifies the fixes' correctness simulating the 2GB offset.
source include/have_semisync.inc;
source include/not_embedded.inc;
source include/have_innodb.inc;
source include/have_debug.inc;
source include/master-slave.inc;
--connection master
# Suppress warnings that might be generated during the test
call mtr.add_suppression("Timeout waiting for reply of binlog");
--let $sav_enabled_master=`SELECT @@GLOBAL.rpl_semi_sync_master_enabled `
--let $sav_timeout_master=`SELECT @@GLOBAL.rpl_semi_sync_master_timeout `
SET @@GLOBAL.rpl_semi_sync_master_enabled = 1;
SET @@GLOBAL.rpl_semi_sync_master_timeout=100;
--connection slave
source include/stop_slave.inc;
--let $sav_skip_marked_slave=`SELECT @@GLOBAL.replicate_events_marked_for_skip `
SET @@GLOBAL.replicate_events_marked_for_skip=FILTER_ON_MASTER;
--let $sav_enabled_slave=`SELECT @@GLOBAL.rpl_semi_sync_slave_enabled `
SET @@GLOBAL. rpl_semi_sync_slave_enabled = 1;
source include/start_slave.inc;
--connection master
CREATE TABLE t1 (a INT) ENGINE=innodb;
# Make the following events as if they offset over 2GB from the beginning of binlog
SET @@GLOBAL.debug_dbug= "d,dbug_master_binlog_over_2GB";
SET @@SESSION.skip_replication=1;
INSERT INTO t1 SET a=1;
SET @@SESSION.skip_replication=0;
INSERT INTO t1 SET a=0;
--sync_slave_with_master
#
# Clean up
#
--connection master
SET @@GLOBAL.debug_dbug="";
--eval SET @@GLOBAL. rpl_semi_sync_master_timeout = $sav_timeout_master
--eval SET @@GLOBAL. rpl_semi_sync_master_enabled = $sav_enabled_master
--connection master
DROP TABLE t1;
--sync_slave_with_master
source include/stop_slave.inc;
--eval SET @@GLOBAL. rpl_semi_sync_slave_enabled = $sav_enabled_slave
--eval SET @@GLOBAL.replicate_events_marked_for_skip = $sav_skip_marked_slave
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc

View file

@ -172,7 +172,7 @@ int logger_vprintf(LOGGER_HANDLE *log, const char* fmt, va_list ap)
if (n_bytes >= sizeof(cvtbuf))
n_bytes= sizeof(cvtbuf) - 1;
result= my_write(log->file, (uchar *) cvtbuf, n_bytes, MYF(0));
result= (int)my_write(log->file, (uchar *) cvtbuf, n_bytes, MYF(0));
exit:
flogger_mutex_unlock(&log->lock);
@ -196,7 +196,7 @@ int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size)
goto exit; /* Log rotation needed but failed */
}
result= my_write(log->file, (uchar *) buffer, size, MYF(0));
result= (int)my_write(log->file, (uchar *) buffer, size, MYF(0));
exit:
flogger_mutex_unlock(&log->lock);

View file

@ -951,7 +951,7 @@ Returns: TRUE if the path is not excluded
static BOOL
test_incexc(char *path, patstr *ip, patstr *ep)
{
int plen = strlen(path);
int plen = (int)strlen(path);
for (; ep != NULL; ep = ep->next)
{
@ -2502,7 +2502,7 @@ compile_pattern(patstr *p, int options, int popts, int fromfile,
char buffer[PATBUFSIZE];
const char *error;
char *ps = p->string;
int patlen = strlen(ps);
int patlen = (int)strlen(ps);
int errptr;
if (p->compiled != NULL) return TRUE;

View file

@ -1904,7 +1904,7 @@ for (;;)
{
if (f == stdin) printf("%s", prompt);
if (fgets((char *)here, rlen, f) == NULL)
if (fgets((char *)here, (int)rlen, f) == NULL)
return (here == start)? NULL : start;
}
@ -2025,7 +2025,7 @@ pcre_uint32 c = 0;
int yield = 0;
if (length < 0)
length = strlen((char *)p);
length = (int)strlen((char *)p);
while (length-- > 0)
{

View file

@ -90,7 +90,7 @@ static int test_plugin_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
return CR_ERROR;
/* send the reply to the server */
res= vio->write_packet(vio, (const unsigned char *) reply,
strlen(reply) + 1);
(int)strlen(reply) + 1);
if (res)
return CR_ERROR;

View file

@ -226,7 +226,7 @@ static int test_plugin_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
return CR_ERROR;
/* send the reply to the server */
res= vio->write_packet(vio, (const unsigned char *) reply,
strlen(reply) + 1);
(int)strlen(reply) + 1);
if (res)
return CR_ERROR;

View file

@ -205,7 +205,7 @@ static int test_plugin_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
return CR_ERROR;
/* send the reply to the server */
res= vio->write_packet(vio, (const unsigned char *) reply,
strlen(reply) + 1);
(int)strlen(reply) + 1);
if (res)
return CR_ERROR;

View file

@ -150,7 +150,7 @@ static void add_word(MYSQL_FTPARSER_PARAM *param, const char *word, size_t len)
MYSQL_FTPARSER_BOOLEAN_INFO bool_info=
{ FT_TOKEN_WORD, 0, 0, 0, 0, ' ', 0 };
param->mysql_add_word(param, word, len, &bool_info);
param->mysql_add_word(param, word, (int)len, &bool_info);
}
/*

View file

@ -300,7 +300,7 @@ static size_t big_buffer_alloced= 0;
static unsigned int query_log_limit= 0;
static char servhost[256];
static size_t servhost_len;
static uint servhost_len;
static char *syslog_ident;
static char syslog_ident_buffer[128]= "mysql-server_auditing";
@ -622,7 +622,7 @@ static void remove_blanks(char *user)
struct user_name
{
int name_len;
size_t name_len;
char *name;
};
@ -657,7 +657,7 @@ static int cmp_users(const void *ia, const void *ib)
{
const struct user_name *a= (const struct user_name *) ia;
const struct user_name *b= (const struct user_name *) ib;
int dl= a->name_len - b->name_len;
int dl= (int)(a->name_len - b->name_len);
if (dl != 0)
return dl;
@ -665,7 +665,7 @@ static int cmp_users(const void *ia, const void *ib)
}
static char *coll_search(struct user_coll *c, const char *n, int len)
static char *coll_search(struct user_coll *c, const char *n, size_t len)
{
struct user_name un;
struct user_name *found;
@ -677,7 +677,7 @@ static char *coll_search(struct user_coll *c, const char *n, int len)
}
static int coll_insert(struct user_coll *c, char *n, int len)
static int coll_insert(struct user_coll *c, char *n, size_t len)
{
if (c->n_users >= c->n_alloced)
{
@ -917,7 +917,7 @@ static void get_str_n(char *dest, int *dest_len, size_t dest_size,
memcpy(dest, src, src_len);
dest[src_len]= 0;
*dest_len= src_len;
*dest_len= (int)src_len;
}
@ -1232,7 +1232,7 @@ static void change_connection(struct connection_info *cn,
event->ip, event->ip_length);
}
static int write_log(const char *message, int len)
static int write_log(const char *message, size_t len)
{
if (output_type == OUTPUT_FILE)
{
@ -1246,7 +1246,7 @@ static int write_log(const char *message, int len)
{
syslog(syslog_facility_codes[syslog_facility] |
syslog_priority_codes[syslog_priority],
"%s %.*s", syslog_info, len, message);
"%s %.*s", syslog_info, (int)len, message);
}
return 0;
}
@ -1739,9 +1739,9 @@ static int log_table(const struct connection_info *cn,
(void) time(&ctime);
csize= log_header(message, sizeof(message)-1, &ctime,
servhost, servhost_len,
event->user, SAFE_STRLEN(event->user),
event->host, SAFE_STRLEN(event->host),
event->ip, SAFE_STRLEN(event->ip),
event->user, (unsigned int)SAFE_STRLEN(event->user),
event->host, (unsigned int)SAFE_STRLEN(event->host),
event->ip, (unsigned int)SAFE_STRLEN(event->ip),
event->thread_id, cn->query_id, type);
csize+= my_snprintf(message+csize, sizeof(message) - 1 - csize,
",%.*s,%.*s,",event->database_length, event->database,
@ -1761,9 +1761,9 @@ static int log_rename(const struct connection_info *cn,
(void) time(&ctime);
csize= log_header(message, sizeof(message)-1, &ctime,
servhost, servhost_len,
event->user, SAFE_STRLEN(event->user),
event->host, SAFE_STRLEN(event->host),
event->ip, SAFE_STRLEN(event->ip),
event->user, (unsigned int)SAFE_STRLEN(event->user),
event->host, (unsigned int)SAFE_STRLEN(event->host),
event->ip, (unsigned int)SAFE_STRLEN(event->ip),
event->thread_id, cn->query_id, "RENAME");
csize+= my_snprintf(message+csize, sizeof(message) - 1 - csize,
",%.*s,%.*s|%.*s.%.*s,",event->database_length, event->database,
@ -2344,7 +2344,7 @@ static int server_audit_init(void *p __attribute__((unused)))
if (gethostname(servhost, sizeof(servhost)))
strcpy(servhost, "unknown");
servhost_len= strlen(servhost);
servhost_len= (uint)strlen(servhost);
logger_init_mutexes();
#if defined(HAVE_PSI_INTERFACE) && !defined(FLOGGER_NO_PSI)

View file

@ -56,11 +56,11 @@ static int auditing_v4(MYSQL_THD thd, mysql_event_class_t class, const void *ev)
ev_302.general_error_code= event->general_error_code;
ev_302.general_thread_id= event->general_thread_id;
ev_302.general_user= event->general_user.str;
ev_302.general_user_length= event->general_user.length;
ev_302.general_user_length= (unsigned int)event->general_user.length;
ev_302.general_command= event->general_command.str;
ev_302.general_command_length= event->general_command.length;
ev_302.general_command_length= (unsigned int)event->general_command.length;
ev_302.general_query= event->general_query.str;
ev_302.general_query_length= event->general_query.length;
ev_302.general_query_length= (unsigned int)event->general_query.length;
ev_302.general_charset= event->general_charset;
ev_302.general_time= event->general_time;
ev_302.general_rows= event->general_rows;

View file

@ -26,7 +26,7 @@ static unsigned min_length, min_digits, min_letters, min_others;
static int validate(MYSQL_CONST_LEX_STRING *username,
MYSQL_CONST_LEX_STRING *password)
{
unsigned digits=0 , uppers=0 , lowers=0, others=0, length= password->length;
unsigned digits=0 , uppers=0 , lowers=0, others=0, length= (unsigned)password->length;
const char *ptr= password->str, *end= ptr + length;
if (strncmp(password->str, username->str, length) == 0)

View file

@ -612,7 +612,8 @@ uchar *engine_option_value::frm_image(uchar *buff)
{
if (value.str)
{
*buff++= name.length;
DBUG_ASSERT(name.length <= 0xff);
*buff++= (uchar)name.length;
memcpy(buff, name.str, name.length);
buff+= name.length;
int2store(buff, value.length | (quoted_value ? FRM_QUOTED_VALUE : 0));

View file

@ -1732,6 +1732,8 @@ bool Log_event::write_header(ulong event_data_length)
*/
log_pos= writer->pos() + data_written;
DBUG_EXECUTE_IF("dbug_master_binlog_over_2GB", log_pos += (1ULL <<31););
}
now= get_time(); // Query start time
@ -12313,7 +12315,8 @@ int Table_map_log_event::rewrite_db(const char* new_db, size_t new_len,
cnt += header_len;
// Write new db name length and new name
*ptr++ = new_len;
DBUG_ASSERT(new_len < 0xff);
*ptr++ = (char)new_len;
memcpy(ptr, new_db, new_len + 1);
ptr += new_len + 1;
cnt += m_dblen + 2;

View file

@ -2676,8 +2676,8 @@ void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx,
LooseScan detector in best_access_path)
*/
remaining_tables &= ~new_join_tab->table->map;
table_map dups_producing_tables, prev_dups_producing_tables,
prev_sjm_lookup_tables;
table_map dups_producing_tables, UNINIT_VAR(prev_dups_producing_tables),
UNINIT_VAR(prev_sjm_lookup_tables);
if (idx == join->const_tables)
dups_producing_tables= 0;
@ -2688,7 +2688,7 @@ void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx,
if ((emb_sj_nest= new_join_tab->emb_sj_nest))
dups_producing_tables |= emb_sj_nest->sj_inner_tables;
Semi_join_strategy_picker **strategy, **prev_strategy;
Semi_join_strategy_picker **strategy, **prev_strategy= 0;
if (idx == join->const_tables)
{
/* First table, initialize pickers */

View file

@ -1623,10 +1623,19 @@ int rpl_parallel_resize_pool_if_no_slaves(void)
}
/**
Resize pool if not active or busy (in which case we may be in
resize to 0
*/
int
rpl_parallel_activate_pool(rpl_parallel_thread_pool *pool)
{
if (!pool->count)
bool resize;
mysql_mutex_lock(&pool->LOCK_rpl_thread_pool);
resize= !pool->count || pool->busy;
mysql_mutex_unlock(&pool->LOCK_rpl_thread_pool);
if (resize)
return rpl_parallel_change_thread_count(pool, opt_slave_parallel_threads,
0);
return 0;

View file

@ -3021,7 +3021,8 @@ exit:
(entry= (acl_entry*) malloc(sizeof(acl_entry)+key_length)))
{
entry->access=(db_access & host_access);
entry->length=key_length;
DBUG_ASSERT(key_length < 0xffff);
entry->length=(uint16)key_length;
memcpy((uchar*) entry->key,key,key_length);
acl_cache->add(entry);
}

View file

@ -82,14 +82,14 @@ int read_bootstrap_query(char *query, int *query_length,
*/
if (query_len + len + 1 >= MAX_BOOTSTRAP_QUERY_SIZE)
{
int new_len= MAX_BOOTSTRAP_QUERY_SIZE - query_len - 1;
size_t new_len= MAX_BOOTSTRAP_QUERY_SIZE - query_len - 1;
if ((new_len > 0) && (query_len < MAX_BOOTSTRAP_QUERY_SIZE))
{
memcpy(query + query_len, line, new_len);
query_len+= new_len;
}
query[query_len]= '\0';
*query_length= query_len;
*query_length= (int)query_len;
return READ_BOOTSTRAP_QUERY_SIZE;
}
@ -111,7 +111,7 @@ int read_bootstrap_query(char *query, int *query_length,
Return the query found.
*/
query[query_len]= '\0';
*query_length= query_len;
*query_length= (int)query_len;
return READ_BOOTSTRAP_SUCCESS;
}
}

View file

@ -1904,11 +1904,8 @@ send_event_to_slave(binlog_send_info *info, Log_event_type event_type,
*/
if (info->thd->variables.option_bits & OPTION_SKIP_REPLICATION)
{
/*
The first byte of the packet is a '\0' to distinguish it from an error
packet. So the actual event starts at offset +1.
*/
uint16 event_flags= uint2korr(&((*packet)[FLAGS_OFFSET+1]));
uint16 event_flags= uint2korr(&((*packet)[FLAGS_OFFSET + ev_offset]));
if (event_flags & LOG_EVENT_SKIP_REPLICATION_F)
return NULL;
}

View file

@ -2973,6 +2973,7 @@ JOIN::create_postjoin_aggr_table(JOIN_TAB *tab, List<Item> *table_fields,
THD_STAGE_INFO(thd, stage_sorting_for_group);
if (ordered_index_usage != ordered_index_group_by &&
!only_const_tables() &&
(join_tab + const_tables)->type != JT_CONST && // Don't sort 1 row
!implicit_grouping &&
add_sorting_to_table(join_tab + const_tables, group_list))
@ -3006,6 +3007,7 @@ JOIN::create_postjoin_aggr_table(JOIN_TAB *tab, List<Item> *table_fields,
THD_STAGE_INFO(thd, stage_sorting_for_order);
if (ordered_index_usage != ordered_index_order_by &&
!only_const_tables() &&
add_sorting_to_table(join_tab + const_tables, order))
goto err;
order= NULL;

View file

@ -1177,7 +1177,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
char *keynames, *names, *comment_pos;
const uchar *forminfo, *extra2;
const uchar *frm_image_end = frm_image + frm_length;
uchar *record, *null_flags, *null_pos, *mysql57_vcol_null_pos= 0;
uchar *record, *null_flags, *null_pos, *UNINIT_VAR(mysql57_vcol_null_pos);
const uchar *disk_buff, *strpos;
ulong pos, record_offset;
ulong rec_buff_length;
@ -2425,7 +2425,10 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
reg_field= share->field[field_nr];
}
else
reg_field= 0; // Safety
{
reg_field= 0;
DBUG_ASSERT(name_length);
}
vcol_screen_pos+= FRM_VCOL_NEW_HEADER_SIZE;
vcol_info->set_vcol_type((enum_vcol_info_type) type);

View file

@ -2250,10 +2250,10 @@ public:
return (SQLCHAR *) (m_part[i].length ? m_part[i].str : NULL);
} // end of ptr
size_t length(uint i)
SQLSMALLINT length(uint i)
{
DBUG_ASSERT(i < max_parts);
return m_part[i].length;
return (SQLSMALLINT)m_part[i].length;
} // end of length
}; // end of class SQLQualifiedName

View file

@ -240,6 +240,7 @@ dict_stats_process_entry_from_defrag_pool()
return;
}
mutex_exit(&dict_sys->mutex);
dict_stats_save_defrag_stats(index);
dict_table_close(table, FALSE, FALSE);
}

View file

@ -1197,7 +1197,6 @@ int maria_create(const char *name, enum data_file_type datafile_type,
{
fn_format(dfilename,name,"", MARIA_NAME_DEXT,
MY_UNPACK_FILENAME | MY_APPEND_EXT);
dlinkname_ptr= NullS;
create_flag= (flags & HA_CREATE_KEEP_FILES) ? 0 : MY_DELETE_OLD;
}
if ((dfile=
@ -1251,8 +1250,6 @@ err_no_lock:
switch (errpos) {
case 3:
mysql_file_close(dfile, MYF(0));
/* fall through */
case 2:
if (! (flags & HA_DONT_TOUCH_DATA))
{
mysql_file_delete(key_file_dfile, dfilename, MYF(sync_dir));

View file

@ -402,7 +402,7 @@ my_strnxfrm_8bit_bin(CHARSET_INFO *cs,
if (dst != src)
memcpy(dst, src, srclen);
return my_strxfrm_pad_desc_and_reverse(cs, dst, dst + srclen, dst + dstlen,
nweights - srclen, flags, 0);
(uint)(nweights - srclen), flags, 0);
}
@ -416,7 +416,7 @@ my_strnxfrm_8bit_nopad_bin(CHARSET_INFO *cs,
if (dst != src)
memcpy(dst, src, srclen);
return my_strxfrm_pad_desc_and_reverse_nopad(cs, dst, dst + srclen,
dst + dstlen, nweights - srclen,
dst + dstlen,(uint)(nweights - srclen),
flags, 0);
}
@ -464,13 +464,13 @@ skip:
if (nmatch > 0)
{
match[0].beg= 0;
match[0].end= (size_t) (str- (const uchar*)b-1);
match[0].end= (uint) (str- (const uchar*)b-1);
match[0].mb_len= match[0].end;
if (nmatch > 1)
{
match[1].beg= match[0].end;
match[1].end= match[0].end+s_length;
match[1].end= (uint)(match[0].end+s_length);
match[1].mb_len= match[1].end-match[1].beg;
}
}

View file

@ -528,12 +528,12 @@ uint my_instr_mb(CHARSET_INFO *cs,
if (nmatch)
{
match[0].beg= 0;
match[0].end= (size_t) (b-b0);
match[0].end= (uint) (b-b0);
match[0].mb_len= res;
if (nmatch > 1)
{
match[1].beg= match[0].end;
match[1].end= match[0].end+s_length;
match[1].end= (uint)(match[0].end+s_length);
match[1].mb_len= 0; /* Not computed */
}
}

View file

@ -78,8 +78,8 @@ size_t my_strnxfrm_simple_internal(CHARSET_INFO * cs,
const uchar *map= cs->sort_order;
uchar *d0= dst;
uint frmlen;
if ((frmlen= MY_MIN(dstlen, *nweights)) > srclen)
frmlen= srclen;
if ((frmlen= (uint)MY_MIN(dstlen, *nweights)) > srclen)
frmlen= (uint)srclen;
if (dst != src)
{
const uchar *end;
@ -321,7 +321,7 @@ size_t my_snprintf_8bit(CHARSET_INFO *cs __attribute__((unused)),
const char* fmt, ...)
{
va_list args;
int result;
size_t result;
va_start(args,fmt);
result= my_vsnprintf(to, n, fmt, args);
va_end(args);
@ -1226,13 +1226,13 @@ skip:
if (nmatch > 0)
{
match[0].beg= 0;
match[0].end= (size_t) (str- (const uchar*)b-1);
match[0].end= (uint) (str- (const uchar*)b-1);
match[0].mb_len= match[0].end;
if (nmatch > 1)
{
match[1].beg= match[0].end;
match[1].end= match[0].end+s_length;
match[1].end= (uint)(match[0].end+s_length);
match[1].mb_len= match[1].end-match[1].beg;
}
}

View file

@ -449,7 +449,7 @@ static const uchar sort_order_tis620[]=
static size_t thai2sortable(uchar *tstr, size_t len)
{
uchar *p;
int tlen;
size_t tlen;
uchar l2bias;
tlen= len;
@ -609,10 +609,10 @@ my_strnxfrm_tis620(CHARSET_INFO *cs,
set_if_smaller(dstlen, nweights);
set_if_smaller(len, dstlen);
len= my_strxfrm_pad_desc_and_reverse(cs, dst, dst + len, dst + dstlen,
dstlen - len, flags, 0);
(uint)(dstlen - len), flags, 0);
if ((flags & MY_STRXFRM_PAD_TO_MAXLEN) && len < dstlen0)
{
uint fill_length= dstlen0 - len;
size_t fill_length= dstlen0 - len;
cs->cset->fill(cs, (char*) dst + len, fill_length, cs->pad_char);
len= dstlen0;
}
@ -632,10 +632,10 @@ my_strnxfrm_tis620_nopad(CHARSET_INFO *cs,
set_if_smaller(dstlen, nweights);
set_if_smaller(len, dstlen);
len= my_strxfrm_pad_desc_and_reverse_nopad(cs, dst, dst + len, dst + dstlen,
dstlen - len, flags, 0);
(uint)(dstlen - len), flags, 0);
if ((flags & MY_STRXFRM_PAD_TO_MAXLEN) && len < dstlen0)
{
uint fill_length= dstlen0 - len;
size_t fill_length= dstlen0 - len;
memset(dst + len, 0x00, fill_length);
len= dstlen0;
}

View file

@ -31260,7 +31260,7 @@ static my_bool
my_uca_alloc_contractions(MY_CONTRACTIONS *contractions,
MY_CHARSET_LOADER *loader, size_t n)
{
uint size= n * sizeof(MY_CONTRACTION);
size_t size= n * sizeof(MY_CONTRACTION);
if (!(contractions->item= (loader->once_alloc)(size)) ||
!(contractions->flags= (char *) (loader->once_alloc)(MY_UCA_CNT_FLAG_SIZE)))
return 1;
@ -34005,7 +34005,7 @@ apply_one_rule(MY_CHARSET_LOADER *loader,
{
MY_CONTRACTIONS *contractions= &dst->contractions;
to= my_uca_init_one_contraction(contractions,
r->curr, nshift, r->with_context);
r->curr, (uint)nshift, r->with_context);
/* Store weights of the "reset to" character */
dst->contractions.nitems--; /* Temporarily hide - it's incomplete */
rc= my_char_weight_put(dst,
@ -34202,9 +34202,9 @@ init_weight_level(MY_CHARSET_LOADER *loader, MY_COLL_RULES *rules,
ncontractions++;
}
ncontractions += src->contractions.nitems;
ncontractions += (int)src->contractions.nitems;
if ((my_uca_generate_pages(loader, dst, src, npages)))
if ((my_uca_generate_pages(loader, dst, src, (uint)npages)))
return TRUE;
if (ncontractions)

View file

@ -1078,7 +1078,7 @@ my_fill_mb2(CHARSET_INFO *cs, char *s, size_t slen, int fill)
}
static int
static size_t
my_vsnprintf_mb2(char *dst, size_t n, const char* fmt, va_list ap)
{
char *start=dst, *end= dst + n - 1;
@ -2327,7 +2327,7 @@ my_charlen_utf32(CHARSET_INFO *cs __attribute__((unused)),
/* Defines my_well_formed_char_length_utf32 */
static int
static size_t
my_vsnprintf_utf32(char *dst, size_t n, const char* fmt, va_list ap)
{
char *start= dst, *end= dst + n;

View file

@ -904,11 +904,11 @@ my_string_metadata_get(MY_STRING_METADATA *metadata,
if (cs->mbmaxlen == 1 && !(cs->state & MY_CS_NONASCII))
{
metadata->char_length= length;
metadata->repertoire= my_string_repertoire_8bit(cs, str, length);
metadata->repertoire= my_string_repertoire_8bit(cs, str, (ulong)length);
}
else
{
my_string_metadata_get_mb(metadata, cs, str, length);
my_string_metadata_get_mb(metadata, cs, str, (ulong)length);
}
}

View file

@ -92,10 +92,10 @@ static const char *get_length(const char *fmt, size_t *length, uint *pre_zero)
*/
static const char *get_length_arg(const char *fmt, ARGS_INFO *args_arr,
uint *arg_count, size_t *length, uint *flags)
size_t *arg_count, size_t *length, uint *flags)
{
fmt= get_length(fmt+1, length, flags);
*arg_count= MY_MAX(*arg_count, (uint) *length);
*arg_count= MY_MAX(*arg_count, *length);
(*length)--;
DBUG_ASSERT(*fmt == '$' && *length < MAX_ARGS);
args_arr[*length].arg_type= 'd';
@ -330,7 +330,7 @@ static char *process_args(CHARSET_INFO *cs, char *to, char *end,
{
ARGS_INFO args_arr[MAX_ARGS];
PRINT_INFO print_arr[MAX_PRINT_INFO];
uint idx= 0, arg_count= arg_index;
size_t idx= 0, arg_count= arg_index;
start:
/* Here we are at the beginning of positional argument, right after $ */

View file

@ -78,7 +78,7 @@ size_t vio_read_pipe(Vio *vio, uchar *buf, size_t count)
disable_iocp_notification(&vio->overlapped);
/* Attempt to read from the pipe (overlapped I/O). */
if (ReadFile(vio->hPipe, buf, count, &transferred, &vio->overlapped))
if (ReadFile(vio->hPipe, buf, (DWORD)count, &transferred, &vio->overlapped))
{
/* The operation completed immediately. */
ret= transferred;
@ -101,7 +101,7 @@ size_t vio_write_pipe(Vio *vio, const uchar *buf, size_t count)
disable_iocp_notification(&vio->overlapped);
/* Attempt to write to the pipe (overlapped I/O). */
if (WriteFile(vio->hPipe, buf, count, &transferred, &vio->overlapped))
if (WriteFile(vio->hPipe, buf, (DWORD)count, &transferred, &vio->overlapped))
{
/* The operation completed immediately. */
ret= transferred;

View file

@ -1296,7 +1296,7 @@ int vio_getnameinfo(const struct sockaddr *sa,
}
return getnameinfo(sa, sa_length,
hostname, hostname_size,
port, port_size,
hostname, (uint)hostname_size,
port, (uint)port_size,
flags);
}

View file

@ -141,10 +141,10 @@ size_t vio_ssl_read(Vio *vio, uchar *buf, size_t size)
vio->ssl_arg));
if (vio->async_context && vio->async_context->active)
ret= my_ssl_read_async(vio->async_context, (SSL *)vio->ssl_arg, buf, size);
ret= my_ssl_read_async(vio->async_context, (SSL *)vio->ssl_arg, buf, (int)size);
else
{
while ((ret= SSL_read(ssl, buf, size)) < 0)
while ((ret= SSL_read(ssl, buf, (int)size)) < 0)
{
enum enum_vio_io_event event;
@ -174,10 +174,10 @@ size_t vio_ssl_write(Vio *vio, const uchar *buf, size_t size)
if (vio->async_context && vio->async_context->active)
ret= my_ssl_write_async(vio->async_context, (SSL *)vio->ssl_arg, buf,
size);
(int)size);
else
{
while ((ret= SSL_write(ssl, buf, size)) < 0)
while ((ret= SSL_write(ssl, buf, (int)size)) < 0)
{
enum enum_vio_io_event event;
@ -200,7 +200,7 @@ size_t vio_ssl_write(Vio *vio, const uchar *buf, size_t size)
static long yassl_recv(void *ptr, void *buf, size_t len,
int flag __attribute__((unused)))
{
return vio_read(ptr, buf, len);
return (long)vio_read(ptr, buf, len);
}
@ -208,7 +208,7 @@ static long yassl_recv(void *ptr, void *buf, size_t len,
static long yassl_send(void *ptr, const void *buf, size_t len,
int flag __attribute__((unused)))
{
return vio_write(ptr, buf, len);
return (long)vio_write(ptr, buf, len);
}
#endif