Documentation Home
MySQL Cluster API Developer Guide
Download this Manual
PDF (US Ltr) - 4.8Mb
PDF (A4) - 4.8Mb
EPUB - 1.9Mb
HTML Download (TGZ) - 1.8Mb
HTML Download (Zip) - 1.9Mb


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:

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.

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.

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.

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
Sign Up Login You must be logged in to post a comment.