@@ -105,23 +105,41 @@ class Term_string
105
105
class Wsrep_load_data_split
106
106
{
107
107
public:
108
- Wsrep_load_data_split (THD *thd)
108
+ Wsrep_load_data_split (THD *thd, TABLE *table )
109
109
: m_thd(thd)
110
- , m_load_data_splitting(wsrep_load_data_splitting )
110
+ , m_load_data_splitting(false )
111
111
, m_fragment_unit(thd->wsrep_trx ().streaming_context().fragment_unit())
112
112
, m_fragment_size(thd->wsrep_trx ().streaming_context().fragment_size())
113
113
{
114
- if (WSREP (m_thd) && m_load_data_splitting)
114
+ /*
115
+ We support load data splitting for InnoDB only as it will use
116
+ streaming replication (SR).
117
+ */
118
+ if (WSREP (thd) && wsrep_load_data_splitting)
115
119
{
116
- /* Override streaming settings with backward compatible values for
117
- load data splitting */
118
- m_thd->wsrep_cs ().streaming_params (wsrep::streaming_context::row, 10000 );
120
+ handlerton *ht= table->s ->db_type ();
121
+ // For partitioned tables find underlying hton
122
+ if (table->file ->partition_ht ())
123
+ ht= table->file ->partition_ht ();
124
+ if (ht->db_type != DB_TYPE_INNODB)
125
+ {
126
+ push_warning_printf (thd, Sql_condition::WARN_LEVEL_WARN,
127
+ ER_NOT_SUPPORTED_YET,
128
+ " wsrep_load_data_splitting for other than InnoDB tables" );
129
+ }
130
+ else
131
+ {
132
+ /* Override streaming settings with backward compatible values for
133
+ load data splitting */
134
+ m_thd->wsrep_cs ().streaming_params (wsrep::streaming_context::row, 10000 );
135
+ m_load_data_splitting= true ;
136
+ }
119
137
}
120
138
}
121
139
122
140
~Wsrep_load_data_split ()
123
141
{
124
- if (WSREP (m_thd) && m_load_data_splitting)
142
+ if (m_load_data_splitting)
125
143
{
126
144
/* Restore original settings */
127
145
m_thd->wsrep_cs ().streaming_params (m_fragment_unit, m_fragment_size);
@@ -346,6 +364,7 @@ int mysql_load(THD *thd, const sql_exchange *ex, TABLE_LIST *table_list,
346
364
bool is_concurrent;
347
365
#endif
348
366
const char *db= table_list->db .str ; // This is never null
367
+
349
368
/*
350
369
If path for file is not defined, we will use the current database.
351
370
If this is not set, we will use the directory where the table to be
@@ -356,9 +375,6 @@ int mysql_load(THD *thd, const sql_exchange *ex, TABLE_LIST *table_list,
356
375
bool transactional_table __attribute__ ((unused));
357
376
DBUG_ENTER (" mysql_load" );
358
377
359
- #ifdef WITH_WSREP
360
- Wsrep_load_data_split wsrep_load_data_split (thd);
361
- #endif /* WITH_WSREP */
362
378
/*
363
379
Bug #34283
364
380
mysqlbinlog leaves tmpfile after termination if binlog contains
@@ -422,6 +438,11 @@ int mysql_load(THD *thd, const sql_exchange *ex, TABLE_LIST *table_list,
422
438
{
423
439
DBUG_RETURN (TRUE );
424
440
}
441
+
442
+ #ifdef WITH_WSREP
443
+ Wsrep_load_data_split wsrep_load_data_split (thd, table_list->table );
444
+ #endif /* WITH_WSREP */
445
+
425
446
thd_proc_info (thd, " Executing" );
426
447
/*
427
448
Let us emit an error if we are loading data to table which is used
0 commit comments