Skip to content

Commit 13927f8

Browse files
author
Sergei Golubchik
committed
percona-server-5.5.41-37.0
1 parent ef7d950 commit 13927f8

File tree

11 files changed

+131
-19
lines changed

11 files changed

+131
-19
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,14 @@ SET(INNOBASE_SOURCES btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c
276276
ut/ut0byte.c ut/ut0dbg.c ut/ut0list.c ut/ut0mem.c ut/ut0rbt.c ut/ut0rnd.c
277277
ut/ut0ut.c ut/ut0vec.c ut/ut0wqueue.c ut/ut0bh.c)
278278

279+
# These files have unused result errors, so we skip Werror
280+
CHECK_C_COMPILER_FLAG("-Werror" HAVE_WERROR)
281+
IF(HAVE_WERROR)
282+
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake)
283+
ADD_COMPILE_FLAGS(page/page0zip.c COMPILE_FLAGS "-Wno-error")
284+
ADD_COMPILE_FLAGS(ut/ut0ut.c COMPILE_FLAGS "-Wno-error")
285+
ENDIF()
286+
279287
IF(WITH_INNODB)
280288
# Legacy option
281289
SET(WITH_INNOBASE_STORAGE_ENGINE TRUE)

dict/dict0dict.c

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ UNIV_INTERN dict_index_t* dict_ind_compact;
4242
UNIV_INTERN uint ibuf_debug;
4343
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
4444

45+
/**********************************************************************
46+
Issue a warning that the row is too big. */
47+
void
48+
ib_warn_row_too_big(const dict_table_t* table);
49+
50+
4551
#ifndef UNIV_HOTBACKUP
4652
#include "buf0buf.h"
4753
#include "data0type.h"
@@ -1892,11 +1898,18 @@ dict_index_add_to_cache(
18921898

18931899
new_index->n_fields = new_index->n_def;
18941900

1895-
if (strict && dict_index_too_big_for_tree(table, new_index)) {
1901+
if (dict_index_too_big_for_tree(table, new_index)) {
1902+
1903+
if (strict) {
18961904
too_big:
1897-
dict_mem_index_free(new_index);
1898-
dict_mem_index_free(index);
1899-
return(DB_TOO_BIG_RECORD);
1905+
dict_mem_index_free(new_index);
1906+
dict_mem_index_free(index);
1907+
return(DB_TOO_BIG_RECORD);
1908+
} else {
1909+
1910+
ib_warn_row_too_big(table);
1911+
1912+
}
19001913
}
19011914

19021915
if (UNIV_UNLIKELY(index->type & DICT_UNIVERSAL)) {
@@ -2650,8 +2663,15 @@ dict_foreign_remove_from_cache(
26502663
foreign);
26512664

26522665
rbt = foreign->referenced_table->referenced_rbt;
2666+
26532667
if (rbt != NULL) {
2654-
rbt_delete(rbt, foreign->id);
2668+
const ib_rbt_node_t* node
2669+
= rbt_lookup(rbt, foreign->id);
2670+
dict_foreign_t* val = *(dict_foreign_t**) node->value;
2671+
2672+
if (val == foreign) {
2673+
rbt_delete(rbt, foreign->id);
2674+
}
26552675
}
26562676
}
26572677

@@ -2664,7 +2684,13 @@ dict_foreign_remove_from_cache(
26642684
rbt = foreign->foreign_table->foreign_rbt;
26652685

26662686
if (rbt != NULL) {
2667-
rbt_delete(rbt, foreign->id);
2687+
const ib_rbt_node_t* node
2688+
= rbt_lookup(rbt, foreign->id);
2689+
dict_foreign_t* val = *(dict_foreign_t**) node->value;
2690+
2691+
if (val == foreign) {
2692+
rbt_delete(rbt, foreign->id);
2693+
}
26682694
}
26692695
}
26702696

@@ -6031,11 +6057,11 @@ dict_set_corrupted(
60316057

60326058
dict_index_copy_types(tuple, sys_index, 2);
60336059

6034-
btr_cur_search_to_nth_level(sys_index, 0, tuple, PAGE_CUR_GE,
6060+
btr_cur_search_to_nth_level(sys_index, 0, tuple, PAGE_CUR_LE,
60356061
BTR_MODIFY_LEAF,
60366062
&cursor, 0, __FILE__, __LINE__, &mtr);
60376063

6038-
if (cursor.up_match == dtuple_get_n_fields(tuple)) {
6064+
if (cursor.low_match == dtuple_get_n_fields(tuple)) {
60396065
/* UPDATE SYS_INDEXES SET TYPE=index->type
60406066
WHERE TABLE_ID=index->table->id AND INDEX_ID=index->id */
60416067
ulint len;

handler/ha_innodb.cc

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2681,7 +2681,7 @@ innobase_init(
26812681
innobase_hton->start_consistent_snapshot=innobase_start_trx_and_assign_read_view;
26822682
innobase_hton->flush_logs=innobase_flush_logs;
26832683
innobase_hton->show_status=innobase_show_status;
2684-
innobase_hton->flags=HTON_NO_FLAGS;
2684+
innobase_hton->flags=HTON_SUPPORTS_FOREIGN_KEYS;
26852685
innobase_hton->release_temporary_latches=innobase_release_temporary_latches;
26862686
innobase_hton->alter_table_flags = innobase_alter_table_flags;
26872687
innobase_hton->flush_changed_page_bitmaps
@@ -10238,6 +10238,7 @@ ha_innobase::start_stmt(
1023810238
thr_lock_type lock_type)
1023910239
{
1024010240
trx_t* trx;
10241+
DBUG_ENTER("ha_innobase::start_stmt");
1024110242

1024210243
update_thd(thd);
1024310244

@@ -10260,6 +10261,28 @@ ha_innobase::start_stmt(
1026010261
prebuilt->hint_need_to_fetch_extra_cols = 0;
1026110262
reset_template(prebuilt);
1026210263

10264+
if (dict_table_is_temporary(prebuilt->table)
10265+
&& prebuilt->mysql_has_locked
10266+
&& prebuilt->select_lock_type == LOCK_NONE) {
10267+
ulint error;
10268+
10269+
switch (thd_sql_command(thd)) {
10270+
case SQLCOM_INSERT:
10271+
case SQLCOM_UPDATE:
10272+
case SQLCOM_DELETE:
10273+
init_table_handle_for_HANDLER();
10274+
prebuilt->select_lock_type = LOCK_X;
10275+
error = row_lock_table_for_mysql(prebuilt, NULL, 1);
10276+
10277+
if (error != DB_SUCCESS) {
10278+
error = convert_error_code_to_mysql(
10279+
(int) error, 0, thd);
10280+
DBUG_RETURN((int) error);
10281+
}
10282+
break;
10283+
}
10284+
}
10285+
1026310286
if (!prebuilt->mysql_has_locked) {
1026410287
/* This handle is for a temporary table created inside
1026510288
this same LOCK TABLES; since MySQL does NOT call external_lock
@@ -10292,7 +10315,7 @@ ha_innobase::start_stmt(
1029210315

1029310316
innobase_register_trx(ht, thd, trx);
1029410317

10295-
return(0);
10318+
DBUG_RETURN(0);
1029610319
}
1029710320

1029810321
/******************************************************************//**
@@ -13711,3 +13734,30 @@ innobase_convert_to_filename_charset(
1371113734

1371213735
return(strconvert(cs_from, from, cs_to, to, len, &errors));
1371313736
}
13737+
13738+
13739+
/**********************************************************************
13740+
Issue a warning that the row is too big. */
13741+
extern "C"
13742+
void
13743+
ib_warn_row_too_big(const dict_table_t* table)
13744+
{
13745+
/* If prefix is true then a 768-byte prefix is stored
13746+
locally for BLOB fields. Refer to dict_table_get_format() */
13747+
const bool prefix = ((table->flags & DICT_TF_FORMAT_MASK)
13748+
>> DICT_TF_FORMAT_SHIFT) < UNIV_FORMAT_B;
13749+
13750+
const ulint free_space = page_get_free_space_of_empty(
13751+
table->flags & DICT_TF_COMPACT) / 2;
13752+
13753+
THD* thd = current_thd;
13754+
13755+
push_warning_printf(
13756+
thd, MYSQL_ERROR::WARN_LEVEL_WARN, HA_ERR_TO_BIG_ROW,
13757+
"Row size too large (> %lu). Changing some columns to TEXT"
13758+
" or BLOB %smay help. In current row format, BLOB prefix of"
13759+
" %d bytes is stored inline.", free_space
13760+
, prefix ? "or using ROW_FORMAT=DYNAMIC or"
13761+
" ROW_FORMAT=COMPRESSED ": ""
13762+
, prefix ? DICT_MAX_FIXED_COL_LEN : 0);
13763+
}

include/btr0cur.ic

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*****************************************************************************
22

3-
Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved.
3+
Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved.
44

55
This program is free software; you can redistribute it and/or modify it under
66
the terms of the GNU General Public License as published by the Free Software
@@ -28,7 +28,7 @@ Created 10/16/1994 Heikki Tuuri
2828

2929
#ifdef UNIV_DEBUG
3030
# define LIMIT_OPTIMISTIC_INSERT_DEBUG(NREC, CODE)\
31-
if (btr_cur_limit_optimistic_insert_debug\
31+
if (btr_cur_limit_optimistic_insert_debug > 1\
3232
&& (NREC) >= (ulint)btr_cur_limit_optimistic_insert_debug) {\
3333
CODE;\
3434
}

include/dict0dict.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,6 +1391,14 @@ dict_table_init_referenced_rbt(
13911391
/*===========================*/
13921392
dict_table_t* table); /*!< in: the table object whose
13931393
table->referenced_rbt will be initialized */
1394+
/********************************************************************//**
1395+
Check if it is a temporary table.
1396+
@return true if temporary table flag is set. */
1397+
UNIV_INLINE
1398+
ibool
1399+
dict_table_is_temporary(
1400+
/*====================*/
1401+
const dict_table_t* table); /*!< in: table to check */
13941402

13951403
#ifndef UNIV_NONINL
13961404
#include "dict0dict.ic"

include/dict0dict.ic

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,3 +1017,15 @@ dict_table_init_referenced_rbt(
10171017
ut_a(table->referenced_rbt != NULL);
10181018
return(table->referenced_rbt);
10191019
}
1020+
1021+
/********************************************************************//**
1022+
Check if it is a temporary table.
1023+
@return true if temporary table flag is set. */
1024+
UNIV_INLINE
1025+
ibool
1026+
dict_table_is_temporary(
1027+
/*====================*/
1028+
const dict_table_t* table) /*!< in: table to check */
1029+
{
1030+
return(table->flags & (DICT_TF2_TEMPORARY << DICT_TF2_SHIFT));
1031+
}

include/univ.i

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ component, i.e. we show M.N.P as M.N */
6464
(INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR)
6565

6666
#ifndef PERCONA_INNODB_VERSION
67-
#define PERCONA_INNODB_VERSION 36.1
67+
#define PERCONA_INNODB_VERSION 37.0
6868
#endif
6969

7070
#define INNODB_VERSION_STR MYSQL_SERVER_VERSION
@@ -122,6 +122,10 @@ if we are compiling on Windows. */
122122
# include <sched.h>
123123
# endif
124124

125+
# ifdef HAVE_MALLOC_H
126+
# include <malloc.h>
127+
# endif
128+
125129
/* We only try to do explicit inlining of functions with gcc and
126130
Sun Studio */
127131

log/log0log.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ log_buffer_extend(
252252
{
253253
ulint move_start;
254254
ulint move_end;
255-
byte tmp_buf[OS_FILE_LOG_BLOCK_SIZE];
255+
byte* tmp_buf = alloca(OS_FILE_LOG_BLOCK_SIZE);
256256

257257
mutex_enter(&(log_sys->mutex));
258258

log/log0online.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1817,7 +1817,7 @@ log_online_purge_changed_page_bitmaps(
18171817
return TRUE;
18181818
}
18191819

1820-
if (srv_track_changed_pages && lsn >= log_bmp_sys->end_lsn) {
1820+
if (srv_track_changed_pages && lsn > log_bmp_sys->end_lsn) {
18211821
/* If we have to delete the current output file, close it
18221822
first. */
18231823
os_file_close(log_bmp_sys->out.file);

log/log0recv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2989,7 +2989,8 @@ recv_recovery_from_checkpoint_start_func(
29892989
#endif /* UNIV_LOG_ARCHIVE */
29902990
byte* buf;
29912991
byte* log_hdr_buf;
2992-
byte log_hdr_buf_base[LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE];
2992+
byte* log_hdr_buf_base = alloca(LOG_FILE_HDR_SIZE
2993+
+ OS_FILE_LOG_BLOCK_SIZE);
29932994
ulint err;
29942995

29952996
log_hdr_buf = ut_align(log_hdr_buf_base, OS_FILE_LOG_BLOCK_SIZE);

0 commit comments

Comments
 (0)