Documentation Home
MySQL NDB Cluster API Developer Guide
Download this Manual

2.3.33 The PartitionSpec Structure

Abstract

This section describes the PartitionSpec structure.

Parent class.  Ndb

Description.  A PartitionSpec is used for describing a table partition in terms of any one of the following criteria:

  • A specific partition ID for a table with user-defined partitioning.

  • An array made up of a table's distribution key values for a table with native partitioning.

  • A row in NdbRecord format containing a natively partitioned table's distribution key values.

Attributes.  A PartitionSpec has two attributes, a SpecType and a Spec which is a data structure corresponding to that SpecType, as shown in the following table:

Table 2.75 PartitionSpec attributes with the SpecType values, data structures, and descriptions for each attribute.

SpecType Enumeration SpecType Value (Uint32) Data Structure Description
PS_NONE 0 none No partitioning information is provided.
PS_USER_DEFINED 1 UserDefined For a table having user-defined partitioning, a specific partition is identified by its partition ID.
PS_DISTR_KEY_PART_PTR 2 KeyPartPtr For a table having native partitioning, an array containing the table's distribution key values is used to identify the partition.
PS_DISTR_KEY_RECORD 3 KeyRecord The partition is identified using a natively partitioned table's distribution key values, as contained in a row given in NdbRecord format.

UserDefined structure.  This structure is used when the SpecType is PS_USER_DEFINED.

Table 2.76 Attribute types of the partitionId attribute of the PS_USER_DEFINED SpecType

Attribute Type Description
partitionId Uint32 The partition ID for the desired table.

KeyPartPtr structure.  This structure is used when the SpecType is PS_DISTR_KEY_PART_PTR.

Table 2.77 Attributes of the PS_DISTR_KEY_PART_PTR SpecType, with attribute types and descriptions

Attribute Type Description
tableKeyParts Key_part_ptr Pointer to the distribution key values for a table having native partitioning.
xfrmbuf void* Pointer to a temporary buffer used for performing calculations.
xfrmbuflen Uint32 Length of the temporary buffer.

KeyRecord structure.  This structure is used when the SpecType is PS_DISTR_KEY_RECORD.

Table 2.78 PS_DISTR_KEY_RECORD SpecType attributes, with attribute types and descriptions

Attribute Type Description
keyRecord NdbRecord A row in NdbRecord format, containing a table's distribution keys.
keyRow const char* The distribution key data.
xfrmbuf void* Pointer to a temporary buffer used for performing calculations.
xfrmbuflen Uint32 Length of the temporary buffer.

Definition from Ndb.hpp Because this is a fairly complex structure, we here provide the original source-code definition of PartitionSpec, as given in storage/ndb/include/ndbapi/Ndb.hpp:

struct PartitionSpec
{
  enum SpecType
  {
    PS_NONE                = 0,
    PS_USER_DEFINED        = 1,
    PS_DISTR_KEY_PART_PTR  = 2,
    PS_DISTR_KEY_RECORD    = 3
  };

  Uint32 type;

  union
  {
    struct {
      Uint32 partitionId;
    } UserDefined;

    struct {
      const Key_part_ptr* tableKeyParts;
      void* xfrmbuf;
      Uint32 xfrmbuflen;
    } KeyPartPtr;

    struct {
      const NdbRecord* keyRecord;
      const char* keyRow;
      void* xfrmbuf;
      Uint32 xfrmbuflen;
    } KeyRecord;
  };
};

User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
Sign Up Login You must be logged in to post a comment.