D.S

dev.mysql.com

MySQL: storage/innobase/handler/ha_innopart.h Source File

MySQL: storage/innobase/handler/ha_innopart.h Source File MySQL  8.0.0 Source Code Documentation Main Page Related Pages Modules Namespaces Classes Files File List File Members ha_innopart.h Go to the documentation of this file. 1 /***************************************************************************** 2  3 Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved. 4  5 This program is free software; you can redistribute it and/or modify it under 6 the terms of the GNU General Public License as published by the Free Software 7 Foundation; version 2 of the License. 8  9 This program is distributed in the hope that it will be useful, but WITHOUT 10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12  13 You should have received a copy of the GNU General Public License along with 14 this program; if not, write to the Free Software Foundation, Inc., 15 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA 16  17 *****************************************************************************/ 18  19 /* The InnoDB Partition handler: the interface between MySQL and InnoDB. */ 20  21 #ifndef ha_innopart_h 22 #define ha_innopart_h 23  24 #include " partitioning/partition_handler.h " 25  26 /* Forward declarations */ 27 class Altered_partitions ; 28 class partition_info ; 29  30 /** HA_DUPLICATE_POS and HA_READ_BEFORE_WRITE_REMOVAL is not 31 set from ha_innobase, but cannot yet be supported in ha_innopart. 32 Full text and geometry is not yet supported. */ 33  const handler::Table_flags HA_INNOPART_DISABLED_TABLE_FLAGS = 34  ( HA_CAN_FULLTEXT 35  | HA_CAN_FULLTEXT_EXT 36  | HA_CAN_GEOMETRY 37  | HA_DUPLICATE_POS 38  | HA_READ_BEFORE_WRITE_REMOVAL ); 39  40 /** InnoDB partition specific Handler_share. */ 41  class Ha_innopart_share : public Partition_share 42 { 43 private: 44  /** Array of all included table definitions (one per partition). */ 45   dict_table_t ** m_table_parts ; 46  47  /** Instead of INNOBASE_SHARE::idx_trans_tbl. Maps MySQL index number 48  to InnoDB index per partition. */ 49   dict_index_t ** m_index_mapping ; 50  51  /** Total number of partitions. */ 52   uint m_tot_parts ; 53  54  /** Number of indexes. */ 55   uint m_index_count ; 56  57  /** Reference count. */ 58   uint m_ref_count ; 59  60  /** Pointer back to owning TABLE_SHARE. */ 61   TABLE_SHARE * m_table_share ; 62  63 public: 64  Ha_innopart_share ( 65  TABLE_SHARE * table_share); 66  67  ~Ha_innopart_share (); 68  69  /** Set innodb table for given partition. 70  @param[in] part_id Partition number. 71  @param[in] table Table. */ 72  inline 73  void 74   set_table_part ( 75  uint part_id, 76  dict_table_t * table) 77  { 78  ut_ad (m_table_parts != NULL); 79  ut_ad (part_id < m_tot_parts); 80  m_table_parts[part_id] = table; 81  } 82  83  /** Return innodb table for given partition. 84  @param[in] part_id Partition number. 85  @return InnoDB table. */ 86  inline 87  dict_table_t * 88   get_table_part ( 89  uint part_id) const 90  { 91  ut_ad (m_table_parts != NULL); 92  ut_ad (part_id < m_tot_parts); 93  return(m_table_parts[part_id]); 94  } 95  96  /** Return innodb index for given partition and key number. 97  @param[in] part_id Partition number. 98  @param[in] keynr Key number. 99  @return InnoDB index. */ 100  dict_index_t * 101  get_index ( 102  uint part_id, 103  uint keynr); 104  105  /** Get MySQL key number corresponding to InnoDB index. 106  @param[in] part_id Partition number. 107  @param[in] index InnoDB index. 108  @return MySQL key number or MAX_KEY if non-existent. */ 109  uint 110  get_mysql_key ( 111  uint part_id, 112  const dict_index_t * index ); 113  114  /** Initialize the share with table and indexes per partition. 115  @param[in] part_info Partition info (partition names to use) 116  @param[in] table_name Table name (db/table_name) 117  @return false on success else true. */ 118  bool 119  open_table_parts ( 120  partition_info * part_info, 121  const char* table_name ); 122  123  /** Close the table partitions. 124  If all instances are closed, also release the resources. */ 125  void 126  close_table_parts (); 127  128  /* Static helper functions. */ 129  /** Fold to lower case if windows or lower_case_table_names == 1. 130  @param[in,out] s String to fold.*/ 131  static 132  void 133  partition_name_casedn_str ( 134  char* s); 135  136  /** Translate and append partition name. 137  @param[out] to String to write in filesystem charset 138  @param[in] from Name in system charset 139  @param[in] sep Separator 140  @param[in] len Max length of to buffer 141  @return length of written string. */ 142  static 143  size_t 144  append_sep_and_name ( 145  char* to, 146  const char* from, 147  const char* sep, 148  size_t len); 149  150  /** Set up the virtual column template for partition table, and points 151  all m_table_parts[]->vc_templ to it. 152  @param[in] table MySQL TABLE ob