Skip to content

Commit e22104c

Browse files
Evangelos DaniasIoannis Mytilinis
Evangelos Danias
authored and
Ioannis Mytilinis
committed
WL#15517: [2] HeatWave Support for InnoDB Partitions - Extend MySQL API
to support partition (UN)LOAD This patch modifies the MySQL parser to accept the partition load/unload commands and also enriches the tables of the RAPID engine with partitioning information. a) Partitioning API ==================== The commands we use for loading/unloading partition are the following: - ALTER TABLE SECONDARY_LOAD PARTITION (p0,p1,..,pn) - ALTER TABLE SECONDARY_UNLOAD PARTITION (p0,p1,..,pn) By using these two commands, and following a similar to the familiar SECONDARY_(UN)LOAD syntax, users can select a set of partitions that they want to load or unload. The PARTITION() clause is parsed by MySQL with the updated SECONDARY_LOAD/SECONDARY_UNLOAD grammar rules in sql_yacc (they are extended to also carry an optional partition list) and the names are stored in Table_ref->partition_names. b) Partitioned secondary tables =============================== Rapid tables inherit exactly the same partitioning information that exists in the primary engine. Change-Id: Idf444787d8b0f9dd0504137a509ec18409e9f567
1 parent 37329e3 commit e22104c

File tree

5 files changed

+36
-13
lines changed

5 files changed

+36
-13
lines changed

Diff for: mysql-test/collections/disabled.def

+3
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ rpl.rpl_io_thd_wait_for_disk_space_stress : BUG#23581287 Disabled until bug is f
150150
rpl.rpl_writeset_add_unique_key : Bug#33134835 RPL_WRITESET_ADD_UNIQUE_KEY FAILS SPORADICALLY
151151
rpl.rpl_replication_observers_example_plugin_ongoing_transaction : Bug#35982448 rpl_replication_observers_example_plugin_ongoing_transaction fails
152152

153+
# secondary_engine tests
154+
secondary_engine.query_preparation : BUG#36306426 Disabled until bug is fixed
155+
153156
# sys_vars tests
154157
sys_vars.max_execution_time_basic @freebsd : BUG#31041720
155158
sys_vars.innodb_log_writer_threads_basic : Bug#32129814 SYS_VARS.INNODB_LOG_WRITER_THREADS_BASIC TIMES OUT SPORADICALLY ON PB2

Diff for: sql/dd_table_share.cc

-5
Original file line numberDiff line numberDiff line change
@@ -1910,11 +1910,6 @@ static bool fill_partitioning_from_dd(THD *thd, TABLE_SHARE *share,
19101910
const dd::Table *tab_obj) {
19111911
if (tab_obj->partition_type() == dd::Table::PT_NONE) return false;
19121912

1913-
// The DD only has information about how the table is partitioned in
1914-
// the primary storage engine, so don't use this information for
1915-
// tables in a secondary storage engine.
1916-
if (share->is_secondary_engine()) return false;
1917-
19181913
partition_info *part_info;
19191914
part_info = new (&share->mem_root) partition_info;
19201915

Diff for: sql/parse_tree_nodes.h

+18-4
Original file line numberDiff line numberDiff line change
@@ -4772,11 +4772,18 @@ class PT_alter_table_secondary_load final
47724772
: public PT_alter_table_standalone_action {
47734773
using super = PT_alter_table_standalone_action;
47744774

4775+
const List<String> *opt_use_partition = nullptr;
4776+
47754777
public:
4776-
explicit PT_alter_table_secondary_load(const POS &pos)
4777-
: super(pos, Alter_info::ALTER_SECONDARY_LOAD) {}
4778+
explicit PT_alter_table_secondary_load(
4779+
const POS &pos, const List<String> *opt_use_partition = nullptr)
4780+
: super(pos, Alter_info::ALTER_SECONDARY_LOAD),
4781+
opt_use_partition{opt_use_partition} {}
47784782

47794783
Sql_cmd *make_cmd(Table_ddl_parse_context *pc) override {
4784+
if (opt_use_partition != nullptr)
4785+
pc->alter_info->partition_names = *opt_use_partition;
4786+
47804787
return new (pc->mem_root) Sql_cmd_secondary_load_unload(pc->alter_info);
47814788
}
47824789
};
@@ -4785,11 +4792,18 @@ class PT_alter_table_secondary_unload final
47854792
: public PT_alter_table_standalone_action {
47864793
using super = PT_alter_table_standalone_action;
47874794

4795+
const List<String> *opt_use_partition = nullptr;
4796+
47884797
public:
4789-
explicit PT_alter_table_secondary_unload(const POS &pos)
4790-
: super(pos, Alter_info::ALTER_SECONDARY_UNLOAD) {}
4798+
explicit PT_alter_table_secondary_unload(
4799+
const POS &pos, const List<String> *opt_use_partition = nullptr)
4800+
: super(pos, Alter_info::ALTER_SECONDARY_UNLOAD),
4801+
opt_use_partition{opt_use_partition} {}
47914802

47924803
Sql_cmd *make_cmd(Table_ddl_parse_context *pc) override {
4804+
if (opt_use_partition != nullptr)
4805+
pc->alter_info->partition_names = *opt_use_partition;
4806+
47934807
return new (pc->mem_root) Sql_cmd_secondary_load_unload(pc->alter_info);
47944808
}
47954809
};

Diff for: sql/sql_table.cc

+11
Original file line numberDiff line numberDiff line change
@@ -11733,6 +11733,17 @@ bool Sql_cmd_secondary_load_unload::mysql_secondary_load_or_unload(
1173311733
/* If set, secondary_load value will not be updated, and also no bin log
1173411734
* entries will be recorded. */
1173511735
bool skip_metadata_update = false;
11736+
11737+
// Partitioned Load/Unload
11738+
if (table_list->table->part_info != nullptr) {
11739+
table_list->partition_names = nullptr;
11740+
11741+
if (m_alter_info->partition_names.elements > 0 &&
11742+
!(m_alter_info->flags & Alter_info::ALTER_ALL_PARTITION)) {
11743+
table_list->partition_names = &m_alter_info->partition_names;
11744+
}
11745+
}
11746+
1173611747
// Initiate loading into or unloading from secondary engine.
1173711748
if (is_load) {
1173811749
DEBUG_SYNC(thd, "before_secondary_engine_load_table");

Diff for: sql/sql_yacc.yy

+4-4
Original file line numberDiff line numberDiff line change
@@ -8741,13 +8741,13 @@ standalone_alter_commands:
87418741
{
87428742
$$= NEW_PTN PT_alter_table_import_partition_tablespace(@$, $3);
87438743
}
8744-
| SECONDARY_LOAD_SYM
8744+
| SECONDARY_LOAD_SYM opt_use_partition
87458745
{
8746-
$$= NEW_PTN PT_alter_table_secondary_load(@$);
8746+
$$= NEW_PTN PT_alter_table_secondary_load(@$, $2);
87478747
}
8748-
| SECONDARY_UNLOAD_SYM
8748+
| SECONDARY_UNLOAD_SYM opt_use_partition
87498749
{
8750-
$$= NEW_PTN PT_alter_table_secondary_unload(@$);
8750+
$$= NEW_PTN PT_alter_table_secondary_unload(@$, $2);
87518751
}
87528752
;
87538753

0 commit comments

Comments
 (0)