ChangeSet
1.2037 05/10/07 20:33:28 mron...@mysql.com +7 -0
Review stuff, fixes on TODO list
sql/sql_table.cc
1.245 05/10/07 20:32:57 mron...@mysql.com +4 -0
Review stuff, fixes on TODO list
sql/sql_partition.cc
1.25 05/10/07 20:32:57 mron...@mysql.com +228 -80
Review stuff, fixes on TODO list
sql/handler.h
1.159 05/10/07 20:32:57 mron...@mysql.com +8 -3
Review stuff, fixes on TODO list
sql/ha_partition.h
1.12 05/10/07 20:32:57 mron...@mysql.com +5 -3
Review stuff, fixes on TODO list
sql/ha_partition.cc
1.15 05/10/07 20:32:57 mron...@mysql.com +18 -5
Review stuff, fixes on TODO list
sql/ha_ndbcluster.h
1.85 05/10/07 20:32:56 mron...@mysql.com +2 -1
Review stuff, fixes on TODO list
sql/ha_ndbcluster.cc
1.164 05/10/07 20:32:56 mron...@mysql.com +50 -4
Review stuff, fixes on TODO list
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: mronstrom
# Host: c-a309e253.1238-1-64736c10.cust.bredbandsbolaget.se
# Root: /Users/mikron/wl2498
--- 1.158/sql/handler.h 2005-10-07 05:45:14 +02:00
+++ 1.159/sql/handler.h 2005-10-07 20:32:57 +02:00
@@ -105,9 +105,9 @@
#define HA_KEYREAD_ONLY 64 /* Support HA_EXTRA_KEYREAD */
/* bits in alter_table_flags */
-#define HA_ONLINE_CHANGE_PARTITION 0x00000001
+#define HA_FAST_CHANGE_PARTITION 0x00000001
#define HA_ONLINE_DOUBLE_WRITE 0x00000002
-#define HA_ONLINE_PARTITION_ONE_PHASE 0x00000004
+#define HA_PARTITION_ONE_PHASE 0x00000004
/* operations for disable/enable indexes */
#define HA_KEY_SWITCH_NONUNIQ 0
@@ -1299,7 +1299,12 @@
virtual ulong partition_flags(void) const { return 0;}
virtual int get_default_no_partitions(ulonglong max_rows) { return 1;}
virtual void set_auto_partitions(partition_info *part_info) { return; }
- virtual uint get_no_parts() { return 0; }
+ virtual bool get_no_parts(const char *table_name, const char *db_name,
+ uint *no_parts)
+ {
+ *no_parts= 0;
+ return 0;
+ }
#endif
virtual ulong index_flags(uint idx, uint part, bool all_parts) const =0;
virtual ulong index_ddl_flags(KEY *wanted_index) const
--- 1.244/sql/sql_table.cc 2005-10-06 09:42:19 +02:00
+++ 1.245/sql/sql_table.cc 2005-10-07 20:32:57 +02:00
@@ -87,9 +87,11 @@
frm file
create_handler_files If set we need to create the handler file as part
of the creation of the frm file
+
RETURN VALUES
TRUE Error
FALSE Success
+
DESCRIPTION
A support method that creates a new frm file and in this process it
regenerates the partition data.
@@ -184,8 +186,10 @@
write_bin_log()
thd Thread object
clear_error is clear_error to be called
+
RETURN VALUES
NONE
+
DESCRIPTION
Write the binlog if open, routine used in multiple places in this
file
--- 1.163/sql/ha_ndbcluster.cc 2005-10-06 06:36:44 +02:00
+++ 1.164/sql/ha_ndbcluster.cc 2005-10-07 20:32:56 +02:00
@@ -7888,6 +7888,7 @@
return COMPATIBLE_DATA_YES;
}
+
/*
Method that sends off the request to perform the ALTER TABLE * PARTITIONS
changes. The cluster takes care of the whole implementation of this
@@ -7909,9 +7910,11 @@
pack_frm_data Reference to a blob containing the
packed frm file
pack_frm_len Length of packed frm file
+
RETURN VALUES
0 Success
>0 Error code
+
DESCRIPTION
The grunt of the work is performed by handle_change_partitions, an
internal method that also is used by optimize_partitions and optimize.
@@ -7925,18 +7928,22 @@
uint pack_frm_len)
{
DBUG_ENTER("ha_ndbcluster::change_partitions");
+
(void)create_info; (void)path; (void)copied; (void)deleted;
DBUG_RETURN(handle_change_partitions(pack_frm_data, pack_frm_len, FALSE));
}
+
/*
SYNOPSIS
optimize()
- THD Thread object
+ thd Thread object
check_opt Options for optimize
+
RETURN VALUES
TRUE Failure
FALSE Success
+
DESCRIPTION
Optimises use of storage and so forth by rebuilding all partitions.
*/
@@ -7944,6 +7951,7 @@
int ha_ndbcluster::optimize(THD *thd, HA_CHECK_OPT *check_opt)
{
DBUG_ENTER("ha_ndbcluster::optimize");
+
(void)thd; (void)check_opt;
DBUG_RETURN(handle_change_partitions(NULL, 0, TRUE));
}
@@ -7951,10 +7959,12 @@
/*
SYNOPSIS
optimize()
- THD Thread object
+ thd Thread object
+
RETURN VALUES
TRUE Failure
FALSE Success
+
DESCRIPTION
Optimises use of storage and so forth by rebuilding partitions as stated
in command.
@@ -7963,10 +7973,12 @@
int ha_ndbcluster::optimize_partitions(THD *thd)
{
DBUG_ENTER("ha_ndbcluster::optimize_partitions");
+
(void)thd;
DBUG_RETURN(handle_change_partitions(NULL, 0, FALSE));
}
+
int ha_ndbcluster::handle_change_partitions(const void *pack_frm_data,
uint pack_frm_len,
bool all_parts)
@@ -8022,8 +8034,42 @@
DBUG_RETURN(0);
}
-uint ha_ndbcluster::get_no_parts()
+
+bool ha_ndbcluster::get_no_parts(const char *table_name, const char *db_name,
+ uint *no_parts)
{
- return 2;
+ Ndb *ndb;
+ NDBDICT *dict;
+ NDBTAB *tab;
+ int err;
+ DBUG_ENTER("ha_ndbcluster::get_no_parts");
+
+ strmov(m_dbname, db_name);
+ strmov(m_tabname, table_name);
+ do
+ {
+ if (check_ndb_connection())
+ {
+ err= HA_ERR_NO_CONNECTION;
+ break;
+ }
+ ndb= get_ndb();
+ dict= ndb->getDictionary();
+ if (!(tab= dict->getTable(m_tabname)))
+ ERR_BREAK(dict->getNdbError(), err);
+ // Check if thread has stale local cache
+ if (tab->getObjectStatus() == NdbDictionary::Object::Invalid)
+ {
+ invalidate_dictionary_cache(FALSE);
+ if (!(tab= dict->getTable(m_tabname)))
+ ERR_BREAK(dict->getNdbError(), err);
+ }
+ *no_parts= tab->getFragmentCount();
+ DBUG_RETURN(FALSE);
+ } while (1);
+
+end:
+ print_error(err, MYF(0));
+ DBUG_RETURN(TRUE);
}
#endif /* HAVE_NDBCLUSTER_DB */
--- 1.84/sql/ha_ndbcluster.h 2005-10-04 17:51:03 +02:00
+++ 1.85/sql/ha_ndbcluster.h 2005-10-07 20:32:56 +02:00
@@ -534,7 +534,8 @@
int delete_table(const char *name);
int create(const char *name, TABLE *form, HA_CREATE_INFO *info);
int get_default_no_partitions(ulonglong max_rows);
- uint get_no_parts();
+ bool get_no_parts(const char *table_name, const char *db_name,
+ uint *no_parts);
void set_auto_partitions(partition_info *part_info);
int change_partitions(HA_CREATE_INFO *create_info,
const char *path,
--- 1.14/sql/ha_partition.cc 2005-10-07 05:45:14 +02:00
+++ 1.15/sql/ha_partition.cc 2005-10-07 20:32:57 +02:00
@@ -499,6 +499,7 @@
DBUG_RETURN(error);
}
+
int ha_partition::rename_partitions(const char *path)
{
List_iterator<partition_element> part_it(m_part_info->partitions);
@@ -576,6 +577,7 @@
DBUG_RETURN(error);
}
+
#define OPTIMIZE_PARTS 1
#define ANALYZE_PARTS 2
#define CHECK_PARTS 3
@@ -588,6 +590,7 @@
OPTIMIZE_PARTS, TRUE));
}
+
int ha_partition::analyze(THD *thd, HA_CHECK_OPT *check_opt)
{
DBUG_ENTER("ha_partition::analyze");
@@ -1008,6 +1011,7 @@
actually copy the data from the reorganised partitions to the new
partitions.
*/
+
int ha_partition::copy_partitions(ulonglong *copied, ulonglong *deleted)
{
uint reorg_part= 0;
@@ -1073,7 +1077,7 @@
char *ha_partition::update_table_comment(const char *comment)
{
- return (char*) comment; // Nothing to change
+ return (char*) comment; /* Nothing to change */
}
@@ -1475,6 +1479,7 @@
DBUG_RETURN(TRUE);
}
+
/****************************************************************************
MODULE open/close object
****************************************************************************/
@@ -1574,10 +1579,8 @@
DBUG_RETURN(error);
}
-/*
- Closes a table. We call the free_share() function to free any resources
- that we have allocated in the "shared" structure.
+/*
Called from sql_base.cc, sql_select.cc, and table.cc.
In sql_select.cc it is only used to close up temporary tables or during
the process where a temporary table is converted over to being a
@@ -1949,6 +1952,7 @@
DBUG_RETURN(0);
}
+
/*
rows == 0 means we will probably insert many rows
*/
@@ -1989,6 +1993,7 @@
DBUG_RETURN(error);
}
+
/****************************************************************************
MODULE full table scan
****************************************************************************/
@@ -2199,6 +2204,7 @@
{
handler *file= m_file[m_last_part];
DBUG_ENTER("ha_partition::position");
+
file->position(record);
store_part_id_in_pos(ref, m_last_part);
memcpy((ref + PARTITION_BYTES_IN_POS), file->ref,
@@ -2415,6 +2421,7 @@
DBUG_RETURN(common_first_last(buf));
}
+
int ha_partition::common_first_last(byte *buf)
{
int error;
@@ -2425,6 +2432,7 @@
return handle_ordered_index_scan(buf);
}
+
/*
Positions an index cursor to the index specified in key. Fetches the
row if any. This is only used to read whole keys.
@@ -2443,6 +2451,7 @@
DBUG_RETURN(res);
}
+
/*
This is used in join_read_last_key to optimise away an ORDER BY.
Can only be used on indexes supporting HA_READ_ORDER
@@ -2492,6 +2501,7 @@
DBUG_RETURN(handle_ordered_next(buf, TRUE));
}
+
/*
Used to read backwards through the index.
*/
@@ -3527,6 +3537,7 @@
DBUG_RETURN(m_file[0]->keys_to_use_for_scanning());
}
+
double ha_partition::scan_time()
{
double scan_time= 0;
@@ -3597,6 +3608,7 @@
DBUG_RETURN(tot_rows);
}
+
bool ha_partition::can_switch_engines()
{
handler **file;
@@ -3749,6 +3761,7 @@
my_ptrdiff_t diff1, diff2;
handler *file;
DBUG_ENTER("ha_partition::cmp_ref");
+
if ((ref1[0] == ref2[0]) && (ref1[1] == ref2[1]))
{
part_id= get_part_id_from_pos(ref1);
@@ -3831,6 +3844,7 @@
/*
Function we use in the creation of our hash to get key.
*/
+
static byte *partition_get_key(PARTITION_SHARE *share, uint *length,
my_bool not_used __attribute__ ((unused)))
{
@@ -3844,7 +3858,6 @@
Well, you have pieces that are used for locking, and they are needed to
function.
*/
-
static PARTITION_SHARE *get_share(const char *table_name, TABLE *table)
{
--- 1.11/sql/ha_partition.h 2005-10-06 09:42:18 +02:00
+++ 1.12/sql/ha_partition.h 2005-10-07 20:32:57 +02:00
@@ -180,10 +180,12 @@
uint pack_frm_len);
virtual int drop_partitions(const char *path);
virtual int rename_partitions(const char *path);
- uint get_no_parts()
+ bool get_no_parts(const char *table_name, const char *db_name,
+ uint *no_parts)
{
DBUG_ENTER("ha_partition::get_no_parts");
- DBUG_RETURN(m_tot_parts);
+ *no_parts= m_tot_parts;
+ DBUG_RETURN(0);
}
private:
int copy_partitions(ulonglong *copied, ulonglong *deleted);
@@ -658,7 +660,7 @@
*/
virtual ulong alter_table_flags(void) const
{
- return HA_ONLINE_CHANGE_PARTITION;
+ return HA_FAST_CHANGE_PARTITION;
}
virtual ulong table_flags() const
{ return m_table_flags; }
--- 1.24/sql/sql_partition.cc 2005-10-07 05:45:15 +02:00
+++ 1.25/sql/sql_partition.cc 2005-10-07 20:32:57 +02:00
@@ -94,12 +94,15 @@
/*
A routine used by the parser to decide whether we are specifying a full
partitioning or if only partitions to add or to split.
+
SYNOPSIS
is_partition_management()
lex Reference to the lex object
+
RETURN VALUE
TRUE Yes, it is part of a management partition command
FALSE No, not a management partition command
+
DESCRIPTION
This needs to be outside of HAVE_PARTITION_DB since it is used from the
sql parser that doesn't have any #ifdef's
@@ -112,13 +115,16 @@
lex->alter_info.flags == ALTER_REORGANIZE_PARTITION));
}
+
#ifdef HAVE_PARTITION_DB
/*
A support function to check if a partition name is in a list of strings
+
SYNOPSIS
is_partition_in_list()
part_name String searched for
list_part_names A list of names searched in
+
RETURN VALUES
TRUE String found
FALSE String not found
@@ -130,6 +136,7 @@
List_iterator<char> part_names_it(list_part_names);
uint no_names= list_part_names.elements;
uint i= 0;
+
do
{
char *list_name= part_names_it++;
@@ -143,13 +150,16 @@
/*
A support function to check partition names for duplication in a
partitioned table
+
SYNOPSIS
is_partitions_in_table()
new_part_info New partition info
old_part_info Old partition info
+
RETURN VALUES
TRUE Duplicate names found
FALSE Duplicate names not found
+
DESCRIPTION
Can handle that the new and old parts are the same in which case it
checks that the list of names in the partitions doesn't contain any
@@ -164,7 +174,7 @@
List_iterator<partition_element> new_parts_it(new_part_info->partitions);
bool same_part_info= (new_part_info == old_part_info);
DBUG_ENTER("is_partitions_in_table");
- DBUG_PRINT("info", ("%u", no_new_parts));
+ DBUG_PRINT("enter", ("%u", no_new_parts));
new_count= 0;
do
@@ -194,6 +204,7 @@
/*
A useful routine used by update_row for partition handlers to calculate
the partition ids of the old and the new record.
+
SYNOPSIS
get_part_for_update()
old_data Buffer of old record
@@ -203,10 +214,12 @@
part_field_array A NULL-terminated array of fields for partition
function
old_part_id The returned partition id of old record
- new_part_id The returned partition id of new record
+ new_part_id The returned partition id of new record
+
RETURN VALUE
0 Success
> 0 Error code
+
DESCRIPTION
Dependent on whether buf is not record[0] we need to prepare the
fields. Then we call the function pointer get_partition_id to
@@ -220,8 +233,8 @@
Field **part_field_array= part_info->full_part_field_array;
int error;
DBUG_ENTER("get_parts_for_update");
- DBUG_ASSERT(new_data == rec0);
+ DBUG_ASSERT(new_data == rec0);
set_field_ptr(part_field_array, old_data, rec0);
error= part_info->get_partition_id(part_info, old_part_id);
set_field_ptr(part_field_array, rec0, old_data);
@@ -263,6 +276,7 @@
/*
A useful routine used by delete_row for partition handlers to calculate
the partition id.
+
SYNOPSIS
get_part_for_delete()
buf Buffer of old record
@@ -271,9 +285,11 @@
part_field_array A NULL-terminated array of fields for partition
function
part_id The returned partition id to delete from
+
RETURN VALUE
0 Success
> 0 Error code
+
DESCRIPTION
Dependent on whether buf is not record[0] we need to prepare the
fields. Then we call the function pointer get_partition_id to
@@ -315,12 +331,15 @@
check what partition a certain value belongs to. At the same time it does
also check that the range constants are defined in increasing order and
that the expressions are constant integer expressions.
+
SYNOPSIS
check_range_constants()
- part_info
+ part_info Partition info
+
RETURN VALUE
TRUE An error occurred during creation of range constants
FALSE Successful creation of range constant mapping
+
DESCRIPTION
This routine is called from check_partition_info to get a quick error
before we came too far into the CREATE TABLE process. It is also called
@@ -374,10 +393,12 @@
/*
A support routine for check_list_constants used by qsort to sort the
constant list expressions.
+
SYNOPSIS
list_part_cmp()
a First list constant to compare with
b Second list constant to compare with
+
RETURN VALUE
+1 a > b
0 a == b
@@ -403,12 +424,15 @@
check what partition a certain value belongs to. At the same time it does
also check that there are no duplicates among the list constants and that
that the list expressions are constant integer expressions.
+
SYNOPSIS
check_list_constants()
- part_info
+ part_info Partition info
+
RETURN VALUE
TRUE An error occurred during creation of list constants
FALSE Successful creation of list constant mapping
+
DESCRIPTION
This routine is called from check_partition_info to get a quick error
before we came too far into the CREATE TABLE process. It is also called
@@ -502,12 +526,15 @@
/*
Create a memory area where default partition names are stored and fill it
up with the names.
+
SYNOPSIS
create_default_partition_names()
no_parts Number of partitions
subpart Is it subpartitions
+
RETURN VALUE
A pointer to the memory area of the default partition names
+
DESCRIPTION
A support routine for the partition code where default values are
generated.
@@ -546,14 +573,17 @@
Set up all the default partitions not set-up by the user in the SQL
statement. Also perform a number of checks that the user hasn't tried
to use default values where no defaults exists.
+
SYNOPSIS
set_up_default_partitions()
part_info The reference to all partition information
file A reference to a handler of the table
max_rows Maximum number of rows stored in the table
+
RETURN VALUE
TRUE Error, attempted default values not possible
FALSE Ok, default partitions set-up
+
DESCRIPTION
The routine uses the underlying handler of the partitioning to define
the default number of partitions. For some handlers this requires
@@ -621,14 +651,17 @@
Set up all the default subpartitions not set-up by the user in the SQL
statement. Also perform a number of checks that the default partitioning
becomes an allowed partitioning scheme.
+
SYNOPSIS
set_up_default_subpartitions()
part_info The reference to all partition information
file A reference to a handler of the table
max_rows Maximum number of rows stored in the table
+
RETURN VALUE
TRUE Error, attempted default values not possible
FALSE Ok, default partitions set-up
+
DESCRIPTION
The routine uses the underlying handler of the partitioning to define
the default number of partitions. For some handlers this requires
@@ -692,14 +725,17 @@
/*
Set up defaults for partition or subpartition (cannot set-up for both,
this will return an error.
+
SYNOPSIS
set_up_defaults_for_partitioning()
part_info The reference to all partition information
file A reference to a handler of the table
max_rows Maximum number of rows stored in the table
+
RETURN VALUE
TRUE Error, attempted default values not possible
FALSE Ok, default partitions set-up
+
DESCRIPTION
Support routine for check_partition_info
*/
@@ -726,10 +762,12 @@
/*
Check that all partitions use the same storage engine.
This is currently a limitation in this version.
+
SYNOPSIS
check_engine_mix()
engine_array An array of engine identifiers
no_parts Total number of partitions
+
RETURN VALUE
TRUE Error, mixed engines
FALSE Ok, no mixed engines
@@ -762,6 +800,7 @@
this version. This routine is an extension of the parser one could say.
If defaults were used we will generate default data structures for all
partitions.
+
SYNOPSIS
check_partition_info()
part_info The reference to all partition information
@@ -769,9 +808,11 @@
partition.
file A reference to a handler of the table
max_rows Maximum number of rows stored in the table
+
RETURN VALUE
TRUE Error, something went wrong
FALSE Ok, full partition data structures are now generated
+
DESCRIPTION
This code is used early in the CREATE TABLE and ALTER TABLE process.
*/
@@ -878,30 +919,30 @@
This is actually the place where most of the things are checked for
partition information when creating a table.
Things that are checked includes
- 1) No NULLable fields in partition function
- 2) All fields of partition function in Primary keys and unique indexes
+ 1) All fields of partition function in Primary keys and unique indexes
(if not supported)
- 3) No fields in partition function that are BLOB's or VARCHAR with a
- collation other than the binary collation.
-
Create an array of partition fields (NULL terminated). Before this method
is called fix_fields or find_table_in_sef has been called to set
GET_FIXED_FIELDS_FLAG on all fields that are part of the partition
function.
+
SYNOPSIS
set_up_field_array()
table TABLE object for which partition fields are set-up
sub_part Is the table subpartitioned as well
+
RETURN VALUE
TRUE Error, some field didn't meet requirements
FALSE Ok, partition field array set-up
+
DESCRIPTION
This method is used to set-up both partition and subpartitioning
field array and used for all types of partitioning.
It is part of the logic around fix_partition_func.
*/
+
static bool set_up_field_array(TABLE *table,
bool sub_part)
{
@@ -977,13 +1018,16 @@
/*
Create a field array including all fields of both the partitioning and the
subpartitioning functions.
+
SYNOPSIS
create_full_part_field_array()
table TABLE object for which partition fields are set-up
part_info Reference to partitioning data structure
+
RETURN VALUE
TRUE Memory allocation of field array failed
FALSE Ok
+
DESCRIPTION
If there is no subpartitioning then the same array is used as for the
partitioning. Otherwise a new array is built up using the flag
@@ -1046,9 +1090,9 @@
derive which partitions are needed to scan.
-
Clear flag GET_FIXED_FIELDS_FLAG in all fields of a key previously set by
set_indicator_in_key_fields (always used in pairs).
+
SYNOPSIS
clear_indicator_in_key_fields()
key_info Reference to find the key fields
@@ -1065,6 +1109,7 @@
/*
Set flag GET_FIXED_FIELDS_FLAG in all fields of a key.
+
SYNOPSIS
set_indicator_in_key_fields
key_info Reference to find the key fields
@@ -1082,11 +1127,13 @@
/*
Check if all or some fields in partition field array is part of a key
previously used to tag key fields.
+
SYNOPSIS
check_fields_in_PF()
ptr Partition field array
all_fields Is all fields of partition field array used in key
some_fields Is some fields of partition field array used in key
+
RETURN VALUE
all_fields, some_fields
*/
@@ -1112,6 +1159,7 @@
/*
Clear flag GET_FIXED_FIELDS_FLAG in all fields of the table.
This routine is used for error handling purposes.
+
SYNOPSIS
clear_field_flag()
table TABLE object for which partition fields are set-up
@@ -1132,15 +1180,18 @@
This routine sets-up the partition field array for KEY partitioning, it
also verifies that all fields in the list of fields is actually a part of
the table.
+
SYNOPSIS
handle_list_of_fields()
it A list of field names for the partition function
table TABLE object for which partition fields are set-up
part_info Reference to partitioning data structure
sub_part Is the table subpartitioned as well
+
RETURN VALUE
TRUE Fields in list of fields not part of table
FALSE All fields ok and array created
+
DESCRIPTION
find_field_in_table_sef finds the field given its name. All fields get
GET_FIXED_FIELDS_FLAG set.
@@ -1219,6 +1270,7 @@
table. This is checked first in the parser that the function doesn't
contain non-cacheable parts (like a random function) and by checking
here that the function isn't a constant function.
+
SYNOPSIS
fix_fields_part_func()
thd The thread object
@@ -1226,10 +1278,12 @@
func_expr The item tree reference of the partition function
part_info Reference to partitioning data structure
sub_part Is the table subpartitioned as well
+
RETURN VALUE
TRUE An error occurred, something was wrong with the
partition function.
FALSE Ok, a partition field array was created
+
DESCRIPTION
The function uses a new feature in fix_fields where the flag
GET_FIXED_FIELDS_FLAG is set for all fields in the item tree.
@@ -1297,9 +1351,11 @@
all the fields of the partition function.
This is a temporary limitation that will hopefully be removed after a
while.
+
SYNOPSIS
check_primary_key()
table TABLE object for which partition fields are set-up
+
RETURN VALUES
TRUE Not all fields in partitioning function was part
of primary key
@@ -1334,9 +1390,11 @@
all the fields of the partition function.
This is a temporary limitation that will hopefully be removed after a
while.
+
SYNOPSIS
check_unique_keys()
table TABLE object for which partition fields are set-up
+
RETURN VALUES
TRUE Not all fields in partitioning function was part
of all unique keys
@@ -1412,9 +1470,11 @@
indicating this to notify that we can use also ranges on the field
of the PF to deduce a set of partitions if the fields of the PF were
not all fully bound.
+
SYNOPSIS
check_range_capable_PF()
table TABLE object for which partition fields are set-up
+
DESCRIPTION
Support for this is not implemented yet.
*/
@@ -1428,12 +1488,15 @@
/*
Set up partition key maps
+
SYNOPSIS
set_up_partition_key_maps()
table TABLE object for which partition fields are set-up
part_info Reference to partitioning data structure
+
RETURN VALUES
None
+
DESCRIPTION
This function sets up a couple of key maps to be able to quickly check
if an index ever can be used to deduce the partition fields or even
@@ -1489,6 +1552,7 @@
subpartition id and the upper part in subpartitioning. This is to speed up
execution of get_partition_id which is executed once every record to be
written and deleted and twice for updates.
+
SYNOPSIS
set_up_partition_function_pointers()
part_info Reference to partitioning data structure
@@ -1528,7 +1592,7 @@
}
}
}
- else //LIST Partitioning
+ else /* LIST Partitioning */
{
part_info->get_part_partition_id= get_partition_id_list;
if (part_info->list_of_subpart_fields)
@@ -1559,7 +1623,7 @@
}
}
}
- else //No subpartitioning
+ else /* No subpartitioning */
{
part_info->get_part_partition_id= NULL;
part_info->get_subpartition_id= NULL;
@@ -1567,7 +1631,7 @@
part_info->get_partition_id= get_partition_id_range;
else if (part_info->part_type == LIST_PARTITION)
part_info->get_partition_id= get_partition_id_list;
- else //HASH partitioning
+ else /* HASH partitioning */
{
if (part_info->list_of_part_fields)
{
@@ -1591,6 +1655,7 @@
/*
For linear hashing we need a mask which is on the form 2**n - 1 where
2**n >= no_parts. Thus if no_parts is 6 then mask is 2**3 - 1 = 8 - 1 = 7.
+
SYNOPSIS
set_linear_hash_mask()
part_info Reference to partitioning data structure
@@ -1609,13 +1674,16 @@
/*
This function calculates the partition id provided the result of the hash
function using linear hashing parameters, mask and number of partitions.
+
SYNOPSIS
get_part_id_from_linear_hash()
hash_value Hash value calculated by HASH function or KEY function
mask Mask calculated previously by set_linear_hash_mask
no_parts Number of partitions in HASH partitioned part
+
RETURN VALUE
part_id The calculated partition identity (starting at 0)
+
DESCRIPTION
The partition is calculated according to the theory of linear hashing.
See e.g. Linear hashing: a new tool for file and table addressing,
@@ -1641,14 +1709,17 @@
that errors due to erroneus syntax isn't found until we come here.
If the user has used a non-existing field in the table is one such example
of an error that is not discovered until here.
+
SYNOPSIS
fix_partition_func()
thd The thread object
name The name of the partitioned table
table TABLE object for which partition fields are set-up
+
RETURN VALUE
- TRUE
- FALSE
+ TRUE Error
+ FALSE Success
+
DESCRIPTION
The name parameter contains the full table name and is used to get the
database name of the table which is used to set-up a correct
@@ -1673,6 +1744,24 @@
DBUG_RETURN(FALSE);
}
thd->set_query_id= 0;
+ /*
+ Set-up the TABLE_LIST object to be a list with a single table
+ Set the object to zero to create NULL pointers and set alias
+ and real name to table name and get database name from file name.
+ */
+
+ bzero((void*)&tables, sizeof(TABLE_LIST));
+ tables.alias= tables.table_name= (char*)share->table_name;
+ tables.table= table;
+ tables.next_local= 0;
+ tables.next_name_resolution_table= 0;
+ strmov(db_name_string, name);
+ dir_length= dirname_length(db_name_string);
+ db_name_string[dir_length - 1]= 0;
+ home_dir_length= dirname_length(db_name_string);
+ db_name= &db_name_string[home_dir_length];
+ tables.db= db_name;
+
if (!create_table_ind)
{
/*
@@ -1680,44 +1769,28 @@
*/
if (part_info->use_default_no_partitions)
{
- part_info->no_parts= table->file->get_no_parts();
- if (!part_info->no_parts)
+ if (table->file->get_no_parts(share->table_name, db_name,
+ &part_info->no_parts))
{
- // No table available
+ DBUG_RETURN(TRUE);
}
}
else if (is_sub_partitioned(part_info) &&
part_info->use_default_no_subpartitions)
{
- uint no_parts= table->file->get_no_parts();
- part_info->no_subparts= no_parts / part_info->no_parts;
- if (!part_info->no_subparts)
+ uint no_parts;
+ if (table->file->get_no_parts(share->table_name, db_name,
+ &no_parts))
{
- // No table available
+ DBUG_RETURN(TRUE);
}
+ DBUG_ASSERT(part_info->no_parts > 0);
+ part_info->no_subparts= no_parts / part_info->no_parts;
DBUG_ASSERT((no_parts % part_info->no_parts) == 0);
}
set_up_defaults_for_partitioning(part_info, table->file,
(ulonglong)0, (uint)0);
}
- /*
- Set-up the TABLE_LIST object to be a list with a single table
- Set the object to zero to create NULL pointers and set alias
- and real name to table name and get database name from file name.
- */
-
- bzero((void*)&tables, sizeof(TABLE_LIST));
- tables.alias= tables.table_name= (char*)share->table_name;
- tables.table= table;
- tables.next_local= 0;
- tables.next_name_resolution_table= 0;
- strmov(db_name_string, name);
- dir_length= dirname_length(db_name_string);
- db_name_string[dir_length - 1]= 0;
- home_dir_length= dirname_length(db_name_string);
- db_name= &db_name_string[home_dir_length];
- tables.db= db_name;
-
if (is_sub_partitioned(part_info))
{
DBUG_ASSERT(part_info->subpart_type == HASH_PARTITION);
@@ -1970,38 +2043,35 @@
return err;
}
-static int add_part_state_string(File fptr)
-{
- return add_string(fptr, "PART_STATE = ");
-}
-
+static const char *PART_STATE_IS= "PART_STATE = ";
+
static int add_partition_state(File fptr, partition_element *p_elem)
{
int err= 0;
switch (p_elem->part_state)
{
case PART_TO_BE_DROPPED:
- err+= add_part_state_string(fptr);
+ err+= add_string(fptr, PART_STATE_IS);
err+= add_string(fptr, "PART_TO_BE_DROPPED");
break;
case PART_TO_BE_ADDED:
- err+= add_part_state_string(fptr);
+ err+= add_string(fptr, PART_STATE_IS);
err+= add_string(fptr, "PART_TO_BE_ADDED");
break;
case PART_TO_BE_REORGED:
- err+= add_part_state_string(fptr);
+ err+= add_string(fptr, PART_STATE_IS);
err+= add_string(fptr, "PART_TO_BE_REORGED");
break;
case PART_REORGED_DROPPED:
- err+= add_part_state_string(fptr);
+ err+= add_string(fptr, PART_STATE_IS);
err+= add_string(fptr, "PART_REORGED_DROPPED");
break;
case PART_CHANGED:
- err+= add_part_state_string(fptr);
+ err+= add_string(fptr, PART_STATE_IS);
err+= add_string(fptr, "PART_CHANGED");
break;
case PART_IS_CHANGED:
- err+= add_part_state_string(fptr);
+ err+= add_string(fptr, PART_STATE_IS);
err+= add_string(fptr, "PART_IS_CHANGED");
break;
case PART_IS_DROPPED:
@@ -2335,10 +2405,12 @@
/*
Check if partition key fields are modified and if it can be handled by the
underlying storage engine.
+
SYNOPSIS
partition_key_modified
table TABLE object for which partition fields are set-up
fields A list of the to be modifed
+
RETURN VALUES
TRUE Need special handling of UPDATE
FALSE Normal UPDATE handling is ok
@@ -2350,6 +2422,7 @@
partition_info *part_info= table->s->part_info;
Item_field *item_field;
DBUG_ENTER("partition_key_modified");
+
if (!part_info)
DBUG_RETURN(FALSE);
if (table->file->partition_flags() & HA_CAN_UPDATE_PARTITION_KEY)
@@ -2382,11 +2455,14 @@
/*
Calculate hash value for KEY partitioning using an array of fields.
+
SYNOPSIS
calculate_key_value()
field_array An array of the fields in KEY partitioning
+
RETURN VALUE
hash_value calculated
+
DESCRIPTION
Uses the hash function on the character set of the field. Integer and
floating point fields use the binary character set by default.
@@ -2396,6 +2472,7 @@
{
uint32 hashnr= 0;
ulong nr2= 4;
+
do
{
Field *field= *field_array;
@@ -2419,6 +2496,7 @@
/*
A simple support function to calculate part_id given local part and
sub part.
+
SYNOPSIS
get_part_id_for_sub()
loc_part_id Local partition id
@@ -2436,10 +2514,12 @@
/*
Calculate part_id for (SUB)PARTITION BY HASH
+
SYNOPSIS
get_part_id_hash()
no_parts Number of hash partitions
part_expr Item tree of hash function
+
RETURN VALUE
Calculated partition id
*/
@@ -2455,12 +2535,14 @@
/*
Calculate part_id for (SUB)PARTITION BY LINEAR HASH
+
SYNOPSIS
get_part_id_linear_hash()
part_info A reference to the partition_info struct where all the
desired information is given
no_parts Number of hash partitions
part_expr Item tree of hash function
+
RETURN VALUE
Calculated partition id
*/
@@ -2479,10 +2561,12 @@
/*
Calculate part_id for (SUB)PARTITION BY KEY
+
SYNOPSIS
get_part_id_key()
field_array Array of fields for PARTTION KEY
no_parts Number of KEY partitions
+
RETURN VALUE
Calculated partition id
*/
@@ -2498,12 +2582,14 @@
/*
Calculate part_id for (SUB)PARTITION BY LINEAR KEY
+
SYNOPSIS
get_part_id_linear_key()
part_info A reference to the partition_info struct where all the
desired information is given
field_array Array of fields for PARTTION KEY
no_parts Number of KEY partitions
+
RETURN VALUE
Calculated partition id
*/
@@ -2523,15 +2609,18 @@
This function is used to calculate the partition id where all partition
fields have been prepared to point to a record where the partition field
values are bound.
+
SYNOPSIS
get_partition_id()
part_info A reference to the partition_info struct where all the
desired information is given
part_id The partition id is returned through this pointer
+
RETURN VALUE
part_id
return TRUE means that the fields of the partition function didn't fit
into any partition and thus the values of the PF-fields are not allowed.
+
DESCRIPTION
A routine used from write_row, update_row and delete_row from any
handler supporting partitioning. It is also a support routine for
@@ -2561,15 +2650,18 @@
This function is used to calculate the main partition to use in the case of
subpartitioning and we don't know enough to get the partition identity in
total.
+
SYNOPSIS
get_part_partition_id()
part_info A reference to the partition_info struct where all the
desired information is given
part_id The partition id is returned through this pointer
+
RETURN VALUE
part_id
return TRUE means that the fields of the partition function didn't fit
into any partition and thus the values of the PF-fields are not allowed.
+
DESCRIPTION
It is actually 6 different variants of this function which are called
@@ -2587,12 +2679,13 @@
bool get_partition_id_list(partition_info *part_info,
uint32 *part_id)
{
- DBUG_ENTER("get_partition_id_list");
LIST_PART_ENTRY *list_array= part_info->list_array;
uint list_index;
longlong list_value;
uint min_list_index= 0, max_list_index= part_info->no_list_values - 1;
longlong part_func_value= part_info->part_expr->val_int();
+ DBUG_ENTER("get_partition_id_list");
+
while (max_list_index >= min_list_index)
{
list_index= (max_list_index + min_list_index) >> 1;
@@ -2614,11 +2707,12 @@
bool get_partition_id_range(partition_info *part_info,
uint32 *part_id)
{
- DBUG_ENTER("get_partition_id_int_range");
longlong *range_array= part_info->range_int_array;
uint max_partition= part_info->no_parts - 1;
uint min_part_id= 0, max_part_id= max_partition, loc_part_id;
longlong part_func_value= part_info->part_expr->val_int();
+ DBUG_ENTER("get_partition_id_int_range");
+
while (max_part_id > min_part_id)
{
loc_part_id= (max_part_id + min_part_id + 1) >> 1;
@@ -2680,6 +2774,7 @@
uint32 loc_part_id, sub_part_id;
uint no_subparts;
DBUG_ENTER("get_partition_id_range_sub_hash");
+
if (unlikely(get_partition_id_range(part_info, &loc_part_id)))
{
DBUG_RETURN(TRUE);
@@ -2697,6 +2792,7 @@
uint32 loc_part_id, sub_part_id;
uint no_subparts;
DBUG_ENTER("get_partition_id_range_sub_linear_hash");
+
if (unlikely(get_partition_id_range(part_info, &loc_part_id)))
{
DBUG_RETURN(TRUE);
@@ -2715,6 +2811,7 @@
uint32 loc_part_id, sub_part_id;
uint no_subparts;
DBUG_ENTER("get_partition_id_range_sub_key");
+
if (unlikely(get_partition_id_range(part_info, &loc_part_id)))
{
DBUG_RETURN(TRUE);
@@ -2732,6 +2829,7 @@
uint32 loc_part_id, sub_part_id;
uint no_subparts;
DBUG_ENTER("get_partition_id_range_sub_linear_key");
+
if (unlikely(get_partition_id_range(part_info, &loc_part_id)))
{
DBUG_RETURN(TRUE);
@@ -2751,6 +2849,7 @@
uint32 loc_part_id, sub_part_id;
uint no_subparts;
DBUG_ENTER("get_partition_id_list_sub_hash");
+
if (unlikely(get_partition_id_list(part_info, &loc_part_id)))
{
DBUG_RETURN(TRUE);
@@ -2768,6 +2867,7 @@
uint32 loc_part_id, sub_part_id;
uint no_subparts;
DBUG_ENTER("get_partition_id_list_sub_linear_hash");
+
if (unlikely(get_partition_id_list(part_info, &loc_part_id)))
{
DBUG_RETURN(TRUE);
@@ -2785,6 +2885,7 @@
uint32 loc_part_id, sub_part_id;
uint no_subparts;
DBUG_ENTER("get_partition_id_range_sub_key");
+
if (unlikely(get_partition_id_list(part_info, &loc_part_id)))
{
DBUG_RETURN(TRUE);
@@ -2802,6 +2903,7 @@
uint32 loc_part_id, sub_part_id;
uint no_subparts;
DBUG_ENTER("get_partition_id_list_sub_linear_key");
+
if (unlikely(get_partition_id_list(part_info, &loc_part_id)))
{
DBUG_RETURN(TRUE);
@@ -2817,13 +2919,15 @@
/*
This function is used to calculate the subpartition id
+
SYNOPSIS
get_subpartition_id()
part_info A reference to the partition_info struct where all the
desired information is given
+
RETURN VALUE
- part_id
- The subpartition identity
+ part_id The subpartition identity
+
DESCRIPTION
A routine used in some SELECT's when only partial knowledge of the
partitions is known.
@@ -2866,11 +2970,13 @@
/*
- Set an indicator on all partition fields that are set by the key
+ Set an indicator on all partition fields that are set by the key
+
SYNOPSIS
set_PF_fields_in_key()
key_info Information about the index
key_length Length of key
+
RETURN VALUE
TRUE Found partition field set by key
FALSE No partition field set by key
@@ -2911,9 +3017,11 @@
/*
We have found that at least one partition field was set by a key, now
check if a partition function has all its fields bound or not.
+
SYNOPSIS
check_part_func_bound()
ptr Array of fields NULL terminated (partition fields)
+
RETURN VALUE
TRUE All fields in partition function are set
FALSE Not all fields in partition function are set
@@ -2939,14 +3047,17 @@
/*
Get the id of the subpartitioning part by using the key buffer of the
index scan.
+
SYNOPSIS
get_sub_part_id_from_key()
table The table object
buf A buffer that can be used to evaluate the partition function
key_info The index object
key_spec A key_range containing key and key length
+
RETURN VALUES
part_id Subpartition id to use
+
DESCRIPTION
Use key buffer to set-up record in buf, move field pointers and
get the partition identity and restore field pointers afterwards.
@@ -2977,6 +3088,7 @@
/*
Get the id of the partitioning part by using the key buffer of the
index scan.
+
SYNOPSIS
get_part_id_from_key()
table The table object
@@ -2984,13 +3096,16 @@
key_info The index object
key_spec A key_range containing key and key length
part_id Partition to use
+
RETURN VALUES
TRUE Partition to use not found
FALSE Ok, part_id indicates partition to use
+
DESCRIPTION
Use key buffer to set-up record in buf, move field pointers and
get the partition identity and restore field pointers afterwards.
*/
+
bool get_part_id_from_key(const TABLE *table, byte *buf, KEY *key_info,
const key_range *key_spec, uint32 *part_id)
{
@@ -3015,6 +3130,7 @@
/*
Get the partitioning id of the full PF by using the key buffer of the
index scan.
+
SYNOPSIS
get_full_part_id_from_key()
table The table object
@@ -3022,6 +3138,7 @@
key_info The index object
key_spec A key_range containing key and key length
part_spec A partition id containing start part and end part
+
RETURN VALUES
part_spec
No partitions to scan is indicated by end_part > start_part when returning
@@ -3058,6 +3175,7 @@
/*
Get the set of partitions to use in query.
+
SYNOPSIS
get_partition_set()
table The table object
@@ -3066,6 +3184,7 @@
key_spec A key_range containing key and key length
part_spec Contains start part, end part and indicator if bitmap is
used for which partitions to scan
+
DESCRIPTION
This function is called to discover which partitions to use in an index
scan or a full table scan.
@@ -3075,6 +3194,7 @@
If start_part > end_part at return it means no partition needs to be
scanned. If start_part == end_part it always means a single partition
needs to be scanned.
+
RETURN VALUE
part_spec
*/
@@ -3247,15 +3367,18 @@
Read the partition syntax from the frm file and parse it to get the
data structures of the partitioning.
+
SYNOPSIS
mysql_unpack_partition()
file File reference of frm file
thd Thread object
part_info_len Length of partition syntax
table Table object of partitioned table
+
RETURN VALUE
TRUE Error
FALSE Sucess
+
DESCRIPTION
Read the partition syntax from the current position in the frm file.
Initiate a LEX object, save the list of item tree objects to free after
@@ -3277,6 +3400,7 @@
partition_info *part_info;
LEX *old_lex= thd->lex, lex;
DBUG_ENTER("mysql_unpack_partition");
+
if (read_string(file, (gptr*)&part_buf, part_info_len))
DBUG_RETURN(result);
thd->lex= &lex;
@@ -3299,7 +3423,7 @@
we then save in the partition info structure.
*/
thd->free_list= NULL;
- lex.part_info= (partition_info*)1; //Indicate yyparse from this place
+ lex.part_info= (partition_info*)1; /* Indicate yyparse from this place */
DBUG_PRINT("info", ("Parse: %s", part_buf));
if (yyparse((void*)thd) || thd->is_fatal_error)
{
@@ -3380,8 +3504,10 @@
online_alter_part_error_handler()
thd Thread object
table Table object
+
RETURN VALUES
None
+
DESCRIPTION
Support routine to clean up after failures of on-line ALTER TABLE
for partition management.
@@ -3403,9 +3529,11 @@
table_list Table list with the one table in it
empty Has nothing been done
lpt Struct to be used by error handler
+
RETURN VALUES
FALSE Success
TRUE Failure
+
DESCRIPTION
Support routine to handle the successful cases for partition
management.
@@ -3450,11 +3578,13 @@
partition_changed Boolean indicating whether partition changed
online_alter_part Boolean indicating whether online partition
change is requested
+
RETURN VALUES
TRUE Error
FALSE Success
partition_changed
online_alter_part
+
DESCRIPTION
This method handles all preparations for ALTER TABLE for partitioned
tables
@@ -3531,7 +3661,7 @@
alter_info->no_parts= curr_part_no - new_part_no;
}
}
- if (table->file->alter_table_flags() & HA_ONLINE_CHANGE_PARTITION)
+ if (table->file->alter_table_flags() & HA_FAST_CHANGE_PARTITION)
online_alter_part= TRUE;
if (alter_info->flags & ALTER_ADD_PARTITION)
{
@@ -4249,6 +4379,16 @@
/*
SYNOPSIS
mysql_change_partitions()
+ lpt Struct containing parameters
+
+ RETURN VALUES
+ TRUE Failure
+ FALSE Success
+
+ DESCRIPTION
+ Request handler to add partitions as set in states of the partition
+
+ Parameters used:
create_info Create information used to create partitions
db Database name
table_name Table name
@@ -4256,12 +4396,6 @@
records are added
deleted Output parameter where number of deleted
records are added
- All parameters passed through the write_frm_type object
- RETURN VALUES
- TRUE Failure
- FALSE Success
- DESCRIPTION
- Request handler to add partitions as set in states of the partition
*/
static bool mysql_change_partitions(LOCK_PARAM_TYPE *lpt)
@@ -4281,14 +4415,18 @@
/*
SYNOPSIS
mysql_rename_partitions()
- db Database name
- table_name Table name
- All parameters passed through the write_frm_type object
+ lpt Struct containing parameters
+
RETURN VALUES
TRUE Failure
FALSE Success
+
DESCRIPTION
Request handler to rename partitions as set in states of the partition
+
+ Parameters used:
+ db Database name
+ table_name Table name
*/
static bool mysql_rename_partitions(LOCK_PARAM_TYPE *lpt)
@@ -4304,16 +4442,18 @@
/*
SYNOPSIS
mysql_drop_partitions()
- table Table object
- db Database name
- table_name Table name
- All parameters passed through the write_frm_type object
+ lpt Struct containing parameters
RETURN VALUES
TRUE Failure
FALSE Success
DESCRIPTION
Drop the partitions marked with PART_TO_BE_DROPPED state and remove
those partitions from the list.
+
+ Parameters used:
+ table Table object
+ db Database name
+ table_name Table name
*/
static bool mysql_drop_partitions(LOCK_PARAM_TYPE *lpt)
@@ -4348,10 +4488,10 @@
table Table object
alter_info ALTER TABLE info
-
RETURN VALUES
TRUE Error
FALSE Success
+
DESCRIPTION
Perform all ALTER TABLE operations for partitioned tables that can be
performed online without a full copy of the original table.
@@ -4369,6 +4509,8 @@
partition_info *part_info= table->s->part_info;
LOCK_PARAM_TYPE lpt_obj;
LOCK_PARAM_TYPE *lpt= &lpt_obj;
+ DBUG_ENTER("online_alter_part_table");
+
lpt->thd= thd;
lpt->create_info= create_info;
lpt->create_list= create_list;
@@ -4384,7 +4526,6 @@
lpt->pack_frm_data= NULL;
lpt->pack_frm_len= 0;
thd->lex->part_info= part_info;
- DBUG_ENTER("online_alter_part_table");
if (alter_info->flags & ALTER_OPTIMIZE_PARTITION ||
alter_info->flags & ALTER_ANALYZE_PARTITION ||
@@ -4413,7 +4554,7 @@
DBUG_RETURN(TRUE);
}
}
- else if (table->file->alter_table_flags() & HA_ONLINE_PARTITION_ONE_PHASE)
+ else if (table->file->alter_table_flags() & HA_PARTITION_ONE_PHASE)
{
/*
In the case where the engine supports one phase online partition
@@ -4645,16 +4786,15 @@
/*
Internal representation of the frm blob
-
*/
struct frm_blob_struct
{
struct frm_blob_header
{
- uint ver; // Version of header
- uint orglen; // Original length of compressed data
- uint complen; // Compressed length of data, 0=uncompressed
+ uint ver; /* Version of header */
+ uint orglen; /* Original length of compressed data */
+ uint complen; /* Compressed length of data, 0=uncompressed */
} head;
char data[1];
};
@@ -4664,12 +4804,14 @@
packfrm is a method used to compress the frm file for storage in a
handler. This method was developed for the NDB handler and has been moved
here to serve also other uses.
+
SYNOPSIS
packfrm()
data Data reference to frm file data
len Length of frm file data
pack_data Reference to the pointer to the packed frm data
pack_len Length of packed frm file data
+
RETURN VALUES¨
0 Success
>0 Failure
@@ -4750,7 +4892,6 @@
*unpack_len= complen;
DBUG_PRINT("exit", ("frmdata: %x, len: %d", *unpack_data, *unpack_len));
-
DBUG_RETURN(0);
}
@@ -4758,11 +4899,13 @@
/*
Prepare for calling val_int on partition function by setting fields to
point to the record where the values of the PF-fields are stored.
+
SYNOPSIS
set_field_ptr()
ptr Array of fields to change ptr
new_buf New record pointer
old_buf Old record pointer
+
DESCRIPTION
Set ptr in field objects of field array to refer to new_buf record
instead of previously old_buf. Used before calling val_int and after
@@ -4790,11 +4933,13 @@
point to the record where the values of the PF-fields are stored.
This variant works on a key_part reference.
It is not required that all fields are NOT NULL fields.
+
SYNOPSIS
set_key_field_ptr()
key_part key part with a set of fields to change ptr
new_buf New record pointer
old_buf Old record pointer
+
DESCRIPTION
Set ptr in field objects of field array to refer to new_buf record
instead of previously old_buf. Used before calling val_int and after
@@ -4823,13 +4968,16 @@
SYNOPSIS
mem_alloc_error()
None
+
RETURN VALUES
None
+
DESCRIPTION
A routine to use for all the many places in the code where memory
allocation error can happen, a tremendous amount of them, needs
simple routine that signals this error.
*/
+
void mem_alloc_error()
{
my_error(ER_OUTOFMEMORY, MYF(0), 64);
--
MySQL Internals Mailing List
For list archives: http://lists.mysql.com/internals
To unsubscribe: http://lists.mysql.com/internals?unsub=mysql-i...@freebsd.csie.nctu.edu.tw