Skip to content
/ server Public

Commit e57afee

Browse files
committed
cleanup: remove #ifdef MYSQL_VERSION_ID
remove conditional compilation for old MariaDB versions. Some were as old as MYSQL_VERSION_ID > 32300 Didn't touch engines hosted externally, like connect, mroonga, and columnstore
1 parent 73660e3 commit e57afee

File tree

10 files changed

+18
-132
lines changed

10 files changed

+18
-132
lines changed

client/mysqladmin.cc

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,7 @@ get_one_option(const struct my_option *opt, const char *argument,
285285
opt_verbose= 0;
286286
break;
287287
case OPT_CHARSETS_DIR:
288-
#if MYSQL_VERSION_ID > 32300
289288
charsets_dir = argument;
290-
#endif
291289
break;
292290
case OPT_MYSQL_PROTOCOL:
293291
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
@@ -1309,9 +1307,9 @@ static void usage(void)
13091307
my_print_help(my_long_options);
13101308
my_print_variables(my_long_options);
13111309
puts("\nWhere command is a one or more of: (Commands may be shortened)\n\
1312-
create databasename Create a new database\n\
1313-
debug Instruct server to write debug information to log\n\
1314-
drop databasename Delete a database and all its tables\n\
1310+
create databasename Create a new database\n\
1311+
debug Instruct server to write debug information to log\n\
1312+
drop databasename Delete a database and all its tables\n\
13151313
extended-status Gives an extended status message from the server\n\
13161314
flush-all-statistics Flush all statistics tables\n\
13171315
flush-all-status Flush status and statistics\n\
@@ -1333,25 +1331,21 @@ static void usage(void)
13331331
flush-threads Flush the thread cache\n\
13341332
flush-user-statistics Flush user statistics\n\
13351333
flush-user-resources Flush user resources\n\
1336-
kill id,id,... Kill mysql threads");
1337-
#if MYSQL_VERSION_ID >= 32200
1338-
puts("\
1334+
kill id,id,... Kill mysql threads\n\
13391335
password [new-password] Change old password to new-password in current format\n\
1340-
old-password [new-password] Change old password to new-password in old format");
1341-
#endif
1342-
puts("\
1343-
ping Check if mysqld is alive\n\
1344-
processlist Show list of active threads in server\n\
1345-
reload Reload grant tables\n\
1346-
refresh Flush all tables and close and open logfiles\n\
1347-
shutdown Take server down\n\
1348-
status Gives a short status message from the server\n\
1349-
start-all-slaves Start all slaves\n\
1350-
start-slave Start slave\n\
1351-
stop-all-slaves Stop all slaves\n\
1352-
stop-slave Stop slave\n\
1336+
old-password [new-password] Change old password to new-password in old format\n\
1337+
ping Check if mysqld is alive\n\
1338+
processlist Show list of active threads in server\n\
1339+
reload Reload grant tables\n\
1340+
refresh Flush all tables and close and open logfiles\n\
1341+
shutdown Take server down\n\
1342+
status Gives a short status message from the server\n\
1343+
start-all-slaves Start all slaves\n\
1344+
start-slave Start slave\n\
1345+
stop-all-slaves Stop all slaves\n\
1346+
stop-slave Stop slave\n\
13531347
variables Prints variables available\n\
1354-
version Get version info from server");
1348+
version Get version info from server");
13551349
}
13561350

13571351

client/mysqldump.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2181,11 +2181,9 @@ static void unescape(FILE *file,char *pos, size_t length)
21812181

21822182
static my_bool test_if_special_chars(const char *str)
21832183
{
2184-
#if MYSQL_VERSION_ID >= 32300
21852184
for ( ; *str ; str++)
21862185
if (!my_isvar(charset_info,*str) && *str != '$')
21872186
return 1;
2188-
#endif
21892187
return 0;
21902188
} /* test_if_special_chars */
21912189

client/mysqltest.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9066,15 +9066,13 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
90669066
var_set_errno(mysql_stmt_errno(stmt));
90679067

90689068
display_optimizer_trace(cn, ds);
9069-
#if MYSQL_VERSION_ID >= 50000
90709069
if (cursor_protocol_enabled)
90719070
{
90729071
ulong type= CURSOR_TYPE_NO_CURSOR;
90739072
if (mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*) &type))
90749073
die("mysql_stmt_attr_set(STMT_ATTR_CURSOR_TYPE) failed': %d %s",
90759074
mysql_stmt_errno(stmt), mysql_stmt_error(stmt));
90769075
}
9077-
#endif
90789076

90799077
revert_properties();
90809078

@@ -9291,7 +9289,6 @@ void run_execute_stmt(struct st_connection *cn, struct st_command *command,
92919289
init_dynamic_string(&ds_execute_warnings, NULL, 0, 256);
92929290
}
92939291

9294-
#if MYSQL_VERSION_ID >= 50000
92959292
if (cursor_protocol_enabled)
92969293
{
92979294
/*
@@ -9302,7 +9299,6 @@ void run_execute_stmt(struct st_connection *cn, struct st_command *command,
93029299
die("mysql_stmt_attr_set(STMT_ATTR_CURSOR_TYPE) failed': %d %s",
93039300
mysql_stmt_errno(stmt), mysql_stmt_error(stmt));
93049301
}
9305-
#endif
93069302

93079303
/*
93089304
Execute the query

extra/mariabackup/ds_local.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ static void init_ibd_data(ds_local_file_t *local_file, const uchar *buf, size_t
211211
? fil_space_t::is_compressed(flags)
212212
: bool(FSP_FLAGS_HAS_PAGE_COMPRESSION(flags));
213213

214-
#if defined(_WIN32) && (MYSQL_VERSION_ID > 100200)
214+
#if defined(_WIN32)
215215
/* Make compressed file sparse, on Windows.
216216
In 10.1, we do not use sparse files. */
217217
if (local_file->compressed) {

plugin/handler_socket/handlersocket/database.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,7 @@ dbcontext::init_thread(const void *stack_bottom, volatile int& shutdown_flag)
288288
thd->system_thread = static_cast<enum_thread_type>(1<<30UL);
289289
memset(&thd->net, 0, sizeof(thd->net));
290290
if (for_write_flag) {
291-
#if MYSQL_VERSION_ID >= 50505
292291
thd->variables.option_bits |= OPTION_BIN_LOG;
293-
#else
294-
thd->options |= OPTION_BIN_LOG;
295-
#endif
296292
safeFree((char*) thd->db.str);
297293
thd->db.str= my_strdup(PSI_NOT_INSTRUMENTED, "handlersocket", MYF(0));
298294
thd->db.length= sizeof("handlersocket")-1;
@@ -382,13 +378,7 @@ dbcontext::lock_tables_if()
382378
}
383379
table_vec[i].modified = false;
384380
}
385-
#if MYSQL_VERSION_ID >= 50505
386381
lock = thd->lock = mysql_lock_tables(thd, &tables[0], num_open, 0);
387-
#else
388-
bool need_reopen= false;
389-
lock = thd->lock = mysql_lock_tables(thd, &tables[0], num_open,
390-
MYSQL_LOCK_NOTIFY_IF_NEED_REOPEN, &need_reopen);
391-
#endif
392382
statistic_increment(lock_tables_count, &LOCK_status);
393383
thd_proc_info(thd, &info_message_buf[0]);
394384
DENA_VERBOSE(100, fprintf(stderr, "HNDSOCK lock tables %p %p %zu %zu\n",
@@ -399,11 +389,7 @@ dbcontext::lock_tables_if()
399389
thd));
400390
}
401391
if (for_write_flag) {
402-
#if MYSQL_VERSION_ID >= 50505
403392
thd->set_current_stmt_binlog_format_row();
404-
#else
405-
thd->current_stmt_binlog_row_based = 1;
406-
#endif
407393
}
408394
DENA_ALLOCA_FREE(tables);
409395
}
@@ -426,11 +412,7 @@ dbcontext::unlock_tables_if()
426412
}
427413
{
428414
bool suc = true;
429-
#if MYSQL_VERSION_ID >= 50505
430415
suc = (trans_commit_stmt(thd) == 0);
431-
#else
432-
suc = (ha_autocommit_or_rollback(thd, 0) == 0);
433-
#endif
434416
if (!suc) {
435417
commit_error = true;
436418
DENA_VERBOSE(10, fprintf(stderr,
@@ -996,7 +978,6 @@ dbcontext::cmd_open(dbcallback_i& cb, const cmd_open_args& arg)
996978
TABLE *table = 0;
997979
bool refresh = true;
998980
const thr_lock_type lock_type = for_write_flag ? TL_WRITE : TL_READ;
999-
#if MYSQL_VERSION_ID >= 50505
1000981
LEX_CSTRING db_name= { arg.dbn, strlen(arg.dbn) };
1001982
LEX_CSTRING tbl_name= { arg.tbl, strlen(arg.tbl) };
1002983
tables.init_one_table(&db_name, &tbl_name, 0, lock_type);
@@ -1006,11 +987,6 @@ dbcontext::cmd_open(dbcallback_i& cb, const cmd_open_args& arg)
1006987
if (!open_table(thd, &tables, &ot_act)) {
1007988
table = tables.table;
1008989
}
1009-
#else
1010-
tables.init_one_table(arg.dbn, arg.tbl, lock_type);
1011-
table = open_table(thd, &tables, thd->mem_root, &refresh,
1012-
OPEN_VIEW_NO_PARSE);
1013-
#endif
1014990
if (table == 0) {
1015991
DENA_VERBOSE(20, fprintf(stderr,
1016992
"HNDSOCK failed to open %p [%s] [%s] [%d]\n",

plugin/handler_socket/handlersocket/mysql_incl.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include <my_global.h>
2323
#include <mysql_version.h>
2424

25-
#if MYSQL_VERSION_ID >= 50505
2625
#include <my_pthread.h>
2726
#include <sql_priv.h>
2827
#include "sql_class.h"
@@ -44,10 +43,6 @@
4443
#define current_stmt_binlog_row_based is_current_stmt_binlog_format_row
4544
#define clear_current_stmt_binlog_row_based clear_current_stmt_binlog_format_row
4645

47-
#else
48-
#include "mysql_priv.h"
49-
#endif
50-
5146
#undef min
5247
#undef max
5348

storage/oqgraph/ha_oqgraph.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,8 @@ class ha_oqgraph: public handler
5252
int fill_record(byte*, const open_query::row&);
5353

5454
public:
55-
#if MYSQL_VERSION_ID >= 50100
5655
ha_oqgraph(handlerton *hton, TABLE_SHARE *table);
5756
ulonglong table_flags() const override;
58-
#else
59-
ha_oqgraph(TABLE *table);
60-
Table_flags table_flags() const;
61-
#endif
6257
virtual ~ha_oqgraph();
6358
const char *index_type(uint inx) override
6459
{
@@ -111,11 +106,6 @@ class ha_oqgraph: public handler
111106

112107
void fprint_error(const char* fmt, ...);
113108

114-
#if MYSQL_VERSION_ID < 100000
115-
// Allow compatibility for build with 5.5.32
116-
virtual const char *table_type() const { return hton_name(ht)->str; }
117-
#endif
118-
119109
my_bool register_query_cache_table(THD *thd, const char *table_key,
120110
uint key_length,
121111
qc_engine_callback

storage/oqgraph/oqgraph_thunk.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@
3434
#include "field.h"
3535
#include "key.h"
3636

37-
#if MYSQL_VERSION_ID < 100000
38-
// Allow compatibility with build for 5.5.32
39-
#define user_defined_key_parts key_parts
40-
#endif
41-
4237
static int debugid = 0;
4338

4439
oqgraph3::vertex_id oqgraph3::edge_info::origid() const

storage/sphinx/ha_sphinx.h

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,9 @@
22
// $Id: ha_sphinx.h 4818 2014-09-24 08:53:38Z tomat $
33
//
44

5-
#if MYSQL_VERSION_ID>=50515
65
#define TABLE_ARG TABLE_SHARE
7-
#elif MYSQL_VERSION_ID>50100
8-
#define TABLE_ARG st_table_share
9-
#else
10-
#define TABLE_ARG st_table
11-
#endif
126

13-
14-
#if MYSQL_VERSION_ID>=50120
157
typedef uchar byte;
16-
#endif
17-
188

199
/// forward decls
2010
class THD;
@@ -43,22 +33,14 @@ class ha_sphinx final : public handler
4333
bool m_bUnpackError; ///< any errors while unpacking response
4434

4535
public:
46-
#if MYSQL_VERSION_ID<50100
47-
ha_sphinx ( TABLE_ARG * table_arg ); // NOLINT
48-
#else
4936
ha_sphinx ( handlerton * hton, TABLE_ARG * table_arg );
50-
#endif
5137
~ha_sphinx ();
5238

5339
const char * table_type () const override { return "SPHINX"; } ///< SE name for display purposes
5440
const char * index_type ( uint ) override { return "HASH"; } ///< index type name for display purposes
5541

56-
#if MYSQL_VERSION_ID>50100
5742
ulonglong table_flags () const override { return HA_CAN_INDEX_BLOBS |
5843
HA_CAN_TABLE_CONDITION_PUSHDOWN; } ///< bitmap of implemented flags (see handler.h for more info)
59-
#else
60-
ulong table_flags () const { return HA_CAN_INDEX_BLOBS; } ///< bitmap of implemented flags (see handler.h for more info)
61-
#endif
6244

6345
ulong index_flags ( uint, uint, bool ) const override { return 0; } ///< bitmap of flags that says how SE implements indexes
6446
uint max_supported_record_length () const override { return HA_MAX_REC_LENGTH; }
@@ -117,14 +99,8 @@ class ha_sphinx final : public handler
11799
int rnd_end () override;
118100
int rnd_next ( byte * buf ) override;
119101
int rnd_pos ( byte * buf, byte * pos ) override;
120-
void position ( const byte * record ) override;
121-
122-
#if MYSQL_VERSION_ID>=50030
102+
void position ( const byte * record ) override;
123103
int info ( uint ) override;
124-
#else
125-
void info ( uint );
126-
#endif
127-
128104
int reset() override;
129105
int external_lock ( THD * thd, int lock_type ) override;
130106
int delete_all_rows () override;
@@ -137,11 +113,7 @@ class ha_sphinx final : public handler
137113
THR_LOCK_DATA ** store_lock ( THD * thd, THR_LOCK_DATA ** to, enum thr_lock_type lock_type ) override;
138114

139115
public:
140-
#if MYSQL_VERSION_ID<50610
141-
virtual const COND * cond_push ( const COND *cond );
142-
#else
143116
const Item * cond_push ( const Item *cond ) override;
144-
#endif
145117
void cond_pop () override;
146118

147119
private:
@@ -168,11 +140,6 @@ class ha_sphinx final : public handler
168140
CSphSEThreadTable * GetTls ();
169141
};
170142

171-
172-
#if MYSQL_VERSION_ID < 50100
173-
bool sphinx_show_status ( THD * thd );
174-
#endif
175-
176143
//
177144
// $Id: ha_sphinx.h 4818 2014-09-24 08:53:38Z tomat $
178145
//

storage/sphinx/snippets_udf.cc

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,13 @@
2626

2727
#include <mysql_version.h>
2828

29-
#if MYSQL_VERSION_ID>=50515
3029
#include "sql_class.h"
3130
#include "sql_array.h"
32-
#elif MYSQL_VERSION_ID>50100
33-
#include "mysql_priv.h"
34-
#include <mysql/plugin.h>
35-
#else
36-
#include "../mysql_priv.h"
37-
#endif
3831

3932
#include <mysys_err.h>
4033
#include <my_sys.h>
4134

42-
#if MYSQL_VERSION_ID>=50120
4335
typedef uchar byte;
44-
#endif
4536

4637
/// partially copy-pasted stuff that should be moved elsewhere
4738

@@ -389,7 +380,6 @@ int CSphUrl::Connect()
389380
int tmp_errno;
390381
bool bError = false;
391382

392-
#if MYSQL_VERSION_ID>=50515
393383
struct addrinfo *hp = NULL;
394384
tmp_errno = getaddrinfo ( m_sHost, NULL, NULL, &hp );
395385
if ( !tmp_errno || !hp || !hp->ai_addr )
@@ -398,16 +388,6 @@ int CSphUrl::Connect()
398388
if ( hp )
399389
freeaddrinfo ( hp );
400390
}
401-
#else
402-
struct hostent tmp_hostent, *hp;
403-
char buff2 [ GETHOSTBYNAME_BUFF_SIZE ];
404-
hp = my_gethostbyname_r ( m_sHost, &tmp_hostent, buff2, sizeof(buff2), &tmp_errno );
405-
if ( !hp )
406-
{
407-
my_gethostbyname_r_free();
408-
bError = true;
409-
}
410-
#endif
411391

412392
if ( bError )
413393
{
@@ -418,13 +398,8 @@ int CSphUrl::Connect()
418398
return -1;
419399
}
420400

421-
#if MYSQL_VERSION_ID>=50515
422401
memcpy ( &sin.sin_addr, hp->ai_addr, Min ( sizeof(sin.sin_addr), (size_t)hp->ai_addrlen ) );
423402
freeaddrinfo ( hp );
424-
#else
425-
memcpy ( &sin.sin_addr, hp->h_addr, Min ( sizeof(sin.sin_addr), (size_t)hp->h_length ) );
426-
my_gethostbyname_r_free();
427-
#endif
428403
}
429404
} else
430405
{

0 commit comments

Comments
 (0)