WL#4807: Separate partitioning interface from handler to Partition_handler
Affects: Server-5.7
—
Status: Complete
Currently the handler class contains partitioning operations which only are used by a few engines, this worklog is to separate the partitioning specific parts of the handler class into an own partitioning interface.
FR1: Possible to build the partitioning engine as a plugin (with 'cmake -DWITH_PARTITION_STORAGE_ENGINE=0') Other than that this is a non-user visible refactoring of the Storage Engine API for partition handling.
Create a new base class 'Partition_handler' which will be the interface for
partitioning specific functionality of storage engines.
To get access to this object a new handler function
handler::get_partition_handler() will be added, and default return NULL.
The change will be:
- remove partition_hton global pointer (use plugin lookup instead).
- remove get_ha_partition (use get_new_handler instead)
- remove all #ifdef WITH_PARTITION_STORAGE_ENGINE. The partitioning support in
the server should always be included even if there are no partitioning engines
included. (To skip partitioning, simply avoid building and linking ha_partition
or build it as plugin and not install it.)
- Add 'virtual Partition_handler* handler::get_partition_handler() { return
NULL; }' to get access to the partitioning specific handler functions.
- Move the partitioning specific handler function to a new file and class
Partition_handler:
/* I_S.PARTITIONS */
get_dynamic_partition_info
/* Setting up partitioning, CREATE/ALTER */
get_default_num_partitions
set_auto_partitions
get_num_parts
set_part_info
initialize_partition
/* TRUNCATE */
truncate_partition
/* fast_alter_partition_table */
change_partitions
drop_partitions
rename_partitions
alter_flags
- Implement Partition_handler derived classes for both ha_partition and
ha_ndbcluster (make the new Parititon_handler class a friend class of
ha_partition/ha_ndbcluster and call the 'old' ha_partition/ha_ndbcluster
functions). The new partition_handler.{h,cc} should be placed in the new
directory sql/partitioning/ which will contain all partitioning related code
used by the server, except storage engines.
- Move ha_partition.{h,cc} to storage/partition/ and adjust the CMakeList.txt
files so that it will built it statically if WITH_PARTITION_STORAGE_ENGINE, not
build it if WITHOUT_PARTITION_STORAGE_ENGINE and build it as a plugin shared
library if neither is set.
Copyright (c) 2000, 2025, Oracle Corporation and/or its affiliates. All rights reserved.