Skip to content

Commit

Permalink
5.6.23-72.1
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed May 4, 2015
1 parent 14a142f commit a4416ab
Show file tree
Hide file tree
Showing 30 changed files with 272 additions and 85 deletions.
12 changes: 6 additions & 6 deletions storage/xtradb/btr/btr0cur.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2522,15 +2522,15 @@ btr_cur_pess_upd_restore_supremum(
Check if the total length of the modified blob for the row is within 10%
of the total redo log size. This constraint on the blob length is to
avoid overwriting the redo logs beyond the last checkpoint lsn.
@return DB_SUCCESS or DB_TOO_BIG_RECORD. */
@return DB_SUCCESS or DB_TOO_BIG_FOR_REDO. */
static
dberr_t
btr_check_blob_limit(const big_rec_t* big_rec_vec)
{
const ib_uint64_t redo_size = srv_n_log_files * srv_log_file_size
* UNIV_PAGE_SIZE;
const ulint redo_10p = redo_size / 10;
ulint total_blob_len = 0;
const ib_uint64_t redo_10p = redo_size / 10;
ib_uint64_t total_blob_len = 0;
dberr_t err = DB_SUCCESS;

/* Calculate the total number of bytes for blob data */
Expand All @@ -2540,11 +2540,11 @@ btr_check_blob_limit(const big_rec_t* big_rec_vec)

if (total_blob_len > redo_10p) {
ib_logf(IB_LOG_LEVEL_ERROR, "The total blob data"
" length (" ULINTPF ") is greater than"
" length (" UINT64PF ") is greater than"
" 10%% of the total redo log size (" UINT64PF
"). Please increase total redo log size.",
total_blob_len, redo_size);
err = DB_TOO_BIG_RECORD;
err = DB_TOO_BIG_FOR_REDO;
}

return(err);
Expand Down Expand Up @@ -4613,7 +4613,7 @@ Stores the fields in big_rec_vec to the tablespace and puts pointers to
them in rec. The extern flags in rec will have to be set beforehand.
The fields are stored on pages allocated from leaf node
file segment of the index tree.
@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */
@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE or DB_TOO_BIG_FOR_REDO */
UNIV_INTERN
dberr_t
btr_store_big_rec_extern_fields(
Expand Down
6 changes: 3 additions & 3 deletions storage/xtradb/dict/dict0dict.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2423,10 +2423,10 @@ dict_index_add_to_cache(
dict_mem_index_free(new_index);
dict_mem_index_free(index);
return(DB_TOO_BIG_RECORD);
} else {

} else if (current_thd != NULL) {
/* Avoid the warning to be printed
during recovery. */
ib_warn_row_too_big(table);

}
}

Expand Down
60 changes: 52 additions & 8 deletions storage/xtradb/dict/dict0mem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ dict_mem_table_col_rename_low(
ut_ad(from_len <= NAME_LEN);
ut_ad(to_len <= NAME_LEN);

char from[NAME_LEN];
strncpy(from, s, NAME_LEN);

if (from_len == to_len) {
/* The easy case: simply replace the column name in
table->col_names. */
Expand Down Expand Up @@ -363,14 +366,53 @@ dict_mem_table_col_rename_low(

foreign = *it;

for (unsigned f = 0; f < foreign->n_fields; f++) {
/* These can point straight to
table->col_names, because the foreign key
constraints will be freed at the same time
when the table object is freed. */
foreign->foreign_col_names[f]
= dict_index_get_nth_field(
foreign->foreign_index, f)->name;
if (foreign->foreign_index == NULL) {
/* We may go here when we set foreign_key_checks to 0,
and then try to rename a column and modify the
corresponding foreign key constraint. The index
would have been dropped, we have to find an equivalent
one */
for (unsigned f = 0; f < foreign->n_fields; f++) {
if (strcmp(foreign->foreign_col_names[f], from)
== 0) {

char** rc = const_cast<char**>(
foreign->foreign_col_names
+ f);

if (to_len <= strlen(*rc)) {
memcpy(*rc, to, to_len + 1);
} else {
*rc = static_cast<char*>(
mem_heap_dup(
foreign->heap,
to,
to_len + 1));
}
}
}

dict_index_t* new_index = dict_foreign_find_index(
foreign->foreign_table, NULL,
foreign->foreign_col_names,
foreign->n_fields, NULL, true, false);
/* There must be an equivalent index in this case. */
ut_ad(new_index != NULL);

foreign->foreign_index = new_index;

} else {

for (unsigned f = 0; f < foreign->n_fields; f++) {
/* These can point straight to
table->col_names, because the foreign key
constraints will be freed at the same time
when the table object is freed. */
foreign->foreign_col_names[f]
= dict_index_get_nth_field(
foreign->foreign_index,
f)->name;
}
}
}

Expand All @@ -380,6 +422,8 @@ dict_mem_table_col_rename_low(

foreign = *it;

ut_ad(foreign->referenced_index != NULL);

for (unsigned f = 0; f < foreign->n_fields; f++) {
/* foreign->referenced_col_names[] need to be
copies, because the constraint may become
Expand Down
48 changes: 48 additions & 0 deletions storage/xtradb/fts/fts0ast.cc
Original file line number Diff line number Diff line change
Expand Up @@ -694,3 +694,51 @@ fts_ast_string_print(

printf("\n");
}

#ifdef UNIV_DEBUG
const char*
fts_ast_oper_name_get(fts_ast_oper_t oper)
{
switch(oper) {
case FTS_NONE:
return("FTS_NONE");
case FTS_IGNORE:
return("FTS_IGNORE");
case FTS_EXIST:
return("FTS_EXIST");
case FTS_NEGATE:
return("FTS_NEGATE");
case FTS_INCR_RATING:
return("FTS_INCR_RATING");
case FTS_DECR_RATING:
return("FTS_DECR_RATING");
case FTS_DISTANCE:
return("FTS_DISTANCE");
case FTS_IGNORE_SKIP:
return("FTS_IGNORE_SKIP");
case FTS_EXIST_SKIP:
return("FTS_EXIST_SKIP");
}
ut_ad(0);
}

const char*
fts_ast_node_type_get(fts_ast_type_t type)
{
switch (type) {
case FTS_AST_OPER:
return("FTS_AST_OPER");
case FTS_AST_NUMB:
return("FTS_AST_NUMB");
case FTS_AST_TERM:
return("FTS_AST_TERM");
case FTS_AST_TEXT:
return("FTS_AST_TEXT");
case FTS_AST_LIST:
return("FTS_AST_LIST");
case FTS_AST_SUBEXP_LIST:
return("FTS_AST_SUBEXP_LIST");
}
ut_ad(0);
}
#endif /* UNIV_DEBUG */
2 changes: 0 additions & 2 deletions storage/xtradb/fts/fts0opt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2577,8 +2577,6 @@ fts_optimize_add_table(
return;
}

ut_ad(table->cached && table->fts != NULL);

/* Make sure table with FTS index cannot be evicted */
if (table->can_be_evicted) {
dict_table_move_from_lru_to_non_lru(table);
Expand Down
44 changes: 27 additions & 17 deletions storage/xtradb/fts/fts0que.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,8 @@ fts_merge_doc_ids(
{
const ib_rbt_node_t* node;

ut_a(!rbt_empty(doc_ids));
DBUG_ENTER("fts_merge_doc_ids");

ut_a(!query->intersection);

/* To process FTS_EXIST operation (intersection), we need
Expand All @@ -1559,7 +1560,7 @@ fts_merge_doc_ids(
query, ranking->doc_id, ranking->rank);

if (query->error != DB_SUCCESS) {
return(query->error);
DBUG_RETURN(query->error);
}

/* Merge words. Don't need to take operator into account. */
Expand All @@ -1578,7 +1579,7 @@ fts_merge_doc_ids(
query->intersection = NULL;
}

return(DB_SUCCESS);
DBUG_RETURN(DB_SUCCESS);
}

/*****************************************************************//**
Expand Down Expand Up @@ -2838,11 +2839,11 @@ fts_query_visitor(
fts_query_t* query = static_cast<fts_query_t*>(arg);

ut_a(node);
DBUG_ENTER("fts_query_visitor");
DBUG_PRINT("fts", ("nodetype: %s", fts_ast_node_type_get(node->type)));

token.f_n_char = 0;

query->oper = oper;

query->cur_node = node;

switch (node->type) {
Expand Down Expand Up @@ -2904,7 +2905,7 @@ fts_query_visitor(
query->multi_exist = true;
}

return(query->error);
DBUG_RETURN(query->error);
}

/*****************************************************************//**
Expand All @@ -2928,6 +2929,8 @@ fts_ast_visit_sub_exp(
bool will_be_ignored = false;
bool multi_exist;

DBUG_ENTER("fts_ast_visit_sub_exp");

ut_a(node->type == FTS_AST_SUBEXP_LIST);

cur_oper = query->oper;
Expand Down Expand Up @@ -2956,14 +2959,14 @@ fts_ast_visit_sub_exp(
/* Merge the sub-expression result with the parent result set. */
subexpr_doc_ids = query->doc_ids;
query->doc_ids = parent_doc_ids;
if (error == DB_SUCCESS && !rbt_empty(subexpr_doc_ids)) {
if (error == DB_SUCCESS) {
error = fts_merge_doc_ids(query, subexpr_doc_ids);
}

/* Free current result set. Result already merged into parent. */
fts_query_free_doc_ids(query, subexpr_doc_ids);

return(error);
DBUG_RETURN(error);
}

#if 0
Expand Down Expand Up @@ -3439,8 +3442,10 @@ fts_retrieve_ranking(
ib_rbt_bound_t parent;
fts_ranking_t new_ranking;

DBUG_ENTER("fts_retrieve_ranking");

if (!result || !result->rankings_by_id) {
return(0);
DBUG_RETURN(0);
}

new_ranking.doc_id = doc_id;
Expand All @@ -3451,10 +3456,10 @@ fts_retrieve_ranking(

ranking = rbt_value(fts_ranking_t, parent.last);

return(ranking->rank);
DBUG_RETURN(ranking->rank);
}

return(0);
DBUG_RETURN(0);
}

/*****************************************************************//**
Expand All @@ -3471,6 +3476,8 @@ fts_query_prepare_result(
const ib_rbt_node_t* node;
bool result_is_null = false;

DBUG_ENTER("fts_query_prepare_result");

if (result == NULL) {
result = static_cast<fts_result_t*>(ut_malloc(sizeof(*result)));

Expand Down Expand Up @@ -3519,7 +3526,7 @@ fts_query_prepare_result(
if (query->total_size > fts_result_cache_limit) {
query->error = DB_FTS_EXCEED_RESULT_CACHE_LIMIT;
fts_query_free_result(result);
return(NULL);
DBUG_RETURN(NULL);
}
}

Expand All @@ -3542,7 +3549,7 @@ fts_query_prepare_result(
ranking->rank * word_freq->idf * word_freq->idf);
}

return(result);
DBUG_RETURN(result);
}

ut_a(rbt_size(query->doc_ids) > 0);
Expand All @@ -3569,7 +3576,7 @@ fts_query_prepare_result(
if (query->total_size > fts_result_cache_limit) {
query->error = DB_FTS_EXCEED_RESULT_CACHE_LIMIT;
fts_query_free_result(result);
return(NULL);
DBUG_RETURN(NULL);
}
}
}
Expand All @@ -3581,7 +3588,7 @@ fts_query_prepare_result(
query->doc_ids = NULL;
}

return(result);
DBUG_RETURN(result);
}

/*****************************************************************//**
Expand All @@ -3593,6 +3600,8 @@ fts_query_get_result(
fts_query_t* query, /*!< in: query instance */
fts_result_t* result) /*!< in: result */
{
DBUG_ENTER("fts_query_get_result");

if (rbt_size(query->doc_ids) > 0 || query->flags == FTS_OPT_RANKING) {
/* Copy the doc ids to the result. */
result = fts_query_prepare_result(query, result);
Expand All @@ -3602,7 +3611,7 @@ fts_query_get_result(
memset(result, 0, sizeof(*result));
}

return(result);
DBUG_RETURN(result);
}

/*****************************************************************//**
Expand Down Expand Up @@ -3680,6 +3689,7 @@ fts_query_parse(
int error;
fts_ast_state_t state;
bool mode = query->boolean_mode;
DBUG_ENTER("fts_query_parse");

memset(&state, 0x0, sizeof(state));

Expand All @@ -3698,7 +3708,7 @@ fts_query_parse(
query->root = state.root;
}

return(state.root);
DBUG_RETURN(state.root);
}

/*******************************************************************//**
Expand Down
Loading

0 comments on commit a4416ab

Please sign in to comment.