1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge 10.1 into 10.2

This commit is contained in:
Marko Mäkelä
2018-08-03 13:02:56 +03:00
27 changed files with 134 additions and 124 deletions

View File

@ -472,6 +472,21 @@ struct datafile_cur_t {
size_t buf_size; size_t buf_size;
size_t buf_read; size_t buf_read;
size_t buf_offset; size_t buf_offset;
explicit datafile_cur_t(const char* filename = NULL) :
file(), thread_n(0), orig_buf(NULL), buf(NULL), buf_size(0),
buf_read(0), buf_offset(0)
{
memset(rel_path, 0, sizeof rel_path);
if (filename) {
strncpy(abs_path, filename, sizeof abs_path);
abs_path[(sizeof abs_path) - 1] = 0;
} else {
abs_path[0] = '\0';
}
rel_path[0] = '\0';
memset(&statinfo, 0, sizeof statinfo);
}
}; };
static static
@ -490,9 +505,7 @@ datafile_open(const char *file, datafile_cur_t *cursor, uint thread_n)
{ {
bool success; bool success;
memset(cursor, 0, sizeof(datafile_cur_t)); new (cursor) datafile_cur_t(file);
strncpy(cursor->abs_path, file, sizeof(cursor->abs_path));
/* Get the relative path for the destination tablespace name, i.e. the /* Get the relative path for the destination tablespace name, i.e. the
one that can be appended to the backup root directory. Non-system one that can be appended to the backup root directory. Non-system

View File

@ -178,8 +178,7 @@ xb_write_galera_info(bool incremental_prepare)
return; return;
} }
memset(&xid, 0, sizeof(xid)); xid.null();
xid.formatID = -1;
if (!trx_sys_read_wsrep_checkpoint(&xid)) { if (!trx_sys_read_wsrep_checkpoint(&xid)) {

View File

@ -35,3 +35,4 @@ galera.galera_pc_ignore_sb : MDEV-15811 Test failure on galera_pc_ignore_sb
galera_kill_applier : race condition at the start of the test galera_kill_applier : race condition at the start of the test
galera_ist_progress: MDEV-15236 galera_ist_progress fails when trying to read transfer status galera_ist_progress: MDEV-15236 galera_ist_progress fails when trying to read transfer status
pxc-421: Lock timeout exceeded pxc-421: Lock timeout exceeded
galera_sst_mysqldump_with_key : MDEV-16890 Galera test failure

View File

@ -2,7 +2,7 @@
#define HANDLER_INCLUDED #define HANDLER_INCLUDED
/* /*
Copyright (c) 2000, 2016, Oracle and/or its affiliates. Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2009, 2017, MariaDB Corporation. Copyright (c) 2009, 2018, MariaDB
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -598,7 +598,7 @@ struct xid_t {
bqual_length= b; bqual_length= b;
memcpy(data, d, g+b); memcpy(data, d, g+b);
} }
bool is_null() { return formatID == -1; } bool is_null() const { return formatID == -1; }
void null() { formatID= -1; } void null() { formatID= -1; }
my_xid quick_get_my_xid() my_xid quick_get_my_xid()
{ {

View File

@ -131,15 +131,14 @@ bool wsrep_get_SE_checkpoint(wsrep_uuid_t& uuid, wsrep_seqno_t& seqno)
seqno= WSREP_SEQNO_UNDEFINED; seqno= WSREP_SEQNO_UNDEFINED;
XID xid; XID xid;
memset(&xid, 0, sizeof(xid)); xid.null();
xid.formatID= -1;
if (wsrep_get_SE_checkpoint(xid)) if (wsrep_get_SE_checkpoint(xid))
{ {
return true; return true;
} }
if (xid.formatID == -1) // nil XID if (xid.is_null())
{ {
return false; return false;
} }

View File

@ -3344,7 +3344,7 @@ buf_relocate(
} }
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
memcpy(dpage, bpage, sizeof *dpage); new (dpage) buf_page_t(*bpage);
/* Important that we adjust the hazard pointer before /* Important that we adjust the hazard pointer before
removing bpage from LRU list. */ removing bpage from LRU list. */

View File

@ -1611,7 +1611,7 @@ func_exit:
} else if (buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE) { } else if (buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE) {
b = buf_page_alloc_descriptor(); b = buf_page_alloc_descriptor();
ut_a(b); ut_a(b);
memcpy(b, bpage, sizeof *b); new (b) buf_page_t(*bpage);
} }
ut_ad(buf_pool_mutex_own(buf_pool)); ut_ad(buf_pool_mutex_own(buf_pool));

View File

@ -39,27 +39,13 @@ static ib_mutex_t defrag_pool_mutex;
static mysql_pfs_key_t defrag_pool_mutex_key; static mysql_pfs_key_t defrag_pool_mutex_key;
#endif #endif
/** Indices whose defrag stats need to be saved to persistent storage.*/
struct defrag_pool_item_t {
table_id_t table_id;
index_id_t index_id;
};
/** Allocator type, used by std::vector */
typedef ut_allocator<defrag_pool_item_t>
defrag_pool_allocator_t;
/** The multitude of tables to be defragmented- an STL vector */
typedef std::vector<defrag_pool_item_t, defrag_pool_allocator_t>
defrag_pool_t;
/** Iterator type for iterating over the elements of objects of type /** Iterator type for iterating over the elements of objects of type
defrag_pool_t. */ defrag_pool_t. */
typedef defrag_pool_t::iterator defrag_pool_iterator_t; typedef defrag_pool_t::iterator defrag_pool_iterator_t;
/** Pool where we store information on which tables are to be processed /** Pool where we store information on which tables are to be processed
by background defragmentation. */ by background defragmentation. */
static defrag_pool_t* defrag_pool; defrag_pool_t defrag_pool;
extern bool dict_stats_start_shutdown; extern bool dict_stats_start_shutdown;
@ -70,14 +56,6 @@ dict_defrag_pool_init(void)
/*=======================*/ /*=======================*/
{ {
ut_ad(!srv_read_only_mode); ut_ad(!srv_read_only_mode);
/* JAN: TODO: MySQL 5.7 PSI
const PSI_memory_key key2 = mem_key_dict_defrag_pool_t;
defrag_pool = UT_NEW(defrag_pool_t(defrag_pool_allocator_t(key2)), key2);
recalc_pool->reserve(RECALC_POOL_INITIAL_SLOTS);
*/
defrag_pool = new std::vector<defrag_pool_item_t, defrag_pool_allocator_t>();
/* We choose SYNC_STATS_DEFRAG to be below SYNC_FSP_PAGE. */ /* We choose SYNC_STATS_DEFRAG to be below SYNC_FSP_PAGE. */
mutex_create(LATCH_ID_DEFRAGMENT_MUTEX, &defrag_pool_mutex); mutex_create(LATCH_ID_DEFRAGMENT_MUTEX, &defrag_pool_mutex);
@ -92,10 +70,7 @@ dict_defrag_pool_deinit(void)
{ {
ut_ad(!srv_read_only_mode); ut_ad(!srv_read_only_mode);
defrag_pool->clear();
mutex_free(&defrag_pool_mutex); mutex_free(&defrag_pool_mutex);
UT_DELETE(defrag_pool);
} }
/*****************************************************************//** /*****************************************************************//**
@ -115,16 +90,16 @@ dict_stats_defrag_pool_get(
mutex_enter(&defrag_pool_mutex); mutex_enter(&defrag_pool_mutex);
if (defrag_pool->empty()) { if (defrag_pool.empty()) {
mutex_exit(&defrag_pool_mutex); mutex_exit(&defrag_pool_mutex);
return(false); return(false);
} }
defrag_pool_item_t& item = defrag_pool->back(); defrag_pool_item_t& item = defrag_pool.back();
*table_id = item.table_id; *table_id = item.table_id;
*index_id = item.index_id; *index_id = item.index_id;
defrag_pool->pop_back(); defrag_pool.pop_back();
mutex_exit(&defrag_pool_mutex); mutex_exit(&defrag_pool_mutex);
@ -149,8 +124,8 @@ dict_stats_defrag_pool_add(
mutex_enter(&defrag_pool_mutex); mutex_enter(&defrag_pool_mutex);
/* quit if already in the list */ /* quit if already in the list */
for (defrag_pool_iterator_t iter = defrag_pool->begin(); for (defrag_pool_iterator_t iter = defrag_pool.begin();
iter != defrag_pool->end(); iter != defrag_pool.end();
++iter) { ++iter) {
if ((*iter).table_id == index->table->id if ((*iter).table_id == index->table->id
&& (*iter).index_id == index->id) { && (*iter).index_id == index->id) {
@ -161,7 +136,7 @@ dict_stats_defrag_pool_add(
item.table_id = index->table->id; item.table_id = index->table->id;
item.index_id = index->id; item.index_id = index->id;
defrag_pool->push_back(item); defrag_pool.push_back(item);
mutex_exit(&defrag_pool_mutex); mutex_exit(&defrag_pool_mutex);
@ -183,14 +158,14 @@ dict_stats_defrag_pool_del(
mutex_enter(&defrag_pool_mutex); mutex_enter(&defrag_pool_mutex);
defrag_pool_iterator_t iter = defrag_pool->begin(); defrag_pool_iterator_t iter = defrag_pool.begin();
while (iter != defrag_pool->end()) { while (iter != defrag_pool.end()) {
if ((table && (*iter).table_id == table->id) if ((table && (*iter).table_id == table->id)
|| (index || (index
&& (*iter).table_id == index->table->id && (*iter).table_id == index->table->id
&& (*iter).index_id == index->id)) { && (*iter).index_id == index->id)) {
/* erase() invalidates the iterator */ /* erase() invalidates the iterator */
iter = defrag_pool->erase(iter); iter = defrag_pool.erase(iter);
if (index) if (index)
break; break;
} else { } else {
@ -252,7 +227,7 @@ void
dict_defrag_process_entries_from_defrag_pool() dict_defrag_process_entries_from_defrag_pool()
/*==========================================*/ /*==========================================*/
{ {
while (defrag_pool->size() && !dict_stats_start_shutdown) { while (defrag_pool.size() && !dict_stats_start_shutdown) {
dict_stats_process_entry_from_defrag_pool(); dict_stats_process_entry_from_defrag_pool();
} }
} }

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2012, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation. Copyright (c) 2017, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
@ -82,40 +82,29 @@ typedef recalc_pool_t::iterator
/** Pool where we store information on which tables are to be processed /** Pool where we store information on which tables are to be processed
by background statistics gathering. */ by background statistics gathering. */
static recalc_pool_t* recalc_pool; static recalc_pool_t recalc_pool;
/*****************************************************************//**
Initialize the recalc pool, called once during thread initialization. */
static
void
dict_stats_recalc_pool_init()
/*=========================*/
{
ut_ad(!srv_read_only_mode);
/* JAN: TODO: MySQL 5.7 PSI
const PSI_memory_key key = mem_key_dict_stats_bg_recalc_pool_t;
recalc_pool = UT_NEW(recalc_pool_t(recalc_pool_allocator_t(key)), key);
recalc_pool->reserve(RECALC_POOL_INITIAL_SLOTS);
*/
recalc_pool = new std::vector<table_id_t, recalc_pool_allocator_t>();
}
/*****************************************************************//** /*****************************************************************//**
Free the resources occupied by the recalc pool, called once during Free the resources occupied by the recalc pool, called once during
thread de-initialization. */ thread de-initialization. */
static static void dict_stats_recalc_pool_deinit()
void
dict_stats_recalc_pool_deinit()
/*===========================*/
{ {
ut_ad(!srv_read_only_mode); ut_ad(!srv_read_only_mode);
recalc_pool->clear(); recalc_pool.clear();
defrag_pool.clear();
UT_DELETE(recalc_pool); /*
recalc_pool may still have its buffer allocated. It will free it when
its destructor is called.
The problem is, memory leak detector is run before the recalc_pool's
destructor is invoked, and will report recalc_pool's buffer as leaked
memory. To avoid that, we force recalc_pool to surrender its buffer
to empty_pool object, which will free it when leaving this function:
*/
recalc_pool_t recalc_empty_pool;
defrag_pool_t defrag_empty_pool;
recalc_pool.swap(recalc_empty_pool);
defrag_pool.swap(defrag_empty_pool);
} }
/*****************************************************************//** /*****************************************************************//**
@ -135,8 +124,8 @@ dict_stats_recalc_pool_add(
mutex_enter(&recalc_pool_mutex); mutex_enter(&recalc_pool_mutex);
/* quit if already in the list */ /* quit if already in the list */
for (recalc_pool_iterator_t iter = recalc_pool->begin(); for (recalc_pool_iterator_t iter = recalc_pool.begin();
iter != recalc_pool->end(); iter != recalc_pool.end();
++iter) { ++iter) {
if (*iter == table->id) { if (*iter == table->id) {
@ -145,7 +134,7 @@ dict_stats_recalc_pool_add(
} }
} }
recalc_pool->push_back(table->id); recalc_pool.push_back(table->id);
mutex_exit(&recalc_pool_mutex); mutex_exit(&recalc_pool_mutex);
@ -221,14 +210,14 @@ dict_stats_recalc_pool_get(
mutex_enter(&recalc_pool_mutex); mutex_enter(&recalc_pool_mutex);
if (recalc_pool->empty()) { if (recalc_pool.empty()) {
mutex_exit(&recalc_pool_mutex); mutex_exit(&recalc_pool_mutex);
return(false); return(false);
} }
*id = recalc_pool->at(0); *id = recalc_pool.at(0);
recalc_pool->erase(recalc_pool->begin()); recalc_pool.erase(recalc_pool.begin());
mutex_exit(&recalc_pool_mutex); mutex_exit(&recalc_pool_mutex);
@ -250,13 +239,13 @@ dict_stats_recalc_pool_del(
ut_ad(table->id > 0); ut_ad(table->id > 0);
for (recalc_pool_iterator_t iter = recalc_pool->begin(); for (recalc_pool_iterator_t iter = recalc_pool.begin();
iter != recalc_pool->end(); iter != recalc_pool.end();
++iter) { ++iter) {
if (*iter == table->id) { if (*iter == table->id) {
/* erase() invalidates the iterator */ /* erase() invalidates the iterator */
recalc_pool->erase(iter); recalc_pool.erase(iter);
break; break;
} }
} }
@ -314,9 +303,7 @@ dict_stats_thread_init()
mutex_create(LATCH_ID_RECALC_POOL, &recalc_pool_mutex); mutex_create(LATCH_ID_RECALC_POOL, &recalc_pool_mutex);
dict_stats_recalc_pool_init();
dict_defrag_pool_init(); dict_defrag_pool_init();
} }
/*****************************************************************//** /*****************************************************************//**

View File

@ -4105,7 +4105,7 @@ fts_query(
if (trx_is_interrupted(trx)) { if (trx_is_interrupted(trx)) {
error = DB_INTERRUPTED; error = DB_INTERRUPTED;
ut_free(lc_query_str); ut_free(lc_query_str);
if (result != NULL) { if (*result) {
fts_query_free_result(*result); fts_query_free_result(*result);
} }
goto func_exit; goto func_exit;

View File

@ -33,6 +33,25 @@ Created 25/08/2016 Jan Lindström
#include "os0event.h" #include "os0event.h"
#include "os0thread.h" #include "os0thread.h"
/** Indices whose defrag stats need to be saved to persistent storage.*/
struct defrag_pool_item_t {
table_id_t table_id;
index_id_t index_id;
};
/** Allocator type, used by std::vector */
typedef ut_allocator<defrag_pool_item_t>
defrag_pool_allocator_t;
/** The multitude of tables to be defragmented- an STL vector */
typedef std::vector<defrag_pool_item_t, defrag_pool_allocator_t>
defrag_pool_t;
/** Pool where we store information on which tables are to be processed
by background defragmentation. */
extern defrag_pool_t defrag_pool;
/*****************************************************************//** /*****************************************************************//**
Initialize the defrag pool, called once during thread initialization. */ Initialize the defrag pool, called once during thread initialization. */
void void

View File

@ -733,6 +733,9 @@ struct dict_field_t{
unsigned fixed_len:10; /*!< 0 or the fixed length of the unsigned fixed_len:10; /*!< 0 or the fixed length of the
column if smaller than column if smaller than
DICT_ANTELOPE_MAX_INDEX_COL_LEN */ DICT_ANTELOPE_MAX_INDEX_COL_LEN */
/** Zero-initialize all fields */
dict_field_t() : col(NULL), name(NULL), prefix_len(0), fixed_len(0) {}
}; };
/**********************************************************************//** /**********************************************************************//**

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2017, MariaDB Corporation. Copyright (c) 2015, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
@ -122,6 +122,16 @@ struct fts_tokenize_ctx {
dfield_t sort_field[FTS_NUM_FIELDS_SORT]; dfield_t sort_field[FTS_NUM_FIELDS_SORT];
/*!< in: sort field */ /*!< in: sort field */
fts_token_list_t fts_token_list; fts_token_list_t fts_token_list;
fts_tokenize_ctx() :
processed_len(0), init_pos(0), buf_used(0),
rows_added(), cached_stopword(NULL), sort_field(),
fts_token_list()
{
memset(rows_added, 0, sizeof rows_added);
memset(sort_field, 0, sizeof sort_field);
UT_LIST_INIT(fts_token_list, &row_fts_token_t::token_list);
}
}; };
typedef struct fts_tokenize_ctx fts_tokenize_ctx_t; typedef struct fts_tokenize_ctx fts_tokenize_ctx_t;

View File

@ -807,7 +807,6 @@ fts_parallel_tokenization(
merge_file = psort_info->merge_file; merge_file = psort_info->merge_file;
blob_heap = mem_heap_create(512); blob_heap = mem_heap_create(512);
memset(&doc, 0, sizeof(doc)); memset(&doc, 0, sizeof(doc));
memset(&t_ctx, 0, sizeof(t_ctx));
memset(mycount, 0, FTS_NUM_AUX_INDEX * sizeof(int)); memset(mycount, 0, FTS_NUM_AUX_INDEX * sizeof(int));
doc.charset = fts_index_get_charset( doc.charset = fts_index_get_charset(

View File

@ -2409,8 +2409,6 @@ row_import_cfg_read_index_fields(
dict_field_t* field = index->m_fields; dict_field_t* field = index->m_fields;
memset(field, 0x0, sizeof(*field) * n_fields);
for (ulint i = 0; i < n_fields; ++i, ++field) { for (ulint i = 0; i < n_fields; ++i, ++field) {
byte* ptr = row; byte* ptr = row;
@ -2428,6 +2426,8 @@ row_import_cfg_read_index_fields(
return(DB_IO_ERROR); return(DB_IO_ERROR);
} }
new (field) dict_field_t();
field->prefix_len = mach_read_from_4(ptr); field->prefix_len = mach_read_from_4(ptr);
ptr += sizeof(ib_uint32_t); ptr += sizeof(ib_uint32_t);

View File

@ -336,11 +336,12 @@ trx_sys_read_wsrep_checkpoint(XID* xid)
if ((magic = mach_read_from_4(sys_header + TRX_SYS_WSREP_XID_INFO if ((magic = mach_read_from_4(sys_header + TRX_SYS_WSREP_XID_INFO
+ TRX_SYS_WSREP_XID_MAGIC_N_FLD)) + TRX_SYS_WSREP_XID_MAGIC_N_FLD))
!= TRX_SYS_WSREP_XID_MAGIC_N) { != TRX_SYS_WSREP_XID_MAGIC_N) {
memset(xid, 0, sizeof(*xid)); mtr.commit();
long long seqno= -1; xid->null();
memcpy(xid->data + 24, &seqno, sizeof(long long)); xid->gtrid_length = 0;
xid->formatID = -1; xid->bqual_length = 0;
mtr_commit(&mtr); memset(xid->data, 0, sizeof xid->data);
memset(xid->data + 24, 0xff, 8);
return false; return false;
} }

View File

@ -1181,8 +1181,7 @@ trx_start_low(
} }
#ifdef WITH_WSREP #ifdef WITH_WSREP
memset(trx->xid, 0, sizeof(xid_t)); trx->xid->null();
trx->xid->formatID = -1;
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
/* The initial value for trx->no: TRX_ID_MAX is used in /* The initial value for trx->no: TRX_ID_MAX is used in

View File

@ -1994,7 +1994,7 @@ buf_relocate(
} }
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
memcpy(dpage, bpage, sizeof *dpage); new (dpage) buf_page_t(*bpage);
ut_d(bpage->in_LRU_list = FALSE); ut_d(bpage->in_LRU_list = FALSE);
ut_d(bpage->in_page_hash = FALSE); ut_d(bpage->in_page_hash = FALSE);

View File

@ -1838,7 +1838,7 @@ not_freed:
} }
if (b) { if (b) {
memcpy(b, bpage, sizeof *b); new (b) buf_page_t(*bpage);
} }
if (!buf_LRU_block_remove_hashed(bpage, zip)) { if (!buf_LRU_block_remove_hashed(bpage, zip)) {

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2012, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation. Copyright (c) 2017, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
@ -95,17 +95,13 @@ dict_stats_pool_init()
/*****************************************************************//** /*****************************************************************//**
Free the resources occupied by the recalc pool, called once during Free the resources occupied by the recalc pool, called once during
thread de-initialization. */ thread de-initialization. */
static static void dict_stats_pool_deinit()
void
dict_stats_pool_deinit()
/*===========================*/
{ {
ut_ad(!srv_read_only_mode); ut_ad(!srv_read_only_mode);
recalc_pool.clear(); recalc_pool.clear();
defrag_pool.clear(); defrag_pool.clear();
/*
/*
recalc_pool may still have its buffer allocated. It will free it when recalc_pool may still have its buffer allocated. It will free it when
its destructor is called. its destructor is called.
The problem is, memory leak detector is run before the recalc_pool's The problem is, memory leak detector is run before the recalc_pool's
@ -115,9 +111,7 @@ dict_stats_pool_deinit()
*/ */
recalc_pool_t recalc_empty_pool; recalc_pool_t recalc_empty_pool;
defrag_pool_t defrag_empty_pool; defrag_pool_t defrag_empty_pool;
memset(&recalc_empty_pool, 0, sizeof(recalc_pool_t)); recalc_pool.swap(recalc_empty_pool);
memset(&defrag_empty_pool, 0, sizeof(defrag_pool_t));
recalc_pool.swap(recalc_empty_pool);
defrag_pool.swap(defrag_empty_pool); defrag_pool.swap(defrag_empty_pool);
} }

View File

@ -4038,7 +4038,7 @@ fts_query(
if (trx_is_interrupted(trx)) { if (trx_is_interrupted(trx)) {
error = DB_INTERRUPTED; error = DB_INTERRUPTED;
ut_free(lc_query_str); ut_free(lc_query_str);
if (result != NULL) { if (*result) {
fts_query_free_result(*result); fts_query_free_result(*result);
} }
goto func_exit; goto func_exit;

View File

@ -605,6 +605,9 @@ struct dict_field_t{
unsigned fixed_len:10; /*!< 0 or the fixed length of the unsigned fixed_len:10; /*!< 0 or the fixed length of the
column if smaller than column if smaller than
DICT_ANTELOPE_MAX_INDEX_COL_LEN */ DICT_ANTELOPE_MAX_INDEX_COL_LEN */
/** Zero-initialize all fields */
dict_field_t() : col(NULL), name(NULL), prefix_len(0), fixed_len(0) {}
}; };
/**********************************************************************//** /**********************************************************************//**

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, 2017, MariaDB Corporation. Copyright (c) 2015, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
@ -111,6 +111,14 @@ struct fts_tokenize_ctx {
ib_rbt_t* cached_stopword;/*!< in: stopword list */ ib_rbt_t* cached_stopword;/*!< in: stopword list */
dfield_t sort_field[FTS_NUM_FIELDS_SORT]; dfield_t sort_field[FTS_NUM_FIELDS_SORT];
/*!< in: sort field */ /*!< in: sort field */
fts_tokenize_ctx() :
processed_len(0), init_pos(0), buf_used(0),
rows_added(), cached_stopword(NULL), sort_field()
{
memset(rows_added, 0, sizeof rows_added);
memset(sort_field, 0, sizeof sort_field);
}
}; };
typedef struct fts_tokenize_ctx fts_tokenize_ctx_t; typedef struct fts_tokenize_ctx fts_tokenize_ctx_t;

View File

@ -676,7 +676,6 @@ fts_parallel_tokenization(
merge_file = psort_info->merge_file; merge_file = psort_info->merge_file;
blob_heap = mem_heap_create(512); blob_heap = mem_heap_create(512);
memset(&doc, 0, sizeof(doc)); memset(&doc, 0, sizeof(doc));
memset(&t_ctx, 0, sizeof(t_ctx));
memset(mycount, 0, FTS_NUM_AUX_INDEX * sizeof(int)); memset(mycount, 0, FTS_NUM_AUX_INDEX * sizeof(int));
doc.charset = fts_index_get_charset( doc.charset = fts_index_get_charset(

View File

@ -2514,8 +2514,6 @@ row_import_cfg_read_index_fields(
dict_field_t* field = index->m_fields; dict_field_t* field = index->m_fields;
memset(field, 0x0, sizeof(*field) * n_fields);
for (ulint i = 0; i < n_fields; ++i, ++field) { for (ulint i = 0; i < n_fields; ++i, ++field) {
byte* ptr = row; byte* ptr = row;
@ -2533,6 +2531,8 @@ row_import_cfg_read_index_fields(
return(DB_IO_ERROR); return(DB_IO_ERROR);
} }
new (field) dict_field_t();
field->prefix_len = mach_read_from_4(ptr); field->prefix_len = mach_read_from_4(ptr);
ptr += sizeof(ib_uint32_t); ptr += sizeof(ib_uint32_t);

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation. Copyright (c) 2017, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
@ -351,7 +351,7 @@ trx_sys_update_wsrep_checkpoint(
mtr_t* mtr) mtr_t* mtr)
{ {
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
if (xid->formatID != -1 if (!xid->is_null()
&& mach_read_from_4(sys_header + TRX_SYS_WSREP_XID_INFO && mach_read_from_4(sys_header + TRX_SYS_WSREP_XID_INFO
+ TRX_SYS_WSREP_XID_MAGIC_N_FLD) + TRX_SYS_WSREP_XID_MAGIC_N_FLD)
== TRX_SYS_WSREP_XID_MAGIC_N) { == TRX_SYS_WSREP_XID_MAGIC_N) {
@ -372,7 +372,7 @@ trx_sys_update_wsrep_checkpoint(
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
ut_ad(xid && mtr); ut_ad(xid && mtr);
ut_a(xid->formatID == -1 || wsrep_is_wsrep_xid((const XID *)xid)); ut_a(xid->is_null() || wsrep_is_wsrep_xid((const XID *)xid));
if (mach_read_from_4(sys_header + TRX_SYS_WSREP_XID_INFO if (mach_read_from_4(sys_header + TRX_SYS_WSREP_XID_INFO
+ TRX_SYS_WSREP_XID_MAGIC_N_FLD) + TRX_SYS_WSREP_XID_MAGIC_N_FLD)
@ -421,8 +421,10 @@ trx_sys_read_wsrep_checkpoint(XID* xid)
if ((magic = mach_read_from_4(sys_header + TRX_SYS_WSREP_XID_INFO if ((magic = mach_read_from_4(sys_header + TRX_SYS_WSREP_XID_INFO
+ TRX_SYS_WSREP_XID_MAGIC_N_FLD)) + TRX_SYS_WSREP_XID_MAGIC_N_FLD))
!= TRX_SYS_WSREP_XID_MAGIC_N) { != TRX_SYS_WSREP_XID_MAGIC_N) {
memset(xid, 0, sizeof(*xid)); xid->null();
xid->formatID = -1; xid->gtrid_length = 0;
xid->bqual_length = 0;
memset(xid->data, 0, sizeof xid->data);
trx_sys_update_wsrep_checkpoint(xid, sys_header, &mtr); trx_sys_update_wsrep_checkpoint(xid, sys_header, &mtr);
mtr_commit(&mtr); mtr_commit(&mtr);
return false; return false;

View File

@ -278,7 +278,7 @@ trx_create(void)
trx->distinct_page_access_hash = NULL; trx->distinct_page_access_hash = NULL;
trx->take_stats = FALSE; trx->take_stats = FALSE;
trx->xid.formatID = -1; trx->xid.null();
trx->op_info = ""; trx->op_info = "";
@ -1041,8 +1041,7 @@ trx_start_low(
} }
#ifdef WITH_WSREP #ifdef WITH_WSREP
memset(&trx->xid, 0, sizeof(trx->xid)); trx->xid.null();
trx->xid.formatID = -1;
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
/* The initial value for trx->no: TRX_ID_MAX is used in /* The initial value for trx->no: TRX_ID_MAX is used in