Skip to content

Commit a4416ab

Browse files
committed
5.6.23-72.1
1 parent 14a142f commit a4416ab

30 files changed

+272
-85
lines changed

storage/xtradb/btr/btr0cur.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2522,15 +2522,15 @@ btr_cur_pess_upd_restore_supremum(
25222522
Check if the total length of the modified blob for the row is within 10%
25232523
of the total redo log size. This constraint on the blob length is to
25242524
avoid overwriting the redo logs beyond the last checkpoint lsn.
2525-
@return DB_SUCCESS or DB_TOO_BIG_RECORD. */
2525+
@return DB_SUCCESS or DB_TOO_BIG_FOR_REDO. */
25262526
static
25272527
dberr_t
25282528
btr_check_blob_limit(const big_rec_t* big_rec_vec)
25292529
{
25302530
const ib_uint64_t redo_size = srv_n_log_files * srv_log_file_size
25312531
* UNIV_PAGE_SIZE;
2532-
const ulint redo_10p = redo_size / 10;
2533-
ulint total_blob_len = 0;
2532+
const ib_uint64_t redo_10p = redo_size / 10;
2533+
ib_uint64_t total_blob_len = 0;
25342534
dberr_t err = DB_SUCCESS;
25352535

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

25412541
if (total_blob_len > redo_10p) {
25422542
ib_logf(IB_LOG_LEVEL_ERROR, "The total blob data"
2543-
" length (" ULINTPF ") is greater than"
2543+
" length (" UINT64PF ") is greater than"
25442544
" 10%% of the total redo log size (" UINT64PF
25452545
"). Please increase total redo log size.",
25462546
total_blob_len, redo_size);
2547-
err = DB_TOO_BIG_RECORD;
2547+
err = DB_TOO_BIG_FOR_REDO;
25482548
}
25492549

25502550
return(err);
@@ -4613,7 +4613,7 @@ Stores the fields in big_rec_vec to the tablespace and puts pointers to
46134613
them in rec. The extern flags in rec will have to be set beforehand.
46144614
The fields are stored on pages allocated from leaf node
46154615
file segment of the index tree.
4616-
@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */
4616+
@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE or DB_TOO_BIG_FOR_REDO */
46174617
UNIV_INTERN
46184618
dberr_t
46194619
btr_store_big_rec_extern_fields(

storage/xtradb/dict/dict0dict.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2423,10 +2423,10 @@ dict_index_add_to_cache(
24232423
dict_mem_index_free(new_index);
24242424
dict_mem_index_free(index);
24252425
return(DB_TOO_BIG_RECORD);
2426-
} else {
2427-
2426+
} else if (current_thd != NULL) {
2427+
/* Avoid the warning to be printed
2428+
during recovery. */
24282429
ib_warn_row_too_big(table);
2429-
24302430
}
24312431
}
24322432

storage/xtradb/dict/dict0mem.cc

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,9 @@ dict_mem_table_col_rename_low(
296296
ut_ad(from_len <= NAME_LEN);
297297
ut_ad(to_len <= NAME_LEN);
298298

299+
char from[NAME_LEN];
300+
strncpy(from, s, NAME_LEN);
301+
299302
if (from_len == to_len) {
300303
/* The easy case: simply replace the column name in
301304
table->col_names. */
@@ -363,14 +366,53 @@ dict_mem_table_col_rename_low(
363366

364367
foreign = *it;
365368

366-
for (unsigned f = 0; f < foreign->n_fields; f++) {
367-
/* These can point straight to
368-
table->col_names, because the foreign key
369-
constraints will be freed at the same time
370-
when the table object is freed. */
371-
foreign->foreign_col_names[f]
372-
= dict_index_get_nth_field(
373-
foreign->foreign_index, f)->name;
369+
if (foreign->foreign_index == NULL) {
370+
/* We may go here when we set foreign_key_checks to 0,
371+
and then try to rename a column and modify the
372+
corresponding foreign key constraint. The index
373+
would have been dropped, we have to find an equivalent
374+
one */
375+
for (unsigned f = 0; f < foreign->n_fields; f++) {
376+
if (strcmp(foreign->foreign_col_names[f], from)
377+
== 0) {
378+
379+
char** rc = const_cast<char**>(
380+
foreign->foreign_col_names
381+
+ f);
382+
383+
if (to_len <= strlen(*rc)) {
384+
memcpy(*rc, to, to_len + 1);
385+
} else {
386+
*rc = static_cast<char*>(
387+
mem_heap_dup(
388+
foreign->heap,
389+
to,
390+
to_len + 1));
391+
}
392+
}
393+
}
394+
395+
dict_index_t* new_index = dict_foreign_find_index(
396+
foreign->foreign_table, NULL,
397+
foreign->foreign_col_names,
398+
foreign->n_fields, NULL, true, false);
399+
/* There must be an equivalent index in this case. */
400+
ut_ad(new_index != NULL);
401+
402+
foreign->foreign_index = new_index;
403+
404+
} else {
405+
406+
for (unsigned f = 0; f < foreign->n_fields; f++) {
407+
/* These can point straight to
408+
table->col_names, because the foreign key
409+
constraints will be freed at the same time
410+
when the table object is freed. */
411+
foreign->foreign_col_names[f]
412+
= dict_index_get_nth_field(
413+
foreign->foreign_index,
414+
f)->name;
415+
}
374416
}
375417
}
376418

@@ -380,6 +422,8 @@ dict_mem_table_col_rename_low(
380422

381423
foreign = *it;
382424

425+
ut_ad(foreign->referenced_index != NULL);
426+
383427
for (unsigned f = 0; f < foreign->n_fields; f++) {
384428
/* foreign->referenced_col_names[] need to be
385429
copies, because the constraint may become

storage/xtradb/fts/fts0ast.cc

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,3 +694,51 @@ fts_ast_string_print(
694694

695695
printf("\n");
696696
}
697+
698+
#ifdef UNIV_DEBUG
699+
const char*
700+
fts_ast_oper_name_get(fts_ast_oper_t oper)
701+
{
702+
switch(oper) {
703+
case FTS_NONE:
704+
return("FTS_NONE");
705+
case FTS_IGNORE:
706+
return("FTS_IGNORE");
707+
case FTS_EXIST:
708+
return("FTS_EXIST");
709+
case FTS_NEGATE:
710+
return("FTS_NEGATE");
711+
case FTS_INCR_RATING:
712+
return("FTS_INCR_RATING");
713+
case FTS_DECR_RATING:
714+
return("FTS_DECR_RATING");
715+
case FTS_DISTANCE:
716+
return("FTS_DISTANCE");
717+
case FTS_IGNORE_SKIP:
718+
return("FTS_IGNORE_SKIP");
719+
case FTS_EXIST_SKIP:
720+
return("FTS_EXIST_SKIP");
721+
}
722+
ut_ad(0);
723+
}
724+
725+
const char*
726+
fts_ast_node_type_get(fts_ast_type_t type)
727+
{
728+
switch (type) {
729+
case FTS_AST_OPER:
730+
return("FTS_AST_OPER");
731+
case FTS_AST_NUMB:
732+
return("FTS_AST_NUMB");
733+
case FTS_AST_TERM:
734+
return("FTS_AST_TERM");
735+
case FTS_AST_TEXT:
736+
return("FTS_AST_TEXT");
737+
case FTS_AST_LIST:
738+
return("FTS_AST_LIST");
739+
case FTS_AST_SUBEXP_LIST:
740+
return("FTS_AST_SUBEXP_LIST");
741+
}
742+
ut_ad(0);
743+
}
744+
#endif /* UNIV_DEBUG */

storage/xtradb/fts/fts0opt.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2577,8 +2577,6 @@ fts_optimize_add_table(
25772577
return;
25782578
}
25792579

2580-
ut_ad(table->cached && table->fts != NULL);
2581-
25822580
/* Make sure table with FTS index cannot be evicted */
25832581
if (table->can_be_evicted) {
25842582
dict_table_move_from_lru_to_non_lru(table);

storage/xtradb/fts/fts0que.cc

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,7 +1534,8 @@ fts_merge_doc_ids(
15341534
{
15351535
const ib_rbt_node_t* node;
15361536

1537-
ut_a(!rbt_empty(doc_ids));
1537+
DBUG_ENTER("fts_merge_doc_ids");
1538+
15381539
ut_a(!query->intersection);
15391540

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

15611562
if (query->error != DB_SUCCESS) {
1562-
return(query->error);
1563+
DBUG_RETURN(query->error);
15631564
}
15641565

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

1581-
return(DB_SUCCESS);
1582+
DBUG_RETURN(DB_SUCCESS);
15821583
}
15831584

15841585
/*****************************************************************//**
@@ -2838,11 +2839,11 @@ fts_query_visitor(
28382839
fts_query_t* query = static_cast<fts_query_t*>(arg);
28392840

28402841
ut_a(node);
2842+
DBUG_ENTER("fts_query_visitor");
2843+
DBUG_PRINT("fts", ("nodetype: %s", fts_ast_node_type_get(node->type)));
28412844

28422845
token.f_n_char = 0;
2843-
28442846
query->oper = oper;
2845-
28462847
query->cur_node = node;
28472848

28482849
switch (node->type) {
@@ -2904,7 +2905,7 @@ fts_query_visitor(
29042905
query->multi_exist = true;
29052906
}
29062907

2907-
return(query->error);
2908+
DBUG_RETURN(query->error);
29082909
}
29092910

29102911
/*****************************************************************//**
@@ -2928,6 +2929,8 @@ fts_ast_visit_sub_exp(
29282929
bool will_be_ignored = false;
29292930
bool multi_exist;
29302931

2932+
DBUG_ENTER("fts_ast_visit_sub_exp");
2933+
29312934
ut_a(node->type == FTS_AST_SUBEXP_LIST);
29322935

29332936
cur_oper = query->oper;
@@ -2956,14 +2959,14 @@ fts_ast_visit_sub_exp(
29562959
/* Merge the sub-expression result with the parent result set. */
29572960
subexpr_doc_ids = query->doc_ids;
29582961
query->doc_ids = parent_doc_ids;
2959-
if (error == DB_SUCCESS && !rbt_empty(subexpr_doc_ids)) {
2962+
if (error == DB_SUCCESS) {
29602963
error = fts_merge_doc_ids(query, subexpr_doc_ids);
29612964
}
29622965

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

2966-
return(error);
2969+
DBUG_RETURN(error);
29672970
}
29682971

29692972
#if 0
@@ -3439,8 +3442,10 @@ fts_retrieve_ranking(
34393442
ib_rbt_bound_t parent;
34403443
fts_ranking_t new_ranking;
34413444

3445+
DBUG_ENTER("fts_retrieve_ranking");
3446+
34423447
if (!result || !result->rankings_by_id) {
3443-
return(0);
3448+
DBUG_RETURN(0);
34443449
}
34453450

34463451
new_ranking.doc_id = doc_id;
@@ -3451,10 +3456,10 @@ fts_retrieve_ranking(
34513456

34523457
ranking = rbt_value(fts_ranking_t, parent.last);
34533458

3454-
return(ranking->rank);
3459+
DBUG_RETURN(ranking->rank);
34553460
}
34563461

3457-
return(0);
3462+
DBUG_RETURN(0);
34583463
}
34593464

34603465
/*****************************************************************//**
@@ -3471,6 +3476,8 @@ fts_query_prepare_result(
34713476
const ib_rbt_node_t* node;
34723477
bool result_is_null = false;
34733478

3479+
DBUG_ENTER("fts_query_prepare_result");
3480+
34743481
if (result == NULL) {
34753482
result = static_cast<fts_result_t*>(ut_malloc(sizeof(*result)));
34763483

@@ -3519,7 +3526,7 @@ fts_query_prepare_result(
35193526
if (query->total_size > fts_result_cache_limit) {
35203527
query->error = DB_FTS_EXCEED_RESULT_CACHE_LIMIT;
35213528
fts_query_free_result(result);
3522-
return(NULL);
3529+
DBUG_RETURN(NULL);
35233530
}
35243531
}
35253532

@@ -3542,7 +3549,7 @@ fts_query_prepare_result(
35423549
ranking->rank * word_freq->idf * word_freq->idf);
35433550
}
35443551

3545-
return(result);
3552+
DBUG_RETURN(result);
35463553
}
35473554

35483555
ut_a(rbt_size(query->doc_ids) > 0);
@@ -3569,7 +3576,7 @@ fts_query_prepare_result(
35693576
if (query->total_size > fts_result_cache_limit) {
35703577
query->error = DB_FTS_EXCEED_RESULT_CACHE_LIMIT;
35713578
fts_query_free_result(result);
3572-
return(NULL);
3579+
DBUG_RETURN(NULL);
35733580
}
35743581
}
35753582
}
@@ -3581,7 +3588,7 @@ fts_query_prepare_result(
35813588
query->doc_ids = NULL;
35823589
}
35833590

3584-
return(result);
3591+
DBUG_RETURN(result);
35853592
}
35863593

35873594
/*****************************************************************//**
@@ -3593,6 +3600,8 @@ fts_query_get_result(
35933600
fts_query_t* query, /*!< in: query instance */
35943601
fts_result_t* result) /*!< in: result */
35953602
{
3603+
DBUG_ENTER("fts_query_get_result");
3604+
35963605
if (rbt_size(query->doc_ids) > 0 || query->flags == FTS_OPT_RANKING) {
35973606
/* Copy the doc ids to the result. */
35983607
result = fts_query_prepare_result(query, result);
@@ -3602,7 +3611,7 @@ fts_query_get_result(
36023611
memset(result, 0, sizeof(*result));
36033612
}
36043613

3605-
return(result);
3614+
DBUG_RETURN(result);
36063615
}
36073616

36083617
/*****************************************************************//**
@@ -3680,6 +3689,7 @@ fts_query_parse(
36803689
int error;
36813690
fts_ast_state_t state;
36823691
bool mode = query->boolean_mode;
3692+
DBUG_ENTER("fts_query_parse");
36833693

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

@@ -3698,7 +3708,7 @@ fts_query_parse(
36983708
query->root = state.root;
36993709
}
37003710

3701-
return(state.root);
3711+
DBUG_RETURN(state.root);
37023712
}
37033713

37043714
/*******************************************************************//**

0 commit comments

Comments
 (0)