Skip to content

Commit 2b39abc

Browse files
author
Libing Song
committed
bug#14798275 GLOBAL GTID VARIABLES RELEASED TO EARLY DURING SHUTDOWN
Problem: NDB engine encounters an error when embedded server shutdown, if binlog is opened. It happens because binlog related things are closed before NDB engine is closed, but the things(e.g GTID) may need when NDB engine is closing. Fix: Handler provides a hook ha_binlog_end which tells engines to finish binlog related works before server closes binlog. But it was not compiled in embedded server. In this patch it is compiled in embedded server, just like a common mysql server. No way to test the patch on mysql server without NDB. But there is a test ndb_basic can verify this patch on ndb branches.
1 parent f79b418 commit 2b39abc

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

sql/handler.cc

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5245,7 +5245,6 @@ int ha_make_pushed_joins(THD *thd, const AQP::Join_plan* plan)
52455245
DBUG_RETURN(args.err);
52465246
}
52475247

5248-
#ifdef HAVE_NDB_BINLOG
52495248
/*
52505249
TODO: change this into a dynamic struct
52515250
List<handlerton> does not work as
@@ -5300,6 +5299,8 @@ static my_bool binlog_func_foreach(THD *thd, binlog_func_st *bfn)
53005299
return FALSE;
53015300
}
53025301

5302+
#ifdef HAVE_NDB_BINLOG
5303+
53035304
int ha_reset_logs(THD *thd)
53045305
{
53055306
binlog_func_st bfn= {BFN_RESET_LOGS, 0};
@@ -5319,13 +5320,6 @@ void ha_binlog_wait(THD* thd)
53195320
binlog_func_foreach(thd, &bfn);
53205321
}
53215322

5322-
int ha_binlog_end(THD* thd)
5323-
{
5324-
binlog_func_st bfn= {BFN_BINLOG_END, 0};
5325-
binlog_func_foreach(thd, &bfn);
5326-
return 0;
5327-
}
5328-
53295323
int ha_binlog_index_purge_file(THD *thd, const char *file)
53305324
{
53315325
binlog_func_st bfn= {BFN_BINLOG_PURGE_FILE, (void *)file};
@@ -5383,6 +5377,13 @@ void ha_binlog_log_query(THD *thd, handlerton *hton,
53835377
}
53845378
#endif
53855379

5380+
int ha_binlog_end(THD* thd)
5381+
{
5382+
binlog_func_st bfn= {BFN_BINLOG_END, 0};
5383+
binlog_func_foreach(thd, &bfn);
5384+
return 0;
5385+
}
5386+
53865387
/**
53875388
Calculate cost of 'index only' scan for given index and number of records
53885389

sql/handler.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3413,16 +3413,17 @@ void ha_binlog_log_query(THD *thd, handlerton *db_type,
34133413
const char *query, uint query_length,
34143414
const char *db, const char *table_name);
34153415
void ha_binlog_wait(THD *thd);
3416-
int ha_binlog_end(THD *thd);
34173416
#else
34183417
#define ha_reset_logs(a) do {} while (0)
34193418
#define ha_binlog_index_purge_file(a,b) do {} while (0)
34203419
#define ha_reset_slave(a) do {} while (0)
34213420
#define ha_binlog_log_query(a,b,c,d,e,f,g) do {} while (0)
34223421
#define ha_binlog_wait(a) do {} while (0)
3423-
#define ha_binlog_end(a) do {} while (0)
34243422
#endif
34253423

3424+
/* It is required by basic binlog features on both MySQL server and libmysqld */
3425+
int ha_binlog_end(THD *thd);
3426+
34263427
const char *ha_legacy_type_name(legacy_db_type legacy_type);
34273428
const char *get_canonical_filename(handler *file, const char *path,
34283429
char *tmp_path);

0 commit comments

Comments
 (0)