Skip to content

Commit cb52174

Browse files
committed
online alter: extract the source to a separate file
Move all the functions dedicated to online alter to a newly created online_alter.cc. With that, make many functions static and simplify the static functions naming. Also, rename binlog_log_row_online_alter -> online_alter_log_row.
1 parent 830bdfc commit cb52174

File tree

7 files changed

+577
-538
lines changed

7 files changed

+577
-538
lines changed

sql/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,17 @@ MYSQL_ADD_PLUGIN(partition ha_partition.cc STORAGE_ENGINE DEFAULT STATIC_ONLY
218218
RECOMPILE_FOR_EMBEDDED)
219219
MYSQL_ADD_PLUGIN(sql_sequence ha_sequence.cc STORAGE_ENGINE MANDATORY STATIC_ONLY
220220
RECOMPILE_FOR_EMBEDDED)
221-
MYSQL_ADD_PLUGIN(online_alter_log log.cc STORAGE_ENGINE MANDATORY STATIC_ONLY
222-
NOT_EMBEDDED)
221+
MYSQL_ADD_PLUGIN(online_alter_log online_alter.cc STORAGE_ENGINE MANDATORY
222+
STATIC_ONLY NOT_EMBEDDED)
223+
223224

224225
ADD_LIBRARY(sql STATIC ${SQL_SOURCE})
225226
MAYBE_DISABLE_IPO(sql)
226227
DTRACE_INSTRUMENT(sql)
227228
TARGET_LINK_LIBRARIES(sql
228229
mysys mysys_ssl dbug strings vio pcre2-8
229230
tpool
231+
online_alter_log
230232
${LIBWRAP} ${LIBCRYPT} ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}
231233
${SSL_LIBRARIES}
232234
${LIBSYSTEMD})

sql/handler.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7304,8 +7304,8 @@ int handler::binlog_log_row(const uchar *before_record,
73047304

73057305
#ifdef HAVE_REPLICATION
73067306
if (unlikely(!error && table->s->online_alter_binlog && is_root_handler()))
7307-
error= binlog_log_row_online_alter(table, before_record, after_record,
7308-
log_func);
7307+
error= online_alter_log_row(table, before_record, after_record,
7308+
log_func);
73097309
#endif // HAVE_REPLICATION
73107310

73117311
DBUG_RETURN(error);

sql/handler.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,8 +1098,6 @@ extern MYSQL_PLUGIN_IMPORT st_plugin_int *hton2plugin[MAX_HA];
10981098

10991099
struct handlerton;
11001100

1101-
extern handlerton *online_alter_hton;
1102-
11031101
#define view_pseudo_hton ((handlerton *)1)
11041102

11051103
/*
@@ -1972,9 +1970,7 @@ class Ha_trx_info
19721970
bool is_trx_read_write() const
19731971
{
19741972
DBUG_ASSERT(is_started());
1975-
bool result= m_flags & (int) TRX_READ_WRITE;
1976-
DBUG_ASSERT(!result || m_ht != online_alter_hton);
1977-
return result;
1973+
return m_flags & (int) TRX_READ_WRITE;
19781974
}
19791975
bool is_started() const { return m_ht != NULL; }
19801976
/** Mark this transaction read-write if the argument is read-write. */

0 commit comments

Comments
 (0)