Skip to content

Commit ccea2a9

Browse files
Ingo StruewingIngo Struewing
Ingo Struewing
authored and
Ingo Struewing
committed
Bug#27001934 - DEMERGE CODE SNIPPETS FROM SQL_TABLE, WHICH ARE NEEDED BY MEB
Server code, needed by MEB was cut out of server files by #ifndef UNIV_HOTBACKUP. This patch reduces the amount of InnoDB code, compiled with MEB, so that the functions, which need server code, are not included. The changes in server code are reverted. Unrelated changes: Fix Windows build: Define strcasecmp and strncasecmp as inline functions instead of preprocessor macros. Change-Id: Iaabf9800f9e5c72282c312f76ad8da2765663c3f
1 parent f8e490f commit ccea2a9

File tree

10 files changed

+11
-73
lines changed

10 files changed

+11
-73
lines changed

sql/sql_table.cc

+1-23
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,16 @@
2828
#include <memory>
2929
#include <string>
3030

31-
#ifndef UNIV_HOTBACKUP
3231
#include "binary_log_types.h"
3332
#include "binlog_event.h"
3433
#include "lex_string.h"
35-
#endif /* !UNIV_HOTBACKUP */
3634
#include "m_ctype.h"
3735
#include "m_string.h" // my_stpncpy
38-
#ifndef UNIV_HOTBACKUP
3936
#include "my_alloc.h"
4037
#include "my_base.h"
4138
#include "my_check_opt.h" // T_EXTEND
4239
#include "my_compiler.h"
43-
#endif /* !UNIV_HOTBACKUP */
4440
#include "my_dbug.h"
45-
#ifndef UNIV_HOTBACKUP
4641
#include "my_io.h"
4742
#include "my_loglevel.h"
4843
#include "my_psi_config.h"
@@ -130,14 +125,10 @@
130125
#include "sql/sql_tablespace.h" // validate_tablespace_name
131126
#include "sql/sql_time.h" // make_truncated_value_warning
132127
#include "sql/sql_trigger.h" // change_trigger_table_name
133-
#endif /* !UNIV_HOTBACKUP */
134128
#include "sql/strfunc.h" // find_type2
135-
#ifndef UNIV_HOTBACKUP
136129
#include "sql/strfunc.h" // find_type2
137130
#include "sql/system_variables.h"
138-
#endif /* !UNIV_HOTBACKUP */
139131
#include "sql/table.h"
140-
#ifndef UNIV_HOTBACKUP
141132
#include "sql/thr_malloc.h"
142133
#include "sql/transaction.h" // trans_commit_stmt
143134
#include "sql/transaction_info.h"
@@ -182,13 +173,6 @@ static bool prepare_enum_field(THD *thd, Create_field *sql_field);
182173
static uint blob_length_by_type(enum_field_types type);
183174
static const Create_field *get_field_by_index(Alter_info *alter_info, uint idx);
184175

185-
#else /* !UNIV_HOTBACKUP */
186-
/* Branches which use these, should not be taken by backup. */
187-
#define ER_THD_OR_DEFAULT(thd,X) ("Cannot explain file name, MySQL error")
188-
#define get_quote_char_for_identifier(thd, conv_name, len) ('`')
189-
#endif /* !UNIV_HOTBACKUP */
190-
191-
#ifndef UNIV_HOTBACKUP
192176
/**
193177
RAII class to control the atomic DDL commit on slave.
194178
A slave context flag responsible to mark the DDL as committed is
@@ -243,7 +227,6 @@ static bool trans_intermediate_ddl_commit(THD *thd, bool error)
243227
}
244228
return trans_commit_stmt(thd) || trans_commit(thd);
245229
}
246-
#endif /* !UNIV_HOTBACKUP */
247230

248231

249232
/**
@@ -518,7 +501,6 @@ size_t explain_filename(THD* thd,
518501
DBUG_RETURN(static_cast<size_t>(to_p - to));
519502
}
520503

521-
#ifndef UNIV_HOTBACKUP
522504
void parse_filename(const char *filename, size_t filename_length,
523505
const char ** schema_name, size_t *schema_name_length,
524506
const char ** table_name, size_t *table_name_length,
@@ -633,7 +615,7 @@ void parse_filename(const char *filename, size_t filename_length,
633615
*subpartition_name= id_ptr;
634616
*subpartition_name_length= id_length;
635617
}
636-
#endif /* !UNIV_HOTBACKUP */
618+
637619

638620
/*
639621
Translate a file name to a table name (WL #1324).
@@ -668,15 +650,13 @@ size_t filename_to_tablename(const char *from, char *to, size_t to_length,
668650
system_charset_info, to, to_length, &errors);
669651
if (errors) // Old 5.0 name
670652
{
671-
#ifndef UNIV_HOTBACKUP
672653
if (!stay_quiet) {
673654
LogErr(ERROR_LEVEL, ER_INVALID_OR_OLD_TABLE_OR_DB_NAME, from);
674655
}
675656
/*
676657
TODO: add a stored procedure for fix table and database names,
677658
and mention its name in error log.
678659
*/
679-
#endif /* !UNIV_HOTBACKUP */
680660
}
681661
}
682662

@@ -685,7 +665,6 @@ size_t filename_to_tablename(const char *from, char *to, size_t to_length,
685665
}
686666

687667

688-
#ifndef UNIV_HOTBACKUP
689668
/*
690669
Translate a table name to a file name (WL #1324).
691670

@@ -15015,4 +14994,3 @@ static bool check_engine(THD *thd, const char *db_name,
1501514994

1501614995
DBUG_RETURN(false);
1501714996
}
15018-
#endif /* !UNIV_HOTBACKUP */

sql/sql_table.h

-10
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <utility>
2424
#include <vector>
2525

26-
#ifndef UNIV_HOTBACKUP
2726
#include "binary_log_types.h" // enum_field_types
2827
#include "dd/string_type.h"
2928
#include "m_ctype.h"
@@ -58,17 +57,13 @@ typedef struct st_mysql_mutex mysql_mutex_t;
5857
template<typename T> class List;
5958

6059

61-
#else /* !UNIV_HOTBACKUP */
62-
class THD {};
63-
#endif /* !UNIV_HOTBACKUP */
6460
enum enum_explain_filename_mode
6561
{
6662
EXPLAIN_ALL_VERBOSE= 0,
6763
EXPLAIN_PARTITIONS_VERBOSE,
6864
EXPLAIN_PARTITIONS_AS_COMMENT
6965
};
7066

71-
#ifndef UNIV_HOTBACKUP
7267
/* Maximum length of GEOM_POINT Field */
7368
#define MAX_LEN_GEOM_POINT_FIELD 25
7469

@@ -83,12 +78,10 @@ static const uint NO_FK_CHECKS= 1 << 2;
8378
the table.
8479
*/
8580
static const uint NO_DD_COMMIT= 1 << 3;
86-
#endif /* !UNIV_HOTBACKUP */
8781

8882

8983
size_t filename_to_tablename(const char *from, char *to, size_t to_length,
9084
bool stay_quiet = false);
91-
#ifndef UNIV_HOTBACKUP
9285
size_t tablename_to_filename(const char *from, char *to, size_t to_length);
9386
size_t build_table_filename(char *buff, size_t bufflen, const char *db,
9487
const char *table, const char *ext,
@@ -489,13 +482,11 @@ bool mysql_prepare_create_table(THD *thd,
489482
uint existing_fks_count,
490483
int select_field_count,
491484
bool find_parent_keys);
492-
#endif /* !UNIV_HOTBACKUP */
493485

494486

495487
size_t explain_filename(THD* thd, const char *from, char *to, size_t to_length,
496488
enum_explain_filename_mode explain_mode);
497489

498-
#ifndef UNIV_HOTBACKUP
499490
void parse_filename(const char *filename, size_t filename_length,
500491
const char ** schema_name, size_t *schema_name_length,
501492
const char ** table_name, size_t *table_name_length,
@@ -518,5 +509,4 @@ extern MYSQL_PLUGIN_IMPORT const char *primary_key_name;
518509

519510
bool lock_trigger_names(THD *thd, TABLE_LIST *tables);
520511

521-
#endif /* !UNIV_HOTBACKUP */
522512
#endif /* SQL_TABLE_INCLUDED */

sql/strfunc.cc

-7
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,14 @@
1919

2020
#include "m_ctype.h" // my_charset_latin1
2121
#include "my_dbug.h"
22-
#ifndef UNIV_HOTBACKUP
2322
#include "mysql/udf_registration_types.h"
2423
#include "sql/session_tracker.h"
2524
#include "sql/sql_class.h"
2625
#include "sql/sql_const.h"
2726
#include "sql/table.h"
28-
#endif /* !UNIV_HOTBACKUP */
2927
#include "sql_string.h"
3028
#include "typelib.h" // TYPELIB
3129

32-
#ifndef UNIV_HOTBACKUP
3330
/*
3431
Return bitmap for strings used in a set
3532
@@ -215,7 +212,6 @@ uint check_word(TYPELIB *lib, const char *val, const char *end,
215212
*end_of_word= ptr;
216213
return res;
217214
}
218-
#endif /* !UNIV_HOTBACKUP */
219215

220216

221217
/*
@@ -293,7 +289,6 @@ size_t strconvert(const CHARSET_INFO *from_cs, const char *from,
293289
}
294290

295291

296-
#ifndef UNIV_HOTBACKUP
297292
char *set_to_string(THD *thd, LEX_STRING *result, ulonglong set,
298293
const char *lib[])
299294
{
@@ -348,5 +343,3 @@ char *flagset_to_string(THD *thd, LEX_STRING *result, ulonglong set,
348343

349344
return result->str;
350345
}
351-
#endif /* !UNIV_HOTBACKUP */
352-

sql/table.h

-16
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <string>
2222
#include <vector>
2323

24-
#ifndef UNIV_HOTBACKUP
2524
#include "binary_log_types.h"
2625
#include "lex_string.h"
2726
#include "m_ctype.h"
@@ -65,17 +64,11 @@
6564
#include "thr_lock.h"
6665
#include "typelib.h"
6766

68-
#else /* !UNIV_HOTBACKUP */
69-
#ifdef MYSQL_CLIENT
70-
#undef MYSQL_CLIENT
71-
#endif /* MYSQL_CLIENT */
72-
#endif /* !UNIV_HOTBACKUP */
7367

7468
#include "sql/mem_root_array.h"
7569

7670
class Field;
7771

78-
#ifndef UNIV_HOTBACKUP
7972
namespace histograms
8073
{
8174
class Histogram;
@@ -144,15 +137,13 @@ enum class enum_json_diff_operation;
144137
structures representing outer joins that have not been simplified away).
145138
*/
146139
typedef ulonglong nested_join_map;
147-
#endif /* !UNIV_HOTBACKUP */
148140

149141

150142
#define tmp_file_prefix "#sql" /**< Prefix for tmp tables */
151143
#define tmp_file_prefix_length 4
152144
#define TMP_TABLE_KEY_EXTRA 8
153145
#define PLACEHOLDER_TABLE_ROW_ESTIMATE 2
154146

155-
#ifndef UNIV_HOTBACKUP
156147
/**
157148
Enumerate possible types of a table from re-execution
158149
standpoint.
@@ -1177,8 +1168,6 @@ class Blob_mem_storage: public Sql_alloc
11771168
};
11781169

11791170

1180-
#endif /* UNIV_HOTBACKUP */
1181-
11821171
/**
11831172
Class that represents a single change to a column value in partial
11841173
update of a JSON column.
@@ -1226,8 +1215,6 @@ class Binary_diff final
12261215
*/
12271216
using Binary_diff_vector= Mem_root_array<Binary_diff>;
12281217

1229-
#ifndef UNIV_HOTBACKUP
1230-
12311218
/**
12321219
Flags for TABLE::m_status (maximum 8 bits).
12331220
The flags define the state of the row buffer in TABLE::record[0].
@@ -3845,10 +3832,8 @@ extern LEX_STRING MYSQL_TABLESPACE_NAME;
38453832
extern LEX_STRING RLI_INFO_NAME;
38463833
extern LEX_STRING MI_INFO_NAME;
38473834
extern LEX_STRING WORKER_INFO_NAME;
3848-
#endif /* !UNIV_HOTBACKUP */
38493835
extern "C" MYSQL_PLUGIN_IMPORT CHARSET_INFO *system_charset_info;
38503836

3851-
#ifndef UNIV_HOTBACKUP
38523837
inline bool is_infoschema_db(const char *name, size_t len)
38533838
{
38543839
return (INFORMATION_SCHEMA_NAME.length == len &&
@@ -4064,5 +4049,4 @@ bool create_table_share_for_upgrade(THD *thd,
40644049
bool is_fix_view_cols_and_deps);
40654050
//////////////////////////////////////////////////////////////////////////
40664051

4067-
#endif /* !UNIV_HOTBACKUP */
40684052
#endif /* TABLE_INCLUDED */

storage/innobase/dict/dict0dd.cc

+5-5
Original file line numberDiff line numberDiff line change
@@ -553,16 +553,16 @@ dd_check_corrupted(dict_table_t*& table)
553553
char db_buf[MAX_DATABASE_NAME_LEN + 1];
554554
char tbl_buf[MAX_TABLE_NAME_LEN + 1];
555555

556+
#ifndef UNIV_HOTBACKUP
556557
dd_parse_tbl_name(
557558
table->name.m_name, db_buf, tbl_buf,
558559
nullptr, nullptr, nullptr);
559-
#ifndef UNIV_HOTBACKUP
560560
my_error(ER_TABLE_CORRUPT, MYF(0),
561561
db_buf, tbl_buf);
562562
#else /* !UNIV_HOTBACKUP */
563563
ib::fatal()
564564
<< "table is corrupt: "
565-
<< db_buf << "." << tbl_buf;
565+
<< table->name.m_name;
566566
#endif /* !UNIV_HOTBACKUP */
567567
}
568568
table = nullptr;
@@ -681,9 +681,11 @@ dd_table_open_on_id(
681681
}
682682
} else {
683683
for (;;) {
684+
#ifndef UNIV_HOTBACKUP
684685
bool ret = dd_parse_tbl_name(
685686
ib_table->name.m_name, db_buf, tbl_buf,
686687
nullptr, nullptr, nullptr);
688+
#endif /* !UNIV_HOTBACKUP */
687689

688690
memset(full_name, 0, MAX_FULL_NAME_LEN + 1);
689691

@@ -693,14 +695,14 @@ dd_table_open_on_id(
693695

694696
mutex_exit(&dict_sys->mutex);
695697

698+
#ifndef UNIV_HOTBACKUP
696699
if (ret == false) {
697700
if (dict_locked) {
698701
mutex_enter(&dict_sys->mutex);
699702
}
700703
return(nullptr);
701704
}
702705

703-
#ifndef UNIV_HOTBACKUP
704706
if (dd_mdl_acquire(thd, mdl, db_buf, tbl_buf)) {
705707
if (dict_locked) {
706708
mutex_enter(&dict_sys->mutex);
@@ -2666,7 +2668,6 @@ dd_fill_dict_table(
26662668

26672669
return(m_table);
26682670
}
2669-
#endif /* !UNIV_HOTBACKUP */
26702671

26712672
/** Parse the tablespace name from filename charset to table name charset
26722673
@param[in] space_name tablespace name
@@ -2718,7 +2719,6 @@ dd_filename_to_spacename(
27182719
ut_ad(tablespace_name->size() < MAX_SPACE_NAME_LEN);
27192720
}
27202721

2721-
#ifndef UNIV_HOTBACKUP
27222722
/* Create metadata for specified tablespace, acquiring exlcusive MDL first
27232723
@param[in,out] dd_client data dictionary client
27242724
@param[in,out] thd THD

storage/innobase/dict/dict0mem.cc

+4
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ operator<<(
8181
std::ostream& s,
8282
const table_name_t& table_name)
8383
{
84+
#ifndef UNIV_HOTBACKUP
8485
return(s << ut_get_name(NULL, table_name.m_name));
86+
#else /* !UNIV_HOTBACKUP */
87+
return(s << table_name.m_name);
88+
#endif /* !UNIV_HOTBACKUP */
8589
}
8690

8791
#ifndef UNIV_HOTBACKUP

storage/innobase/handler/ha_innodb.cc

-2
Original file line numberDiff line numberDiff line change
@@ -3196,7 +3196,6 @@ innobase_quote_identifier(
31963196
putc(q, file);
31973197
}
31983198
}
3199-
#endif /* !UNIV_HOTBACKUP */
32003199

32013200
/** Convert a table name to the MySQL system_charset_info (UTF-8)
32023201
and quote it.
@@ -3272,7 +3271,6 @@ innobase_convert_name(
32723271
return(s);
32733272
}
32743273

3275-
#ifndef UNIV_HOTBACKUP
32763274
/*****************************************************************//**
32773275
A wrapper function of innobase_convert_name(), convert a table name
32783276
to the MySQL system_charset_info (UTF-8) and quote it if needed.

storage/innobase/include/dict0dd.h

-2
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,6 @@ MY_ATTRIBUTE((warn_unused_result))
920920
innodb_session_t*&
921921
thd_to_innodb_session(
922922
THD* thd);
923-
#endif /* !UNIV_HOTBACKUP */
924923

925924
/** Parse a table file name into table name and database name.
926925
Note the table name may have trailing TMP_POSTFIX for temporary table name.
@@ -943,7 +942,6 @@ dd_parse_tbl_name(
943942
char* dd_sub_name,
944943
bool* is_temp);
945944

946-
#ifndef UNIV_HOTBACKUP
947945
/** Look up a column in a table using the system_charset_info collation.
948946
@param[in] dd_table data dictionary table
949947
@param[in] name column name

0 commit comments

Comments
 (0)