2009-09-23 23:32:31 +02:00
|
|
|
#ifndef SQL_PARTITION_INCLUDED
|
|
|
|
#define SQL_PARTITION_INCLUDED
|
|
|
|
|
2009-10-21 17:45:34 +02:00
|
|
|
/* Copyright 2005-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
|
2006-02-16 17:38:33 +01:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2006-12-27 02:23:51 +01:00
|
|
|
the Free Software Foundation; version 2 of the License.
|
2006-02-16 17:38:33 +01:00
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
|
|
|
|
#ifdef __GNUC__
|
|
|
|
#pragma interface /* gcc class implementation */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Flags for partition handlers */
|
|
|
|
#define HA_CAN_PARTITION (1 << 0) /* Partition support */
|
|
|
|
#define HA_CAN_UPDATE_PARTITION_KEY (1 << 1)
|
|
|
|
#define HA_CAN_PARTITION_UNIQUE (1 << 2)
|
|
|
|
#define HA_USE_AUTO_PARTITION (1 << 3)
|
|
|
|
|
|
|
|
/*typedef struct {
|
|
|
|
ulonglong data_file_length;
|
|
|
|
ulonglong max_data_file_length;
|
|
|
|
ulonglong index_file_length;
|
|
|
|
ulonglong delete_length;
|
|
|
|
ha_rows records;
|
|
|
|
ulong mean_rec_length;
|
|
|
|
time_t create_time;
|
|
|
|
time_t check_time;
|
|
|
|
time_t update_time;
|
|
|
|
ulonglong check_sum;
|
|
|
|
} PARTITION_INFO;
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
longlong list_value;
|
|
|
|
uint32 partition_id;
|
|
|
|
} LIST_PART_ENTRY;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
uint32 start_part;
|
|
|
|
uint32 end_part;
|
|
|
|
} part_id_range;
|
|
|
|
|
|
|
|
struct st_partition_iter;
|
|
|
|
#define NOT_A_PARTITION_ID ((uint32)-1)
|
|
|
|
|
|
|
|
bool is_partition_in_list(char *part_name, List<char> list_part_names);
|
|
|
|
char *are_partitions_in_table(partition_info *new_part_info,
|
|
|
|
partition_info *old_part_info);
|
|
|
|
bool check_reorganise_list(partition_info *new_part_info,
|
|
|
|
partition_info *old_part_info,
|
|
|
|
List<char> list_part_names);
|
|
|
|
handler *get_ha_partition(partition_info *part_info);
|
WL#3817: Simplify string / memory area types and make things more consistent (first part)
The following type conversions was done:
- Changed byte to uchar
- Changed gptr to uchar*
- Change my_string to char *
- Change my_size_t to size_t
- Change size_s to size_t
Removed declaration of byte, gptr, my_string, my_size_t and size_s.
Following function parameter changes was done:
- All string functions in mysys/strings was changed to use size_t
instead of uint for string lengths.
- All read()/write() functions changed to use size_t (including vio).
- All protocoll functions changed to use size_t instead of uint
- Functions that used a pointer to a string length was changed to use size_t*
- Changed malloc(), free() and related functions from using gptr to use void *
as this requires fewer casts in the code and is more in line with how the
standard functions work.
- Added extra length argument to dirname_part() to return the length of the
created string.
- Changed (at least) following functions to take uchar* as argument:
- db_dump()
- my_net_write()
- net_write_command()
- net_store_data()
- DBUG_DUMP()
- decimal2bin() & bin2decimal()
- Changed my_compress() and my_uncompress() to use size_t. Changed one
argument to my_uncompress() from a pointer to a value as we only return
one value (makes function easier to use).
- Changed type of 'pack_data' argument to packfrm() to avoid casts.
- Changed in readfrm() and writefrom(), ha_discover and handler::discover()
the type for argument 'frmdata' to uchar** to avoid casts.
- Changed most Field functions to use uchar* instead of char* (reduced a lot of
casts).
- Changed field->val_xxx(xxx, new_ptr) to take const pointers.
Other changes:
- Removed a lot of not needed casts
- Added a few new cast required by other changes
- Added some cast to my_multi_malloc() arguments for safety (as string lengths
needs to be uint, not size_t).
- Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done
explicitely as this conflict was often hided by casting the function to
hash_get_key).
- Changed some buffers to memory regions to uchar* to avoid casts.
- Changed some string lengths from uint to size_t.
- Changed field->ptr to be uchar* instead of char*. This allowed us to
get rid of a lot of casts.
- Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar
- Include zlib.h in some files as we needed declaration of crc32()
- Changed MY_FILE_ERROR to be (size_t) -1.
- Changed many variables to hold the result of my_read() / my_write() to be
size_t. This was needed to properly detect errors (which are
returned as (size_t) -1).
- Removed some very old VMS code
- Changed packfrm()/unpackfrm() to not be depending on uint size
(portability fix)
- Removed windows specific code to restore cursor position as this
causes slowdown on windows and we should not mix read() and pread()
calls anyway as this is not thread safe. Updated function comment to
reflect this. Changed function that depended on original behavior of
my_pwrite() to itself restore the cursor position (one such case).
- Added some missing checking of return value of malloc().
- Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow.
- Changed type of table_def::m_size from my_size_t to ulong to reflect that
m_size is the number of elements in the array, not a string/memory
length.
- Moved THD::max_row_length() to table.cc (as it's not depending on THD).
Inlined max_row_length_blob() into this function.
- More function comments
- Fixed some compiler warnings when compiled without partitions.
- Removed setting of LEX_STRING() arguments in declaration (portability fix).
- Some trivial indentation/variable name changes.
- Some trivial code simplifications:
- Replaced some calls to alloc_root + memcpy to use
strmake_root()/strdup_root().
- Changed some calls from memdup() to strmake() (Safety fix)
- Simpler loops in client-simple.c
2007-05-10 11:59:39 +02:00
|
|
|
int get_parts_for_update(const uchar *old_data, uchar *new_data,
|
|
|
|
const uchar *rec0, partition_info *part_info,
|
2006-02-16 17:38:33 +01:00
|
|
|
uint32 *old_part_id, uint32 *new_part_id,
|
|
|
|
longlong *func_value);
|
WL#3817: Simplify string / memory area types and make things more consistent (first part)
The following type conversions was done:
- Changed byte to uchar
- Changed gptr to uchar*
- Change my_string to char *
- Change my_size_t to size_t
- Change size_s to size_t
Removed declaration of byte, gptr, my_string, my_size_t and size_s.
Following function parameter changes was done:
- All string functions in mysys/strings was changed to use size_t
instead of uint for string lengths.
- All read()/write() functions changed to use size_t (including vio).
- All protocoll functions changed to use size_t instead of uint
- Functions that used a pointer to a string length was changed to use size_t*
- Changed malloc(), free() and related functions from using gptr to use void *
as this requires fewer casts in the code and is more in line with how the
standard functions work.
- Added extra length argument to dirname_part() to return the length of the
created string.
- Changed (at least) following functions to take uchar* as argument:
- db_dump()
- my_net_write()
- net_write_command()
- net_store_data()
- DBUG_DUMP()
- decimal2bin() & bin2decimal()
- Changed my_compress() and my_uncompress() to use size_t. Changed one
argument to my_uncompress() from a pointer to a value as we only return
one value (makes function easier to use).
- Changed type of 'pack_data' argument to packfrm() to avoid casts.
- Changed in readfrm() and writefrom(), ha_discover and handler::discover()
the type for argument 'frmdata' to uchar** to avoid casts.
- Changed most Field functions to use uchar* instead of char* (reduced a lot of
casts).
- Changed field->val_xxx(xxx, new_ptr) to take const pointers.
Other changes:
- Removed a lot of not needed casts
- Added a few new cast required by other changes
- Added some cast to my_multi_malloc() arguments for safety (as string lengths
needs to be uint, not size_t).
- Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done
explicitely as this conflict was often hided by casting the function to
hash_get_key).
- Changed some buffers to memory regions to uchar* to avoid casts.
- Changed some string lengths from uint to size_t.
- Changed field->ptr to be uchar* instead of char*. This allowed us to
get rid of a lot of casts.
- Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar
- Include zlib.h in some files as we needed declaration of crc32()
- Changed MY_FILE_ERROR to be (size_t) -1.
- Changed many variables to hold the result of my_read() / my_write() to be
size_t. This was needed to properly detect errors (which are
returned as (size_t) -1).
- Removed some very old VMS code
- Changed packfrm()/unpackfrm() to not be depending on uint size
(portability fix)
- Removed windows specific code to restore cursor position as this
causes slowdown on windows and we should not mix read() and pread()
calls anyway as this is not thread safe. Updated function comment to
reflect this. Changed function that depended on original behavior of
my_pwrite() to itself restore the cursor position (one such case).
- Added some missing checking of return value of malloc().
- Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow.
- Changed type of table_def::m_size from my_size_t to ulong to reflect that
m_size is the number of elements in the array, not a string/memory
length.
- Moved THD::max_row_length() to table.cc (as it's not depending on THD).
Inlined max_row_length_blob() into this function.
- More function comments
- Fixed some compiler warnings when compiled without partitions.
- Removed setting of LEX_STRING() arguments in declaration (portability fix).
- Some trivial indentation/variable name changes.
- Some trivial code simplifications:
- Replaced some calls to alloc_root + memcpy to use
strmake_root()/strdup_root().
- Changed some calls from memdup() to strmake() (Safety fix)
- Simpler loops in client-simple.c
2007-05-10 11:59:39 +02:00
|
|
|
int get_part_for_delete(const uchar *buf, const uchar *rec0,
|
2006-02-16 17:38:33 +01:00
|
|
|
partition_info *part_info, uint32 *part_id);
|
2006-02-16 18:25:26 +01:00
|
|
|
void prune_partition_set(const TABLE *table, part_id_range *part_spec);
|
2006-02-16 17:38:33 +01:00
|
|
|
bool check_partition_info(partition_info *part_info,handlerton **eng_type,
|
2006-06-27 22:19:27 +02:00
|
|
|
TABLE *table, handler *file, HA_CREATE_INFO *info);
|
2009-10-01 15:04:42 +02:00
|
|
|
void set_linear_hash_mask(partition_info *part_info, uint num_parts);
|
2006-04-18 04:51:34 +02:00
|
|
|
bool fix_partition_func(THD *thd, TABLE *table, bool create_table_ind);
|
2006-09-21 11:39:29 +02:00
|
|
|
bool partition_key_modified(TABLE *table, const MY_BITMAP *fields);
|
WL#3817: Simplify string / memory area types and make things more consistent (first part)
The following type conversions was done:
- Changed byte to uchar
- Changed gptr to uchar*
- Change my_string to char *
- Change my_size_t to size_t
- Change size_s to size_t
Removed declaration of byte, gptr, my_string, my_size_t and size_s.
Following function parameter changes was done:
- All string functions in mysys/strings was changed to use size_t
instead of uint for string lengths.
- All read()/write() functions changed to use size_t (including vio).
- All protocoll functions changed to use size_t instead of uint
- Functions that used a pointer to a string length was changed to use size_t*
- Changed malloc(), free() and related functions from using gptr to use void *
as this requires fewer casts in the code and is more in line with how the
standard functions work.
- Added extra length argument to dirname_part() to return the length of the
created string.
- Changed (at least) following functions to take uchar* as argument:
- db_dump()
- my_net_write()
- net_write_command()
- net_store_data()
- DBUG_DUMP()
- decimal2bin() & bin2decimal()
- Changed my_compress() and my_uncompress() to use size_t. Changed one
argument to my_uncompress() from a pointer to a value as we only return
one value (makes function easier to use).
- Changed type of 'pack_data' argument to packfrm() to avoid casts.
- Changed in readfrm() and writefrom(), ha_discover and handler::discover()
the type for argument 'frmdata' to uchar** to avoid casts.
- Changed most Field functions to use uchar* instead of char* (reduced a lot of
casts).
- Changed field->val_xxx(xxx, new_ptr) to take const pointers.
Other changes:
- Removed a lot of not needed casts
- Added a few new cast required by other changes
- Added some cast to my_multi_malloc() arguments for safety (as string lengths
needs to be uint, not size_t).
- Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done
explicitely as this conflict was often hided by casting the function to
hash_get_key).
- Changed some buffers to memory regions to uchar* to avoid casts.
- Changed some string lengths from uint to size_t.
- Changed field->ptr to be uchar* instead of char*. This allowed us to
get rid of a lot of casts.
- Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar
- Include zlib.h in some files as we needed declaration of crc32()
- Changed MY_FILE_ERROR to be (size_t) -1.
- Changed many variables to hold the result of my_read() / my_write() to be
size_t. This was needed to properly detect errors (which are
returned as (size_t) -1).
- Removed some very old VMS code
- Changed packfrm()/unpackfrm() to not be depending on uint size
(portability fix)
- Removed windows specific code to restore cursor position as this
causes slowdown on windows and we should not mix read() and pread()
calls anyway as this is not thread safe. Updated function comment to
reflect this. Changed function that depended on original behavior of
my_pwrite() to itself restore the cursor position (one such case).
- Added some missing checking of return value of malloc().
- Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow.
- Changed type of table_def::m_size from my_size_t to ulong to reflect that
m_size is the number of elements in the array, not a string/memory
length.
- Moved THD::max_row_length() to table.cc (as it's not depending on THD).
Inlined max_row_length_blob() into this function.
- More function comments
- Fixed some compiler warnings when compiled without partitions.
- Removed setting of LEX_STRING() arguments in declaration (portability fix).
- Some trivial indentation/variable name changes.
- Some trivial code simplifications:
- Replaced some calls to alloc_root + memcpy to use
strmake_root()/strdup_root().
- Changed some calls from memdup() to strmake() (Safety fix)
- Simpler loops in client-simple.c
2007-05-10 11:59:39 +02:00
|
|
|
void get_partition_set(const TABLE *table, uchar *buf, const uint index,
|
2006-02-16 17:38:33 +01:00
|
|
|
const key_range *key_spec,
|
|
|
|
part_id_range *part_spec);
|
2009-10-28 01:11:17 +01:00
|
|
|
uint get_partition_field_store_length(Field *field);
|
2009-11-02 14:49:26 +01:00
|
|
|
int get_cs_converted_part_value_from_string(THD *thd,
|
|
|
|
Item *item,
|
|
|
|
String *input_str,
|
|
|
|
String *output_str,
|
|
|
|
CHARSET_INFO *cs,
|
|
|
|
bool use_hex);
|
WL#3817: Simplify string / memory area types and make things more consistent (first part)
The following type conversions was done:
- Changed byte to uchar
- Changed gptr to uchar*
- Change my_string to char *
- Change my_size_t to size_t
- Change size_s to size_t
Removed declaration of byte, gptr, my_string, my_size_t and size_s.
Following function parameter changes was done:
- All string functions in mysys/strings was changed to use size_t
instead of uint for string lengths.
- All read()/write() functions changed to use size_t (including vio).
- All protocoll functions changed to use size_t instead of uint
- Functions that used a pointer to a string length was changed to use size_t*
- Changed malloc(), free() and related functions from using gptr to use void *
as this requires fewer casts in the code and is more in line with how the
standard functions work.
- Added extra length argument to dirname_part() to return the length of the
created string.
- Changed (at least) following functions to take uchar* as argument:
- db_dump()
- my_net_write()
- net_write_command()
- net_store_data()
- DBUG_DUMP()
- decimal2bin() & bin2decimal()
- Changed my_compress() and my_uncompress() to use size_t. Changed one
argument to my_uncompress() from a pointer to a value as we only return
one value (makes function easier to use).
- Changed type of 'pack_data' argument to packfrm() to avoid casts.
- Changed in readfrm() and writefrom(), ha_discover and handler::discover()
the type for argument 'frmdata' to uchar** to avoid casts.
- Changed most Field functions to use uchar* instead of char* (reduced a lot of
casts).
- Changed field->val_xxx(xxx, new_ptr) to take const pointers.
Other changes:
- Removed a lot of not needed casts
- Added a few new cast required by other changes
- Added some cast to my_multi_malloc() arguments for safety (as string lengths
needs to be uint, not size_t).
- Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done
explicitely as this conflict was often hided by casting the function to
hash_get_key).
- Changed some buffers to memory regions to uchar* to avoid casts.
- Changed some string lengths from uint to size_t.
- Changed field->ptr to be uchar* instead of char*. This allowed us to
get rid of a lot of casts.
- Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar
- Include zlib.h in some files as we needed declaration of crc32()
- Changed MY_FILE_ERROR to be (size_t) -1.
- Changed many variables to hold the result of my_read() / my_write() to be
size_t. This was needed to properly detect errors (which are
returned as (size_t) -1).
- Removed some very old VMS code
- Changed packfrm()/unpackfrm() to not be depending on uint size
(portability fix)
- Removed windows specific code to restore cursor position as this
causes slowdown on windows and we should not mix read() and pread()
calls anyway as this is not thread safe. Updated function comment to
reflect this. Changed function that depended on original behavior of
my_pwrite() to itself restore the cursor position (one such case).
- Added some missing checking of return value of malloc().
- Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow.
- Changed type of table_def::m_size from my_size_t to ulong to reflect that
m_size is the number of elements in the array, not a string/memory
length.
- Moved THD::max_row_length() to table.cc (as it's not depending on THD).
Inlined max_row_length_blob() into this function.
- More function comments
- Fixed some compiler warnings when compiled without partitions.
- Removed setting of LEX_STRING() arguments in declaration (portability fix).
- Some trivial indentation/variable name changes.
- Some trivial code simplifications:
- Replaced some calls to alloc_root + memcpy to use
strmake_root()/strdup_root().
- Changed some calls from memdup() to strmake() (Safety fix)
- Simpler loops in client-simple.c
2007-05-10 11:59:39 +02:00
|
|
|
void get_full_part_id_from_key(const TABLE *table, uchar *buf,
|
2006-02-16 17:38:33 +01:00
|
|
|
KEY *key_info,
|
|
|
|
const key_range *key_spec,
|
|
|
|
part_id_range *part_spec);
|
2007-03-27 19:09:56 +02:00
|
|
|
bool mysql_unpack_partition(THD *thd, const char *part_buf,
|
2006-02-16 17:38:33 +01:00
|
|
|
uint part_info_len,
|
2007-03-27 19:09:56 +02:00
|
|
|
const char *part_state, uint part_state_len,
|
2006-02-16 17:38:33 +01:00
|
|
|
TABLE *table, bool is_create_table_ind,
|
2007-03-27 13:15:38 +02:00
|
|
|
handlerton *default_db_type,
|
|
|
|
bool *work_part_info_used);
|
2006-02-16 17:38:33 +01:00
|
|
|
void make_used_partitions_str(partition_info *part_info, String *parts_str);
|
|
|
|
uint32 get_list_array_idx_for_endpoint(partition_info *part_info,
|
|
|
|
bool left_endpoint,
|
|
|
|
bool include_endpoint);
|
|
|
|
uint32 get_partition_id_range_for_endpoint(partition_info *part_info,
|
|
|
|
bool left_endpoint,
|
|
|
|
bool include_endpoint);
|
2006-09-26 22:30:39 +02:00
|
|
|
bool check_part_func_fields(Field **ptr, bool ok_with_charsets);
|
|
|
|
bool field_is_partition_charset(Field *field);
|
2009-10-22 16:15:06 +02:00
|
|
|
Item* convert_charset_partition_constant(Item *item, CHARSET_INFO *cs);
|
2006-09-26 22:30:39 +02:00
|
|
|
|
2006-02-16 17:38:33 +01:00
|
|
|
/*
|
|
|
|
A "Get next" function for partition iterator.
|
2006-04-06 19:23:33 +02:00
|
|
|
|
2006-02-16 17:38:33 +01:00
|
|
|
SYNOPSIS
|
|
|
|
partition_iter_func()
|
|
|
|
part_iter Partition iterator, you call only "iter.get_next(&iter)"
|
|
|
|
|
2006-04-06 19:23:33 +02:00
|
|
|
DESCRIPTION
|
|
|
|
Depending on whether partitions or sub-partitions are iterated, the
|
|
|
|
function returns next subpartition id/partition number. The sequence of
|
|
|
|
returned numbers is not ordered and may contain duplicates.
|
|
|
|
|
|
|
|
When the end of sequence is reached, NOT_A_PARTITION_ID is returned, and
|
|
|
|
the iterator resets itself (so next get_next() call will start to
|
|
|
|
enumerate the set all over again).
|
|
|
|
|
2006-02-16 17:38:33 +01:00
|
|
|
RETURN
|
|
|
|
NOT_A_PARTITION_ID if there are no more partitions.
|
|
|
|
[sub]partition_id of the next partition
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef uint32 (*partition_iter_func)(st_partition_iter* part_iter);
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Partition set iterator. Used to enumerate a set of [sub]partitions
|
|
|
|
obtained in partition interval analysis (see get_partitions_in_range_iter).
|
|
|
|
|
|
|
|
For the user, the only meaningful field is get_next, which may be used as
|
|
|
|
follows:
|
|
|
|
part_iterator.get_next(&part_iterator);
|
|
|
|
|
|
|
|
Initialization is done by any of the following calls:
|
|
|
|
- get_partitions_in_range_iter-type function call
|
|
|
|
- init_single_partition_iterator()
|
|
|
|
- init_all_partitions_iterator()
|
|
|
|
Cleanup is not needed.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct st_partition_iter
|
|
|
|
{
|
|
|
|
partition_iter_func get_next;
|
2006-04-06 19:23:33 +02:00
|
|
|
/*
|
|
|
|
Valid for "Interval mapping" in LIST partitioning: if true, let the
|
|
|
|
iterator also produce id of the partition that contains NULL value.
|
|
|
|
*/
|
|
|
|
bool ret_null_part, ret_null_part_orig;
|
2006-02-16 17:38:33 +01:00
|
|
|
struct st_part_num_range
|
|
|
|
{
|
|
|
|
uint32 start;
|
2006-04-06 19:23:33 +02:00
|
|
|
uint32 cur;
|
2006-02-16 17:38:33 +01:00
|
|
|
uint32 end;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct st_field_value_range
|
|
|
|
{
|
|
|
|
longlong start;
|
2006-04-06 19:23:33 +02:00
|
|
|
longlong cur;
|
2006-02-16 17:38:33 +01:00
|
|
|
longlong end;
|
|
|
|
};
|
|
|
|
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct st_part_num_range part_nums;
|
|
|
|
struct st_field_value_range field_vals;
|
|
|
|
};
|
|
|
|
partition_info *part_info;
|
|
|
|
} PARTITION_ITERATOR;
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Get an iterator for set of partitions that match given field-space interval
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
get_partitions_in_range_iter()
|
2009-10-21 17:45:34 +02:00
|
|
|
part_info Partitioning info
|
2009-09-15 17:07:52 +02:00
|
|
|
is_subpart
|
2009-10-21 17:45:34 +02:00
|
|
|
store_length_array Length of fields packed in opt_range_key format
|
|
|
|
min_val Left edge, field value in opt_range_key format
|
|
|
|
max_val Right edge, field value in opt_range_key format
|
|
|
|
min_len Length of minimum value
|
|
|
|
max_len Length of maximum value
|
|
|
|
flags Some combination of NEAR_MIN, NEAR_MAX, NO_MIN_RANGE,
|
|
|
|
NO_MAX_RANGE
|
|
|
|
part_iter Iterator structure to be initialized
|
2006-02-16 17:38:33 +01:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Functions with this signature are used to perform "Partitioning Interval
|
|
|
|
Analysis". This analysis is applicable for any type of [sub]partitioning
|
|
|
|
by some function of a single fieldX. The idea is as follows:
|
|
|
|
Given an interval "const1 <=? fieldX <=? const2", find a set of partitions
|
|
|
|
that may contain records with value of fieldX within the given interval.
|
|
|
|
|
|
|
|
The min_val, max_val and flags parameters specify the interval.
|
|
|
|
The set of partitions is returned by initializing an iterator in *part_iter
|
|
|
|
|
|
|
|
NOTES
|
2009-09-15 17:07:52 +02:00
|
|
|
There are currently three functions of this type:
|
2006-02-16 17:38:33 +01:00
|
|
|
- get_part_iter_for_interval_via_walking
|
2009-09-15 17:07:52 +02:00
|
|
|
- get_part_iter_for_interval_cols_via_map
|
2006-02-16 17:38:33 +01:00
|
|
|
- get_part_iter_for_interval_via_mapping
|
|
|
|
|
|
|
|
RETURN
|
|
|
|
0 - No matching partitions, iterator not initialized
|
|
|
|
1 - Some partitions would match, iterator intialized for traversing them
|
|
|
|
-1 - All partitions would match, iterator not initialized
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef int (*get_partitions_in_range_iter)(partition_info *part_info,
|
|
|
|
bool is_subpart,
|
2009-09-15 17:07:52 +02:00
|
|
|
uint32 *store_length_array,
|
WL#3817: Simplify string / memory area types and make things more consistent (first part)
The following type conversions was done:
- Changed byte to uchar
- Changed gptr to uchar*
- Change my_string to char *
- Change my_size_t to size_t
- Change size_s to size_t
Removed declaration of byte, gptr, my_string, my_size_t and size_s.
Following function parameter changes was done:
- All string functions in mysys/strings was changed to use size_t
instead of uint for string lengths.
- All read()/write() functions changed to use size_t (including vio).
- All protocoll functions changed to use size_t instead of uint
- Functions that used a pointer to a string length was changed to use size_t*
- Changed malloc(), free() and related functions from using gptr to use void *
as this requires fewer casts in the code and is more in line with how the
standard functions work.
- Added extra length argument to dirname_part() to return the length of the
created string.
- Changed (at least) following functions to take uchar* as argument:
- db_dump()
- my_net_write()
- net_write_command()
- net_store_data()
- DBUG_DUMP()
- decimal2bin() & bin2decimal()
- Changed my_compress() and my_uncompress() to use size_t. Changed one
argument to my_uncompress() from a pointer to a value as we only return
one value (makes function easier to use).
- Changed type of 'pack_data' argument to packfrm() to avoid casts.
- Changed in readfrm() and writefrom(), ha_discover and handler::discover()
the type for argument 'frmdata' to uchar** to avoid casts.
- Changed most Field functions to use uchar* instead of char* (reduced a lot of
casts).
- Changed field->val_xxx(xxx, new_ptr) to take const pointers.
Other changes:
- Removed a lot of not needed casts
- Added a few new cast required by other changes
- Added some cast to my_multi_malloc() arguments for safety (as string lengths
needs to be uint, not size_t).
- Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done
explicitely as this conflict was often hided by casting the function to
hash_get_key).
- Changed some buffers to memory regions to uchar* to avoid casts.
- Changed some string lengths from uint to size_t.
- Changed field->ptr to be uchar* instead of char*. This allowed us to
get rid of a lot of casts.
- Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar
- Include zlib.h in some files as we needed declaration of crc32()
- Changed MY_FILE_ERROR to be (size_t) -1.
- Changed many variables to hold the result of my_read() / my_write() to be
size_t. This was needed to properly detect errors (which are
returned as (size_t) -1).
- Removed some very old VMS code
- Changed packfrm()/unpackfrm() to not be depending on uint size
(portability fix)
- Removed windows specific code to restore cursor position as this
causes slowdown on windows and we should not mix read() and pread()
calls anyway as this is not thread safe. Updated function comment to
reflect this. Changed function that depended on original behavior of
my_pwrite() to itself restore the cursor position (one such case).
- Added some missing checking of return value of malloc().
- Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow.
- Changed type of table_def::m_size from my_size_t to ulong to reflect that
m_size is the number of elements in the array, not a string/memory
length.
- Moved THD::max_row_length() to table.cc (as it's not depending on THD).
Inlined max_row_length_blob() into this function.
- More function comments
- Fixed some compiler warnings when compiled without partitions.
- Removed setting of LEX_STRING() arguments in declaration (portability fix).
- Some trivial indentation/variable name changes.
- Some trivial code simplifications:
- Replaced some calls to alloc_root + memcpy to use
strmake_root()/strdup_root().
- Changed some calls from memdup() to strmake() (Safety fix)
- Simpler loops in client-simple.c
2007-05-10 11:59:39 +02:00
|
|
|
uchar *min_val, uchar *max_val,
|
2009-09-15 17:07:52 +02:00
|
|
|
uint min_len, uint max_len,
|
2006-02-16 17:38:33 +01:00
|
|
|
uint flags,
|
|
|
|
PARTITION_ITERATOR *part_iter);
|
|
|
|
|
|
|
|
#include "partition_info.h"
|
|
|
|
|
2009-09-23 23:32:31 +02:00
|
|
|
#endif /* SQL_PARTITION_INCLUDED */
|