Abstract
This section describes the PartitionSpec
structure.
Parent class. Ndb
Description.
PartitionSpec
is a structure available in MySQL
Cluster NDB 6.3.24 and later, and used for describing a table
partition in terms of any one of the following:
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.
(MySQL Cluster NDB 7.0.4 and later:) 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. |
(MySQL Cluster NDB 7.0.4 and later:)
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 |
const Key_part_ptr* (see
Section 2.3.30, “The Key_part_ptr Structure”) |
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.
(MySQL Cluster NDB 7.0.4 and later:) This
structure is used when the SpecType
is
PS_DISTR_KEY_RECORD
.
Attribute | Type | Description |
---|---|---|
keyRecord |
const NdbRecord* (see
Section 2.3.25, “The NdbRecord Interface”) |
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 /* MySQL Cluster NDB 7.0.4 and later: */ , PS_DISTR_KEY_RECORD = 3 }; Uint32 type; union { struct { Uint32 partitionId; } UserDefined; struct { const Key_part_ptr* tableKeyParts; void* xfrmbuf; Uint32 xfrmbuflen; } KeyPartPtr; /* MySQL Cluster NDB 7.0.4 and later: */ struct { const NdbRecord* keyRecord; const char* keyRow; void* xfrmbuf; Uint32 xfrmbuflen; } KeyRecord; }; };