From 4d606cb95520e6fff5835c05f2df4b10233d4ced Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 24 Apr 2015 23:17:16 +1000 Subject: [PATCH 1/3] c99 style for assigning structure members --- storage/innobase/handler/i_s.cc | 2 +- storage/xtradb/handler/i_s.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 9fec09da564..48c8c46a951 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -158,7 +158,7 @@ do { \ } while (0) #if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && !defined __INTEL_COMPILER -#define STRUCT_FLD(name, value) name: value +#define STRUCT_FLD(name, value) .name = value #else #define STRUCT_FLD(name, value) value #endif diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc index 01e40222c22..6ca38d3e394 100644 --- a/storage/xtradb/handler/i_s.cc +++ b/storage/xtradb/handler/i_s.cc @@ -180,7 +180,7 @@ do { \ #if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && \ !defined __INTEL_COMPILER && !defined __clang__ -#define STRUCT_FLD(name, value) name: value +#define STRUCT_FLD(name, value) .name = value #else #define STRUCT_FLD(name, value) value #endif From 8350ea05141c55c17807e9654c61cad481542480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 7 May 2015 13:04:03 +0300 Subject: [PATCH 2/3] Fix compiler error if compiler does not support c99 style initializers. --- storage/innobase/CMakeLists.txt | 2 ++ storage/innobase/handler/i_s.cc | 6 +++++- storage/xtradb/CMakeLists.txt | 2 ++ storage/xtradb/handler/i_s.cc | 7 +++++-- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index e6a65566d66..861f2a9bd0d 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -144,6 +144,8 @@ IF(HAVE_IB_ATOMIC_PTHREAD_T_GCC) ADD_DEFINITIONS(-DHAVE_IB_ATOMIC_PTHREAD_T_GCC=1) ENDIF() +CHECK_C_SOURCE_COMPILES("struct t1{ int a; char *b; }; struct t1 c= { .a=1, .b=0 }; main() { }" HAVE_C99_INITIALIZERS) + ENDIF(NOT MSVC) # Solaris atomics diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 48c8c46a951..afe9c568f18 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -157,9 +157,13 @@ do { \ } \ } while (0) -#if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && !defined __INTEL_COMPILER +#if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && !defined __INTEL_COMPILER && !defined __clang__ +#ifdef HAVE_C99_INITIALIZERS #define STRUCT_FLD(name, value) .name = value #else +#define STRUCT_FLD(name, value) name: value +#endif /* HAVE_C99_INITIALIZERS */ +#else #define STRUCT_FLD(name, value) value #endif diff --git a/storage/xtradb/CMakeLists.txt b/storage/xtradb/CMakeLists.txt index 1c3bf769ef4..2f8e42427d0 100644 --- a/storage/xtradb/CMakeLists.txt +++ b/storage/xtradb/CMakeLists.txt @@ -180,6 +180,8 @@ IF(HAVE_IB_ATOMIC_PTHREAD_T_GCC) ADD_DEFINITIONS(-DHAVE_IB_ATOMIC_PTHREAD_T_GCC=1) ENDIF() +CHECK_C_SOURCE_COMPILES("struct t1{ int a; char *b; }; struct t1 c= { .a=1, .b=0 }; main() { }" HAVE_C99_INITIALIZERS) + ENDIF(NOT MSVC) # Solaris atomics diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc index 6ca38d3e394..bba0dade830 100644 --- a/storage/xtradb/handler/i_s.cc +++ b/storage/xtradb/handler/i_s.cc @@ -178,10 +178,13 @@ do { \ } \ } while (0) -#if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && \ - !defined __INTEL_COMPILER && !defined __clang__ +#if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && !defined __INTEL_COMPILER && !defined __clang__ +#ifdef HAVE_C99_INITIALIZERS #define STRUCT_FLD(name, value) .name = value #else +#define STRUCT_FLD(name, value) name: value +#endif /* HAVE_C99_INITIALIZERS */ +#else #define STRUCT_FLD(name, value) value #endif From 0014bdc7eef141dcd66930e853242b3be4960831 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 7 May 2015 22:18:34 +0200 Subject: [PATCH 3/3] MDEV-8115 mysql_upgrade crashes the server with REPAIR VIEW on REPAIR don't do table-specific stuff for views (because even if the view has a temp table opened for it, it's not opened all the way down the engine. In particular, Aria crashes in maria_status() because MARIA_HA* info - that is table->table->file->file - is NULL) --- mysql-test/r/repair.result | 7 +++++++ mysql-test/t/repair.test | 9 +++++++++ sql/sql_admin.cc | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/repair.result b/mysql-test/r/repair.result index 52ae9c38792..51c3374602d 100644 --- a/mysql-test/r/repair.result +++ b/mysql-test/r/repair.result @@ -207,3 +207,10 @@ check table t1; Table Op Msg_type Msg_text test.t1 check status OK drop table t1; +create table t1 (a blob); +create view v1 as select * from t1; +repair view v1; +Table Op Msg_type Msg_text +test.v1 repair status OK +drop view v1; +drop table t1; diff --git a/mysql-test/t/repair.test b/mysql-test/t/repair.test index 337b73f37d1..f625965090a 100644 --- a/mysql-test/t/repair.test +++ b/mysql-test/t/repair.test @@ -208,3 +208,12 @@ repair table t1 use_frm; select count(*) from t1; check table t1; drop table t1; + +# +# MDEV-8115 mysql_upgrade crashes the server with REPAIR VIEW +# +create table t1 (a blob); +create view v1 as select * from t1; +repair view v1; +drop view v1; +drop table t1; diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index 44057b6220e..9827c67065c 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -901,7 +901,7 @@ send_result_message: break; } } - if (table->table) + if (table->table && !table->view) { if (table->table->s->tmp_table) {