Skip to content

Commit 22770a9

Browse files
committed
Merge 10.2 into bb-10.2-ext
2 parents 7bd81c7 + 27ea296 commit 22770a9

32 files changed

+70
-263
lines changed

sql/handler.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
2-
Copyright (c) 2009, 2016, MariaDB
2+
Copyright (c) 2009, 2018, MariaDB Corporation.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -797,7 +797,9 @@ static my_bool closecon_handlerton(THD *thd, plugin_ref plugin,
797797
*/
798798
void ha_close_connection(THD* thd)
799799
{
800-
plugin_foreach(thd, closecon_handlerton, MYSQL_STORAGE_ENGINE_PLUGIN, 0);
800+
plugin_foreach_with_mask(thd, closecon_handlerton,
801+
MYSQL_STORAGE_ENGINE_PLUGIN,
802+
PLUGIN_IS_DELETED|PLUGIN_IS_READY, 0);
801803
}
802804

803805
static my_bool kill_handlerton(THD *thd, plugin_ref plugin,

sql/sql_load.cc

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,23 +104,25 @@ the transaction after every 10,000 inserted rows. */
104104
static bool wsrep_load_data_split(THD *thd, const TABLE *table,
105105
const COPY_INFO &info)
106106
{
107-
extern struct handlerton* innodb_hton_ptr;
108-
109107
DBUG_ENTER("wsrep_load_data_split");
110108

111-
if (wsrep_load_data_splitting && wsrep_on(thd)
112-
&& info.records && !(info.records % 10000)
113-
&& thd->transaction.stmt.ha_list
114-
&& thd->transaction.stmt.ha_list->ht() == binlog_hton
115-
&& thd->transaction.stmt.ha_list->next()
116-
&& thd->transaction.stmt.ha_list->next()->ht() == innodb_hton_ptr
117-
&& !thd->transaction.stmt.ha_list->next()->next())
109+
if (!wsrep_load_data_splitting || !wsrep_on(thd)
110+
|| !info.records || (info.records % 10000)
111+
|| !thd->transaction.stmt.ha_list
112+
|| thd->transaction.stmt.ha_list->ht() != binlog_hton
113+
|| !thd->transaction.stmt.ha_list->next()
114+
|| thd->transaction.stmt.ha_list->next()->next())
115+
DBUG_RETURN(false);
116+
117+
if (handlerton* hton= thd->transaction.stmt.ha_list->next()->ht())
118118
{
119+
if (hton->db_type != DB_TYPE_INNODB)
120+
DBUG_RETURN(false);
119121
WSREP_DEBUG("intermediate transaction commit in LOAD DATA");
120122
if (wsrep_run_wsrep_commit(thd, true) != WSREP_TRX_OK) DBUG_RETURN(true);
121123
if (binlog_hton->commit(binlog_hton, thd, true)) DBUG_RETURN(true);
122124
wsrep_post_commit(thd, true);
123-
innodb_hton_ptr->commit(innodb_hton_ptr, thd, true);
125+
hton->commit(hton, thd, true);
124126
table->file->extra(HA_EXTRA_FAKE_START_STMT);
125127
}
126128

sql/wsrep_var.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ int wsrep_init_vars()
4242
return 0;
4343
}
4444

45-
extern ulong innodb_lock_schedule_algorithm;
45+
/* This is intentionally declared as a weak global symbol, so that
46+
linking will succeed even if the server is built with a dynamically
47+
linked InnoDB. */
48+
ulong innodb_lock_schedule_algorithm __attribute__((weak));
4649

4750
bool wsrep_on_update (sys_var *self, THD* thd, enum_var_type var_type)
4851
{

storage/innobase/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ SET(INNOBASE_SOURCES
137137
trx/trx0sys.cc
138138
trx/trx0trx.cc
139139
trx/trx0undo.cc
140-
usr/usr0sess.cc
141140
ut/ut0crc32.cc
142141
ut/ut0dbg.cc
143142
ut/ut0list.cc
@@ -151,6 +150,7 @@ SET(INNOBASE_SOURCES
151150
ut/ut0timer.cc)
152151

153152
MYSQL_ADD_PLUGIN(innobase ${INNOBASE_SOURCES} STORAGE_ENGINE
153+
MODULE_OUTPUT_NAME ha_innodb
154154
DEFAULT RECOMPILE_FOR_EMBEDDED
155155
LINK_LIBRARIES
156156
${ZLIB_LIBRARY}

storage/innobase/dict/dict0crea.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*****************************************************************************
22
33
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
4-
Copyright (c) 2017, MariaDB Corporation.
4+
Copyright (c) 2017, 2018, MariaDB Corporation.
55
66
This program is free software; you can redistribute it and/or modify it under
77
the terms of the GNU General Public License as published by the Free Software
@@ -38,7 +38,6 @@ Created 1/8/1996 Heikki Tuuri
3838
#include "row0mysql.h"
3939
#include "pars0pars.h"
4040
#include "trx0roll.h"
41-
#include "usr0sess.h"
4241
#include "ut0vec.h"
4342
#include "dict0priv.h"
4443
#include "fts0priv.h"

storage/innobase/fts/fts0fts.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2699,6 +2699,7 @@ fts_cmp_set_sync_doc_id(
26992699
fts_table.parent = table->name.m_name;
27002700

27012701
trx = trx_allocate_for_background();
2702+
trx_start_internal(trx);
27022703

27032704
trx->op_info = "update the next FTS document id";
27042705

@@ -2819,6 +2820,7 @@ fts_update_sync_doc_id(
28192820

28202821
if (!trx) {
28212822
trx = trx_allocate_for_background();
2823+
trx_start_internal(trx);
28222824

28232825
trx->op_info = "setting last FTS document id";
28242826
local_trx = TRUE;
@@ -3056,6 +3058,8 @@ fts_commit_table(
30563058
fts_cache_t* cache = ftt->table->fts->cache;
30573059
trx_t* trx = trx_allocate_for_background();
30583060

3061+
trx_start_internal(trx);
3062+
30593063
rows = ftt->rows;
30603064

30613065
ftt->fts_trx->trx = trx;
@@ -3792,6 +3796,7 @@ fts_doc_fetch_by_doc_id(
37923796
trx_t* trx = trx_allocate_for_background();
37933797
que_t* graph;
37943798

3799+
trx_start_internal(trx);
37953800
trx->op_info = "fetching indexed FTS document";
37963801

37973802
/* The FTS index can be supplied by caller directly with
@@ -4138,6 +4143,7 @@ fts_sync_begin(
41384143
sync->start_time = ut_time();
41394144

41404145
sync->trx = trx_allocate_for_background();
4146+
trx_start_internal(sync->trx);
41414147

41424148
if (fts_enable_diag_print) {
41434149
ib::info() << "FTS SYNC for table " << sync->table->name
@@ -5008,7 +5014,6 @@ fts_get_rows_count(
50085014
chartable_name[MAX_FULL_NAME_LEN];
50095015

50105016
trx = trx_allocate_for_background();
5011-
50125017
trx->op_info = "fetching FT table rows count";
50135018

50145019
info = pars_info_create();
@@ -7330,6 +7335,7 @@ fts_load_stopword(
73307335

73317336
if (!trx) {
73327337
trx = trx_allocate_for_background();
7338+
trx_start_internal(trx);
73337339
trx->op_info = "upload FTS stopword";
73347340
new_trx = TRUE;
73357341
}

storage/innobase/fts/fts0opt.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*****************************************************************************
22
33
Copyright (c) 2007, 2017, Oracle and/or its affiliates. All Rights Reserved.
4-
Copyright (c) 2016, MariaDB Corporation. All Rights reserved.
4+
Copyright (c) 2016, 2018, MariaDB Corporation.
55
66
This program is free software; you can redistribute it and/or modify it under
77
the terms of the GNU General Public License as published by the Free Software
@@ -989,6 +989,7 @@ fts_table_fetch_doc_ids(
989989

990990
if (!trx) {
991991
trx = trx_allocate_for_background();
992+
trx_start_internal(trx);
992993
alloc_bk_trx = TRUE;
993994
}
994995

@@ -1619,6 +1620,7 @@ fts_optimize_create(
16191620
optim->table = table;
16201621

16211622
optim->trx = trx_allocate_for_background();
1623+
trx_start_internal(optim->trx);
16221624

16231625
optim->fts_common_table.parent = table->name.m_name;
16241626
optim->fts_common_table.table_id = table->id;
@@ -1741,6 +1743,7 @@ fts_optimize_free(
17411743
{
17421744
mem_heap_t* heap = static_cast<mem_heap_t*>(optim->self_heap->arg);
17431745

1746+
trx_commit_for_mysql(optim->trx);
17441747
trx_free_for_background(optim->trx);
17451748

17461749
fts_doc_ids_free(optim->to_delete);

storage/innobase/handler/ha_innodb.cc

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,9 @@ innodb_check_deprecated(void);
154154

155155
#ifdef WITH_WSREP
156156
#include "dict0priv.h"
157-
#include "../storage/innobase/include/ut0byte.h"
157+
#include "ut0byte.h"
158158
#include <mysql/service_md5.h>
159159

160-
class binlog_trx_data;
161-
extern handlerton *binlog_hton;
162-
163160
extern MYSQL_PLUGIN_IMPORT MYSQL_BIN_LOG mysql_bin_log;
164161

165162
static inline wsrep_ws_handle_t*
@@ -1957,14 +1954,11 @@ thd_innodb_tmpdir(
19571954
}
19581955

19591956
/** Obtain the InnoDB transaction of a MySQL thread.
1960-
@param[in,out] thdMySQL thread handler.
1957+
@param[in,out] thd thread handle
19611958
@return reference to transaction pointer */
1962-
MY_ATTRIBUTE((warn_unused_result))
1963-
trx_t*&
1964-
thd_to_trx(
1965-
THD* thd)
1959+
static trx_t* thd_to_trx(THD* thd)
19661960
{
1967-
return(*(trx_t**) thd_ha_data(thd, innodb_hton_ptr));
1961+
return *reinterpret_cast<trx_t**>(thd_ha_data(thd, innodb_hton_ptr));
19681962
}
19691963

19701964
#ifdef WITH_WSREP
@@ -2873,20 +2867,19 @@ check_trx_exists(
28732867
/*=============*/
28742868
THD* thd) /*!< in: user thread handle */
28752869
{
2876-
trx_t*& trx = thd_to_trx(thd);
2877-
2878-
if (trx == NULL) {
2870+
if (trx_t* trx = thd_to_trx(thd)) {
2871+
ut_a(trx->magic_n == TRX_MAGIC_N);
2872+
innobase_trx_init(thd, trx);
2873+
return trx;
2874+
} else {
28792875
trx = innobase_trx_allocate(thd);
28802876
/* User trx can be forced to rollback,
28812877
so we unset the disable flag. */
28822878
ut_ad(trx->in_innodb & TRX_FORCE_ROLLBACK_DISABLE);
28832879
trx->in_innodb &= TRX_FORCE_ROLLBACK_MASK;
2884-
} else {
2885-
ut_a(trx->magic_n == TRX_MAGIC_N);
2886-
innobase_trx_init(thd, trx);
2880+
thd_set_ha_data(thd, innodb_hton_ptr, trx);
2881+
return trx;
28872882
}
2888-
2889-
return(trx);
28902883
}
28912884

28922885
/*************************************************************************
@@ -2896,8 +2889,7 @@ innobase_get_trx()
28962889
{
28972890
THD *thd=current_thd;
28982891
if (likely(thd != 0)) {
2899-
trx_t*& trx = thd_to_trx(thd);
2900-
return(trx);
2892+
return thd_to_trx(thd);
29012893
} else {
29022894
return(NULL);
29032895
}

storage/innobase/handler/ha_innodb.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*****************************************************************************
22
33
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved.
4-
Copyright (c) 2013, 2017, MariaDB Corporation.
4+
Copyright (c) 2013, 2018, MariaDB Corporation.
55
66
This program is free software; you can redistribute it and/or modify it under
77
the terms of the GNU General Public License as published by the Free Software
@@ -911,11 +911,6 @@ innodb_base_col_setup_for_stored(
911911
create_table_info_t::normalize_table_name_low(norm_name, name, FALSE)
912912
#endif /* _WIN32 */
913913

914-
/** Obtain the InnoDB transaction of a MySQL thread.
915-
@param[in,out] thd MySQL thread handler.
916-
@return reference to transaction pointer */
917-
trx_t*& thd_to_trx(THD* thd);
918-
919914
/** Converts an InnoDB error code to a MySQL error code.
920915
Also tells to MySQL about a possible transaction rollback inside InnoDB caused
921916
by a lock wait timeout or a deadlock.

storage/innobase/include/pars0opt.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*****************************************************************************
22
33
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
4-
Copyright (c) 2017, MariaDB Corporation.
4+
Copyright (c) 2017, 2018, MariaDB Corporation.
55
66
This program is free software; you can redistribute it and/or modify it under
77
the terms of the GNU General Public License as published by the Free Software
@@ -29,7 +29,6 @@ Created 12/21/1997 Heikki Tuuri
2929

3030
#include "univ.i"
3131
#include "que0types.h"
32-
#include "usr0types.h"
3332
#include "pars0sym.h"
3433
#include "dict0types.h"
3534
#include "row0sel.h"

0 commit comments

Comments
 (0)