Skip to content

Commit f7c394d

Browse files
author
Sven Sandberg
committed
WL#3584 cleanup
removed #define HAVE_GTID and @@GLOBAL.HAVE_GTID
1 parent 1b939bc commit f7c394d

40 files changed

+22
-281
lines changed

client/mysqlbinlog.cc

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ enum Exit_status {
157157
OK_STOP
158158
};
159159

160-
#ifdef HAVE_GTID
161160
/*
162161
Options that will be used to filter out events.
163162
*/
@@ -167,7 +166,6 @@ static my_bool opt_skip_gtids= 0;
167166
static bool filter_based_on_gtids= false;
168167
static Gtid_set gtid_set_included(&global_sid_map);
169168
static Gtid_set gtid_set_excluded(&global_sid_map);
170-
#endif
171169

172170
static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
173171
const char* logname);
@@ -690,7 +688,6 @@ static bool shall_skip_database(const char *log_dbname)
690688
}
691689

692690

693-
#ifdef HAVE_GTID
694691
/**
695692
Checks whether the given event should be filtered out,
696693
according to the include-gtids, exclude-gtids and
@@ -734,7 +731,6 @@ static bool shall_skip_gtids(Log_event* ev)
734731

735732
return filtered;
736733
}
737-
#endif
738734

739735
/**
740736
Print the given event, and either delete it or delegate the deletion
@@ -815,10 +811,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
815811

816812
DBUG_PRINT("debug", ("event_type: %s", ev->get_type_str()));
817813

818-
#ifdef HAVE_GTID
819814
if (shall_skip_gtids(ev))
820815
goto end;
821-
#endif
822816

823817
switch (ev_type) {
824818
case QUERY_EVENT:
@@ -1338,7 +1332,6 @@ static struct my_option my_long_options[] =
13381332
/* def_value 4GB */ UINT_MAX, /* min_value */ 256,
13391333
/* max_value */ ULONG_MAX, /* sub_size */ 0,
13401334
/* block_size */ 256, /* app_type */ 0},
1341-
#ifdef HAVE_GTID
13421335
{"skip-gtids", OPT_MYSQLBINLOG_SKIP_GTIDS,
13431336
"Do not print Global Transaction Identifier information "
13441337
"(SET GTID_NEXT=... etc).",
@@ -1352,7 +1345,6 @@ static struct my_option my_long_options[] =
13521345
"Print all but the given Global Transaction Identifiers.",
13531346
&opt_exclude_gtids_str, &opt_exclude_gtids_str, 0,
13541347
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1355-
#endif
13561348
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
13571349
};
13581350

@@ -2353,7 +2345,6 @@ static int args_post_process(void)
23532345
}
23542346
}
23552347

2356-
#ifdef HAVE_GTID
23572348
global_sid_lock.rdlock();
23582349

23592350
if (opt_include_gtids_str != NULL)
@@ -2379,7 +2370,6 @@ static int args_post_process(void)
23792370
}
23802371

23812372
global_sid_lock.unlock();
2382-
#endif
23832373

23842374
DBUG_RETURN(OK_CONTINUE);
23852375
}

include/my_global.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,18 +1481,6 @@ enum loglevel {
14811481
};
14821482

14831483

1484-
/*
1485-
The group log can only be correctly truncated if my_chsize actually
1486-
truncates the file. So disable GTIDs on platforms that don't support
1487-
truncate.
1488-
*/
1489-
#if defined(_WIN32) || defined(HAVE_FTRUNCATE) || defined(HAVE_CHSIZE)
1490-
#if defined(HAVE_REPLICATION)
1491-
#define HAVE_GTID
1492-
#endif
1493-
#endif
1494-
1495-
14961484
/*
14971485
Visual Studio before the version 2010 did not have lldiv_t.
14981486
In Visual Studio 2010, _MSC_VER is defined as 1600.

sql/binlog.cc

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,10 @@ class binlog_cache_data
120120
return pending() == NULL && my_b_tell(&cache_log) == 0;
121121
}
122122

123-
#ifdef HAVE_GTID
124123
bool is_group_cache_empty() const
125124
{
126125
return group_cache.is_empty();
127126
}
128-
#endif
129127

130128
Rows_log_event *pending() const
131129
{
@@ -170,9 +168,7 @@ class binlog_cache_data
170168
variable after truncating the cache.
171169
*/
172170
cache_log.disk_writes= 0;
173-
#ifdef HAVE_GTID
174171
group_cache.clear();
175-
#endif
176172
DBUG_ASSERT(is_binlog_empty());
177173
}
178174

@@ -181,12 +177,10 @@ class binlog_cache_data
181177
*/
182178
IO_CACHE cache_log;
183179

184-
#ifdef HAVE_GTID
185180
/**
186181
The group cache for this cache.
187182
*/
188183
Group_cache group_cache;
189-
#endif
190184

191185
protected:
192186
/*
@@ -538,10 +532,8 @@ static int binlog_close_connection(handlerton *hton, THD *thd)
538532
binlog_cache_mngr *const cache_mngr= thd_get_cache_mngr(thd);
539533
DBUG_ASSERT(cache_mngr->trx_cache.is_binlog_empty() &&
540534
cache_mngr->stmt_cache.is_binlog_empty());
541-
#ifdef HAVE_GTID
542535
DBUG_ASSERT(cache_mngr->trx_cache.is_group_cache_empty() &&
543536
cache_mngr->stmt_cache.is_group_cache_empty());
544-
#endif
545537
thd_set_ha_data(thd, binlog_hton, NULL);
546538
cache_mngr->~binlog_cache_mngr();
547539
my_free(cache_mngr);
@@ -553,7 +545,7 @@ static int write_event_to_cache(THD *thd, Log_event *ev,
553545
{
554546
DBUG_ENTER("write_event_to_cache");
555547
IO_CACHE *cache= &cache_data->cache_log;
556-
#ifdef HAVE_GTID
548+
557549
if (gtid_mode > 0)
558550
{
559551
Group_cache* group_cache= &cache_data->group_cache;
@@ -568,15 +560,14 @@ static int write_event_to_cache(THD *thd, Log_event *ev,
568560
DBUG_RETURN(1);
569561
}
570562
}
571-
#endif
563+
572564
if (ev != NULL)
573565
if (ev->write(cache) != 0)
574566
DBUG_RETURN(1);
575567
DBUG_RETURN(0);
576568
}
577569

578570

579-
#ifdef HAVE_GTID
580571
/**
581572
Checks if the given GTID exists in the Group_cache. If not, add it
582573
as an empty group.
@@ -696,7 +687,6 @@ int gtid_before_write_cache(THD* thd, binlog_cache_data* cache_data)
696687

697688
DBUG_RETURN(0);
698689
}
699-
#endif
700690

701691
/**
702692
This function flushes a cache upon commit/rollback.
@@ -726,10 +716,8 @@ binlog_flush_cache(THD *thd, binlog_cache_mngr *cache_mngr,
726716
if (write_event_to_cache(thd, end_evt, cache_data))
727717
DBUG_RETURN(1);
728718

729-
#ifdef HAVE_GTID
730719
if (gtid_before_write_cache(thd, cache_data))
731720
DBUG_RETURN(1);
732-
#endif
733721

734722
/*
735723
Doing a commit or a rollback including non-transactional tables,
@@ -875,7 +863,6 @@ binlog_truncate_trx_cache(THD *thd, binlog_cache_mngr *cache_mngr, bool all)
875863
else
876864
{
877865
cache_mngr->trx_cache.restore_prev_position();
878-
#ifdef HAVE_GTID
879866
if (cache_mngr->trx_cache.is_binlog_empty())
880867
{
881868
/*
@@ -894,7 +881,6 @@ binlog_truncate_trx_cache(THD *thd, binlog_cache_mngr *cache_mngr, bool all)
894881
*/
895882
cache_mngr->trx_cache.group_cache.clear();
896883
}
897-
#endif
898884
}
899885

900886
DBUG_ASSERT(thd->binlog_get_pending_rows_event(TRUE) == NULL);
@@ -950,12 +936,9 @@ static int binlog_commit(handlerton *hton, THD *thd, bool all)
950936
*/
951937
if (!cache_mngr->stmt_cache.is_binlog_empty())
952938
error=
953-
#ifdef HAVE_GTID
954939
write_empty_groups_to_cache(thd, &cache_mngr->stmt_cache) ||
955-
#endif
956940
binlog_commit_flush_stmt_cache(thd, cache_mngr);
957941

958-
#ifdef HAVE_GTID
959942
/*
960943
todo: what is the exact condition to check here?
961944
@@ -968,7 +951,6 @@ static int binlog_commit(handlerton *hton, THD *thd, bool all)
968951
*/
969952
else if (all || !thd->in_multi_stmt_transaction_mode())
970953
error= write_empty_groups_to_cache(thd, &cache_mngr->trx_cache) != 0;
971-
#endif
972954

973955
if (cache_mngr->trx_cache.is_binlog_empty())
974956
{
@@ -1821,10 +1803,8 @@ MYSQL_BIN_LOG::MYSQL_BIN_LOG(uint *sync_period)
18211803
is_relay_log(0), signal_cnt(0),
18221804
checksum_alg_reset(BINLOG_CHECKSUM_ALG_UNDEF),
18231805
relay_log_checksum_alg(BINLOG_CHECKSUM_ALG_UNDEF),
1824-
description_event_for_exec(0), description_event_for_queue(0)
1825-
#ifdef HAVE_GTID
1826-
,previous_gtid_set(0)
1827-
#endif
1806+
description_event_for_exec(0), description_event_for_queue(0),
1807+
previous_gtid_set(0)
18281808
{
18291809
/*
18301810
We don't want to initialize locks here as such initialization depends on
@@ -1964,7 +1944,6 @@ bool MYSQL_BIN_LOG::open_index_file(const char *index_file_name_arg,
19641944
}
19651945

19661946

1967-
#ifdef HAVE_GTID
19681947
/**
19691948
Reads GTIDs from the given binlog file.
19701949
@@ -2186,7 +2165,7 @@ bool MYSQL_BIN_LOG::init_gtid_sets(Gtid_set *all_gtids, Gtid_set *lost_gtids,
21862165
mysql_mutex_unlock(&LOCK_log);
21872166
DBUG_RETURN(false);
21882167
}
2189-
#endif
2168+
21902169

21912170
/**
21922171
Open a (new) binlog file.
@@ -2321,7 +2300,6 @@ bool MYSQL_BIN_LOG::open_binlog(const char *log_name,
23212300
if (s.write(&log_file))
23222301
goto err;
23232302
bytes_written+= s.data_written;
2324-
#ifdef HAVE_GTID
23252303
/*
23262304
We need to revisit this code and improve it.
23272305
See further comments in the mysqld.
@@ -2341,7 +2319,6 @@ bool MYSQL_BIN_LOG::open_binlog(const char *log_name,
23412319
goto err;
23422320
bytes_written+= prev_gtids_ev.data_written;
23432321
}
2344-
#endif
23452322
}
23462323
if (description_event_for_queue &&
23472324
description_event_for_queue->binlog_version>=4)
@@ -2833,9 +2810,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd)
28332810
mysql_mutex_lock(&LOCK_log);
28342811
mysql_mutex_lock(&LOCK_index);
28352812

2836-
#ifdef HAVE_GTID
28372813
global_sid_lock.wrlock();
2838-
#endif
28392814

28402815
/* Save variables so that we can reopen the log */
28412816
save_name=name;
@@ -2920,7 +2895,6 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd)
29202895
}
29212896
}
29222897

2923-
#ifdef HAVE_GTID
29242898
#ifdef HAVE_REPLICATION
29252899
if (is_relay_log)
29262900
{
@@ -2935,7 +2909,6 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd)
29352909
if (gtid_state.init() != 0)
29362910
goto err;
29372911
}
2938-
#endif
29392912
#endif
29402913

29412914
if (!open_index_file(index_file_name, 0, FALSE))
@@ -2948,9 +2921,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd)
29482921
err:
29492922
if (error == 1)
29502923
name= const_cast<char*>(save_name);
2951-
#ifdef HAVE_GTID
29522924
global_sid_lock.unlock();
2953-
#endif
29542925
mysql_mutex_unlock(&LOCK_thread_count);
29552926
mysql_mutex_unlock(&LOCK_index);
29562927
mysql_mutex_unlock(&LOCK_log);
@@ -4278,9 +4249,7 @@ bool MYSQL_BIN_LOG::write_event(Log_event *event_info)
42784249
err:
42794250
if (event_info->is_using_immediate_logging())
42804251
{
4281-
#ifdef HAVE_GTID
42824252
error |= gtid_before_write_cache(thd, cache_data);
4283-
#endif
42844253
error |= mysql_bin_log.write_cache(thd, cache_data, false);
42854254
cache_data->reset();
42864255
}
@@ -5341,7 +5310,6 @@ int MYSQL_BIN_LOG::recover(IO_CACHE *log, Format_description_log_event *fdle,
53415310
return 1;
53425311
}
53435312

5344-
#ifdef HAVE_GTID
53455313
Group_cache *THD::get_group_cache(bool is_transactional)
53465314
{
53475315
DBUG_ENTER("THD::get_group_cache(bool)");
@@ -5361,7 +5329,6 @@ Group_cache *THD::get_group_cache(bool is_transactional)
53615329

53625330
DBUG_RETURN(&cache_data->group_cache);
53635331
}
5364-
#endif
53655332

53665333
/*
53675334
These functions are placed in this file since they need access to

sql/binlog.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
177177
m_key_file_log_index= key_file_log_index;
178178
}
179179
#endif
180-
#ifdef HAVE_GTID
181180
/**
182181
Reads the set of all GTIDs in the binary log, and the set of all
183182
lost GTIDs in the binary log, and stores each set in respective
@@ -198,9 +197,7 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
198197
}
199198
private:
200199
Gtid_set* previous_gtid_set;
201-
#endif
202200

203-
private:
204201
int open(const char *opt_name) { return open_binlog(opt_name); }
205202
public:
206203
int open_binlog(const char *opt_name);

0 commit comments

Comments
 (0)