@@ -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
191185protected:
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)
29482921err:
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)
42784249err:
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
53455313Group_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
0 commit comments