2009-09-23 23:32:31 +02:00
|
|
|
#ifndef HA_PARTITION_INCLUDED
|
|
|
|
#define HA_PARTITION_INCLUDED
|
|
|
|
|
2011-07-04 01:25:49 +02:00
|
|
|
/*
|
2012-04-10 08:28:13 +02:00
|
|
|
Copyright (c) 2005, 2012, Oracle and/or its affiliates.
|
2022-03-30 14:57:08 +02:00
|
|
|
Copyright (c) 2009, 2022, MariaDB Corporation.
|
2005-07-18 13:31:02 +02:00
|
|
|
|
2013-06-27 13:01:03 +02: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
|
|
|
|
the Free Software Foundation; version 2 of the License.
|
2005-07-18 13:31:02 +02:00
|
|
|
|
2013-06-27 13:01:03 +02: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.
|
2005-07-18 13:31:02 +02:00
|
|
|
|
2013-06-27 13:01:03 +02:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2019-05-11 21:19:05 +02:00
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
|
2005-07-18 13:31:02 +02:00
|
|
|
|
2010-03-31 16:05:33 +02:00
|
|
|
#include "sql_partition.h" /* part_id_range, partition_element */
|
|
|
|
#include "queues.h" /* QUEUE */
|
|
|
|
|
2021-08-05 22:48:02 +02:00
|
|
|
struct Ordered_blob_storage
|
|
|
|
{
|
|
|
|
String blob;
|
|
|
|
bool set_read_value;
|
|
|
|
Ordered_blob_storage() : set_read_value(false)
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
2020-03-30 13:50:03 +02:00
|
|
|
#define PAR_EXT ".par"
|
2005-07-18 13:31:02 +02:00
|
|
|
#define PARTITION_BYTES_IN_POS 2
|
2021-08-05 22:48:02 +02:00
|
|
|
#define ORDERED_PART_NUM_OFFSET sizeof(Ordered_blob_storage **)
|
|
|
|
#define ORDERED_REC_OFFSET (ORDERED_PART_NUM_OFFSET + PARTITION_BYTES_IN_POS)
|
2013-06-27 13:01:03 +02:00
|
|
|
|
2011-04-20 17:52:33 +02:00
|
|
|
|
2013-06-15 17:32:08 +02:00
|
|
|
/** Struct used for partition_name_hash */
|
|
|
|
typedef struct st_part_name_def
|
|
|
|
{
|
|
|
|
uchar *partition_name;
|
|
|
|
uint length;
|
|
|
|
uint32 part_id;
|
|
|
|
my_bool is_subpart;
|
|
|
|
} PART_NAME_DEF;
|
|
|
|
|
|
|
|
/** class where to save partitions Handler_share's */
|
|
|
|
class Parts_share_refs
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
uint num_parts; /**< Size of ha_share array */
|
|
|
|
Handler_share **ha_shares; /**< Storage for each part */
|
|
|
|
Parts_share_refs()
|
|
|
|
{
|
|
|
|
num_parts= 0;
|
|
|
|
ha_shares= NULL;
|
|
|
|
}
|
|
|
|
~Parts_share_refs()
|
|
|
|
{
|
|
|
|
uint i;
|
|
|
|
for (i= 0; i < num_parts; i++)
|
2017-09-12 14:49:23 +02:00
|
|
|
delete ha_shares[i];
|
|
|
|
delete[] ha_shares;
|
2013-06-15 17:32:08 +02:00
|
|
|
}
|
|
|
|
bool init(uint arg_num_parts)
|
|
|
|
{
|
|
|
|
DBUG_ASSERT(!num_parts && !ha_shares);
|
|
|
|
num_parts= arg_num_parts;
|
|
|
|
/* Allocate an array of Handler_share pointers */
|
|
|
|
ha_shares= new Handler_share *[num_parts];
|
|
|
|
if (!ha_shares)
|
|
|
|
{
|
|
|
|
num_parts= 0;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
memset(ha_shares, 0, sizeof(Handler_share*) * num_parts);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-09-25 23:56:10 +02:00
|
|
|
class ha_partition;
|
|
|
|
|
|
|
|
/* Partition Full Text Search info */
|
|
|
|
struct st_partition_ft_info
|
|
|
|
{
|
|
|
|
struct _ft_vft *please;
|
|
|
|
st_partition_ft_info *next;
|
|
|
|
ha_partition *file;
|
|
|
|
FT_INFO **part_ft_info;
|
|
|
|
};
|
|
|
|
|
2013-06-15 17:32:08 +02:00
|
|
|
|
2018-01-03 17:19:39 +01:00
|
|
|
#ifdef HAVE_PSI_MUTEX_INTERFACE
|
2017-02-20 08:06:58 +01:00
|
|
|
extern PSI_mutex_key key_partition_auto_inc_mutex;
|
2018-01-03 17:19:39 +01:00
|
|
|
#endif
|
2017-02-20 08:06:58 +01:00
|
|
|
|
2013-06-15 17:32:08 +02:00
|
|
|
/**
|
|
|
|
Partition specific Handler_share.
|
|
|
|
*/
|
|
|
|
class Partition_share : public Handler_share
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bool auto_inc_initialized;
|
|
|
|
mysql_mutex_t auto_inc_mutex; /**< protecting auto_inc val */
|
|
|
|
ulonglong next_auto_inc_val; /**< first non reserved value */
|
|
|
|
/**
|
|
|
|
Hash of partition names. Initialized in the first ha_partition::open()
|
|
|
|
for the table_share. After that it is read-only, i.e. no locking required.
|
|
|
|
*/
|
|
|
|
bool partition_name_hash_initialized;
|
|
|
|
HASH partition_name_hash;
|
2021-03-30 16:06:55 +02:00
|
|
|
const char *partition_engine_name;
|
2013-06-15 17:32:08 +02:00
|
|
|
/** Storage for each partitions Handler_share */
|
2017-09-12 14:49:23 +02:00
|
|
|
Parts_share_refs partitions_share_refs;
|
2017-02-20 08:06:58 +01:00
|
|
|
Partition_share()
|
|
|
|
: auto_inc_initialized(false),
|
|
|
|
next_auto_inc_val(0),
|
|
|
|
partition_name_hash_initialized(false),
|
2021-03-30 16:06:55 +02:00
|
|
|
partition_engine_name(NULL),
|
2017-02-20 08:06:58 +01:00
|
|
|
partition_names(NULL)
|
|
|
|
{
|
|
|
|
mysql_mutex_init(key_partition_auto_inc_mutex,
|
|
|
|
&auto_inc_mutex,
|
|
|
|
MY_MUTEX_INIT_FAST);
|
|
|
|
}
|
|
|
|
|
2013-06-15 17:32:08 +02:00
|
|
|
~Partition_share()
|
|
|
|
{
|
|
|
|
mysql_mutex_destroy(&auto_inc_mutex);
|
2017-02-20 08:06:58 +01:00
|
|
|
if (partition_names)
|
|
|
|
{
|
|
|
|
my_free(partition_names);
|
|
|
|
}
|
2013-06-15 17:32:08 +02:00
|
|
|
if (partition_name_hash_initialized)
|
2017-02-20 08:06:58 +01:00
|
|
|
{
|
2013-06-15 17:32:08 +02:00
|
|
|
my_hash_free(&partition_name_hash);
|
2017-02-20 08:06:58 +01:00
|
|
|
}
|
2013-06-15 17:32:08 +02:00
|
|
|
}
|
2017-02-20 08:06:58 +01:00
|
|
|
|
2013-06-15 17:32:08 +02:00
|
|
|
bool init(uint num_parts);
|
2017-02-20 08:06:58 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
Release reserved auto increment values not used.
|
|
|
|
@param thd Thread.
|
|
|
|
@param table_share Table Share
|
|
|
|
@param next_insert_id Next insert id (first non used auto inc value).
|
|
|
|
@param max_reserved End of reserved auto inc range.
|
|
|
|
*/
|
|
|
|
void release_auto_inc_if_possible(THD *thd, TABLE_SHARE *table_share,
|
|
|
|
const ulonglong next_insert_id,
|
|
|
|
const ulonglong max_reserved);
|
|
|
|
|
|
|
|
/** lock mutex protecting auto increment value next_auto_inc_val. */
|
|
|
|
inline void lock_auto_inc()
|
2013-06-15 17:32:08 +02:00
|
|
|
{
|
|
|
|
mysql_mutex_lock(&auto_inc_mutex);
|
|
|
|
}
|
2017-02-20 08:06:58 +01:00
|
|
|
/** unlock mutex protecting auto increment value next_auto_inc_val. */
|
|
|
|
inline void unlock_auto_inc()
|
2013-06-15 17:32:08 +02:00
|
|
|
{
|
|
|
|
mysql_mutex_unlock(&auto_inc_mutex);
|
|
|
|
}
|
2017-02-20 08:06:58 +01:00
|
|
|
/**
|
|
|
|
Populate partition_name_hash with partition and subpartition names
|
|
|
|
from part_info.
|
|
|
|
@param part_info Partition info containing all partitions metadata.
|
|
|
|
|
|
|
|
@return Operation status.
|
|
|
|
@retval false Success.
|
|
|
|
@retval true Failure.
|
|
|
|
*/
|
|
|
|
bool populate_partition_name_hash(partition_info *part_info);
|
|
|
|
/** Get partition name.
|
|
|
|
|
|
|
|
@param part_id Partition id (for subpartitioned table only subpartition
|
|
|
|
names will be returned.)
|
|
|
|
|
|
|
|
@return partition name or NULL if error.
|
|
|
|
*/
|
|
|
|
const char *get_partition_name(size_t part_id) const;
|
|
|
|
private:
|
|
|
|
const uchar **partition_names;
|
|
|
|
/**
|
|
|
|
Insert [sub]partition name into partition_name_hash
|
|
|
|
@param name Partition name.
|
|
|
|
@param part_id Partition id.
|
|
|
|
@param is_subpart True if subpartition else partition.
|
|
|
|
|
|
|
|
@return Operation status.
|
|
|
|
@retval false Success.
|
|
|
|
@retval true Failure.
|
|
|
|
*/
|
|
|
|
bool insert_partition_name_in_hash(const char *name,
|
|
|
|
uint part_id,
|
|
|
|
bool is_subpart);
|
2013-06-15 17:32:08 +02:00
|
|
|
};
|
|
|
|
|
2020-02-04 22:54:16 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
List of ranges to be scanned by ha_partition's MRR implementation
|
|
|
|
|
|
|
|
This object is
|
|
|
|
- A KEY_MULTI_RANGE structure (the MRR range)
|
|
|
|
- Storage for the range endpoints that the KEY_MULTI_RANGE has pointers to
|
|
|
|
- list of such ranges (connected through the "next" pointer).
|
|
|
|
*/
|
|
|
|
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
typedef struct st_partition_key_multi_range
|
|
|
|
{
|
2020-02-04 22:54:16 +01:00
|
|
|
/*
|
|
|
|
Number of the range. The ranges are numbered in the order RANGE_SEQ_IF has
|
|
|
|
emitted them, starting from 1. The numbering in used by ordered MRR scans.
|
|
|
|
*/
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
uint id;
|
|
|
|
uchar *key[2];
|
2020-02-04 22:54:16 +01:00
|
|
|
/*
|
|
|
|
Sizes of allocated memory in key[]. These may be larger then the actual
|
|
|
|
values as this structure is reused across MRR scans
|
|
|
|
*/
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
uint length[2];
|
2020-02-04 22:54:16 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
The range.
|
|
|
|
key_multi_range.ptr is a pointer to the this PARTITION_KEY_MULTI_RANGE
|
|
|
|
object
|
|
|
|
*/
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
KEY_MULTI_RANGE key_multi_range;
|
2020-02-04 22:54:16 +01:00
|
|
|
|
|
|
|
// Range id from the SQL layer
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
range_id_t ptr;
|
2020-02-04 22:54:16 +01:00
|
|
|
|
|
|
|
// The next element in the list of MRR ranges.
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
st_partition_key_multi_range *next;
|
|
|
|
} PARTITION_KEY_MULTI_RANGE;
|
|
|
|
|
|
|
|
|
2020-02-04 22:54:16 +01:00
|
|
|
/*
|
2020-02-25 12:55:15 +01:00
|
|
|
List of ranges to be scanned in a certain [sub]partition
|
2020-02-04 22:54:16 +01:00
|
|
|
|
|
|
|
The idea is that there's a list of ranges to be scanned in the table
|
|
|
|
(formed by PARTITION_KEY_MULTI_RANGE structures),
|
|
|
|
and for each [sub]partition, we only need to scan a subset of that list.
|
|
|
|
|
|
|
|
PKMR1 --> PKMR2 --> PKMR3 -->... // list of PARTITION_KEY_MULTI_RANGE
|
|
|
|
^ ^
|
|
|
|
| |
|
|
|
|
PPKMR1 ----------> PPKMR2 -->... // list of PARTITION_PART_KEY_MULTI_RANGE
|
|
|
|
|
|
|
|
This way, per-partition lists of PARTITION_PART_KEY_MULTI_RANGE have pointers
|
|
|
|
to the elements of the global list of PARTITION_KEY_MULTI_RANGE.
|
|
|
|
*/
|
|
|
|
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
typedef struct st_partition_part_key_multi_range
|
|
|
|
{
|
|
|
|
PARTITION_KEY_MULTI_RANGE *partition_key_multi_range;
|
|
|
|
st_partition_part_key_multi_range *next;
|
|
|
|
} PARTITION_PART_KEY_MULTI_RANGE;
|
|
|
|
|
|
|
|
|
|
|
|
class ha_partition;
|
2020-02-04 22:54:16 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
The structure holding information about range sequence to be used with one
|
|
|
|
partition.
|
|
|
|
(pointer to this is used as seq_init_param for RANGE_SEQ_IF structure when
|
|
|
|
invoking MRR for an individual partition)
|
|
|
|
*/
|
|
|
|
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
typedef struct st_partition_part_key_multi_range_hld
|
|
|
|
{
|
2020-02-04 22:54:16 +01:00
|
|
|
/* Owner object */
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
ha_partition *partition;
|
2020-02-04 22:54:16 +01:00
|
|
|
|
2020-02-25 12:55:15 +01:00
|
|
|
/* id of the the partition this structure is for */
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
uint32 part_id;
|
2020-02-04 22:54:16 +01:00
|
|
|
|
2020-02-25 12:55:15 +01:00
|
|
|
/* Current range we're iterating through */
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
PARTITION_PART_KEY_MULTI_RANGE *partition_part_key_multi_range;
|
|
|
|
} PARTITION_PART_KEY_MULTI_RANGE_HLD;
|
|
|
|
|
2011-04-20 17:52:33 +02:00
|
|
|
|
2017-09-28 15:38:10 +02:00
|
|
|
extern "C" int cmp_key_part_id(void *key_p, uchar *ref1, uchar *ref2);
|
2014-03-11 16:45:08 +01:00
|
|
|
extern "C" int cmp_key_rowid_part_id(void *ptr, uchar *ref1, uchar *ref2);
|
|
|
|
|
2021-03-30 16:06:55 +02:00
|
|
|
class ha_partition final :public handler
|
2005-07-18 13:31:02 +02:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
enum partition_index_scan_type
|
|
|
|
{
|
|
|
|
partition_index_read= 0,
|
|
|
|
partition_index_first= 1,
|
2006-09-19 08:56:02 +02:00
|
|
|
partition_index_last= 3,
|
2013-07-21 16:39:19 +02:00
|
|
|
partition_index_read_last= 4,
|
|
|
|
partition_read_range = 5,
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
partition_no_index_scan= 6,
|
|
|
|
partition_read_multi_range = 7,
|
|
|
|
partition_ft_read= 8
|
2005-07-18 13:31:02 +02:00
|
|
|
};
|
|
|
|
/* Data for the partition handler */
|
WL #2604: Partition Management
Optimised version of ADD/DROP/REORGANIZE partitions for
non-NDB storage engines.
New syntax to handle REBUILD/OPTIMIZE/ANALYZE/CHECK/REPAIR partitions
Quite a few bug fixes
include/thr_lock.h:
New method to downgrade locks from TL_WRITE_ONLY
Possibility to upgrade lock while aborting locks
mysql-test/r/ndb_autodiscover.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_bitfield.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_gis.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_partition_key.result:
New test case
mysql-test/r/partition.result:
New test case
mysql-test/r/partition_error.result:
New test case
mysql-test/r/partition_mgm_err.result:
Fix of test case results
mysql-test/t/disabled.def:
partition_03ndb still has bug
mysql-test/t/ndb_partition_key.test:
New test cases for new functionality and bugs
mysql-test/t/partition.test:
New test cases for new functionality and bugs
mysql-test/t/partition_error.test:
New test cases for new functionality and bugs
mysql-test/t/partition_mgm_err.test:
New test cases for new functionality and bugs
mysys/thr_lock.c:
New method to downgrade TL_WRITE_ONLY locks
Possibility to specify if locks are to be upgraded at abort locks
sql/ha_archive.cc:
New handlerton methods
sql/ha_berkeley.cc:
New handlerton methods
sql/ha_blackhole.cc:
New handlerton methods
sql/ha_federated.cc:
New handlerton methods
sql/ha_heap.cc:
New handlerton methods
sql/ha_innodb.cc:
New handlerton methods
sql/ha_myisam.cc:
New handlerton methods
sql/ha_myisammrg.cc:
New handlerton methods
sql/ha_ndbcluster.cc:
New handlerton methods
Moved out packfrm and unpackfrm methods
Adapted many parts to use table_share instead of table->s
Ensured that .ndb file uses filename and not tablename
according to new encoding of names (WL 1324)
All NDB tables are partitioned and set up partition info
Fixed such that tablenames use tablenames and not filenames in NDB
NDB uses auto partitioning for ENGINE=NDB tables
Warning for very large tables
Set RANGE data
Set LIST data
New method to set-up partition info
Set Default number of partitions flag
Set linear hash flag
Set node group array
Set number of fragments
Set max rows
Set tablespace names
New method to get number of partitions of table to use at open table
sql/ha_ndbcluster.h:
Removed partition_flags and alter_table_flags from handler class
A couple of new and changed method headers
sql/ha_ndbcluster_binlog.cc:
Use new method headers
sql/ha_partition.cc:
New handlerton methods
Lots of new function headers
Use #P# as separator between table name and partition name and
#SP# as separator between partition name and subpartition name
Use filename encoding for files both of table name part and of
partition name parts
New method to drop partitions based on partition state
New method to rename partitions based on partition state
New methods to optimize, analyze, check and repair partitions
New methods to optimize, analyze, check and repair table
Helper method to create new partition, open it and external lock
it, not needed to lock it internally since no one else knows about
it yet.
Cleanup method at error for new partitions
New methods to perform bulk of work at ADD/REORGANIZE partitions
(change_partitions, copy_partitions)
sql/ha_partition.h:
New methods and variables
A few dropped ones and a few changed ones
sql/handler.cc:
Handlerton interface changes
New flag to open_table_from_share
sql/handler.h:
New alter_table_flags
New partition flags
New partition states
More states for default handling
Lots of new, dropped and changed interfaces
sql/lex.h:
Added REBUILD and changed name of REORGANISE to REORGANIZE
sql/lock.cc:
Method to downgrade locks
Able to specify if locks upgraded on abort locks
sql/log.cc:
New handlerton methods
sql/mysql_priv.h:
Lots of new interfaces
sql/share/errmsg.txt:
Lots of new, dropped and changed error messages
sql/sql_base.cc:
Adapted to new method headers
New method to abort and upgrade lock
New method to close open tables and downgrade lock
New method to wait for completed table
sql/sql_lex.h:
New flags
sql/sql_partition.cc:
Return int instead of bool in get_partition_id
More defaults handling
Make use of new mem_alloc_error method
More work on function headers
Changes to generate partition syntax to cater for intermediate
partition states
Lots of new code with large comments describing new features for
Partition Management:
ADD/DROP/REORGANIZE/OPTIMIZE/ANALYZE/CHECK/REPAIR partitions
sql/sql_show.cc:
Minors
sql/sql_table.cc:
Moved a couple of methods
New methods to copy create lists and key lists
for use with mysql_prepare_table
New method to write frm file
New handling of handlers with auto partitioning
Fix CREATE TABLE LIKE
Moved code for ADD/DROP/REORGANIZE partitions
Use handlerton method for alter_table_flags
sql/sql_yacc.yy:
More memory alloc error checks
New syntax for REBUILD, ANALYZE, CHECK, OPTIMIZE, REPAIR partitions
sql/table.cc:
Fix length of extra part to be 4 bytes
Partition state introduced in frm file
sql/table.h:
Partition state introduced
sql/unireg.cc:
Partition state introduced
Default partition
storage/csv/ha_tina.cc:
New handlerton methods
storage/example/ha_example.cc:
New handlerton methods
storage/ndb/include/kernel/ndb_limits.h:
RANGE DATA
storage/ndb/include/kernel/signaldata/AlterTable.hpp:
New interfaces in ALTER TABLE towards NDB kernel
storage/ndb/include/kernel/signaldata/DiAddTab.hpp:
New section
storage/ndb/include/kernel/signaldata/DictTabInfo.hpp:
Lots of new parts of table description
storage/ndb/include/kernel/signaldata/LqhFrag.hpp:
tablespace id specified in LQHFRAGREQ
storage/ndb/include/ndbapi/NdbDictionary.hpp:
Lots of new methods in NDB dictionary
storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
New error insertion
storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp:
a few extra jam's
storage/ndb/src/ndbapi/NdbBlob.cpp:
Changes to definition of blob tables
storage/ndb/src/ndbapi/NdbDictionary.cpp:
Lots of new stuff in NDB dictionary
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
Lots of new stuff in NDB dictionary
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp:
Lots of new stuff in NDB dictionary
storage/ndb/test/ndbapi/test_event.cpp:
removed use of methods no longer in existence
storage/ndb/tools/restore/Restore.cpp:
Renamed variable
2006-01-17 08:40:00 +01:00
|
|
|
int m_mode; // Open mode
|
|
|
|
uint m_open_test_lock; // Open test_if_locked
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
uchar *m_file_buffer; // Content of the .par file
|
2005-07-18 13:31:02 +02:00
|
|
|
char *m_name_buffer_ptr; // Pointer to first partition name
|
2011-02-10 21:40:59 +01:00
|
|
|
MEM_ROOT m_mem_root;
|
2007-03-02 17:43:45 +01:00
|
|
|
plugin_ref *m_engine_array; // Array of types of the handlers
|
2005-07-18 13:31:02 +02:00
|
|
|
handler **m_file; // Array of references to handler inst.
|
2006-07-10 23:08:42 +02:00
|
|
|
uint m_file_tot_parts; // Debug
|
WL #2604: Partition Management
Optimised version of ADD/DROP/REORGANIZE partitions for
non-NDB storage engines.
New syntax to handle REBUILD/OPTIMIZE/ANALYZE/CHECK/REPAIR partitions
Quite a few bug fixes
include/thr_lock.h:
New method to downgrade locks from TL_WRITE_ONLY
Possibility to upgrade lock while aborting locks
mysql-test/r/ndb_autodiscover.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_bitfield.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_gis.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_partition_key.result:
New test case
mysql-test/r/partition.result:
New test case
mysql-test/r/partition_error.result:
New test case
mysql-test/r/partition_mgm_err.result:
Fix of test case results
mysql-test/t/disabled.def:
partition_03ndb still has bug
mysql-test/t/ndb_partition_key.test:
New test cases for new functionality and bugs
mysql-test/t/partition.test:
New test cases for new functionality and bugs
mysql-test/t/partition_error.test:
New test cases for new functionality and bugs
mysql-test/t/partition_mgm_err.test:
New test cases for new functionality and bugs
mysys/thr_lock.c:
New method to downgrade TL_WRITE_ONLY locks
Possibility to specify if locks are to be upgraded at abort locks
sql/ha_archive.cc:
New handlerton methods
sql/ha_berkeley.cc:
New handlerton methods
sql/ha_blackhole.cc:
New handlerton methods
sql/ha_federated.cc:
New handlerton methods
sql/ha_heap.cc:
New handlerton methods
sql/ha_innodb.cc:
New handlerton methods
sql/ha_myisam.cc:
New handlerton methods
sql/ha_myisammrg.cc:
New handlerton methods
sql/ha_ndbcluster.cc:
New handlerton methods
Moved out packfrm and unpackfrm methods
Adapted many parts to use table_share instead of table->s
Ensured that .ndb file uses filename and not tablename
according to new encoding of names (WL 1324)
All NDB tables are partitioned and set up partition info
Fixed such that tablenames use tablenames and not filenames in NDB
NDB uses auto partitioning for ENGINE=NDB tables
Warning for very large tables
Set RANGE data
Set LIST data
New method to set-up partition info
Set Default number of partitions flag
Set linear hash flag
Set node group array
Set number of fragments
Set max rows
Set tablespace names
New method to get number of partitions of table to use at open table
sql/ha_ndbcluster.h:
Removed partition_flags and alter_table_flags from handler class
A couple of new and changed method headers
sql/ha_ndbcluster_binlog.cc:
Use new method headers
sql/ha_partition.cc:
New handlerton methods
Lots of new function headers
Use #P# as separator between table name and partition name and
#SP# as separator between partition name and subpartition name
Use filename encoding for files both of table name part and of
partition name parts
New method to drop partitions based on partition state
New method to rename partitions based on partition state
New methods to optimize, analyze, check and repair partitions
New methods to optimize, analyze, check and repair table
Helper method to create new partition, open it and external lock
it, not needed to lock it internally since no one else knows about
it yet.
Cleanup method at error for new partitions
New methods to perform bulk of work at ADD/REORGANIZE partitions
(change_partitions, copy_partitions)
sql/ha_partition.h:
New methods and variables
A few dropped ones and a few changed ones
sql/handler.cc:
Handlerton interface changes
New flag to open_table_from_share
sql/handler.h:
New alter_table_flags
New partition flags
New partition states
More states for default handling
Lots of new, dropped and changed interfaces
sql/lex.h:
Added REBUILD and changed name of REORGANISE to REORGANIZE
sql/lock.cc:
Method to downgrade locks
Able to specify if locks upgraded on abort locks
sql/log.cc:
New handlerton methods
sql/mysql_priv.h:
Lots of new interfaces
sql/share/errmsg.txt:
Lots of new, dropped and changed error messages
sql/sql_base.cc:
Adapted to new method headers
New method to abort and upgrade lock
New method to close open tables and downgrade lock
New method to wait for completed table
sql/sql_lex.h:
New flags
sql/sql_partition.cc:
Return int instead of bool in get_partition_id
More defaults handling
Make use of new mem_alloc_error method
More work on function headers
Changes to generate partition syntax to cater for intermediate
partition states
Lots of new code with large comments describing new features for
Partition Management:
ADD/DROP/REORGANIZE/OPTIMIZE/ANALYZE/CHECK/REPAIR partitions
sql/sql_show.cc:
Minors
sql/sql_table.cc:
Moved a couple of methods
New methods to copy create lists and key lists
for use with mysql_prepare_table
New method to write frm file
New handling of handlers with auto partitioning
Fix CREATE TABLE LIKE
Moved code for ADD/DROP/REORGANIZE partitions
Use handlerton method for alter_table_flags
sql/sql_yacc.yy:
More memory alloc error checks
New syntax for REBUILD, ANALYZE, CHECK, OPTIMIZE, REPAIR partitions
sql/table.cc:
Fix length of extra part to be 4 bytes
Partition state introduced in frm file
sql/table.h:
Partition state introduced
sql/unireg.cc:
Partition state introduced
Default partition
storage/csv/ha_tina.cc:
New handlerton methods
storage/example/ha_example.cc:
New handlerton methods
storage/ndb/include/kernel/ndb_limits.h:
RANGE DATA
storage/ndb/include/kernel/signaldata/AlterTable.hpp:
New interfaces in ALTER TABLE towards NDB kernel
storage/ndb/include/kernel/signaldata/DiAddTab.hpp:
New section
storage/ndb/include/kernel/signaldata/DictTabInfo.hpp:
Lots of new parts of table description
storage/ndb/include/kernel/signaldata/LqhFrag.hpp:
tablespace id specified in LQHFRAGREQ
storage/ndb/include/ndbapi/NdbDictionary.hpp:
Lots of new methods in NDB dictionary
storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
New error insertion
storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp:
a few extra jam's
storage/ndb/src/ndbapi/NdbBlob.cpp:
Changes to definition of blob tables
storage/ndb/src/ndbapi/NdbDictionary.cpp:
Lots of new stuff in NDB dictionary
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
Lots of new stuff in NDB dictionary
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp:
Lots of new stuff in NDB dictionary
storage/ndb/test/ndbapi/test_event.cpp:
removed use of methods no longer in existence
storage/ndb/tools/restore/Restore.cpp:
Renamed variable
2006-01-17 08:40:00 +01:00
|
|
|
handler **m_new_file; // Array of references to new handlers
|
|
|
|
handler **m_reorged_file; // Reorganised partitions
|
|
|
|
handler **m_added_file; // Added parts kept for errors
|
2017-04-23 18:39:57 +02:00
|
|
|
LEX_CSTRING *m_connect_string;
|
2005-07-18 13:31:02 +02:00
|
|
|
partition_info *m_part_info; // local reference to partition
|
|
|
|
Field **m_part_field_array; // Part field array locally to save acc
|
2008-10-10 12:01:01 +02:00
|
|
|
uchar *m_ordered_rec_buffer; // Row and key buffer for ord. idx scan
|
2017-09-25 23:56:10 +02:00
|
|
|
st_partition_ft_info *ft_first;
|
|
|
|
st_partition_ft_info *ft_current;
|
2008-10-10 12:01:01 +02:00
|
|
|
/*
|
|
|
|
Current index.
|
|
|
|
When used in key_rec_cmp: If clustered pk, index compare
|
|
|
|
must compare pk if given index is same for two rows.
|
|
|
|
So normally m_curr_key_info[0]= current index and m_curr_key[1]= NULL,
|
|
|
|
and if clustered pk, [0]= current index, [1]= pk, [2]= NULL
|
|
|
|
*/
|
|
|
|
KEY *m_curr_key_info[3]; // Current index
|
|
|
|
uchar *m_rec0; // table->record[0]
|
2013-11-28 12:10:44 +01:00
|
|
|
const uchar *m_err_rec; // record which gave error
|
WL #2604: Partition Management
Optimised version of ADD/DROP/REORGANIZE partitions for
non-NDB storage engines.
New syntax to handle REBUILD/OPTIMIZE/ANALYZE/CHECK/REPAIR partitions
Quite a few bug fixes
include/thr_lock.h:
New method to downgrade locks from TL_WRITE_ONLY
Possibility to upgrade lock while aborting locks
mysql-test/r/ndb_autodiscover.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_bitfield.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_gis.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_partition_key.result:
New test case
mysql-test/r/partition.result:
New test case
mysql-test/r/partition_error.result:
New test case
mysql-test/r/partition_mgm_err.result:
Fix of test case results
mysql-test/t/disabled.def:
partition_03ndb still has bug
mysql-test/t/ndb_partition_key.test:
New test cases for new functionality and bugs
mysql-test/t/partition.test:
New test cases for new functionality and bugs
mysql-test/t/partition_error.test:
New test cases for new functionality and bugs
mysql-test/t/partition_mgm_err.test:
New test cases for new functionality and bugs
mysys/thr_lock.c:
New method to downgrade TL_WRITE_ONLY locks
Possibility to specify if locks are to be upgraded at abort locks
sql/ha_archive.cc:
New handlerton methods
sql/ha_berkeley.cc:
New handlerton methods
sql/ha_blackhole.cc:
New handlerton methods
sql/ha_federated.cc:
New handlerton methods
sql/ha_heap.cc:
New handlerton methods
sql/ha_innodb.cc:
New handlerton methods
sql/ha_myisam.cc:
New handlerton methods
sql/ha_myisammrg.cc:
New handlerton methods
sql/ha_ndbcluster.cc:
New handlerton methods
Moved out packfrm and unpackfrm methods
Adapted many parts to use table_share instead of table->s
Ensured that .ndb file uses filename and not tablename
according to new encoding of names (WL 1324)
All NDB tables are partitioned and set up partition info
Fixed such that tablenames use tablenames and not filenames in NDB
NDB uses auto partitioning for ENGINE=NDB tables
Warning for very large tables
Set RANGE data
Set LIST data
New method to set-up partition info
Set Default number of partitions flag
Set linear hash flag
Set node group array
Set number of fragments
Set max rows
Set tablespace names
New method to get number of partitions of table to use at open table
sql/ha_ndbcluster.h:
Removed partition_flags and alter_table_flags from handler class
A couple of new and changed method headers
sql/ha_ndbcluster_binlog.cc:
Use new method headers
sql/ha_partition.cc:
New handlerton methods
Lots of new function headers
Use #P# as separator between table name and partition name and
#SP# as separator between partition name and subpartition name
Use filename encoding for files both of table name part and of
partition name parts
New method to drop partitions based on partition state
New method to rename partitions based on partition state
New methods to optimize, analyze, check and repair partitions
New methods to optimize, analyze, check and repair table
Helper method to create new partition, open it and external lock
it, not needed to lock it internally since no one else knows about
it yet.
Cleanup method at error for new partitions
New methods to perform bulk of work at ADD/REORGANIZE partitions
(change_partitions, copy_partitions)
sql/ha_partition.h:
New methods and variables
A few dropped ones and a few changed ones
sql/handler.cc:
Handlerton interface changes
New flag to open_table_from_share
sql/handler.h:
New alter_table_flags
New partition flags
New partition states
More states for default handling
Lots of new, dropped and changed interfaces
sql/lex.h:
Added REBUILD and changed name of REORGANISE to REORGANIZE
sql/lock.cc:
Method to downgrade locks
Able to specify if locks upgraded on abort locks
sql/log.cc:
New handlerton methods
sql/mysql_priv.h:
Lots of new interfaces
sql/share/errmsg.txt:
Lots of new, dropped and changed error messages
sql/sql_base.cc:
Adapted to new method headers
New method to abort and upgrade lock
New method to close open tables and downgrade lock
New method to wait for completed table
sql/sql_lex.h:
New flags
sql/sql_partition.cc:
Return int instead of bool in get_partition_id
More defaults handling
Make use of new mem_alloc_error method
More work on function headers
Changes to generate partition syntax to cater for intermediate
partition states
Lots of new code with large comments describing new features for
Partition Management:
ADD/DROP/REORGANIZE/OPTIMIZE/ANALYZE/CHECK/REPAIR partitions
sql/sql_show.cc:
Minors
sql/sql_table.cc:
Moved a couple of methods
New methods to copy create lists and key lists
for use with mysql_prepare_table
New method to write frm file
New handling of handlers with auto partitioning
Fix CREATE TABLE LIKE
Moved code for ADD/DROP/REORGANIZE partitions
Use handlerton method for alter_table_flags
sql/sql_yacc.yy:
More memory alloc error checks
New syntax for REBUILD, ANALYZE, CHECK, OPTIMIZE, REPAIR partitions
sql/table.cc:
Fix length of extra part to be 4 bytes
Partition state introduced in frm file
sql/table.h:
Partition state introduced
sql/unireg.cc:
Partition state introduced
Default partition
storage/csv/ha_tina.cc:
New handlerton methods
storage/example/ha_example.cc:
New handlerton methods
storage/ndb/include/kernel/ndb_limits.h:
RANGE DATA
storage/ndb/include/kernel/signaldata/AlterTable.hpp:
New interfaces in ALTER TABLE towards NDB kernel
storage/ndb/include/kernel/signaldata/DiAddTab.hpp:
New section
storage/ndb/include/kernel/signaldata/DictTabInfo.hpp:
Lots of new parts of table description
storage/ndb/include/kernel/signaldata/LqhFrag.hpp:
tablespace id specified in LQHFRAGREQ
storage/ndb/include/ndbapi/NdbDictionary.hpp:
Lots of new methods in NDB dictionary
storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
New error insertion
storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp:
a few extra jam's
storage/ndb/src/ndbapi/NdbBlob.cpp:
Changes to definition of blob tables
storage/ndb/src/ndbapi/NdbDictionary.cpp:
Lots of new stuff in NDB dictionary
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
Lots of new stuff in NDB dictionary
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp:
Lots of new stuff in NDB dictionary
storage/ndb/test/ndbapi/test_event.cpp:
removed use of methods no longer in existence
storage/ndb/tools/restore/Restore.cpp:
Renamed variable
2006-01-17 08:40:00 +01:00
|
|
|
QUEUE m_queue; // Prio queue used by sorted read
|
2014-03-11 16:45:08 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
Length of an element in m_ordered_rec_buffer. The elements are composed of
|
|
|
|
|
|
|
|
[part_no] [table->record copy] [underlying_table_rowid]
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
|
2014-03-11 16:45:08 +01:00
|
|
|
underlying_table_rowid is only stored when the table has no extended keys.
|
|
|
|
*/
|
2018-02-06 13:55:58 +01:00
|
|
|
size_t m_priority_queue_rec_len;
|
2014-03-11 16:45:08 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
If true, then sorting records by key value also sorts them by their
|
|
|
|
underlying_table_rowid.
|
|
|
|
*/
|
|
|
|
bool m_using_extended_keys;
|
|
|
|
|
2005-07-18 13:31:02 +02:00
|
|
|
/*
|
|
|
|
Since the partition handler is a handler on top of other handlers, it
|
|
|
|
is necessary to keep information about what the underlying handler
|
|
|
|
characteristics is. It is not possible to keep any handler instances
|
|
|
|
for this since the MySQL Server sometimes allocating the handler object
|
|
|
|
without freeing them.
|
|
|
|
*/
|
2008-10-29 21:20:04 +01:00
|
|
|
enum enum_handler_status
|
|
|
|
{
|
|
|
|
handler_not_initialized= 0,
|
|
|
|
handler_initialized,
|
|
|
|
handler_opened,
|
|
|
|
handler_closed
|
|
|
|
};
|
|
|
|
enum_handler_status m_handler_status;
|
2005-07-18 13:31:02 +02:00
|
|
|
|
WL #2604: Partition Management
Optimised version of ADD/DROP/REORGANIZE partitions for
non-NDB storage engines.
New syntax to handle REBUILD/OPTIMIZE/ANALYZE/CHECK/REPAIR partitions
Quite a few bug fixes
include/thr_lock.h:
New method to downgrade locks from TL_WRITE_ONLY
Possibility to upgrade lock while aborting locks
mysql-test/r/ndb_autodiscover.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_bitfield.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_gis.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_partition_key.result:
New test case
mysql-test/r/partition.result:
New test case
mysql-test/r/partition_error.result:
New test case
mysql-test/r/partition_mgm_err.result:
Fix of test case results
mysql-test/t/disabled.def:
partition_03ndb still has bug
mysql-test/t/ndb_partition_key.test:
New test cases for new functionality and bugs
mysql-test/t/partition.test:
New test cases for new functionality and bugs
mysql-test/t/partition_error.test:
New test cases for new functionality and bugs
mysql-test/t/partition_mgm_err.test:
New test cases for new functionality and bugs
mysys/thr_lock.c:
New method to downgrade TL_WRITE_ONLY locks
Possibility to specify if locks are to be upgraded at abort locks
sql/ha_archive.cc:
New handlerton methods
sql/ha_berkeley.cc:
New handlerton methods
sql/ha_blackhole.cc:
New handlerton methods
sql/ha_federated.cc:
New handlerton methods
sql/ha_heap.cc:
New handlerton methods
sql/ha_innodb.cc:
New handlerton methods
sql/ha_myisam.cc:
New handlerton methods
sql/ha_myisammrg.cc:
New handlerton methods
sql/ha_ndbcluster.cc:
New handlerton methods
Moved out packfrm and unpackfrm methods
Adapted many parts to use table_share instead of table->s
Ensured that .ndb file uses filename and not tablename
according to new encoding of names (WL 1324)
All NDB tables are partitioned and set up partition info
Fixed such that tablenames use tablenames and not filenames in NDB
NDB uses auto partitioning for ENGINE=NDB tables
Warning for very large tables
Set RANGE data
Set LIST data
New method to set-up partition info
Set Default number of partitions flag
Set linear hash flag
Set node group array
Set number of fragments
Set max rows
Set tablespace names
New method to get number of partitions of table to use at open table
sql/ha_ndbcluster.h:
Removed partition_flags and alter_table_flags from handler class
A couple of new and changed method headers
sql/ha_ndbcluster_binlog.cc:
Use new method headers
sql/ha_partition.cc:
New handlerton methods
Lots of new function headers
Use #P# as separator between table name and partition name and
#SP# as separator between partition name and subpartition name
Use filename encoding for files both of table name part and of
partition name parts
New method to drop partitions based on partition state
New method to rename partitions based on partition state
New methods to optimize, analyze, check and repair partitions
New methods to optimize, analyze, check and repair table
Helper method to create new partition, open it and external lock
it, not needed to lock it internally since no one else knows about
it yet.
Cleanup method at error for new partitions
New methods to perform bulk of work at ADD/REORGANIZE partitions
(change_partitions, copy_partitions)
sql/ha_partition.h:
New methods and variables
A few dropped ones and a few changed ones
sql/handler.cc:
Handlerton interface changes
New flag to open_table_from_share
sql/handler.h:
New alter_table_flags
New partition flags
New partition states
More states for default handling
Lots of new, dropped and changed interfaces
sql/lex.h:
Added REBUILD and changed name of REORGANISE to REORGANIZE
sql/lock.cc:
Method to downgrade locks
Able to specify if locks upgraded on abort locks
sql/log.cc:
New handlerton methods
sql/mysql_priv.h:
Lots of new interfaces
sql/share/errmsg.txt:
Lots of new, dropped and changed error messages
sql/sql_base.cc:
Adapted to new method headers
New method to abort and upgrade lock
New method to close open tables and downgrade lock
New method to wait for completed table
sql/sql_lex.h:
New flags
sql/sql_partition.cc:
Return int instead of bool in get_partition_id
More defaults handling
Make use of new mem_alloc_error method
More work on function headers
Changes to generate partition syntax to cater for intermediate
partition states
Lots of new code with large comments describing new features for
Partition Management:
ADD/DROP/REORGANIZE/OPTIMIZE/ANALYZE/CHECK/REPAIR partitions
sql/sql_show.cc:
Minors
sql/sql_table.cc:
Moved a couple of methods
New methods to copy create lists and key lists
for use with mysql_prepare_table
New method to write frm file
New handling of handlers with auto partitioning
Fix CREATE TABLE LIKE
Moved code for ADD/DROP/REORGANIZE partitions
Use handlerton method for alter_table_flags
sql/sql_yacc.yy:
More memory alloc error checks
New syntax for REBUILD, ANALYZE, CHECK, OPTIMIZE, REPAIR partitions
sql/table.cc:
Fix length of extra part to be 4 bytes
Partition state introduced in frm file
sql/table.h:
Partition state introduced
sql/unireg.cc:
Partition state introduced
Default partition
storage/csv/ha_tina.cc:
New handlerton methods
storage/example/ha_example.cc:
New handlerton methods
storage/ndb/include/kernel/ndb_limits.h:
RANGE DATA
storage/ndb/include/kernel/signaldata/AlterTable.hpp:
New interfaces in ALTER TABLE towards NDB kernel
storage/ndb/include/kernel/signaldata/DiAddTab.hpp:
New section
storage/ndb/include/kernel/signaldata/DictTabInfo.hpp:
Lots of new parts of table description
storage/ndb/include/kernel/signaldata/LqhFrag.hpp:
tablespace id specified in LQHFRAGREQ
storage/ndb/include/ndbapi/NdbDictionary.hpp:
Lots of new methods in NDB dictionary
storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
New error insertion
storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp:
a few extra jam's
storage/ndb/src/ndbapi/NdbBlob.cpp:
Changes to definition of blob tables
storage/ndb/src/ndbapi/NdbDictionary.cpp:
Lots of new stuff in NDB dictionary
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
Lots of new stuff in NDB dictionary
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp:
Lots of new stuff in NDB dictionary
storage/ndb/test/ndbapi/test_event.cpp:
removed use of methods no longer in existence
storage/ndb/tools/restore/Restore.cpp:
Renamed variable
2006-01-17 08:40:00 +01:00
|
|
|
uint m_reorged_parts; // Number of reorganised parts
|
2005-07-18 13:31:02 +02:00
|
|
|
uint m_tot_parts; // Total number of partitions;
|
2009-10-01 15:04:42 +02:00
|
|
|
uint m_num_locks; // For engines like ha_blackhole, which needs no locks
|
2008-12-16 12:44:18 +01:00
|
|
|
uint m_last_part; // Last file that we update,write,read
|
2005-07-18 13:31:02 +02:00
|
|
|
part_id_range m_part_spec; // Which parts to scan
|
|
|
|
uint m_scan_value; // Value passed in rnd_init
|
|
|
|
// call
|
|
|
|
uint m_ref_length; // Length of position in this
|
|
|
|
// handler object
|
|
|
|
key_range m_start_key; // index read key range
|
|
|
|
enum partition_index_scan_type m_index_scan_type;// What type of index
|
|
|
|
// scan
|
|
|
|
uint m_top_entry; // Which partition is to
|
|
|
|
// deliver next result
|
|
|
|
uint m_rec_length; // Local copy of record length
|
|
|
|
|
|
|
|
bool m_ordered; // Ordered/Unordered index scan
|
|
|
|
bool m_create_handler; // Handler used to create table
|
|
|
|
bool m_is_sub_partitioned; // Is subpartitioned
|
|
|
|
bool m_ordered_scan_ongoing;
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
bool m_rnd_init_and_first;
|
2017-09-25 23:56:10 +02:00
|
|
|
bool m_ft_init_and_first;
|
2005-07-18 13:31:02 +02:00
|
|
|
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
/*
|
2011-03-25 12:36:02 +01:00
|
|
|
If set, this object was created with ha_partition::clone and doesn't
|
|
|
|
"own" the m_part_info structure.
|
|
|
|
*/
|
|
|
|
ha_partition *m_is_clone_of;
|
|
|
|
MEM_ROOT *m_clone_mem_root;
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
|
2005-07-18 13:31:02 +02:00
|
|
|
/*
|
|
|
|
We keep track if all underlying handlers are MyISAM since MyISAM has a
|
|
|
|
great number of extra flags not needed by other handlers.
|
|
|
|
*/
|
|
|
|
bool m_myisam; // Are all underlying handlers
|
|
|
|
// MyISAM
|
|
|
|
/*
|
|
|
|
We keep track of InnoDB handlers below since it requires proper setting
|
|
|
|
of query_id in fields at index_init and index_read calls.
|
|
|
|
*/
|
|
|
|
bool m_innodb; // Are all underlying handlers
|
|
|
|
// InnoDB
|
|
|
|
/*
|
|
|
|
When calling extra(HA_EXTRA_CACHE) we do not pass this to the underlying
|
|
|
|
handlers immediately. Instead we cache it and call the underlying
|
|
|
|
immediately before starting the scan on the partition. This is to
|
|
|
|
prevent allocating a READ CACHE for each partition in parallel when
|
|
|
|
performing a full table scan on MyISAM partitioned table.
|
|
|
|
This state is cleared by extra(HA_EXTRA_NO_CACHE).
|
|
|
|
*/
|
|
|
|
bool m_extra_cache;
|
|
|
|
uint m_extra_cache_size;
|
2010-08-10 10:43:12 +02:00
|
|
|
/* The same goes for HA_EXTRA_PREPARE_FOR_UPDATE */
|
|
|
|
bool m_extra_prepare_for_update;
|
2010-09-07 17:56:43 +02:00
|
|
|
/* Which partition has active cache */
|
|
|
|
uint m_extra_cache_part_id;
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
void init_handler_variables();
|
|
|
|
/*
|
|
|
|
Variables for lock structures.
|
|
|
|
*/
|
|
|
|
|
Bug#38804: Query deadlock causes all tables to be inaccessible.
Problem was a mutex added in bug n 27405 for solving a problem
with auto_increment in partitioned innodb tables.
(in ha_partition::write_row over partitions file->ha_write_row)
Solution is to use the patch for bug#33479, which refines the
usage of mutexes for auto_increment.
Backport of bug-33479 from 6.0:
Bug-33479: auto_increment failures in partitioning
Several problems with auto_increment in partitioning
(with MyISAM, InnoDB. Locking issues, not handling
multi-row INSERTs properly etc.)
Changed the auto_increment handling for partitioning:
Added a ha_data variable in table_share for storage engine specific data
such as auto_increment value handling in partitioning, also see WL 4305
and using the ha_data->mutex to lock around read + update.
The idea is this:
Store the table's reserved auto_increment value in
the TABLE_SHARE and use a mutex to, lock it for reading and updating it
and unlocking it, in one block. Only accessing all partitions
when it is not initialized.
Also allow reservations of ranges, and if no one has done a reservation
afterwards, lower the reservation to what was actually used after
the statement is done (via release_auto_increment from WL 3146).
The lock is kept from the first reservation if it is statement based
replication and a multi-row INSERT statement where the number of
candidate rows to insert is not known in advance (like INSERT SELECT,
LOAD DATA, unlike INSERT VALUES (row1), (row2),,(rowN)).
This should also lead to better concurrancy (no need to have a mutex
protection around write_row in all cases)
and work with any local storage engine.
mysql-test/suite/parts/inc/partition_auto_increment.inc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Test source file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_archive.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_innodb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_memory.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_ndb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_archive.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_blackhole.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_innodb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_memory.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_myisam.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_ndb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
sql/ha_partition.cc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Changed ha_partition::get_auto_increment from file->get_auto_increment
to file->info(HA_AUTO_STATUS), since it is works better with InnoDB
(InnoDB can have issues with partitioning and auto_increment,
where get_auto_increment sometimes can return a non updated value.)
Using the new table_share->ha_data for keeping the auto_increment
value, shared by all instances of the same table.
It is read+updated when holding a auto_increment specific mutex.
Also added release_auto_increment to decrease gaps if possible.
And a lock for multi-row INSERT statements where the number of candidate
rows to insert is not known in advance (like INSERT SELECT, LOAD DATA;
Unlike INSERT INTO (row1),(row2),,(rowN)).
Fixed a small bug, copied++ to (*copied)++ and the same for deleted.
Changed from current_thd, to ha_thd()
sql/ha_partition.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a new struct HA_DATA_PARTITION to be used in table_share->ha_data
Added a private function to set auto_increment values if needed
Removed the restore_auto_increment (the hander version is better)
Added lock/unlock functions for auto_increment handling.
Changed copied/deleted to const.
sql/handler.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Added const for changed_partitions
Added comments about SQLCOM_TRUNCATE for delete_all_rows
sql/table.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a variable in table_share: ha_data for storage of storage engine
specific data (such as auto_increment handling in partitioning).
2008-09-08 15:30:01 +02:00
|
|
|
bool auto_increment_lock; /**< lock reading/updating auto_inc */
|
|
|
|
/**
|
|
|
|
Flag to keep the auto_increment lock through out the statement.
|
|
|
|
This to ensure it will work with statement based replication.
|
|
|
|
*/
|
|
|
|
bool auto_increment_safe_stmt_log_lock;
|
2009-09-04 15:02:15 +02:00
|
|
|
/** For optimizing ha_start_bulk_insert calls */
|
|
|
|
MY_BITMAP m_bulk_insert_started;
|
|
|
|
ha_rows m_bulk_inserted_rows;
|
|
|
|
/** used for prediction of start_bulk_insert rows */
|
|
|
|
enum_monotonicity_info m_part_func_monotonicity_info;
|
2017-11-16 10:11:52 +01:00
|
|
|
part_id_range m_direct_update_part_spec;
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
bool m_pre_calling;
|
|
|
|
bool m_pre_call_use_parallel;
|
2017-09-25 23:56:10 +02:00
|
|
|
/* Keep track of bulk access requests */
|
|
|
|
bool bulk_access_executing;
|
|
|
|
|
2013-06-15 17:32:08 +02:00
|
|
|
/** keep track of locked partitions */
|
|
|
|
MY_BITMAP m_locked_partitions;
|
|
|
|
/** Stores shared auto_increment etc. */
|
|
|
|
Partition_share *part_share;
|
2019-11-29 00:22:13 +01:00
|
|
|
void sum_copy_info(handler *file);
|
|
|
|
void sum_copy_infos();
|
2020-02-28 13:01:27 +01:00
|
|
|
void reset_copy_info() override;
|
2013-06-15 17:32:08 +02:00
|
|
|
/** Temporary storage for new partitions Handler_shares during ALTER */
|
|
|
|
List<Parts_share_refs> m_new_partitions_share_refs;
|
2012-02-22 23:13:36 +01:00
|
|
|
/** Sorted array of partition ids in descending order of number of rows. */
|
|
|
|
uint32 *m_part_ids_sorted_by_num_of_records;
|
|
|
|
/* Compare function for my_qsort2, for reversed order. */
|
|
|
|
static int compare_number_of_records(ha_partition *me,
|
|
|
|
const uint32 *a,
|
|
|
|
const uint32 *b);
|
2013-06-15 17:32:08 +02:00
|
|
|
/** keep track of partitions to call ha_reset */
|
|
|
|
MY_BITMAP m_partitions_to_reset;
|
2012-09-10 13:32:50 +02:00
|
|
|
/** partitions that returned HA_ERR_KEY_NOT_FOUND. */
|
|
|
|
MY_BITMAP m_key_not_found_partitions;
|
|
|
|
bool m_key_not_found;
|
2018-01-29 08:01:14 +01:00
|
|
|
List<String> *m_partitions_to_open;
|
|
|
|
MY_BITMAP m_opened_partitions;
|
2018-02-13 15:06:15 +01:00
|
|
|
/** This is one of the m_file-s that it guaranteed to be opened. */
|
|
|
|
/** It is set in open_read_partitions() */
|
|
|
|
handler *m_file_sample;
|
2005-07-18 13:31:02 +02:00
|
|
|
public:
|
2016-12-05 11:17:52 +01:00
|
|
|
handler **get_child_handlers()
|
|
|
|
{
|
|
|
|
return m_file;
|
|
|
|
}
|
2020-03-02 18:50:40 +01:00
|
|
|
ha_partition *get_clone_source()
|
|
|
|
{
|
|
|
|
return m_is_clone_of;
|
|
|
|
}
|
2017-11-28 22:42:51 +01:00
|
|
|
virtual part_id_range *get_part_spec()
|
|
|
|
{
|
|
|
|
return &m_part_spec;
|
|
|
|
}
|
|
|
|
virtual uint get_no_current_part_id()
|
|
|
|
{
|
|
|
|
return NO_CURRENT_PART_ID;
|
|
|
|
}
|
2013-06-15 17:32:08 +02:00
|
|
|
Partition_share *get_part_share() { return part_share; }
|
2020-02-28 13:01:27 +01:00
|
|
|
handler *clone(const char *name, MEM_ROOT *mem_root) override;
|
2020-08-19 01:53:22 +02:00
|
|
|
void set_part_info(partition_info *part_info) override
|
Table definition cache, part 2
The table opening process now works the following way:
- Create common TABLE_SHARE object
- Read the .frm file and unpack it into the TABLE_SHARE object
- Create a TABLE object based on the information in the TABLE_SHARE
object and open a handler to the table object
Other noteworthy changes:
- In TABLE_SHARE the most common strings are now LEX_STRING's
- Better error message when table is not found
- Variable table_cache is now renamed 'table_open_cache'
- New variable 'table_definition_cache' that is the number of table defintions that will be cached
- strxnmov() calls are now fixed to avoid overflows
- strxnmov() will now always add one end \0 to result
- engine objects are now created with a TABLE_SHARE object instead of a TABLE object.
- After creating a field object one must call field->init(table) before using it
- For a busy system this change will give you:
- Less memory usage for table object
- Faster opening of tables (if it's has been in use or is in table definition cache)
- Allow you to cache many table definitions objects
- Faster drop of table
mysql-test/mysql-test-run.sh:
Fixed some problems with --gdb option
Test both with socket and tcp/ip port that all old servers are killed
mysql-test/r/flush_table.result:
More tests with lock table with 2 threads + flush table
mysql-test/r/information_schema.result:
Removed old (now wrong) result
mysql-test/r/innodb.result:
Better error messages (thanks to TDC patch)
mysql-test/r/merge.result:
Extra flush table test
mysql-test/r/ndb_bitfield.result:
Better error messages (thanks to TDC patch)
mysql-test/r/ndb_partition_error.result:
Better error messages (thanks to TDC patch)
mysql-test/r/query_cache.result:
Remove tables left from old tests
mysql-test/r/temp_table.result:
Test truncate with temporary tables
mysql-test/r/variables.result:
Table_cache -> Table_open_cache
mysql-test/t/flush_table.test:
More tests with lock table with 2 threads + flush table
mysql-test/t/merge.test:
Extra flush table test
mysql-test/t/multi_update.test:
Added 'sleep' to make test predictable
mysql-test/t/query_cache.test:
Remove tables left from old tests
mysql-test/t/temp_table.test:
Test truncate with temporary tables
mysql-test/t/variables.test:
Table_cache -> Table_open_cache
mysql-test/valgrind.supp:
Remove warning that may happens becasue threads dies in different order
mysys/hash.c:
Fixed wrong DBUG_PRINT
mysys/mf_dirname.c:
More DBUG
mysys/mf_pack.c:
Better comment
mysys/mf_tempdir.c:
More DBUG
Ensure that we call cleanup_dirname() on all temporary directory paths.
If we don't do this, we will get a failure when comparing temporary table
names as in some cases the temporary table name is run through convert_dirname())
mysys/my_alloc.c:
Indentation fix
sql/examples/ha_example.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/examples/ha_example.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/examples/ha_tina.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/examples/ha_tina.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/field.cc:
Update for table definition cache:
- Field creation now takes TABLE_SHARE instead of TABLE as argument
(This is becasue field definitions are now cached in TABLE_SHARE)
When a field is created, one now must call field->init(TABLE) before using it
- Use s->db instead of s->table_cache_key
- Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE
- make_field() takes TABLE_SHARE as argument instead of TABLE
- move_field() -> move_field_offset()
sql/field.h:
Update for table definition cache:
- Field creation now takes TABLE_SHARE instead of TABLE as argument
(This is becasue field definitions are now cached in TABLE_SHARE)
When a field is created, one now must call field->init(TABLE) before using it
- Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE
- make_field() takes TABLE_SHARE as argument instead of TABLE
- move_field() -> move_field_offset()
sql/ha_archive.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_archive.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_berkeley.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
Changed name of argument create() to not hide internal 'table' variable.
table->s -> table_share
sql/ha_berkeley.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_blackhole.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_blackhole.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_federated.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
Fixed comments
Remove index variable and replace with pointers (simple optimization)
move_field() -> move_field_offset()
Removed some strlen() calls
sql/ha_federated.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_heap.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
Simplify delete_table() and create() as the given file names are now without extension
sql/ha_heap.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_innodb.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_innodb.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_myisam.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
Remove not needed fn_format()
Fixed for new table->s structure
sql/ha_myisam.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_myisammrg.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
Don't set 'is_view' for MERGE tables
Use new interface to find_temporary_table()
sql/ha_myisammrg.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
Added flag HA_NO_COPY_ON_ALTER
sql/ha_ndbcluster.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
Fixed wrong calls to strxnmov()
Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed
drop_table -> intern_drop_table()
table->s -> table_share
Move part_info to TABLE
Fixed comments & DBUG print's
New arguments to print_error()
sql/ha_ndbcluster.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_partition.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
We can't set up or use part_info when creating handler as there is not yet any table object
New ha_intialise() to work with TDC (Done by Mikael)
sql/ha_partition.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
Got set_part_info() from Mikael
sql/handler.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
ha_delete_table() now also takes database as an argument
handler::ha_open() now takes TABLE as argument
ha_open() now calls ha_allocate_read_write_set()
Simplify ha_allocate_read_write_set()
Remove ha_deallocate_read_write_set()
Use table_share (Cached by table definition cache)
sql/handler.h:
New table flag: HA_NO_COPY_ON_ALTER (used by merge tables)
Remove ha_deallocate_read_write_set()
get_new_handler() now takes TABLE_SHARE as argument
ha_delete_table() now gets database as argument
sql/item.cc:
table_name and db are now LEX_STRING objects
When creating fields, we have now have to call field->init(table)
move_field -> move_field_offset()
sql/item.h:
tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR
instead of BLOB
sql/item_cmpfunc.cc:
Fixed call to tmp_table_field_from_field_type()
sql/item_create.cc:
Assert if new not handled cast type
sql/item_func.cc:
When creating fields, we have now have to call field->init(table)
dummy_table used by 'sp' now needs a TABLE_SHARE object
sql/item_subselect.cc:
Trivial code cleanups
sql/item_sum.cc:
When creating fields, we have now have to call field->init(table)
sql/item_timefunc.cc:
Item_func_str_to_date::tmp_table_field() now replaced by call to
tmp_table_field_from_field_type() (see item_timefunc.h)
sql/item_timefunc.h:
Simply tmp_table_field()
sql/item_uniq.cc:
When creating fields, we have now have to call field->init(table)
sql/key.cc:
Added 'KEY' argument to 'find_ref_key' to simplify code
sql/lock.cc:
More debugging
Use create_table_def_key() to create key for table cache
Allocate TABLE_SHARE properly when creating name lock
Fix that locked_table_name doesn't test same table twice
sql/mysql_priv.h:
New functions for table definition cache
New interfaces to a lot of functions.
New faster interface to find_temporary_table() and close_temporary_table()
sql/mysqld.cc:
Added support for table definition cache of size 'table_def_size'
Fixed som calls to strnmov()
Changed name of 'table_cache' to 'table_open_cache'
sql/opt_range.cc:
Use new interfaces
Fixed warnings from valgrind
sql/parse_file.cc:
Safer calls to strxnmov()
Fixed typo
sql/set_var.cc:
Added variable 'table_definition_cache'
Variable table_cache renamed to 'table_open_cache'
sql/slave.cc:
Use new interface
sql/sp.cc:
Proper use of TABLE_SHARE
sql/sp_head.cc:
Remove compiler warnings
We have now to call field->init(table)
sql/sp_head.h:
Pointers to parsed strings are now const
sql/sql_acl.cc:
table_name is now a LEX_STRING
sql/sql_base.cc:
Main implementation of table definition cache
(The #ifdef's are there for the future when table definition cache will replace open table cache)
Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places
Views are not yet cached; For the moment we only cache if a table is a view or not.
Faster implementation of find_temorary_table()
Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()'
Drop table is slightly faster as we can use the table definition cache to know the type of the table
sql/sql_cache.cc:
table_cache_key and table_name are now LEX_STRING
'sDBUG print fixes
sql/sql_class.cc:
table_cache_key is now a LEX_STRING
safer strxnmov()
sql/sql_class.h:
Added number of open table shares (table definitions)
sql/sql_db.cc:
safer strxnmov()
sql/sql_delete.cc:
Use new interface to find_temporary_table()
sql/sql_derived.cc:
table_name is now a LEX_STRING
sql/sql_handler.cc:
TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's
sql/sql_insert.cc:
TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's
sql/sql_lex.cc:
Make parsed string a const (to quickly find out if anything is trying to change the query string)
sql/sql_lex.h:
Make parsed string a const (to quickly find out if anything is trying to change the query string)
sql/sql_load.cc:
Safer strxnmov()
sql/sql_parse.cc:
Better error if wrong DB name
sql/sql_partition.cc:
part_info moved to TABLE from TABLE_SHARE
Indentation changes
sql/sql_select.cc:
Indentation fixes
Call field->init(TABLE) for new created fields
Update create_tmp_table() to use TABLE_SHARE properly
sql/sql_select.h:
Call field->init(TABLE) for new created fields
sql/sql_show.cc:
table_name is now a LEX_STRING
part_info moved to TABLE
sql/sql_table.cc:
Use table definition cache to speed up delete of tables
Fixed calls to functions with new interfaces
Don't use 'share_not_to_be_used'
Instead of doing openfrm() when doing repair, we now have to call
get_table_share() followed by open_table_from_share().
Replace some fn_format() with faster unpack_filename().
Safer strxnmov()
part_info is now in TABLE
Added Mikaels patch for partition and ALTER TABLE
Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER
sql/sql_test.cc:
table_name and table_cache_key are now LEX_STRING's
sql/sql_trigger.cc:
TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's
safer strxnmov()
Removed compiler warnings
sql/sql_update.cc:
Call field->init(TABLE) after field is created
sql/sql_view.cc:
safer strxnmov()
Create common TABLE_SHARE object for views to allow us to cache if table is a view
sql/structs.h:
Added SHOW_TABLE_DEFINITIONS
sql/table.cc:
Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects
The table opening process now works the following way:
- Create common TABLE_SHARE object
- Read the .frm file and unpack it into the TABLE_SHARE object
- Create a TABLE object based on the information in the TABLE_SHARE
object and open a handler to the table object
open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats
sql/table.h:
TABLE objects for the same database table now share a common TABLE_SHARE object
In TABLE_SHARE the most common strings are now LEX_STRING's
sql/unireg.cc:
Changed arguments to rea_create_table() to have same order as other functions
Call field->init(table) for new created fields
sql/unireg.h:
Added OPEN_VIEW
strings/strxnmov.c:
Change strxnmov() to always add end \0
This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
|
|
|
{
|
|
|
|
m_part_info= part_info;
|
2006-02-16 17:38:33 +01:00
|
|
|
m_is_sub_partitioned= part_info->is_sub_partitioned();
|
Table definition cache, part 2
The table opening process now works the following way:
- Create common TABLE_SHARE object
- Read the .frm file and unpack it into the TABLE_SHARE object
- Create a TABLE object based on the information in the TABLE_SHARE
object and open a handler to the table object
Other noteworthy changes:
- In TABLE_SHARE the most common strings are now LEX_STRING's
- Better error message when table is not found
- Variable table_cache is now renamed 'table_open_cache'
- New variable 'table_definition_cache' that is the number of table defintions that will be cached
- strxnmov() calls are now fixed to avoid overflows
- strxnmov() will now always add one end \0 to result
- engine objects are now created with a TABLE_SHARE object instead of a TABLE object.
- After creating a field object one must call field->init(table) before using it
- For a busy system this change will give you:
- Less memory usage for table object
- Faster opening of tables (if it's has been in use or is in table definition cache)
- Allow you to cache many table definitions objects
- Faster drop of table
mysql-test/mysql-test-run.sh:
Fixed some problems with --gdb option
Test both with socket and tcp/ip port that all old servers are killed
mysql-test/r/flush_table.result:
More tests with lock table with 2 threads + flush table
mysql-test/r/information_schema.result:
Removed old (now wrong) result
mysql-test/r/innodb.result:
Better error messages (thanks to TDC patch)
mysql-test/r/merge.result:
Extra flush table test
mysql-test/r/ndb_bitfield.result:
Better error messages (thanks to TDC patch)
mysql-test/r/ndb_partition_error.result:
Better error messages (thanks to TDC patch)
mysql-test/r/query_cache.result:
Remove tables left from old tests
mysql-test/r/temp_table.result:
Test truncate with temporary tables
mysql-test/r/variables.result:
Table_cache -> Table_open_cache
mysql-test/t/flush_table.test:
More tests with lock table with 2 threads + flush table
mysql-test/t/merge.test:
Extra flush table test
mysql-test/t/multi_update.test:
Added 'sleep' to make test predictable
mysql-test/t/query_cache.test:
Remove tables left from old tests
mysql-test/t/temp_table.test:
Test truncate with temporary tables
mysql-test/t/variables.test:
Table_cache -> Table_open_cache
mysql-test/valgrind.supp:
Remove warning that may happens becasue threads dies in different order
mysys/hash.c:
Fixed wrong DBUG_PRINT
mysys/mf_dirname.c:
More DBUG
mysys/mf_pack.c:
Better comment
mysys/mf_tempdir.c:
More DBUG
Ensure that we call cleanup_dirname() on all temporary directory paths.
If we don't do this, we will get a failure when comparing temporary table
names as in some cases the temporary table name is run through convert_dirname())
mysys/my_alloc.c:
Indentation fix
sql/examples/ha_example.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/examples/ha_example.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/examples/ha_tina.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/examples/ha_tina.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/field.cc:
Update for table definition cache:
- Field creation now takes TABLE_SHARE instead of TABLE as argument
(This is becasue field definitions are now cached in TABLE_SHARE)
When a field is created, one now must call field->init(TABLE) before using it
- Use s->db instead of s->table_cache_key
- Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE
- make_field() takes TABLE_SHARE as argument instead of TABLE
- move_field() -> move_field_offset()
sql/field.h:
Update for table definition cache:
- Field creation now takes TABLE_SHARE instead of TABLE as argument
(This is becasue field definitions are now cached in TABLE_SHARE)
When a field is created, one now must call field->init(TABLE) before using it
- Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE
- make_field() takes TABLE_SHARE as argument instead of TABLE
- move_field() -> move_field_offset()
sql/ha_archive.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_archive.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_berkeley.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
Changed name of argument create() to not hide internal 'table' variable.
table->s -> table_share
sql/ha_berkeley.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_blackhole.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_blackhole.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_federated.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
Fixed comments
Remove index variable and replace with pointers (simple optimization)
move_field() -> move_field_offset()
Removed some strlen() calls
sql/ha_federated.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_heap.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
Simplify delete_table() and create() as the given file names are now without extension
sql/ha_heap.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_innodb.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_innodb.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_myisam.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
Remove not needed fn_format()
Fixed for new table->s structure
sql/ha_myisam.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_myisammrg.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
Don't set 'is_view' for MERGE tables
Use new interface to find_temporary_table()
sql/ha_myisammrg.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
Added flag HA_NO_COPY_ON_ALTER
sql/ha_ndbcluster.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
Fixed wrong calls to strxnmov()
Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed
drop_table -> intern_drop_table()
table->s -> table_share
Move part_info to TABLE
Fixed comments & DBUG print's
New arguments to print_error()
sql/ha_ndbcluster.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_partition.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
We can't set up or use part_info when creating handler as there is not yet any table object
New ha_intialise() to work with TDC (Done by Mikael)
sql/ha_partition.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
Got set_part_info() from Mikael
sql/handler.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
ha_delete_table() now also takes database as an argument
handler::ha_open() now takes TABLE as argument
ha_open() now calls ha_allocate_read_write_set()
Simplify ha_allocate_read_write_set()
Remove ha_deallocate_read_write_set()
Use table_share (Cached by table definition cache)
sql/handler.h:
New table flag: HA_NO_COPY_ON_ALTER (used by merge tables)
Remove ha_deallocate_read_write_set()
get_new_handler() now takes TABLE_SHARE as argument
ha_delete_table() now gets database as argument
sql/item.cc:
table_name and db are now LEX_STRING objects
When creating fields, we have now have to call field->init(table)
move_field -> move_field_offset()
sql/item.h:
tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR
instead of BLOB
sql/item_cmpfunc.cc:
Fixed call to tmp_table_field_from_field_type()
sql/item_create.cc:
Assert if new not handled cast type
sql/item_func.cc:
When creating fields, we have now have to call field->init(table)
dummy_table used by 'sp' now needs a TABLE_SHARE object
sql/item_subselect.cc:
Trivial code cleanups
sql/item_sum.cc:
When creating fields, we have now have to call field->init(table)
sql/item_timefunc.cc:
Item_func_str_to_date::tmp_table_field() now replaced by call to
tmp_table_field_from_field_type() (see item_timefunc.h)
sql/item_timefunc.h:
Simply tmp_table_field()
sql/item_uniq.cc:
When creating fields, we have now have to call field->init(table)
sql/key.cc:
Added 'KEY' argument to 'find_ref_key' to simplify code
sql/lock.cc:
More debugging
Use create_table_def_key() to create key for table cache
Allocate TABLE_SHARE properly when creating name lock
Fix that locked_table_name doesn't test same table twice
sql/mysql_priv.h:
New functions for table definition cache
New interfaces to a lot of functions.
New faster interface to find_temporary_table() and close_temporary_table()
sql/mysqld.cc:
Added support for table definition cache of size 'table_def_size'
Fixed som calls to strnmov()
Changed name of 'table_cache' to 'table_open_cache'
sql/opt_range.cc:
Use new interfaces
Fixed warnings from valgrind
sql/parse_file.cc:
Safer calls to strxnmov()
Fixed typo
sql/set_var.cc:
Added variable 'table_definition_cache'
Variable table_cache renamed to 'table_open_cache'
sql/slave.cc:
Use new interface
sql/sp.cc:
Proper use of TABLE_SHARE
sql/sp_head.cc:
Remove compiler warnings
We have now to call field->init(table)
sql/sp_head.h:
Pointers to parsed strings are now const
sql/sql_acl.cc:
table_name is now a LEX_STRING
sql/sql_base.cc:
Main implementation of table definition cache
(The #ifdef's are there for the future when table definition cache will replace open table cache)
Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places
Views are not yet cached; For the moment we only cache if a table is a view or not.
Faster implementation of find_temorary_table()
Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()'
Drop table is slightly faster as we can use the table definition cache to know the type of the table
sql/sql_cache.cc:
table_cache_key and table_name are now LEX_STRING
'sDBUG print fixes
sql/sql_class.cc:
table_cache_key is now a LEX_STRING
safer strxnmov()
sql/sql_class.h:
Added number of open table shares (table definitions)
sql/sql_db.cc:
safer strxnmov()
sql/sql_delete.cc:
Use new interface to find_temporary_table()
sql/sql_derived.cc:
table_name is now a LEX_STRING
sql/sql_handler.cc:
TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's
sql/sql_insert.cc:
TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's
sql/sql_lex.cc:
Make parsed string a const (to quickly find out if anything is trying to change the query string)
sql/sql_lex.h:
Make parsed string a const (to quickly find out if anything is trying to change the query string)
sql/sql_load.cc:
Safer strxnmov()
sql/sql_parse.cc:
Better error if wrong DB name
sql/sql_partition.cc:
part_info moved to TABLE from TABLE_SHARE
Indentation changes
sql/sql_select.cc:
Indentation fixes
Call field->init(TABLE) for new created fields
Update create_tmp_table() to use TABLE_SHARE properly
sql/sql_select.h:
Call field->init(TABLE) for new created fields
sql/sql_show.cc:
table_name is now a LEX_STRING
part_info moved to TABLE
sql/sql_table.cc:
Use table definition cache to speed up delete of tables
Fixed calls to functions with new interfaces
Don't use 'share_not_to_be_used'
Instead of doing openfrm() when doing repair, we now have to call
get_table_share() followed by open_table_from_share().
Replace some fn_format() with faster unpack_filename().
Safer strxnmov()
part_info is now in TABLE
Added Mikaels patch for partition and ALTER TABLE
Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER
sql/sql_test.cc:
table_name and table_cache_key are now LEX_STRING's
sql/sql_trigger.cc:
TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's
safer strxnmov()
Removed compiler warnings
sql/sql_update.cc:
Call field->init(TABLE) after field is created
sql/sql_view.cc:
safer strxnmov()
Create common TABLE_SHARE object for views to allow us to cache if table is a view
sql/structs.h:
Added SHOW_TABLE_DEFINITIONS
sql/table.cc:
Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects
The table opening process now works the following way:
- Create common TABLE_SHARE object
- Read the .frm file and unpack it into the TABLE_SHARE object
- Create a TABLE object based on the information in the TABLE_SHARE
object and open a handler to the table object
open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats
sql/table.h:
TABLE objects for the same database table now share a common TABLE_SHARE object
In TABLE_SHARE the most common strings are now LEX_STRING's
sql/unireg.cc:
Changed arguments to rea_create_table() to have same order as other functions
Call field->init(table) for new created fields
sql/unireg.h:
Added OPEN_VIEW
strings/strxnmov.c:
Change strxnmov() to always add end \0
This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
|
|
|
}
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
|
2020-02-28 13:01:27 +01:00
|
|
|
void return_record_by_parent() override;
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
|
2020-02-28 13:01:27 +01:00
|
|
|
bool vers_can_native(THD *thd) override
|
2019-02-22 13:17:41 +01:00
|
|
|
{
|
|
|
|
if (thd->lex->part_info)
|
|
|
|
{
|
|
|
|
// PARTITION BY SYSTEM_TIME is not supported for now
|
|
|
|
return thd->lex->part_info->part_type != VERSIONING_PARTITION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bool can= true;
|
|
|
|
for (uint i= 0; i < m_tot_parts && can; i++)
|
|
|
|
can= can && m_file[i]->vers_can_native(thd);
|
|
|
|
return can;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-07-18 13:31:02 +02:00
|
|
|
/*
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
MODULE create/delete handler object
|
|
|
|
-------------------------------------------------------------------------
|
2020-07-14 00:42:47 +02:00
|
|
|
Object create/delete method. Normally called when a table object
|
2005-07-18 13:31:02 +02:00
|
|
|
exists. There is also a method to create the handler object with only
|
|
|
|
partition information. This is used from mysql_create_table when the
|
|
|
|
table is to be created and the engine type is deduced to be the
|
|
|
|
partition handler.
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
*/
|
2006-09-30 02:19:02 +02:00
|
|
|
ha_partition(handlerton *hton, TABLE_SHARE * table);
|
|
|
|
ha_partition(handlerton *hton, partition_info * part_info);
|
2012-02-20 22:59:11 +01:00
|
|
|
ha_partition(handlerton *hton, TABLE_SHARE *share,
|
|
|
|
partition_info *part_info_arg,
|
|
|
|
ha_partition *clone_arg,
|
2011-03-25 12:36:02 +01:00
|
|
|
MEM_ROOT *clone_mem_root_arg);
|
2005-07-18 13:31:02 +02:00
|
|
|
~ha_partition();
|
2017-09-25 23:56:10 +02:00
|
|
|
void ha_partition_init();
|
2005-07-18 13:31:02 +02:00
|
|
|
/*
|
|
|
|
A partition handler has no characteristics in itself. It only inherits
|
|
|
|
those from the underlying handlers. Here we set-up those constants to
|
|
|
|
enable later calls of the methods to retrieve constants from the under-
|
|
|
|
lying handlers. Returns false if not successful.
|
|
|
|
*/
|
2008-10-29 21:20:04 +01:00
|
|
|
bool initialize_partition(MEM_ROOT *mem_root);
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
MODULE meta data changes
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
Meta data routines to CREATE, DROP, RENAME table and often used at
|
|
|
|
ALTER TABLE (update_create_info used from ALTER TABLE and SHOW ..).
|
|
|
|
|
2013-04-09 15:49:13 +02:00
|
|
|
create_partitioning_metadata is called before opening a new handler object
|
2005-07-18 13:31:02 +02:00
|
|
|
with openfrm to call create. It is used to create any local handler
|
|
|
|
object needed in opening the object in openfrm
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
int delete_table(const char *from) override;
|
|
|
|
int rename_table(const char *from, const char *to) override;
|
|
|
|
int create(const char *name, TABLE *form,
|
|
|
|
HA_CREATE_INFO *create_info) override;
|
|
|
|
int create_partitioning_metadata(const char *name,
|
2020-03-30 13:50:03 +02:00
|
|
|
const char *old_name,
|
|
|
|
chf_create_flags action_flag)
|
2020-02-28 13:01:27 +01:00
|
|
|
override;
|
2020-03-30 13:50:03 +02:00
|
|
|
bool check_if_updates_are_ignored(const char *op) const override;
|
2020-02-28 13:01:27 +01:00
|
|
|
void update_create_info(HA_CREATE_INFO *create_info) override;
|
|
|
|
int change_partitions(HA_CREATE_INFO *create_info, const char *path,
|
|
|
|
ulonglong * const copied, ulonglong * const deleted,
|
|
|
|
const uchar *pack_frm_data, size_t pack_frm_len)
|
|
|
|
override;
|
|
|
|
int drop_partitions(const char *path) override;
|
|
|
|
int rename_partitions(const char *path) override;
|
|
|
|
bool get_no_parts(const char *, uint *num_parts) override
|
WL #2604: Partition Management
Optimised version of ADD/DROP/REORGANIZE partitions for
non-NDB storage engines.
New syntax to handle REBUILD/OPTIMIZE/ANALYZE/CHECK/REPAIR partitions
Quite a few bug fixes
include/thr_lock.h:
New method to downgrade locks from TL_WRITE_ONLY
Possibility to upgrade lock while aborting locks
mysql-test/r/ndb_autodiscover.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_bitfield.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_gis.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_partition_key.result:
New test case
mysql-test/r/partition.result:
New test case
mysql-test/r/partition_error.result:
New test case
mysql-test/r/partition_mgm_err.result:
Fix of test case results
mysql-test/t/disabled.def:
partition_03ndb still has bug
mysql-test/t/ndb_partition_key.test:
New test cases for new functionality and bugs
mysql-test/t/partition.test:
New test cases for new functionality and bugs
mysql-test/t/partition_error.test:
New test cases for new functionality and bugs
mysql-test/t/partition_mgm_err.test:
New test cases for new functionality and bugs
mysys/thr_lock.c:
New method to downgrade TL_WRITE_ONLY locks
Possibility to specify if locks are to be upgraded at abort locks
sql/ha_archive.cc:
New handlerton methods
sql/ha_berkeley.cc:
New handlerton methods
sql/ha_blackhole.cc:
New handlerton methods
sql/ha_federated.cc:
New handlerton methods
sql/ha_heap.cc:
New handlerton methods
sql/ha_innodb.cc:
New handlerton methods
sql/ha_myisam.cc:
New handlerton methods
sql/ha_myisammrg.cc:
New handlerton methods
sql/ha_ndbcluster.cc:
New handlerton methods
Moved out packfrm and unpackfrm methods
Adapted many parts to use table_share instead of table->s
Ensured that .ndb file uses filename and not tablename
according to new encoding of names (WL 1324)
All NDB tables are partitioned and set up partition info
Fixed such that tablenames use tablenames and not filenames in NDB
NDB uses auto partitioning for ENGINE=NDB tables
Warning for very large tables
Set RANGE data
Set LIST data
New method to set-up partition info
Set Default number of partitions flag
Set linear hash flag
Set node group array
Set number of fragments
Set max rows
Set tablespace names
New method to get number of partitions of table to use at open table
sql/ha_ndbcluster.h:
Removed partition_flags and alter_table_flags from handler class
A couple of new and changed method headers
sql/ha_ndbcluster_binlog.cc:
Use new method headers
sql/ha_partition.cc:
New handlerton methods
Lots of new function headers
Use #P# as separator between table name and partition name and
#SP# as separator between partition name and subpartition name
Use filename encoding for files both of table name part and of
partition name parts
New method to drop partitions based on partition state
New method to rename partitions based on partition state
New methods to optimize, analyze, check and repair partitions
New methods to optimize, analyze, check and repair table
Helper method to create new partition, open it and external lock
it, not needed to lock it internally since no one else knows about
it yet.
Cleanup method at error for new partitions
New methods to perform bulk of work at ADD/REORGANIZE partitions
(change_partitions, copy_partitions)
sql/ha_partition.h:
New methods and variables
A few dropped ones and a few changed ones
sql/handler.cc:
Handlerton interface changes
New flag to open_table_from_share
sql/handler.h:
New alter_table_flags
New partition flags
New partition states
More states for default handling
Lots of new, dropped and changed interfaces
sql/lex.h:
Added REBUILD and changed name of REORGANISE to REORGANIZE
sql/lock.cc:
Method to downgrade locks
Able to specify if locks upgraded on abort locks
sql/log.cc:
New handlerton methods
sql/mysql_priv.h:
Lots of new interfaces
sql/share/errmsg.txt:
Lots of new, dropped and changed error messages
sql/sql_base.cc:
Adapted to new method headers
New method to abort and upgrade lock
New method to close open tables and downgrade lock
New method to wait for completed table
sql/sql_lex.h:
New flags
sql/sql_partition.cc:
Return int instead of bool in get_partition_id
More defaults handling
Make use of new mem_alloc_error method
More work on function headers
Changes to generate partition syntax to cater for intermediate
partition states
Lots of new code with large comments describing new features for
Partition Management:
ADD/DROP/REORGANIZE/OPTIMIZE/ANALYZE/CHECK/REPAIR partitions
sql/sql_show.cc:
Minors
sql/sql_table.cc:
Moved a couple of methods
New methods to copy create lists and key lists
for use with mysql_prepare_table
New method to write frm file
New handling of handlers with auto partitioning
Fix CREATE TABLE LIKE
Moved code for ADD/DROP/REORGANIZE partitions
Use handlerton method for alter_table_flags
sql/sql_yacc.yy:
More memory alloc error checks
New syntax for REBUILD, ANALYZE, CHECK, OPTIMIZE, REPAIR partitions
sql/table.cc:
Fix length of extra part to be 4 bytes
Partition state introduced in frm file
sql/table.h:
Partition state introduced
sql/unireg.cc:
Partition state introduced
Default partition
storage/csv/ha_tina.cc:
New handlerton methods
storage/example/ha_example.cc:
New handlerton methods
storage/ndb/include/kernel/ndb_limits.h:
RANGE DATA
storage/ndb/include/kernel/signaldata/AlterTable.hpp:
New interfaces in ALTER TABLE towards NDB kernel
storage/ndb/include/kernel/signaldata/DiAddTab.hpp:
New section
storage/ndb/include/kernel/signaldata/DictTabInfo.hpp:
Lots of new parts of table description
storage/ndb/include/kernel/signaldata/LqhFrag.hpp:
tablespace id specified in LQHFRAGREQ
storage/ndb/include/ndbapi/NdbDictionary.hpp:
Lots of new methods in NDB dictionary
storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
New error insertion
storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp:
a few extra jam's
storage/ndb/src/ndbapi/NdbBlob.cpp:
Changes to definition of blob tables
storage/ndb/src/ndbapi/NdbDictionary.cpp:
Lots of new stuff in NDB dictionary
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
Lots of new stuff in NDB dictionary
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp:
Lots of new stuff in NDB dictionary
storage/ndb/test/ndbapi/test_event.cpp:
removed use of methods no longer in existence
storage/ndb/tools/restore/Restore.cpp:
Renamed variable
2006-01-17 08:40:00 +01:00
|
|
|
{
|
|
|
|
DBUG_ENTER("ha_partition::get_no_parts");
|
2009-10-01 15:04:42 +02:00
|
|
|
*num_parts= m_tot_parts;
|
WL #2604: Partition Management
Optimised version of ADD/DROP/REORGANIZE partitions for
non-NDB storage engines.
New syntax to handle REBUILD/OPTIMIZE/ANALYZE/CHECK/REPAIR partitions
Quite a few bug fixes
include/thr_lock.h:
New method to downgrade locks from TL_WRITE_ONLY
Possibility to upgrade lock while aborting locks
mysql-test/r/ndb_autodiscover.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_bitfield.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_gis.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_partition_key.result:
New test case
mysql-test/r/partition.result:
New test case
mysql-test/r/partition_error.result:
New test case
mysql-test/r/partition_mgm_err.result:
Fix of test case results
mysql-test/t/disabled.def:
partition_03ndb still has bug
mysql-test/t/ndb_partition_key.test:
New test cases for new functionality and bugs
mysql-test/t/partition.test:
New test cases for new functionality and bugs
mysql-test/t/partition_error.test:
New test cases for new functionality and bugs
mysql-test/t/partition_mgm_err.test:
New test cases for new functionality and bugs
mysys/thr_lock.c:
New method to downgrade TL_WRITE_ONLY locks
Possibility to specify if locks are to be upgraded at abort locks
sql/ha_archive.cc:
New handlerton methods
sql/ha_berkeley.cc:
New handlerton methods
sql/ha_blackhole.cc:
New handlerton methods
sql/ha_federated.cc:
New handlerton methods
sql/ha_heap.cc:
New handlerton methods
sql/ha_innodb.cc:
New handlerton methods
sql/ha_myisam.cc:
New handlerton methods
sql/ha_myisammrg.cc:
New handlerton methods
sql/ha_ndbcluster.cc:
New handlerton methods
Moved out packfrm and unpackfrm methods
Adapted many parts to use table_share instead of table->s
Ensured that .ndb file uses filename and not tablename
according to new encoding of names (WL 1324)
All NDB tables are partitioned and set up partition info
Fixed such that tablenames use tablenames and not filenames in NDB
NDB uses auto partitioning for ENGINE=NDB tables
Warning for very large tables
Set RANGE data
Set LIST data
New method to set-up partition info
Set Default number of partitions flag
Set linear hash flag
Set node group array
Set number of fragments
Set max rows
Set tablespace names
New method to get number of partitions of table to use at open table
sql/ha_ndbcluster.h:
Removed partition_flags and alter_table_flags from handler class
A couple of new and changed method headers
sql/ha_ndbcluster_binlog.cc:
Use new method headers
sql/ha_partition.cc:
New handlerton methods
Lots of new function headers
Use #P# as separator between table name and partition name and
#SP# as separator between partition name and subpartition name
Use filename encoding for files both of table name part and of
partition name parts
New method to drop partitions based on partition state
New method to rename partitions based on partition state
New methods to optimize, analyze, check and repair partitions
New methods to optimize, analyze, check and repair table
Helper method to create new partition, open it and external lock
it, not needed to lock it internally since no one else knows about
it yet.
Cleanup method at error for new partitions
New methods to perform bulk of work at ADD/REORGANIZE partitions
(change_partitions, copy_partitions)
sql/ha_partition.h:
New methods and variables
A few dropped ones and a few changed ones
sql/handler.cc:
Handlerton interface changes
New flag to open_table_from_share
sql/handler.h:
New alter_table_flags
New partition flags
New partition states
More states for default handling
Lots of new, dropped and changed interfaces
sql/lex.h:
Added REBUILD and changed name of REORGANISE to REORGANIZE
sql/lock.cc:
Method to downgrade locks
Able to specify if locks upgraded on abort locks
sql/log.cc:
New handlerton methods
sql/mysql_priv.h:
Lots of new interfaces
sql/share/errmsg.txt:
Lots of new, dropped and changed error messages
sql/sql_base.cc:
Adapted to new method headers
New method to abort and upgrade lock
New method to close open tables and downgrade lock
New method to wait for completed table
sql/sql_lex.h:
New flags
sql/sql_partition.cc:
Return int instead of bool in get_partition_id
More defaults handling
Make use of new mem_alloc_error method
More work on function headers
Changes to generate partition syntax to cater for intermediate
partition states
Lots of new code with large comments describing new features for
Partition Management:
ADD/DROP/REORGANIZE/OPTIMIZE/ANALYZE/CHECK/REPAIR partitions
sql/sql_show.cc:
Minors
sql/sql_table.cc:
Moved a couple of methods
New methods to copy create lists and key lists
for use with mysql_prepare_table
New method to write frm file
New handling of handlers with auto partitioning
Fix CREATE TABLE LIKE
Moved code for ADD/DROP/REORGANIZE partitions
Use handlerton method for alter_table_flags
sql/sql_yacc.yy:
More memory alloc error checks
New syntax for REBUILD, ANALYZE, CHECK, OPTIMIZE, REPAIR partitions
sql/table.cc:
Fix length of extra part to be 4 bytes
Partition state introduced in frm file
sql/table.h:
Partition state introduced
sql/unireg.cc:
Partition state introduced
Default partition
storage/csv/ha_tina.cc:
New handlerton methods
storage/example/ha_example.cc:
New handlerton methods
storage/ndb/include/kernel/ndb_limits.h:
RANGE DATA
storage/ndb/include/kernel/signaldata/AlterTable.hpp:
New interfaces in ALTER TABLE towards NDB kernel
storage/ndb/include/kernel/signaldata/DiAddTab.hpp:
New section
storage/ndb/include/kernel/signaldata/DictTabInfo.hpp:
Lots of new parts of table description
storage/ndb/include/kernel/signaldata/LqhFrag.hpp:
tablespace id specified in LQHFRAGREQ
storage/ndb/include/ndbapi/NdbDictionary.hpp:
Lots of new methods in NDB dictionary
storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
New error insertion
storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp:
a few extra jam's
storage/ndb/src/ndbapi/NdbBlob.cpp:
Changes to definition of blob tables
storage/ndb/src/ndbapi/NdbDictionary.cpp:
Lots of new stuff in NDB dictionary
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
Lots of new stuff in NDB dictionary
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp:
Lots of new stuff in NDB dictionary
storage/ndb/test/ndbapi/test_event.cpp:
removed use of methods no longer in existence
storage/ndb/tools/restore/Restore.cpp:
Renamed variable
2006-01-17 08:40:00 +01:00
|
|
|
DBUG_RETURN(0);
|
|
|
|
}
|
2020-02-28 13:01:27 +01:00
|
|
|
void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share) override;
|
|
|
|
bool check_if_incompatible_data(HA_CREATE_INFO *create_info,
|
|
|
|
uint table_changes) override;
|
2017-09-17 20:01:38 +02:00
|
|
|
void update_part_create_info(HA_CREATE_INFO *create_info, uint part_id)
|
|
|
|
{
|
|
|
|
m_file[part_id]->update_create_info(create_info);
|
|
|
|
}
|
2005-07-18 13:31:02 +02:00
|
|
|
private:
|
Bug#38804: Query deadlock causes all tables to be inaccessible.
Problem was a mutex added in bug n 27405 for solving a problem
with auto_increment in partitioned innodb tables.
(in ha_partition::write_row over partitions file->ha_write_row)
Solution is to use the patch for bug#33479, which refines the
usage of mutexes for auto_increment.
Backport of bug-33479 from 6.0:
Bug-33479: auto_increment failures in partitioning
Several problems with auto_increment in partitioning
(with MyISAM, InnoDB. Locking issues, not handling
multi-row INSERTs properly etc.)
Changed the auto_increment handling for partitioning:
Added a ha_data variable in table_share for storage engine specific data
such as auto_increment value handling in partitioning, also see WL 4305
and using the ha_data->mutex to lock around read + update.
The idea is this:
Store the table's reserved auto_increment value in
the TABLE_SHARE and use a mutex to, lock it for reading and updating it
and unlocking it, in one block. Only accessing all partitions
when it is not initialized.
Also allow reservations of ranges, and if no one has done a reservation
afterwards, lower the reservation to what was actually used after
the statement is done (via release_auto_increment from WL 3146).
The lock is kept from the first reservation if it is statement based
replication and a multi-row INSERT statement where the number of
candidate rows to insert is not known in advance (like INSERT SELECT,
LOAD DATA, unlike INSERT VALUES (row1), (row2),,(rowN)).
This should also lead to better concurrancy (no need to have a mutex
protection around write_row in all cases)
and work with any local storage engine.
mysql-test/suite/parts/inc/partition_auto_increment.inc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Test source file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_archive.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_innodb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_memory.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_ndb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_archive.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_blackhole.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_innodb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_memory.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_myisam.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_ndb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
sql/ha_partition.cc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Changed ha_partition::get_auto_increment from file->get_auto_increment
to file->info(HA_AUTO_STATUS), since it is works better with InnoDB
(InnoDB can have issues with partitioning and auto_increment,
where get_auto_increment sometimes can return a non updated value.)
Using the new table_share->ha_data for keeping the auto_increment
value, shared by all instances of the same table.
It is read+updated when holding a auto_increment specific mutex.
Also added release_auto_increment to decrease gaps if possible.
And a lock for multi-row INSERT statements where the number of candidate
rows to insert is not known in advance (like INSERT SELECT, LOAD DATA;
Unlike INSERT INTO (row1),(row2),,(rowN)).
Fixed a small bug, copied++ to (*copied)++ and the same for deleted.
Changed from current_thd, to ha_thd()
sql/ha_partition.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a new struct HA_DATA_PARTITION to be used in table_share->ha_data
Added a private function to set auto_increment values if needed
Removed the restore_auto_increment (the hander version is better)
Added lock/unlock functions for auto_increment handling.
Changed copied/deleted to const.
sql/handler.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Added const for changed_partitions
Added comments about SQLCOM_TRUNCATE for delete_all_rows
sql/table.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a variable in table_share: ha_data for storage of storage engine
specific data (such as auto_increment handling in partitioning).
2008-09-08 15:30:01 +02:00
|
|
|
int copy_partitions(ulonglong * const copied, ulonglong * const deleted);
|
WL #2604: Partition Management
Optimised version of ADD/DROP/REORGANIZE partitions for
non-NDB storage engines.
New syntax to handle REBUILD/OPTIMIZE/ANALYZE/CHECK/REPAIR partitions
Quite a few bug fixes
include/thr_lock.h:
New method to downgrade locks from TL_WRITE_ONLY
Possibility to upgrade lock while aborting locks
mysql-test/r/ndb_autodiscover.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_bitfield.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_gis.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_partition_key.result:
New test case
mysql-test/r/partition.result:
New test case
mysql-test/r/partition_error.result:
New test case
mysql-test/r/partition_mgm_err.result:
Fix of test case results
mysql-test/t/disabled.def:
partition_03ndb still has bug
mysql-test/t/ndb_partition_key.test:
New test cases for new functionality and bugs
mysql-test/t/partition.test:
New test cases for new functionality and bugs
mysql-test/t/partition_error.test:
New test cases for new functionality and bugs
mysql-test/t/partition_mgm_err.test:
New test cases for new functionality and bugs
mysys/thr_lock.c:
New method to downgrade TL_WRITE_ONLY locks
Possibility to specify if locks are to be upgraded at abort locks
sql/ha_archive.cc:
New handlerton methods
sql/ha_berkeley.cc:
New handlerton methods
sql/ha_blackhole.cc:
New handlerton methods
sql/ha_federated.cc:
New handlerton methods
sql/ha_heap.cc:
New handlerton methods
sql/ha_innodb.cc:
New handlerton methods
sql/ha_myisam.cc:
New handlerton methods
sql/ha_myisammrg.cc:
New handlerton methods
sql/ha_ndbcluster.cc:
New handlerton methods
Moved out packfrm and unpackfrm methods
Adapted many parts to use table_share instead of table->s
Ensured that .ndb file uses filename and not tablename
according to new encoding of names (WL 1324)
All NDB tables are partitioned and set up partition info
Fixed such that tablenames use tablenames and not filenames in NDB
NDB uses auto partitioning for ENGINE=NDB tables
Warning for very large tables
Set RANGE data
Set LIST data
New method to set-up partition info
Set Default number of partitions flag
Set linear hash flag
Set node group array
Set number of fragments
Set max rows
Set tablespace names
New method to get number of partitions of table to use at open table
sql/ha_ndbcluster.h:
Removed partition_flags and alter_table_flags from handler class
A couple of new and changed method headers
sql/ha_ndbcluster_binlog.cc:
Use new method headers
sql/ha_partition.cc:
New handlerton methods
Lots of new function headers
Use #P# as separator between table name and partition name and
#SP# as separator between partition name and subpartition name
Use filename encoding for files both of table name part and of
partition name parts
New method to drop partitions based on partition state
New method to rename partitions based on partition state
New methods to optimize, analyze, check and repair partitions
New methods to optimize, analyze, check and repair table
Helper method to create new partition, open it and external lock
it, not needed to lock it internally since no one else knows about
it yet.
Cleanup method at error for new partitions
New methods to perform bulk of work at ADD/REORGANIZE partitions
(change_partitions, copy_partitions)
sql/ha_partition.h:
New methods and variables
A few dropped ones and a few changed ones
sql/handler.cc:
Handlerton interface changes
New flag to open_table_from_share
sql/handler.h:
New alter_table_flags
New partition flags
New partition states
More states for default handling
Lots of new, dropped and changed interfaces
sql/lex.h:
Added REBUILD and changed name of REORGANISE to REORGANIZE
sql/lock.cc:
Method to downgrade locks
Able to specify if locks upgraded on abort locks
sql/log.cc:
New handlerton methods
sql/mysql_priv.h:
Lots of new interfaces
sql/share/errmsg.txt:
Lots of new, dropped and changed error messages
sql/sql_base.cc:
Adapted to new method headers
New method to abort and upgrade lock
New method to close open tables and downgrade lock
New method to wait for completed table
sql/sql_lex.h:
New flags
sql/sql_partition.cc:
Return int instead of bool in get_partition_id
More defaults handling
Make use of new mem_alloc_error method
More work on function headers
Changes to generate partition syntax to cater for intermediate
partition states
Lots of new code with large comments describing new features for
Partition Management:
ADD/DROP/REORGANIZE/OPTIMIZE/ANALYZE/CHECK/REPAIR partitions
sql/sql_show.cc:
Minors
sql/sql_table.cc:
Moved a couple of methods
New methods to copy create lists and key lists
for use with mysql_prepare_table
New method to write frm file
New handling of handlers with auto partitioning
Fix CREATE TABLE LIKE
Moved code for ADD/DROP/REORGANIZE partitions
Use handlerton method for alter_table_flags
sql/sql_yacc.yy:
More memory alloc error checks
New syntax for REBUILD, ANALYZE, CHECK, OPTIMIZE, REPAIR partitions
sql/table.cc:
Fix length of extra part to be 4 bytes
Partition state introduced in frm file
sql/table.h:
Partition state introduced
sql/unireg.cc:
Partition state introduced
Default partition
storage/csv/ha_tina.cc:
New handlerton methods
storage/example/ha_example.cc:
New handlerton methods
storage/ndb/include/kernel/ndb_limits.h:
RANGE DATA
storage/ndb/include/kernel/signaldata/AlterTable.hpp:
New interfaces in ALTER TABLE towards NDB kernel
storage/ndb/include/kernel/signaldata/DiAddTab.hpp:
New section
storage/ndb/include/kernel/signaldata/DictTabInfo.hpp:
Lots of new parts of table description
storage/ndb/include/kernel/signaldata/LqhFrag.hpp:
tablespace id specified in LQHFRAGREQ
storage/ndb/include/ndbapi/NdbDictionary.hpp:
Lots of new methods in NDB dictionary
storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
New error insertion
storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp:
a few extra jam's
storage/ndb/src/ndbapi/NdbBlob.cpp:
Changes to definition of blob tables
storage/ndb/src/ndbapi/NdbDictionary.cpp:
Lots of new stuff in NDB dictionary
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
Lots of new stuff in NDB dictionary
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp:
Lots of new stuff in NDB dictionary
storage/ndb/test/ndbapi/test_event.cpp:
removed use of methods no longer in existence
storage/ndb/tools/restore/Restore.cpp:
Renamed variable
2006-01-17 08:40:00 +01:00
|
|
|
void cleanup_new_partition(uint part_count);
|
|
|
|
int prepare_new_partition(TABLE *table, HA_CREATE_INFO *create_info,
|
2006-07-05 18:57:23 +02:00
|
|
|
handler *file, const char *part_name,
|
2013-10-21 08:37:02 +02:00
|
|
|
partition_element *p_elem,
|
|
|
|
uint disable_non_uniq_indexes);
|
2005-07-18 13:31:02 +02:00
|
|
|
/*
|
2013-06-15 17:32:08 +02:00
|
|
|
delete_table and rename_table uses very similar logic which
|
2005-07-18 13:31:02 +02:00
|
|
|
is packed into this routine.
|
|
|
|
*/
|
2013-06-15 17:32:08 +02:00
|
|
|
uint del_ren_table(const char *from, const char *to);
|
2005-07-18 13:31:02 +02:00
|
|
|
/*
|
|
|
|
One method to create the table_name.par file containing the names of the
|
|
|
|
underlying partitions, their engine and the number of partitions.
|
|
|
|
And one method to read it in.
|
|
|
|
*/
|
|
|
|
bool create_handler_file(const char *name);
|
MDEV-27753 Incorrect ENGINE type of table after crash for CONNECT table
whenever possible, partitioning should use the full
partition plugin name, not the one byte legacy code.
Normally, ha_partition can get the engine plugin from
table_share->default_part_plugin.
But in some cases, e.g. in DROP TABLE, the table isn't
opened, table_share is NULL, and ha_partition has to parse
the frm, much like dd_frm_type() does.
temporary_tables.cc, sql_table.cc:
When dropping a table, it must be deleted in the engine
first, then frm file. Because frm can be the only true
source of metadata that the engine might need for DROP.
table.cc:
when opening a partitioned table, if the engine for
partitions is not found, do not fallback to MyISAM.
2022-03-11 20:18:22 +01:00
|
|
|
bool setup_engine_array(MEM_ROOT *mem_root, handlerton *first_engine);
|
2023-06-01 18:03:56 +02:00
|
|
|
int read_par_file(const char *name);
|
MDEV-27753 Incorrect ENGINE type of table after crash for CONNECT table
whenever possible, partitioning should use the full
partition plugin name, not the one byte legacy code.
Normally, ha_partition can get the engine plugin from
table_share->default_part_plugin.
But in some cases, e.g. in DROP TABLE, the table isn't
opened, table_share is NULL, and ha_partition has to parse
the frm, much like dd_frm_type() does.
temporary_tables.cc, sql_table.cc:
When dropping a table, it must be deleted in the engine
first, then frm file. Because frm can be the only true
source of metadata that the engine might need for DROP.
table.cc:
when opening a partitioned table, if the engine for
partitions is not found, do not fallback to MyISAM.
2022-03-11 20:18:22 +01:00
|
|
|
handlerton *get_def_part_engine(const char *name);
|
2011-04-20 17:52:33 +02:00
|
|
|
bool get_from_handler_file(const char *name, MEM_ROOT *mem_root,
|
|
|
|
bool is_clone);
|
2023-06-01 18:03:56 +02:00
|
|
|
bool re_create_par_file(const char *name);
|
This changeset is largely a handler cleanup changeset (WL#3281), but includes fixes and cleanups that was found necessary while testing the handler changes
Changes that requires code changes in other code of other storage engines.
(Note that all changes are very straightforward and one should find all issues
by compiling a --debug build and fixing all compiler errors and all
asserts in field.cc while running the test suite),
- New optional handler function introduced: reset()
This is called after every DML statement to make it easy for a handler to
statement specific cleanups.
(The only case it's not called is if force the file to be closed)
- handler::extra(HA_EXTRA_RESET) is removed. Code that was there before
should be moved to handler::reset()
- table->read_set contains a bitmap over all columns that are needed
in the query. read_row() and similar functions only needs to read these
columns
- table->write_set contains a bitmap over all columns that will be updated
in the query. write_row() and update_row() only needs to update these
columns.
The above bitmaps should now be up to date in all context
(including ALTER TABLE, filesort()).
The handler is informed of any changes to the bitmap after
fix_fields() by calling the virtual function
handler::column_bitmaps_signal(). If the handler does caching of
these bitmaps (instead of using table->read_set, table->write_set),
it should redo the caching in this code. as the signal() may be sent
several times, it's probably best to set a variable in the signal
and redo the caching on read_row() / write_row() if the variable was
set.
- Removed the read_set and write_set bitmap objects from the handler class
- Removed all column bit handling functions from the handler class.
(Now one instead uses the normal bitmap functions in my_bitmap.c instead
of handler dedicated bitmap functions)
- field->query_id is removed. One should instead instead check
table->read_set and table->write_set if a field is used in the query.
- handler::extra(HA_EXTRA_RETRIVE_ALL_COLS) and
handler::extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY) are removed. One should now
instead use table->read_set to check for which columns to retrieve.
- If a handler needs to call Field->val() or Field->store() on columns
that are not used in the query, one should install a temporary
all-columns-used map while doing so. For this, we provide the following
functions:
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
field->val();
dbug_tmp_restore_column_map(table->read_set, old_map);
and similar for the write map:
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->write_set);
field->val();
dbug_tmp_restore_column_map(table->write_set, old_map);
If this is not done, you will sooner or later hit a DBUG_ASSERT
in the field store() / val() functions.
(For not DBUG binaries, the dbug_tmp_restore_column_map() and
dbug_tmp_restore_column_map() are inline dummy functions and should
be optimized away be the compiler).
- If one needs to temporary set the column map for all binaries (and not
just to avoid the DBUG_ASSERT() in the Field::store() / Field::val()
methods) one should use the functions tmp_use_all_columns() and
tmp_restore_column_map() instead of the above dbug_ variants.
- All 'status' fields in the handler base class (like records,
data_file_length etc) are now stored in a 'stats' struct. This makes
it easier to know what status variables are provided by the base
handler. This requires some trivial variable names in the extra()
function.
- New virtual function handler::records(). This is called to optimize
COUNT(*) if (handler::table_flags() & HA_HAS_RECORDS()) is true.
(stats.records is not supposed to be an exact value. It's only has to
be 'reasonable enough' for the optimizer to be able to choose a good
optimization path).
- Non virtual handler::init() function added for caching of virtual
constants from engine.
- Removed has_transactions() virtual method. Now one should instead return
HA_NO_TRANSACTIONS in table_flags() if the table handler DOES NOT support
transactions.
- The 'xxxx_create_handler()' function now has a MEM_ROOT_root argument
that is to be used with 'new handler_name()' to allocate the handler
in the right area. The xxxx_create_handler() function is also
responsible for any initialization of the object before returning.
For example, one should change:
static handler *myisam_create_handler(TABLE_SHARE *table)
{
return new ha_myisam(table);
}
->
static handler *myisam_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
{
return new (mem_root) ha_myisam(table);
}
- New optional virtual function: use_hidden_primary_key().
This is called in case of an update/delete when
(table_flags() and HA_PRIMARY_KEY_REQUIRED_FOR_DELETE) is defined
but we don't have a primary key. This allows the handler to take precisions
in remembering any hidden primary key to able to update/delete any
found row. The default handler marks all columns to be read.
- handler::table_flags() now returns a ulonglong (to allow for more flags).
- New/changed table_flags()
- HA_HAS_RECORDS Set if ::records() is supported
- HA_NO_TRANSACTIONS Set if engine doesn't support transactions
- HA_PRIMARY_KEY_REQUIRED_FOR_DELETE
Set if we should mark all primary key columns for
read when reading rows as part of a DELETE
statement. If there is no primary key,
all columns are marked for read.
- HA_PARTIAL_COLUMN_READ Set if engine will not read all columns in some
cases (based on table->read_set)
- HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS
Renamed to HA_PRIMARY_KEY_REQUIRED_FOR_POSITION.
- HA_DUPP_POS Renamed to HA_DUPLICATE_POS
- HA_REQUIRES_KEY_COLUMNS_FOR_DELETE
Set this if we should mark ALL key columns for
read when when reading rows as part of a DELETE
statement. In case of an update we will mark
all keys for read for which key part changed
value.
- HA_STATS_RECORDS_IS_EXACT
Set this if stats.records is exact.
(This saves us some extra records() calls
when optimizing COUNT(*))
- Removed table_flags()
- HA_NOT_EXACT_COUNT Now one should instead use HA_HAS_RECORDS if
handler::records() gives an exact count() and
HA_STATS_RECORDS_IS_EXACT if stats.records is exact.
- HA_READ_RND_SAME Removed (no one supported this one)
- Removed not needed functions ha_retrieve_all_cols() and ha_retrieve_all_pk()
- Renamed handler::dupp_pos to handler::dup_pos
- Removed not used variable handler::sortkey
Upper level handler changes:
- ha_reset() now does some overall checks and calls ::reset()
- ha_table_flags() added. This is a cached version of table_flags(). The
cache is updated on engine creation time and updated on open.
MySQL level changes (not obvious from the above):
- DBUG_ASSERT() added to check that column usage matches what is set
in the column usage bit maps. (This found a LOT of bugs in current
column marking code).
- In 5.1 before, all used columns was marked in read_set and only updated
columns was marked in write_set. Now we only mark columns for which we
need a value in read_set.
- Column bitmaps are created in open_binary_frm() and open_table_from_share().
(Before this was in table.cc)
- handler::table_flags() calls are replaced with handler::ha_table_flags()
- For calling field->val() you must have the corresponding bit set in
table->read_set. For calling field->store() you must have the
corresponding bit set in table->write_set. (There are asserts in
all store()/val() functions to catch wrong usage)
- thd->set_query_id is renamed to thd->mark_used_columns and instead
of setting this to an integer value, this has now the values:
MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE
Changed also all variables named 'set_query_id' to mark_used_columns.
- In filesort() we now inform the handler of exactly which columns are needed
doing the sort and choosing the rows.
- The TABLE_SHARE object has a 'all_set' column bitmap one can use
when one needs a column bitmap with all columns set.
(This is used for table->use_all_columns() and other places)
- The TABLE object has 3 column bitmaps:
- def_read_set Default bitmap for columns to be read
- def_write_set Default bitmap for columns to be written
- tmp_set Can be used as a temporary bitmap when needed.
The table object has also two pointer to bitmaps read_set and write_set
that the handler should use to find out which columns are used in which way.
- count() optimization now calls handler::records() instead of using
handler->stats.records (if (table_flags() & HA_HAS_RECORDS) is true).
- Added extra argument to Item::walk() to indicate if we should also
traverse sub queries.
- Added TABLE parameter to cp_buffer_from_ref()
- Don't close tables created with CREATE ... SELECT but keep them in
the table cache. (Faster usage of newly created tables).
New interfaces:
- table->clear_column_bitmaps() to initialize the bitmaps for tables
at start of new statements.
- table->column_bitmaps_set() to set up new column bitmaps and signal
the handler about this.
- table->column_bitmaps_set_no_signal() for some few cases where we need
to setup new column bitmaps but don't signal the handler (as the handler
has already been signaled about these before). Used for the momement
only in opt_range.cc when doing ROR scans.
- table->use_all_columns() to install a bitmap where all columns are marked
as use in the read and the write set.
- table->default_column_bitmaps() to install the normal read and write
column bitmaps, but not signaling the handler about this.
This is mainly used when creating TABLE instances.
- table->mark_columns_needed_for_delete(),
table->mark_columns_needed_for_delete() and
table->mark_columns_needed_for_insert() to allow us to put additional
columns in column usage maps if handler so requires.
(The handler indicates what it neads in handler->table_flags())
- table->prepare_for_position() to allow us to tell handler that it
needs to read primary key parts to be able to store them in
future table->position() calls.
(This replaces the table->file->ha_retrieve_all_pk function)
- table->mark_auto_increment_column() to tell handler are going to update
columns part of any auto_increment key.
- table->mark_columns_used_by_index() to mark all columns that is part of
an index. It will also send extra(HA_EXTRA_KEYREAD) to handler to allow
it to quickly know that it only needs to read colums that are part
of the key. (The handler can also use the column map for detecting this,
but simpler/faster handler can just monitor the extra() call).
- table->mark_columns_used_by_index_no_reset() to in addition to other columns,
also mark all columns that is used by the given key.
- table->restore_column_maps_after_mark_index() to restore to default
column maps after a call to table->mark_columns_used_by_index().
- New item function register_field_in_read_map(), for marking used columns
in table->read_map. Used by filesort() to mark all used columns
- Maintain in TABLE->merge_keys set of all keys that are used in query.
(Simplices some optimization loops)
- Maintain Field->part_of_key_not_clustered which is like Field->part_of_key
but the field in the clustered key is not assumed to be part of all index.
(used in opt_range.cc for faster loops)
- dbug_tmp_use_all_columns(), dbug_tmp_restore_column_map()
tmp_use_all_columns() and tmp_restore_column_map() functions to temporally
mark all columns as usable. The 'dbug_' version is primarily intended
inside a handler when it wants to just call Field:store() & Field::val()
functions, but don't need the column maps set for any other usage.
(ie:: bitmap_is_set() is never called)
- We can't use compare_records() to skip updates for handlers that returns
a partial column set and the read_set doesn't cover all columns in the
write set. The reason for this is that if we have a column marked only for
write we can't in the MySQL level know if the value changed or not.
The reason this worked before was that MySQL marked all to be written
columns as also to be read. The new 'optimal' bitmaps exposed this 'hidden
bug'.
- open_table_from_share() does not anymore setup temporary MEM_ROOT
object as a thread specific variable for the handler. Instead we
send the to-be-used MEMROOT to get_new_handler().
(Simpler, faster code)
Bugs fixed:
- Column marking was not done correctly in a lot of cases.
(ALTER TABLE, when using triggers, auto_increment fields etc)
(Could potentially result in wrong values inserted in table handlers
relying on that the old column maps or field->set_query_id was correct)
Especially when it comes to triggers, there may be cases where the
old code would cause lost/wrong values for NDB and/or InnoDB tables.
- Split thd->options flag OPTION_STATUS_NO_TRANS_UPDATE to two flags:
OPTION_STATUS_NO_TRANS_UPDATE and OPTION_KEEP_LOG.
This allowed me to remove some wrong warnings about:
"Some non-transactional changed tables couldn't be rolled back"
- Fixed handling of INSERT .. SELECT and CREATE ... SELECT that wrongly reset
(thd->options & OPTION_STATUS_NO_TRANS_UPDATE) which caused us to loose
some warnings about
"Some non-transactional changed tables couldn't be rolled back")
- Fixed use of uninitialized memory in ha_ndbcluster.cc::delete_table()
which could cause delete_table to report random failures.
- Fixed core dumps for some tests when running with --debug
- Added missing FN_LIBCHAR in mysql_rm_tmp_tables()
(This has probably caused us to not properly remove temporary files after
crash)
- slow_logs was not properly initialized, which could maybe cause
extra/lost entries in slow log.
- If we get an duplicate row on insert, change column map to read and
write all columns while retrying the operation. This is required by
the definition of REPLACE and also ensures that fields that are only
part of UPDATE are properly handled. This fixed a bug in NDB and
REPLACE where REPLACE wrongly copied some column values from the replaced
row.
- For table handler that doesn't support NULL in keys, we would give an error
when creating a primary key with NULL fields, even after the fields has been
automaticly converted to NOT NULL.
- Creating a primary key on a SPATIAL key, would fail if field was not
declared as NOT NULL.
Cleanups:
- Removed not used condition argument to setup_tables
- Removed not needed item function reset_query_id_processor().
- Field->add_index is removed. Now this is instead maintained in
(field->flags & FIELD_IN_ADD_INDEX)
- Field->fieldnr is removed (use field->field_index instead)
- New argument to filesort() to indicate that it should return a set of
row pointers (not used columns). This allowed me to remove some references
to sql_command in filesort and should also enable us to return column
results in some cases where we couldn't before.
- Changed column bitmap handling in opt_range.cc to be aligned with TABLE
bitmap, which allowed me to use bitmap functions instead of looping over
all fields to create some needed bitmaps. (Faster and smaller code)
- Broke up found too long lines
- Moved some variable declaration at start of function for better code
readability.
- Removed some not used arguments from functions.
(setup_fields(), mysql_prepare_insert_check_table())
- setup_fields() now takes an enum instead of an int for marking columns
usage.
- For internal temporary tables, use handler::write_row(),
handler::delete_row() and handler::update_row() instead of
handler::ha_xxxx() for faster execution.
- Changed some constants to enum's and define's.
- Using separate column read and write sets allows for easier checking
of timestamp field was set by statement.
- Remove calls to free_io_cache() as this is now done automaticly in ha_reset()
- Don't build table->normalized_path as this is now identical to table->path
(after bar's fixes to convert filenames)
- Fixed some missed DBUG_PRINT(.."%lx") to use "0x%lx" to make it easier to
do comparision with the 'convert-dbug-for-diff' tool.
Things left to do in 5.1:
- We wrongly log failed CREATE TABLE ... SELECT in some cases when using
row based logging (as shown by testcase binlog_row_mix_innodb_myisam.result)
Mats has promised to look into this.
- Test that my fix for CREATE TABLE ... SELECT is indeed correct.
(I added several test cases for this, but in this case it's better that
someone else also tests this throughly).
Lars has promosed to do this.
BitKeeper/etc/ignore:
added mysys/test_bitmap
include/base64.h:
Removed my_global.h, as this must be included first in any program
include/heap.h:
Added heap_reset() (Required by new handler interface)
include/my_base.h:
Removed HA_EXTRA_RESET. MySQL will now call ::reset() instead of ::extra(HA_EXTRA_RESET).
HA_EXTRA_RETRIVE_ALL_COLS and HA_EXTRA_RETRIVE_PRIMARY key are deleted as the column bitmaps makes these unnecessary
include/my_bitmap.h:
Remove my_pthread.h (should be included at upper level)
Introduced my_bitmap_map typedef to make it the bitmap handling more like a black box
Added bitmap_is_overlapping(), bitmap_test_and_clear(), bitmap_copy() and bitmap_cmp()
Made bitmap_set_bit(), bitmap_flip_bit(), bitmap_clear_bit() return void
include/myisam.h:
Added mi_reset() (Required by new handler interface)
include/myisammrg.h:
Added myrg_reset() (Required by new handler interface)
include/mysql_com.h:
Added flag FIELD_IN_ADD_INDEX to be able to remove Field->add_index
mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test:
Added testing of CREATE ... SELECT in a mixed environment
(This found some bugs that Mats is going to fix shortly)
mysql-test/install_test_db.sh:
Simplify ldata usage
Added --tmpdir=. option to mysqld bootstrap (Removed some warnings when TMPDIR was wrongly set)
mysql-test/mysql-test-run.pl:
Added --tmpdir=. to bootstrap
mysql-test/mysql-test-run.sh:
Use copy instead of INSTALL_DB for master and slave databases.
(Speeds up startup time a lot!)
Remove snapshot directories at startup (removes some strange warnings)
mysql-test/r/binlog_row_mix_innodb_myisam.result:
Added testing of CREATE ... SELECT in a mixed environment
(This found some bugs that Mats is going to fix shortly)
mysql-test/r/binlog_stm_mix_innodb_myisam.result:
Added testing of CREATE ... SELECT in a mixed environment
mysql-test/r/create.result:
Some extra tests of warnings and number of tables opened by CREATE ... SELECT
mysql-test/r/federated.result:
Drop some left over tables
Added testing of multiple table update and multiple table delete (with and without keys)
mysql-test/r/func_gconcat.result:
Enable some disabled tests (converted them slightly to be predictable)
mysql-test/r/func_time.result:
Added drop of test function
mysql-test/r/innodb_mysql.result:
Added tests for CREATE ... SELECT
mysql-test/r/insert.result:
More tests
Added testing of duplicate columns in insert
mysql-test/r/loaddata.result:
Added testing LOAD DATA ... SET ...
mysql-test/r/multi_update.result:
Test multi updates and deletes using primary key and without
mysql-test/r/ndb_index_unique.result:
Better error message
mysql-test/r/ndb_replace.result:
New correct result after fixing REPLACE handling with NDB
mysql-test/r/rpl_ddl.result:
Now we don't get these (wrong) warnings anymore
mysql-test/r/view_grant.result:
Drop used views
mysql-test/t/create.test:
Some extra tests of warnings and number of tables opened by CREATE ... SELECT
mysql-test/t/federated.test:
Drop some left over tables
Added testing of multiple table update and multiple table delete (with and without keys)
mysql-test/t/func_gconcat.test:
Enable some disabled tests (converted them slightly to be predictable)
mysql-test/t/func_time.test:
Added drop of test function
mysql-test/t/innodb_mysql.test:
Added tests for CREATE ... SELECT
mysql-test/t/insert.test:
More tests
Added testing of duplicate columns in insert
mysql-test/t/loaddata.test:
Added testing LOAD DATA ... SET ...
mysql-test/t/multi_update.test:
Test multi updates and deletes using primary key and without
mysql-test/t/view_grant.test:
Drop used views
mysql-test/valgrind.supp:
Added supression of not needed warnings when printing stack trace
mysys/base64.c:
Include my_global.h first
mysys/my_bitmap.c:
Added bitmap_is_overlapping(), bitmap_test_and_clear() and bitmap_copy()
Changed logic of bitmap handling to be a bit more efficent (Did this together with Mikael Ronström)
Now the 'extra, not used bits' in the bitmap are assumed to have a 'random value' and the bitmap functions are free to change them whenever needed.
Changed how mutex is allocated to make 'bitmap_free()' function simpler.
mysys/thr_lock.c:
Added 0x before thread pointers (for easier comparison of DBUG traces)
sql/event.cc:
Ensure 'use_all_columns()' is used for event tables
Don't print warning that event table is damaged if it doesn't exists.
sql/field.cc:
Added ASSERT_COLUMN_MARKED_FOR_WRITE in all store() methods and ASSERT_COLUMN_MARKED_FOR_READ in all val() methods to catch wrong setting if table->read_set and table->write_set
(Rest of changes are only indentation cleanups)
sql/field.h:
Removed Field->query_id (replaced by table->read_set and table->write_set)
Removed Field->fieldnr (use Field->field_index instead)
Removed Field->add_index (Use Field->flags instead)
Add Field->part_of_key_not_clustered (for usage in opt_range.cc)
sql/filesort.cc:
Added paramater sort_postion to filesort() to force sorting by position instead of storing all fields in the result set.
This allowed me to remove checking of sql_command.
Create a temporary column bitmap for fields that are used by the sorting process.
Use column bitmaps instead of query_id
sql/ha_berkeley.cc:
Update to 'newer' table handler interface
sql/ha_berkeley.h:
Update to 'newer' table handler interface
sql/ha_federated.cc:
Update to 'newer' table handler interface
Only read columns that are needed from remote server.
In case of eq ranges, don't generate two conditions in the WHERE clause
(this can still be optimized, but would require a bigger code change)
Use 'simpler to use' XXXX_LEN' macros
A bit simpler logic in ::write_row() when creating statements.
In update, only include test of fields actually read.
(This greatly simplifies the queries sent by the federated engine)
Similar changes done for delete_row()
sql/ha_federated.h:
Update to 'newer' table handler interface
Changed XXX_LEN macros to use sizeof(...)-1, to simplify usage in ha_federated.cc
Added HA_PRIMARY_KEY_REQUIRED_FOR_DELETE to tell MySQL to read all primary key columns in case of DELETE
sql/ha_heap.cc:
Update to 'newer' table handler interface
sql/ha_heap.h:
Update to 'newer' table handler interface
sql/ha_innodb.cc:
Update to 'newer' table handler interface
- Update innobase_create_handler() to new interface
- Removed HA_NOT_EXACT_COUNT (not needed)
- Renamed HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS to HA_PRIMARY_KEY_REQUIRED_FOR_POSITION.
- Prefixed base status variables with 'stats'
- Use table column bitmaps instead of ha_get_bit_in_read_set()
- Added ::reset(), with code from ::extra(HA_EXTRA_RESET)
- Removed HA_EXTRA_RETRIVE_ALL_COLS and HA_EXTRA_RETRIEVE_PRIMARY_KEY as
the table->read_set and table->write_set bitmaps now are accurate
sql/ha_innodb.h:
Update to 'newer' table handler interface
- table_flags are now ulonglong
- Added reset() method
- Removed not needed ha_retrieve_all_cols() and ha_retrieve_all_pk() columns.
- Made build_template() a class function to be able to easier access class variables
sql/ha_myisam.cc:
Update to 'newer' table handler interface
sql/ha_myisam.h:
Update to 'newer' table handler interface
sql/ha_myisammrg.cc:
Update to 'newer' table handler interface
sql/ha_myisammrg.h:
Update to 'newer' table handler interface
sql/ha_ndbcluster.cc:
Update to 'newer' table handler interface
Fixed use_blob_value() to be accurate
In ::complemented_read() we have to check both the read and write bitmap as the old code did mark all changed columns also in the read map
Correct dumping of field data with DBUG_DUMP
Prefix addresses in DBUG_PRINT with 0x
Fixed usage of not initialized memory
Update to use field->flags & FIELD_IN_ADD_INDEX instead of field->add_index.
sql/ha_ndbcluster.h:
Update to 'newer' table handler interface
sql/ha_ndbcluster_binlog.cc:
Mark usage of all columns in ndbcluster binlog tables
false -> FALSE, true -> TRUE
Use table->s->all_set instead of creating a temporary bitmap.
sql/ha_partition.cc:
Update to 'newer' table handler interface
Added memroot to initialise_partitions() and related functions to get faster memory allocation.
partition_create_handler() is now responsible for initialisation of the partition object
Some trivial optimizations and indentation fixes
Ensure that table_flags() are up to date
Removed documentation for removed HA_EXTRA flags
Fixed 'strange' usage of m_file[i] in new_handlers_from_part_info()that worked in current code 'by chance'
sql/ha_partition.h:
Update to 'newer' table handler interface
sql/handler.cc:
create_xxx handler now takes MEMROOT as an argument to simplify memory allocation.
Much simpler get_new_handler()
(Initialization of the object is now handled by the create method for the engine)
Moved all allocation of bitmap handling to the TABLE object (in table.cc)
Added column_bitmaps_signal() to signal column usage changes.
Changed binlog_log_row() to use the exiusting all_set bitmap in the table object.
Added ha_reset() function to test that the file object is ok at end of statement and call handler::reset()
Added use_hidden_primary_key() to signal handler that we we are going to read and update + delete the row and the handler should thus remember the position for the row
sql/handler.h:
Added HA_NO_TRANSACTIONS, HA_PARTIAL_COLUMN_READ, HA_REQUIRES_KEY_COLUMNS_FOR_DELETE,HA_PRIMARY_KEY_REQUIRED_FOR_DELETE and HA_HAS_RECORDS
Removed HA_NOT_EXACT_COUNT, HA_READ_RND_SAME
HA_DUPP_POS -> HA_DUPLICATE_POS
HA_NOT_EXACT_COUNT replaced by HA_STATS_RECORDS_IS_EXACT, HA_HAS_RECORDS and records()
HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS renamed to HA_PRIMARY_KEY_REQUIRED_FOR_POSITION
Added future row type 'ROW_TYPE_PAGES'
Added MEM_ROOT to handlerton 'create' function
Added ha_statistics, a structure for all status variable in the base handler class.
Moved all status variables in the handler class into a stats structs to improve readability.
ha_table_flags() is now a cached (not virtual) version of table_flags()
reset() doesn't anymore call extra(HA_EXTRA_RESET) but is a function of it's own.
Renamed dupp_ref to dup_ref
Renamed not used handler::sortkey
Moved read_set and write_set to TABLE structure
handler::init() function added for cacheing of virtual constants from engine.
sql/item.cc:
Added register_field_in_read_map() for marking used columns in expression.
This is used by filesort() for creating an optimal column bitmap while retrieving columns for sorting.
Initalize value.cs_info.character_set_client to fix core dump bug with --debug
set_query_id -> mark_used_columns
Mark used columns in read_set OR write_set.
sql/item.h:
Removed reset_query_id_processor() as it's not needed anymore.
Added register_field_in_read_map()
Added extra argument to Item::walk() to indicate if we should also
traverse sub queries.
sql/item_cmpfunc.cc:
Temporary mark used columns to be read/writable
Update Item::walk to new interface
sql/item_cmpfunc.h:
Added extra argument to Item::walk() to indicate if we should also traverse sub queries.
sql/item_func.cc:
Update Item::walk() to new interface
table_flags() -> ha_table_flags()
sql/item_func.h:
Update Item::walk() to new interface
sql/item_row.cc:
Update Item::walk() to new interface
sql/item_row.h:
Update Item::walk() to new interface
sql/item_strfunc.h:
Update Item::walk() to new interface
sql/item_subselect.cc:
Added Item_subselect::walk()
(It was a bug it was missing before. Not sure what kind of bugs this could have caused)
sql/item_subselect.h:
Update Item::walk() to new interface
sql/item_sum.cc:
Update Item::walk() to new interface
Updates for new handler interace
sql/item_sum.h:
Update Item::walk() to new interface
sql/key.cc:
Updates for new handler interace
sql/log.cc:
Mark all columns used for log tables
Split options flag
Ensured that second argument to trans_register_ha is a bool
sql/log_event.cc:
Fixed comments to be withing 79 characters
Use OPTION_KEEP_LOG instead of OPTION_STATUS_NO_TRANS_UPDATE to remove wrong warnings
Updates for new handler interface
Use 0x%lx instead of %p (portability problem)
sql/mysql_priv.h:
Added OPTION_KEEP_LOG to indicate that we should replicate the binlog even on rollback
Removed not used 'conds' argument to setup_tables
sql/mysqld.cc:
Indentation fixes and removed old comment
sql/opt_range.cc:
Update to new handler and bitmap interface.
Fixed calls to cp_buffer_from_ref() and walk() (new argument).
Create new temporary bitmaps for ror scans.
(Needed because of handler changes and to get more accurate column bitmaps than before)
Remove not needed file->ha_reset() call before file->close().
Some trivial optimization and indentation fixes.
Use Field->part_of_key_not_clustered() to check if field is part of a key, instead of looping over all key parts.
Added flag 'in_ror_merged_scan' to allow ::get_next() to know that we need a special column bitmap to only fetch pointer to record.
This is needed because ror scan uses the same TABLE object but different file objects, which creates problem for the column bitmap handling.
(This is a temporary solution. A better one would be to allocate an own TABLE object for ROR scans)
Optimized bitmap handling in ror scans:
- Start bitmap at position 0, not 1
- Use same bitmap size as in TABLE
- Use table->read_set and table->write_set to create column bitmaps instead of looping over all fields in table
sql/opt_range.h:
Added 'in_ror_merged_scan' to indicate if we are doing a ROR scan
Added temporary column bitmaps used in ROR scans
sql/opt_sum.cc:
Added get_ext_record_count() which is used in COUNT() optimization if handler has HA_HAS_RECORDS
Note that we don't call this if handler has HA_STATS_RECORDS_IS_EXACT set.
sql/protocol.cc:
We need to mark columns as readable in ::store() as we sometimes return default value for fields to the user
sql/records.cc:
Updates for new handler interface
sql/set_var.cc:
Handle splitting OPTION_STATUS_NO_TRANS_UPDATE to two flags
sql/share/errmsg.txt:
Fixed wrong
sql/sp.cc:
Mark that we are using all columns for the proc table
Update call to setup_tables() to use new prototype
sql/sp_head.cc:
Removed QQ comment
sql/spatial.cc:
Removed wrong QQ comment
sql/sql_acl.cc:
Mark that we need all columns for acl tables
Supply memroot to some 'new' calls.
Indentation fixes
sql/sql_base.cc:
set_query_id removed
Ensure we call ha_reset() at end of each statement
Mark read columns in read_set and changed columns in write_set (Before all columns was marked in read set)
Fixed marking of some columns that was not proplerly marked before
Maintain in TABLE->merge_keys set of all keys that are used in some way
Removed not used 'conds' argument from setup_tables()
Remove not used setting of 'dupp_field' in insert_fields()
Added missing FN_LIBCHAR in mysql_rm_tmp_tables()
(This has probably caused us to not properly remove temporary files after crash)
sql/sql_bitmap.h:
Added is_overlapping()
sql/sql_class.cc:
Slow_logs was not properly initialized, which could maybe cause extra/lost entries in slow log.
set_query_id -> mark_used_columns
Simpler variable usage in pack_row() (cleanup)
Moved some variable declartion at start of function for better code readability
sql/sql_class.h:
Added enum_mark_columns
Updated comments
Renamed dupp_field -> dup_field
Added virtual function 'can_rollback_data()' to select_insert() to be used in CREATE ... SELECT to optimize use of OPTION_STATUS_NO_TRANS_UPDATE.
(This fixes a bug in CREATE ... SELECT where we did give wrong warnings when using non transacational tables)
sql/sql_delete.cc:
Updates to new handler interface
Call table->mark_columns_needed_for_delete() to allow us to put additional columns in column usage maps if handler so requires.
Call table->prepare_for_position() to tell handler that we are going to call ha_position().
Removed call to free_io_cache(). (io_cache is now removed in ha_reset()).
Fixed calls to setup_tables()
sql/sql_do.cc:
Update call to setup_fields()
sql/sql_handler.cc:
Tell handler tables to always read all columns.
Use temporary column map when storing value in field for later index usage
sql/sql_help.cc:
Makr all used fields to be read
Update call to setup_fields()
sql/sql_insert.cc:
Tell handler we are going to update the auto_increment column
dupp_field -> dup_field
Set column usage bits for timestamp field.
Call table->mark_columns_needed_for_insert() and table->mark_auto_increment_column()
Removed not used argument from mysql_prepare_insert_check_table().
If we get an duplicate row on insert, change column map to read and write all columns while retrying the operatation.
This is required by the definition of REPLACE and also ensures that fields that are only part of UPDATE are properly handled.
This fixed a bug in NDB and REPLACE where REPLACE wrongly copied some column values from the replaced row.
Setup new bitmaps for delayed insert rows
Remove reseting of next_number_fields as it will be reset on next call to handler_insert()
Fixed usage of thd->options and OPTION_STATUS_NO_TRANS_UPDATE.
The issue was that one should not to reset this flag as it may be set by a previous statement.
The way it was now used caused us to loose some warnings and get other wrong warnings when using non transactional tables mixed with transactional.
I fixed it by introducing 'select_insert::can_rollback_data' to inform send_error() that the given statement can be rolled back (which in case of CREATE TABLE can always be done)
Don't close tables created with CREATE ... SELECT but keep them in the table cache.
Moved out MY_HOOKS from inside function (better readability)
sql/sql_load.cc:
Update to use new handler and column marking interface
Update using setup_tables()
sql/sql_olap.cc:
Update calls to setup_tables
Use enums instead of constants to setup_fields()
sql/sql_parse.cc:
Handle OPTION_KEEP_LOG:
- Set it on CREATE TEMPORARY TABLE / DROP TABLE
- Reset it when OPTION_STATUS_NO_TRANS_UPDATE is reset
- Don't set it for CREATE ... SELECT (this is handled in select_create class)
Remove reseting of OPTION_STATUS_NO_TRANS_UPDATE in begin_trans() as this should already be reset.
If in autocommit mode, reset OPTION_KEEP_LOG and OPTION_STATUS_NO_TRANS_UPDATE to not give warnings in future commands
sql/sql_partition.cc:
Update walk() usage
Trivial indentation fixes
sql/sql_plugin.cc:
Mark all columns as used for plugins
sql/sql_prepare.cc:
Added assert to find out hidden bugs in character_set_client (got an error in debug binary when this not set correctly)
Updates for new handler interface
Update calls to setup_fields()
sql/sql_repl.cc:
Indentation fixes
sql/sql_select.cc:
Update call to setup_tables() and setup_fields()
Remove some old disabled code
Update to new hadler interface
Indentation cleanups
Added column bitmaps for temporary tables.
Remove updating of the removed slots in the Field class
Added TABLE argument to cp_buffer_from_ref() (To be able to install temporary column maps)
For internal temporary tables, use handler::write_row(), handler::delete_row() and handler::update_row() instead of handler::ha_xxxx() for faster execution.
sql/sql_select.h:
Indentaition fixes.
Install temporary column usage maps when needed
Added TABLE element to cp_buffer_from_ref()
sql/sql_show.cc:
Update to new handler interface
Mark all columns used for internal tables.
Style fixes.
Added support for 'future' ROW_TYPE_PAGES.
Don't allocate TMP_TABLE_PARAM with calloc. The 'init()' function will initialize the structure properly.
sql/sql_table.cc:
Update to new handler interface
Simple my_snprintf -> strmake()
Changed some constants to defines
Don't test for NULL in primary key (as we a couple of line above force the PRIMARY KEY to be NOT NULL)
Change field->add_index to use field->flags & FIELD_IN_ADD_INDEX
Mark all columns as used for ALTER TABLE
Style fixes
Update call to filesort()
sql/sql_trigger.h:
Added friend functions to be able to test if triggers exists for table we are going to insert/update or delete in.
sql/sql_udf.cc:
Mark all columns as used for udf system table.
sql/sql_union.cc:
Update call to walk()
Update to new handler interface
sql/sql_update.cc:
Remove query_id argument from compare_record()
Use column bitmaps instead of query_id.
We can't use compare_records() to skip updates for handlers that returns a partial column set and the read_set doesn't cover all columns in the write set, because compare_record() can't in this case know if a not read column changed value.
Update call to setup_fields()
Using separate column read and write sets allows for easier checking of timestamp field was set by statement.
Removed call to free_io_cache() as this is now done in ha_reset()
Call table->mark_columns_needed_for_update() and table->prepare_for_position()
Style fixes
sql/sql_view.cc:
Style fixes
sql/table.cc:
Remove implicitely include 'errno.h'
Remove code for building normalized path, as this is now identical to 'path'
Remove field->fieldnr
Added update of field->part_of_key_not_clustered()
Create column bitmaps in TABLE and TABLE_SHARE
Don't setup a temporary MEM_ROOT object as a thread specific variable for the handler. Instead we send the to-be-used MEMROOT to get_new_handler()
Update to new handler interface
Update call to walk()
Added new functions:
- st_table::clear_column_bitmaps()
- st_table::prepare_for_position()
- st_table::mark_columns_used_by_index()
- st_table::restore_column_maps_after_mark_index()
- st_table::mark_columns_used_by_index_no_reset()
- st_table::mark_auto_increment_column()
- st_table::mark_columns_needed_for_delete()
- st_table::mark_columns_needed_for_update()
- st_table::mark_columns_needed_for_insert()
sql/table.h:
Moved column usage bitmaps from handler to TABLE
Added to TABLE_SHARE all_set and column_bitmap_size
Added to TABLE merge_keys, bitmap_init_values, def_read_set, def_write_set, tmp_set, read_set and write_set.
Declared all new table column bitmap functions
Added TABLE functions column_bitmaps_set(), column_bitmaps_set_no_signal(), use_all_columns() and default_column_bitmaps()
Added functions: tmp_use_all_columns() and tmp_restore_column_map() to temporarly switch column bitmaps
Added functions: dbug_tmp_use_all_columns() and dbug_tmp_restore_column_map() to temporarly switch column bitmaps to avoid asserts in Field::store() and Field::val().
sql/tztime.cc:
Mark all columns as used for timezone tables
storage/archive/ha_archive.cc:
Update to new handler interface
storage/archive/ha_archive.h:
Update to new handler interface
storage/blackhole/ha_blackhole.cc:
Update to new handler interface
storage/blackhole/ha_blackhole.h:
Update to new handler interface
removed not needed flag HA_DUPP_POS
storage/csv/ha_tina.cc:
Update to new handler interface
storage/csv/ha_tina.h:
Update to new handler interface
storage/example/ha_example.cc:
Update to new handler interface
storage/example/ha_example.h:
Update to new handler interface
storage/heap/hp_extra.c:
Added heap_reset() (Required by new handler interface)
storage/heap/hp_test2.c:
Use heap_reset()
storage/myisam/ft_boolean_search.c:
Fixed compiler warning
storage/myisam/mi_extra.c:
Added mi_reset() (Required by new handler interface)
storage/myisam/mi_search.c:
Fixed DBUG_PRINT messages to use 0x%lx instead of %lx
storage/myisam/mi_test2.c:
Use mi_reset()
storage/myisam/myisampack.c:
Use mi_reset()
storage/myisammrg/myrg_extra.c:
Added myrg_reset() (Required by new handler interface)
unittest/mysys/base64.t.c:
Include my_global.h
Don't include implictely include file 'stdlib.h'
2006-06-04 17:52:22 +02:00
|
|
|
bool new_handlers_from_part_info(MEM_ROOT *mem_root);
|
|
|
|
bool create_handlers(MEM_ROOT *mem_root);
|
2005-07-18 13:31:02 +02:00
|
|
|
void clear_handler_file();
|
2006-08-07 12:22:08 +02:00
|
|
|
int set_up_table_before_create(TABLE *table_arg,
|
|
|
|
const char *partition_name_with_path,
|
|
|
|
HA_CREATE_INFO *info,
|
|
|
|
partition_element *p_elem);
|
2005-07-18 13:31:02 +02:00
|
|
|
partition_element *find_partition_element(uint part_id);
|
2013-06-15 17:32:08 +02:00
|
|
|
bool insert_partition_name_in_hash(const char *name, uint part_id,
|
|
|
|
bool is_subpart);
|
|
|
|
bool populate_partition_name_hash();
|
|
|
|
Partition_share *get_share();
|
2020-02-28 13:01:27 +01:00
|
|
|
bool set_ha_share_ref(Handler_share **ha_share) override;
|
2013-06-27 13:01:03 +02:00
|
|
|
void fix_data_dir(char* path);
|
2013-06-15 17:32:08 +02:00
|
|
|
bool init_partition_bitmaps();
|
|
|
|
void free_partition_bitmaps();
|
This changeset is largely a handler cleanup changeset (WL#3281), but includes fixes and cleanups that was found necessary while testing the handler changes
Changes that requires code changes in other code of other storage engines.
(Note that all changes are very straightforward and one should find all issues
by compiling a --debug build and fixing all compiler errors and all
asserts in field.cc while running the test suite),
- New optional handler function introduced: reset()
This is called after every DML statement to make it easy for a handler to
statement specific cleanups.
(The only case it's not called is if force the file to be closed)
- handler::extra(HA_EXTRA_RESET) is removed. Code that was there before
should be moved to handler::reset()
- table->read_set contains a bitmap over all columns that are needed
in the query. read_row() and similar functions only needs to read these
columns
- table->write_set contains a bitmap over all columns that will be updated
in the query. write_row() and update_row() only needs to update these
columns.
The above bitmaps should now be up to date in all context
(including ALTER TABLE, filesort()).
The handler is informed of any changes to the bitmap after
fix_fields() by calling the virtual function
handler::column_bitmaps_signal(). If the handler does caching of
these bitmaps (instead of using table->read_set, table->write_set),
it should redo the caching in this code. as the signal() may be sent
several times, it's probably best to set a variable in the signal
and redo the caching on read_row() / write_row() if the variable was
set.
- Removed the read_set and write_set bitmap objects from the handler class
- Removed all column bit handling functions from the handler class.
(Now one instead uses the normal bitmap functions in my_bitmap.c instead
of handler dedicated bitmap functions)
- field->query_id is removed. One should instead instead check
table->read_set and table->write_set if a field is used in the query.
- handler::extra(HA_EXTRA_RETRIVE_ALL_COLS) and
handler::extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY) are removed. One should now
instead use table->read_set to check for which columns to retrieve.
- If a handler needs to call Field->val() or Field->store() on columns
that are not used in the query, one should install a temporary
all-columns-used map while doing so. For this, we provide the following
functions:
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
field->val();
dbug_tmp_restore_column_map(table->read_set, old_map);
and similar for the write map:
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->write_set);
field->val();
dbug_tmp_restore_column_map(table->write_set, old_map);
If this is not done, you will sooner or later hit a DBUG_ASSERT
in the field store() / val() functions.
(For not DBUG binaries, the dbug_tmp_restore_column_map() and
dbug_tmp_restore_column_map() are inline dummy functions and should
be optimized away be the compiler).
- If one needs to temporary set the column map for all binaries (and not
just to avoid the DBUG_ASSERT() in the Field::store() / Field::val()
methods) one should use the functions tmp_use_all_columns() and
tmp_restore_column_map() instead of the above dbug_ variants.
- All 'status' fields in the handler base class (like records,
data_file_length etc) are now stored in a 'stats' struct. This makes
it easier to know what status variables are provided by the base
handler. This requires some trivial variable names in the extra()
function.
- New virtual function handler::records(). This is called to optimize
COUNT(*) if (handler::table_flags() & HA_HAS_RECORDS()) is true.
(stats.records is not supposed to be an exact value. It's only has to
be 'reasonable enough' for the optimizer to be able to choose a good
optimization path).
- Non virtual handler::init() function added for caching of virtual
constants from engine.
- Removed has_transactions() virtual method. Now one should instead return
HA_NO_TRANSACTIONS in table_flags() if the table handler DOES NOT support
transactions.
- The 'xxxx_create_handler()' function now has a MEM_ROOT_root argument
that is to be used with 'new handler_name()' to allocate the handler
in the right area. The xxxx_create_handler() function is also
responsible for any initialization of the object before returning.
For example, one should change:
static handler *myisam_create_handler(TABLE_SHARE *table)
{
return new ha_myisam(table);
}
->
static handler *myisam_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
{
return new (mem_root) ha_myisam(table);
}
- New optional virtual function: use_hidden_primary_key().
This is called in case of an update/delete when
(table_flags() and HA_PRIMARY_KEY_REQUIRED_FOR_DELETE) is defined
but we don't have a primary key. This allows the handler to take precisions
in remembering any hidden primary key to able to update/delete any
found row. The default handler marks all columns to be read.
- handler::table_flags() now returns a ulonglong (to allow for more flags).
- New/changed table_flags()
- HA_HAS_RECORDS Set if ::records() is supported
- HA_NO_TRANSACTIONS Set if engine doesn't support transactions
- HA_PRIMARY_KEY_REQUIRED_FOR_DELETE
Set if we should mark all primary key columns for
read when reading rows as part of a DELETE
statement. If there is no primary key,
all columns are marked for read.
- HA_PARTIAL_COLUMN_READ Set if engine will not read all columns in some
cases (based on table->read_set)
- HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS
Renamed to HA_PRIMARY_KEY_REQUIRED_FOR_POSITION.
- HA_DUPP_POS Renamed to HA_DUPLICATE_POS
- HA_REQUIRES_KEY_COLUMNS_FOR_DELETE
Set this if we should mark ALL key columns for
read when when reading rows as part of a DELETE
statement. In case of an update we will mark
all keys for read for which key part changed
value.
- HA_STATS_RECORDS_IS_EXACT
Set this if stats.records is exact.
(This saves us some extra records() calls
when optimizing COUNT(*))
- Removed table_flags()
- HA_NOT_EXACT_COUNT Now one should instead use HA_HAS_RECORDS if
handler::records() gives an exact count() and
HA_STATS_RECORDS_IS_EXACT if stats.records is exact.
- HA_READ_RND_SAME Removed (no one supported this one)
- Removed not needed functions ha_retrieve_all_cols() and ha_retrieve_all_pk()
- Renamed handler::dupp_pos to handler::dup_pos
- Removed not used variable handler::sortkey
Upper level handler changes:
- ha_reset() now does some overall checks and calls ::reset()
- ha_table_flags() added. This is a cached version of table_flags(). The
cache is updated on engine creation time and updated on open.
MySQL level changes (not obvious from the above):
- DBUG_ASSERT() added to check that column usage matches what is set
in the column usage bit maps. (This found a LOT of bugs in current
column marking code).
- In 5.1 before, all used columns was marked in read_set and only updated
columns was marked in write_set. Now we only mark columns for which we
need a value in read_set.
- Column bitmaps are created in open_binary_frm() and open_table_from_share().
(Before this was in table.cc)
- handler::table_flags() calls are replaced with handler::ha_table_flags()
- For calling field->val() you must have the corresponding bit set in
table->read_set. For calling field->store() you must have the
corresponding bit set in table->write_set. (There are asserts in
all store()/val() functions to catch wrong usage)
- thd->set_query_id is renamed to thd->mark_used_columns and instead
of setting this to an integer value, this has now the values:
MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE
Changed also all variables named 'set_query_id' to mark_used_columns.
- In filesort() we now inform the handler of exactly which columns are needed
doing the sort and choosing the rows.
- The TABLE_SHARE object has a 'all_set' column bitmap one can use
when one needs a column bitmap with all columns set.
(This is used for table->use_all_columns() and other places)
- The TABLE object has 3 column bitmaps:
- def_read_set Default bitmap for columns to be read
- def_write_set Default bitmap for columns to be written
- tmp_set Can be used as a temporary bitmap when needed.
The table object has also two pointer to bitmaps read_set and write_set
that the handler should use to find out which columns are used in which way.
- count() optimization now calls handler::records() instead of using
handler->stats.records (if (table_flags() & HA_HAS_RECORDS) is true).
- Added extra argument to Item::walk() to indicate if we should also
traverse sub queries.
- Added TABLE parameter to cp_buffer_from_ref()
- Don't close tables created with CREATE ... SELECT but keep them in
the table cache. (Faster usage of newly created tables).
New interfaces:
- table->clear_column_bitmaps() to initialize the bitmaps for tables
at start of new statements.
- table->column_bitmaps_set() to set up new column bitmaps and signal
the handler about this.
- table->column_bitmaps_set_no_signal() for some few cases where we need
to setup new column bitmaps but don't signal the handler (as the handler
has already been signaled about these before). Used for the momement
only in opt_range.cc when doing ROR scans.
- table->use_all_columns() to install a bitmap where all columns are marked
as use in the read and the write set.
- table->default_column_bitmaps() to install the normal read and write
column bitmaps, but not signaling the handler about this.
This is mainly used when creating TABLE instances.
- table->mark_columns_needed_for_delete(),
table->mark_columns_needed_for_delete() and
table->mark_columns_needed_for_insert() to allow us to put additional
columns in column usage maps if handler so requires.
(The handler indicates what it neads in handler->table_flags())
- table->prepare_for_position() to allow us to tell handler that it
needs to read primary key parts to be able to store them in
future table->position() calls.
(This replaces the table->file->ha_retrieve_all_pk function)
- table->mark_auto_increment_column() to tell handler are going to update
columns part of any auto_increment key.
- table->mark_columns_used_by_index() to mark all columns that is part of
an index. It will also send extra(HA_EXTRA_KEYREAD) to handler to allow
it to quickly know that it only needs to read colums that are part
of the key. (The handler can also use the column map for detecting this,
but simpler/faster handler can just monitor the extra() call).
- table->mark_columns_used_by_index_no_reset() to in addition to other columns,
also mark all columns that is used by the given key.
- table->restore_column_maps_after_mark_index() to restore to default
column maps after a call to table->mark_columns_used_by_index().
- New item function register_field_in_read_map(), for marking used columns
in table->read_map. Used by filesort() to mark all used columns
- Maintain in TABLE->merge_keys set of all keys that are used in query.
(Simplices some optimization loops)
- Maintain Field->part_of_key_not_clustered which is like Field->part_of_key
but the field in the clustered key is not assumed to be part of all index.
(used in opt_range.cc for faster loops)
- dbug_tmp_use_all_columns(), dbug_tmp_restore_column_map()
tmp_use_all_columns() and tmp_restore_column_map() functions to temporally
mark all columns as usable. The 'dbug_' version is primarily intended
inside a handler when it wants to just call Field:store() & Field::val()
functions, but don't need the column maps set for any other usage.
(ie:: bitmap_is_set() is never called)
- We can't use compare_records() to skip updates for handlers that returns
a partial column set and the read_set doesn't cover all columns in the
write set. The reason for this is that if we have a column marked only for
write we can't in the MySQL level know if the value changed or not.
The reason this worked before was that MySQL marked all to be written
columns as also to be read. The new 'optimal' bitmaps exposed this 'hidden
bug'.
- open_table_from_share() does not anymore setup temporary MEM_ROOT
object as a thread specific variable for the handler. Instead we
send the to-be-used MEMROOT to get_new_handler().
(Simpler, faster code)
Bugs fixed:
- Column marking was not done correctly in a lot of cases.
(ALTER TABLE, when using triggers, auto_increment fields etc)
(Could potentially result in wrong values inserted in table handlers
relying on that the old column maps or field->set_query_id was correct)
Especially when it comes to triggers, there may be cases where the
old code would cause lost/wrong values for NDB and/or InnoDB tables.
- Split thd->options flag OPTION_STATUS_NO_TRANS_UPDATE to two flags:
OPTION_STATUS_NO_TRANS_UPDATE and OPTION_KEEP_LOG.
This allowed me to remove some wrong warnings about:
"Some non-transactional changed tables couldn't be rolled back"
- Fixed handling of INSERT .. SELECT and CREATE ... SELECT that wrongly reset
(thd->options & OPTION_STATUS_NO_TRANS_UPDATE) which caused us to loose
some warnings about
"Some non-transactional changed tables couldn't be rolled back")
- Fixed use of uninitialized memory in ha_ndbcluster.cc::delete_table()
which could cause delete_table to report random failures.
- Fixed core dumps for some tests when running with --debug
- Added missing FN_LIBCHAR in mysql_rm_tmp_tables()
(This has probably caused us to not properly remove temporary files after
crash)
- slow_logs was not properly initialized, which could maybe cause
extra/lost entries in slow log.
- If we get an duplicate row on insert, change column map to read and
write all columns while retrying the operation. This is required by
the definition of REPLACE and also ensures that fields that are only
part of UPDATE are properly handled. This fixed a bug in NDB and
REPLACE where REPLACE wrongly copied some column values from the replaced
row.
- For table handler that doesn't support NULL in keys, we would give an error
when creating a primary key with NULL fields, even after the fields has been
automaticly converted to NOT NULL.
- Creating a primary key on a SPATIAL key, would fail if field was not
declared as NOT NULL.
Cleanups:
- Removed not used condition argument to setup_tables
- Removed not needed item function reset_query_id_processor().
- Field->add_index is removed. Now this is instead maintained in
(field->flags & FIELD_IN_ADD_INDEX)
- Field->fieldnr is removed (use field->field_index instead)
- New argument to filesort() to indicate that it should return a set of
row pointers (not used columns). This allowed me to remove some references
to sql_command in filesort and should also enable us to return column
results in some cases where we couldn't before.
- Changed column bitmap handling in opt_range.cc to be aligned with TABLE
bitmap, which allowed me to use bitmap functions instead of looping over
all fields to create some needed bitmaps. (Faster and smaller code)
- Broke up found too long lines
- Moved some variable declaration at start of function for better code
readability.
- Removed some not used arguments from functions.
(setup_fields(), mysql_prepare_insert_check_table())
- setup_fields() now takes an enum instead of an int for marking columns
usage.
- For internal temporary tables, use handler::write_row(),
handler::delete_row() and handler::update_row() instead of
handler::ha_xxxx() for faster execution.
- Changed some constants to enum's and define's.
- Using separate column read and write sets allows for easier checking
of timestamp field was set by statement.
- Remove calls to free_io_cache() as this is now done automaticly in ha_reset()
- Don't build table->normalized_path as this is now identical to table->path
(after bar's fixes to convert filenames)
- Fixed some missed DBUG_PRINT(.."%lx") to use "0x%lx" to make it easier to
do comparision with the 'convert-dbug-for-diff' tool.
Things left to do in 5.1:
- We wrongly log failed CREATE TABLE ... SELECT in some cases when using
row based logging (as shown by testcase binlog_row_mix_innodb_myisam.result)
Mats has promised to look into this.
- Test that my fix for CREATE TABLE ... SELECT is indeed correct.
(I added several test cases for this, but in this case it's better that
someone else also tests this throughly).
Lars has promosed to do this.
BitKeeper/etc/ignore:
added mysys/test_bitmap
include/base64.h:
Removed my_global.h, as this must be included first in any program
include/heap.h:
Added heap_reset() (Required by new handler interface)
include/my_base.h:
Removed HA_EXTRA_RESET. MySQL will now call ::reset() instead of ::extra(HA_EXTRA_RESET).
HA_EXTRA_RETRIVE_ALL_COLS and HA_EXTRA_RETRIVE_PRIMARY key are deleted as the column bitmaps makes these unnecessary
include/my_bitmap.h:
Remove my_pthread.h (should be included at upper level)
Introduced my_bitmap_map typedef to make it the bitmap handling more like a black box
Added bitmap_is_overlapping(), bitmap_test_and_clear(), bitmap_copy() and bitmap_cmp()
Made bitmap_set_bit(), bitmap_flip_bit(), bitmap_clear_bit() return void
include/myisam.h:
Added mi_reset() (Required by new handler interface)
include/myisammrg.h:
Added myrg_reset() (Required by new handler interface)
include/mysql_com.h:
Added flag FIELD_IN_ADD_INDEX to be able to remove Field->add_index
mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test:
Added testing of CREATE ... SELECT in a mixed environment
(This found some bugs that Mats is going to fix shortly)
mysql-test/install_test_db.sh:
Simplify ldata usage
Added --tmpdir=. option to mysqld bootstrap (Removed some warnings when TMPDIR was wrongly set)
mysql-test/mysql-test-run.pl:
Added --tmpdir=. to bootstrap
mysql-test/mysql-test-run.sh:
Use copy instead of INSTALL_DB for master and slave databases.
(Speeds up startup time a lot!)
Remove snapshot directories at startup (removes some strange warnings)
mysql-test/r/binlog_row_mix_innodb_myisam.result:
Added testing of CREATE ... SELECT in a mixed environment
(This found some bugs that Mats is going to fix shortly)
mysql-test/r/binlog_stm_mix_innodb_myisam.result:
Added testing of CREATE ... SELECT in a mixed environment
mysql-test/r/create.result:
Some extra tests of warnings and number of tables opened by CREATE ... SELECT
mysql-test/r/federated.result:
Drop some left over tables
Added testing of multiple table update and multiple table delete (with and without keys)
mysql-test/r/func_gconcat.result:
Enable some disabled tests (converted them slightly to be predictable)
mysql-test/r/func_time.result:
Added drop of test function
mysql-test/r/innodb_mysql.result:
Added tests for CREATE ... SELECT
mysql-test/r/insert.result:
More tests
Added testing of duplicate columns in insert
mysql-test/r/loaddata.result:
Added testing LOAD DATA ... SET ...
mysql-test/r/multi_update.result:
Test multi updates and deletes using primary key and without
mysql-test/r/ndb_index_unique.result:
Better error message
mysql-test/r/ndb_replace.result:
New correct result after fixing REPLACE handling with NDB
mysql-test/r/rpl_ddl.result:
Now we don't get these (wrong) warnings anymore
mysql-test/r/view_grant.result:
Drop used views
mysql-test/t/create.test:
Some extra tests of warnings and number of tables opened by CREATE ... SELECT
mysql-test/t/federated.test:
Drop some left over tables
Added testing of multiple table update and multiple table delete (with and without keys)
mysql-test/t/func_gconcat.test:
Enable some disabled tests (converted them slightly to be predictable)
mysql-test/t/func_time.test:
Added drop of test function
mysql-test/t/innodb_mysql.test:
Added tests for CREATE ... SELECT
mysql-test/t/insert.test:
More tests
Added testing of duplicate columns in insert
mysql-test/t/loaddata.test:
Added testing LOAD DATA ... SET ...
mysql-test/t/multi_update.test:
Test multi updates and deletes using primary key and without
mysql-test/t/view_grant.test:
Drop used views
mysql-test/valgrind.supp:
Added supression of not needed warnings when printing stack trace
mysys/base64.c:
Include my_global.h first
mysys/my_bitmap.c:
Added bitmap_is_overlapping(), bitmap_test_and_clear() and bitmap_copy()
Changed logic of bitmap handling to be a bit more efficent (Did this together with Mikael Ronström)
Now the 'extra, not used bits' in the bitmap are assumed to have a 'random value' and the bitmap functions are free to change them whenever needed.
Changed how mutex is allocated to make 'bitmap_free()' function simpler.
mysys/thr_lock.c:
Added 0x before thread pointers (for easier comparison of DBUG traces)
sql/event.cc:
Ensure 'use_all_columns()' is used for event tables
Don't print warning that event table is damaged if it doesn't exists.
sql/field.cc:
Added ASSERT_COLUMN_MARKED_FOR_WRITE in all store() methods and ASSERT_COLUMN_MARKED_FOR_READ in all val() methods to catch wrong setting if table->read_set and table->write_set
(Rest of changes are only indentation cleanups)
sql/field.h:
Removed Field->query_id (replaced by table->read_set and table->write_set)
Removed Field->fieldnr (use Field->field_index instead)
Removed Field->add_index (Use Field->flags instead)
Add Field->part_of_key_not_clustered (for usage in opt_range.cc)
sql/filesort.cc:
Added paramater sort_postion to filesort() to force sorting by position instead of storing all fields in the result set.
This allowed me to remove checking of sql_command.
Create a temporary column bitmap for fields that are used by the sorting process.
Use column bitmaps instead of query_id
sql/ha_berkeley.cc:
Update to 'newer' table handler interface
sql/ha_berkeley.h:
Update to 'newer' table handler interface
sql/ha_federated.cc:
Update to 'newer' table handler interface
Only read columns that are needed from remote server.
In case of eq ranges, don't generate two conditions in the WHERE clause
(this can still be optimized, but would require a bigger code change)
Use 'simpler to use' XXXX_LEN' macros
A bit simpler logic in ::write_row() when creating statements.
In update, only include test of fields actually read.
(This greatly simplifies the queries sent by the federated engine)
Similar changes done for delete_row()
sql/ha_federated.h:
Update to 'newer' table handler interface
Changed XXX_LEN macros to use sizeof(...)-1, to simplify usage in ha_federated.cc
Added HA_PRIMARY_KEY_REQUIRED_FOR_DELETE to tell MySQL to read all primary key columns in case of DELETE
sql/ha_heap.cc:
Update to 'newer' table handler interface
sql/ha_heap.h:
Update to 'newer' table handler interface
sql/ha_innodb.cc:
Update to 'newer' table handler interface
- Update innobase_create_handler() to new interface
- Removed HA_NOT_EXACT_COUNT (not needed)
- Renamed HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS to HA_PRIMARY_KEY_REQUIRED_FOR_POSITION.
- Prefixed base status variables with 'stats'
- Use table column bitmaps instead of ha_get_bit_in_read_set()
- Added ::reset(), with code from ::extra(HA_EXTRA_RESET)
- Removed HA_EXTRA_RETRIVE_ALL_COLS and HA_EXTRA_RETRIEVE_PRIMARY_KEY as
the table->read_set and table->write_set bitmaps now are accurate
sql/ha_innodb.h:
Update to 'newer' table handler interface
- table_flags are now ulonglong
- Added reset() method
- Removed not needed ha_retrieve_all_cols() and ha_retrieve_all_pk() columns.
- Made build_template() a class function to be able to easier access class variables
sql/ha_myisam.cc:
Update to 'newer' table handler interface
sql/ha_myisam.h:
Update to 'newer' table handler interface
sql/ha_myisammrg.cc:
Update to 'newer' table handler interface
sql/ha_myisammrg.h:
Update to 'newer' table handler interface
sql/ha_ndbcluster.cc:
Update to 'newer' table handler interface
Fixed use_blob_value() to be accurate
In ::complemented_read() we have to check both the read and write bitmap as the old code did mark all changed columns also in the read map
Correct dumping of field data with DBUG_DUMP
Prefix addresses in DBUG_PRINT with 0x
Fixed usage of not initialized memory
Update to use field->flags & FIELD_IN_ADD_INDEX instead of field->add_index.
sql/ha_ndbcluster.h:
Update to 'newer' table handler interface
sql/ha_ndbcluster_binlog.cc:
Mark usage of all columns in ndbcluster binlog tables
false -> FALSE, true -> TRUE
Use table->s->all_set instead of creating a temporary bitmap.
sql/ha_partition.cc:
Update to 'newer' table handler interface
Added memroot to initialise_partitions() and related functions to get faster memory allocation.
partition_create_handler() is now responsible for initialisation of the partition object
Some trivial optimizations and indentation fixes
Ensure that table_flags() are up to date
Removed documentation for removed HA_EXTRA flags
Fixed 'strange' usage of m_file[i] in new_handlers_from_part_info()that worked in current code 'by chance'
sql/ha_partition.h:
Update to 'newer' table handler interface
sql/handler.cc:
create_xxx handler now takes MEMROOT as an argument to simplify memory allocation.
Much simpler get_new_handler()
(Initialization of the object is now handled by the create method for the engine)
Moved all allocation of bitmap handling to the TABLE object (in table.cc)
Added column_bitmaps_signal() to signal column usage changes.
Changed binlog_log_row() to use the exiusting all_set bitmap in the table object.
Added ha_reset() function to test that the file object is ok at end of statement and call handler::reset()
Added use_hidden_primary_key() to signal handler that we we are going to read and update + delete the row and the handler should thus remember the position for the row
sql/handler.h:
Added HA_NO_TRANSACTIONS, HA_PARTIAL_COLUMN_READ, HA_REQUIRES_KEY_COLUMNS_FOR_DELETE,HA_PRIMARY_KEY_REQUIRED_FOR_DELETE and HA_HAS_RECORDS
Removed HA_NOT_EXACT_COUNT, HA_READ_RND_SAME
HA_DUPP_POS -> HA_DUPLICATE_POS
HA_NOT_EXACT_COUNT replaced by HA_STATS_RECORDS_IS_EXACT, HA_HAS_RECORDS and records()
HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS renamed to HA_PRIMARY_KEY_REQUIRED_FOR_POSITION
Added future row type 'ROW_TYPE_PAGES'
Added MEM_ROOT to handlerton 'create' function
Added ha_statistics, a structure for all status variable in the base handler class.
Moved all status variables in the handler class into a stats structs to improve readability.
ha_table_flags() is now a cached (not virtual) version of table_flags()
reset() doesn't anymore call extra(HA_EXTRA_RESET) but is a function of it's own.
Renamed dupp_ref to dup_ref
Renamed not used handler::sortkey
Moved read_set and write_set to TABLE structure
handler::init() function added for cacheing of virtual constants from engine.
sql/item.cc:
Added register_field_in_read_map() for marking used columns in expression.
This is used by filesort() for creating an optimal column bitmap while retrieving columns for sorting.
Initalize value.cs_info.character_set_client to fix core dump bug with --debug
set_query_id -> mark_used_columns
Mark used columns in read_set OR write_set.
sql/item.h:
Removed reset_query_id_processor() as it's not needed anymore.
Added register_field_in_read_map()
Added extra argument to Item::walk() to indicate if we should also
traverse sub queries.
sql/item_cmpfunc.cc:
Temporary mark used columns to be read/writable
Update Item::walk to new interface
sql/item_cmpfunc.h:
Added extra argument to Item::walk() to indicate if we should also traverse sub queries.
sql/item_func.cc:
Update Item::walk() to new interface
table_flags() -> ha_table_flags()
sql/item_func.h:
Update Item::walk() to new interface
sql/item_row.cc:
Update Item::walk() to new interface
sql/item_row.h:
Update Item::walk() to new interface
sql/item_strfunc.h:
Update Item::walk() to new interface
sql/item_subselect.cc:
Added Item_subselect::walk()
(It was a bug it was missing before. Not sure what kind of bugs this could have caused)
sql/item_subselect.h:
Update Item::walk() to new interface
sql/item_sum.cc:
Update Item::walk() to new interface
Updates for new handler interace
sql/item_sum.h:
Update Item::walk() to new interface
sql/key.cc:
Updates for new handler interace
sql/log.cc:
Mark all columns used for log tables
Split options flag
Ensured that second argument to trans_register_ha is a bool
sql/log_event.cc:
Fixed comments to be withing 79 characters
Use OPTION_KEEP_LOG instead of OPTION_STATUS_NO_TRANS_UPDATE to remove wrong warnings
Updates for new handler interface
Use 0x%lx instead of %p (portability problem)
sql/mysql_priv.h:
Added OPTION_KEEP_LOG to indicate that we should replicate the binlog even on rollback
Removed not used 'conds' argument to setup_tables
sql/mysqld.cc:
Indentation fixes and removed old comment
sql/opt_range.cc:
Update to new handler and bitmap interface.
Fixed calls to cp_buffer_from_ref() and walk() (new argument).
Create new temporary bitmaps for ror scans.
(Needed because of handler changes and to get more accurate column bitmaps than before)
Remove not needed file->ha_reset() call before file->close().
Some trivial optimization and indentation fixes.
Use Field->part_of_key_not_clustered() to check if field is part of a key, instead of looping over all key parts.
Added flag 'in_ror_merged_scan' to allow ::get_next() to know that we need a special column bitmap to only fetch pointer to record.
This is needed because ror scan uses the same TABLE object but different file objects, which creates problem for the column bitmap handling.
(This is a temporary solution. A better one would be to allocate an own TABLE object for ROR scans)
Optimized bitmap handling in ror scans:
- Start bitmap at position 0, not 1
- Use same bitmap size as in TABLE
- Use table->read_set and table->write_set to create column bitmaps instead of looping over all fields in table
sql/opt_range.h:
Added 'in_ror_merged_scan' to indicate if we are doing a ROR scan
Added temporary column bitmaps used in ROR scans
sql/opt_sum.cc:
Added get_ext_record_count() which is used in COUNT() optimization if handler has HA_HAS_RECORDS
Note that we don't call this if handler has HA_STATS_RECORDS_IS_EXACT set.
sql/protocol.cc:
We need to mark columns as readable in ::store() as we sometimes return default value for fields to the user
sql/records.cc:
Updates for new handler interface
sql/set_var.cc:
Handle splitting OPTION_STATUS_NO_TRANS_UPDATE to two flags
sql/share/errmsg.txt:
Fixed wrong
sql/sp.cc:
Mark that we are using all columns for the proc table
Update call to setup_tables() to use new prototype
sql/sp_head.cc:
Removed QQ comment
sql/spatial.cc:
Removed wrong QQ comment
sql/sql_acl.cc:
Mark that we need all columns for acl tables
Supply memroot to some 'new' calls.
Indentation fixes
sql/sql_base.cc:
set_query_id removed
Ensure we call ha_reset() at end of each statement
Mark read columns in read_set and changed columns in write_set (Before all columns was marked in read set)
Fixed marking of some columns that was not proplerly marked before
Maintain in TABLE->merge_keys set of all keys that are used in some way
Removed not used 'conds' argument from setup_tables()
Remove not used setting of 'dupp_field' in insert_fields()
Added missing FN_LIBCHAR in mysql_rm_tmp_tables()
(This has probably caused us to not properly remove temporary files after crash)
sql/sql_bitmap.h:
Added is_overlapping()
sql/sql_class.cc:
Slow_logs was not properly initialized, which could maybe cause extra/lost entries in slow log.
set_query_id -> mark_used_columns
Simpler variable usage in pack_row() (cleanup)
Moved some variable declartion at start of function for better code readability
sql/sql_class.h:
Added enum_mark_columns
Updated comments
Renamed dupp_field -> dup_field
Added virtual function 'can_rollback_data()' to select_insert() to be used in CREATE ... SELECT to optimize use of OPTION_STATUS_NO_TRANS_UPDATE.
(This fixes a bug in CREATE ... SELECT where we did give wrong warnings when using non transacational tables)
sql/sql_delete.cc:
Updates to new handler interface
Call table->mark_columns_needed_for_delete() to allow us to put additional columns in column usage maps if handler so requires.
Call table->prepare_for_position() to tell handler that we are going to call ha_position().
Removed call to free_io_cache(). (io_cache is now removed in ha_reset()).
Fixed calls to setup_tables()
sql/sql_do.cc:
Update call to setup_fields()
sql/sql_handler.cc:
Tell handler tables to always read all columns.
Use temporary column map when storing value in field for later index usage
sql/sql_help.cc:
Makr all used fields to be read
Update call to setup_fields()
sql/sql_insert.cc:
Tell handler we are going to update the auto_increment column
dupp_field -> dup_field
Set column usage bits for timestamp field.
Call table->mark_columns_needed_for_insert() and table->mark_auto_increment_column()
Removed not used argument from mysql_prepare_insert_check_table().
If we get an duplicate row on insert, change column map to read and write all columns while retrying the operatation.
This is required by the definition of REPLACE and also ensures that fields that are only part of UPDATE are properly handled.
This fixed a bug in NDB and REPLACE where REPLACE wrongly copied some column values from the replaced row.
Setup new bitmaps for delayed insert rows
Remove reseting of next_number_fields as it will be reset on next call to handler_insert()
Fixed usage of thd->options and OPTION_STATUS_NO_TRANS_UPDATE.
The issue was that one should not to reset this flag as it may be set by a previous statement.
The way it was now used caused us to loose some warnings and get other wrong warnings when using non transactional tables mixed with transactional.
I fixed it by introducing 'select_insert::can_rollback_data' to inform send_error() that the given statement can be rolled back (which in case of CREATE TABLE can always be done)
Don't close tables created with CREATE ... SELECT but keep them in the table cache.
Moved out MY_HOOKS from inside function (better readability)
sql/sql_load.cc:
Update to use new handler and column marking interface
Update using setup_tables()
sql/sql_olap.cc:
Update calls to setup_tables
Use enums instead of constants to setup_fields()
sql/sql_parse.cc:
Handle OPTION_KEEP_LOG:
- Set it on CREATE TEMPORARY TABLE / DROP TABLE
- Reset it when OPTION_STATUS_NO_TRANS_UPDATE is reset
- Don't set it for CREATE ... SELECT (this is handled in select_create class)
Remove reseting of OPTION_STATUS_NO_TRANS_UPDATE in begin_trans() as this should already be reset.
If in autocommit mode, reset OPTION_KEEP_LOG and OPTION_STATUS_NO_TRANS_UPDATE to not give warnings in future commands
sql/sql_partition.cc:
Update walk() usage
Trivial indentation fixes
sql/sql_plugin.cc:
Mark all columns as used for plugins
sql/sql_prepare.cc:
Added assert to find out hidden bugs in character_set_client (got an error in debug binary when this not set correctly)
Updates for new handler interface
Update calls to setup_fields()
sql/sql_repl.cc:
Indentation fixes
sql/sql_select.cc:
Update call to setup_tables() and setup_fields()
Remove some old disabled code
Update to new hadler interface
Indentation cleanups
Added column bitmaps for temporary tables.
Remove updating of the removed slots in the Field class
Added TABLE argument to cp_buffer_from_ref() (To be able to install temporary column maps)
For internal temporary tables, use handler::write_row(), handler::delete_row() and handler::update_row() instead of handler::ha_xxxx() for faster execution.
sql/sql_select.h:
Indentaition fixes.
Install temporary column usage maps when needed
Added TABLE element to cp_buffer_from_ref()
sql/sql_show.cc:
Update to new handler interface
Mark all columns used for internal tables.
Style fixes.
Added support for 'future' ROW_TYPE_PAGES.
Don't allocate TMP_TABLE_PARAM with calloc. The 'init()' function will initialize the structure properly.
sql/sql_table.cc:
Update to new handler interface
Simple my_snprintf -> strmake()
Changed some constants to defines
Don't test for NULL in primary key (as we a couple of line above force the PRIMARY KEY to be NOT NULL)
Change field->add_index to use field->flags & FIELD_IN_ADD_INDEX
Mark all columns as used for ALTER TABLE
Style fixes
Update call to filesort()
sql/sql_trigger.h:
Added friend functions to be able to test if triggers exists for table we are going to insert/update or delete in.
sql/sql_udf.cc:
Mark all columns as used for udf system table.
sql/sql_union.cc:
Update call to walk()
Update to new handler interface
sql/sql_update.cc:
Remove query_id argument from compare_record()
Use column bitmaps instead of query_id.
We can't use compare_records() to skip updates for handlers that returns a partial column set and the read_set doesn't cover all columns in the write set, because compare_record() can't in this case know if a not read column changed value.
Update call to setup_fields()
Using separate column read and write sets allows for easier checking of timestamp field was set by statement.
Removed call to free_io_cache() as this is now done in ha_reset()
Call table->mark_columns_needed_for_update() and table->prepare_for_position()
Style fixes
sql/sql_view.cc:
Style fixes
sql/table.cc:
Remove implicitely include 'errno.h'
Remove code for building normalized path, as this is now identical to 'path'
Remove field->fieldnr
Added update of field->part_of_key_not_clustered()
Create column bitmaps in TABLE and TABLE_SHARE
Don't setup a temporary MEM_ROOT object as a thread specific variable for the handler. Instead we send the to-be-used MEMROOT to get_new_handler()
Update to new handler interface
Update call to walk()
Added new functions:
- st_table::clear_column_bitmaps()
- st_table::prepare_for_position()
- st_table::mark_columns_used_by_index()
- st_table::restore_column_maps_after_mark_index()
- st_table::mark_columns_used_by_index_no_reset()
- st_table::mark_auto_increment_column()
- st_table::mark_columns_needed_for_delete()
- st_table::mark_columns_needed_for_update()
- st_table::mark_columns_needed_for_insert()
sql/table.h:
Moved column usage bitmaps from handler to TABLE
Added to TABLE_SHARE all_set and column_bitmap_size
Added to TABLE merge_keys, bitmap_init_values, def_read_set, def_write_set, tmp_set, read_set and write_set.
Declared all new table column bitmap functions
Added TABLE functions column_bitmaps_set(), column_bitmaps_set_no_signal(), use_all_columns() and default_column_bitmaps()
Added functions: tmp_use_all_columns() and tmp_restore_column_map() to temporarly switch column bitmaps
Added functions: dbug_tmp_use_all_columns() and dbug_tmp_restore_column_map() to temporarly switch column bitmaps to avoid asserts in Field::store() and Field::val().
sql/tztime.cc:
Mark all columns as used for timezone tables
storage/archive/ha_archive.cc:
Update to new handler interface
storage/archive/ha_archive.h:
Update to new handler interface
storage/blackhole/ha_blackhole.cc:
Update to new handler interface
storage/blackhole/ha_blackhole.h:
Update to new handler interface
removed not needed flag HA_DUPP_POS
storage/csv/ha_tina.cc:
Update to new handler interface
storage/csv/ha_tina.h:
Update to new handler interface
storage/example/ha_example.cc:
Update to new handler interface
storage/example/ha_example.h:
Update to new handler interface
storage/heap/hp_extra.c:
Added heap_reset() (Required by new handler interface)
storage/heap/hp_test2.c:
Use heap_reset()
storage/myisam/ft_boolean_search.c:
Fixed compiler warning
storage/myisam/mi_extra.c:
Added mi_reset() (Required by new handler interface)
storage/myisam/mi_search.c:
Fixed DBUG_PRINT messages to use 0x%lx instead of %lx
storage/myisam/mi_test2.c:
Use mi_reset()
storage/myisam/myisampack.c:
Use mi_reset()
storage/myisammrg/myrg_extra.c:
Added myrg_reset() (Required by new handler interface)
unittest/mysys/base64.t.c:
Include my_global.h
Don't include implictely include file 'stdlib.h'
2006-06-04 17:52:22 +02:00
|
|
|
|
2005-07-18 13:31:02 +02:00
|
|
|
public:
|
|
|
|
|
|
|
|
/*
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
MODULE open/close object
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
Open and close handler object to ensure all underlying files and
|
|
|
|
objects allocated and deallocated for query handling is handled
|
|
|
|
properly.
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
A handler object is opened as part of its initialisation and before
|
|
|
|
being used for normal queries (not before meta-data changes always.
|
|
|
|
If the object was opened it will also be closed before being deleted.
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
int open(const char *name, int mode, uint test_if_locked) override;
|
|
|
|
int close() override;
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
MODULE start/end statement
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
This module contains methods that are used to understand start/end of
|
|
|
|
statements, transaction boundaries, and aid for proper concurrency
|
|
|
|
control.
|
|
|
|
The partition handler need not implement abort and commit since this
|
|
|
|
will be handled by any underlying handlers implementing transactions.
|
|
|
|
There is only one call to each handler type involved per transaction
|
|
|
|
and these go directly to the handlers supporting transactions
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
THR_LOCK_DATA **store_lock(THD * thd, THR_LOCK_DATA ** to,
|
|
|
|
enum thr_lock_type lock_type) override;
|
|
|
|
int external_lock(THD * thd, int lock_type) override;
|
|
|
|
LEX_CSTRING *engine_name() override { return hton_name(partition_ht()); }
|
2005-07-18 13:31:02 +02:00
|
|
|
/*
|
|
|
|
When table is locked a statement is started by calling start_stmt
|
|
|
|
instead of external_lock
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
int start_stmt(THD * thd, thr_lock_type lock_type) override;
|
2005-07-18 13:31:02 +02:00
|
|
|
/*
|
|
|
|
Lock count is number of locked underlying handlers (I assume)
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
uint lock_count() const override;
|
2005-07-18 13:31:02 +02:00
|
|
|
/*
|
|
|
|
Call to unlock rows not to be updated in transaction
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
void unlock_row() override;
|
2008-12-16 12:44:18 +01:00
|
|
|
/*
|
|
|
|
Check if semi consistent read
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
bool was_semi_consistent_read() override;
|
2008-11-10 21:13:24 +01:00
|
|
|
/*
|
|
|
|
Call to hint about semi consistent read
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
void try_semi_consistent_read(bool) override;
|
2005-07-18 13:31:02 +02:00
|
|
|
|
2013-06-27 13:01:03 +02:00
|
|
|
/*
|
|
|
|
NOTE: due to performance and resource issues with many partitions,
|
|
|
|
we only use the m_psi on the ha_partition handler, excluding all
|
|
|
|
partitions m_psi.
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_M_PSI_PER_PARTITION
|
|
|
|
/*
|
|
|
|
Bind the table/handler thread to track table i/o.
|
|
|
|
*/
|
|
|
|
virtual void unbind_psi();
|
2020-01-23 21:44:48 +01:00
|
|
|
virtual int rebind();
|
2013-06-27 13:01:03 +02:00
|
|
|
#endif
|
2020-03-30 13:50:03 +02:00
|
|
|
int discover_check_version() override;
|
2005-07-18 13:31:02 +02:00
|
|
|
/*
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
MODULE change record
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
This part of the handler interface is used to change the records
|
|
|
|
after INSERT, DELETE, UPDATE, REPLACE method calls but also other
|
|
|
|
special meta-data operations as ALTER TABLE, LOAD DATA, TRUNCATE.
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
These methods are used for insert (write_row), update (update_row)
|
|
|
|
and delete (delete_row). All methods to change data always work on
|
|
|
|
one row at a time. update_row and delete_row also contains the old
|
|
|
|
row.
|
|
|
|
delete_all_rows will delete all rows in the table in one call as a
|
|
|
|
special optimisation for DELETE from table;
|
|
|
|
|
|
|
|
Bulk inserts are supported if all underlying handlers support it.
|
|
|
|
start_bulk_insert and end_bulk_insert is called before and after a
|
|
|
|
number of calls to write_row.
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
int write_row(const uchar * buf) override;
|
|
|
|
bool start_bulk_update() override;
|
|
|
|
int exec_bulk_update(ha_rows *dup_key_found) override;
|
|
|
|
int end_bulk_update() override;
|
|
|
|
int bulk_update_row(const uchar *old_data, const uchar *new_data,
|
|
|
|
ha_rows *dup_key_found) override;
|
|
|
|
int update_row(const uchar * old_data, const uchar * new_data) override;
|
|
|
|
int direct_update_rows_init(List<Item> *update_fields) override;
|
|
|
|
int pre_direct_update_rows_init(List<Item> *update_fields) override;
|
|
|
|
int direct_update_rows(ha_rows *update_rows, ha_rows *found_rows) override;
|
|
|
|
int pre_direct_update_rows() override;
|
|
|
|
bool start_bulk_delete() override;
|
|
|
|
int end_bulk_delete() override;
|
|
|
|
int delete_row(const uchar * buf) override;
|
|
|
|
int direct_delete_rows_init() override;
|
|
|
|
int pre_direct_delete_rows_init() override;
|
|
|
|
int direct_delete_rows(ha_rows *delete_rows) override;
|
|
|
|
int pre_direct_delete_rows() override;
|
|
|
|
int delete_all_rows() override;
|
|
|
|
int truncate() override;
|
|
|
|
void start_bulk_insert(ha_rows rows, uint flags) override;
|
|
|
|
int end_bulk_insert() override;
|
2009-09-04 15:02:15 +02:00
|
|
|
private:
|
|
|
|
ha_rows guess_bulk_insert_rows();
|
2009-09-17 14:05:43 +02:00
|
|
|
void start_part_bulk_insert(THD *thd, uint part_id);
|
|
|
|
long estimate_read_buffer_size(long original_size);
|
2009-09-04 15:02:15 +02:00
|
|
|
public:
|
2005-07-18 13:31:02 +02:00
|
|
|
|
Bug#49938: Failing assertion: inode or deadlock in fsp/fsp0fsp.c
Bug#54678: InnoDB, TRUNCATE, ALTER, I_S SELECT, crash or deadlock
- Incompatible change: truncate no longer resorts to a row by
row delete if the storage engine does not support the truncate
method. Consequently, the count of affected rows does not, in
any case, reflect the actual number of rows.
- Incompatible change: it is no longer possible to truncate a
table that participates as a parent in a foreign key constraint,
unless it is a self-referencing constraint (both parent and child
are in the same table). To work around this incompatible change
and still be able to truncate such tables, disable foreign checks
with SET foreign_key_checks=0 before truncate. Alternatively, if
foreign key checks are necessary, please use a DELETE statement
without a WHERE condition.
Problem description:
The problem was that for storage engines that do not support
truncate table via a external drop and recreate, such as InnoDB
which implements truncate via a internal drop and recreate, the
delete_all_rows method could be invoked with a shared metadata
lock, causing problems if the engine needed exclusive access
to some internal metadata. This problem originated with the
fact that there is no truncate specific handler method, which
ended up leading to a abuse of the delete_all_rows method that
is primarily used for delete operations without a condition.
Solution:
The solution is to introduce a truncate handler method that is
invoked when the engine does not support truncation via a table
drop and recreate. This method is invoked under a exclusive
metadata lock, so that there is only a single instance of the
table when the method is invoked.
Also, the method is not invoked and a error is thrown if
the table is a parent in a non-self-referencing foreign key
relationship. This was necessary to avoid inconsistency as
some integrity checks are bypassed. This is inline with the
fact that truncate is primarily a DDL operation that was
designed to quickly remove all data from a table.
mysql-test/suite/innodb/t/innodb-truncate.test:
Add test cases for truncate and foreign key checks.
Also test that InnoDB resets auto-increment on truncate.
mysql-test/suite/innodb/t/innodb.test:
FK is not necessary, test is related to auto-increment.
Update error number, truncate is no longer invoked if
table is parent in a FK relationship.
mysql-test/suite/innodb/t/innodb_mysql.test:
Update error number, truncate is no longer invoked if
table is parent in a FK relationship.
Use delete instead of truncate, test is used to check
the interaction of FKs, triggers and delete.
mysql-test/suite/parts/inc/partition_check.inc:
Fix typo.
mysql-test/suite/sys_vars/t/foreign_key_checks_func.test:
Update error number, truncate is no longer invoked if
table is parent in a FK relationship.
mysql-test/t/mdl_sync.test:
Modify test case to reflect and ensure that truncate takes
a exclusive metadata lock.
mysql-test/t/trigger-trans.test:
Update error number, truncate is no longer invoked if
table is parent in a FK relationship.
sql/ha_partition.cc:
Reorganize the various truncate methods. delete_all_rows is now
passed directly to the underlying engines, so as truncate. The
code responsible for truncating individual partitions is moved
to ha_partition::truncate_partition, which is invoked when a
ALTER TABLE t1 TRUNCATE PARTITION p statement is executed.
Since the partition truncate no longer can be invoked via
delete, the bitmap operations are not necessary anymore. The
explicit reset of the auto-increment value is also removed
as the underlying engines are now responsible for reseting
the value.
sql/handler.cc:
Wire up the handler truncate method.
sql/handler.h:
Introduce and document the truncate handler method. It assumes
certain use cases of delete_all_rows.
Add method to retrieve the list of foreign keys referencing a
table. Method is used to avoid truncating tables that are
parent in a foreign key relationship.
sql/share/errmsg-utf8.txt:
Add error message for truncate and FK.
sql/sql_lex.h:
Introduce a flag so that the partition engine can detect when
a partition is being truncated. Used to give a special error.
sql/sql_parse.cc:
Function mysql_truncate_table no longer exists.
sql/sql_partition_admin.cc:
Implement the TRUNCATE PARTITION statement.
sql/sql_truncate.cc:
Change the truncate table implementation to use the new truncate
handler method and to not rely on row-by-row delete anymore.
The truncate handler method is always invoked with a exclusive
metadata lock. Also, it is no longer possible to truncate a
table that is parent in some non-self-referencing foreign key.
storage/archive/ha_archive.cc:
Rename method as the description indicates that in the future
this could be a truncate operation.
storage/blackhole/ha_blackhole.cc:
Implement truncate as no operation for the blackhole engine in
order to remain compatible with older releases.
storage/federated/ha_federated.cc:
Introduce truncate method that invokes delete_all_rows.
This is required to support partition truncate as this
form of truncate does not implement the drop and recreate
protocol.
storage/heap/ha_heap.cc:
Introduce truncate method that invokes delete_all_rows.
This is required to support partition truncate as this
form of truncate does not implement the drop and recreate
protocol.
storage/ibmdb2i/ha_ibmdb2i.cc:
Introduce truncate method that invokes delete_all_rows.
This is required to support partition truncate as this
form of truncate does not implement the drop and recreate
protocol.
storage/innobase/handler/ha_innodb.cc:
Rename delete_all_rows to truncate. InnoDB now does truncate
under a exclusive metadata lock.
Introduce and reorganize methods used to retrieve the list
of foreign keys referenced by a or referencing a table.
storage/myisammrg/ha_myisammrg.cc:
Introduce truncate method that invokes delete_all_rows.
This is required in order to remain compatible with earlier
releases where truncate would resort to a row-by-row delete.
2010-10-06 16:34:28 +02:00
|
|
|
/*
|
|
|
|
Method for truncating a specific partition.
|
|
|
|
(i.e. ALTER TABLE t1 TRUNCATE PARTITION p).
|
|
|
|
|
|
|
|
@remark This method is a partitioning-specific hook
|
|
|
|
and thus not a member of the general SE API.
|
|
|
|
*/
|
2010-12-03 10:33:29 +01:00
|
|
|
int truncate_partition(Alter_info *, bool *binlog_stmt);
|
Bug#49938: Failing assertion: inode or deadlock in fsp/fsp0fsp.c
Bug#54678: InnoDB, TRUNCATE, ALTER, I_S SELECT, crash or deadlock
- Incompatible change: truncate no longer resorts to a row by
row delete if the storage engine does not support the truncate
method. Consequently, the count of affected rows does not, in
any case, reflect the actual number of rows.
- Incompatible change: it is no longer possible to truncate a
table that participates as a parent in a foreign key constraint,
unless it is a self-referencing constraint (both parent and child
are in the same table). To work around this incompatible change
and still be able to truncate such tables, disable foreign checks
with SET foreign_key_checks=0 before truncate. Alternatively, if
foreign key checks are necessary, please use a DELETE statement
without a WHERE condition.
Problem description:
The problem was that for storage engines that do not support
truncate table via a external drop and recreate, such as InnoDB
which implements truncate via a internal drop and recreate, the
delete_all_rows method could be invoked with a shared metadata
lock, causing problems if the engine needed exclusive access
to some internal metadata. This problem originated with the
fact that there is no truncate specific handler method, which
ended up leading to a abuse of the delete_all_rows method that
is primarily used for delete operations without a condition.
Solution:
The solution is to introduce a truncate handler method that is
invoked when the engine does not support truncation via a table
drop and recreate. This method is invoked under a exclusive
metadata lock, so that there is only a single instance of the
table when the method is invoked.
Also, the method is not invoked and a error is thrown if
the table is a parent in a non-self-referencing foreign key
relationship. This was necessary to avoid inconsistency as
some integrity checks are bypassed. This is inline with the
fact that truncate is primarily a DDL operation that was
designed to quickly remove all data from a table.
mysql-test/suite/innodb/t/innodb-truncate.test:
Add test cases for truncate and foreign key checks.
Also test that InnoDB resets auto-increment on truncate.
mysql-test/suite/innodb/t/innodb.test:
FK is not necessary, test is related to auto-increment.
Update error number, truncate is no longer invoked if
table is parent in a FK relationship.
mysql-test/suite/innodb/t/innodb_mysql.test:
Update error number, truncate is no longer invoked if
table is parent in a FK relationship.
Use delete instead of truncate, test is used to check
the interaction of FKs, triggers and delete.
mysql-test/suite/parts/inc/partition_check.inc:
Fix typo.
mysql-test/suite/sys_vars/t/foreign_key_checks_func.test:
Update error number, truncate is no longer invoked if
table is parent in a FK relationship.
mysql-test/t/mdl_sync.test:
Modify test case to reflect and ensure that truncate takes
a exclusive metadata lock.
mysql-test/t/trigger-trans.test:
Update error number, truncate is no longer invoked if
table is parent in a FK relationship.
sql/ha_partition.cc:
Reorganize the various truncate methods. delete_all_rows is now
passed directly to the underlying engines, so as truncate. The
code responsible for truncating individual partitions is moved
to ha_partition::truncate_partition, which is invoked when a
ALTER TABLE t1 TRUNCATE PARTITION p statement is executed.
Since the partition truncate no longer can be invoked via
delete, the bitmap operations are not necessary anymore. The
explicit reset of the auto-increment value is also removed
as the underlying engines are now responsible for reseting
the value.
sql/handler.cc:
Wire up the handler truncate method.
sql/handler.h:
Introduce and document the truncate handler method. It assumes
certain use cases of delete_all_rows.
Add method to retrieve the list of foreign keys referencing a
table. Method is used to avoid truncating tables that are
parent in a foreign key relationship.
sql/share/errmsg-utf8.txt:
Add error message for truncate and FK.
sql/sql_lex.h:
Introduce a flag so that the partition engine can detect when
a partition is being truncated. Used to give a special error.
sql/sql_parse.cc:
Function mysql_truncate_table no longer exists.
sql/sql_partition_admin.cc:
Implement the TRUNCATE PARTITION statement.
sql/sql_truncate.cc:
Change the truncate table implementation to use the new truncate
handler method and to not rely on row-by-row delete anymore.
The truncate handler method is always invoked with a exclusive
metadata lock. Also, it is no longer possible to truncate a
table that is parent in some non-self-referencing foreign key.
storage/archive/ha_archive.cc:
Rename method as the description indicates that in the future
this could be a truncate operation.
storage/blackhole/ha_blackhole.cc:
Implement truncate as no operation for the blackhole engine in
order to remain compatible with older releases.
storage/federated/ha_federated.cc:
Introduce truncate method that invokes delete_all_rows.
This is required to support partition truncate as this
form of truncate does not implement the drop and recreate
protocol.
storage/heap/ha_heap.cc:
Introduce truncate method that invokes delete_all_rows.
This is required to support partition truncate as this
form of truncate does not implement the drop and recreate
protocol.
storage/ibmdb2i/ha_ibmdb2i.cc:
Introduce truncate method that invokes delete_all_rows.
This is required to support partition truncate as this
form of truncate does not implement the drop and recreate
protocol.
storage/innobase/handler/ha_innodb.cc:
Rename delete_all_rows to truncate. InnoDB now does truncate
under a exclusive metadata lock.
Introduce and reorganize methods used to retrieve the list
of foreign keys referenced by a or referencing a table.
storage/myisammrg/ha_myisammrg.cc:
Introduce truncate method that invokes delete_all_rows.
This is required in order to remain compatible with earlier
releases where truncate would resort to a row-by-row delete.
2010-10-06 16:34:28 +02:00
|
|
|
|
2020-02-28 13:01:27 +01:00
|
|
|
bool is_fatal_error(int error, uint flags) override
|
2006-06-20 02:56:50 +02:00
|
|
|
{
|
2006-07-01 06:01:37 +02:00
|
|
|
if (!handler::is_fatal_error(error, flags) ||
|
2013-06-15 17:32:08 +02:00
|
|
|
error == HA_ERR_NO_PARTITION_FOUND ||
|
|
|
|
error == HA_ERR_NOT_IN_LOCK_PARTITIONS)
|
2006-06-20 02:56:50 +02:00
|
|
|
return FALSE;
|
|
|
|
return TRUE;
|
|
|
|
}
|
2013-06-27 13:01:03 +02:00
|
|
|
|
2013-07-21 16:39:19 +02:00
|
|
|
|
2005-07-18 13:31:02 +02:00
|
|
|
/*
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
MODULE full table scan
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
This module is used for the most basic access method for any table
|
|
|
|
handler. This is to fetch all data through a full table scan. No
|
|
|
|
indexes are needed to implement this part.
|
|
|
|
It contains one method to start the scan (rnd_init) that can also be
|
|
|
|
called multiple times (typical in a nested loop join). Then proceeding
|
|
|
|
to the next record (rnd_next) and closing the scan (rnd_end).
|
|
|
|
To remember a record for later access there is a method (position)
|
|
|
|
and there is a method used to retrieve the record based on the stored
|
|
|
|
position.
|
|
|
|
The position can be a file position, a primary key, a ROWID dependent
|
|
|
|
on the handler below.
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
unlike index_init(), rnd_init() can be called two times
|
|
|
|
without rnd_end() in between (it only makes sense if scan=1).
|
|
|
|
then the second call should prepare for the new table scan
|
|
|
|
(e.g if rnd_init allocates the cursor, second call should
|
|
|
|
position it to the start of the table, no need to deallocate
|
|
|
|
and allocate it again
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
int rnd_init(bool scan) override;
|
|
|
|
int rnd_end() override;
|
|
|
|
int rnd_next(uchar * buf) override;
|
|
|
|
int rnd_pos(uchar * buf, uchar * pos) override;
|
|
|
|
int rnd_pos_by_record(uchar *record) override;
|
|
|
|
void position(const uchar * record) override;
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
MODULE index scan
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
This part of the handler interface is used to perform access through
|
|
|
|
indexes. The interface is defined as a scan interface but the handler
|
|
|
|
can also use key lookup if the index is a unique index or a primary
|
|
|
|
key index.
|
|
|
|
Index scans are mostly useful for SELECT queries but are an important
|
|
|
|
part also of UPDATE, DELETE, REPLACE and CREATE TABLE table AS SELECT
|
|
|
|
and so forth.
|
|
|
|
Naturally an index is needed for an index scan and indexes can either
|
|
|
|
be ordered, hash based. Some ordered indexes can return data in order
|
|
|
|
but not necessarily all of them.
|
|
|
|
There are many flags that define the behavior of indexes in the
|
|
|
|
various handlers. These methods are found in the optimizer module.
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
index_read is called to start a scan of an index. The find_flag defines
|
|
|
|
the semantics of the scan. These flags are defined in
|
|
|
|
include/my_base.h
|
|
|
|
index_read_idx is the same but also initializes index before calling doing
|
|
|
|
the same thing as index_read. Thus it is similar to index_init followed
|
|
|
|
by index_read. This is also how we implement it.
|
|
|
|
|
|
|
|
index_read/index_read_idx does also return the first row. Thus for
|
|
|
|
key lookups, the index_read will be the only call to the handler in
|
|
|
|
the index scan.
|
|
|
|
|
|
|
|
index_init initializes an index before using it and index_end does
|
|
|
|
any end processing needed.
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
int index_read_map(uchar * buf, const uchar * key,
|
|
|
|
key_part_map keypart_map,
|
|
|
|
enum ha_rkey_function find_flag) override;
|
|
|
|
int index_init(uint idx, bool sorted) override;
|
|
|
|
int index_end() override;
|
2005-07-18 13:31:02 +02:00
|
|
|
|
2010-07-09 01:09:31 +02:00
|
|
|
/**
|
|
|
|
@breif
|
2020-07-14 00:42:47 +02:00
|
|
|
Positions an index cursor to the index specified in the handle. Fetches the
|
2010-07-09 01:09:31 +02:00
|
|
|
row if available. If the key value is null, begin at first key of the
|
|
|
|
index.
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
int index_read_idx_map(uchar *buf, uint index, const uchar *key,
|
|
|
|
key_part_map keypart_map,
|
|
|
|
enum ha_rkey_function find_flag) override;
|
2005-07-18 13:31:02 +02:00
|
|
|
/*
|
|
|
|
These methods are used to jump to next or previous entry in the index
|
|
|
|
scan. There are also methods to jump to first and last entry.
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
int index_next(uchar * buf) override;
|
|
|
|
int index_prev(uchar * buf) override;
|
|
|
|
int index_first(uchar * buf) override;
|
|
|
|
int index_last(uchar * buf) override;
|
|
|
|
int index_next_same(uchar * buf, const uchar * key, uint keylen) override;
|
2005-07-18 13:31:02 +02:00
|
|
|
|
2017-02-20 08:06:58 +01:00
|
|
|
int index_read_last_map(uchar *buf,
|
|
|
|
const uchar *key,
|
2020-02-28 13:01:27 +01:00
|
|
|
key_part_map keypart_map) override;
|
2017-02-20 08:06:58 +01:00
|
|
|
|
2005-07-18 13:31:02 +02:00
|
|
|
/*
|
|
|
|
read_first_row is virtual method but is only implemented by
|
|
|
|
handler.cc, no storage engine has implemented it so neither
|
|
|
|
will the partition handler.
|
|
|
|
|
2020-02-28 13:01:27 +01:00
|
|
|
int read_first_row(uchar *buf, uint primary_key) override;
|
2005-07-18 13:31:02 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2020-02-28 13:01:27 +01:00
|
|
|
int read_range_first(const key_range * start_key,
|
|
|
|
const key_range * end_key,
|
|
|
|
bool eq_range, bool sorted) override;
|
|
|
|
int read_range_next() override;
|
2005-07-18 13:31:02 +02:00
|
|
|
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
|
|
|
|
HANDLER_BUFFER *m_mrr_buffer;
|
|
|
|
uint *m_mrr_buffer_size;
|
|
|
|
uchar *m_mrr_full_buffer;
|
|
|
|
uint m_mrr_full_buffer_size;
|
|
|
|
uint m_mrr_new_full_buffer_size;
|
|
|
|
MY_BITMAP m_mrr_used_partitions;
|
|
|
|
uint *m_stock_range_seq;
|
2020-02-25 12:55:15 +01:00
|
|
|
/* not used: uint m_current_range_seq; */
|
2020-02-04 22:54:16 +01:00
|
|
|
|
2020-02-25 12:55:15 +01:00
|
|
|
/* Value of mrr_mode passed to ha_partition::multi_range_read_init */
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
uint m_mrr_mode;
|
2020-02-04 22:54:16 +01:00
|
|
|
|
2020-02-25 12:55:15 +01:00
|
|
|
/* Value of n_ranges passed to ha_partition::multi_range_read_init */
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
uint m_mrr_n_ranges;
|
2020-02-04 22:54:16 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
Ordered MRR mode: m_range_info[N] has the range_id of the last record that
|
2020-02-25 12:55:15 +01:00
|
|
|
we've got from partition N
|
2020-02-04 22:54:16 +01:00
|
|
|
*/
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
range_id_t *m_range_info;
|
2020-02-04 22:54:16 +01:00
|
|
|
|
2020-02-25 12:55:15 +01:00
|
|
|
/*
|
|
|
|
TRUE <=> This ha_partition::multi_range_read_next() call is the first one
|
|
|
|
*/
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
bool m_multi_range_read_first;
|
2020-02-25 12:55:15 +01:00
|
|
|
|
|
|
|
/* not used: uint m_mrr_range_init_flags; */
|
2020-02-04 22:54:16 +01:00
|
|
|
|
|
|
|
/* Number of elements in the list pointed by m_mrr_range_first. Not used */
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
uint m_mrr_range_length;
|
2020-02-04 22:54:16 +01:00
|
|
|
|
2020-02-25 12:55:15 +01:00
|
|
|
/* Linked list of ranges to scan */
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
PARTITION_KEY_MULTI_RANGE *m_mrr_range_first;
|
|
|
|
PARTITION_KEY_MULTI_RANGE *m_mrr_range_current;
|
2020-02-04 22:54:16 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
For each partition: number of ranges MRR scan will scan in the partition
|
|
|
|
*/
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
uint *m_part_mrr_range_length;
|
2020-02-04 22:54:16 +01:00
|
|
|
|
2020-02-25 12:55:15 +01:00
|
|
|
/* For each partition: List of ranges to scan in this partition */
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
PARTITION_PART_KEY_MULTI_RANGE **m_part_mrr_range_first;
|
|
|
|
PARTITION_PART_KEY_MULTI_RANGE **m_part_mrr_range_current;
|
|
|
|
PARTITION_PART_KEY_MULTI_RANGE_HLD *m_partition_part_key_multi_range_hld;
|
2020-02-04 22:54:16 +01:00
|
|
|
|
|
|
|
/*
|
2020-02-25 12:55:15 +01:00
|
|
|
Sequence of ranges to be scanned (TODO: why not store this in
|
2020-02-04 22:54:16 +01:00
|
|
|
handler::mrr_{iter,funcs}?)
|
|
|
|
*/
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
range_seq_t m_seq;
|
|
|
|
RANGE_SEQ_IF *m_seq_if;
|
2020-02-04 22:54:16 +01:00
|
|
|
|
2020-02-25 12:55:15 +01:00
|
|
|
/* Range iterator structure to be supplied to partitions */
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
RANGE_SEQ_IF m_part_seq_if;
|
|
|
|
|
|
|
|
virtual int multi_range_key_create_key(
|
|
|
|
RANGE_SEQ_IF *seq,
|
|
|
|
range_seq_t seq_it
|
|
|
|
);
|
2020-02-28 13:01:27 +01:00
|
|
|
ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
|
|
|
|
void *seq_init_param,
|
|
|
|
uint n_ranges, uint *bufsz,
|
|
|
|
uint *mrr_mode,
|
|
|
|
Cost_estimate *cost) override;
|
|
|
|
ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys,
|
|
|
|
uint key_parts, uint *bufsz,
|
|
|
|
uint *mrr_mode, Cost_estimate *cost) override;
|
|
|
|
int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param,
|
|
|
|
uint n_ranges, uint mrr_mode,
|
|
|
|
HANDLER_BUFFER *buf) override;
|
|
|
|
int multi_range_read_next(range_id_t *range_info) override;
|
|
|
|
int multi_range_read_explain_info(uint mrr_mode, char *str, size_t size)
|
|
|
|
override;
|
2017-09-25 23:56:10 +02:00
|
|
|
uint last_part() { return m_last_part; }
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
|
2005-07-18 13:31:02 +02:00
|
|
|
private:
|
2012-08-15 14:31:26 +02:00
|
|
|
bool init_record_priority_queue();
|
|
|
|
void destroy_record_priority_queue();
|
2008-09-18 21:49:34 +02:00
|
|
|
int common_index_read(uchar * buf, bool have_start_key);
|
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
BitKeeper/etc/ignore:
added libmysqld/ha_ndbcluster_cond.cc
---
added debian/defs.mk debian/control
client/completion_hash.cc:
Remove not needed casts
client/my_readline.h:
Remove some old types
client/mysql.cc:
Simplify types
client/mysql_upgrade.c:
Remove some old types
Update call to dirname_part
client/mysqladmin.cc:
Remove some old types
client/mysqlbinlog.cc:
Remove some old types
Change some buffers to be uchar to avoid casts
client/mysqlcheck.c:
Remove some old types
client/mysqldump.c:
Remove some old types
Remove some not needed casts
Change some string lengths to size_t
client/mysqlimport.c:
Remove some old types
client/mysqlshow.c:
Remove some old types
client/mysqlslap.c:
Remove some old types
Remove some not needed casts
client/mysqltest.c:
Removed some old types
Removed some not needed casts
Updated hash-get-key function arguments
Updated parameters to dirname_part()
client/readline.cc:
Removed some old types
Removed some not needed casts
Changed some string lengths to use size_t
client/sql_string.cc:
Removed some old types
dbug/dbug.c:
Removed some old types
Changed some string lengths to use size_t
Changed some prototypes to avoid casts
extra/comp_err.c:
Removed some old types
extra/innochecksum.c:
Removed some old types
extra/my_print_defaults.c:
Removed some old types
extra/mysql_waitpid.c:
Removed some old types
extra/perror.c:
Removed some old types
extra/replace.c:
Removed some old types
Updated parameters to dirname_part()
extra/resolve_stack_dump.c:
Removed some old types
extra/resolveip.c:
Removed some old types
include/config-win.h:
Removed some old types
include/decimal.h:
Changed binary strings to be uchar* instead of char*
include/ft_global.h:
Removed some old types
include/hash.h:
Removed some old types
include/heap.h:
Removed some old types
Changed records_under_level to be 'ulong' instead of 'uint' to clarify usage of variable
include/keycache.h:
Removed some old types
include/m_ctype.h:
Removed some old types
Changed some string lengths to use size_t
Changed character length functions to return uint
unsigned char -> uchar
include/m_string.h:
Removed some old types
Changed some string lengths to use size_t
include/my_alloc.h:
Changed some string lengths to use size_t
include/my_base.h:
Removed some old types
include/my_dbug.h:
Removed some old types
Changed some string lengths to use size_t
Changed db_dump() to take uchar * as argument for memory to reduce number of casts in usage
include/my_getopt.h:
Removed some old types
include/my_global.h:
Removed old types:
my_size_t -> size_t
byte -> uchar
gptr -> uchar *
include/my_list.h:
Removed some old types
include/my_nosys.h:
Removed some old types
include/my_pthread.h:
Removed some old types
include/my_sys.h:
Removed some old types
Changed MY_FILE_ERROR to be in line with new definitions of my_write()/my_read()
Changed some string lengths to use size_t
my_malloc() / my_free() now uses void *
Updated parameters to dirname_part() & my_uncompress()
include/my_tree.h:
Removed some old types
include/my_trie.h:
Removed some old types
include/my_user.h:
Changed some string lengths to use size_t
include/my_vle.h:
Removed some old types
include/my_xml.h:
Removed some old types
Changed some string lengths to use size_t
include/myisam.h:
Removed some old types
include/myisammrg.h:
Removed some old types
include/mysql.h:
Removed some old types
Changed byte streams to use uchar* instead of char*
include/mysql_com.h:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
include/queues.h:
Removed some old types
include/sql_common.h:
Removed some old types
include/sslopt-longopts.h:
Removed some old types
include/violite.h:
Removed some old types
Changed some string lengths to use size_t
libmysql/client_settings.h:
Removed some old types
libmysql/libmysql.c:
Removed some old types
libmysql/manager.c:
Removed some old types
libmysqld/emb_qcache.cc:
Removed some old types
libmysqld/emb_qcache.h:
Removed some old types
libmysqld/lib_sql.cc:
Removed some old types
Removed some not needed casts
Changed some buffers to be uchar* to avoid casts
true -> TRUE, false -> FALSE
mysys/array.c:
Removed some old types
mysys/charset.c:
Changed some string lengths to use size_t
mysys/checksum.c:
Include zlib to get definition for crc32
Removed some old types
mysys/default.c:
Removed some old types
Changed some string lengths to use size_t
mysys/default_modify.c:
Changed some string lengths to use size_t
Removed some not needed casts
mysys/hash.c:
Removed some old types
Changed some string lengths to use size_t
Note: Prototype of hash_key() has changed which may cause problems if client uses hash_init() with a cast for the hash-get-key function.
hash_element now takes 'ulong' as the index type (cleanup)
mysys/list.c:
Removed some old types
mysys/mf_cache.c:
Changed some string lengths to use size_t
mysys/mf_dirname.c:
Removed some old types
Changed some string lengths to use size_t
Added argument to dirname_part() to avoid calculation of length for 'to'
mysys/mf_fn_ext.c:
Removed some old types
Updated parameters to dirname_part()
mysys/mf_format.c:
Removed some old types
Changed some string lengths to use size_t
mysys/mf_getdate.c:
Removed some old types
mysys/mf_iocache.c:
Removed some old types
Changed some string lengths to use size_t
Changed calculation of 'max_length' to be done the same way in all functions
mysys/mf_iocache2.c:
Removed some old types
Changed some string lengths to use size_t
Clean up comments
Removed not needed indentation
mysys/mf_keycache.c:
Removed some old types
mysys/mf_keycaches.c:
Removed some old types
mysys/mf_loadpath.c:
Removed some old types
mysys/mf_pack.c:
Removed some old types
Changed some string lengths to use size_t
Removed some not needed casts
Removed very old VMS code
Updated parameters to dirname_part()
Use result of dirnam_part() to remove call to strcat()
mysys/mf_path.c:
Removed some old types
mysys/mf_radix.c:
Removed some old types
mysys/mf_same.c:
Removed some old types
mysys/mf_sort.c:
Removed some old types
mysys/mf_soundex.c:
Removed some old types
mysys/mf_strip.c:
Removed some old types
mysys/mf_tempdir.c:
Removed some old types
mysys/mf_unixpath.c:
Removed some old types
mysys/mf_wfile.c:
Removed some old types
mysys/mulalloc.c:
Removed some old types
mysys/my_alloc.c:
Removed some old types
Changed some string lengths to use size_t
Use void* as type for allocated memory area
Removed some not needed casts
Changed argument 'Size' to 'length' according coding guidelines
mysys/my_chsize.c:
Changed some buffers to be uchar* to avoid casts
mysys/my_compress.c:
More comments
Removed some old types
Changed string lengths to use size_t
Changed arguments to my_uncompress() to make them easier to understand
Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix)
Changed type of 'pack_data' argument to packfrm() to avoid casts.
mysys/my_conio.c:
Changed some string lengths to use size_t
mysys/my_create.c:
Removed some old types
mysys/my_div.c:
Removed some old types
mysys/my_error.c:
Removed some old types
mysys/my_fopen.c:
Removed some old types
mysys/my_fstream.c:
Removed some old types
Changed some string lengths to use size_t
writen -> written
mysys/my_getopt.c:
Removed some old types
mysys/my_getwd.c:
Removed some old types
More comments
mysys/my_init.c:
Removed some old types
mysys/my_largepage.c:
Removed some old types
Changed some string lengths to use size_t
mysys/my_lib.c:
Removed some old types
mysys/my_lockmem.c:
Removed some old types
mysys/my_malloc.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed all functions to use size_t
mysys/my_memmem.c:
Indentation cleanup
mysys/my_once.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
mysys/my_open.c:
Removed some old types
mysys/my_pread.c:
Removed some old types
Changed all functions to use size_t
Added comment for how my_pread() / my_pwrite() are supposed to work.
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.
(If we ever would really need this, it should be enabled only with a flag argument)
mysys/my_quick.c:
Removed some old types
Changed all functions to use size_t
mysys/my_read.c:
Removed some old types
Changed all functions to use size_t
mysys/my_realloc.c:
Removed some old types
Use void* as type for allocated memory area
Changed all functions to use size_t
mysys/my_static.c:
Removed some old types
mysys/my_static.h:
Removed some old types
mysys/my_vle.c:
Removed some old types
mysys/my_wincond.c:
Removed some old types
mysys/my_windac.c:
Removed some old types
mysys/my_write.c:
Removed some old types
Changed all functions to use size_t
mysys/ptr_cmp.c:
Removed some old types
Changed all functions to use size_t
mysys/queues.c:
Removed some old types
mysys/safemalloc.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed all functions to use size_t
mysys/string.c:
Removed some old types
Changed all functions to use size_t
mysys/testhash.c:
Removed some old types
mysys/thr_alarm.c:
Removed some old types
mysys/thr_lock.c:
Removed some old types
mysys/tree.c:
Removed some old types
mysys/trie.c:
Removed some old types
mysys/typelib.c:
Removed some old types
plugin/daemon_example/daemon_example.cc:
Removed some old types
regex/reginit.c:
Removed some old types
server-tools/instance-manager/buffer.cc:
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/buffer.h:
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/commands.cc:
Removed some old types
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/instance_map.cc:
Removed some old types
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/instance_options.cc:
Changed buffer to be of type uchar*
Replaced alloc_root + strcpy() with strdup_root()
server-tools/instance-manager/mysql_connection.cc:
Changed buffer to be of type uchar*
server-tools/instance-manager/options.cc:
Removed some old types
server-tools/instance-manager/parse.cc:
Changed some string lengths to use size_t
server-tools/instance-manager/parse.h:
Removed some old types
Changed some string lengths to use size_t
server-tools/instance-manager/protocol.cc:
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
server-tools/instance-manager/protocol.h:
Changed some string lengths to use size_t
server-tools/instance-manager/user_map.cc:
Removed some old types
Changed some string lengths to use size_t
sql/derror.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/discover.cc:
Changed in readfrm() and writefrom() the type for argument 'frmdata' to uchar** to avoid casts
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
sql/event_data_objects.cc:
Removed some old types
Added missing casts for alloc() and sprintf()
sql/event_db_repository.cc:
Changed some buffers to be uchar* to avoid casts
Added missing casts for sprintf()
sql/event_queue.cc:
Removed some old types
sql/field.cc:
Removed some old types
Changed memory buffers to be uchar*
Changed some string lengths to use size_t
Removed a lot of casts
Safety fix in Field_blob::val_decimal() to not access zero pointer
sql/field.h:
Removed some old types
Changed memory buffers to be uchar* (except of store() as this would have caused too many other changes).
Changed some string lengths to use size_t
Removed some not needed casts
Changed val_xxx(xxx, new_ptr) to take const pointers
sql/field_conv.cc:
Removed some old types
Added casts required because memory area pointers are now uchar*
sql/filesort.cc:
Initalize variable that was used unitialized in error conditions
sql/gen_lex_hash.cc:
Removed some old types
Changed memory buffers to be uchar*
Changed some string lengths to use size_t
Removed a lot of casts
Safety fix in Field_blob::val_decimal() to not access zero pointer
sql/gstream.h:
Added required cast
sql/ha_ndbcluster.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
Added required casts
Removed some not needed casts
sql/ha_ndbcluster.h:
Removed some old types
sql/ha_ndbcluster_binlog.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Replaced sql_alloc() + memcpy() + set end 0 with sql_strmake()
Changed some string lengths to use size_t
Added missing casts for alloc() and sprintf()
sql/ha_ndbcluster_binlog.h:
Removed some old types
sql/ha_ndbcluster_cond.cc:
Removed some old types
Removed some not needed casts
sql/ha_ndbcluster_cond.h:
Removed some old types
sql/ha_partition.cc:
Removed some old types
Changed prototype for change_partition() to avoid casts
sql/ha_partition.h:
Removed some old types
sql/handler.cc:
Removed some old types
Changed some string lengths to use size_t
sql/handler.h:
Removed some old types
Changed some string lengths to use size_t
Changed type for 'frmblob' parameter for discover() and ha_discover() to get fewer casts
sql/hash_filo.h:
Removed some old types
Changed all functions to use size_t
sql/hostname.cc:
Removed some old types
sql/item.cc:
Removed some old types
Changed some string lengths to use size_t
Use strmake() instead of memdup() to create a null terminated string.
Updated calls to new Field()
sql/item.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed some buffers to be uchar* to avoid casts
sql/item_cmpfunc.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/item_cmpfunc.h:
Removed some old types
sql/item_create.cc:
Removed some old types
sql/item_func.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added test for failing alloc() in init_result_field()
Remove old confusing comment
Fixed compiler warning
sql/item_func.h:
Removed some old types
sql/item_row.cc:
Removed some old types
sql/item_row.h:
Removed some old types
sql/item_strfunc.cc:
Include zlib (needed becasue we call crc32)
Removed some old types
sql/item_strfunc.h:
Removed some old types
Changed some types to match new function prototypes
sql/item_subselect.cc:
Removed some old types
sql/item_subselect.h:
Removed some old types
sql/item_sum.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/item_sum.h:
Removed some old types
sql/item_timefunc.cc:
Removed some old types
Changed some string lengths to use size_t
sql/item_timefunc.h:
Removed some old types
sql/item_xmlfunc.cc:
Changed some string lengths to use size_t
sql/item_xmlfunc.h:
Removed some old types
sql/key.cc:
Removed some old types
Removed some not needed casts
sql/lock.cc:
Removed some old types
Added some cast to my_multi_malloc() arguments for safety
sql/log.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Changed usage of pwrite() to not assume it holds the cursor position for the file
Made usage of my_read() safer
sql/log_event.cc:
Removed some old types
Added checking of return value of malloc() in pack_info()
Changed some buffers to be uchar* to avoid casts
Removed some 'const' to avoid casts
Added missing casts for alloc() and sprintf()
Added required casts
Removed some not needed casts
Added some cast to my_multi_malloc() arguments for safety
sql/log_event.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/log_event_old.cc:
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/log_event_old.h:
Changed some buffers to be uchar* to avoid casts
sql/mf_iocache.cc:
Removed some old types
sql/my_decimal.cc:
Changed memory area to use uchar*
sql/my_decimal.h:
Changed memory area to use uchar*
sql/mysql_priv.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed some string lengths to use size_t
Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid long overflow
Changed some buffers to be uchar* to avoid casts
sql/mysqld.cc:
Removed some old types
sql/net_serv.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Ensure that vio_read()/vio_write() return values are stored in a size_t variable
Removed some not needed casts
sql/opt_range.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/opt_range.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/opt_sum.cc:
Removed some old types
Removed some not needed casts
sql/parse_file.cc:
Removed some old types
Changed some string lengths to use size_t
Changed alloc_root + memcpy + set end 0 -> strmake_root()
sql/parse_file.h:
Removed some old types
sql/partition_info.cc:
Removed some old types
Added missing casts for alloc()
Changed some buffers to be uchar* to avoid casts
sql/partition_info.h:
Changed some buffers to be uchar* to avoid casts
sql/protocol.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/protocol.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/records.cc:
Removed some old types
sql/repl_failsafe.cc:
Removed some old types
Changed some string lengths to use size_t
Added required casts
sql/rpl_filter.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some string lengths to use size_t
sql/rpl_filter.h:
Changed some string lengths to use size_t
sql/rpl_injector.h:
Removed some old types
sql/rpl_record.cc:
Removed some old types
Removed some not needed casts
Changed some buffers to be uchar* to avoid casts
sql/rpl_record.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/rpl_record_old.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/rpl_record_old.h:
Removed some old types
Changed some buffers to be uchar* to avoid cast
sql/rpl_rli.cc:
Removed some old types
sql/rpl_tblmap.cc:
Removed some old types
sql/rpl_tblmap.h:
Removed some old types
sql/rpl_utility.cc:
Removed some old types
sql/rpl_utility.h:
Removed some old types
Changed type of 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
sql/set_var.cc:
Removed some old types
Updated parameters to dirname_part()
sql/set_var.h:
Removed some old types
sql/slave.cc:
Removed some old types
Changed some string lengths to use size_t
sql/slave.h:
Removed some old types
sql/sp.cc:
Removed some old types
Added missing casts for printf()
sql/sp.h:
Removed some old types
Updated hash-get-key function arguments
sql/sp_cache.cc:
Removed some old types
Added missing casts for printf()
Updated hash-get-key function arguments
sql/sp_head.cc:
Removed some old types
Added missing casts for alloc() and printf()
Added required casts
Updated hash-get-key function arguments
sql/sp_head.h:
Removed some old types
sql/sp_pcontext.cc:
Removed some old types
sql/sp_pcontext.h:
Removed some old types
sql/sql_acl.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added required casts
sql/sql_analyse.cc:
Changed some buffers to be uchar* to avoid casts
sql/sql_analyse.h:
Changed some buffers to be uchar* to avoid casts
sql/sql_array.h:
Removed some old types
sql/sql_base.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_binlog.cc:
Removed some old types
Added missing casts for printf()
sql/sql_cache.cc:
Removed some old types
Updated hash-get-key function arguments
Removed some not needed casts
Changed some string lengths to use size_t
sql/sql_cache.h:
Removed some old types
Removed reference to not existing function cache_key()
Updated hash-get-key function arguments
sql/sql_class.cc:
Removed some old types
Updated hash-get-key function arguments
Added missing casts for alloc()
Updated hash-get-key function arguments
Moved THD::max_row_length() to table.cc (as it's not depending on THD)
Removed some not needed casts
sql/sql_class.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Removed some not needed casts
Changed some string lengths to use size_t
Moved max_row_length and max_row_length_blob() to table.cc, as they are not depending on THD
sql/sql_connect.cc:
Removed some old types
Added required casts
sql/sql_db.cc:
Removed some old types
Removed some not needed casts
Added some cast to my_multi_malloc() arguments for safety
Added missing casts for alloc()
sql/sql_delete.cc:
Removed some old types
sql/sql_handler.cc:
Removed some old types
Updated hash-get-key function arguments
Added some cast to my_multi_malloc() arguments for safety
sql/sql_help.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_insert.cc:
Removed some old types
Added missing casts for alloc() and printf()
sql/sql_lex.cc:
Removed some old types
sql/sql_lex.h:
Removed some old types
Removed some not needed casts
sql/sql_list.h:
Removed some old types
Removed some not needed casts
sql/sql_load.cc:
Removed some old types
Removed compiler warning
sql/sql_manager.cc:
Removed some old types
sql/sql_map.cc:
Removed some old types
sql/sql_map.h:
Removed some old types
sql/sql_olap.cc:
Removed some old types
sql/sql_parse.cc:
Removed some old types
Trivial move of code lines to make things more readable
Changed some string lengths to use size_t
Added missing casts for alloc()
sql/sql_partition.cc:
Removed some old types
Removed compiler warnings about not used functions
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_partition.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/sql_plugin.cc:
Removed some old types
Added missing casts for alloc()
Updated hash-get-key function arguments
sql/sql_prepare.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Added missing casts for alloc() and printf()
sql-common/client.c:
Removed some old types
Changed some memory areas to use uchar*
sql-common/my_user.c:
Changed some string lengths to use size_t
sql-common/pack.c:
Changed some buffers to be uchar* to avoid casts
sql/sql_repl.cc:
Added required casts
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/sql_select.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some old types
sql/sql_select.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/sql_servers.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_show.cc:
Removed some old types
Added missing casts for alloc()
Removed some not needed casts
sql/sql_string.cc:
Removed some old types
Added required casts
sql/sql_table.cc:
Removed some old types
Removed compiler warning about not used variable
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_test.cc:
Removed some old types
sql/sql_trigger.cc:
Removed some old types
Added missing casts for alloc()
sql/sql_udf.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_union.cc:
Removed some old types
sql/sql_update.cc:
Removed some old types
Removed some not needed casts
sql/sql_view.cc:
Removed some old types
sql/sql_yacc.yy:
Removed some old types
Changed some string lengths to use size_t
Added missing casts for alloc()
sql/stacktrace.c:
Removed some old types
sql/stacktrace.h:
Removed some old types
sql/structs.h:
Removed some old types
sql/table.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
Removed setting of LEX_STRING() arguments in declaration
Added required casts
More function comments
Moved max_row_length() here from sql_class.cc/sql_class.h
sql/table.h:
Removed some old types
Changed some string lengths to use size_t
sql/thr_malloc.cc:
Use void* as type for allocated memory area
Changed all functions to use size_t
sql/tzfile.h:
Changed some buffers to be uchar* to avoid casts
sql/tztime.cc:
Changed some buffers to be uchar* to avoid casts
Updated hash-get-key function arguments
Added missing casts for alloc()
Removed some not needed casts
sql/uniques.cc:
Removed some old types
Removed some not needed casts
sql/unireg.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added missing casts for alloc()
storage/archive/archive_reader.c:
Removed some old types
storage/archive/azio.c:
Removed some old types
Removed some not needed casts
storage/archive/ha_archive.cc:
Removed some old types
Changed type for 'frmblob' in archive_discover() to match handler
Updated hash-get-key function arguments
Removed some not needed casts
storage/archive/ha_archive.h:
Removed some old types
storage/blackhole/ha_blackhole.cc:
Removed some old types
storage/blackhole/ha_blackhole.h:
Removed some old types
storage/csv/ha_tina.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
storage/csv/ha_tina.h:
Removed some old types
Removed some not needed casts
storage/csv/transparent_file.cc:
Removed some old types
Changed type of 'bytes_read' to be able to detect read errors
Fixed indentation
storage/csv/transparent_file.h:
Removed some old types
storage/example/ha_example.cc:
Removed some old types
Updated hash-get-key function arguments
storage/example/ha_example.h:
Removed some old types
storage/federated/ha_federated.cc:
Removed some old types
Updated hash-get-key function arguments
Removed some not needed casts
storage/federated/ha_federated.h:
Removed some old types
storage/heap/_check.c:
Changed some buffers to be uchar* to avoid casts
storage/heap/_rectest.c:
Removed some old types
storage/heap/ha_heap.cc:
Removed some old types
storage/heap/ha_heap.h:
Removed some old types
storage/heap/heapdef.h:
Removed some old types
storage/heap/hp_block.c:
Removed some old types
Changed some string lengths to use size_t
storage/heap/hp_clear.c:
Removed some old types
storage/heap/hp_close.c:
Removed some old types
storage/heap/hp_create.c:
Removed some old types
storage/heap/hp_delete.c:
Removed some old types
storage/heap/hp_hash.c:
Removed some old types
storage/heap/hp_info.c:
Removed some old types
storage/heap/hp_open.c:
Removed some old types
storage/heap/hp_rfirst.c:
Removed some old types
storage/heap/hp_rkey.c:
Removed some old types
storage/heap/hp_rlast.c:
Removed some old types
storage/heap/hp_rnext.c:
Removed some old types
storage/heap/hp_rprev.c:
Removed some old types
storage/heap/hp_rrnd.c:
Removed some old types
storage/heap/hp_rsame.c:
Removed some old types
storage/heap/hp_scan.c:
Removed some old types
storage/heap/hp_test1.c:
Removed some old types
storage/heap/hp_test2.c:
Removed some old types
storage/heap/hp_update.c:
Removed some old types
storage/heap/hp_write.c:
Removed some old types
Changed some string lengths to use size_t
storage/innobase/handler/ha_innodb.cc:
Removed some old types
Updated hash-get-key function arguments
Added missing casts for alloc() and printf()
Removed some not needed casts
storage/innobase/handler/ha_innodb.h:
Removed some old types
storage/myisam/ft_boolean_search.c:
Removed some old types
storage/myisam/ft_nlq_search.c:
Removed some old types
storage/myisam/ft_parser.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/ft_static.c:
Removed some old types
storage/myisam/ft_stopwords.c:
Removed some old types
storage/myisam/ft_update.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/ftdefs.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/fulltext.h:
Removed some old types
storage/myisam/ha_myisam.cc:
Removed some old types
storage/myisam/ha_myisam.h:
Removed some old types
storage/myisam/mi_cache.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/mi_check.c:
Removed some old types
storage/myisam/mi_checksum.c:
Removed some old types
storage/myisam/mi_close.c:
Removed some old types
storage/myisam/mi_create.c:
Removed some old types
storage/myisam/mi_delete.c:
Removed some old types
storage/myisam/mi_delete_all.c:
Removed some old types
storage/myisam/mi_dynrec.c:
Removed some old types
storage/myisam/mi_extra.c:
Removed some old types
storage/myisam/mi_key.c:
Removed some old types
storage/myisam/mi_locking.c:
Removed some old types
storage/myisam/mi_log.c:
Removed some old types
storage/myisam/mi_open.c:
Removed some old types
Removed some not needed casts
Check argument of my_write()/my_pwrite() in functions returning int
Added casting of string lengths to size_t
storage/myisam/mi_packrec.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/mi_page.c:
Removed some old types
storage/myisam/mi_preload.c:
Removed some old types
storage/myisam/mi_range.c:
Removed some old types
storage/myisam/mi_rfirst.c:
Removed some old types
storage/myisam/mi_rkey.c:
Removed some old types
storage/myisam/mi_rlast.c:
Removed some old types
storage/myisam/mi_rnext.c:
Removed some old types
storage/myisam/mi_rnext_same.c:
Removed some old types
storage/myisam/mi_rprev.c:
Removed some old types
storage/myisam/mi_rrnd.c:
Removed some old types
storage/myisam/mi_rsame.c:
Removed some old types
storage/myisam/mi_rsamepos.c:
Removed some old types
storage/myisam/mi_scan.c:
Removed some old types
storage/myisam/mi_search.c:
Removed some old types
storage/myisam/mi_static.c:
Removed some old types
storage/myisam/mi_statrec.c:
Removed some old types
storage/myisam/mi_test1.c:
Removed some old types
storage/myisam/mi_test2.c:
Removed some old types
storage/myisam/mi_test3.c:
Removed some old types
storage/myisam/mi_unique.c:
Removed some old types
storage/myisam/mi_update.c:
Removed some old types
storage/myisam/mi_write.c:
Removed some old types
storage/myisam/myisam_ftdump.c:
Removed some old types
storage/myisam/myisamchk.c:
Removed some old types
storage/myisam/myisamdef.h:
Removed some old types
storage/myisam/myisamlog.c:
Removed some old types
Indentation fix
storage/myisam/myisampack.c:
Removed some old types
storage/myisam/rt_index.c:
Removed some old types
storage/myisam/rt_split.c:
Removed some old types
storage/myisam/sort.c:
Removed some old types
storage/myisam/sp_defs.h:
Removed some old types
storage/myisam/sp_key.c:
Removed some old types
storage/myisammrg/ha_myisammrg.cc:
Removed some old types
storage/myisammrg/ha_myisammrg.h:
Removed some old types
storage/myisammrg/myrg_close.c:
Removed some old types
storage/myisammrg/myrg_def.h:
Removed some old types
storage/myisammrg/myrg_delete.c:
Removed some old types
storage/myisammrg/myrg_open.c:
Removed some old types
Updated parameters to dirname_part()
storage/myisammrg/myrg_queue.c:
Removed some old types
storage/myisammrg/myrg_rfirst.c:
Removed some old types
storage/myisammrg/myrg_rkey.c:
Removed some old types
storage/myisammrg/myrg_rlast.c:
Removed some old types
storage/myisammrg/myrg_rnext.c:
Removed some old types
storage/myisammrg/myrg_rnext_same.c:
Removed some old types
storage/myisammrg/myrg_rprev.c:
Removed some old types
storage/myisammrg/myrg_rrnd.c:
Removed some old types
storage/myisammrg/myrg_rsame.c:
Removed some old types
storage/myisammrg/myrg_update.c:
Removed some old types
storage/myisammrg/myrg_write.c:
Removed some old types
storage/ndb/include/util/ndb_opts.h:
Removed some old types
storage/ndb/src/cw/cpcd/main.cpp:
Removed some old types
storage/ndb/src/kernel/vm/Configuration.cpp:
Removed some old types
storage/ndb/src/mgmclient/main.cpp:
Removed some old types
storage/ndb/src/mgmsrv/InitConfigFileParser.cpp:
Removed some old types
Removed old disabled code
storage/ndb/src/mgmsrv/main.cpp:
Removed some old types
storage/ndb/src/ndbapi/NdbBlob.cpp:
Removed some old types
storage/ndb/src/ndbapi/NdbOperationDefine.cpp:
Removed not used variable
storage/ndb/src/ndbapi/NdbOperationInt.cpp:
Added required casts
storage/ndb/src/ndbapi/NdbScanOperation.cpp:
Added required casts
storage/ndb/tools/delete_all.cpp:
Removed some old types
storage/ndb/tools/desc.cpp:
Removed some old types
storage/ndb/tools/drop_index.cpp:
Removed some old types
storage/ndb/tools/drop_tab.cpp:
Removed some old types
storage/ndb/tools/listTables.cpp:
Removed some old types
storage/ndb/tools/ndb_config.cpp:
Removed some old types
storage/ndb/tools/restore/consumer_restore.cpp:
Changed some buffers to be uchar* to avoid casts with new defintion of packfrm()
storage/ndb/tools/restore/restore_main.cpp:
Removed some old types
storage/ndb/tools/select_all.cpp:
Removed some old types
storage/ndb/tools/select_count.cpp:
Removed some old types
storage/ndb/tools/waiter.cpp:
Removed some old types
strings/bchange.c:
Changed function to use uchar * and size_t
strings/bcmp.c:
Changed function to use uchar * and size_t
strings/bmove512.c:
Changed function to use uchar * and size_t
strings/bmove_upp.c:
Changed function to use uchar * and size_t
strings/ctype-big5.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-bin.c:
Changed functions to use size_t
strings/ctype-cp932.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-czech.c:
Fixed indentation
Changed functions to use size_t
strings/ctype-euc_kr.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-eucjpms.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-gb2312.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-gbk.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-latin1.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-mb.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-simple.c:
Changed functions to use size_t
Simpler loops for caseup/casedown
unsigned int -> uint
unsigned char -> uchar
strings/ctype-sjis.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-tis620.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-uca.c:
Changed functions to use size_t
unsigned char -> uchar
strings/ctype-ucs2.c:
Moved inclusion of stdarg.h to other includes
usigned char -> uchar
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-ujis.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-utf8.c:
Changed functions to use size_t
unsigned char -> uchar
Indentation fixes
strings/ctype-win1250ch.c:
Indentation fixes
Changed functions to use size_t
strings/ctype.c:
Changed functions to use size_t
strings/decimal.c:
Changed type for memory argument to uchar *
strings/do_ctype.c:
Indentation fixes
strings/my_strtoll10.c:
unsigned char -> uchar
strings/my_vsnprintf.c:
Changed functions to use size_t
strings/r_strinstr.c:
Removed some old types
Changed functions to use size_t
strings/str_test.c:
Removed some old types
strings/strappend.c:
Changed functions to use size_t
strings/strcont.c:
Removed some old types
strings/strfill.c:
Removed some old types
strings/strinstr.c:
Changed functions to use size_t
strings/strlen.c:
Changed functions to use size_t
strings/strmake.c:
Changed functions to use size_t
strings/strnlen.c:
Changed functions to use size_t
strings/strnmov.c:
Changed functions to use size_t
strings/strto.c:
unsigned char -> uchar
strings/strtod.c:
Changed functions to use size_t
strings/strxnmov.c:
Changed functions to use size_t
strings/xml.c:
Changed functions to use size_t
Indentation fixes
tests/mysql_client_test.c:
Removed some old types
tests/thread_test.c:
Removed some old types
vio/test-ssl.c:
Removed some old types
vio/test-sslclient.c:
Removed some old types
vio/test-sslserver.c:
Removed some old types
vio/vio.c:
Removed some old types
vio/vio_priv.h:
Removed some old types
Changed vio_read()/vio_write() to work with size_t
vio/viosocket.c:
Changed vio_read()/vio_write() to work with size_t
Indentation fixes
vio/viossl.c:
Changed vio_read()/vio_write() to work with size_t
Indentation fixes
vio/viosslfactories.c:
Removed some old types
vio/viotest-ssl.c:
Removed some old types
win/README:
More explanations
2007-05-10 11:59:39 +02:00
|
|
|
int common_first_last(uchar * buf);
|
|
|
|
int partition_scan_set_up(uchar * buf, bool idx_read_flag);
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
bool check_parallel_search();
|
|
|
|
int handle_pre_scan(bool reverse_order, bool use_parallel);
|
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
BitKeeper/etc/ignore:
added libmysqld/ha_ndbcluster_cond.cc
---
added debian/defs.mk debian/control
client/completion_hash.cc:
Remove not needed casts
client/my_readline.h:
Remove some old types
client/mysql.cc:
Simplify types
client/mysql_upgrade.c:
Remove some old types
Update call to dirname_part
client/mysqladmin.cc:
Remove some old types
client/mysqlbinlog.cc:
Remove some old types
Change some buffers to be uchar to avoid casts
client/mysqlcheck.c:
Remove some old types
client/mysqldump.c:
Remove some old types
Remove some not needed casts
Change some string lengths to size_t
client/mysqlimport.c:
Remove some old types
client/mysqlshow.c:
Remove some old types
client/mysqlslap.c:
Remove some old types
Remove some not needed casts
client/mysqltest.c:
Removed some old types
Removed some not needed casts
Updated hash-get-key function arguments
Updated parameters to dirname_part()
client/readline.cc:
Removed some old types
Removed some not needed casts
Changed some string lengths to use size_t
client/sql_string.cc:
Removed some old types
dbug/dbug.c:
Removed some old types
Changed some string lengths to use size_t
Changed some prototypes to avoid casts
extra/comp_err.c:
Removed some old types
extra/innochecksum.c:
Removed some old types
extra/my_print_defaults.c:
Removed some old types
extra/mysql_waitpid.c:
Removed some old types
extra/perror.c:
Removed some old types
extra/replace.c:
Removed some old types
Updated parameters to dirname_part()
extra/resolve_stack_dump.c:
Removed some old types
extra/resolveip.c:
Removed some old types
include/config-win.h:
Removed some old types
include/decimal.h:
Changed binary strings to be uchar* instead of char*
include/ft_global.h:
Removed some old types
include/hash.h:
Removed some old types
include/heap.h:
Removed some old types
Changed records_under_level to be 'ulong' instead of 'uint' to clarify usage of variable
include/keycache.h:
Removed some old types
include/m_ctype.h:
Removed some old types
Changed some string lengths to use size_t
Changed character length functions to return uint
unsigned char -> uchar
include/m_string.h:
Removed some old types
Changed some string lengths to use size_t
include/my_alloc.h:
Changed some string lengths to use size_t
include/my_base.h:
Removed some old types
include/my_dbug.h:
Removed some old types
Changed some string lengths to use size_t
Changed db_dump() to take uchar * as argument for memory to reduce number of casts in usage
include/my_getopt.h:
Removed some old types
include/my_global.h:
Removed old types:
my_size_t -> size_t
byte -> uchar
gptr -> uchar *
include/my_list.h:
Removed some old types
include/my_nosys.h:
Removed some old types
include/my_pthread.h:
Removed some old types
include/my_sys.h:
Removed some old types
Changed MY_FILE_ERROR to be in line with new definitions of my_write()/my_read()
Changed some string lengths to use size_t
my_malloc() / my_free() now uses void *
Updated parameters to dirname_part() & my_uncompress()
include/my_tree.h:
Removed some old types
include/my_trie.h:
Removed some old types
include/my_user.h:
Changed some string lengths to use size_t
include/my_vle.h:
Removed some old types
include/my_xml.h:
Removed some old types
Changed some string lengths to use size_t
include/myisam.h:
Removed some old types
include/myisammrg.h:
Removed some old types
include/mysql.h:
Removed some old types
Changed byte streams to use uchar* instead of char*
include/mysql_com.h:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
include/queues.h:
Removed some old types
include/sql_common.h:
Removed some old types
include/sslopt-longopts.h:
Removed some old types
include/violite.h:
Removed some old types
Changed some string lengths to use size_t
libmysql/client_settings.h:
Removed some old types
libmysql/libmysql.c:
Removed some old types
libmysql/manager.c:
Removed some old types
libmysqld/emb_qcache.cc:
Removed some old types
libmysqld/emb_qcache.h:
Removed some old types
libmysqld/lib_sql.cc:
Removed some old types
Removed some not needed casts
Changed some buffers to be uchar* to avoid casts
true -> TRUE, false -> FALSE
mysys/array.c:
Removed some old types
mysys/charset.c:
Changed some string lengths to use size_t
mysys/checksum.c:
Include zlib to get definition for crc32
Removed some old types
mysys/default.c:
Removed some old types
Changed some string lengths to use size_t
mysys/default_modify.c:
Changed some string lengths to use size_t
Removed some not needed casts
mysys/hash.c:
Removed some old types
Changed some string lengths to use size_t
Note: Prototype of hash_key() has changed which may cause problems if client uses hash_init() with a cast for the hash-get-key function.
hash_element now takes 'ulong' as the index type (cleanup)
mysys/list.c:
Removed some old types
mysys/mf_cache.c:
Changed some string lengths to use size_t
mysys/mf_dirname.c:
Removed some old types
Changed some string lengths to use size_t
Added argument to dirname_part() to avoid calculation of length for 'to'
mysys/mf_fn_ext.c:
Removed some old types
Updated parameters to dirname_part()
mysys/mf_format.c:
Removed some old types
Changed some string lengths to use size_t
mysys/mf_getdate.c:
Removed some old types
mysys/mf_iocache.c:
Removed some old types
Changed some string lengths to use size_t
Changed calculation of 'max_length' to be done the same way in all functions
mysys/mf_iocache2.c:
Removed some old types
Changed some string lengths to use size_t
Clean up comments
Removed not needed indentation
mysys/mf_keycache.c:
Removed some old types
mysys/mf_keycaches.c:
Removed some old types
mysys/mf_loadpath.c:
Removed some old types
mysys/mf_pack.c:
Removed some old types
Changed some string lengths to use size_t
Removed some not needed casts
Removed very old VMS code
Updated parameters to dirname_part()
Use result of dirnam_part() to remove call to strcat()
mysys/mf_path.c:
Removed some old types
mysys/mf_radix.c:
Removed some old types
mysys/mf_same.c:
Removed some old types
mysys/mf_sort.c:
Removed some old types
mysys/mf_soundex.c:
Removed some old types
mysys/mf_strip.c:
Removed some old types
mysys/mf_tempdir.c:
Removed some old types
mysys/mf_unixpath.c:
Removed some old types
mysys/mf_wfile.c:
Removed some old types
mysys/mulalloc.c:
Removed some old types
mysys/my_alloc.c:
Removed some old types
Changed some string lengths to use size_t
Use void* as type for allocated memory area
Removed some not needed casts
Changed argument 'Size' to 'length' according coding guidelines
mysys/my_chsize.c:
Changed some buffers to be uchar* to avoid casts
mysys/my_compress.c:
More comments
Removed some old types
Changed string lengths to use size_t
Changed arguments to my_uncompress() to make them easier to understand
Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix)
Changed type of 'pack_data' argument to packfrm() to avoid casts.
mysys/my_conio.c:
Changed some string lengths to use size_t
mysys/my_create.c:
Removed some old types
mysys/my_div.c:
Removed some old types
mysys/my_error.c:
Removed some old types
mysys/my_fopen.c:
Removed some old types
mysys/my_fstream.c:
Removed some old types
Changed some string lengths to use size_t
writen -> written
mysys/my_getopt.c:
Removed some old types
mysys/my_getwd.c:
Removed some old types
More comments
mysys/my_init.c:
Removed some old types
mysys/my_largepage.c:
Removed some old types
Changed some string lengths to use size_t
mysys/my_lib.c:
Removed some old types
mysys/my_lockmem.c:
Removed some old types
mysys/my_malloc.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed all functions to use size_t
mysys/my_memmem.c:
Indentation cleanup
mysys/my_once.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
mysys/my_open.c:
Removed some old types
mysys/my_pread.c:
Removed some old types
Changed all functions to use size_t
Added comment for how my_pread() / my_pwrite() are supposed to work.
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.
(If we ever would really need this, it should be enabled only with a flag argument)
mysys/my_quick.c:
Removed some old types
Changed all functions to use size_t
mysys/my_read.c:
Removed some old types
Changed all functions to use size_t
mysys/my_realloc.c:
Removed some old types
Use void* as type for allocated memory area
Changed all functions to use size_t
mysys/my_static.c:
Removed some old types
mysys/my_static.h:
Removed some old types
mysys/my_vle.c:
Removed some old types
mysys/my_wincond.c:
Removed some old types
mysys/my_windac.c:
Removed some old types
mysys/my_write.c:
Removed some old types
Changed all functions to use size_t
mysys/ptr_cmp.c:
Removed some old types
Changed all functions to use size_t
mysys/queues.c:
Removed some old types
mysys/safemalloc.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed all functions to use size_t
mysys/string.c:
Removed some old types
Changed all functions to use size_t
mysys/testhash.c:
Removed some old types
mysys/thr_alarm.c:
Removed some old types
mysys/thr_lock.c:
Removed some old types
mysys/tree.c:
Removed some old types
mysys/trie.c:
Removed some old types
mysys/typelib.c:
Removed some old types
plugin/daemon_example/daemon_example.cc:
Removed some old types
regex/reginit.c:
Removed some old types
server-tools/instance-manager/buffer.cc:
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/buffer.h:
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/commands.cc:
Removed some old types
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/instance_map.cc:
Removed some old types
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/instance_options.cc:
Changed buffer to be of type uchar*
Replaced alloc_root + strcpy() with strdup_root()
server-tools/instance-manager/mysql_connection.cc:
Changed buffer to be of type uchar*
server-tools/instance-manager/options.cc:
Removed some old types
server-tools/instance-manager/parse.cc:
Changed some string lengths to use size_t
server-tools/instance-manager/parse.h:
Removed some old types
Changed some string lengths to use size_t
server-tools/instance-manager/protocol.cc:
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
server-tools/instance-manager/protocol.h:
Changed some string lengths to use size_t
server-tools/instance-manager/user_map.cc:
Removed some old types
Changed some string lengths to use size_t
sql/derror.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/discover.cc:
Changed in readfrm() and writefrom() the type for argument 'frmdata' to uchar** to avoid casts
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
sql/event_data_objects.cc:
Removed some old types
Added missing casts for alloc() and sprintf()
sql/event_db_repository.cc:
Changed some buffers to be uchar* to avoid casts
Added missing casts for sprintf()
sql/event_queue.cc:
Removed some old types
sql/field.cc:
Removed some old types
Changed memory buffers to be uchar*
Changed some string lengths to use size_t
Removed a lot of casts
Safety fix in Field_blob::val_decimal() to not access zero pointer
sql/field.h:
Removed some old types
Changed memory buffers to be uchar* (except of store() as this would have caused too many other changes).
Changed some string lengths to use size_t
Removed some not needed casts
Changed val_xxx(xxx, new_ptr) to take const pointers
sql/field_conv.cc:
Removed some old types
Added casts required because memory area pointers are now uchar*
sql/filesort.cc:
Initalize variable that was used unitialized in error conditions
sql/gen_lex_hash.cc:
Removed some old types
Changed memory buffers to be uchar*
Changed some string lengths to use size_t
Removed a lot of casts
Safety fix in Field_blob::val_decimal() to not access zero pointer
sql/gstream.h:
Added required cast
sql/ha_ndbcluster.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
Added required casts
Removed some not needed casts
sql/ha_ndbcluster.h:
Removed some old types
sql/ha_ndbcluster_binlog.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Replaced sql_alloc() + memcpy() + set end 0 with sql_strmake()
Changed some string lengths to use size_t
Added missing casts for alloc() and sprintf()
sql/ha_ndbcluster_binlog.h:
Removed some old types
sql/ha_ndbcluster_cond.cc:
Removed some old types
Removed some not needed casts
sql/ha_ndbcluster_cond.h:
Removed some old types
sql/ha_partition.cc:
Removed some old types
Changed prototype for change_partition() to avoid casts
sql/ha_partition.h:
Removed some old types
sql/handler.cc:
Removed some old types
Changed some string lengths to use size_t
sql/handler.h:
Removed some old types
Changed some string lengths to use size_t
Changed type for 'frmblob' parameter for discover() and ha_discover() to get fewer casts
sql/hash_filo.h:
Removed some old types
Changed all functions to use size_t
sql/hostname.cc:
Removed some old types
sql/item.cc:
Removed some old types
Changed some string lengths to use size_t
Use strmake() instead of memdup() to create a null terminated string.
Updated calls to new Field()
sql/item.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed some buffers to be uchar* to avoid casts
sql/item_cmpfunc.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/item_cmpfunc.h:
Removed some old types
sql/item_create.cc:
Removed some old types
sql/item_func.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added test for failing alloc() in init_result_field()
Remove old confusing comment
Fixed compiler warning
sql/item_func.h:
Removed some old types
sql/item_row.cc:
Removed some old types
sql/item_row.h:
Removed some old types
sql/item_strfunc.cc:
Include zlib (needed becasue we call crc32)
Removed some old types
sql/item_strfunc.h:
Removed some old types
Changed some types to match new function prototypes
sql/item_subselect.cc:
Removed some old types
sql/item_subselect.h:
Removed some old types
sql/item_sum.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/item_sum.h:
Removed some old types
sql/item_timefunc.cc:
Removed some old types
Changed some string lengths to use size_t
sql/item_timefunc.h:
Removed some old types
sql/item_xmlfunc.cc:
Changed some string lengths to use size_t
sql/item_xmlfunc.h:
Removed some old types
sql/key.cc:
Removed some old types
Removed some not needed casts
sql/lock.cc:
Removed some old types
Added some cast to my_multi_malloc() arguments for safety
sql/log.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Changed usage of pwrite() to not assume it holds the cursor position for the file
Made usage of my_read() safer
sql/log_event.cc:
Removed some old types
Added checking of return value of malloc() in pack_info()
Changed some buffers to be uchar* to avoid casts
Removed some 'const' to avoid casts
Added missing casts for alloc() and sprintf()
Added required casts
Removed some not needed casts
Added some cast to my_multi_malloc() arguments for safety
sql/log_event.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/log_event_old.cc:
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/log_event_old.h:
Changed some buffers to be uchar* to avoid casts
sql/mf_iocache.cc:
Removed some old types
sql/my_decimal.cc:
Changed memory area to use uchar*
sql/my_decimal.h:
Changed memory area to use uchar*
sql/mysql_priv.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed some string lengths to use size_t
Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid long overflow
Changed some buffers to be uchar* to avoid casts
sql/mysqld.cc:
Removed some old types
sql/net_serv.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Ensure that vio_read()/vio_write() return values are stored in a size_t variable
Removed some not needed casts
sql/opt_range.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/opt_range.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/opt_sum.cc:
Removed some old types
Removed some not needed casts
sql/parse_file.cc:
Removed some old types
Changed some string lengths to use size_t
Changed alloc_root + memcpy + set end 0 -> strmake_root()
sql/parse_file.h:
Removed some old types
sql/partition_info.cc:
Removed some old types
Added missing casts for alloc()
Changed some buffers to be uchar* to avoid casts
sql/partition_info.h:
Changed some buffers to be uchar* to avoid casts
sql/protocol.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/protocol.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/records.cc:
Removed some old types
sql/repl_failsafe.cc:
Removed some old types
Changed some string lengths to use size_t
Added required casts
sql/rpl_filter.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some string lengths to use size_t
sql/rpl_filter.h:
Changed some string lengths to use size_t
sql/rpl_injector.h:
Removed some old types
sql/rpl_record.cc:
Removed some old types
Removed some not needed casts
Changed some buffers to be uchar* to avoid casts
sql/rpl_record.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/rpl_record_old.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/rpl_record_old.h:
Removed some old types
Changed some buffers to be uchar* to avoid cast
sql/rpl_rli.cc:
Removed some old types
sql/rpl_tblmap.cc:
Removed some old types
sql/rpl_tblmap.h:
Removed some old types
sql/rpl_utility.cc:
Removed some old types
sql/rpl_utility.h:
Removed some old types
Changed type of 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
sql/set_var.cc:
Removed some old types
Updated parameters to dirname_part()
sql/set_var.h:
Removed some old types
sql/slave.cc:
Removed some old types
Changed some string lengths to use size_t
sql/slave.h:
Removed some old types
sql/sp.cc:
Removed some old types
Added missing casts for printf()
sql/sp.h:
Removed some old types
Updated hash-get-key function arguments
sql/sp_cache.cc:
Removed some old types
Added missing casts for printf()
Updated hash-get-key function arguments
sql/sp_head.cc:
Removed some old types
Added missing casts for alloc() and printf()
Added required casts
Updated hash-get-key function arguments
sql/sp_head.h:
Removed some old types
sql/sp_pcontext.cc:
Removed some old types
sql/sp_pcontext.h:
Removed some old types
sql/sql_acl.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added required casts
sql/sql_analyse.cc:
Changed some buffers to be uchar* to avoid casts
sql/sql_analyse.h:
Changed some buffers to be uchar* to avoid casts
sql/sql_array.h:
Removed some old types
sql/sql_base.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_binlog.cc:
Removed some old types
Added missing casts for printf()
sql/sql_cache.cc:
Removed some old types
Updated hash-get-key function arguments
Removed some not needed casts
Changed some string lengths to use size_t
sql/sql_cache.h:
Removed some old types
Removed reference to not existing function cache_key()
Updated hash-get-key function arguments
sql/sql_class.cc:
Removed some old types
Updated hash-get-key function arguments
Added missing casts for alloc()
Updated hash-get-key function arguments
Moved THD::max_row_length() to table.cc (as it's not depending on THD)
Removed some not needed casts
sql/sql_class.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Removed some not needed casts
Changed some string lengths to use size_t
Moved max_row_length and max_row_length_blob() to table.cc, as they are not depending on THD
sql/sql_connect.cc:
Removed some old types
Added required casts
sql/sql_db.cc:
Removed some old types
Removed some not needed casts
Added some cast to my_multi_malloc() arguments for safety
Added missing casts for alloc()
sql/sql_delete.cc:
Removed some old types
sql/sql_handler.cc:
Removed some old types
Updated hash-get-key function arguments
Added some cast to my_multi_malloc() arguments for safety
sql/sql_help.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_insert.cc:
Removed some old types
Added missing casts for alloc() and printf()
sql/sql_lex.cc:
Removed some old types
sql/sql_lex.h:
Removed some old types
Removed some not needed casts
sql/sql_list.h:
Removed some old types
Removed some not needed casts
sql/sql_load.cc:
Removed some old types
Removed compiler warning
sql/sql_manager.cc:
Removed some old types
sql/sql_map.cc:
Removed some old types
sql/sql_map.h:
Removed some old types
sql/sql_olap.cc:
Removed some old types
sql/sql_parse.cc:
Removed some old types
Trivial move of code lines to make things more readable
Changed some string lengths to use size_t
Added missing casts for alloc()
sql/sql_partition.cc:
Removed some old types
Removed compiler warnings about not used functions
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_partition.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/sql_plugin.cc:
Removed some old types
Added missing casts for alloc()
Updated hash-get-key function arguments
sql/sql_prepare.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Added missing casts for alloc() and printf()
sql-common/client.c:
Removed some old types
Changed some memory areas to use uchar*
sql-common/my_user.c:
Changed some string lengths to use size_t
sql-common/pack.c:
Changed some buffers to be uchar* to avoid casts
sql/sql_repl.cc:
Added required casts
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/sql_select.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some old types
sql/sql_select.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/sql_servers.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_show.cc:
Removed some old types
Added missing casts for alloc()
Removed some not needed casts
sql/sql_string.cc:
Removed some old types
Added required casts
sql/sql_table.cc:
Removed some old types
Removed compiler warning about not used variable
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_test.cc:
Removed some old types
sql/sql_trigger.cc:
Removed some old types
Added missing casts for alloc()
sql/sql_udf.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_union.cc:
Removed some old types
sql/sql_update.cc:
Removed some old types
Removed some not needed casts
sql/sql_view.cc:
Removed some old types
sql/sql_yacc.yy:
Removed some old types
Changed some string lengths to use size_t
Added missing casts for alloc()
sql/stacktrace.c:
Removed some old types
sql/stacktrace.h:
Removed some old types
sql/structs.h:
Removed some old types
sql/table.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
Removed setting of LEX_STRING() arguments in declaration
Added required casts
More function comments
Moved max_row_length() here from sql_class.cc/sql_class.h
sql/table.h:
Removed some old types
Changed some string lengths to use size_t
sql/thr_malloc.cc:
Use void* as type for allocated memory area
Changed all functions to use size_t
sql/tzfile.h:
Changed some buffers to be uchar* to avoid casts
sql/tztime.cc:
Changed some buffers to be uchar* to avoid casts
Updated hash-get-key function arguments
Added missing casts for alloc()
Removed some not needed casts
sql/uniques.cc:
Removed some old types
Removed some not needed casts
sql/unireg.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added missing casts for alloc()
storage/archive/archive_reader.c:
Removed some old types
storage/archive/azio.c:
Removed some old types
Removed some not needed casts
storage/archive/ha_archive.cc:
Removed some old types
Changed type for 'frmblob' in archive_discover() to match handler
Updated hash-get-key function arguments
Removed some not needed casts
storage/archive/ha_archive.h:
Removed some old types
storage/blackhole/ha_blackhole.cc:
Removed some old types
storage/blackhole/ha_blackhole.h:
Removed some old types
storage/csv/ha_tina.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
storage/csv/ha_tina.h:
Removed some old types
Removed some not needed casts
storage/csv/transparent_file.cc:
Removed some old types
Changed type of 'bytes_read' to be able to detect read errors
Fixed indentation
storage/csv/transparent_file.h:
Removed some old types
storage/example/ha_example.cc:
Removed some old types
Updated hash-get-key function arguments
storage/example/ha_example.h:
Removed some old types
storage/federated/ha_federated.cc:
Removed some old types
Updated hash-get-key function arguments
Removed some not needed casts
storage/federated/ha_federated.h:
Removed some old types
storage/heap/_check.c:
Changed some buffers to be uchar* to avoid casts
storage/heap/_rectest.c:
Removed some old types
storage/heap/ha_heap.cc:
Removed some old types
storage/heap/ha_heap.h:
Removed some old types
storage/heap/heapdef.h:
Removed some old types
storage/heap/hp_block.c:
Removed some old types
Changed some string lengths to use size_t
storage/heap/hp_clear.c:
Removed some old types
storage/heap/hp_close.c:
Removed some old types
storage/heap/hp_create.c:
Removed some old types
storage/heap/hp_delete.c:
Removed some old types
storage/heap/hp_hash.c:
Removed some old types
storage/heap/hp_info.c:
Removed some old types
storage/heap/hp_open.c:
Removed some old types
storage/heap/hp_rfirst.c:
Removed some old types
storage/heap/hp_rkey.c:
Removed some old types
storage/heap/hp_rlast.c:
Removed some old types
storage/heap/hp_rnext.c:
Removed some old types
storage/heap/hp_rprev.c:
Removed some old types
storage/heap/hp_rrnd.c:
Removed some old types
storage/heap/hp_rsame.c:
Removed some old types
storage/heap/hp_scan.c:
Removed some old types
storage/heap/hp_test1.c:
Removed some old types
storage/heap/hp_test2.c:
Removed some old types
storage/heap/hp_update.c:
Removed some old types
storage/heap/hp_write.c:
Removed some old types
Changed some string lengths to use size_t
storage/innobase/handler/ha_innodb.cc:
Removed some old types
Updated hash-get-key function arguments
Added missing casts for alloc() and printf()
Removed some not needed casts
storage/innobase/handler/ha_innodb.h:
Removed some old types
storage/myisam/ft_boolean_search.c:
Removed some old types
storage/myisam/ft_nlq_search.c:
Removed some old types
storage/myisam/ft_parser.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/ft_static.c:
Removed some old types
storage/myisam/ft_stopwords.c:
Removed some old types
storage/myisam/ft_update.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/ftdefs.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/fulltext.h:
Removed some old types
storage/myisam/ha_myisam.cc:
Removed some old types
storage/myisam/ha_myisam.h:
Removed some old types
storage/myisam/mi_cache.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/mi_check.c:
Removed some old types
storage/myisam/mi_checksum.c:
Removed some old types
storage/myisam/mi_close.c:
Removed some old types
storage/myisam/mi_create.c:
Removed some old types
storage/myisam/mi_delete.c:
Removed some old types
storage/myisam/mi_delete_all.c:
Removed some old types
storage/myisam/mi_dynrec.c:
Removed some old types
storage/myisam/mi_extra.c:
Removed some old types
storage/myisam/mi_key.c:
Removed some old types
storage/myisam/mi_locking.c:
Removed some old types
storage/myisam/mi_log.c:
Removed some old types
storage/myisam/mi_open.c:
Removed some old types
Removed some not needed casts
Check argument of my_write()/my_pwrite() in functions returning int
Added casting of string lengths to size_t
storage/myisam/mi_packrec.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/mi_page.c:
Removed some old types
storage/myisam/mi_preload.c:
Removed some old types
storage/myisam/mi_range.c:
Removed some old types
storage/myisam/mi_rfirst.c:
Removed some old types
storage/myisam/mi_rkey.c:
Removed some old types
storage/myisam/mi_rlast.c:
Removed some old types
storage/myisam/mi_rnext.c:
Removed some old types
storage/myisam/mi_rnext_same.c:
Removed some old types
storage/myisam/mi_rprev.c:
Removed some old types
storage/myisam/mi_rrnd.c:
Removed some old types
storage/myisam/mi_rsame.c:
Removed some old types
storage/myisam/mi_rsamepos.c:
Removed some old types
storage/myisam/mi_scan.c:
Removed some old types
storage/myisam/mi_search.c:
Removed some old types
storage/myisam/mi_static.c:
Removed some old types
storage/myisam/mi_statrec.c:
Removed some old types
storage/myisam/mi_test1.c:
Removed some old types
storage/myisam/mi_test2.c:
Removed some old types
storage/myisam/mi_test3.c:
Removed some old types
storage/myisam/mi_unique.c:
Removed some old types
storage/myisam/mi_update.c:
Removed some old types
storage/myisam/mi_write.c:
Removed some old types
storage/myisam/myisam_ftdump.c:
Removed some old types
storage/myisam/myisamchk.c:
Removed some old types
storage/myisam/myisamdef.h:
Removed some old types
storage/myisam/myisamlog.c:
Removed some old types
Indentation fix
storage/myisam/myisampack.c:
Removed some old types
storage/myisam/rt_index.c:
Removed some old types
storage/myisam/rt_split.c:
Removed some old types
storage/myisam/sort.c:
Removed some old types
storage/myisam/sp_defs.h:
Removed some old types
storage/myisam/sp_key.c:
Removed some old types
storage/myisammrg/ha_myisammrg.cc:
Removed some old types
storage/myisammrg/ha_myisammrg.h:
Removed some old types
storage/myisammrg/myrg_close.c:
Removed some old types
storage/myisammrg/myrg_def.h:
Removed some old types
storage/myisammrg/myrg_delete.c:
Removed some old types
storage/myisammrg/myrg_open.c:
Removed some old types
Updated parameters to dirname_part()
storage/myisammrg/myrg_queue.c:
Removed some old types
storage/myisammrg/myrg_rfirst.c:
Removed some old types
storage/myisammrg/myrg_rkey.c:
Removed some old types
storage/myisammrg/myrg_rlast.c:
Removed some old types
storage/myisammrg/myrg_rnext.c:
Removed some old types
storage/myisammrg/myrg_rnext_same.c:
Removed some old types
storage/myisammrg/myrg_rprev.c:
Removed some old types
storage/myisammrg/myrg_rrnd.c:
Removed some old types
storage/myisammrg/myrg_rsame.c:
Removed some old types
storage/myisammrg/myrg_update.c:
Removed some old types
storage/myisammrg/myrg_write.c:
Removed some old types
storage/ndb/include/util/ndb_opts.h:
Removed some old types
storage/ndb/src/cw/cpcd/main.cpp:
Removed some old types
storage/ndb/src/kernel/vm/Configuration.cpp:
Removed some old types
storage/ndb/src/mgmclient/main.cpp:
Removed some old types
storage/ndb/src/mgmsrv/InitConfigFileParser.cpp:
Removed some old types
Removed old disabled code
storage/ndb/src/mgmsrv/main.cpp:
Removed some old types
storage/ndb/src/ndbapi/NdbBlob.cpp:
Removed some old types
storage/ndb/src/ndbapi/NdbOperationDefine.cpp:
Removed not used variable
storage/ndb/src/ndbapi/NdbOperationInt.cpp:
Added required casts
storage/ndb/src/ndbapi/NdbScanOperation.cpp:
Added required casts
storage/ndb/tools/delete_all.cpp:
Removed some old types
storage/ndb/tools/desc.cpp:
Removed some old types
storage/ndb/tools/drop_index.cpp:
Removed some old types
storage/ndb/tools/drop_tab.cpp:
Removed some old types
storage/ndb/tools/listTables.cpp:
Removed some old types
storage/ndb/tools/ndb_config.cpp:
Removed some old types
storage/ndb/tools/restore/consumer_restore.cpp:
Changed some buffers to be uchar* to avoid casts with new defintion of packfrm()
storage/ndb/tools/restore/restore_main.cpp:
Removed some old types
storage/ndb/tools/select_all.cpp:
Removed some old types
storage/ndb/tools/select_count.cpp:
Removed some old types
storage/ndb/tools/waiter.cpp:
Removed some old types
strings/bchange.c:
Changed function to use uchar * and size_t
strings/bcmp.c:
Changed function to use uchar * and size_t
strings/bmove512.c:
Changed function to use uchar * and size_t
strings/bmove_upp.c:
Changed function to use uchar * and size_t
strings/ctype-big5.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-bin.c:
Changed functions to use size_t
strings/ctype-cp932.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-czech.c:
Fixed indentation
Changed functions to use size_t
strings/ctype-euc_kr.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-eucjpms.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-gb2312.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-gbk.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-latin1.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-mb.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-simple.c:
Changed functions to use size_t
Simpler loops for caseup/casedown
unsigned int -> uint
unsigned char -> uchar
strings/ctype-sjis.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-tis620.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-uca.c:
Changed functions to use size_t
unsigned char -> uchar
strings/ctype-ucs2.c:
Moved inclusion of stdarg.h to other includes
usigned char -> uchar
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-ujis.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-utf8.c:
Changed functions to use size_t
unsigned char -> uchar
Indentation fixes
strings/ctype-win1250ch.c:
Indentation fixes
Changed functions to use size_t
strings/ctype.c:
Changed functions to use size_t
strings/decimal.c:
Changed type for memory argument to uchar *
strings/do_ctype.c:
Indentation fixes
strings/my_strtoll10.c:
unsigned char -> uchar
strings/my_vsnprintf.c:
Changed functions to use size_t
strings/r_strinstr.c:
Removed some old types
Changed functions to use size_t
strings/str_test.c:
Removed some old types
strings/strappend.c:
Changed functions to use size_t
strings/strcont.c:
Removed some old types
strings/strfill.c:
Removed some old types
strings/strinstr.c:
Changed functions to use size_t
strings/strlen.c:
Changed functions to use size_t
strings/strmake.c:
Changed functions to use size_t
strings/strnlen.c:
Changed functions to use size_t
strings/strnmov.c:
Changed functions to use size_t
strings/strto.c:
unsigned char -> uchar
strings/strtod.c:
Changed functions to use size_t
strings/strxnmov.c:
Changed functions to use size_t
strings/xml.c:
Changed functions to use size_t
Indentation fixes
tests/mysql_client_test.c:
Removed some old types
tests/thread_test.c:
Removed some old types
vio/test-ssl.c:
Removed some old types
vio/test-sslclient.c:
Removed some old types
vio/test-sslserver.c:
Removed some old types
vio/vio.c:
Removed some old types
vio/vio_priv.h:
Removed some old types
Changed vio_read()/vio_write() to work with size_t
vio/viosocket.c:
Changed vio_read()/vio_write() to work with size_t
Indentation fixes
vio/viossl.c:
Changed vio_read()/vio_write() to work with size_t
Indentation fixes
vio/viosslfactories.c:
Removed some old types
vio/viotest-ssl.c:
Removed some old types
win/README:
More explanations
2007-05-10 11:59:39 +02:00
|
|
|
int handle_unordered_next(uchar * buf, bool next_same);
|
|
|
|
int handle_unordered_scan_next_partition(uchar * buf);
|
|
|
|
int handle_ordered_index_scan(uchar * buf, bool reverse_order);
|
2012-09-10 13:32:50 +02:00
|
|
|
int handle_ordered_index_scan_key_not_found();
|
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
BitKeeper/etc/ignore:
added libmysqld/ha_ndbcluster_cond.cc
---
added debian/defs.mk debian/control
client/completion_hash.cc:
Remove not needed casts
client/my_readline.h:
Remove some old types
client/mysql.cc:
Simplify types
client/mysql_upgrade.c:
Remove some old types
Update call to dirname_part
client/mysqladmin.cc:
Remove some old types
client/mysqlbinlog.cc:
Remove some old types
Change some buffers to be uchar to avoid casts
client/mysqlcheck.c:
Remove some old types
client/mysqldump.c:
Remove some old types
Remove some not needed casts
Change some string lengths to size_t
client/mysqlimport.c:
Remove some old types
client/mysqlshow.c:
Remove some old types
client/mysqlslap.c:
Remove some old types
Remove some not needed casts
client/mysqltest.c:
Removed some old types
Removed some not needed casts
Updated hash-get-key function arguments
Updated parameters to dirname_part()
client/readline.cc:
Removed some old types
Removed some not needed casts
Changed some string lengths to use size_t
client/sql_string.cc:
Removed some old types
dbug/dbug.c:
Removed some old types
Changed some string lengths to use size_t
Changed some prototypes to avoid casts
extra/comp_err.c:
Removed some old types
extra/innochecksum.c:
Removed some old types
extra/my_print_defaults.c:
Removed some old types
extra/mysql_waitpid.c:
Removed some old types
extra/perror.c:
Removed some old types
extra/replace.c:
Removed some old types
Updated parameters to dirname_part()
extra/resolve_stack_dump.c:
Removed some old types
extra/resolveip.c:
Removed some old types
include/config-win.h:
Removed some old types
include/decimal.h:
Changed binary strings to be uchar* instead of char*
include/ft_global.h:
Removed some old types
include/hash.h:
Removed some old types
include/heap.h:
Removed some old types
Changed records_under_level to be 'ulong' instead of 'uint' to clarify usage of variable
include/keycache.h:
Removed some old types
include/m_ctype.h:
Removed some old types
Changed some string lengths to use size_t
Changed character length functions to return uint
unsigned char -> uchar
include/m_string.h:
Removed some old types
Changed some string lengths to use size_t
include/my_alloc.h:
Changed some string lengths to use size_t
include/my_base.h:
Removed some old types
include/my_dbug.h:
Removed some old types
Changed some string lengths to use size_t
Changed db_dump() to take uchar * as argument for memory to reduce number of casts in usage
include/my_getopt.h:
Removed some old types
include/my_global.h:
Removed old types:
my_size_t -> size_t
byte -> uchar
gptr -> uchar *
include/my_list.h:
Removed some old types
include/my_nosys.h:
Removed some old types
include/my_pthread.h:
Removed some old types
include/my_sys.h:
Removed some old types
Changed MY_FILE_ERROR to be in line with new definitions of my_write()/my_read()
Changed some string lengths to use size_t
my_malloc() / my_free() now uses void *
Updated parameters to dirname_part() & my_uncompress()
include/my_tree.h:
Removed some old types
include/my_trie.h:
Removed some old types
include/my_user.h:
Changed some string lengths to use size_t
include/my_vle.h:
Removed some old types
include/my_xml.h:
Removed some old types
Changed some string lengths to use size_t
include/myisam.h:
Removed some old types
include/myisammrg.h:
Removed some old types
include/mysql.h:
Removed some old types
Changed byte streams to use uchar* instead of char*
include/mysql_com.h:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
include/queues.h:
Removed some old types
include/sql_common.h:
Removed some old types
include/sslopt-longopts.h:
Removed some old types
include/violite.h:
Removed some old types
Changed some string lengths to use size_t
libmysql/client_settings.h:
Removed some old types
libmysql/libmysql.c:
Removed some old types
libmysql/manager.c:
Removed some old types
libmysqld/emb_qcache.cc:
Removed some old types
libmysqld/emb_qcache.h:
Removed some old types
libmysqld/lib_sql.cc:
Removed some old types
Removed some not needed casts
Changed some buffers to be uchar* to avoid casts
true -> TRUE, false -> FALSE
mysys/array.c:
Removed some old types
mysys/charset.c:
Changed some string lengths to use size_t
mysys/checksum.c:
Include zlib to get definition for crc32
Removed some old types
mysys/default.c:
Removed some old types
Changed some string lengths to use size_t
mysys/default_modify.c:
Changed some string lengths to use size_t
Removed some not needed casts
mysys/hash.c:
Removed some old types
Changed some string lengths to use size_t
Note: Prototype of hash_key() has changed which may cause problems if client uses hash_init() with a cast for the hash-get-key function.
hash_element now takes 'ulong' as the index type (cleanup)
mysys/list.c:
Removed some old types
mysys/mf_cache.c:
Changed some string lengths to use size_t
mysys/mf_dirname.c:
Removed some old types
Changed some string lengths to use size_t
Added argument to dirname_part() to avoid calculation of length for 'to'
mysys/mf_fn_ext.c:
Removed some old types
Updated parameters to dirname_part()
mysys/mf_format.c:
Removed some old types
Changed some string lengths to use size_t
mysys/mf_getdate.c:
Removed some old types
mysys/mf_iocache.c:
Removed some old types
Changed some string lengths to use size_t
Changed calculation of 'max_length' to be done the same way in all functions
mysys/mf_iocache2.c:
Removed some old types
Changed some string lengths to use size_t
Clean up comments
Removed not needed indentation
mysys/mf_keycache.c:
Removed some old types
mysys/mf_keycaches.c:
Removed some old types
mysys/mf_loadpath.c:
Removed some old types
mysys/mf_pack.c:
Removed some old types
Changed some string lengths to use size_t
Removed some not needed casts
Removed very old VMS code
Updated parameters to dirname_part()
Use result of dirnam_part() to remove call to strcat()
mysys/mf_path.c:
Removed some old types
mysys/mf_radix.c:
Removed some old types
mysys/mf_same.c:
Removed some old types
mysys/mf_sort.c:
Removed some old types
mysys/mf_soundex.c:
Removed some old types
mysys/mf_strip.c:
Removed some old types
mysys/mf_tempdir.c:
Removed some old types
mysys/mf_unixpath.c:
Removed some old types
mysys/mf_wfile.c:
Removed some old types
mysys/mulalloc.c:
Removed some old types
mysys/my_alloc.c:
Removed some old types
Changed some string lengths to use size_t
Use void* as type for allocated memory area
Removed some not needed casts
Changed argument 'Size' to 'length' according coding guidelines
mysys/my_chsize.c:
Changed some buffers to be uchar* to avoid casts
mysys/my_compress.c:
More comments
Removed some old types
Changed string lengths to use size_t
Changed arguments to my_uncompress() to make them easier to understand
Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix)
Changed type of 'pack_data' argument to packfrm() to avoid casts.
mysys/my_conio.c:
Changed some string lengths to use size_t
mysys/my_create.c:
Removed some old types
mysys/my_div.c:
Removed some old types
mysys/my_error.c:
Removed some old types
mysys/my_fopen.c:
Removed some old types
mysys/my_fstream.c:
Removed some old types
Changed some string lengths to use size_t
writen -> written
mysys/my_getopt.c:
Removed some old types
mysys/my_getwd.c:
Removed some old types
More comments
mysys/my_init.c:
Removed some old types
mysys/my_largepage.c:
Removed some old types
Changed some string lengths to use size_t
mysys/my_lib.c:
Removed some old types
mysys/my_lockmem.c:
Removed some old types
mysys/my_malloc.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed all functions to use size_t
mysys/my_memmem.c:
Indentation cleanup
mysys/my_once.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
mysys/my_open.c:
Removed some old types
mysys/my_pread.c:
Removed some old types
Changed all functions to use size_t
Added comment for how my_pread() / my_pwrite() are supposed to work.
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.
(If we ever would really need this, it should be enabled only with a flag argument)
mysys/my_quick.c:
Removed some old types
Changed all functions to use size_t
mysys/my_read.c:
Removed some old types
Changed all functions to use size_t
mysys/my_realloc.c:
Removed some old types
Use void* as type for allocated memory area
Changed all functions to use size_t
mysys/my_static.c:
Removed some old types
mysys/my_static.h:
Removed some old types
mysys/my_vle.c:
Removed some old types
mysys/my_wincond.c:
Removed some old types
mysys/my_windac.c:
Removed some old types
mysys/my_write.c:
Removed some old types
Changed all functions to use size_t
mysys/ptr_cmp.c:
Removed some old types
Changed all functions to use size_t
mysys/queues.c:
Removed some old types
mysys/safemalloc.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed all functions to use size_t
mysys/string.c:
Removed some old types
Changed all functions to use size_t
mysys/testhash.c:
Removed some old types
mysys/thr_alarm.c:
Removed some old types
mysys/thr_lock.c:
Removed some old types
mysys/tree.c:
Removed some old types
mysys/trie.c:
Removed some old types
mysys/typelib.c:
Removed some old types
plugin/daemon_example/daemon_example.cc:
Removed some old types
regex/reginit.c:
Removed some old types
server-tools/instance-manager/buffer.cc:
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/buffer.h:
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/commands.cc:
Removed some old types
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/instance_map.cc:
Removed some old types
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/instance_options.cc:
Changed buffer to be of type uchar*
Replaced alloc_root + strcpy() with strdup_root()
server-tools/instance-manager/mysql_connection.cc:
Changed buffer to be of type uchar*
server-tools/instance-manager/options.cc:
Removed some old types
server-tools/instance-manager/parse.cc:
Changed some string lengths to use size_t
server-tools/instance-manager/parse.h:
Removed some old types
Changed some string lengths to use size_t
server-tools/instance-manager/protocol.cc:
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
server-tools/instance-manager/protocol.h:
Changed some string lengths to use size_t
server-tools/instance-manager/user_map.cc:
Removed some old types
Changed some string lengths to use size_t
sql/derror.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/discover.cc:
Changed in readfrm() and writefrom() the type for argument 'frmdata' to uchar** to avoid casts
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
sql/event_data_objects.cc:
Removed some old types
Added missing casts for alloc() and sprintf()
sql/event_db_repository.cc:
Changed some buffers to be uchar* to avoid casts
Added missing casts for sprintf()
sql/event_queue.cc:
Removed some old types
sql/field.cc:
Removed some old types
Changed memory buffers to be uchar*
Changed some string lengths to use size_t
Removed a lot of casts
Safety fix in Field_blob::val_decimal() to not access zero pointer
sql/field.h:
Removed some old types
Changed memory buffers to be uchar* (except of store() as this would have caused too many other changes).
Changed some string lengths to use size_t
Removed some not needed casts
Changed val_xxx(xxx, new_ptr) to take const pointers
sql/field_conv.cc:
Removed some old types
Added casts required because memory area pointers are now uchar*
sql/filesort.cc:
Initalize variable that was used unitialized in error conditions
sql/gen_lex_hash.cc:
Removed some old types
Changed memory buffers to be uchar*
Changed some string lengths to use size_t
Removed a lot of casts
Safety fix in Field_blob::val_decimal() to not access zero pointer
sql/gstream.h:
Added required cast
sql/ha_ndbcluster.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
Added required casts
Removed some not needed casts
sql/ha_ndbcluster.h:
Removed some old types
sql/ha_ndbcluster_binlog.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Replaced sql_alloc() + memcpy() + set end 0 with sql_strmake()
Changed some string lengths to use size_t
Added missing casts for alloc() and sprintf()
sql/ha_ndbcluster_binlog.h:
Removed some old types
sql/ha_ndbcluster_cond.cc:
Removed some old types
Removed some not needed casts
sql/ha_ndbcluster_cond.h:
Removed some old types
sql/ha_partition.cc:
Removed some old types
Changed prototype for change_partition() to avoid casts
sql/ha_partition.h:
Removed some old types
sql/handler.cc:
Removed some old types
Changed some string lengths to use size_t
sql/handler.h:
Removed some old types
Changed some string lengths to use size_t
Changed type for 'frmblob' parameter for discover() and ha_discover() to get fewer casts
sql/hash_filo.h:
Removed some old types
Changed all functions to use size_t
sql/hostname.cc:
Removed some old types
sql/item.cc:
Removed some old types
Changed some string lengths to use size_t
Use strmake() instead of memdup() to create a null terminated string.
Updated calls to new Field()
sql/item.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed some buffers to be uchar* to avoid casts
sql/item_cmpfunc.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/item_cmpfunc.h:
Removed some old types
sql/item_create.cc:
Removed some old types
sql/item_func.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added test for failing alloc() in init_result_field()
Remove old confusing comment
Fixed compiler warning
sql/item_func.h:
Removed some old types
sql/item_row.cc:
Removed some old types
sql/item_row.h:
Removed some old types
sql/item_strfunc.cc:
Include zlib (needed becasue we call crc32)
Removed some old types
sql/item_strfunc.h:
Removed some old types
Changed some types to match new function prototypes
sql/item_subselect.cc:
Removed some old types
sql/item_subselect.h:
Removed some old types
sql/item_sum.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/item_sum.h:
Removed some old types
sql/item_timefunc.cc:
Removed some old types
Changed some string lengths to use size_t
sql/item_timefunc.h:
Removed some old types
sql/item_xmlfunc.cc:
Changed some string lengths to use size_t
sql/item_xmlfunc.h:
Removed some old types
sql/key.cc:
Removed some old types
Removed some not needed casts
sql/lock.cc:
Removed some old types
Added some cast to my_multi_malloc() arguments for safety
sql/log.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Changed usage of pwrite() to not assume it holds the cursor position for the file
Made usage of my_read() safer
sql/log_event.cc:
Removed some old types
Added checking of return value of malloc() in pack_info()
Changed some buffers to be uchar* to avoid casts
Removed some 'const' to avoid casts
Added missing casts for alloc() and sprintf()
Added required casts
Removed some not needed casts
Added some cast to my_multi_malloc() arguments for safety
sql/log_event.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/log_event_old.cc:
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/log_event_old.h:
Changed some buffers to be uchar* to avoid casts
sql/mf_iocache.cc:
Removed some old types
sql/my_decimal.cc:
Changed memory area to use uchar*
sql/my_decimal.h:
Changed memory area to use uchar*
sql/mysql_priv.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed some string lengths to use size_t
Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid long overflow
Changed some buffers to be uchar* to avoid casts
sql/mysqld.cc:
Removed some old types
sql/net_serv.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Ensure that vio_read()/vio_write() return values are stored in a size_t variable
Removed some not needed casts
sql/opt_range.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/opt_range.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/opt_sum.cc:
Removed some old types
Removed some not needed casts
sql/parse_file.cc:
Removed some old types
Changed some string lengths to use size_t
Changed alloc_root + memcpy + set end 0 -> strmake_root()
sql/parse_file.h:
Removed some old types
sql/partition_info.cc:
Removed some old types
Added missing casts for alloc()
Changed some buffers to be uchar* to avoid casts
sql/partition_info.h:
Changed some buffers to be uchar* to avoid casts
sql/protocol.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/protocol.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/records.cc:
Removed some old types
sql/repl_failsafe.cc:
Removed some old types
Changed some string lengths to use size_t
Added required casts
sql/rpl_filter.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some string lengths to use size_t
sql/rpl_filter.h:
Changed some string lengths to use size_t
sql/rpl_injector.h:
Removed some old types
sql/rpl_record.cc:
Removed some old types
Removed some not needed casts
Changed some buffers to be uchar* to avoid casts
sql/rpl_record.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/rpl_record_old.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/rpl_record_old.h:
Removed some old types
Changed some buffers to be uchar* to avoid cast
sql/rpl_rli.cc:
Removed some old types
sql/rpl_tblmap.cc:
Removed some old types
sql/rpl_tblmap.h:
Removed some old types
sql/rpl_utility.cc:
Removed some old types
sql/rpl_utility.h:
Removed some old types
Changed type of 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
sql/set_var.cc:
Removed some old types
Updated parameters to dirname_part()
sql/set_var.h:
Removed some old types
sql/slave.cc:
Removed some old types
Changed some string lengths to use size_t
sql/slave.h:
Removed some old types
sql/sp.cc:
Removed some old types
Added missing casts for printf()
sql/sp.h:
Removed some old types
Updated hash-get-key function arguments
sql/sp_cache.cc:
Removed some old types
Added missing casts for printf()
Updated hash-get-key function arguments
sql/sp_head.cc:
Removed some old types
Added missing casts for alloc() and printf()
Added required casts
Updated hash-get-key function arguments
sql/sp_head.h:
Removed some old types
sql/sp_pcontext.cc:
Removed some old types
sql/sp_pcontext.h:
Removed some old types
sql/sql_acl.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added required casts
sql/sql_analyse.cc:
Changed some buffers to be uchar* to avoid casts
sql/sql_analyse.h:
Changed some buffers to be uchar* to avoid casts
sql/sql_array.h:
Removed some old types
sql/sql_base.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_binlog.cc:
Removed some old types
Added missing casts for printf()
sql/sql_cache.cc:
Removed some old types
Updated hash-get-key function arguments
Removed some not needed casts
Changed some string lengths to use size_t
sql/sql_cache.h:
Removed some old types
Removed reference to not existing function cache_key()
Updated hash-get-key function arguments
sql/sql_class.cc:
Removed some old types
Updated hash-get-key function arguments
Added missing casts for alloc()
Updated hash-get-key function arguments
Moved THD::max_row_length() to table.cc (as it's not depending on THD)
Removed some not needed casts
sql/sql_class.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Removed some not needed casts
Changed some string lengths to use size_t
Moved max_row_length and max_row_length_blob() to table.cc, as they are not depending on THD
sql/sql_connect.cc:
Removed some old types
Added required casts
sql/sql_db.cc:
Removed some old types
Removed some not needed casts
Added some cast to my_multi_malloc() arguments for safety
Added missing casts for alloc()
sql/sql_delete.cc:
Removed some old types
sql/sql_handler.cc:
Removed some old types
Updated hash-get-key function arguments
Added some cast to my_multi_malloc() arguments for safety
sql/sql_help.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_insert.cc:
Removed some old types
Added missing casts for alloc() and printf()
sql/sql_lex.cc:
Removed some old types
sql/sql_lex.h:
Removed some old types
Removed some not needed casts
sql/sql_list.h:
Removed some old types
Removed some not needed casts
sql/sql_load.cc:
Removed some old types
Removed compiler warning
sql/sql_manager.cc:
Removed some old types
sql/sql_map.cc:
Removed some old types
sql/sql_map.h:
Removed some old types
sql/sql_olap.cc:
Removed some old types
sql/sql_parse.cc:
Removed some old types
Trivial move of code lines to make things more readable
Changed some string lengths to use size_t
Added missing casts for alloc()
sql/sql_partition.cc:
Removed some old types
Removed compiler warnings about not used functions
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_partition.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/sql_plugin.cc:
Removed some old types
Added missing casts for alloc()
Updated hash-get-key function arguments
sql/sql_prepare.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Added missing casts for alloc() and printf()
sql-common/client.c:
Removed some old types
Changed some memory areas to use uchar*
sql-common/my_user.c:
Changed some string lengths to use size_t
sql-common/pack.c:
Changed some buffers to be uchar* to avoid casts
sql/sql_repl.cc:
Added required casts
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/sql_select.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some old types
sql/sql_select.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/sql_servers.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_show.cc:
Removed some old types
Added missing casts for alloc()
Removed some not needed casts
sql/sql_string.cc:
Removed some old types
Added required casts
sql/sql_table.cc:
Removed some old types
Removed compiler warning about not used variable
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_test.cc:
Removed some old types
sql/sql_trigger.cc:
Removed some old types
Added missing casts for alloc()
sql/sql_udf.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_union.cc:
Removed some old types
sql/sql_update.cc:
Removed some old types
Removed some not needed casts
sql/sql_view.cc:
Removed some old types
sql/sql_yacc.yy:
Removed some old types
Changed some string lengths to use size_t
Added missing casts for alloc()
sql/stacktrace.c:
Removed some old types
sql/stacktrace.h:
Removed some old types
sql/structs.h:
Removed some old types
sql/table.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
Removed setting of LEX_STRING() arguments in declaration
Added required casts
More function comments
Moved max_row_length() here from sql_class.cc/sql_class.h
sql/table.h:
Removed some old types
Changed some string lengths to use size_t
sql/thr_malloc.cc:
Use void* as type for allocated memory area
Changed all functions to use size_t
sql/tzfile.h:
Changed some buffers to be uchar* to avoid casts
sql/tztime.cc:
Changed some buffers to be uchar* to avoid casts
Updated hash-get-key function arguments
Added missing casts for alloc()
Removed some not needed casts
sql/uniques.cc:
Removed some old types
Removed some not needed casts
sql/unireg.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added missing casts for alloc()
storage/archive/archive_reader.c:
Removed some old types
storage/archive/azio.c:
Removed some old types
Removed some not needed casts
storage/archive/ha_archive.cc:
Removed some old types
Changed type for 'frmblob' in archive_discover() to match handler
Updated hash-get-key function arguments
Removed some not needed casts
storage/archive/ha_archive.h:
Removed some old types
storage/blackhole/ha_blackhole.cc:
Removed some old types
storage/blackhole/ha_blackhole.h:
Removed some old types
storage/csv/ha_tina.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
storage/csv/ha_tina.h:
Removed some old types
Removed some not needed casts
storage/csv/transparent_file.cc:
Removed some old types
Changed type of 'bytes_read' to be able to detect read errors
Fixed indentation
storage/csv/transparent_file.h:
Removed some old types
storage/example/ha_example.cc:
Removed some old types
Updated hash-get-key function arguments
storage/example/ha_example.h:
Removed some old types
storage/federated/ha_federated.cc:
Removed some old types
Updated hash-get-key function arguments
Removed some not needed casts
storage/federated/ha_federated.h:
Removed some old types
storage/heap/_check.c:
Changed some buffers to be uchar* to avoid casts
storage/heap/_rectest.c:
Removed some old types
storage/heap/ha_heap.cc:
Removed some old types
storage/heap/ha_heap.h:
Removed some old types
storage/heap/heapdef.h:
Removed some old types
storage/heap/hp_block.c:
Removed some old types
Changed some string lengths to use size_t
storage/heap/hp_clear.c:
Removed some old types
storage/heap/hp_close.c:
Removed some old types
storage/heap/hp_create.c:
Removed some old types
storage/heap/hp_delete.c:
Removed some old types
storage/heap/hp_hash.c:
Removed some old types
storage/heap/hp_info.c:
Removed some old types
storage/heap/hp_open.c:
Removed some old types
storage/heap/hp_rfirst.c:
Removed some old types
storage/heap/hp_rkey.c:
Removed some old types
storage/heap/hp_rlast.c:
Removed some old types
storage/heap/hp_rnext.c:
Removed some old types
storage/heap/hp_rprev.c:
Removed some old types
storage/heap/hp_rrnd.c:
Removed some old types
storage/heap/hp_rsame.c:
Removed some old types
storage/heap/hp_scan.c:
Removed some old types
storage/heap/hp_test1.c:
Removed some old types
storage/heap/hp_test2.c:
Removed some old types
storage/heap/hp_update.c:
Removed some old types
storage/heap/hp_write.c:
Removed some old types
Changed some string lengths to use size_t
storage/innobase/handler/ha_innodb.cc:
Removed some old types
Updated hash-get-key function arguments
Added missing casts for alloc() and printf()
Removed some not needed casts
storage/innobase/handler/ha_innodb.h:
Removed some old types
storage/myisam/ft_boolean_search.c:
Removed some old types
storage/myisam/ft_nlq_search.c:
Removed some old types
storage/myisam/ft_parser.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/ft_static.c:
Removed some old types
storage/myisam/ft_stopwords.c:
Removed some old types
storage/myisam/ft_update.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/ftdefs.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/fulltext.h:
Removed some old types
storage/myisam/ha_myisam.cc:
Removed some old types
storage/myisam/ha_myisam.h:
Removed some old types
storage/myisam/mi_cache.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/mi_check.c:
Removed some old types
storage/myisam/mi_checksum.c:
Removed some old types
storage/myisam/mi_close.c:
Removed some old types
storage/myisam/mi_create.c:
Removed some old types
storage/myisam/mi_delete.c:
Removed some old types
storage/myisam/mi_delete_all.c:
Removed some old types
storage/myisam/mi_dynrec.c:
Removed some old types
storage/myisam/mi_extra.c:
Removed some old types
storage/myisam/mi_key.c:
Removed some old types
storage/myisam/mi_locking.c:
Removed some old types
storage/myisam/mi_log.c:
Removed some old types
storage/myisam/mi_open.c:
Removed some old types
Removed some not needed casts
Check argument of my_write()/my_pwrite() in functions returning int
Added casting of string lengths to size_t
storage/myisam/mi_packrec.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/mi_page.c:
Removed some old types
storage/myisam/mi_preload.c:
Removed some old types
storage/myisam/mi_range.c:
Removed some old types
storage/myisam/mi_rfirst.c:
Removed some old types
storage/myisam/mi_rkey.c:
Removed some old types
storage/myisam/mi_rlast.c:
Removed some old types
storage/myisam/mi_rnext.c:
Removed some old types
storage/myisam/mi_rnext_same.c:
Removed some old types
storage/myisam/mi_rprev.c:
Removed some old types
storage/myisam/mi_rrnd.c:
Removed some old types
storage/myisam/mi_rsame.c:
Removed some old types
storage/myisam/mi_rsamepos.c:
Removed some old types
storage/myisam/mi_scan.c:
Removed some old types
storage/myisam/mi_search.c:
Removed some old types
storage/myisam/mi_static.c:
Removed some old types
storage/myisam/mi_statrec.c:
Removed some old types
storage/myisam/mi_test1.c:
Removed some old types
storage/myisam/mi_test2.c:
Removed some old types
storage/myisam/mi_test3.c:
Removed some old types
storage/myisam/mi_unique.c:
Removed some old types
storage/myisam/mi_update.c:
Removed some old types
storage/myisam/mi_write.c:
Removed some old types
storage/myisam/myisam_ftdump.c:
Removed some old types
storage/myisam/myisamchk.c:
Removed some old types
storage/myisam/myisamdef.h:
Removed some old types
storage/myisam/myisamlog.c:
Removed some old types
Indentation fix
storage/myisam/myisampack.c:
Removed some old types
storage/myisam/rt_index.c:
Removed some old types
storage/myisam/rt_split.c:
Removed some old types
storage/myisam/sort.c:
Removed some old types
storage/myisam/sp_defs.h:
Removed some old types
storage/myisam/sp_key.c:
Removed some old types
storage/myisammrg/ha_myisammrg.cc:
Removed some old types
storage/myisammrg/ha_myisammrg.h:
Removed some old types
storage/myisammrg/myrg_close.c:
Removed some old types
storage/myisammrg/myrg_def.h:
Removed some old types
storage/myisammrg/myrg_delete.c:
Removed some old types
storage/myisammrg/myrg_open.c:
Removed some old types
Updated parameters to dirname_part()
storage/myisammrg/myrg_queue.c:
Removed some old types
storage/myisammrg/myrg_rfirst.c:
Removed some old types
storage/myisammrg/myrg_rkey.c:
Removed some old types
storage/myisammrg/myrg_rlast.c:
Removed some old types
storage/myisammrg/myrg_rnext.c:
Removed some old types
storage/myisammrg/myrg_rnext_same.c:
Removed some old types
storage/myisammrg/myrg_rprev.c:
Removed some old types
storage/myisammrg/myrg_rrnd.c:
Removed some old types
storage/myisammrg/myrg_rsame.c:
Removed some old types
storage/myisammrg/myrg_update.c:
Removed some old types
storage/myisammrg/myrg_write.c:
Removed some old types
storage/ndb/include/util/ndb_opts.h:
Removed some old types
storage/ndb/src/cw/cpcd/main.cpp:
Removed some old types
storage/ndb/src/kernel/vm/Configuration.cpp:
Removed some old types
storage/ndb/src/mgmclient/main.cpp:
Removed some old types
storage/ndb/src/mgmsrv/InitConfigFileParser.cpp:
Removed some old types
Removed old disabled code
storage/ndb/src/mgmsrv/main.cpp:
Removed some old types
storage/ndb/src/ndbapi/NdbBlob.cpp:
Removed some old types
storage/ndb/src/ndbapi/NdbOperationDefine.cpp:
Removed not used variable
storage/ndb/src/ndbapi/NdbOperationInt.cpp:
Added required casts
storage/ndb/src/ndbapi/NdbScanOperation.cpp:
Added required casts
storage/ndb/tools/delete_all.cpp:
Removed some old types
storage/ndb/tools/desc.cpp:
Removed some old types
storage/ndb/tools/drop_index.cpp:
Removed some old types
storage/ndb/tools/drop_tab.cpp:
Removed some old types
storage/ndb/tools/listTables.cpp:
Removed some old types
storage/ndb/tools/ndb_config.cpp:
Removed some old types
storage/ndb/tools/restore/consumer_restore.cpp:
Changed some buffers to be uchar* to avoid casts with new defintion of packfrm()
storage/ndb/tools/restore/restore_main.cpp:
Removed some old types
storage/ndb/tools/select_all.cpp:
Removed some old types
storage/ndb/tools/select_count.cpp:
Removed some old types
storage/ndb/tools/waiter.cpp:
Removed some old types
strings/bchange.c:
Changed function to use uchar * and size_t
strings/bcmp.c:
Changed function to use uchar * and size_t
strings/bmove512.c:
Changed function to use uchar * and size_t
strings/bmove_upp.c:
Changed function to use uchar * and size_t
strings/ctype-big5.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-bin.c:
Changed functions to use size_t
strings/ctype-cp932.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-czech.c:
Fixed indentation
Changed functions to use size_t
strings/ctype-euc_kr.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-eucjpms.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-gb2312.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-gbk.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-latin1.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-mb.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-simple.c:
Changed functions to use size_t
Simpler loops for caseup/casedown
unsigned int -> uint
unsigned char -> uchar
strings/ctype-sjis.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-tis620.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-uca.c:
Changed functions to use size_t
unsigned char -> uchar
strings/ctype-ucs2.c:
Moved inclusion of stdarg.h to other includes
usigned char -> uchar
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-ujis.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-utf8.c:
Changed functions to use size_t
unsigned char -> uchar
Indentation fixes
strings/ctype-win1250ch.c:
Indentation fixes
Changed functions to use size_t
strings/ctype.c:
Changed functions to use size_t
strings/decimal.c:
Changed type for memory argument to uchar *
strings/do_ctype.c:
Indentation fixes
strings/my_strtoll10.c:
unsigned char -> uchar
strings/my_vsnprintf.c:
Changed functions to use size_t
strings/r_strinstr.c:
Removed some old types
Changed functions to use size_t
strings/str_test.c:
Removed some old types
strings/strappend.c:
Changed functions to use size_t
strings/strcont.c:
Removed some old types
strings/strfill.c:
Removed some old types
strings/strinstr.c:
Changed functions to use size_t
strings/strlen.c:
Changed functions to use size_t
strings/strmake.c:
Changed functions to use size_t
strings/strnlen.c:
Changed functions to use size_t
strings/strnmov.c:
Changed functions to use size_t
strings/strto.c:
unsigned char -> uchar
strings/strtod.c:
Changed functions to use size_t
strings/strxnmov.c:
Changed functions to use size_t
strings/xml.c:
Changed functions to use size_t
Indentation fixes
tests/mysql_client_test.c:
Removed some old types
tests/thread_test.c:
Removed some old types
vio/test-ssl.c:
Removed some old types
vio/test-sslclient.c:
Removed some old types
vio/test-sslserver.c:
Removed some old types
vio/vio.c:
Removed some old types
vio/vio_priv.h:
Removed some old types
Changed vio_read()/vio_write() to work with size_t
vio/viosocket.c:
Changed vio_read()/vio_write() to work with size_t
Indentation fixes
vio/viossl.c:
Changed vio_read()/vio_write() to work with size_t
Indentation fixes
vio/viosslfactories.c:
Removed some old types
vio/viotest-ssl.c:
Removed some old types
win/README:
More explanations
2007-05-10 11:59:39 +02:00
|
|
|
int handle_ordered_next(uchar * buf, bool next_same);
|
|
|
|
int handle_ordered_prev(uchar * buf);
|
|
|
|
void return_top_record(uchar * buf);
|
2021-08-05 22:48:02 +02:00
|
|
|
void swap_blobs(uchar* rec_buf, Ordered_blob_storage ** storage, bool restore);
|
2005-07-18 13:31:02 +02:00
|
|
|
public:
|
|
|
|
/*
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
MODULE information calls
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
This calls are used to inform the handler of specifics of the ongoing
|
|
|
|
scans and other actions. Most of these are used for optimisation
|
|
|
|
purposes.
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
int info(uint) override;
|
|
|
|
void get_dynamic_partition_info(PARTITION_STATS *stat_info, uint part_id)
|
|
|
|
override;
|
|
|
|
void set_partitions_to_open(List<String> *partition_names) override;
|
|
|
|
int change_partitions_to_open(List<String> *partition_names) override;
|
2018-02-13 15:06:15 +01:00
|
|
|
int open_read_partitions(char *name_buff, size_t name_buff_size);
|
2020-02-28 13:01:27 +01:00
|
|
|
int extra(enum ha_extra_function operation) override;
|
|
|
|
int extra_opt(enum ha_extra_function operation, ulong arg) override;
|
|
|
|
int reset() override;
|
|
|
|
uint count_query_cache_dependant_tables(uint8 *tables_type) override;
|
|
|
|
my_bool register_query_cache_dependant_tables(THD *thd,
|
|
|
|
Query_cache *cache,
|
|
|
|
Query_cache_block_table **block,
|
|
|
|
uint *n) override;
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
private:
|
2018-06-21 08:46:11 +02:00
|
|
|
typedef int handler_callback(handler *, void *);
|
|
|
|
|
2012-07-13 21:17:32 +02:00
|
|
|
my_bool reg_query_cache_dependant_table(THD *thd,
|
2013-07-03 21:50:34 +02:00
|
|
|
char *engine_key,
|
|
|
|
uint engine_key_len,
|
|
|
|
char *query_key, uint query_key_len,
|
|
|
|
uint8 type,
|
2012-07-13 21:17:32 +02:00
|
|
|
Query_cache *cache,
|
|
|
|
Query_cache_block_table
|
|
|
|
**block_table,
|
|
|
|
handler *file, uint *n);
|
2017-12-02 20:50:08 +01:00
|
|
|
static const uint NO_CURRENT_PART_ID= NOT_A_PARTITION_ID;
|
2018-06-21 08:46:11 +02:00
|
|
|
int loop_partitions(handler_callback callback, void *param);
|
2013-06-27 13:01:03 +02:00
|
|
|
int loop_extra_alter(enum ha_extra_function operations);
|
2005-07-18 13:31:02 +02:00
|
|
|
void late_extra_cache(uint partition_id);
|
|
|
|
void late_extra_no_cache(uint partition_id);
|
|
|
|
void prepare_extra_cache(uint cachesize);
|
2018-02-13 15:06:15 +01:00
|
|
|
handler *get_open_file_sample() const { return m_file_sample; }
|
2005-07-18 13:31:02 +02:00
|
|
|
public:
|
|
|
|
|
|
|
|
/*
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
MODULE optimiser support
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
NOTE !!!!!!
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
One important part of the public handler interface that is not depicted in
|
|
|
|
the methods is the attribute records
|
|
|
|
|
|
|
|
which is defined in the base class. This is looked upon directly and is
|
|
|
|
set by calling info(HA_STATUS_INFO) ?
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2009-11-17 20:02:16 +01:00
|
|
|
private:
|
2012-02-22 23:13:36 +01:00
|
|
|
/* Helper functions for optimizer hints. */
|
|
|
|
ha_rows min_rows_for_estimate();
|
|
|
|
uint get_biggest_used_partition(uint *part_index);
|
2009-11-17 20:02:16 +01:00
|
|
|
public:
|
|
|
|
|
2005-07-18 13:31:02 +02:00
|
|
|
/*
|
|
|
|
keys_to_use_for_scanning can probably be implemented as the
|
|
|
|
intersection of all underlying handlers if mixed handlers are used.
|
|
|
|
This method is used to derive whether an index can be used for
|
|
|
|
index-only scanning when performing an ORDER BY query.
|
|
|
|
Only called from one place in sql_select.cc
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
const key_map *keys_to_use_for_scanning() override;
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
Called in test_quick_select to determine if indexes should be used.
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
double scan_time() override;
|
2005-07-18 13:31:02 +02:00
|
|
|
|
2020-02-28 13:01:27 +01:00
|
|
|
double key_scan_time(uint inx) override;
|
2019-02-03 23:56:12 +01:00
|
|
|
|
2020-02-28 13:01:27 +01:00
|
|
|
double keyread_time(uint inx, uint ranges, ha_rows rows) override;
|
2019-02-03 23:56:12 +01:00
|
|
|
|
2005-07-18 13:31:02 +02:00
|
|
|
/*
|
|
|
|
The next method will never be called if you do not implement indexes.
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
double read_time(uint index, uint ranges, ha_rows rows) override;
|
2005-07-18 13:31:02 +02:00
|
|
|
/*
|
|
|
|
For the given range how many records are estimated to be in this range.
|
|
|
|
Used by optimiser to calculate cost of using a particular index.
|
|
|
|
*/
|
2020-02-27 18:12:27 +01:00
|
|
|
ha_rows records_in_range(uint inx,
|
|
|
|
const key_range * min_key,
|
|
|
|
const key_range * max_key,
|
|
|
|
page_range *pages) override;
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
Upper bound of number records returned in scan is sum of all
|
|
|
|
underlying handlers.
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
ha_rows estimate_rows_upper_bound() override;
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
table_cache_type is implemented by the underlying handler but all
|
|
|
|
underlying handlers must have the same implementation for it to work.
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
uint8 table_cache_type() override;
|
|
|
|
ha_rows records() override;
|
2005-07-18 13:31:02 +02:00
|
|
|
|
2013-06-27 13:01:03 +02:00
|
|
|
/* Calculate hash value for PARTITION BY KEY tables. */
|
2013-07-21 16:39:19 +02:00
|
|
|
static uint32 calculate_key_hash_value(Field **field_array);
|
2013-06-27 13:01:03 +02:00
|
|
|
|
2005-07-18 13:31:02 +02:00
|
|
|
/*
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
MODULE print messages
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
This module contains various methods that returns text messages for
|
|
|
|
table types, index type and error messages.
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
The name of the index type that will be used for display
|
|
|
|
Here we must ensure that all handlers use the same index type
|
|
|
|
for each index created.
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
const char *index_type(uint inx) override;
|
2005-07-18 13:31:02 +02:00
|
|
|
|
2021-03-30 16:06:55 +02:00
|
|
|
/* The name of the table type that will be used for display purposes */
|
|
|
|
const char *real_table_type() const override;
|
2006-03-08 20:06:01 +01:00
|
|
|
/* The name of the row type used for the underlying tables. */
|
2020-02-28 13:01:27 +01:00
|
|
|
enum row_type get_row_type() const override;
|
2006-03-08 20:06:01 +01:00
|
|
|
|
2005-07-18 13:31:02 +02:00
|
|
|
/*
|
|
|
|
Handler specific error messages
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
void print_error(int error, myf errflag) override;
|
|
|
|
bool get_error_message(int error, String * buf) override;
|
2005-07-18 13:31:02 +02:00
|
|
|
/*
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
MODULE handler characteristics
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
This module contains a number of methods defining limitations and
|
|
|
|
characteristics of the handler. The partition handler will calculate
|
|
|
|
this characteristics based on underlying handler characteristics.
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
This is a list of flags that says what the storage engine
|
|
|
|
implements. The current table flags are documented in handler.h
|
|
|
|
The partition handler will support whatever the underlying handlers
|
|
|
|
support except when specifically mentioned below about exceptions
|
|
|
|
to this rule.
|
2008-10-29 21:20:04 +01:00
|
|
|
NOTE: This cannot be cached since it can depend on TRANSACTION ISOLATION
|
|
|
|
LEVEL which is dynamic, see bug#39084.
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
HA_TABLE_SCAN_ON_INDEX:
|
|
|
|
Used to avoid scanning full tables on an index. If this flag is set then
|
|
|
|
the handler always has a primary key (hidden if not defined) and this
|
|
|
|
index is used for scanning rather than a full table scan in all
|
|
|
|
situations.
|
2014-08-21 18:11:46 +02:00
|
|
|
(InnoDB, Federated)
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
HA_REC_NOT_IN_SEQ:
|
|
|
|
This flag is set for handlers that cannot guarantee that the rows are
|
2020-07-14 00:42:47 +02:00
|
|
|
returned according to incremental positions (0, 1, 2, 3...).
|
2005-07-18 13:31:02 +02:00
|
|
|
This also means that rnd_next() should return HA_ERR_RECORD_DELETED
|
|
|
|
if it finds a deleted row.
|
2014-08-21 18:11:46 +02:00
|
|
|
(MyISAM (not fixed length row), HEAP, InnoDB)
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
HA_CAN_GEOMETRY:
|
|
|
|
Can the storage engine handle spatial data.
|
|
|
|
Used to check that no spatial attributes are declared unless
|
|
|
|
the storage engine is capable of handling it.
|
|
|
|
(MyISAM)
|
|
|
|
|
|
|
|
HA_FAST_KEY_READ:
|
|
|
|
Setting this flag indicates that the handler is equally fast in
|
|
|
|
finding a row by key as by position.
|
|
|
|
This flag is used in a very special situation in conjunction with
|
|
|
|
filesort's. For further explanation see intro to init_read_record.
|
2014-08-21 18:11:46 +02:00
|
|
|
(HEAP, InnoDB)
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
HA_NULL_IN_KEY:
|
|
|
|
Is NULL values allowed in indexes.
|
|
|
|
If this is not allowed then it is not possible to use an index on a
|
|
|
|
NULLable field.
|
2014-08-21 18:11:46 +02:00
|
|
|
(HEAP, MyISAM, InnoDB)
|
2005-07-18 13:31:02 +02:00
|
|
|
|
This changeset is largely a handler cleanup changeset (WL#3281), but includes fixes and cleanups that was found necessary while testing the handler changes
Changes that requires code changes in other code of other storage engines.
(Note that all changes are very straightforward and one should find all issues
by compiling a --debug build and fixing all compiler errors and all
asserts in field.cc while running the test suite),
- New optional handler function introduced: reset()
This is called after every DML statement to make it easy for a handler to
statement specific cleanups.
(The only case it's not called is if force the file to be closed)
- handler::extra(HA_EXTRA_RESET) is removed. Code that was there before
should be moved to handler::reset()
- table->read_set contains a bitmap over all columns that are needed
in the query. read_row() and similar functions only needs to read these
columns
- table->write_set contains a bitmap over all columns that will be updated
in the query. write_row() and update_row() only needs to update these
columns.
The above bitmaps should now be up to date in all context
(including ALTER TABLE, filesort()).
The handler is informed of any changes to the bitmap after
fix_fields() by calling the virtual function
handler::column_bitmaps_signal(). If the handler does caching of
these bitmaps (instead of using table->read_set, table->write_set),
it should redo the caching in this code. as the signal() may be sent
several times, it's probably best to set a variable in the signal
and redo the caching on read_row() / write_row() if the variable was
set.
- Removed the read_set and write_set bitmap objects from the handler class
- Removed all column bit handling functions from the handler class.
(Now one instead uses the normal bitmap functions in my_bitmap.c instead
of handler dedicated bitmap functions)
- field->query_id is removed. One should instead instead check
table->read_set and table->write_set if a field is used in the query.
- handler::extra(HA_EXTRA_RETRIVE_ALL_COLS) and
handler::extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY) are removed. One should now
instead use table->read_set to check for which columns to retrieve.
- If a handler needs to call Field->val() or Field->store() on columns
that are not used in the query, one should install a temporary
all-columns-used map while doing so. For this, we provide the following
functions:
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
field->val();
dbug_tmp_restore_column_map(table->read_set, old_map);
and similar for the write map:
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->write_set);
field->val();
dbug_tmp_restore_column_map(table->write_set, old_map);
If this is not done, you will sooner or later hit a DBUG_ASSERT
in the field store() / val() functions.
(For not DBUG binaries, the dbug_tmp_restore_column_map() and
dbug_tmp_restore_column_map() are inline dummy functions and should
be optimized away be the compiler).
- If one needs to temporary set the column map for all binaries (and not
just to avoid the DBUG_ASSERT() in the Field::store() / Field::val()
methods) one should use the functions tmp_use_all_columns() and
tmp_restore_column_map() instead of the above dbug_ variants.
- All 'status' fields in the handler base class (like records,
data_file_length etc) are now stored in a 'stats' struct. This makes
it easier to know what status variables are provided by the base
handler. This requires some trivial variable names in the extra()
function.
- New virtual function handler::records(). This is called to optimize
COUNT(*) if (handler::table_flags() & HA_HAS_RECORDS()) is true.
(stats.records is not supposed to be an exact value. It's only has to
be 'reasonable enough' for the optimizer to be able to choose a good
optimization path).
- Non virtual handler::init() function added for caching of virtual
constants from engine.
- Removed has_transactions() virtual method. Now one should instead return
HA_NO_TRANSACTIONS in table_flags() if the table handler DOES NOT support
transactions.
- The 'xxxx_create_handler()' function now has a MEM_ROOT_root argument
that is to be used with 'new handler_name()' to allocate the handler
in the right area. The xxxx_create_handler() function is also
responsible for any initialization of the object before returning.
For example, one should change:
static handler *myisam_create_handler(TABLE_SHARE *table)
{
return new ha_myisam(table);
}
->
static handler *myisam_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
{
return new (mem_root) ha_myisam(table);
}
- New optional virtual function: use_hidden_primary_key().
This is called in case of an update/delete when
(table_flags() and HA_PRIMARY_KEY_REQUIRED_FOR_DELETE) is defined
but we don't have a primary key. This allows the handler to take precisions
in remembering any hidden primary key to able to update/delete any
found row. The default handler marks all columns to be read.
- handler::table_flags() now returns a ulonglong (to allow for more flags).
- New/changed table_flags()
- HA_HAS_RECORDS Set if ::records() is supported
- HA_NO_TRANSACTIONS Set if engine doesn't support transactions
- HA_PRIMARY_KEY_REQUIRED_FOR_DELETE
Set if we should mark all primary key columns for
read when reading rows as part of a DELETE
statement. If there is no primary key,
all columns are marked for read.
- HA_PARTIAL_COLUMN_READ Set if engine will not read all columns in some
cases (based on table->read_set)
- HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS
Renamed to HA_PRIMARY_KEY_REQUIRED_FOR_POSITION.
- HA_DUPP_POS Renamed to HA_DUPLICATE_POS
- HA_REQUIRES_KEY_COLUMNS_FOR_DELETE
Set this if we should mark ALL key columns for
read when when reading rows as part of a DELETE
statement. In case of an update we will mark
all keys for read for which key part changed
value.
- HA_STATS_RECORDS_IS_EXACT
Set this if stats.records is exact.
(This saves us some extra records() calls
when optimizing COUNT(*))
- Removed table_flags()
- HA_NOT_EXACT_COUNT Now one should instead use HA_HAS_RECORDS if
handler::records() gives an exact count() and
HA_STATS_RECORDS_IS_EXACT if stats.records is exact.
- HA_READ_RND_SAME Removed (no one supported this one)
- Removed not needed functions ha_retrieve_all_cols() and ha_retrieve_all_pk()
- Renamed handler::dupp_pos to handler::dup_pos
- Removed not used variable handler::sortkey
Upper level handler changes:
- ha_reset() now does some overall checks and calls ::reset()
- ha_table_flags() added. This is a cached version of table_flags(). The
cache is updated on engine creation time and updated on open.
MySQL level changes (not obvious from the above):
- DBUG_ASSERT() added to check that column usage matches what is set
in the column usage bit maps. (This found a LOT of bugs in current
column marking code).
- In 5.1 before, all used columns was marked in read_set and only updated
columns was marked in write_set. Now we only mark columns for which we
need a value in read_set.
- Column bitmaps are created in open_binary_frm() and open_table_from_share().
(Before this was in table.cc)
- handler::table_flags() calls are replaced with handler::ha_table_flags()
- For calling field->val() you must have the corresponding bit set in
table->read_set. For calling field->store() you must have the
corresponding bit set in table->write_set. (There are asserts in
all store()/val() functions to catch wrong usage)
- thd->set_query_id is renamed to thd->mark_used_columns and instead
of setting this to an integer value, this has now the values:
MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE
Changed also all variables named 'set_query_id' to mark_used_columns.
- In filesort() we now inform the handler of exactly which columns are needed
doing the sort and choosing the rows.
- The TABLE_SHARE object has a 'all_set' column bitmap one can use
when one needs a column bitmap with all columns set.
(This is used for table->use_all_columns() and other places)
- The TABLE object has 3 column bitmaps:
- def_read_set Default bitmap for columns to be read
- def_write_set Default bitmap for columns to be written
- tmp_set Can be used as a temporary bitmap when needed.
The table object has also two pointer to bitmaps read_set and write_set
that the handler should use to find out which columns are used in which way.
- count() optimization now calls handler::records() instead of using
handler->stats.records (if (table_flags() & HA_HAS_RECORDS) is true).
- Added extra argument to Item::walk() to indicate if we should also
traverse sub queries.
- Added TABLE parameter to cp_buffer_from_ref()
- Don't close tables created with CREATE ... SELECT but keep them in
the table cache. (Faster usage of newly created tables).
New interfaces:
- table->clear_column_bitmaps() to initialize the bitmaps for tables
at start of new statements.
- table->column_bitmaps_set() to set up new column bitmaps and signal
the handler about this.
- table->column_bitmaps_set_no_signal() for some few cases where we need
to setup new column bitmaps but don't signal the handler (as the handler
has already been signaled about these before). Used for the momement
only in opt_range.cc when doing ROR scans.
- table->use_all_columns() to install a bitmap where all columns are marked
as use in the read and the write set.
- table->default_column_bitmaps() to install the normal read and write
column bitmaps, but not signaling the handler about this.
This is mainly used when creating TABLE instances.
- table->mark_columns_needed_for_delete(),
table->mark_columns_needed_for_delete() and
table->mark_columns_needed_for_insert() to allow us to put additional
columns in column usage maps if handler so requires.
(The handler indicates what it neads in handler->table_flags())
- table->prepare_for_position() to allow us to tell handler that it
needs to read primary key parts to be able to store them in
future table->position() calls.
(This replaces the table->file->ha_retrieve_all_pk function)
- table->mark_auto_increment_column() to tell handler are going to update
columns part of any auto_increment key.
- table->mark_columns_used_by_index() to mark all columns that is part of
an index. It will also send extra(HA_EXTRA_KEYREAD) to handler to allow
it to quickly know that it only needs to read colums that are part
of the key. (The handler can also use the column map for detecting this,
but simpler/faster handler can just monitor the extra() call).
- table->mark_columns_used_by_index_no_reset() to in addition to other columns,
also mark all columns that is used by the given key.
- table->restore_column_maps_after_mark_index() to restore to default
column maps after a call to table->mark_columns_used_by_index().
- New item function register_field_in_read_map(), for marking used columns
in table->read_map. Used by filesort() to mark all used columns
- Maintain in TABLE->merge_keys set of all keys that are used in query.
(Simplices some optimization loops)
- Maintain Field->part_of_key_not_clustered which is like Field->part_of_key
but the field in the clustered key is not assumed to be part of all index.
(used in opt_range.cc for faster loops)
- dbug_tmp_use_all_columns(), dbug_tmp_restore_column_map()
tmp_use_all_columns() and tmp_restore_column_map() functions to temporally
mark all columns as usable. The 'dbug_' version is primarily intended
inside a handler when it wants to just call Field:store() & Field::val()
functions, but don't need the column maps set for any other usage.
(ie:: bitmap_is_set() is never called)
- We can't use compare_records() to skip updates for handlers that returns
a partial column set and the read_set doesn't cover all columns in the
write set. The reason for this is that if we have a column marked only for
write we can't in the MySQL level know if the value changed or not.
The reason this worked before was that MySQL marked all to be written
columns as also to be read. The new 'optimal' bitmaps exposed this 'hidden
bug'.
- open_table_from_share() does not anymore setup temporary MEM_ROOT
object as a thread specific variable for the handler. Instead we
send the to-be-used MEMROOT to get_new_handler().
(Simpler, faster code)
Bugs fixed:
- Column marking was not done correctly in a lot of cases.
(ALTER TABLE, when using triggers, auto_increment fields etc)
(Could potentially result in wrong values inserted in table handlers
relying on that the old column maps or field->set_query_id was correct)
Especially when it comes to triggers, there may be cases where the
old code would cause lost/wrong values for NDB and/or InnoDB tables.
- Split thd->options flag OPTION_STATUS_NO_TRANS_UPDATE to two flags:
OPTION_STATUS_NO_TRANS_UPDATE and OPTION_KEEP_LOG.
This allowed me to remove some wrong warnings about:
"Some non-transactional changed tables couldn't be rolled back"
- Fixed handling of INSERT .. SELECT and CREATE ... SELECT that wrongly reset
(thd->options & OPTION_STATUS_NO_TRANS_UPDATE) which caused us to loose
some warnings about
"Some non-transactional changed tables couldn't be rolled back")
- Fixed use of uninitialized memory in ha_ndbcluster.cc::delete_table()
which could cause delete_table to report random failures.
- Fixed core dumps for some tests when running with --debug
- Added missing FN_LIBCHAR in mysql_rm_tmp_tables()
(This has probably caused us to not properly remove temporary files after
crash)
- slow_logs was not properly initialized, which could maybe cause
extra/lost entries in slow log.
- If we get an duplicate row on insert, change column map to read and
write all columns while retrying the operation. This is required by
the definition of REPLACE and also ensures that fields that are only
part of UPDATE are properly handled. This fixed a bug in NDB and
REPLACE where REPLACE wrongly copied some column values from the replaced
row.
- For table handler that doesn't support NULL in keys, we would give an error
when creating a primary key with NULL fields, even after the fields has been
automaticly converted to NOT NULL.
- Creating a primary key on a SPATIAL key, would fail if field was not
declared as NOT NULL.
Cleanups:
- Removed not used condition argument to setup_tables
- Removed not needed item function reset_query_id_processor().
- Field->add_index is removed. Now this is instead maintained in
(field->flags & FIELD_IN_ADD_INDEX)
- Field->fieldnr is removed (use field->field_index instead)
- New argument to filesort() to indicate that it should return a set of
row pointers (not used columns). This allowed me to remove some references
to sql_command in filesort and should also enable us to return column
results in some cases where we couldn't before.
- Changed column bitmap handling in opt_range.cc to be aligned with TABLE
bitmap, which allowed me to use bitmap functions instead of looping over
all fields to create some needed bitmaps. (Faster and smaller code)
- Broke up found too long lines
- Moved some variable declaration at start of function for better code
readability.
- Removed some not used arguments from functions.
(setup_fields(), mysql_prepare_insert_check_table())
- setup_fields() now takes an enum instead of an int for marking columns
usage.
- For internal temporary tables, use handler::write_row(),
handler::delete_row() and handler::update_row() instead of
handler::ha_xxxx() for faster execution.
- Changed some constants to enum's and define's.
- Using separate column read and write sets allows for easier checking
of timestamp field was set by statement.
- Remove calls to free_io_cache() as this is now done automaticly in ha_reset()
- Don't build table->normalized_path as this is now identical to table->path
(after bar's fixes to convert filenames)
- Fixed some missed DBUG_PRINT(.."%lx") to use "0x%lx" to make it easier to
do comparision with the 'convert-dbug-for-diff' tool.
Things left to do in 5.1:
- We wrongly log failed CREATE TABLE ... SELECT in some cases when using
row based logging (as shown by testcase binlog_row_mix_innodb_myisam.result)
Mats has promised to look into this.
- Test that my fix for CREATE TABLE ... SELECT is indeed correct.
(I added several test cases for this, but in this case it's better that
someone else also tests this throughly).
Lars has promosed to do this.
BitKeeper/etc/ignore:
added mysys/test_bitmap
include/base64.h:
Removed my_global.h, as this must be included first in any program
include/heap.h:
Added heap_reset() (Required by new handler interface)
include/my_base.h:
Removed HA_EXTRA_RESET. MySQL will now call ::reset() instead of ::extra(HA_EXTRA_RESET).
HA_EXTRA_RETRIVE_ALL_COLS and HA_EXTRA_RETRIVE_PRIMARY key are deleted as the column bitmaps makes these unnecessary
include/my_bitmap.h:
Remove my_pthread.h (should be included at upper level)
Introduced my_bitmap_map typedef to make it the bitmap handling more like a black box
Added bitmap_is_overlapping(), bitmap_test_and_clear(), bitmap_copy() and bitmap_cmp()
Made bitmap_set_bit(), bitmap_flip_bit(), bitmap_clear_bit() return void
include/myisam.h:
Added mi_reset() (Required by new handler interface)
include/myisammrg.h:
Added myrg_reset() (Required by new handler interface)
include/mysql_com.h:
Added flag FIELD_IN_ADD_INDEX to be able to remove Field->add_index
mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test:
Added testing of CREATE ... SELECT in a mixed environment
(This found some bugs that Mats is going to fix shortly)
mysql-test/install_test_db.sh:
Simplify ldata usage
Added --tmpdir=. option to mysqld bootstrap (Removed some warnings when TMPDIR was wrongly set)
mysql-test/mysql-test-run.pl:
Added --tmpdir=. to bootstrap
mysql-test/mysql-test-run.sh:
Use copy instead of INSTALL_DB for master and slave databases.
(Speeds up startup time a lot!)
Remove snapshot directories at startup (removes some strange warnings)
mysql-test/r/binlog_row_mix_innodb_myisam.result:
Added testing of CREATE ... SELECT in a mixed environment
(This found some bugs that Mats is going to fix shortly)
mysql-test/r/binlog_stm_mix_innodb_myisam.result:
Added testing of CREATE ... SELECT in a mixed environment
mysql-test/r/create.result:
Some extra tests of warnings and number of tables opened by CREATE ... SELECT
mysql-test/r/federated.result:
Drop some left over tables
Added testing of multiple table update and multiple table delete (with and without keys)
mysql-test/r/func_gconcat.result:
Enable some disabled tests (converted them slightly to be predictable)
mysql-test/r/func_time.result:
Added drop of test function
mysql-test/r/innodb_mysql.result:
Added tests for CREATE ... SELECT
mysql-test/r/insert.result:
More tests
Added testing of duplicate columns in insert
mysql-test/r/loaddata.result:
Added testing LOAD DATA ... SET ...
mysql-test/r/multi_update.result:
Test multi updates and deletes using primary key and without
mysql-test/r/ndb_index_unique.result:
Better error message
mysql-test/r/ndb_replace.result:
New correct result after fixing REPLACE handling with NDB
mysql-test/r/rpl_ddl.result:
Now we don't get these (wrong) warnings anymore
mysql-test/r/view_grant.result:
Drop used views
mysql-test/t/create.test:
Some extra tests of warnings and number of tables opened by CREATE ... SELECT
mysql-test/t/federated.test:
Drop some left over tables
Added testing of multiple table update and multiple table delete (with and without keys)
mysql-test/t/func_gconcat.test:
Enable some disabled tests (converted them slightly to be predictable)
mysql-test/t/func_time.test:
Added drop of test function
mysql-test/t/innodb_mysql.test:
Added tests for CREATE ... SELECT
mysql-test/t/insert.test:
More tests
Added testing of duplicate columns in insert
mysql-test/t/loaddata.test:
Added testing LOAD DATA ... SET ...
mysql-test/t/multi_update.test:
Test multi updates and deletes using primary key and without
mysql-test/t/view_grant.test:
Drop used views
mysql-test/valgrind.supp:
Added supression of not needed warnings when printing stack trace
mysys/base64.c:
Include my_global.h first
mysys/my_bitmap.c:
Added bitmap_is_overlapping(), bitmap_test_and_clear() and bitmap_copy()
Changed logic of bitmap handling to be a bit more efficent (Did this together with Mikael Ronström)
Now the 'extra, not used bits' in the bitmap are assumed to have a 'random value' and the bitmap functions are free to change them whenever needed.
Changed how mutex is allocated to make 'bitmap_free()' function simpler.
mysys/thr_lock.c:
Added 0x before thread pointers (for easier comparison of DBUG traces)
sql/event.cc:
Ensure 'use_all_columns()' is used for event tables
Don't print warning that event table is damaged if it doesn't exists.
sql/field.cc:
Added ASSERT_COLUMN_MARKED_FOR_WRITE in all store() methods and ASSERT_COLUMN_MARKED_FOR_READ in all val() methods to catch wrong setting if table->read_set and table->write_set
(Rest of changes are only indentation cleanups)
sql/field.h:
Removed Field->query_id (replaced by table->read_set and table->write_set)
Removed Field->fieldnr (use Field->field_index instead)
Removed Field->add_index (Use Field->flags instead)
Add Field->part_of_key_not_clustered (for usage in opt_range.cc)
sql/filesort.cc:
Added paramater sort_postion to filesort() to force sorting by position instead of storing all fields in the result set.
This allowed me to remove checking of sql_command.
Create a temporary column bitmap for fields that are used by the sorting process.
Use column bitmaps instead of query_id
sql/ha_berkeley.cc:
Update to 'newer' table handler interface
sql/ha_berkeley.h:
Update to 'newer' table handler interface
sql/ha_federated.cc:
Update to 'newer' table handler interface
Only read columns that are needed from remote server.
In case of eq ranges, don't generate two conditions in the WHERE clause
(this can still be optimized, but would require a bigger code change)
Use 'simpler to use' XXXX_LEN' macros
A bit simpler logic in ::write_row() when creating statements.
In update, only include test of fields actually read.
(This greatly simplifies the queries sent by the federated engine)
Similar changes done for delete_row()
sql/ha_federated.h:
Update to 'newer' table handler interface
Changed XXX_LEN macros to use sizeof(...)-1, to simplify usage in ha_federated.cc
Added HA_PRIMARY_KEY_REQUIRED_FOR_DELETE to tell MySQL to read all primary key columns in case of DELETE
sql/ha_heap.cc:
Update to 'newer' table handler interface
sql/ha_heap.h:
Update to 'newer' table handler interface
sql/ha_innodb.cc:
Update to 'newer' table handler interface
- Update innobase_create_handler() to new interface
- Removed HA_NOT_EXACT_COUNT (not needed)
- Renamed HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS to HA_PRIMARY_KEY_REQUIRED_FOR_POSITION.
- Prefixed base status variables with 'stats'
- Use table column bitmaps instead of ha_get_bit_in_read_set()
- Added ::reset(), with code from ::extra(HA_EXTRA_RESET)
- Removed HA_EXTRA_RETRIVE_ALL_COLS and HA_EXTRA_RETRIEVE_PRIMARY_KEY as
the table->read_set and table->write_set bitmaps now are accurate
sql/ha_innodb.h:
Update to 'newer' table handler interface
- table_flags are now ulonglong
- Added reset() method
- Removed not needed ha_retrieve_all_cols() and ha_retrieve_all_pk() columns.
- Made build_template() a class function to be able to easier access class variables
sql/ha_myisam.cc:
Update to 'newer' table handler interface
sql/ha_myisam.h:
Update to 'newer' table handler interface
sql/ha_myisammrg.cc:
Update to 'newer' table handler interface
sql/ha_myisammrg.h:
Update to 'newer' table handler interface
sql/ha_ndbcluster.cc:
Update to 'newer' table handler interface
Fixed use_blob_value() to be accurate
In ::complemented_read() we have to check both the read and write bitmap as the old code did mark all changed columns also in the read map
Correct dumping of field data with DBUG_DUMP
Prefix addresses in DBUG_PRINT with 0x
Fixed usage of not initialized memory
Update to use field->flags & FIELD_IN_ADD_INDEX instead of field->add_index.
sql/ha_ndbcluster.h:
Update to 'newer' table handler interface
sql/ha_ndbcluster_binlog.cc:
Mark usage of all columns in ndbcluster binlog tables
false -> FALSE, true -> TRUE
Use table->s->all_set instead of creating a temporary bitmap.
sql/ha_partition.cc:
Update to 'newer' table handler interface
Added memroot to initialise_partitions() and related functions to get faster memory allocation.
partition_create_handler() is now responsible for initialisation of the partition object
Some trivial optimizations and indentation fixes
Ensure that table_flags() are up to date
Removed documentation for removed HA_EXTRA flags
Fixed 'strange' usage of m_file[i] in new_handlers_from_part_info()that worked in current code 'by chance'
sql/ha_partition.h:
Update to 'newer' table handler interface
sql/handler.cc:
create_xxx handler now takes MEMROOT as an argument to simplify memory allocation.
Much simpler get_new_handler()
(Initialization of the object is now handled by the create method for the engine)
Moved all allocation of bitmap handling to the TABLE object (in table.cc)
Added column_bitmaps_signal() to signal column usage changes.
Changed binlog_log_row() to use the exiusting all_set bitmap in the table object.
Added ha_reset() function to test that the file object is ok at end of statement and call handler::reset()
Added use_hidden_primary_key() to signal handler that we we are going to read and update + delete the row and the handler should thus remember the position for the row
sql/handler.h:
Added HA_NO_TRANSACTIONS, HA_PARTIAL_COLUMN_READ, HA_REQUIRES_KEY_COLUMNS_FOR_DELETE,HA_PRIMARY_KEY_REQUIRED_FOR_DELETE and HA_HAS_RECORDS
Removed HA_NOT_EXACT_COUNT, HA_READ_RND_SAME
HA_DUPP_POS -> HA_DUPLICATE_POS
HA_NOT_EXACT_COUNT replaced by HA_STATS_RECORDS_IS_EXACT, HA_HAS_RECORDS and records()
HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS renamed to HA_PRIMARY_KEY_REQUIRED_FOR_POSITION
Added future row type 'ROW_TYPE_PAGES'
Added MEM_ROOT to handlerton 'create' function
Added ha_statistics, a structure for all status variable in the base handler class.
Moved all status variables in the handler class into a stats structs to improve readability.
ha_table_flags() is now a cached (not virtual) version of table_flags()
reset() doesn't anymore call extra(HA_EXTRA_RESET) but is a function of it's own.
Renamed dupp_ref to dup_ref
Renamed not used handler::sortkey
Moved read_set and write_set to TABLE structure
handler::init() function added for cacheing of virtual constants from engine.
sql/item.cc:
Added register_field_in_read_map() for marking used columns in expression.
This is used by filesort() for creating an optimal column bitmap while retrieving columns for sorting.
Initalize value.cs_info.character_set_client to fix core dump bug with --debug
set_query_id -> mark_used_columns
Mark used columns in read_set OR write_set.
sql/item.h:
Removed reset_query_id_processor() as it's not needed anymore.
Added register_field_in_read_map()
Added extra argument to Item::walk() to indicate if we should also
traverse sub queries.
sql/item_cmpfunc.cc:
Temporary mark used columns to be read/writable
Update Item::walk to new interface
sql/item_cmpfunc.h:
Added extra argument to Item::walk() to indicate if we should also traverse sub queries.
sql/item_func.cc:
Update Item::walk() to new interface
table_flags() -> ha_table_flags()
sql/item_func.h:
Update Item::walk() to new interface
sql/item_row.cc:
Update Item::walk() to new interface
sql/item_row.h:
Update Item::walk() to new interface
sql/item_strfunc.h:
Update Item::walk() to new interface
sql/item_subselect.cc:
Added Item_subselect::walk()
(It was a bug it was missing before. Not sure what kind of bugs this could have caused)
sql/item_subselect.h:
Update Item::walk() to new interface
sql/item_sum.cc:
Update Item::walk() to new interface
Updates for new handler interace
sql/item_sum.h:
Update Item::walk() to new interface
sql/key.cc:
Updates for new handler interace
sql/log.cc:
Mark all columns used for log tables
Split options flag
Ensured that second argument to trans_register_ha is a bool
sql/log_event.cc:
Fixed comments to be withing 79 characters
Use OPTION_KEEP_LOG instead of OPTION_STATUS_NO_TRANS_UPDATE to remove wrong warnings
Updates for new handler interface
Use 0x%lx instead of %p (portability problem)
sql/mysql_priv.h:
Added OPTION_KEEP_LOG to indicate that we should replicate the binlog even on rollback
Removed not used 'conds' argument to setup_tables
sql/mysqld.cc:
Indentation fixes and removed old comment
sql/opt_range.cc:
Update to new handler and bitmap interface.
Fixed calls to cp_buffer_from_ref() and walk() (new argument).
Create new temporary bitmaps for ror scans.
(Needed because of handler changes and to get more accurate column bitmaps than before)
Remove not needed file->ha_reset() call before file->close().
Some trivial optimization and indentation fixes.
Use Field->part_of_key_not_clustered() to check if field is part of a key, instead of looping over all key parts.
Added flag 'in_ror_merged_scan' to allow ::get_next() to know that we need a special column bitmap to only fetch pointer to record.
This is needed because ror scan uses the same TABLE object but different file objects, which creates problem for the column bitmap handling.
(This is a temporary solution. A better one would be to allocate an own TABLE object for ROR scans)
Optimized bitmap handling in ror scans:
- Start bitmap at position 0, not 1
- Use same bitmap size as in TABLE
- Use table->read_set and table->write_set to create column bitmaps instead of looping over all fields in table
sql/opt_range.h:
Added 'in_ror_merged_scan' to indicate if we are doing a ROR scan
Added temporary column bitmaps used in ROR scans
sql/opt_sum.cc:
Added get_ext_record_count() which is used in COUNT() optimization if handler has HA_HAS_RECORDS
Note that we don't call this if handler has HA_STATS_RECORDS_IS_EXACT set.
sql/protocol.cc:
We need to mark columns as readable in ::store() as we sometimes return default value for fields to the user
sql/records.cc:
Updates for new handler interface
sql/set_var.cc:
Handle splitting OPTION_STATUS_NO_TRANS_UPDATE to two flags
sql/share/errmsg.txt:
Fixed wrong
sql/sp.cc:
Mark that we are using all columns for the proc table
Update call to setup_tables() to use new prototype
sql/sp_head.cc:
Removed QQ comment
sql/spatial.cc:
Removed wrong QQ comment
sql/sql_acl.cc:
Mark that we need all columns for acl tables
Supply memroot to some 'new' calls.
Indentation fixes
sql/sql_base.cc:
set_query_id removed
Ensure we call ha_reset() at end of each statement
Mark read columns in read_set and changed columns in write_set (Before all columns was marked in read set)
Fixed marking of some columns that was not proplerly marked before
Maintain in TABLE->merge_keys set of all keys that are used in some way
Removed not used 'conds' argument from setup_tables()
Remove not used setting of 'dupp_field' in insert_fields()
Added missing FN_LIBCHAR in mysql_rm_tmp_tables()
(This has probably caused us to not properly remove temporary files after crash)
sql/sql_bitmap.h:
Added is_overlapping()
sql/sql_class.cc:
Slow_logs was not properly initialized, which could maybe cause extra/lost entries in slow log.
set_query_id -> mark_used_columns
Simpler variable usage in pack_row() (cleanup)
Moved some variable declartion at start of function for better code readability
sql/sql_class.h:
Added enum_mark_columns
Updated comments
Renamed dupp_field -> dup_field
Added virtual function 'can_rollback_data()' to select_insert() to be used in CREATE ... SELECT to optimize use of OPTION_STATUS_NO_TRANS_UPDATE.
(This fixes a bug in CREATE ... SELECT where we did give wrong warnings when using non transacational tables)
sql/sql_delete.cc:
Updates to new handler interface
Call table->mark_columns_needed_for_delete() to allow us to put additional columns in column usage maps if handler so requires.
Call table->prepare_for_position() to tell handler that we are going to call ha_position().
Removed call to free_io_cache(). (io_cache is now removed in ha_reset()).
Fixed calls to setup_tables()
sql/sql_do.cc:
Update call to setup_fields()
sql/sql_handler.cc:
Tell handler tables to always read all columns.
Use temporary column map when storing value in field for later index usage
sql/sql_help.cc:
Makr all used fields to be read
Update call to setup_fields()
sql/sql_insert.cc:
Tell handler we are going to update the auto_increment column
dupp_field -> dup_field
Set column usage bits for timestamp field.
Call table->mark_columns_needed_for_insert() and table->mark_auto_increment_column()
Removed not used argument from mysql_prepare_insert_check_table().
If we get an duplicate row on insert, change column map to read and write all columns while retrying the operatation.
This is required by the definition of REPLACE and also ensures that fields that are only part of UPDATE are properly handled.
This fixed a bug in NDB and REPLACE where REPLACE wrongly copied some column values from the replaced row.
Setup new bitmaps for delayed insert rows
Remove reseting of next_number_fields as it will be reset on next call to handler_insert()
Fixed usage of thd->options and OPTION_STATUS_NO_TRANS_UPDATE.
The issue was that one should not to reset this flag as it may be set by a previous statement.
The way it was now used caused us to loose some warnings and get other wrong warnings when using non transactional tables mixed with transactional.
I fixed it by introducing 'select_insert::can_rollback_data' to inform send_error() that the given statement can be rolled back (which in case of CREATE TABLE can always be done)
Don't close tables created with CREATE ... SELECT but keep them in the table cache.
Moved out MY_HOOKS from inside function (better readability)
sql/sql_load.cc:
Update to use new handler and column marking interface
Update using setup_tables()
sql/sql_olap.cc:
Update calls to setup_tables
Use enums instead of constants to setup_fields()
sql/sql_parse.cc:
Handle OPTION_KEEP_LOG:
- Set it on CREATE TEMPORARY TABLE / DROP TABLE
- Reset it when OPTION_STATUS_NO_TRANS_UPDATE is reset
- Don't set it for CREATE ... SELECT (this is handled in select_create class)
Remove reseting of OPTION_STATUS_NO_TRANS_UPDATE in begin_trans() as this should already be reset.
If in autocommit mode, reset OPTION_KEEP_LOG and OPTION_STATUS_NO_TRANS_UPDATE to not give warnings in future commands
sql/sql_partition.cc:
Update walk() usage
Trivial indentation fixes
sql/sql_plugin.cc:
Mark all columns as used for plugins
sql/sql_prepare.cc:
Added assert to find out hidden bugs in character_set_client (got an error in debug binary when this not set correctly)
Updates for new handler interface
Update calls to setup_fields()
sql/sql_repl.cc:
Indentation fixes
sql/sql_select.cc:
Update call to setup_tables() and setup_fields()
Remove some old disabled code
Update to new hadler interface
Indentation cleanups
Added column bitmaps for temporary tables.
Remove updating of the removed slots in the Field class
Added TABLE argument to cp_buffer_from_ref() (To be able to install temporary column maps)
For internal temporary tables, use handler::write_row(), handler::delete_row() and handler::update_row() instead of handler::ha_xxxx() for faster execution.
sql/sql_select.h:
Indentaition fixes.
Install temporary column usage maps when needed
Added TABLE element to cp_buffer_from_ref()
sql/sql_show.cc:
Update to new handler interface
Mark all columns used for internal tables.
Style fixes.
Added support for 'future' ROW_TYPE_PAGES.
Don't allocate TMP_TABLE_PARAM with calloc. The 'init()' function will initialize the structure properly.
sql/sql_table.cc:
Update to new handler interface
Simple my_snprintf -> strmake()
Changed some constants to defines
Don't test for NULL in primary key (as we a couple of line above force the PRIMARY KEY to be NOT NULL)
Change field->add_index to use field->flags & FIELD_IN_ADD_INDEX
Mark all columns as used for ALTER TABLE
Style fixes
Update call to filesort()
sql/sql_trigger.h:
Added friend functions to be able to test if triggers exists for table we are going to insert/update or delete in.
sql/sql_udf.cc:
Mark all columns as used for udf system table.
sql/sql_union.cc:
Update call to walk()
Update to new handler interface
sql/sql_update.cc:
Remove query_id argument from compare_record()
Use column bitmaps instead of query_id.
We can't use compare_records() to skip updates for handlers that returns a partial column set and the read_set doesn't cover all columns in the write set, because compare_record() can't in this case know if a not read column changed value.
Update call to setup_fields()
Using separate column read and write sets allows for easier checking of timestamp field was set by statement.
Removed call to free_io_cache() as this is now done in ha_reset()
Call table->mark_columns_needed_for_update() and table->prepare_for_position()
Style fixes
sql/sql_view.cc:
Style fixes
sql/table.cc:
Remove implicitely include 'errno.h'
Remove code for building normalized path, as this is now identical to 'path'
Remove field->fieldnr
Added update of field->part_of_key_not_clustered()
Create column bitmaps in TABLE and TABLE_SHARE
Don't setup a temporary MEM_ROOT object as a thread specific variable for the handler. Instead we send the to-be-used MEMROOT to get_new_handler()
Update to new handler interface
Update call to walk()
Added new functions:
- st_table::clear_column_bitmaps()
- st_table::prepare_for_position()
- st_table::mark_columns_used_by_index()
- st_table::restore_column_maps_after_mark_index()
- st_table::mark_columns_used_by_index_no_reset()
- st_table::mark_auto_increment_column()
- st_table::mark_columns_needed_for_delete()
- st_table::mark_columns_needed_for_update()
- st_table::mark_columns_needed_for_insert()
sql/table.h:
Moved column usage bitmaps from handler to TABLE
Added to TABLE_SHARE all_set and column_bitmap_size
Added to TABLE merge_keys, bitmap_init_values, def_read_set, def_write_set, tmp_set, read_set and write_set.
Declared all new table column bitmap functions
Added TABLE functions column_bitmaps_set(), column_bitmaps_set_no_signal(), use_all_columns() and default_column_bitmaps()
Added functions: tmp_use_all_columns() and tmp_restore_column_map() to temporarly switch column bitmaps
Added functions: dbug_tmp_use_all_columns() and dbug_tmp_restore_column_map() to temporarly switch column bitmaps to avoid asserts in Field::store() and Field::val().
sql/tztime.cc:
Mark all columns as used for timezone tables
storage/archive/ha_archive.cc:
Update to new handler interface
storage/archive/ha_archive.h:
Update to new handler interface
storage/blackhole/ha_blackhole.cc:
Update to new handler interface
storage/blackhole/ha_blackhole.h:
Update to new handler interface
removed not needed flag HA_DUPP_POS
storage/csv/ha_tina.cc:
Update to new handler interface
storage/csv/ha_tina.h:
Update to new handler interface
storage/example/ha_example.cc:
Update to new handler interface
storage/example/ha_example.h:
Update to new handler interface
storage/heap/hp_extra.c:
Added heap_reset() (Required by new handler interface)
storage/heap/hp_test2.c:
Use heap_reset()
storage/myisam/ft_boolean_search.c:
Fixed compiler warning
storage/myisam/mi_extra.c:
Added mi_reset() (Required by new handler interface)
storage/myisam/mi_search.c:
Fixed DBUG_PRINT messages to use 0x%lx instead of %lx
storage/myisam/mi_test2.c:
Use mi_reset()
storage/myisam/myisampack.c:
Use mi_reset()
storage/myisammrg/myrg_extra.c:
Added myrg_reset() (Required by new handler interface)
unittest/mysys/base64.t.c:
Include my_global.h
Don't include implictely include file 'stdlib.h'
2006-06-04 17:52:22 +02:00
|
|
|
HA_DUPLICATE_POS:
|
2005-07-18 13:31:02 +02:00
|
|
|
Tells that we can the position for the conflicting duplicate key
|
|
|
|
record is stored in table->file->dupp_ref. (insert uses rnd_pos() on
|
|
|
|
this to find the duplicated row)
|
|
|
|
(MyISAM)
|
|
|
|
|
|
|
|
HA_CAN_INDEX_BLOBS:
|
|
|
|
Is the storage engine capable of defining an index of a prefix on
|
|
|
|
a BLOB attribute.
|
2014-08-21 18:11:46 +02:00
|
|
|
(Federated, MyISAM, InnoDB)
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
HA_AUTO_PART_KEY:
|
|
|
|
Auto increment fields can be part of a multi-part key. For second part
|
|
|
|
auto-increment keys, the auto_incrementing is done in handler.cc
|
2014-08-21 18:11:46 +02:00
|
|
|
(Federated, MyISAM)
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
HA_REQUIRE_PRIMARY_KEY:
|
|
|
|
Can't define a table without primary key (and cannot handle a table
|
|
|
|
with hidden primary key)
|
|
|
|
(No handler has this limitation currently)
|
|
|
|
|
This changeset is largely a handler cleanup changeset (WL#3281), but includes fixes and cleanups that was found necessary while testing the handler changes
Changes that requires code changes in other code of other storage engines.
(Note that all changes are very straightforward and one should find all issues
by compiling a --debug build and fixing all compiler errors and all
asserts in field.cc while running the test suite),
- New optional handler function introduced: reset()
This is called after every DML statement to make it easy for a handler to
statement specific cleanups.
(The only case it's not called is if force the file to be closed)
- handler::extra(HA_EXTRA_RESET) is removed. Code that was there before
should be moved to handler::reset()
- table->read_set contains a bitmap over all columns that are needed
in the query. read_row() and similar functions only needs to read these
columns
- table->write_set contains a bitmap over all columns that will be updated
in the query. write_row() and update_row() only needs to update these
columns.
The above bitmaps should now be up to date in all context
(including ALTER TABLE, filesort()).
The handler is informed of any changes to the bitmap after
fix_fields() by calling the virtual function
handler::column_bitmaps_signal(). If the handler does caching of
these bitmaps (instead of using table->read_set, table->write_set),
it should redo the caching in this code. as the signal() may be sent
several times, it's probably best to set a variable in the signal
and redo the caching on read_row() / write_row() if the variable was
set.
- Removed the read_set and write_set bitmap objects from the handler class
- Removed all column bit handling functions from the handler class.
(Now one instead uses the normal bitmap functions in my_bitmap.c instead
of handler dedicated bitmap functions)
- field->query_id is removed. One should instead instead check
table->read_set and table->write_set if a field is used in the query.
- handler::extra(HA_EXTRA_RETRIVE_ALL_COLS) and
handler::extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY) are removed. One should now
instead use table->read_set to check for which columns to retrieve.
- If a handler needs to call Field->val() or Field->store() on columns
that are not used in the query, one should install a temporary
all-columns-used map while doing so. For this, we provide the following
functions:
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
field->val();
dbug_tmp_restore_column_map(table->read_set, old_map);
and similar for the write map:
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->write_set);
field->val();
dbug_tmp_restore_column_map(table->write_set, old_map);
If this is not done, you will sooner or later hit a DBUG_ASSERT
in the field store() / val() functions.
(For not DBUG binaries, the dbug_tmp_restore_column_map() and
dbug_tmp_restore_column_map() are inline dummy functions and should
be optimized away be the compiler).
- If one needs to temporary set the column map for all binaries (and not
just to avoid the DBUG_ASSERT() in the Field::store() / Field::val()
methods) one should use the functions tmp_use_all_columns() and
tmp_restore_column_map() instead of the above dbug_ variants.
- All 'status' fields in the handler base class (like records,
data_file_length etc) are now stored in a 'stats' struct. This makes
it easier to know what status variables are provided by the base
handler. This requires some trivial variable names in the extra()
function.
- New virtual function handler::records(). This is called to optimize
COUNT(*) if (handler::table_flags() & HA_HAS_RECORDS()) is true.
(stats.records is not supposed to be an exact value. It's only has to
be 'reasonable enough' for the optimizer to be able to choose a good
optimization path).
- Non virtual handler::init() function added for caching of virtual
constants from engine.
- Removed has_transactions() virtual method. Now one should instead return
HA_NO_TRANSACTIONS in table_flags() if the table handler DOES NOT support
transactions.
- The 'xxxx_create_handler()' function now has a MEM_ROOT_root argument
that is to be used with 'new handler_name()' to allocate the handler
in the right area. The xxxx_create_handler() function is also
responsible for any initialization of the object before returning.
For example, one should change:
static handler *myisam_create_handler(TABLE_SHARE *table)
{
return new ha_myisam(table);
}
->
static handler *myisam_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
{
return new (mem_root) ha_myisam(table);
}
- New optional virtual function: use_hidden_primary_key().
This is called in case of an update/delete when
(table_flags() and HA_PRIMARY_KEY_REQUIRED_FOR_DELETE) is defined
but we don't have a primary key. This allows the handler to take precisions
in remembering any hidden primary key to able to update/delete any
found row. The default handler marks all columns to be read.
- handler::table_flags() now returns a ulonglong (to allow for more flags).
- New/changed table_flags()
- HA_HAS_RECORDS Set if ::records() is supported
- HA_NO_TRANSACTIONS Set if engine doesn't support transactions
- HA_PRIMARY_KEY_REQUIRED_FOR_DELETE
Set if we should mark all primary key columns for
read when reading rows as part of a DELETE
statement. If there is no primary key,
all columns are marked for read.
- HA_PARTIAL_COLUMN_READ Set if engine will not read all columns in some
cases (based on table->read_set)
- HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS
Renamed to HA_PRIMARY_KEY_REQUIRED_FOR_POSITION.
- HA_DUPP_POS Renamed to HA_DUPLICATE_POS
- HA_REQUIRES_KEY_COLUMNS_FOR_DELETE
Set this if we should mark ALL key columns for
read when when reading rows as part of a DELETE
statement. In case of an update we will mark
all keys for read for which key part changed
value.
- HA_STATS_RECORDS_IS_EXACT
Set this if stats.records is exact.
(This saves us some extra records() calls
when optimizing COUNT(*))
- Removed table_flags()
- HA_NOT_EXACT_COUNT Now one should instead use HA_HAS_RECORDS if
handler::records() gives an exact count() and
HA_STATS_RECORDS_IS_EXACT if stats.records is exact.
- HA_READ_RND_SAME Removed (no one supported this one)
- Removed not needed functions ha_retrieve_all_cols() and ha_retrieve_all_pk()
- Renamed handler::dupp_pos to handler::dup_pos
- Removed not used variable handler::sortkey
Upper level handler changes:
- ha_reset() now does some overall checks and calls ::reset()
- ha_table_flags() added. This is a cached version of table_flags(). The
cache is updated on engine creation time and updated on open.
MySQL level changes (not obvious from the above):
- DBUG_ASSERT() added to check that column usage matches what is set
in the column usage bit maps. (This found a LOT of bugs in current
column marking code).
- In 5.1 before, all used columns was marked in read_set and only updated
columns was marked in write_set. Now we only mark columns for which we
need a value in read_set.
- Column bitmaps are created in open_binary_frm() and open_table_from_share().
(Before this was in table.cc)
- handler::table_flags() calls are replaced with handler::ha_table_flags()
- For calling field->val() you must have the corresponding bit set in
table->read_set. For calling field->store() you must have the
corresponding bit set in table->write_set. (There are asserts in
all store()/val() functions to catch wrong usage)
- thd->set_query_id is renamed to thd->mark_used_columns and instead
of setting this to an integer value, this has now the values:
MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE
Changed also all variables named 'set_query_id' to mark_used_columns.
- In filesort() we now inform the handler of exactly which columns are needed
doing the sort and choosing the rows.
- The TABLE_SHARE object has a 'all_set' column bitmap one can use
when one needs a column bitmap with all columns set.
(This is used for table->use_all_columns() and other places)
- The TABLE object has 3 column bitmaps:
- def_read_set Default bitmap for columns to be read
- def_write_set Default bitmap for columns to be written
- tmp_set Can be used as a temporary bitmap when needed.
The table object has also two pointer to bitmaps read_set and write_set
that the handler should use to find out which columns are used in which way.
- count() optimization now calls handler::records() instead of using
handler->stats.records (if (table_flags() & HA_HAS_RECORDS) is true).
- Added extra argument to Item::walk() to indicate if we should also
traverse sub queries.
- Added TABLE parameter to cp_buffer_from_ref()
- Don't close tables created with CREATE ... SELECT but keep them in
the table cache. (Faster usage of newly created tables).
New interfaces:
- table->clear_column_bitmaps() to initialize the bitmaps for tables
at start of new statements.
- table->column_bitmaps_set() to set up new column bitmaps and signal
the handler about this.
- table->column_bitmaps_set_no_signal() for some few cases where we need
to setup new column bitmaps but don't signal the handler (as the handler
has already been signaled about these before). Used for the momement
only in opt_range.cc when doing ROR scans.
- table->use_all_columns() to install a bitmap where all columns are marked
as use in the read and the write set.
- table->default_column_bitmaps() to install the normal read and write
column bitmaps, but not signaling the handler about this.
This is mainly used when creating TABLE instances.
- table->mark_columns_needed_for_delete(),
table->mark_columns_needed_for_delete() and
table->mark_columns_needed_for_insert() to allow us to put additional
columns in column usage maps if handler so requires.
(The handler indicates what it neads in handler->table_flags())
- table->prepare_for_position() to allow us to tell handler that it
needs to read primary key parts to be able to store them in
future table->position() calls.
(This replaces the table->file->ha_retrieve_all_pk function)
- table->mark_auto_increment_column() to tell handler are going to update
columns part of any auto_increment key.
- table->mark_columns_used_by_index() to mark all columns that is part of
an index. It will also send extra(HA_EXTRA_KEYREAD) to handler to allow
it to quickly know that it only needs to read colums that are part
of the key. (The handler can also use the column map for detecting this,
but simpler/faster handler can just monitor the extra() call).
- table->mark_columns_used_by_index_no_reset() to in addition to other columns,
also mark all columns that is used by the given key.
- table->restore_column_maps_after_mark_index() to restore to default
column maps after a call to table->mark_columns_used_by_index().
- New item function register_field_in_read_map(), for marking used columns
in table->read_map. Used by filesort() to mark all used columns
- Maintain in TABLE->merge_keys set of all keys that are used in query.
(Simplices some optimization loops)
- Maintain Field->part_of_key_not_clustered which is like Field->part_of_key
but the field in the clustered key is not assumed to be part of all index.
(used in opt_range.cc for faster loops)
- dbug_tmp_use_all_columns(), dbug_tmp_restore_column_map()
tmp_use_all_columns() and tmp_restore_column_map() functions to temporally
mark all columns as usable. The 'dbug_' version is primarily intended
inside a handler when it wants to just call Field:store() & Field::val()
functions, but don't need the column maps set for any other usage.
(ie:: bitmap_is_set() is never called)
- We can't use compare_records() to skip updates for handlers that returns
a partial column set and the read_set doesn't cover all columns in the
write set. The reason for this is that if we have a column marked only for
write we can't in the MySQL level know if the value changed or not.
The reason this worked before was that MySQL marked all to be written
columns as also to be read. The new 'optimal' bitmaps exposed this 'hidden
bug'.
- open_table_from_share() does not anymore setup temporary MEM_ROOT
object as a thread specific variable for the handler. Instead we
send the to-be-used MEMROOT to get_new_handler().
(Simpler, faster code)
Bugs fixed:
- Column marking was not done correctly in a lot of cases.
(ALTER TABLE, when using triggers, auto_increment fields etc)
(Could potentially result in wrong values inserted in table handlers
relying on that the old column maps or field->set_query_id was correct)
Especially when it comes to triggers, there may be cases where the
old code would cause lost/wrong values for NDB and/or InnoDB tables.
- Split thd->options flag OPTION_STATUS_NO_TRANS_UPDATE to two flags:
OPTION_STATUS_NO_TRANS_UPDATE and OPTION_KEEP_LOG.
This allowed me to remove some wrong warnings about:
"Some non-transactional changed tables couldn't be rolled back"
- Fixed handling of INSERT .. SELECT and CREATE ... SELECT that wrongly reset
(thd->options & OPTION_STATUS_NO_TRANS_UPDATE) which caused us to loose
some warnings about
"Some non-transactional changed tables couldn't be rolled back")
- Fixed use of uninitialized memory in ha_ndbcluster.cc::delete_table()
which could cause delete_table to report random failures.
- Fixed core dumps for some tests when running with --debug
- Added missing FN_LIBCHAR in mysql_rm_tmp_tables()
(This has probably caused us to not properly remove temporary files after
crash)
- slow_logs was not properly initialized, which could maybe cause
extra/lost entries in slow log.
- If we get an duplicate row on insert, change column map to read and
write all columns while retrying the operation. This is required by
the definition of REPLACE and also ensures that fields that are only
part of UPDATE are properly handled. This fixed a bug in NDB and
REPLACE where REPLACE wrongly copied some column values from the replaced
row.
- For table handler that doesn't support NULL in keys, we would give an error
when creating a primary key with NULL fields, even after the fields has been
automaticly converted to NOT NULL.
- Creating a primary key on a SPATIAL key, would fail if field was not
declared as NOT NULL.
Cleanups:
- Removed not used condition argument to setup_tables
- Removed not needed item function reset_query_id_processor().
- Field->add_index is removed. Now this is instead maintained in
(field->flags & FIELD_IN_ADD_INDEX)
- Field->fieldnr is removed (use field->field_index instead)
- New argument to filesort() to indicate that it should return a set of
row pointers (not used columns). This allowed me to remove some references
to sql_command in filesort and should also enable us to return column
results in some cases where we couldn't before.
- Changed column bitmap handling in opt_range.cc to be aligned with TABLE
bitmap, which allowed me to use bitmap functions instead of looping over
all fields to create some needed bitmaps. (Faster and smaller code)
- Broke up found too long lines
- Moved some variable declaration at start of function for better code
readability.
- Removed some not used arguments from functions.
(setup_fields(), mysql_prepare_insert_check_table())
- setup_fields() now takes an enum instead of an int for marking columns
usage.
- For internal temporary tables, use handler::write_row(),
handler::delete_row() and handler::update_row() instead of
handler::ha_xxxx() for faster execution.
- Changed some constants to enum's and define's.
- Using separate column read and write sets allows for easier checking
of timestamp field was set by statement.
- Remove calls to free_io_cache() as this is now done automaticly in ha_reset()
- Don't build table->normalized_path as this is now identical to table->path
(after bar's fixes to convert filenames)
- Fixed some missed DBUG_PRINT(.."%lx") to use "0x%lx" to make it easier to
do comparision with the 'convert-dbug-for-diff' tool.
Things left to do in 5.1:
- We wrongly log failed CREATE TABLE ... SELECT in some cases when using
row based logging (as shown by testcase binlog_row_mix_innodb_myisam.result)
Mats has promised to look into this.
- Test that my fix for CREATE TABLE ... SELECT is indeed correct.
(I added several test cases for this, but in this case it's better that
someone else also tests this throughly).
Lars has promosed to do this.
BitKeeper/etc/ignore:
added mysys/test_bitmap
include/base64.h:
Removed my_global.h, as this must be included first in any program
include/heap.h:
Added heap_reset() (Required by new handler interface)
include/my_base.h:
Removed HA_EXTRA_RESET. MySQL will now call ::reset() instead of ::extra(HA_EXTRA_RESET).
HA_EXTRA_RETRIVE_ALL_COLS and HA_EXTRA_RETRIVE_PRIMARY key are deleted as the column bitmaps makes these unnecessary
include/my_bitmap.h:
Remove my_pthread.h (should be included at upper level)
Introduced my_bitmap_map typedef to make it the bitmap handling more like a black box
Added bitmap_is_overlapping(), bitmap_test_and_clear(), bitmap_copy() and bitmap_cmp()
Made bitmap_set_bit(), bitmap_flip_bit(), bitmap_clear_bit() return void
include/myisam.h:
Added mi_reset() (Required by new handler interface)
include/myisammrg.h:
Added myrg_reset() (Required by new handler interface)
include/mysql_com.h:
Added flag FIELD_IN_ADD_INDEX to be able to remove Field->add_index
mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test:
Added testing of CREATE ... SELECT in a mixed environment
(This found some bugs that Mats is going to fix shortly)
mysql-test/install_test_db.sh:
Simplify ldata usage
Added --tmpdir=. option to mysqld bootstrap (Removed some warnings when TMPDIR was wrongly set)
mysql-test/mysql-test-run.pl:
Added --tmpdir=. to bootstrap
mysql-test/mysql-test-run.sh:
Use copy instead of INSTALL_DB for master and slave databases.
(Speeds up startup time a lot!)
Remove snapshot directories at startup (removes some strange warnings)
mysql-test/r/binlog_row_mix_innodb_myisam.result:
Added testing of CREATE ... SELECT in a mixed environment
(This found some bugs that Mats is going to fix shortly)
mysql-test/r/binlog_stm_mix_innodb_myisam.result:
Added testing of CREATE ... SELECT in a mixed environment
mysql-test/r/create.result:
Some extra tests of warnings and number of tables opened by CREATE ... SELECT
mysql-test/r/federated.result:
Drop some left over tables
Added testing of multiple table update and multiple table delete (with and without keys)
mysql-test/r/func_gconcat.result:
Enable some disabled tests (converted them slightly to be predictable)
mysql-test/r/func_time.result:
Added drop of test function
mysql-test/r/innodb_mysql.result:
Added tests for CREATE ... SELECT
mysql-test/r/insert.result:
More tests
Added testing of duplicate columns in insert
mysql-test/r/loaddata.result:
Added testing LOAD DATA ... SET ...
mysql-test/r/multi_update.result:
Test multi updates and deletes using primary key and without
mysql-test/r/ndb_index_unique.result:
Better error message
mysql-test/r/ndb_replace.result:
New correct result after fixing REPLACE handling with NDB
mysql-test/r/rpl_ddl.result:
Now we don't get these (wrong) warnings anymore
mysql-test/r/view_grant.result:
Drop used views
mysql-test/t/create.test:
Some extra tests of warnings and number of tables opened by CREATE ... SELECT
mysql-test/t/federated.test:
Drop some left over tables
Added testing of multiple table update and multiple table delete (with and without keys)
mysql-test/t/func_gconcat.test:
Enable some disabled tests (converted them slightly to be predictable)
mysql-test/t/func_time.test:
Added drop of test function
mysql-test/t/innodb_mysql.test:
Added tests for CREATE ... SELECT
mysql-test/t/insert.test:
More tests
Added testing of duplicate columns in insert
mysql-test/t/loaddata.test:
Added testing LOAD DATA ... SET ...
mysql-test/t/multi_update.test:
Test multi updates and deletes using primary key and without
mysql-test/t/view_grant.test:
Drop used views
mysql-test/valgrind.supp:
Added supression of not needed warnings when printing stack trace
mysys/base64.c:
Include my_global.h first
mysys/my_bitmap.c:
Added bitmap_is_overlapping(), bitmap_test_and_clear() and bitmap_copy()
Changed logic of bitmap handling to be a bit more efficent (Did this together with Mikael Ronström)
Now the 'extra, not used bits' in the bitmap are assumed to have a 'random value' and the bitmap functions are free to change them whenever needed.
Changed how mutex is allocated to make 'bitmap_free()' function simpler.
mysys/thr_lock.c:
Added 0x before thread pointers (for easier comparison of DBUG traces)
sql/event.cc:
Ensure 'use_all_columns()' is used for event tables
Don't print warning that event table is damaged if it doesn't exists.
sql/field.cc:
Added ASSERT_COLUMN_MARKED_FOR_WRITE in all store() methods and ASSERT_COLUMN_MARKED_FOR_READ in all val() methods to catch wrong setting if table->read_set and table->write_set
(Rest of changes are only indentation cleanups)
sql/field.h:
Removed Field->query_id (replaced by table->read_set and table->write_set)
Removed Field->fieldnr (use Field->field_index instead)
Removed Field->add_index (Use Field->flags instead)
Add Field->part_of_key_not_clustered (for usage in opt_range.cc)
sql/filesort.cc:
Added paramater sort_postion to filesort() to force sorting by position instead of storing all fields in the result set.
This allowed me to remove checking of sql_command.
Create a temporary column bitmap for fields that are used by the sorting process.
Use column bitmaps instead of query_id
sql/ha_berkeley.cc:
Update to 'newer' table handler interface
sql/ha_berkeley.h:
Update to 'newer' table handler interface
sql/ha_federated.cc:
Update to 'newer' table handler interface
Only read columns that are needed from remote server.
In case of eq ranges, don't generate two conditions in the WHERE clause
(this can still be optimized, but would require a bigger code change)
Use 'simpler to use' XXXX_LEN' macros
A bit simpler logic in ::write_row() when creating statements.
In update, only include test of fields actually read.
(This greatly simplifies the queries sent by the federated engine)
Similar changes done for delete_row()
sql/ha_federated.h:
Update to 'newer' table handler interface
Changed XXX_LEN macros to use sizeof(...)-1, to simplify usage in ha_federated.cc
Added HA_PRIMARY_KEY_REQUIRED_FOR_DELETE to tell MySQL to read all primary key columns in case of DELETE
sql/ha_heap.cc:
Update to 'newer' table handler interface
sql/ha_heap.h:
Update to 'newer' table handler interface
sql/ha_innodb.cc:
Update to 'newer' table handler interface
- Update innobase_create_handler() to new interface
- Removed HA_NOT_EXACT_COUNT (not needed)
- Renamed HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS to HA_PRIMARY_KEY_REQUIRED_FOR_POSITION.
- Prefixed base status variables with 'stats'
- Use table column bitmaps instead of ha_get_bit_in_read_set()
- Added ::reset(), with code from ::extra(HA_EXTRA_RESET)
- Removed HA_EXTRA_RETRIVE_ALL_COLS and HA_EXTRA_RETRIEVE_PRIMARY_KEY as
the table->read_set and table->write_set bitmaps now are accurate
sql/ha_innodb.h:
Update to 'newer' table handler interface
- table_flags are now ulonglong
- Added reset() method
- Removed not needed ha_retrieve_all_cols() and ha_retrieve_all_pk() columns.
- Made build_template() a class function to be able to easier access class variables
sql/ha_myisam.cc:
Update to 'newer' table handler interface
sql/ha_myisam.h:
Update to 'newer' table handler interface
sql/ha_myisammrg.cc:
Update to 'newer' table handler interface
sql/ha_myisammrg.h:
Update to 'newer' table handler interface
sql/ha_ndbcluster.cc:
Update to 'newer' table handler interface
Fixed use_blob_value() to be accurate
In ::complemented_read() we have to check both the read and write bitmap as the old code did mark all changed columns also in the read map
Correct dumping of field data with DBUG_DUMP
Prefix addresses in DBUG_PRINT with 0x
Fixed usage of not initialized memory
Update to use field->flags & FIELD_IN_ADD_INDEX instead of field->add_index.
sql/ha_ndbcluster.h:
Update to 'newer' table handler interface
sql/ha_ndbcluster_binlog.cc:
Mark usage of all columns in ndbcluster binlog tables
false -> FALSE, true -> TRUE
Use table->s->all_set instead of creating a temporary bitmap.
sql/ha_partition.cc:
Update to 'newer' table handler interface
Added memroot to initialise_partitions() and related functions to get faster memory allocation.
partition_create_handler() is now responsible for initialisation of the partition object
Some trivial optimizations and indentation fixes
Ensure that table_flags() are up to date
Removed documentation for removed HA_EXTRA flags
Fixed 'strange' usage of m_file[i] in new_handlers_from_part_info()that worked in current code 'by chance'
sql/ha_partition.h:
Update to 'newer' table handler interface
sql/handler.cc:
create_xxx handler now takes MEMROOT as an argument to simplify memory allocation.
Much simpler get_new_handler()
(Initialization of the object is now handled by the create method for the engine)
Moved all allocation of bitmap handling to the TABLE object (in table.cc)
Added column_bitmaps_signal() to signal column usage changes.
Changed binlog_log_row() to use the exiusting all_set bitmap in the table object.
Added ha_reset() function to test that the file object is ok at end of statement and call handler::reset()
Added use_hidden_primary_key() to signal handler that we we are going to read and update + delete the row and the handler should thus remember the position for the row
sql/handler.h:
Added HA_NO_TRANSACTIONS, HA_PARTIAL_COLUMN_READ, HA_REQUIRES_KEY_COLUMNS_FOR_DELETE,HA_PRIMARY_KEY_REQUIRED_FOR_DELETE and HA_HAS_RECORDS
Removed HA_NOT_EXACT_COUNT, HA_READ_RND_SAME
HA_DUPP_POS -> HA_DUPLICATE_POS
HA_NOT_EXACT_COUNT replaced by HA_STATS_RECORDS_IS_EXACT, HA_HAS_RECORDS and records()
HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS renamed to HA_PRIMARY_KEY_REQUIRED_FOR_POSITION
Added future row type 'ROW_TYPE_PAGES'
Added MEM_ROOT to handlerton 'create' function
Added ha_statistics, a structure for all status variable in the base handler class.
Moved all status variables in the handler class into a stats structs to improve readability.
ha_table_flags() is now a cached (not virtual) version of table_flags()
reset() doesn't anymore call extra(HA_EXTRA_RESET) but is a function of it's own.
Renamed dupp_ref to dup_ref
Renamed not used handler::sortkey
Moved read_set and write_set to TABLE structure
handler::init() function added for cacheing of virtual constants from engine.
sql/item.cc:
Added register_field_in_read_map() for marking used columns in expression.
This is used by filesort() for creating an optimal column bitmap while retrieving columns for sorting.
Initalize value.cs_info.character_set_client to fix core dump bug with --debug
set_query_id -> mark_used_columns
Mark used columns in read_set OR write_set.
sql/item.h:
Removed reset_query_id_processor() as it's not needed anymore.
Added register_field_in_read_map()
Added extra argument to Item::walk() to indicate if we should also
traverse sub queries.
sql/item_cmpfunc.cc:
Temporary mark used columns to be read/writable
Update Item::walk to new interface
sql/item_cmpfunc.h:
Added extra argument to Item::walk() to indicate if we should also traverse sub queries.
sql/item_func.cc:
Update Item::walk() to new interface
table_flags() -> ha_table_flags()
sql/item_func.h:
Update Item::walk() to new interface
sql/item_row.cc:
Update Item::walk() to new interface
sql/item_row.h:
Update Item::walk() to new interface
sql/item_strfunc.h:
Update Item::walk() to new interface
sql/item_subselect.cc:
Added Item_subselect::walk()
(It was a bug it was missing before. Not sure what kind of bugs this could have caused)
sql/item_subselect.h:
Update Item::walk() to new interface
sql/item_sum.cc:
Update Item::walk() to new interface
Updates for new handler interace
sql/item_sum.h:
Update Item::walk() to new interface
sql/key.cc:
Updates for new handler interace
sql/log.cc:
Mark all columns used for log tables
Split options flag
Ensured that second argument to trans_register_ha is a bool
sql/log_event.cc:
Fixed comments to be withing 79 characters
Use OPTION_KEEP_LOG instead of OPTION_STATUS_NO_TRANS_UPDATE to remove wrong warnings
Updates for new handler interface
Use 0x%lx instead of %p (portability problem)
sql/mysql_priv.h:
Added OPTION_KEEP_LOG to indicate that we should replicate the binlog even on rollback
Removed not used 'conds' argument to setup_tables
sql/mysqld.cc:
Indentation fixes and removed old comment
sql/opt_range.cc:
Update to new handler and bitmap interface.
Fixed calls to cp_buffer_from_ref() and walk() (new argument).
Create new temporary bitmaps for ror scans.
(Needed because of handler changes and to get more accurate column bitmaps than before)
Remove not needed file->ha_reset() call before file->close().
Some trivial optimization and indentation fixes.
Use Field->part_of_key_not_clustered() to check if field is part of a key, instead of looping over all key parts.
Added flag 'in_ror_merged_scan' to allow ::get_next() to know that we need a special column bitmap to only fetch pointer to record.
This is needed because ror scan uses the same TABLE object but different file objects, which creates problem for the column bitmap handling.
(This is a temporary solution. A better one would be to allocate an own TABLE object for ROR scans)
Optimized bitmap handling in ror scans:
- Start bitmap at position 0, not 1
- Use same bitmap size as in TABLE
- Use table->read_set and table->write_set to create column bitmaps instead of looping over all fields in table
sql/opt_range.h:
Added 'in_ror_merged_scan' to indicate if we are doing a ROR scan
Added temporary column bitmaps used in ROR scans
sql/opt_sum.cc:
Added get_ext_record_count() which is used in COUNT() optimization if handler has HA_HAS_RECORDS
Note that we don't call this if handler has HA_STATS_RECORDS_IS_EXACT set.
sql/protocol.cc:
We need to mark columns as readable in ::store() as we sometimes return default value for fields to the user
sql/records.cc:
Updates for new handler interface
sql/set_var.cc:
Handle splitting OPTION_STATUS_NO_TRANS_UPDATE to two flags
sql/share/errmsg.txt:
Fixed wrong
sql/sp.cc:
Mark that we are using all columns for the proc table
Update call to setup_tables() to use new prototype
sql/sp_head.cc:
Removed QQ comment
sql/spatial.cc:
Removed wrong QQ comment
sql/sql_acl.cc:
Mark that we need all columns for acl tables
Supply memroot to some 'new' calls.
Indentation fixes
sql/sql_base.cc:
set_query_id removed
Ensure we call ha_reset() at end of each statement
Mark read columns in read_set and changed columns in write_set (Before all columns was marked in read set)
Fixed marking of some columns that was not proplerly marked before
Maintain in TABLE->merge_keys set of all keys that are used in some way
Removed not used 'conds' argument from setup_tables()
Remove not used setting of 'dupp_field' in insert_fields()
Added missing FN_LIBCHAR in mysql_rm_tmp_tables()
(This has probably caused us to not properly remove temporary files after crash)
sql/sql_bitmap.h:
Added is_overlapping()
sql/sql_class.cc:
Slow_logs was not properly initialized, which could maybe cause extra/lost entries in slow log.
set_query_id -> mark_used_columns
Simpler variable usage in pack_row() (cleanup)
Moved some variable declartion at start of function for better code readability
sql/sql_class.h:
Added enum_mark_columns
Updated comments
Renamed dupp_field -> dup_field
Added virtual function 'can_rollback_data()' to select_insert() to be used in CREATE ... SELECT to optimize use of OPTION_STATUS_NO_TRANS_UPDATE.
(This fixes a bug in CREATE ... SELECT where we did give wrong warnings when using non transacational tables)
sql/sql_delete.cc:
Updates to new handler interface
Call table->mark_columns_needed_for_delete() to allow us to put additional columns in column usage maps if handler so requires.
Call table->prepare_for_position() to tell handler that we are going to call ha_position().
Removed call to free_io_cache(). (io_cache is now removed in ha_reset()).
Fixed calls to setup_tables()
sql/sql_do.cc:
Update call to setup_fields()
sql/sql_handler.cc:
Tell handler tables to always read all columns.
Use temporary column map when storing value in field for later index usage
sql/sql_help.cc:
Makr all used fields to be read
Update call to setup_fields()
sql/sql_insert.cc:
Tell handler we are going to update the auto_increment column
dupp_field -> dup_field
Set column usage bits for timestamp field.
Call table->mark_columns_needed_for_insert() and table->mark_auto_increment_column()
Removed not used argument from mysql_prepare_insert_check_table().
If we get an duplicate row on insert, change column map to read and write all columns while retrying the operatation.
This is required by the definition of REPLACE and also ensures that fields that are only part of UPDATE are properly handled.
This fixed a bug in NDB and REPLACE where REPLACE wrongly copied some column values from the replaced row.
Setup new bitmaps for delayed insert rows
Remove reseting of next_number_fields as it will be reset on next call to handler_insert()
Fixed usage of thd->options and OPTION_STATUS_NO_TRANS_UPDATE.
The issue was that one should not to reset this flag as it may be set by a previous statement.
The way it was now used caused us to loose some warnings and get other wrong warnings when using non transactional tables mixed with transactional.
I fixed it by introducing 'select_insert::can_rollback_data' to inform send_error() that the given statement can be rolled back (which in case of CREATE TABLE can always be done)
Don't close tables created with CREATE ... SELECT but keep them in the table cache.
Moved out MY_HOOKS from inside function (better readability)
sql/sql_load.cc:
Update to use new handler and column marking interface
Update using setup_tables()
sql/sql_olap.cc:
Update calls to setup_tables
Use enums instead of constants to setup_fields()
sql/sql_parse.cc:
Handle OPTION_KEEP_LOG:
- Set it on CREATE TEMPORARY TABLE / DROP TABLE
- Reset it when OPTION_STATUS_NO_TRANS_UPDATE is reset
- Don't set it for CREATE ... SELECT (this is handled in select_create class)
Remove reseting of OPTION_STATUS_NO_TRANS_UPDATE in begin_trans() as this should already be reset.
If in autocommit mode, reset OPTION_KEEP_LOG and OPTION_STATUS_NO_TRANS_UPDATE to not give warnings in future commands
sql/sql_partition.cc:
Update walk() usage
Trivial indentation fixes
sql/sql_plugin.cc:
Mark all columns as used for plugins
sql/sql_prepare.cc:
Added assert to find out hidden bugs in character_set_client (got an error in debug binary when this not set correctly)
Updates for new handler interface
Update calls to setup_fields()
sql/sql_repl.cc:
Indentation fixes
sql/sql_select.cc:
Update call to setup_tables() and setup_fields()
Remove some old disabled code
Update to new hadler interface
Indentation cleanups
Added column bitmaps for temporary tables.
Remove updating of the removed slots in the Field class
Added TABLE argument to cp_buffer_from_ref() (To be able to install temporary column maps)
For internal temporary tables, use handler::write_row(), handler::delete_row() and handler::update_row() instead of handler::ha_xxxx() for faster execution.
sql/sql_select.h:
Indentaition fixes.
Install temporary column usage maps when needed
Added TABLE element to cp_buffer_from_ref()
sql/sql_show.cc:
Update to new handler interface
Mark all columns used for internal tables.
Style fixes.
Added support for 'future' ROW_TYPE_PAGES.
Don't allocate TMP_TABLE_PARAM with calloc. The 'init()' function will initialize the structure properly.
sql/sql_table.cc:
Update to new handler interface
Simple my_snprintf -> strmake()
Changed some constants to defines
Don't test for NULL in primary key (as we a couple of line above force the PRIMARY KEY to be NOT NULL)
Change field->add_index to use field->flags & FIELD_IN_ADD_INDEX
Mark all columns as used for ALTER TABLE
Style fixes
Update call to filesort()
sql/sql_trigger.h:
Added friend functions to be able to test if triggers exists for table we are going to insert/update or delete in.
sql/sql_udf.cc:
Mark all columns as used for udf system table.
sql/sql_union.cc:
Update call to walk()
Update to new handler interface
sql/sql_update.cc:
Remove query_id argument from compare_record()
Use column bitmaps instead of query_id.
We can't use compare_records() to skip updates for handlers that returns a partial column set and the read_set doesn't cover all columns in the write set, because compare_record() can't in this case know if a not read column changed value.
Update call to setup_fields()
Using separate column read and write sets allows for easier checking of timestamp field was set by statement.
Removed call to free_io_cache() as this is now done in ha_reset()
Call table->mark_columns_needed_for_update() and table->prepare_for_position()
Style fixes
sql/sql_view.cc:
Style fixes
sql/table.cc:
Remove implicitely include 'errno.h'
Remove code for building normalized path, as this is now identical to 'path'
Remove field->fieldnr
Added update of field->part_of_key_not_clustered()
Create column bitmaps in TABLE and TABLE_SHARE
Don't setup a temporary MEM_ROOT object as a thread specific variable for the handler. Instead we send the to-be-used MEMROOT to get_new_handler()
Update to new handler interface
Update call to walk()
Added new functions:
- st_table::clear_column_bitmaps()
- st_table::prepare_for_position()
- st_table::mark_columns_used_by_index()
- st_table::restore_column_maps_after_mark_index()
- st_table::mark_columns_used_by_index_no_reset()
- st_table::mark_auto_increment_column()
- st_table::mark_columns_needed_for_delete()
- st_table::mark_columns_needed_for_update()
- st_table::mark_columns_needed_for_insert()
sql/table.h:
Moved column usage bitmaps from handler to TABLE
Added to TABLE_SHARE all_set and column_bitmap_size
Added to TABLE merge_keys, bitmap_init_values, def_read_set, def_write_set, tmp_set, read_set and write_set.
Declared all new table column bitmap functions
Added TABLE functions column_bitmaps_set(), column_bitmaps_set_no_signal(), use_all_columns() and default_column_bitmaps()
Added functions: tmp_use_all_columns() and tmp_restore_column_map() to temporarly switch column bitmaps
Added functions: dbug_tmp_use_all_columns() and dbug_tmp_restore_column_map() to temporarly switch column bitmaps to avoid asserts in Field::store() and Field::val().
sql/tztime.cc:
Mark all columns as used for timezone tables
storage/archive/ha_archive.cc:
Update to new handler interface
storage/archive/ha_archive.h:
Update to new handler interface
storage/blackhole/ha_blackhole.cc:
Update to new handler interface
storage/blackhole/ha_blackhole.h:
Update to new handler interface
removed not needed flag HA_DUPP_POS
storage/csv/ha_tina.cc:
Update to new handler interface
storage/csv/ha_tina.h:
Update to new handler interface
storage/example/ha_example.cc:
Update to new handler interface
storage/example/ha_example.h:
Update to new handler interface
storage/heap/hp_extra.c:
Added heap_reset() (Required by new handler interface)
storage/heap/hp_test2.c:
Use heap_reset()
storage/myisam/ft_boolean_search.c:
Fixed compiler warning
storage/myisam/mi_extra.c:
Added mi_reset() (Required by new handler interface)
storage/myisam/mi_search.c:
Fixed DBUG_PRINT messages to use 0x%lx instead of %lx
storage/myisam/mi_test2.c:
Use mi_reset()
storage/myisam/myisampack.c:
Use mi_reset()
storage/myisammrg/myrg_extra.c:
Added myrg_reset() (Required by new handler interface)
unittest/mysys/base64.t.c:
Include my_global.h
Don't include implictely include file 'stdlib.h'
2006-06-04 17:52:22 +02:00
|
|
|
HA_STATS_RECORDS_IS_EXACT:
|
2005-07-18 13:31:02 +02:00
|
|
|
Does the counter of records after the info call specify an exact
|
This changeset is largely a handler cleanup changeset (WL#3281), but includes fixes and cleanups that was found necessary while testing the handler changes
Changes that requires code changes in other code of other storage engines.
(Note that all changes are very straightforward and one should find all issues
by compiling a --debug build and fixing all compiler errors and all
asserts in field.cc while running the test suite),
- New optional handler function introduced: reset()
This is called after every DML statement to make it easy for a handler to
statement specific cleanups.
(The only case it's not called is if force the file to be closed)
- handler::extra(HA_EXTRA_RESET) is removed. Code that was there before
should be moved to handler::reset()
- table->read_set contains a bitmap over all columns that are needed
in the query. read_row() and similar functions only needs to read these
columns
- table->write_set contains a bitmap over all columns that will be updated
in the query. write_row() and update_row() only needs to update these
columns.
The above bitmaps should now be up to date in all context
(including ALTER TABLE, filesort()).
The handler is informed of any changes to the bitmap after
fix_fields() by calling the virtual function
handler::column_bitmaps_signal(). If the handler does caching of
these bitmaps (instead of using table->read_set, table->write_set),
it should redo the caching in this code. as the signal() may be sent
several times, it's probably best to set a variable in the signal
and redo the caching on read_row() / write_row() if the variable was
set.
- Removed the read_set and write_set bitmap objects from the handler class
- Removed all column bit handling functions from the handler class.
(Now one instead uses the normal bitmap functions in my_bitmap.c instead
of handler dedicated bitmap functions)
- field->query_id is removed. One should instead instead check
table->read_set and table->write_set if a field is used in the query.
- handler::extra(HA_EXTRA_RETRIVE_ALL_COLS) and
handler::extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY) are removed. One should now
instead use table->read_set to check for which columns to retrieve.
- If a handler needs to call Field->val() or Field->store() on columns
that are not used in the query, one should install a temporary
all-columns-used map while doing so. For this, we provide the following
functions:
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
field->val();
dbug_tmp_restore_column_map(table->read_set, old_map);
and similar for the write map:
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->write_set);
field->val();
dbug_tmp_restore_column_map(table->write_set, old_map);
If this is not done, you will sooner or later hit a DBUG_ASSERT
in the field store() / val() functions.
(For not DBUG binaries, the dbug_tmp_restore_column_map() and
dbug_tmp_restore_column_map() are inline dummy functions and should
be optimized away be the compiler).
- If one needs to temporary set the column map for all binaries (and not
just to avoid the DBUG_ASSERT() in the Field::store() / Field::val()
methods) one should use the functions tmp_use_all_columns() and
tmp_restore_column_map() instead of the above dbug_ variants.
- All 'status' fields in the handler base class (like records,
data_file_length etc) are now stored in a 'stats' struct. This makes
it easier to know what status variables are provided by the base
handler. This requires some trivial variable names in the extra()
function.
- New virtual function handler::records(). This is called to optimize
COUNT(*) if (handler::table_flags() & HA_HAS_RECORDS()) is true.
(stats.records is not supposed to be an exact value. It's only has to
be 'reasonable enough' for the optimizer to be able to choose a good
optimization path).
- Non virtual handler::init() function added for caching of virtual
constants from engine.
- Removed has_transactions() virtual method. Now one should instead return
HA_NO_TRANSACTIONS in table_flags() if the table handler DOES NOT support
transactions.
- The 'xxxx_create_handler()' function now has a MEM_ROOT_root argument
that is to be used with 'new handler_name()' to allocate the handler
in the right area. The xxxx_create_handler() function is also
responsible for any initialization of the object before returning.
For example, one should change:
static handler *myisam_create_handler(TABLE_SHARE *table)
{
return new ha_myisam(table);
}
->
static handler *myisam_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
{
return new (mem_root) ha_myisam(table);
}
- New optional virtual function: use_hidden_primary_key().
This is called in case of an update/delete when
(table_flags() and HA_PRIMARY_KEY_REQUIRED_FOR_DELETE) is defined
but we don't have a primary key. This allows the handler to take precisions
in remembering any hidden primary key to able to update/delete any
found row. The default handler marks all columns to be read.
- handler::table_flags() now returns a ulonglong (to allow for more flags).
- New/changed table_flags()
- HA_HAS_RECORDS Set if ::records() is supported
- HA_NO_TRANSACTIONS Set if engine doesn't support transactions
- HA_PRIMARY_KEY_REQUIRED_FOR_DELETE
Set if we should mark all primary key columns for
read when reading rows as part of a DELETE
statement. If there is no primary key,
all columns are marked for read.
- HA_PARTIAL_COLUMN_READ Set if engine will not read all columns in some
cases (based on table->read_set)
- HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS
Renamed to HA_PRIMARY_KEY_REQUIRED_FOR_POSITION.
- HA_DUPP_POS Renamed to HA_DUPLICATE_POS
- HA_REQUIRES_KEY_COLUMNS_FOR_DELETE
Set this if we should mark ALL key columns for
read when when reading rows as part of a DELETE
statement. In case of an update we will mark
all keys for read for which key part changed
value.
- HA_STATS_RECORDS_IS_EXACT
Set this if stats.records is exact.
(This saves us some extra records() calls
when optimizing COUNT(*))
- Removed table_flags()
- HA_NOT_EXACT_COUNT Now one should instead use HA_HAS_RECORDS if
handler::records() gives an exact count() and
HA_STATS_RECORDS_IS_EXACT if stats.records is exact.
- HA_READ_RND_SAME Removed (no one supported this one)
- Removed not needed functions ha_retrieve_all_cols() and ha_retrieve_all_pk()
- Renamed handler::dupp_pos to handler::dup_pos
- Removed not used variable handler::sortkey
Upper level handler changes:
- ha_reset() now does some overall checks and calls ::reset()
- ha_table_flags() added. This is a cached version of table_flags(). The
cache is updated on engine creation time and updated on open.
MySQL level changes (not obvious from the above):
- DBUG_ASSERT() added to check that column usage matches what is set
in the column usage bit maps. (This found a LOT of bugs in current
column marking code).
- In 5.1 before, all used columns was marked in read_set and only updated
columns was marked in write_set. Now we only mark columns for which we
need a value in read_set.
- Column bitmaps are created in open_binary_frm() and open_table_from_share().
(Before this was in table.cc)
- handler::table_flags() calls are replaced with handler::ha_table_flags()
- For calling field->val() you must have the corresponding bit set in
table->read_set. For calling field->store() you must have the
corresponding bit set in table->write_set. (There are asserts in
all store()/val() functions to catch wrong usage)
- thd->set_query_id is renamed to thd->mark_used_columns and instead
of setting this to an integer value, this has now the values:
MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE
Changed also all variables named 'set_query_id' to mark_used_columns.
- In filesort() we now inform the handler of exactly which columns are needed
doing the sort and choosing the rows.
- The TABLE_SHARE object has a 'all_set' column bitmap one can use
when one needs a column bitmap with all columns set.
(This is used for table->use_all_columns() and other places)
- The TABLE object has 3 column bitmaps:
- def_read_set Default bitmap for columns to be read
- def_write_set Default bitmap for columns to be written
- tmp_set Can be used as a temporary bitmap when needed.
The table object has also two pointer to bitmaps read_set and write_set
that the handler should use to find out which columns are used in which way.
- count() optimization now calls handler::records() instead of using
handler->stats.records (if (table_flags() & HA_HAS_RECORDS) is true).
- Added extra argument to Item::walk() to indicate if we should also
traverse sub queries.
- Added TABLE parameter to cp_buffer_from_ref()
- Don't close tables created with CREATE ... SELECT but keep them in
the table cache. (Faster usage of newly created tables).
New interfaces:
- table->clear_column_bitmaps() to initialize the bitmaps for tables
at start of new statements.
- table->column_bitmaps_set() to set up new column bitmaps and signal
the handler about this.
- table->column_bitmaps_set_no_signal() for some few cases where we need
to setup new column bitmaps but don't signal the handler (as the handler
has already been signaled about these before). Used for the momement
only in opt_range.cc when doing ROR scans.
- table->use_all_columns() to install a bitmap where all columns are marked
as use in the read and the write set.
- table->default_column_bitmaps() to install the normal read and write
column bitmaps, but not signaling the handler about this.
This is mainly used when creating TABLE instances.
- table->mark_columns_needed_for_delete(),
table->mark_columns_needed_for_delete() and
table->mark_columns_needed_for_insert() to allow us to put additional
columns in column usage maps if handler so requires.
(The handler indicates what it neads in handler->table_flags())
- table->prepare_for_position() to allow us to tell handler that it
needs to read primary key parts to be able to store them in
future table->position() calls.
(This replaces the table->file->ha_retrieve_all_pk function)
- table->mark_auto_increment_column() to tell handler are going to update
columns part of any auto_increment key.
- table->mark_columns_used_by_index() to mark all columns that is part of
an index. It will also send extra(HA_EXTRA_KEYREAD) to handler to allow
it to quickly know that it only needs to read colums that are part
of the key. (The handler can also use the column map for detecting this,
but simpler/faster handler can just monitor the extra() call).
- table->mark_columns_used_by_index_no_reset() to in addition to other columns,
also mark all columns that is used by the given key.
- table->restore_column_maps_after_mark_index() to restore to default
column maps after a call to table->mark_columns_used_by_index().
- New item function register_field_in_read_map(), for marking used columns
in table->read_map. Used by filesort() to mark all used columns
- Maintain in TABLE->merge_keys set of all keys that are used in query.
(Simplices some optimization loops)
- Maintain Field->part_of_key_not_clustered which is like Field->part_of_key
but the field in the clustered key is not assumed to be part of all index.
(used in opt_range.cc for faster loops)
- dbug_tmp_use_all_columns(), dbug_tmp_restore_column_map()
tmp_use_all_columns() and tmp_restore_column_map() functions to temporally
mark all columns as usable. The 'dbug_' version is primarily intended
inside a handler when it wants to just call Field:store() & Field::val()
functions, but don't need the column maps set for any other usage.
(ie:: bitmap_is_set() is never called)
- We can't use compare_records() to skip updates for handlers that returns
a partial column set and the read_set doesn't cover all columns in the
write set. The reason for this is that if we have a column marked only for
write we can't in the MySQL level know if the value changed or not.
The reason this worked before was that MySQL marked all to be written
columns as also to be read. The new 'optimal' bitmaps exposed this 'hidden
bug'.
- open_table_from_share() does not anymore setup temporary MEM_ROOT
object as a thread specific variable for the handler. Instead we
send the to-be-used MEMROOT to get_new_handler().
(Simpler, faster code)
Bugs fixed:
- Column marking was not done correctly in a lot of cases.
(ALTER TABLE, when using triggers, auto_increment fields etc)
(Could potentially result in wrong values inserted in table handlers
relying on that the old column maps or field->set_query_id was correct)
Especially when it comes to triggers, there may be cases where the
old code would cause lost/wrong values for NDB and/or InnoDB tables.
- Split thd->options flag OPTION_STATUS_NO_TRANS_UPDATE to two flags:
OPTION_STATUS_NO_TRANS_UPDATE and OPTION_KEEP_LOG.
This allowed me to remove some wrong warnings about:
"Some non-transactional changed tables couldn't be rolled back"
- Fixed handling of INSERT .. SELECT and CREATE ... SELECT that wrongly reset
(thd->options & OPTION_STATUS_NO_TRANS_UPDATE) which caused us to loose
some warnings about
"Some non-transactional changed tables couldn't be rolled back")
- Fixed use of uninitialized memory in ha_ndbcluster.cc::delete_table()
which could cause delete_table to report random failures.
- Fixed core dumps for some tests when running with --debug
- Added missing FN_LIBCHAR in mysql_rm_tmp_tables()
(This has probably caused us to not properly remove temporary files after
crash)
- slow_logs was not properly initialized, which could maybe cause
extra/lost entries in slow log.
- If we get an duplicate row on insert, change column map to read and
write all columns while retrying the operation. This is required by
the definition of REPLACE and also ensures that fields that are only
part of UPDATE are properly handled. This fixed a bug in NDB and
REPLACE where REPLACE wrongly copied some column values from the replaced
row.
- For table handler that doesn't support NULL in keys, we would give an error
when creating a primary key with NULL fields, even after the fields has been
automaticly converted to NOT NULL.
- Creating a primary key on a SPATIAL key, would fail if field was not
declared as NOT NULL.
Cleanups:
- Removed not used condition argument to setup_tables
- Removed not needed item function reset_query_id_processor().
- Field->add_index is removed. Now this is instead maintained in
(field->flags & FIELD_IN_ADD_INDEX)
- Field->fieldnr is removed (use field->field_index instead)
- New argument to filesort() to indicate that it should return a set of
row pointers (not used columns). This allowed me to remove some references
to sql_command in filesort and should also enable us to return column
results in some cases where we couldn't before.
- Changed column bitmap handling in opt_range.cc to be aligned with TABLE
bitmap, which allowed me to use bitmap functions instead of looping over
all fields to create some needed bitmaps. (Faster and smaller code)
- Broke up found too long lines
- Moved some variable declaration at start of function for better code
readability.
- Removed some not used arguments from functions.
(setup_fields(), mysql_prepare_insert_check_table())
- setup_fields() now takes an enum instead of an int for marking columns
usage.
- For internal temporary tables, use handler::write_row(),
handler::delete_row() and handler::update_row() instead of
handler::ha_xxxx() for faster execution.
- Changed some constants to enum's and define's.
- Using separate column read and write sets allows for easier checking
of timestamp field was set by statement.
- Remove calls to free_io_cache() as this is now done automaticly in ha_reset()
- Don't build table->normalized_path as this is now identical to table->path
(after bar's fixes to convert filenames)
- Fixed some missed DBUG_PRINT(.."%lx") to use "0x%lx" to make it easier to
do comparision with the 'convert-dbug-for-diff' tool.
Things left to do in 5.1:
- We wrongly log failed CREATE TABLE ... SELECT in some cases when using
row based logging (as shown by testcase binlog_row_mix_innodb_myisam.result)
Mats has promised to look into this.
- Test that my fix for CREATE TABLE ... SELECT is indeed correct.
(I added several test cases for this, but in this case it's better that
someone else also tests this throughly).
Lars has promosed to do this.
BitKeeper/etc/ignore:
added mysys/test_bitmap
include/base64.h:
Removed my_global.h, as this must be included first in any program
include/heap.h:
Added heap_reset() (Required by new handler interface)
include/my_base.h:
Removed HA_EXTRA_RESET. MySQL will now call ::reset() instead of ::extra(HA_EXTRA_RESET).
HA_EXTRA_RETRIVE_ALL_COLS and HA_EXTRA_RETRIVE_PRIMARY key are deleted as the column bitmaps makes these unnecessary
include/my_bitmap.h:
Remove my_pthread.h (should be included at upper level)
Introduced my_bitmap_map typedef to make it the bitmap handling more like a black box
Added bitmap_is_overlapping(), bitmap_test_and_clear(), bitmap_copy() and bitmap_cmp()
Made bitmap_set_bit(), bitmap_flip_bit(), bitmap_clear_bit() return void
include/myisam.h:
Added mi_reset() (Required by new handler interface)
include/myisammrg.h:
Added myrg_reset() (Required by new handler interface)
include/mysql_com.h:
Added flag FIELD_IN_ADD_INDEX to be able to remove Field->add_index
mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test:
Added testing of CREATE ... SELECT in a mixed environment
(This found some bugs that Mats is going to fix shortly)
mysql-test/install_test_db.sh:
Simplify ldata usage
Added --tmpdir=. option to mysqld bootstrap (Removed some warnings when TMPDIR was wrongly set)
mysql-test/mysql-test-run.pl:
Added --tmpdir=. to bootstrap
mysql-test/mysql-test-run.sh:
Use copy instead of INSTALL_DB for master and slave databases.
(Speeds up startup time a lot!)
Remove snapshot directories at startup (removes some strange warnings)
mysql-test/r/binlog_row_mix_innodb_myisam.result:
Added testing of CREATE ... SELECT in a mixed environment
(This found some bugs that Mats is going to fix shortly)
mysql-test/r/binlog_stm_mix_innodb_myisam.result:
Added testing of CREATE ... SELECT in a mixed environment
mysql-test/r/create.result:
Some extra tests of warnings and number of tables opened by CREATE ... SELECT
mysql-test/r/federated.result:
Drop some left over tables
Added testing of multiple table update and multiple table delete (with and without keys)
mysql-test/r/func_gconcat.result:
Enable some disabled tests (converted them slightly to be predictable)
mysql-test/r/func_time.result:
Added drop of test function
mysql-test/r/innodb_mysql.result:
Added tests for CREATE ... SELECT
mysql-test/r/insert.result:
More tests
Added testing of duplicate columns in insert
mysql-test/r/loaddata.result:
Added testing LOAD DATA ... SET ...
mysql-test/r/multi_update.result:
Test multi updates and deletes using primary key and without
mysql-test/r/ndb_index_unique.result:
Better error message
mysql-test/r/ndb_replace.result:
New correct result after fixing REPLACE handling with NDB
mysql-test/r/rpl_ddl.result:
Now we don't get these (wrong) warnings anymore
mysql-test/r/view_grant.result:
Drop used views
mysql-test/t/create.test:
Some extra tests of warnings and number of tables opened by CREATE ... SELECT
mysql-test/t/federated.test:
Drop some left over tables
Added testing of multiple table update and multiple table delete (with and without keys)
mysql-test/t/func_gconcat.test:
Enable some disabled tests (converted them slightly to be predictable)
mysql-test/t/func_time.test:
Added drop of test function
mysql-test/t/innodb_mysql.test:
Added tests for CREATE ... SELECT
mysql-test/t/insert.test:
More tests
Added testing of duplicate columns in insert
mysql-test/t/loaddata.test:
Added testing LOAD DATA ... SET ...
mysql-test/t/multi_update.test:
Test multi updates and deletes using primary key and without
mysql-test/t/view_grant.test:
Drop used views
mysql-test/valgrind.supp:
Added supression of not needed warnings when printing stack trace
mysys/base64.c:
Include my_global.h first
mysys/my_bitmap.c:
Added bitmap_is_overlapping(), bitmap_test_and_clear() and bitmap_copy()
Changed logic of bitmap handling to be a bit more efficent (Did this together with Mikael Ronström)
Now the 'extra, not used bits' in the bitmap are assumed to have a 'random value' and the bitmap functions are free to change them whenever needed.
Changed how mutex is allocated to make 'bitmap_free()' function simpler.
mysys/thr_lock.c:
Added 0x before thread pointers (for easier comparison of DBUG traces)
sql/event.cc:
Ensure 'use_all_columns()' is used for event tables
Don't print warning that event table is damaged if it doesn't exists.
sql/field.cc:
Added ASSERT_COLUMN_MARKED_FOR_WRITE in all store() methods and ASSERT_COLUMN_MARKED_FOR_READ in all val() methods to catch wrong setting if table->read_set and table->write_set
(Rest of changes are only indentation cleanups)
sql/field.h:
Removed Field->query_id (replaced by table->read_set and table->write_set)
Removed Field->fieldnr (use Field->field_index instead)
Removed Field->add_index (Use Field->flags instead)
Add Field->part_of_key_not_clustered (for usage in opt_range.cc)
sql/filesort.cc:
Added paramater sort_postion to filesort() to force sorting by position instead of storing all fields in the result set.
This allowed me to remove checking of sql_command.
Create a temporary column bitmap for fields that are used by the sorting process.
Use column bitmaps instead of query_id
sql/ha_berkeley.cc:
Update to 'newer' table handler interface
sql/ha_berkeley.h:
Update to 'newer' table handler interface
sql/ha_federated.cc:
Update to 'newer' table handler interface
Only read columns that are needed from remote server.
In case of eq ranges, don't generate two conditions in the WHERE clause
(this can still be optimized, but would require a bigger code change)
Use 'simpler to use' XXXX_LEN' macros
A bit simpler logic in ::write_row() when creating statements.
In update, only include test of fields actually read.
(This greatly simplifies the queries sent by the federated engine)
Similar changes done for delete_row()
sql/ha_federated.h:
Update to 'newer' table handler interface
Changed XXX_LEN macros to use sizeof(...)-1, to simplify usage in ha_federated.cc
Added HA_PRIMARY_KEY_REQUIRED_FOR_DELETE to tell MySQL to read all primary key columns in case of DELETE
sql/ha_heap.cc:
Update to 'newer' table handler interface
sql/ha_heap.h:
Update to 'newer' table handler interface
sql/ha_innodb.cc:
Update to 'newer' table handler interface
- Update innobase_create_handler() to new interface
- Removed HA_NOT_EXACT_COUNT (not needed)
- Renamed HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS to HA_PRIMARY_KEY_REQUIRED_FOR_POSITION.
- Prefixed base status variables with 'stats'
- Use table column bitmaps instead of ha_get_bit_in_read_set()
- Added ::reset(), with code from ::extra(HA_EXTRA_RESET)
- Removed HA_EXTRA_RETRIVE_ALL_COLS and HA_EXTRA_RETRIEVE_PRIMARY_KEY as
the table->read_set and table->write_set bitmaps now are accurate
sql/ha_innodb.h:
Update to 'newer' table handler interface
- table_flags are now ulonglong
- Added reset() method
- Removed not needed ha_retrieve_all_cols() and ha_retrieve_all_pk() columns.
- Made build_template() a class function to be able to easier access class variables
sql/ha_myisam.cc:
Update to 'newer' table handler interface
sql/ha_myisam.h:
Update to 'newer' table handler interface
sql/ha_myisammrg.cc:
Update to 'newer' table handler interface
sql/ha_myisammrg.h:
Update to 'newer' table handler interface
sql/ha_ndbcluster.cc:
Update to 'newer' table handler interface
Fixed use_blob_value() to be accurate
In ::complemented_read() we have to check both the read and write bitmap as the old code did mark all changed columns also in the read map
Correct dumping of field data with DBUG_DUMP
Prefix addresses in DBUG_PRINT with 0x
Fixed usage of not initialized memory
Update to use field->flags & FIELD_IN_ADD_INDEX instead of field->add_index.
sql/ha_ndbcluster.h:
Update to 'newer' table handler interface
sql/ha_ndbcluster_binlog.cc:
Mark usage of all columns in ndbcluster binlog tables
false -> FALSE, true -> TRUE
Use table->s->all_set instead of creating a temporary bitmap.
sql/ha_partition.cc:
Update to 'newer' table handler interface
Added memroot to initialise_partitions() and related functions to get faster memory allocation.
partition_create_handler() is now responsible for initialisation of the partition object
Some trivial optimizations and indentation fixes
Ensure that table_flags() are up to date
Removed documentation for removed HA_EXTRA flags
Fixed 'strange' usage of m_file[i] in new_handlers_from_part_info()that worked in current code 'by chance'
sql/ha_partition.h:
Update to 'newer' table handler interface
sql/handler.cc:
create_xxx handler now takes MEMROOT as an argument to simplify memory allocation.
Much simpler get_new_handler()
(Initialization of the object is now handled by the create method for the engine)
Moved all allocation of bitmap handling to the TABLE object (in table.cc)
Added column_bitmaps_signal() to signal column usage changes.
Changed binlog_log_row() to use the exiusting all_set bitmap in the table object.
Added ha_reset() function to test that the file object is ok at end of statement and call handler::reset()
Added use_hidden_primary_key() to signal handler that we we are going to read and update + delete the row and the handler should thus remember the position for the row
sql/handler.h:
Added HA_NO_TRANSACTIONS, HA_PARTIAL_COLUMN_READ, HA_REQUIRES_KEY_COLUMNS_FOR_DELETE,HA_PRIMARY_KEY_REQUIRED_FOR_DELETE and HA_HAS_RECORDS
Removed HA_NOT_EXACT_COUNT, HA_READ_RND_SAME
HA_DUPP_POS -> HA_DUPLICATE_POS
HA_NOT_EXACT_COUNT replaced by HA_STATS_RECORDS_IS_EXACT, HA_HAS_RECORDS and records()
HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS renamed to HA_PRIMARY_KEY_REQUIRED_FOR_POSITION
Added future row type 'ROW_TYPE_PAGES'
Added MEM_ROOT to handlerton 'create' function
Added ha_statistics, a structure for all status variable in the base handler class.
Moved all status variables in the handler class into a stats structs to improve readability.
ha_table_flags() is now a cached (not virtual) version of table_flags()
reset() doesn't anymore call extra(HA_EXTRA_RESET) but is a function of it's own.
Renamed dupp_ref to dup_ref
Renamed not used handler::sortkey
Moved read_set and write_set to TABLE structure
handler::init() function added for cacheing of virtual constants from engine.
sql/item.cc:
Added register_field_in_read_map() for marking used columns in expression.
This is used by filesort() for creating an optimal column bitmap while retrieving columns for sorting.
Initalize value.cs_info.character_set_client to fix core dump bug with --debug
set_query_id -> mark_used_columns
Mark used columns in read_set OR write_set.
sql/item.h:
Removed reset_query_id_processor() as it's not needed anymore.
Added register_field_in_read_map()
Added extra argument to Item::walk() to indicate if we should also
traverse sub queries.
sql/item_cmpfunc.cc:
Temporary mark used columns to be read/writable
Update Item::walk to new interface
sql/item_cmpfunc.h:
Added extra argument to Item::walk() to indicate if we should also traverse sub queries.
sql/item_func.cc:
Update Item::walk() to new interface
table_flags() -> ha_table_flags()
sql/item_func.h:
Update Item::walk() to new interface
sql/item_row.cc:
Update Item::walk() to new interface
sql/item_row.h:
Update Item::walk() to new interface
sql/item_strfunc.h:
Update Item::walk() to new interface
sql/item_subselect.cc:
Added Item_subselect::walk()
(It was a bug it was missing before. Not sure what kind of bugs this could have caused)
sql/item_subselect.h:
Update Item::walk() to new interface
sql/item_sum.cc:
Update Item::walk() to new interface
Updates for new handler interace
sql/item_sum.h:
Update Item::walk() to new interface
sql/key.cc:
Updates for new handler interace
sql/log.cc:
Mark all columns used for log tables
Split options flag
Ensured that second argument to trans_register_ha is a bool
sql/log_event.cc:
Fixed comments to be withing 79 characters
Use OPTION_KEEP_LOG instead of OPTION_STATUS_NO_TRANS_UPDATE to remove wrong warnings
Updates for new handler interface
Use 0x%lx instead of %p (portability problem)
sql/mysql_priv.h:
Added OPTION_KEEP_LOG to indicate that we should replicate the binlog even on rollback
Removed not used 'conds' argument to setup_tables
sql/mysqld.cc:
Indentation fixes and removed old comment
sql/opt_range.cc:
Update to new handler and bitmap interface.
Fixed calls to cp_buffer_from_ref() and walk() (new argument).
Create new temporary bitmaps for ror scans.
(Needed because of handler changes and to get more accurate column bitmaps than before)
Remove not needed file->ha_reset() call before file->close().
Some trivial optimization and indentation fixes.
Use Field->part_of_key_not_clustered() to check if field is part of a key, instead of looping over all key parts.
Added flag 'in_ror_merged_scan' to allow ::get_next() to know that we need a special column bitmap to only fetch pointer to record.
This is needed because ror scan uses the same TABLE object but different file objects, which creates problem for the column bitmap handling.
(This is a temporary solution. A better one would be to allocate an own TABLE object for ROR scans)
Optimized bitmap handling in ror scans:
- Start bitmap at position 0, not 1
- Use same bitmap size as in TABLE
- Use table->read_set and table->write_set to create column bitmaps instead of looping over all fields in table
sql/opt_range.h:
Added 'in_ror_merged_scan' to indicate if we are doing a ROR scan
Added temporary column bitmaps used in ROR scans
sql/opt_sum.cc:
Added get_ext_record_count() which is used in COUNT() optimization if handler has HA_HAS_RECORDS
Note that we don't call this if handler has HA_STATS_RECORDS_IS_EXACT set.
sql/protocol.cc:
We need to mark columns as readable in ::store() as we sometimes return default value for fields to the user
sql/records.cc:
Updates for new handler interface
sql/set_var.cc:
Handle splitting OPTION_STATUS_NO_TRANS_UPDATE to two flags
sql/share/errmsg.txt:
Fixed wrong
sql/sp.cc:
Mark that we are using all columns for the proc table
Update call to setup_tables() to use new prototype
sql/sp_head.cc:
Removed QQ comment
sql/spatial.cc:
Removed wrong QQ comment
sql/sql_acl.cc:
Mark that we need all columns for acl tables
Supply memroot to some 'new' calls.
Indentation fixes
sql/sql_base.cc:
set_query_id removed
Ensure we call ha_reset() at end of each statement
Mark read columns in read_set and changed columns in write_set (Before all columns was marked in read set)
Fixed marking of some columns that was not proplerly marked before
Maintain in TABLE->merge_keys set of all keys that are used in some way
Removed not used 'conds' argument from setup_tables()
Remove not used setting of 'dupp_field' in insert_fields()
Added missing FN_LIBCHAR in mysql_rm_tmp_tables()
(This has probably caused us to not properly remove temporary files after crash)
sql/sql_bitmap.h:
Added is_overlapping()
sql/sql_class.cc:
Slow_logs was not properly initialized, which could maybe cause extra/lost entries in slow log.
set_query_id -> mark_used_columns
Simpler variable usage in pack_row() (cleanup)
Moved some variable declartion at start of function for better code readability
sql/sql_class.h:
Added enum_mark_columns
Updated comments
Renamed dupp_field -> dup_field
Added virtual function 'can_rollback_data()' to select_insert() to be used in CREATE ... SELECT to optimize use of OPTION_STATUS_NO_TRANS_UPDATE.
(This fixes a bug in CREATE ... SELECT where we did give wrong warnings when using non transacational tables)
sql/sql_delete.cc:
Updates to new handler interface
Call table->mark_columns_needed_for_delete() to allow us to put additional columns in column usage maps if handler so requires.
Call table->prepare_for_position() to tell handler that we are going to call ha_position().
Removed call to free_io_cache(). (io_cache is now removed in ha_reset()).
Fixed calls to setup_tables()
sql/sql_do.cc:
Update call to setup_fields()
sql/sql_handler.cc:
Tell handler tables to always read all columns.
Use temporary column map when storing value in field for later index usage
sql/sql_help.cc:
Makr all used fields to be read
Update call to setup_fields()
sql/sql_insert.cc:
Tell handler we are going to update the auto_increment column
dupp_field -> dup_field
Set column usage bits for timestamp field.
Call table->mark_columns_needed_for_insert() and table->mark_auto_increment_column()
Removed not used argument from mysql_prepare_insert_check_table().
If we get an duplicate row on insert, change column map to read and write all columns while retrying the operatation.
This is required by the definition of REPLACE and also ensures that fields that are only part of UPDATE are properly handled.
This fixed a bug in NDB and REPLACE where REPLACE wrongly copied some column values from the replaced row.
Setup new bitmaps for delayed insert rows
Remove reseting of next_number_fields as it will be reset on next call to handler_insert()
Fixed usage of thd->options and OPTION_STATUS_NO_TRANS_UPDATE.
The issue was that one should not to reset this flag as it may be set by a previous statement.
The way it was now used caused us to loose some warnings and get other wrong warnings when using non transactional tables mixed with transactional.
I fixed it by introducing 'select_insert::can_rollback_data' to inform send_error() that the given statement can be rolled back (which in case of CREATE TABLE can always be done)
Don't close tables created with CREATE ... SELECT but keep them in the table cache.
Moved out MY_HOOKS from inside function (better readability)
sql/sql_load.cc:
Update to use new handler and column marking interface
Update using setup_tables()
sql/sql_olap.cc:
Update calls to setup_tables
Use enums instead of constants to setup_fields()
sql/sql_parse.cc:
Handle OPTION_KEEP_LOG:
- Set it on CREATE TEMPORARY TABLE / DROP TABLE
- Reset it when OPTION_STATUS_NO_TRANS_UPDATE is reset
- Don't set it for CREATE ... SELECT (this is handled in select_create class)
Remove reseting of OPTION_STATUS_NO_TRANS_UPDATE in begin_trans() as this should already be reset.
If in autocommit mode, reset OPTION_KEEP_LOG and OPTION_STATUS_NO_TRANS_UPDATE to not give warnings in future commands
sql/sql_partition.cc:
Update walk() usage
Trivial indentation fixes
sql/sql_plugin.cc:
Mark all columns as used for plugins
sql/sql_prepare.cc:
Added assert to find out hidden bugs in character_set_client (got an error in debug binary when this not set correctly)
Updates for new handler interface
Update calls to setup_fields()
sql/sql_repl.cc:
Indentation fixes
sql/sql_select.cc:
Update call to setup_tables() and setup_fields()
Remove some old disabled code
Update to new hadler interface
Indentation cleanups
Added column bitmaps for temporary tables.
Remove updating of the removed slots in the Field class
Added TABLE argument to cp_buffer_from_ref() (To be able to install temporary column maps)
For internal temporary tables, use handler::write_row(), handler::delete_row() and handler::update_row() instead of handler::ha_xxxx() for faster execution.
sql/sql_select.h:
Indentaition fixes.
Install temporary column usage maps when needed
Added TABLE element to cp_buffer_from_ref()
sql/sql_show.cc:
Update to new handler interface
Mark all columns used for internal tables.
Style fixes.
Added support for 'future' ROW_TYPE_PAGES.
Don't allocate TMP_TABLE_PARAM with calloc. The 'init()' function will initialize the structure properly.
sql/sql_table.cc:
Update to new handler interface
Simple my_snprintf -> strmake()
Changed some constants to defines
Don't test for NULL in primary key (as we a couple of line above force the PRIMARY KEY to be NOT NULL)
Change field->add_index to use field->flags & FIELD_IN_ADD_INDEX
Mark all columns as used for ALTER TABLE
Style fixes
Update call to filesort()
sql/sql_trigger.h:
Added friend functions to be able to test if triggers exists for table we are going to insert/update or delete in.
sql/sql_udf.cc:
Mark all columns as used for udf system table.
sql/sql_union.cc:
Update call to walk()
Update to new handler interface
sql/sql_update.cc:
Remove query_id argument from compare_record()
Use column bitmaps instead of query_id.
We can't use compare_records() to skip updates for handlers that returns a partial column set and the read_set doesn't cover all columns in the write set, because compare_record() can't in this case know if a not read column changed value.
Update call to setup_fields()
Using separate column read and write sets allows for easier checking of timestamp field was set by statement.
Removed call to free_io_cache() as this is now done in ha_reset()
Call table->mark_columns_needed_for_update() and table->prepare_for_position()
Style fixes
sql/sql_view.cc:
Style fixes
sql/table.cc:
Remove implicitely include 'errno.h'
Remove code for building normalized path, as this is now identical to 'path'
Remove field->fieldnr
Added update of field->part_of_key_not_clustered()
Create column bitmaps in TABLE and TABLE_SHARE
Don't setup a temporary MEM_ROOT object as a thread specific variable for the handler. Instead we send the to-be-used MEMROOT to get_new_handler()
Update to new handler interface
Update call to walk()
Added new functions:
- st_table::clear_column_bitmaps()
- st_table::prepare_for_position()
- st_table::mark_columns_used_by_index()
- st_table::restore_column_maps_after_mark_index()
- st_table::mark_columns_used_by_index_no_reset()
- st_table::mark_auto_increment_column()
- st_table::mark_columns_needed_for_delete()
- st_table::mark_columns_needed_for_update()
- st_table::mark_columns_needed_for_insert()
sql/table.h:
Moved column usage bitmaps from handler to TABLE
Added to TABLE_SHARE all_set and column_bitmap_size
Added to TABLE merge_keys, bitmap_init_values, def_read_set, def_write_set, tmp_set, read_set and write_set.
Declared all new table column bitmap functions
Added TABLE functions column_bitmaps_set(), column_bitmaps_set_no_signal(), use_all_columns() and default_column_bitmaps()
Added functions: tmp_use_all_columns() and tmp_restore_column_map() to temporarly switch column bitmaps
Added functions: dbug_tmp_use_all_columns() and dbug_tmp_restore_column_map() to temporarly switch column bitmaps to avoid asserts in Field::store() and Field::val().
sql/tztime.cc:
Mark all columns as used for timezone tables
storage/archive/ha_archive.cc:
Update to new handler interface
storage/archive/ha_archive.h:
Update to new handler interface
storage/blackhole/ha_blackhole.cc:
Update to new handler interface
storage/blackhole/ha_blackhole.h:
Update to new handler interface
removed not needed flag HA_DUPP_POS
storage/csv/ha_tina.cc:
Update to new handler interface
storage/csv/ha_tina.h:
Update to new handler interface
storage/example/ha_example.cc:
Update to new handler interface
storage/example/ha_example.h:
Update to new handler interface
storage/heap/hp_extra.c:
Added heap_reset() (Required by new handler interface)
storage/heap/hp_test2.c:
Use heap_reset()
storage/myisam/ft_boolean_search.c:
Fixed compiler warning
storage/myisam/mi_extra.c:
Added mi_reset() (Required by new handler interface)
storage/myisam/mi_search.c:
Fixed DBUG_PRINT messages to use 0x%lx instead of %lx
storage/myisam/mi_test2.c:
Use mi_reset()
storage/myisam/myisampack.c:
Use mi_reset()
storage/myisammrg/myrg_extra.c:
Added myrg_reset() (Required by new handler interface)
unittest/mysys/base64.t.c:
Include my_global.h
Don't include implictely include file 'stdlib.h'
2006-06-04 17:52:22 +02:00
|
|
|
value or not. If it does this flag is set.
|
2005-07-18 13:31:02 +02:00
|
|
|
Only MyISAM and HEAP uses exact count.
|
|
|
|
|
|
|
|
HA_CAN_INSERT_DELAYED:
|
|
|
|
Can the storage engine support delayed inserts.
|
|
|
|
To start with the partition handler will not support delayed inserts.
|
|
|
|
Further investigation needed.
|
|
|
|
(HEAP, MyISAM)
|
|
|
|
|
|
|
|
HA_PRIMARY_KEY_IN_READ_INDEX:
|
|
|
|
This parameter is set when the handler will also return the primary key
|
|
|
|
when doing read-only-key on another index.
|
|
|
|
|
|
|
|
HA_NOT_DELETE_WITH_CACHE:
|
|
|
|
Seems to be an old MyISAM feature that is no longer used. No handler
|
|
|
|
has it defined but it is checked in init_read_record.
|
|
|
|
Further investigation needed.
|
|
|
|
(No handler defines it)
|
|
|
|
|
|
|
|
HA_NO_PREFIX_CHAR_KEYS:
|
|
|
|
Indexes on prefixes of character fields is not allowed.
|
2014-08-21 18:11:46 +02:00
|
|
|
(Federated)
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
HA_CAN_FULLTEXT:
|
|
|
|
Does the storage engine support fulltext indexes
|
|
|
|
The partition handler will start by not supporting fulltext indexes.
|
|
|
|
(MyISAM)
|
|
|
|
|
|
|
|
HA_CAN_SQL_HANDLER:
|
|
|
|
Can the HANDLER interface in the MySQL API be used towards this
|
|
|
|
storage engine.
|
|
|
|
(MyISAM, InnoDB)
|
|
|
|
|
|
|
|
HA_NO_AUTO_INCREMENT:
|
|
|
|
Set if the storage engine does not support auto increment fields.
|
|
|
|
(Currently not set by any handler)
|
|
|
|
|
|
|
|
HA_HAS_CHECKSUM:
|
|
|
|
Special MyISAM feature. Has special SQL support in CREATE TABLE.
|
|
|
|
No special handling needed by partition handler.
|
|
|
|
(MyISAM)
|
|
|
|
|
|
|
|
HA_FILE_BASED:
|
|
|
|
Should file names always be in lower case (used by engines
|
|
|
|
that map table names to file names.
|
|
|
|
Since partition handler has a local file this flag is set.
|
2014-08-21 18:11:46 +02:00
|
|
|
(Federated, MyISAM)
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
HA_CAN_BIT_FIELD:
|
|
|
|
Is the storage engine capable of handling bit fields?
|
2014-08-21 18:11:46 +02:00
|
|
|
(MyISAM)
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
HA_NEED_READ_RANGE_BUFFER:
|
|
|
|
Is Read Multi-Range supported => need multi read range buffer
|
|
|
|
This parameter specifies whether a buffer for read multi range
|
|
|
|
is needed by the handler. Whether the handler supports this
|
|
|
|
feature or not is dependent of whether the handler implements
|
|
|
|
read_multi_range* calls or not. The only handler currently
|
|
|
|
supporting this feature is NDB so the partition handler need
|
|
|
|
not handle this call. There are methods in handler.cc that will
|
|
|
|
transfer those calls into index_read and other calls in the
|
|
|
|
index scan module.
|
2014-08-21 18:11:46 +02:00
|
|
|
(No handler defines it)
|
2008-10-29 21:20:04 +01:00
|
|
|
|
|
|
|
HA_PRIMARY_KEY_REQUIRED_FOR_POSITION:
|
|
|
|
Does the storage engine need a PK for position?
|
|
|
|
(InnoDB)
|
|
|
|
|
|
|
|
HA_FILE_BASED is always set for partition handler since we use a
|
|
|
|
special file for handling names of partitions, engine types.
|
|
|
|
HA_REC_NOT_IN_SEQ is always set for partition handler since we cannot
|
|
|
|
guarantee that the records will be returned in sequence.
|
2017-09-25 23:56:10 +02:00
|
|
|
HA_DUPLICATE_POS,
|
2008-10-29 21:20:04 +01:00
|
|
|
HA_CAN_INSERT_DELAYED, HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is disabled
|
|
|
|
until further investigated.
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
Table_flags table_flags() const override;
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
This is a bitmap of flags that says how the storage engine
|
|
|
|
implements indexes. The current index flags are documented in
|
|
|
|
handler.h. If you do not implement indexes, just return zero
|
|
|
|
here.
|
|
|
|
|
|
|
|
part is the key part to check. First key part is 0
|
|
|
|
If all_parts it's set, MySQL want to know the flags for the combined
|
|
|
|
index up to and including 'part'.
|
|
|
|
|
|
|
|
HA_READ_NEXT:
|
|
|
|
Does the index support read next, this is assumed in the server
|
|
|
|
code and never checked so all indexes must support this.
|
|
|
|
Note that the handler can be used even if it doesn't have any index.
|
2014-08-21 18:11:46 +02:00
|
|
|
(HEAP, MyISAM, Federated, InnoDB)
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
HA_READ_PREV:
|
|
|
|
Can the index be used to scan backwards.
|
2014-08-21 18:11:46 +02:00
|
|
|
(HEAP, MyISAM, InnoDB)
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
HA_READ_ORDER:
|
|
|
|
Can the index deliver its record in index order. Typically true for
|
|
|
|
all ordered indexes and not true for hash indexes.
|
|
|
|
In first step this is not true for partition handler until a merge
|
|
|
|
sort has been implemented in partition handler.
|
|
|
|
Used to set keymap part_of_sortkey
|
|
|
|
This keymap is only used to find indexes usable for resolving an ORDER BY
|
|
|
|
in the query. Thus in most cases index_read will work just fine without
|
|
|
|
order in result production. When this flag is set it is however safe to
|
|
|
|
order all output started by index_read since most engines do this. With
|
|
|
|
read_multi_range calls there is a specific flag setting order or not
|
|
|
|
order so in those cases ordering of index output can be avoided.
|
2014-08-21 18:11:46 +02:00
|
|
|
(InnoDB, HEAP, MyISAM)
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
HA_READ_RANGE:
|
|
|
|
Specify whether index can handle ranges, typically true for all
|
|
|
|
ordered indexes and not true for hash indexes.
|
|
|
|
Used by optimiser to check if ranges (as key >= 5) can be optimised
|
|
|
|
by index.
|
2014-08-21 18:11:46 +02:00
|
|
|
(InnoDB, MyISAM, HEAP)
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
HA_ONLY_WHOLE_INDEX:
|
|
|
|
Can't use part key searches. This is typically true for hash indexes
|
|
|
|
and typically not true for ordered indexes.
|
2014-08-21 18:11:46 +02:00
|
|
|
(Federated, HEAP)
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
HA_KEYREAD_ONLY:
|
|
|
|
Does the storage engine support index-only scans on this index.
|
|
|
|
Enables use of HA_EXTRA_KEYREAD and HA_EXTRA_NO_KEYREAD
|
|
|
|
Used to set key_map keys_for_keyread and to check in optimiser for
|
|
|
|
index-only scans. When doing a read under HA_EXTRA_KEYREAD the handler
|
|
|
|
only have to fill in the columns the key covers. If
|
|
|
|
HA_PRIMARY_KEY_IN_READ_INDEX is set then also the PRIMARY KEY columns
|
|
|
|
must be updated in the row.
|
2014-08-21 18:11:46 +02:00
|
|
|
(InnoDB, MyISAM)
|
2005-07-18 13:31:02 +02:00
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
ulong index_flags(uint inx, uint part, bool all_parts) const override
|
2005-07-18 13:31:02 +02:00
|
|
|
{
|
2011-05-18 18:26:30 +02:00
|
|
|
/*
|
|
|
|
The following code is not safe if you are using different
|
|
|
|
storage engines or different index types per partition.
|
|
|
|
*/
|
2023-02-13 14:54:13 +01:00
|
|
|
ulong part_flags= m_file[0]->index_flags(inx, part, all_parts);
|
|
|
|
|
|
|
|
/*
|
|
|
|
The underlying storage engine might support Rowid Filtering. But
|
|
|
|
ha_partition does not forward the needed SE API calls, so the feature
|
|
|
|
will not be used.
|
|
|
|
|
|
|
|
Note: It's the same with IndexConditionPushdown, except for its variant
|
|
|
|
of IndexConditionPushdown+BatchedKeyAccess (that one works). Because of
|
|
|
|
that, we do not clear HA_DO_INDEX_COND_PUSHDOWN here.
|
|
|
|
*/
|
|
|
|
return part_flags & ~HA_DO_RANGE_FILTER_PUSHDOWN;
|
2005-07-18 13:31:02 +02:00
|
|
|
}
|
|
|
|
|
Bug#37453: Dropping/creating index on partitioned table with
InnoDB Plugin locks table
The fast/on-line add/drop index handler calls was not implemented
whithin the partitioning.
This implements it in the partitioning handler.
Since this is only used by the not included InnoDB plugin, there
is no test case. (Have tested it manually with the plugin, and
it does not allow unique indexes not including partitioning
function, or removal of pk, which in innodb generates a new pk,
which is not in the partitioning function.)
NOTE: This introduces a new handler method, and because of that
changes the storage engine api. (One cannot use a handlerton to
see the capabilities of a table's handler if it is partitioned.
So I added a wrapper function in the handler that defaults to
the handlerton function, which the partitioning handler overrides.
sql/ha_partition.cc:
Bug#37453: Dropping/creating index on partitioned table with
InnoDB Plugin locks table
Added support for fast/on-line add/drop index.
Implemented alter_table_flags as bit-or of the partitioned
hton and the first partitions alter_table_flags.
It is only to forward the calls for the other functions:
check_if_incompatible_data
add_index
prepare_drop_index
final_drop_index
to all parts handler
sql/ha_partition.h:
Bug#37453: Dropping/creating index on partitioned table with
InnoDB Plugin locks table
Added support for fast/on-line add/drop index.
sql/handler.h:
Bug#37453: Dropping/creating index on partitioned table with
InnoDB Plugin locks table
Added the function on handler level, defaulting to use
the handlerton function, but a handler can override it.
Needed for partitioned tables.
NOTE: Change of storage engine api.
sql/sql_partition.cc:
Bug#37453: Dropping/creating index on partitioned table with
InnoDB Plugin locks table
Using the new handler function, instead of the handlerton
function. This works better with the partitioning handler.
sql/sql_table.cc:
Bug#37453: Dropping/creating index on partitioned table with
InnoDB Plugin locks table
Using the new handler function, instead of the handlerton
function. This works better with the partitioning handler.
Also using new process info for 'manage keys' (kind of fix
for bug-37550).
2008-10-05 00:40:30 +02:00
|
|
|
/**
|
|
|
|
wrapper function for handlerton alter_table_flags, since
|
|
|
|
the ha_partition_hton cannot know all its capabilities
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
alter_table_operations alter_table_flags(alter_table_operations flags)
|
|
|
|
override;
|
2005-07-18 13:31:02 +02:00
|
|
|
/*
|
|
|
|
unireg.cc will call the following to make sure that the storage engine
|
|
|
|
can handle the data it is about to send.
|
|
|
|
|
|
|
|
The maximum supported values is the minimum of all handlers in the table
|
|
|
|
*/
|
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
partition_pruning etc are becasue partitions can now more exactly
calculate the number of rows in a range.
Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-07-05 17:20:06 +02:00
|
|
|
uint min_of_the_max_uint(uint (handler::*operator_func)(void) const) const;
|
2020-02-28 13:01:27 +01:00
|
|
|
uint max_supported_record_length() const override;
|
|
|
|
uint max_supported_keys() const override;
|
|
|
|
uint max_supported_key_parts() const override;
|
|
|
|
uint max_supported_key_length() const override;
|
|
|
|
uint max_supported_key_part_length() const override;
|
|
|
|
uint min_record_length(uint options) const override;
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
MODULE compare records
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
cmp_ref checks if two references are the same. For most handlers this is
|
|
|
|
a simple memcmp of the reference. However some handlers use primary key
|
|
|
|
as reference and this can be the same even if memcmp says they are
|
|
|
|
different. This is due to character sets and end spaces and so forth.
|
|
|
|
For the partition handler the reference is first two bytes providing the
|
|
|
|
partition identity of the referred record and then the reference of the
|
|
|
|
underlying handler.
|
|
|
|
Thus cmp_ref for the partition handler always returns FALSE for records
|
|
|
|
not in the same partition and uses cmp_ref on the underlying handler
|
|
|
|
to check whether the rest of the reference part is also the same.
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
int cmp_ref(const uchar * ref1, const uchar * ref2) override;
|
2005-07-18 13:31:02 +02:00
|
|
|
/*
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
MODULE auto increment
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
This module is used to handle the support of auto increments.
|
|
|
|
|
|
|
|
This variable in the handler is used as part of the handler interface
|
|
|
|
It is maintained by the parent handler object and should not be
|
|
|
|
touched by child handler objects (see handler.cc for its use).
|
|
|
|
|
|
|
|
auto_increment_column_changed
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
bool need_info_for_auto_inc() override;
|
|
|
|
bool can_use_for_auto_inc_init() override;
|
|
|
|
void get_auto_increment(ulonglong offset, ulonglong increment,
|
|
|
|
ulonglong nb_desired_values,
|
|
|
|
ulonglong *first_value,
|
|
|
|
ulonglong *nb_reserved_values) override;
|
|
|
|
void release_auto_increment() override;
|
Bug#38804: Query deadlock causes all tables to be inaccessible.
Problem was a mutex added in bug n 27405 for solving a problem
with auto_increment in partitioned innodb tables.
(in ha_partition::write_row over partitions file->ha_write_row)
Solution is to use the patch for bug#33479, which refines the
usage of mutexes for auto_increment.
Backport of bug-33479 from 6.0:
Bug-33479: auto_increment failures in partitioning
Several problems with auto_increment in partitioning
(with MyISAM, InnoDB. Locking issues, not handling
multi-row INSERTs properly etc.)
Changed the auto_increment handling for partitioning:
Added a ha_data variable in table_share for storage engine specific data
such as auto_increment value handling in partitioning, also see WL 4305
and using the ha_data->mutex to lock around read + update.
The idea is this:
Store the table's reserved auto_increment value in
the TABLE_SHARE and use a mutex to, lock it for reading and updating it
and unlocking it, in one block. Only accessing all partitions
when it is not initialized.
Also allow reservations of ranges, and if no one has done a reservation
afterwards, lower the reservation to what was actually used after
the statement is done (via release_auto_increment from WL 3146).
The lock is kept from the first reservation if it is statement based
replication and a multi-row INSERT statement where the number of
candidate rows to insert is not known in advance (like INSERT SELECT,
LOAD DATA, unlike INSERT VALUES (row1), (row2),,(rowN)).
This should also lead to better concurrancy (no need to have a mutex
protection around write_row in all cases)
and work with any local storage engine.
mysql-test/suite/parts/inc/partition_auto_increment.inc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Test source file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_archive.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_innodb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_memory.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_ndb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_archive.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_blackhole.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_innodb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_memory.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_myisam.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_ndb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
sql/ha_partition.cc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Changed ha_partition::get_auto_increment from file->get_auto_increment
to file->info(HA_AUTO_STATUS), since it is works better with InnoDB
(InnoDB can have issues with partitioning and auto_increment,
where get_auto_increment sometimes can return a non updated value.)
Using the new table_share->ha_data for keeping the auto_increment
value, shared by all instances of the same table.
It is read+updated when holding a auto_increment specific mutex.
Also added release_auto_increment to decrease gaps if possible.
And a lock for multi-row INSERT statements where the number of candidate
rows to insert is not known in advance (like INSERT SELECT, LOAD DATA;
Unlike INSERT INTO (row1),(row2),,(rowN)).
Fixed a small bug, copied++ to (*copied)++ and the same for deleted.
Changed from current_thd, to ha_thd()
sql/ha_partition.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a new struct HA_DATA_PARTITION to be used in table_share->ha_data
Added a private function to set auto_increment values if needed
Removed the restore_auto_increment (the hander version is better)
Added lock/unlock functions for auto_increment handling.
Changed copied/deleted to const.
sql/handler.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Added const for changed_partitions
Added comments about SQLCOM_TRUNCATE for delete_all_rows
sql/table.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a variable in table_share: ha_data for storage of storage engine
specific data (such as auto_increment handling in partitioning).
2008-09-08 15:30:01 +02:00
|
|
|
private:
|
2020-02-28 13:01:27 +01:00
|
|
|
int reset_auto_increment(ulonglong value) override;
|
2021-10-13 15:45:26 +02:00
|
|
|
int update_next_auto_inc_val();
|
Bug#38804: Query deadlock causes all tables to be inaccessible.
Problem was a mutex added in bug n 27405 for solving a problem
with auto_increment in partitioned innodb tables.
(in ha_partition::write_row over partitions file->ha_write_row)
Solution is to use the patch for bug#33479, which refines the
usage of mutexes for auto_increment.
Backport of bug-33479 from 6.0:
Bug-33479: auto_increment failures in partitioning
Several problems with auto_increment in partitioning
(with MyISAM, InnoDB. Locking issues, not handling
multi-row INSERTs properly etc.)
Changed the auto_increment handling for partitioning:
Added a ha_data variable in table_share for storage engine specific data
such as auto_increment value handling in partitioning, also see WL 4305
and using the ha_data->mutex to lock around read + update.
The idea is this:
Store the table's reserved auto_increment value in
the TABLE_SHARE and use a mutex to, lock it for reading and updating it
and unlocking it, in one block. Only accessing all partitions
when it is not initialized.
Also allow reservations of ranges, and if no one has done a reservation
afterwards, lower the reservation to what was actually used after
the statement is done (via release_auto_increment from WL 3146).
The lock is kept from the first reservation if it is statement based
replication and a multi-row INSERT statement where the number of
candidate rows to insert is not known in advance (like INSERT SELECT,
LOAD DATA, unlike INSERT VALUES (row1), (row2),,(rowN)).
This should also lead to better concurrancy (no need to have a mutex
protection around write_row in all cases)
and work with any local storage engine.
mysql-test/suite/parts/inc/partition_auto_increment.inc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Test source file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_archive.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_innodb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_memory.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_ndb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_archive.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_blackhole.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_innodb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_memory.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_myisam.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_ndb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
sql/ha_partition.cc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Changed ha_partition::get_auto_increment from file->get_auto_increment
to file->info(HA_AUTO_STATUS), since it is works better with InnoDB
(InnoDB can have issues with partitioning and auto_increment,
where get_auto_increment sometimes can return a non updated value.)
Using the new table_share->ha_data for keeping the auto_increment
value, shared by all instances of the same table.
It is read+updated when holding a auto_increment specific mutex.
Also added release_auto_increment to decrease gaps if possible.
And a lock for multi-row INSERT statements where the number of candidate
rows to insert is not known in advance (like INSERT SELECT, LOAD DATA;
Unlike INSERT INTO (row1),(row2),,(rowN)).
Fixed a small bug, copied++ to (*copied)++ and the same for deleted.
Changed from current_thd, to ha_thd()
sql/ha_partition.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a new struct HA_DATA_PARTITION to be used in table_share->ha_data
Added a private function to set auto_increment values if needed
Removed the restore_auto_increment (the hander version is better)
Added lock/unlock functions for auto_increment handling.
Changed copied/deleted to const.
sql/handler.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Added const for changed_partitions
Added comments about SQLCOM_TRUNCATE for delete_all_rows
sql/table.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a variable in table_share: ha_data for storage of storage engine
specific data (such as auto_increment handling in partitioning).
2008-09-08 15:30:01 +02:00
|
|
|
virtual void lock_auto_increment()
|
|
|
|
{
|
|
|
|
/* lock already taken */
|
|
|
|
if (auto_increment_safe_stmt_log_lock)
|
|
|
|
return;
|
2017-09-27 21:48:05 +02:00
|
|
|
if (table_share->tmp_table == NO_TMP_TABLE)
|
Bug#38804: Query deadlock causes all tables to be inaccessible.
Problem was a mutex added in bug n 27405 for solving a problem
with auto_increment in partitioned innodb tables.
(in ha_partition::write_row over partitions file->ha_write_row)
Solution is to use the patch for bug#33479, which refines the
usage of mutexes for auto_increment.
Backport of bug-33479 from 6.0:
Bug-33479: auto_increment failures in partitioning
Several problems with auto_increment in partitioning
(with MyISAM, InnoDB. Locking issues, not handling
multi-row INSERTs properly etc.)
Changed the auto_increment handling for partitioning:
Added a ha_data variable in table_share for storage engine specific data
such as auto_increment value handling in partitioning, also see WL 4305
and using the ha_data->mutex to lock around read + update.
The idea is this:
Store the table's reserved auto_increment value in
the TABLE_SHARE and use a mutex to, lock it for reading and updating it
and unlocking it, in one block. Only accessing all partitions
when it is not initialized.
Also allow reservations of ranges, and if no one has done a reservation
afterwards, lower the reservation to what was actually used after
the statement is done (via release_auto_increment from WL 3146).
The lock is kept from the first reservation if it is statement based
replication and a multi-row INSERT statement where the number of
candidate rows to insert is not known in advance (like INSERT SELECT,
LOAD DATA, unlike INSERT VALUES (row1), (row2),,(rowN)).
This should also lead to better concurrancy (no need to have a mutex
protection around write_row in all cases)
and work with any local storage engine.
mysql-test/suite/parts/inc/partition_auto_increment.inc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Test source file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_archive.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_innodb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_memory.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_ndb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_archive.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_blackhole.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_innodb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_memory.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_myisam.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_ndb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
sql/ha_partition.cc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Changed ha_partition::get_auto_increment from file->get_auto_increment
to file->info(HA_AUTO_STATUS), since it is works better with InnoDB
(InnoDB can have issues with partitioning and auto_increment,
where get_auto_increment sometimes can return a non updated value.)
Using the new table_share->ha_data for keeping the auto_increment
value, shared by all instances of the same table.
It is read+updated when holding a auto_increment specific mutex.
Also added release_auto_increment to decrease gaps if possible.
And a lock for multi-row INSERT statements where the number of candidate
rows to insert is not known in advance (like INSERT SELECT, LOAD DATA;
Unlike INSERT INTO (row1),(row2),,(rowN)).
Fixed a small bug, copied++ to (*copied)++ and the same for deleted.
Changed from current_thd, to ha_thd()
sql/ha_partition.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a new struct HA_DATA_PARTITION to be used in table_share->ha_data
Added a private function to set auto_increment values if needed
Removed the restore_auto_increment (the hander version is better)
Added lock/unlock functions for auto_increment handling.
Changed copied/deleted to const.
sql/handler.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Added const for changed_partitions
Added comments about SQLCOM_TRUNCATE for delete_all_rows
sql/table.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a variable in table_share: ha_data for storage of storage engine
specific data (such as auto_increment handling in partitioning).
2008-09-08 15:30:01 +02:00
|
|
|
{
|
2013-06-15 17:32:08 +02:00
|
|
|
part_share->lock_auto_inc();
|
2017-09-27 21:48:05 +02:00
|
|
|
DBUG_ASSERT(!auto_increment_lock);
|
|
|
|
auto_increment_lock= TRUE;
|
Bug#38804: Query deadlock causes all tables to be inaccessible.
Problem was a mutex added in bug n 27405 for solving a problem
with auto_increment in partitioned innodb tables.
(in ha_partition::write_row over partitions file->ha_write_row)
Solution is to use the patch for bug#33479, which refines the
usage of mutexes for auto_increment.
Backport of bug-33479 from 6.0:
Bug-33479: auto_increment failures in partitioning
Several problems with auto_increment in partitioning
(with MyISAM, InnoDB. Locking issues, not handling
multi-row INSERTs properly etc.)
Changed the auto_increment handling for partitioning:
Added a ha_data variable in table_share for storage engine specific data
such as auto_increment value handling in partitioning, also see WL 4305
and using the ha_data->mutex to lock around read + update.
The idea is this:
Store the table's reserved auto_increment value in
the TABLE_SHARE and use a mutex to, lock it for reading and updating it
and unlocking it, in one block. Only accessing all partitions
when it is not initialized.
Also allow reservations of ranges, and if no one has done a reservation
afterwards, lower the reservation to what was actually used after
the statement is done (via release_auto_increment from WL 3146).
The lock is kept from the first reservation if it is statement based
replication and a multi-row INSERT statement where the number of
candidate rows to insert is not known in advance (like INSERT SELECT,
LOAD DATA, unlike INSERT VALUES (row1), (row2),,(rowN)).
This should also lead to better concurrancy (no need to have a mutex
protection around write_row in all cases)
and work with any local storage engine.
mysql-test/suite/parts/inc/partition_auto_increment.inc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Test source file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_archive.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_innodb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_memory.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_ndb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_archive.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_blackhole.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_innodb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_memory.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_myisam.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_ndb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
sql/ha_partition.cc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Changed ha_partition::get_auto_increment from file->get_auto_increment
to file->info(HA_AUTO_STATUS), since it is works better with InnoDB
(InnoDB can have issues with partitioning and auto_increment,
where get_auto_increment sometimes can return a non updated value.)
Using the new table_share->ha_data for keeping the auto_increment
value, shared by all instances of the same table.
It is read+updated when holding a auto_increment specific mutex.
Also added release_auto_increment to decrease gaps if possible.
And a lock for multi-row INSERT statements where the number of candidate
rows to insert is not known in advance (like INSERT SELECT, LOAD DATA;
Unlike INSERT INTO (row1),(row2),,(rowN)).
Fixed a small bug, copied++ to (*copied)++ and the same for deleted.
Changed from current_thd, to ha_thd()
sql/ha_partition.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a new struct HA_DATA_PARTITION to be used in table_share->ha_data
Added a private function to set auto_increment values if needed
Removed the restore_auto_increment (the hander version is better)
Added lock/unlock functions for auto_increment handling.
Changed copied/deleted to const.
sql/handler.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Added const for changed_partitions
Added comments about SQLCOM_TRUNCATE for delete_all_rows
sql/table.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a variable in table_share: ha_data for storage of storage engine
specific data (such as auto_increment handling in partitioning).
2008-09-08 15:30:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
virtual void unlock_auto_increment()
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
If auto_increment_safe_stmt_log_lock is true, we have to keep the lock.
|
|
|
|
It will be set to false and thus unlocked at the end of the statement by
|
|
|
|
ha_partition::release_auto_increment.
|
|
|
|
*/
|
2017-09-27 21:48:05 +02:00
|
|
|
if (auto_increment_lock && !auto_increment_safe_stmt_log_lock)
|
Bug#38804: Query deadlock causes all tables to be inaccessible.
Problem was a mutex added in bug n 27405 for solving a problem
with auto_increment in partitioned innodb tables.
(in ha_partition::write_row over partitions file->ha_write_row)
Solution is to use the patch for bug#33479, which refines the
usage of mutexes for auto_increment.
Backport of bug-33479 from 6.0:
Bug-33479: auto_increment failures in partitioning
Several problems with auto_increment in partitioning
(with MyISAM, InnoDB. Locking issues, not handling
multi-row INSERTs properly etc.)
Changed the auto_increment handling for partitioning:
Added a ha_data variable in table_share for storage engine specific data
such as auto_increment value handling in partitioning, also see WL 4305
and using the ha_data->mutex to lock around read + update.
The idea is this:
Store the table's reserved auto_increment value in
the TABLE_SHARE and use a mutex to, lock it for reading and updating it
and unlocking it, in one block. Only accessing all partitions
when it is not initialized.
Also allow reservations of ranges, and if no one has done a reservation
afterwards, lower the reservation to what was actually used after
the statement is done (via release_auto_increment from WL 3146).
The lock is kept from the first reservation if it is statement based
replication and a multi-row INSERT statement where the number of
candidate rows to insert is not known in advance (like INSERT SELECT,
LOAD DATA, unlike INSERT VALUES (row1), (row2),,(rowN)).
This should also lead to better concurrancy (no need to have a mutex
protection around write_row in all cases)
and work with any local storage engine.
mysql-test/suite/parts/inc/partition_auto_increment.inc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Test source file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_archive.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_innodb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_memory.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_ndb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_archive.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_blackhole.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_innodb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_memory.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_myisam.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_ndb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
sql/ha_partition.cc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Changed ha_partition::get_auto_increment from file->get_auto_increment
to file->info(HA_AUTO_STATUS), since it is works better with InnoDB
(InnoDB can have issues with partitioning and auto_increment,
where get_auto_increment sometimes can return a non updated value.)
Using the new table_share->ha_data for keeping the auto_increment
value, shared by all instances of the same table.
It is read+updated when holding a auto_increment specific mutex.
Also added release_auto_increment to decrease gaps if possible.
And a lock for multi-row INSERT statements where the number of candidate
rows to insert is not known in advance (like INSERT SELECT, LOAD DATA;
Unlike INSERT INTO (row1),(row2),,(rowN)).
Fixed a small bug, copied++ to (*copied)++ and the same for deleted.
Changed from current_thd, to ha_thd()
sql/ha_partition.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a new struct HA_DATA_PARTITION to be used in table_share->ha_data
Added a private function to set auto_increment values if needed
Removed the restore_auto_increment (the hander version is better)
Added lock/unlock functions for auto_increment handling.
Changed copied/deleted to const.
sql/handler.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Added const for changed_partitions
Added comments about SQLCOM_TRUNCATE for delete_all_rows
sql/table.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a variable in table_share: ha_data for storage of storage engine
specific data (such as auto_increment handling in partitioning).
2008-09-08 15:30:01 +02:00
|
|
|
{
|
|
|
|
auto_increment_lock= FALSE;
|
2017-09-27 21:48:05 +02:00
|
|
|
part_share->unlock_auto_inc();
|
Bug#38804: Query deadlock causes all tables to be inaccessible.
Problem was a mutex added in bug n 27405 for solving a problem
with auto_increment in partitioned innodb tables.
(in ha_partition::write_row over partitions file->ha_write_row)
Solution is to use the patch for bug#33479, which refines the
usage of mutexes for auto_increment.
Backport of bug-33479 from 6.0:
Bug-33479: auto_increment failures in partitioning
Several problems with auto_increment in partitioning
(with MyISAM, InnoDB. Locking issues, not handling
multi-row INSERTs properly etc.)
Changed the auto_increment handling for partitioning:
Added a ha_data variable in table_share for storage engine specific data
such as auto_increment value handling in partitioning, also see WL 4305
and using the ha_data->mutex to lock around read + update.
The idea is this:
Store the table's reserved auto_increment value in
the TABLE_SHARE and use a mutex to, lock it for reading and updating it
and unlocking it, in one block. Only accessing all partitions
when it is not initialized.
Also allow reservations of ranges, and if no one has done a reservation
afterwards, lower the reservation to what was actually used after
the statement is done (via release_auto_increment from WL 3146).
The lock is kept from the first reservation if it is statement based
replication and a multi-row INSERT statement where the number of
candidate rows to insert is not known in advance (like INSERT SELECT,
LOAD DATA, unlike INSERT VALUES (row1), (row2),,(rowN)).
This should also lead to better concurrancy (no need to have a mutex
protection around write_row in all cases)
and work with any local storage engine.
mysql-test/suite/parts/inc/partition_auto_increment.inc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Test source file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_archive.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_innodb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_memory.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_ndb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_archive.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_blackhole.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_innodb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_memory.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_myisam.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_ndb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
sql/ha_partition.cc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Changed ha_partition::get_auto_increment from file->get_auto_increment
to file->info(HA_AUTO_STATUS), since it is works better with InnoDB
(InnoDB can have issues with partitioning and auto_increment,
where get_auto_increment sometimes can return a non updated value.)
Using the new table_share->ha_data for keeping the auto_increment
value, shared by all instances of the same table.
It is read+updated when holding a auto_increment specific mutex.
Also added release_auto_increment to decrease gaps if possible.
And a lock for multi-row INSERT statements where the number of candidate
rows to insert is not known in advance (like INSERT SELECT, LOAD DATA;
Unlike INSERT INTO (row1),(row2),,(rowN)).
Fixed a small bug, copied++ to (*copied)++ and the same for deleted.
Changed from current_thd, to ha_thd()
sql/ha_partition.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a new struct HA_DATA_PARTITION to be used in table_share->ha_data
Added a private function to set auto_increment values if needed
Removed the restore_auto_increment (the hander version is better)
Added lock/unlock functions for auto_increment handling.
Changed copied/deleted to const.
sql/handler.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Added const for changed_partitions
Added comments about SQLCOM_TRUNCATE for delete_all_rows
sql/table.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a variable in table_share: ha_data for storage of storage engine
specific data (such as auto_increment handling in partitioning).
2008-09-08 15:30:01 +02:00
|
|
|
}
|
|
|
|
}
|
2009-09-04 05:57:11 +02:00
|
|
|
virtual void set_auto_increment_if_higher(Field *field)
|
Bug#38804: Query deadlock causes all tables to be inaccessible.
Problem was a mutex added in bug n 27405 for solving a problem
with auto_increment in partitioned innodb tables.
(in ha_partition::write_row over partitions file->ha_write_row)
Solution is to use the patch for bug#33479, which refines the
usage of mutexes for auto_increment.
Backport of bug-33479 from 6.0:
Bug-33479: auto_increment failures in partitioning
Several problems with auto_increment in partitioning
(with MyISAM, InnoDB. Locking issues, not handling
multi-row INSERTs properly etc.)
Changed the auto_increment handling for partitioning:
Added a ha_data variable in table_share for storage engine specific data
such as auto_increment value handling in partitioning, also see WL 4305
and using the ha_data->mutex to lock around read + update.
The idea is this:
Store the table's reserved auto_increment value in
the TABLE_SHARE and use a mutex to, lock it for reading and updating it
and unlocking it, in one block. Only accessing all partitions
when it is not initialized.
Also allow reservations of ranges, and if no one has done a reservation
afterwards, lower the reservation to what was actually used after
the statement is done (via release_auto_increment from WL 3146).
The lock is kept from the first reservation if it is statement based
replication and a multi-row INSERT statement where the number of
candidate rows to insert is not known in advance (like INSERT SELECT,
LOAD DATA, unlike INSERT VALUES (row1), (row2),,(rowN)).
This should also lead to better concurrancy (no need to have a mutex
protection around write_row in all cases)
and work with any local storage engine.
mysql-test/suite/parts/inc/partition_auto_increment.inc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Test source file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_archive.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_innodb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_memory.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_ndb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_archive.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_blackhole.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_innodb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_memory.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_myisam.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_ndb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
sql/ha_partition.cc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Changed ha_partition::get_auto_increment from file->get_auto_increment
to file->info(HA_AUTO_STATUS), since it is works better with InnoDB
(InnoDB can have issues with partitioning and auto_increment,
where get_auto_increment sometimes can return a non updated value.)
Using the new table_share->ha_data for keeping the auto_increment
value, shared by all instances of the same table.
It is read+updated when holding a auto_increment specific mutex.
Also added release_auto_increment to decrease gaps if possible.
And a lock for multi-row INSERT statements where the number of candidate
rows to insert is not known in advance (like INSERT SELECT, LOAD DATA;
Unlike INSERT INTO (row1),(row2),,(rowN)).
Fixed a small bug, copied++ to (*copied)++ and the same for deleted.
Changed from current_thd, to ha_thd()
sql/ha_partition.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a new struct HA_DATA_PARTITION to be used in table_share->ha_data
Added a private function to set auto_increment values if needed
Removed the restore_auto_increment (the hander version is better)
Added lock/unlock functions for auto_increment handling.
Changed copied/deleted to const.
sql/handler.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Added const for changed_partitions
Added comments about SQLCOM_TRUNCATE for delete_all_rows
sql/table.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a variable in table_share: ha_data for storage of storage engine
specific data (such as auto_increment handling in partitioning).
2008-09-08 15:30:01 +02:00
|
|
|
{
|
2009-09-04 05:57:11 +02:00
|
|
|
ulonglong nr= (((Field_num*) field)->unsigned_flag ||
|
|
|
|
field->val_int() > 0) ? field->val_int() : 0;
|
Bug#38804: Query deadlock causes all tables to be inaccessible.
Problem was a mutex added in bug n 27405 for solving a problem
with auto_increment in partitioned innodb tables.
(in ha_partition::write_row over partitions file->ha_write_row)
Solution is to use the patch for bug#33479, which refines the
usage of mutexes for auto_increment.
Backport of bug-33479 from 6.0:
Bug-33479: auto_increment failures in partitioning
Several problems with auto_increment in partitioning
(with MyISAM, InnoDB. Locking issues, not handling
multi-row INSERTs properly etc.)
Changed the auto_increment handling for partitioning:
Added a ha_data variable in table_share for storage engine specific data
such as auto_increment value handling in partitioning, also see WL 4305
and using the ha_data->mutex to lock around read + update.
The idea is this:
Store the table's reserved auto_increment value in
the TABLE_SHARE and use a mutex to, lock it for reading and updating it
and unlocking it, in one block. Only accessing all partitions
when it is not initialized.
Also allow reservations of ranges, and if no one has done a reservation
afterwards, lower the reservation to what was actually used after
the statement is done (via release_auto_increment from WL 3146).
The lock is kept from the first reservation if it is statement based
replication and a multi-row INSERT statement where the number of
candidate rows to insert is not known in advance (like INSERT SELECT,
LOAD DATA, unlike INSERT VALUES (row1), (row2),,(rowN)).
This should also lead to better concurrancy (no need to have a mutex
protection around write_row in all cases)
and work with any local storage engine.
mysql-test/suite/parts/inc/partition_auto_increment.inc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Test source file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_archive.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_innodb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_memory.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_ndb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_archive.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_blackhole.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_innodb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_memory.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_myisam.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_ndb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
sql/ha_partition.cc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Changed ha_partition::get_auto_increment from file->get_auto_increment
to file->info(HA_AUTO_STATUS), since it is works better with InnoDB
(InnoDB can have issues with partitioning and auto_increment,
where get_auto_increment sometimes can return a non updated value.)
Using the new table_share->ha_data for keeping the auto_increment
value, shared by all instances of the same table.
It is read+updated when holding a auto_increment specific mutex.
Also added release_auto_increment to decrease gaps if possible.
And a lock for multi-row INSERT statements where the number of candidate
rows to insert is not known in advance (like INSERT SELECT, LOAD DATA;
Unlike INSERT INTO (row1),(row2),,(rowN)).
Fixed a small bug, copied++ to (*copied)++ and the same for deleted.
Changed from current_thd, to ha_thd()
sql/ha_partition.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a new struct HA_DATA_PARTITION to be used in table_share->ha_data
Added a private function to set auto_increment values if needed
Removed the restore_auto_increment (the hander version is better)
Added lock/unlock functions for auto_increment handling.
Changed copied/deleted to const.
sql/handler.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Added const for changed_partitions
Added comments about SQLCOM_TRUNCATE for delete_all_rows
sql/table.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a variable in table_share: ha_data for storage of storage engine
specific data (such as auto_increment handling in partitioning).
2008-09-08 15:30:01 +02:00
|
|
|
lock_auto_increment();
|
2017-09-27 21:48:05 +02:00
|
|
|
DBUG_ASSERT(part_share->auto_inc_initialized ||
|
|
|
|
!can_use_for_auto_inc_init());
|
Bug#38804: Query deadlock causes all tables to be inaccessible.
Problem was a mutex added in bug n 27405 for solving a problem
with auto_increment in partitioned innodb tables.
(in ha_partition::write_row over partitions file->ha_write_row)
Solution is to use the patch for bug#33479, which refines the
usage of mutexes for auto_increment.
Backport of bug-33479 from 6.0:
Bug-33479: auto_increment failures in partitioning
Several problems with auto_increment in partitioning
(with MyISAM, InnoDB. Locking issues, not handling
multi-row INSERTs properly etc.)
Changed the auto_increment handling for partitioning:
Added a ha_data variable in table_share for storage engine specific data
such as auto_increment value handling in partitioning, also see WL 4305
and using the ha_data->mutex to lock around read + update.
The idea is this:
Store the table's reserved auto_increment value in
the TABLE_SHARE and use a mutex to, lock it for reading and updating it
and unlocking it, in one block. Only accessing all partitions
when it is not initialized.
Also allow reservations of ranges, and if no one has done a reservation
afterwards, lower the reservation to what was actually used after
the statement is done (via release_auto_increment from WL 3146).
The lock is kept from the first reservation if it is statement based
replication and a multi-row INSERT statement where the number of
candidate rows to insert is not known in advance (like INSERT SELECT,
LOAD DATA, unlike INSERT VALUES (row1), (row2),,(rowN)).
This should also lead to better concurrancy (no need to have a mutex
protection around write_row in all cases)
and work with any local storage engine.
mysql-test/suite/parts/inc/partition_auto_increment.inc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Test source file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_archive.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_innodb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_memory.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_ndb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_archive.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_blackhole.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_innodb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_memory.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_myisam.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_ndb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
sql/ha_partition.cc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Changed ha_partition::get_auto_increment from file->get_auto_increment
to file->info(HA_AUTO_STATUS), since it is works better with InnoDB
(InnoDB can have issues with partitioning and auto_increment,
where get_auto_increment sometimes can return a non updated value.)
Using the new table_share->ha_data for keeping the auto_increment
value, shared by all instances of the same table.
It is read+updated when holding a auto_increment specific mutex.
Also added release_auto_increment to decrease gaps if possible.
And a lock for multi-row INSERT statements where the number of candidate
rows to insert is not known in advance (like INSERT SELECT, LOAD DATA;
Unlike INSERT INTO (row1),(row2),,(rowN)).
Fixed a small bug, copied++ to (*copied)++ and the same for deleted.
Changed from current_thd, to ha_thd()
sql/ha_partition.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a new struct HA_DATA_PARTITION to be used in table_share->ha_data
Added a private function to set auto_increment values if needed
Removed the restore_auto_increment (the hander version is better)
Added lock/unlock functions for auto_increment handling.
Changed copied/deleted to const.
sql/handler.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Added const for changed_partitions
Added comments about SQLCOM_TRUNCATE for delete_all_rows
sql/table.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a variable in table_share: ha_data for storage of storage engine
specific data (such as auto_increment handling in partitioning).
2008-09-08 15:30:01 +02:00
|
|
|
/* must check when the mutex is taken */
|
2013-06-15 17:32:08 +02:00
|
|
|
if (nr >= part_share->next_auto_inc_val)
|
|
|
|
part_share->next_auto_inc_val= nr + 1;
|
Bug#38804: Query deadlock causes all tables to be inaccessible.
Problem was a mutex added in bug n 27405 for solving a problem
with auto_increment in partitioned innodb tables.
(in ha_partition::write_row over partitions file->ha_write_row)
Solution is to use the patch for bug#33479, which refines the
usage of mutexes for auto_increment.
Backport of bug-33479 from 6.0:
Bug-33479: auto_increment failures in partitioning
Several problems with auto_increment in partitioning
(with MyISAM, InnoDB. Locking issues, not handling
multi-row INSERTs properly etc.)
Changed the auto_increment handling for partitioning:
Added a ha_data variable in table_share for storage engine specific data
such as auto_increment value handling in partitioning, also see WL 4305
and using the ha_data->mutex to lock around read + update.
The idea is this:
Store the table's reserved auto_increment value in
the TABLE_SHARE and use a mutex to, lock it for reading and updating it
and unlocking it, in one block. Only accessing all partitions
when it is not initialized.
Also allow reservations of ranges, and if no one has done a reservation
afterwards, lower the reservation to what was actually used after
the statement is done (via release_auto_increment from WL 3146).
The lock is kept from the first reservation if it is statement based
replication and a multi-row INSERT statement where the number of
candidate rows to insert is not known in advance (like INSERT SELECT,
LOAD DATA, unlike INSERT VALUES (row1), (row2),,(rowN)).
This should also lead to better concurrancy (no need to have a mutex
protection around write_row in all cases)
and work with any local storage engine.
mysql-test/suite/parts/inc/partition_auto_increment.inc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Test source file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_archive.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_innodb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_memory.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_ndb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_archive.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_blackhole.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_innodb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_memory.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_myisam.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_ndb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
sql/ha_partition.cc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Changed ha_partition::get_auto_increment from file->get_auto_increment
to file->info(HA_AUTO_STATUS), since it is works better with InnoDB
(InnoDB can have issues with partitioning and auto_increment,
where get_auto_increment sometimes can return a non updated value.)
Using the new table_share->ha_data for keeping the auto_increment
value, shared by all instances of the same table.
It is read+updated when holding a auto_increment specific mutex.
Also added release_auto_increment to decrease gaps if possible.
And a lock for multi-row INSERT statements where the number of candidate
rows to insert is not known in advance (like INSERT SELECT, LOAD DATA;
Unlike INSERT INTO (row1),(row2),,(rowN)).
Fixed a small bug, copied++ to (*copied)++ and the same for deleted.
Changed from current_thd, to ha_thd()
sql/ha_partition.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a new struct HA_DATA_PARTITION to be used in table_share->ha_data
Added a private function to set auto_increment values if needed
Removed the restore_auto_increment (the hander version is better)
Added lock/unlock functions for auto_increment handling.
Changed copied/deleted to const.
sql/handler.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Added const for changed_partitions
Added comments about SQLCOM_TRUNCATE for delete_all_rows
sql/table.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a variable in table_share: ha_data for storage of storage engine
specific data (such as auto_increment handling in partitioning).
2008-09-08 15:30:01 +02:00
|
|
|
unlock_auto_increment();
|
|
|
|
}
|
|
|
|
|
2022-06-16 06:28:24 +02:00
|
|
|
void check_insert_or_replace_autoincrement()
|
2019-11-01 06:39:43 +01:00
|
|
|
{
|
|
|
|
/*
|
2022-06-16 06:28:24 +02:00
|
|
|
If we INSERT or REPLACE into the table having the AUTO_INCREMENT column,
|
2019-11-01 06:39:43 +01:00
|
|
|
we have to read all partitions for the next autoincrement value
|
|
|
|
unless we already did it.
|
|
|
|
*/
|
|
|
|
if (!part_share->auto_inc_initialized &&
|
2022-06-21 17:56:16 +02:00
|
|
|
(ha_thd()->lex->sql_command == SQLCOM_INSERT ||
|
|
|
|
ha_thd()->lex->sql_command == SQLCOM_INSERT_SELECT ||
|
2022-09-27 05:01:29 +02:00
|
|
|
ha_thd()->lex->sql_command == SQLCOM_REPLACE ||
|
|
|
|
ha_thd()->lex->sql_command == SQLCOM_REPLACE_SELECT) &&
|
2019-11-01 06:39:43 +01:00
|
|
|
table->found_next_number_field)
|
|
|
|
bitmap_set_all(&m_part_info->read_partitions);
|
|
|
|
}
|
|
|
|
|
Bug#38804: Query deadlock causes all tables to be inaccessible.
Problem was a mutex added in bug n 27405 for solving a problem
with auto_increment in partitioned innodb tables.
(in ha_partition::write_row over partitions file->ha_write_row)
Solution is to use the patch for bug#33479, which refines the
usage of mutexes for auto_increment.
Backport of bug-33479 from 6.0:
Bug-33479: auto_increment failures in partitioning
Several problems with auto_increment in partitioning
(with MyISAM, InnoDB. Locking issues, not handling
multi-row INSERTs properly etc.)
Changed the auto_increment handling for partitioning:
Added a ha_data variable in table_share for storage engine specific data
such as auto_increment value handling in partitioning, also see WL 4305
and using the ha_data->mutex to lock around read + update.
The idea is this:
Store the table's reserved auto_increment value in
the TABLE_SHARE and use a mutex to, lock it for reading and updating it
and unlocking it, in one block. Only accessing all partitions
when it is not initialized.
Also allow reservations of ranges, and if no one has done a reservation
afterwards, lower the reservation to what was actually used after
the statement is done (via release_auto_increment from WL 3146).
The lock is kept from the first reservation if it is statement based
replication and a multi-row INSERT statement where the number of
candidate rows to insert is not known in advance (like INSERT SELECT,
LOAD DATA, unlike INSERT VALUES (row1), (row2),,(rowN)).
This should also lead to better concurrancy (no need to have a mutex
protection around write_row in all cases)
and work with any local storage engine.
mysql-test/suite/parts/inc/partition_auto_increment.inc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Test source file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_archive.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_innodb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_memory.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_ndb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_archive.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_blackhole.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_innodb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_memory.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_myisam.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_ndb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
sql/ha_partition.cc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Changed ha_partition::get_auto_increment from file->get_auto_increment
to file->info(HA_AUTO_STATUS), since it is works better with InnoDB
(InnoDB can have issues with partitioning and auto_increment,
where get_auto_increment sometimes can return a non updated value.)
Using the new table_share->ha_data for keeping the auto_increment
value, shared by all instances of the same table.
It is read+updated when holding a auto_increment specific mutex.
Also added release_auto_increment to decrease gaps if possible.
And a lock for multi-row INSERT statements where the number of candidate
rows to insert is not known in advance (like INSERT SELECT, LOAD DATA;
Unlike INSERT INTO (row1),(row2),,(rowN)).
Fixed a small bug, copied++ to (*copied)++ and the same for deleted.
Changed from current_thd, to ha_thd()
sql/ha_partition.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a new struct HA_DATA_PARTITION to be used in table_share->ha_data
Added a private function to set auto_increment values if needed
Removed the restore_auto_increment (the hander version is better)
Added lock/unlock functions for auto_increment handling.
Changed copied/deleted to const.
sql/handler.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Added const for changed_partitions
Added comments about SQLCOM_TRUNCATE for delete_all_rows
sql/table.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a variable in table_share: ha_data for storage of storage engine
specific data (such as auto_increment handling in partitioning).
2008-09-08 15:30:01 +02:00
|
|
|
public:
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
-------------------------------------------------------------------------
|
2008-10-29 21:20:04 +01:00
|
|
|
MODULE initialize handler for HANDLER call
|
2005-07-18 13:31:02 +02:00
|
|
|
-------------------------------------------------------------------------
|
|
|
|
This method is a special InnoDB method called before a HANDLER query.
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
void init_table_handle_for_HANDLER() override;
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
The remainder of this file defines the handler methods not implemented
|
|
|
|
by the partition handler
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
MODULE foreign key support
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
The following methods are used to implement foreign keys as supported by
|
|
|
|
InnoDB. Implement this ??
|
|
|
|
get_foreign_key_create_info is used by SHOW CREATE TABLE to get a textual
|
|
|
|
description of how the CREATE TABLE part to define FOREIGN KEY's is done.
|
|
|
|
free_foreign_key_create_info is used to free the memory area that provided
|
|
|
|
this description.
|
WL #2604: Partition Management
Optimised version of ADD/DROP/REORGANIZE partitions for
non-NDB storage engines.
New syntax to handle REBUILD/OPTIMIZE/ANALYZE/CHECK/REPAIR partitions
Quite a few bug fixes
include/thr_lock.h:
New method to downgrade locks from TL_WRITE_ONLY
Possibility to upgrade lock while aborting locks
mysql-test/r/ndb_autodiscover.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_bitfield.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_gis.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_partition_key.result:
New test case
mysql-test/r/partition.result:
New test case
mysql-test/r/partition_error.result:
New test case
mysql-test/r/partition_mgm_err.result:
Fix of test case results
mysql-test/t/disabled.def:
partition_03ndb still has bug
mysql-test/t/ndb_partition_key.test:
New test cases for new functionality and bugs
mysql-test/t/partition.test:
New test cases for new functionality and bugs
mysql-test/t/partition_error.test:
New test cases for new functionality and bugs
mysql-test/t/partition_mgm_err.test:
New test cases for new functionality and bugs
mysys/thr_lock.c:
New method to downgrade TL_WRITE_ONLY locks
Possibility to specify if locks are to be upgraded at abort locks
sql/ha_archive.cc:
New handlerton methods
sql/ha_berkeley.cc:
New handlerton methods
sql/ha_blackhole.cc:
New handlerton methods
sql/ha_federated.cc:
New handlerton methods
sql/ha_heap.cc:
New handlerton methods
sql/ha_innodb.cc:
New handlerton methods
sql/ha_myisam.cc:
New handlerton methods
sql/ha_myisammrg.cc:
New handlerton methods
sql/ha_ndbcluster.cc:
New handlerton methods
Moved out packfrm and unpackfrm methods
Adapted many parts to use table_share instead of table->s
Ensured that .ndb file uses filename and not tablename
according to new encoding of names (WL 1324)
All NDB tables are partitioned and set up partition info
Fixed such that tablenames use tablenames and not filenames in NDB
NDB uses auto partitioning for ENGINE=NDB tables
Warning for very large tables
Set RANGE data
Set LIST data
New method to set-up partition info
Set Default number of partitions flag
Set linear hash flag
Set node group array
Set number of fragments
Set max rows
Set tablespace names
New method to get number of partitions of table to use at open table
sql/ha_ndbcluster.h:
Removed partition_flags and alter_table_flags from handler class
A couple of new and changed method headers
sql/ha_ndbcluster_binlog.cc:
Use new method headers
sql/ha_partition.cc:
New handlerton methods
Lots of new function headers
Use #P# as separator between table name and partition name and
#SP# as separator between partition name and subpartition name
Use filename encoding for files both of table name part and of
partition name parts
New method to drop partitions based on partition state
New method to rename partitions based on partition state
New methods to optimize, analyze, check and repair partitions
New methods to optimize, analyze, check and repair table
Helper method to create new partition, open it and external lock
it, not needed to lock it internally since no one else knows about
it yet.
Cleanup method at error for new partitions
New methods to perform bulk of work at ADD/REORGANIZE partitions
(change_partitions, copy_partitions)
sql/ha_partition.h:
New methods and variables
A few dropped ones and a few changed ones
sql/handler.cc:
Handlerton interface changes
New flag to open_table_from_share
sql/handler.h:
New alter_table_flags
New partition flags
New partition states
More states for default handling
Lots of new, dropped and changed interfaces
sql/lex.h:
Added REBUILD and changed name of REORGANISE to REORGANIZE
sql/lock.cc:
Method to downgrade locks
Able to specify if locks upgraded on abort locks
sql/log.cc:
New handlerton methods
sql/mysql_priv.h:
Lots of new interfaces
sql/share/errmsg.txt:
Lots of new, dropped and changed error messages
sql/sql_base.cc:
Adapted to new method headers
New method to abort and upgrade lock
New method to close open tables and downgrade lock
New method to wait for completed table
sql/sql_lex.h:
New flags
sql/sql_partition.cc:
Return int instead of bool in get_partition_id
More defaults handling
Make use of new mem_alloc_error method
More work on function headers
Changes to generate partition syntax to cater for intermediate
partition states
Lots of new code with large comments describing new features for
Partition Management:
ADD/DROP/REORGANIZE/OPTIMIZE/ANALYZE/CHECK/REPAIR partitions
sql/sql_show.cc:
Minors
sql/sql_table.cc:
Moved a couple of methods
New methods to copy create lists and key lists
for use with mysql_prepare_table
New method to write frm file
New handling of handlers with auto partitioning
Fix CREATE TABLE LIKE
Moved code for ADD/DROP/REORGANIZE partitions
Use handlerton method for alter_table_flags
sql/sql_yacc.yy:
More memory alloc error checks
New syntax for REBUILD, ANALYZE, CHECK, OPTIMIZE, REPAIR partitions
sql/table.cc:
Fix length of extra part to be 4 bytes
Partition state introduced in frm file
sql/table.h:
Partition state introduced
sql/unireg.cc:
Partition state introduced
Default partition
storage/csv/ha_tina.cc:
New handlerton methods
storage/example/ha_example.cc:
New handlerton methods
storage/ndb/include/kernel/ndb_limits.h:
RANGE DATA
storage/ndb/include/kernel/signaldata/AlterTable.hpp:
New interfaces in ALTER TABLE towards NDB kernel
storage/ndb/include/kernel/signaldata/DiAddTab.hpp:
New section
storage/ndb/include/kernel/signaldata/DictTabInfo.hpp:
Lots of new parts of table description
storage/ndb/include/kernel/signaldata/LqhFrag.hpp:
tablespace id specified in LQHFRAGREQ
storage/ndb/include/ndbapi/NdbDictionary.hpp:
Lots of new methods in NDB dictionary
storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
New error insertion
storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp:
a few extra jam's
storage/ndb/src/ndbapi/NdbBlob.cpp:
Changes to definition of blob tables
storage/ndb/src/ndbapi/NdbDictionary.cpp:
Lots of new stuff in NDB dictionary
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
Lots of new stuff in NDB dictionary
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp:
Lots of new stuff in NDB dictionary
storage/ndb/test/ndbapi/test_event.cpp:
removed use of methods no longer in existence
storage/ndb/tools/restore/Restore.cpp:
Renamed variable
2006-01-17 08:40:00 +01:00
|
|
|
can_switch_engines checks if it is ok to switch to a new engine based on
|
|
|
|
the foreign key info in the table.
|
2005-07-18 13:31:02 +02:00
|
|
|
-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
virtual char* get_foreign_key_create_info()
|
|
|
|
virtual void free_foreign_key_create_info(char* str)
|
|
|
|
|
|
|
|
virtual int get_foreign_key_list(THD *thd,
|
|
|
|
List<FOREIGN_KEY_INFO> *f_key_list)
|
|
|
|
virtual uint referenced_by_foreign_key()
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
bool can_switch_engines() override;
|
2005-07-18 13:31:02 +02:00
|
|
|
/*
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
MODULE fulltext index
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
*/
|
2017-09-25 23:56:10 +02:00
|
|
|
void ft_close_search(FT_INFO *handler);
|
2020-02-28 13:01:27 +01:00
|
|
|
int ft_init() override;
|
|
|
|
int pre_ft_init() override;
|
|
|
|
void ft_end() override;
|
|
|
|
int pre_ft_end() override;
|
|
|
|
FT_INFO *ft_init_ext(uint flags, uint inx, String *key) override;
|
|
|
|
int ft_read(uchar *buf) override;
|
|
|
|
int pre_ft_read(bool use_parallel) override;
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
MODULE restart full table scan at position (MyISAM)
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
The following method is only used by MyISAM when used as
|
|
|
|
temporary tables in a join.
|
2020-02-28 13:01:27 +01:00
|
|
|
int restart_rnd_next(uchar *buf, uchar *pos) override;
|
2005-07-18 13:31:02 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
-------------------------------------------------------------------------
|
2013-06-15 17:32:08 +02:00
|
|
|
MODULE in-place ALTER TABLE
|
2005-07-18 13:31:02 +02:00
|
|
|
-------------------------------------------------------------------------
|
Bug#37453: Dropping/creating index on partitioned table with
InnoDB Plugin locks table
The fast/on-line add/drop index handler calls was not implemented
whithin the partitioning.
This implements it in the partitioning handler.
Since this is only used by the not included InnoDB plugin, there
is no test case. (Have tested it manually with the plugin, and
it does not allow unique indexes not including partitioning
function, or removal of pk, which in innodb generates a new pk,
which is not in the partitioning function.)
NOTE: This introduces a new handler method, and because of that
changes the storage engine api. (One cannot use a handlerton to
see the capabilities of a table's handler if it is partitioned.
So I added a wrapper function in the handler that defaults to
the handlerton function, which the partitioning handler overrides.
sql/ha_partition.cc:
Bug#37453: Dropping/creating index on partitioned table with
InnoDB Plugin locks table
Added support for fast/on-line add/drop index.
Implemented alter_table_flags as bit-or of the partitioned
hton and the first partitions alter_table_flags.
It is only to forward the calls for the other functions:
check_if_incompatible_data
add_index
prepare_drop_index
final_drop_index
to all parts handler
sql/ha_partition.h:
Bug#37453: Dropping/creating index on partitioned table with
InnoDB Plugin locks table
Added support for fast/on-line add/drop index.
sql/handler.h:
Bug#37453: Dropping/creating index on partitioned table with
InnoDB Plugin locks table
Added the function on handler level, defaulting to use
the handlerton function, but a handler can override it.
Needed for partitioned tables.
NOTE: Change of storage engine api.
sql/sql_partition.cc:
Bug#37453: Dropping/creating index on partitioned table with
InnoDB Plugin locks table
Using the new handler function, instead of the handlerton
function. This works better with the partitioning handler.
sql/sql_table.cc:
Bug#37453: Dropping/creating index on partitioned table with
InnoDB Plugin locks table
Using the new handler function, instead of the handlerton
function. This works better with the partitioning handler.
Also using new process info for 'manage keys' (kind of fix
for bug-37550).
2008-10-05 00:40:30 +02:00
|
|
|
These methods are in the handler interface. (used by innodb-plugin)
|
2013-06-15 17:32:08 +02:00
|
|
|
They are used for in-place alter table:
|
2005-07-18 13:31:02 +02:00
|
|
|
-------------------------------------------------------------------------
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
enum_alter_inplace_result
|
2013-06-15 17:32:08 +02:00
|
|
|
check_if_supported_inplace_alter(TABLE *altered_table,
|
2020-02-28 13:01:27 +01:00
|
|
|
Alter_inplace_info *ha_alter_info)
|
|
|
|
override;
|
|
|
|
bool prepare_inplace_alter_table(TABLE *altered_table,
|
|
|
|
Alter_inplace_info *ha_alter_info)
|
|
|
|
override;
|
|
|
|
bool inplace_alter_table(TABLE *altered_table,
|
2020-03-11 17:52:49 +01:00
|
|
|
Alter_inplace_info *ha_alter_info) override;
|
2020-02-28 13:01:27 +01:00
|
|
|
bool commit_inplace_alter_table(TABLE *altered_table,
|
|
|
|
Alter_inplace_info *ha_alter_info,
|
|
|
|
bool commit) override;
|
2005-07-18 13:31:02 +02:00
|
|
|
/*
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
MODULE tablespace support
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
Admin of table spaces is not applicable to the partition handler (InnoDB)
|
|
|
|
This means that the following method is not implemented:
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
virtual int discard_or_import_tablespace(my_bool discard)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
MODULE admin MyISAM
|
|
|
|
-------------------------------------------------------------------------
|
WL #2604: Partition Management
Optimised version of ADD/DROP/REORGANIZE partitions for
non-NDB storage engines.
New syntax to handle REBUILD/OPTIMIZE/ANALYZE/CHECK/REPAIR partitions
Quite a few bug fixes
include/thr_lock.h:
New method to downgrade locks from TL_WRITE_ONLY
Possibility to upgrade lock while aborting locks
mysql-test/r/ndb_autodiscover.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_bitfield.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_gis.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_partition_key.result:
New test case
mysql-test/r/partition.result:
New test case
mysql-test/r/partition_error.result:
New test case
mysql-test/r/partition_mgm_err.result:
Fix of test case results
mysql-test/t/disabled.def:
partition_03ndb still has bug
mysql-test/t/ndb_partition_key.test:
New test cases for new functionality and bugs
mysql-test/t/partition.test:
New test cases for new functionality and bugs
mysql-test/t/partition_error.test:
New test cases for new functionality and bugs
mysql-test/t/partition_mgm_err.test:
New test cases for new functionality and bugs
mysys/thr_lock.c:
New method to downgrade TL_WRITE_ONLY locks
Possibility to specify if locks are to be upgraded at abort locks
sql/ha_archive.cc:
New handlerton methods
sql/ha_berkeley.cc:
New handlerton methods
sql/ha_blackhole.cc:
New handlerton methods
sql/ha_federated.cc:
New handlerton methods
sql/ha_heap.cc:
New handlerton methods
sql/ha_innodb.cc:
New handlerton methods
sql/ha_myisam.cc:
New handlerton methods
sql/ha_myisammrg.cc:
New handlerton methods
sql/ha_ndbcluster.cc:
New handlerton methods
Moved out packfrm and unpackfrm methods
Adapted many parts to use table_share instead of table->s
Ensured that .ndb file uses filename and not tablename
according to new encoding of names (WL 1324)
All NDB tables are partitioned and set up partition info
Fixed such that tablenames use tablenames and not filenames in NDB
NDB uses auto partitioning for ENGINE=NDB tables
Warning for very large tables
Set RANGE data
Set LIST data
New method to set-up partition info
Set Default number of partitions flag
Set linear hash flag
Set node group array
Set number of fragments
Set max rows
Set tablespace names
New method to get number of partitions of table to use at open table
sql/ha_ndbcluster.h:
Removed partition_flags and alter_table_flags from handler class
A couple of new and changed method headers
sql/ha_ndbcluster_binlog.cc:
Use new method headers
sql/ha_partition.cc:
New handlerton methods
Lots of new function headers
Use #P# as separator between table name and partition name and
#SP# as separator between partition name and subpartition name
Use filename encoding for files both of table name part and of
partition name parts
New method to drop partitions based on partition state
New method to rename partitions based on partition state
New methods to optimize, analyze, check and repair partitions
New methods to optimize, analyze, check and repair table
Helper method to create new partition, open it and external lock
it, not needed to lock it internally since no one else knows about
it yet.
Cleanup method at error for new partitions
New methods to perform bulk of work at ADD/REORGANIZE partitions
(change_partitions, copy_partitions)
sql/ha_partition.h:
New methods and variables
A few dropped ones and a few changed ones
sql/handler.cc:
Handlerton interface changes
New flag to open_table_from_share
sql/handler.h:
New alter_table_flags
New partition flags
New partition states
More states for default handling
Lots of new, dropped and changed interfaces
sql/lex.h:
Added REBUILD and changed name of REORGANISE to REORGANIZE
sql/lock.cc:
Method to downgrade locks
Able to specify if locks upgraded on abort locks
sql/log.cc:
New handlerton methods
sql/mysql_priv.h:
Lots of new interfaces
sql/share/errmsg.txt:
Lots of new, dropped and changed error messages
sql/sql_base.cc:
Adapted to new method headers
New method to abort and upgrade lock
New method to close open tables and downgrade lock
New method to wait for completed table
sql/sql_lex.h:
New flags
sql/sql_partition.cc:
Return int instead of bool in get_partition_id
More defaults handling
Make use of new mem_alloc_error method
More work on function headers
Changes to generate partition syntax to cater for intermediate
partition states
Lots of new code with large comments describing new features for
Partition Management:
ADD/DROP/REORGANIZE/OPTIMIZE/ANALYZE/CHECK/REPAIR partitions
sql/sql_show.cc:
Minors
sql/sql_table.cc:
Moved a couple of methods
New methods to copy create lists and key lists
for use with mysql_prepare_table
New method to write frm file
New handling of handlers with auto partitioning
Fix CREATE TABLE LIKE
Moved code for ADD/DROP/REORGANIZE partitions
Use handlerton method for alter_table_flags
sql/sql_yacc.yy:
More memory alloc error checks
New syntax for REBUILD, ANALYZE, CHECK, OPTIMIZE, REPAIR partitions
sql/table.cc:
Fix length of extra part to be 4 bytes
Partition state introduced in frm file
sql/table.h:
Partition state introduced
sql/unireg.cc:
Partition state introduced
Default partition
storage/csv/ha_tina.cc:
New handlerton methods
storage/example/ha_example.cc:
New handlerton methods
storage/ndb/include/kernel/ndb_limits.h:
RANGE DATA
storage/ndb/include/kernel/signaldata/AlterTable.hpp:
New interfaces in ALTER TABLE towards NDB kernel
storage/ndb/include/kernel/signaldata/DiAddTab.hpp:
New section
storage/ndb/include/kernel/signaldata/DictTabInfo.hpp:
Lots of new parts of table description
storage/ndb/include/kernel/signaldata/LqhFrag.hpp:
tablespace id specified in LQHFRAGREQ
storage/ndb/include/ndbapi/NdbDictionary.hpp:
Lots of new methods in NDB dictionary
storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
New error insertion
storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp:
a few extra jam's
storage/ndb/src/ndbapi/NdbBlob.cpp:
Changes to definition of blob tables
storage/ndb/src/ndbapi/NdbDictionary.cpp:
Lots of new stuff in NDB dictionary
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
Lots of new stuff in NDB dictionary
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp:
Lots of new stuff in NDB dictionary
storage/ndb/test/ndbapi/test_event.cpp:
removed use of methods no longer in existence
storage/ndb/tools/restore/Restore.cpp:
Renamed variable
2006-01-17 08:40:00 +01:00
|
|
|
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
OPTIMIZE TABLE, CHECK TABLE, ANALYZE TABLE and REPAIR TABLE are
|
|
|
|
mapped to a routine that handles looping over a given set of
|
|
|
|
partitions and those routines send a flag indicating to execute on
|
|
|
|
all partitions.
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
int optimize(THD* thd, HA_CHECK_OPT *check_opt) override;
|
|
|
|
int analyze(THD* thd, HA_CHECK_OPT *check_opt) override;
|
|
|
|
int check(THD* thd, HA_CHECK_OPT *check_opt) override;
|
|
|
|
int repair(THD* thd, HA_CHECK_OPT *check_opt) override;
|
|
|
|
bool check_and_repair(THD *thd) override;
|
|
|
|
bool auto_repair(int error) const override;
|
|
|
|
bool is_crashed() const override;
|
|
|
|
int check_for_upgrade(HA_CHECK_OPT *check_opt) override;
|
WL #2604: Partition Management
Optimised version of ADD/DROP/REORGANIZE partitions for
non-NDB storage engines.
New syntax to handle REBUILD/OPTIMIZE/ANALYZE/CHECK/REPAIR partitions
Quite a few bug fixes
include/thr_lock.h:
New method to downgrade locks from TL_WRITE_ONLY
Possibility to upgrade lock while aborting locks
mysql-test/r/ndb_autodiscover.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_bitfield.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_gis.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_partition_key.result:
New test case
mysql-test/r/partition.result:
New test case
mysql-test/r/partition_error.result:
New test case
mysql-test/r/partition_mgm_err.result:
Fix of test case results
mysql-test/t/disabled.def:
partition_03ndb still has bug
mysql-test/t/ndb_partition_key.test:
New test cases for new functionality and bugs
mysql-test/t/partition.test:
New test cases for new functionality and bugs
mysql-test/t/partition_error.test:
New test cases for new functionality and bugs
mysql-test/t/partition_mgm_err.test:
New test cases for new functionality and bugs
mysys/thr_lock.c:
New method to downgrade TL_WRITE_ONLY locks
Possibility to specify if locks are to be upgraded at abort locks
sql/ha_archive.cc:
New handlerton methods
sql/ha_berkeley.cc:
New handlerton methods
sql/ha_blackhole.cc:
New handlerton methods
sql/ha_federated.cc:
New handlerton methods
sql/ha_heap.cc:
New handlerton methods
sql/ha_innodb.cc:
New handlerton methods
sql/ha_myisam.cc:
New handlerton methods
sql/ha_myisammrg.cc:
New handlerton methods
sql/ha_ndbcluster.cc:
New handlerton methods
Moved out packfrm and unpackfrm methods
Adapted many parts to use table_share instead of table->s
Ensured that .ndb file uses filename and not tablename
according to new encoding of names (WL 1324)
All NDB tables are partitioned and set up partition info
Fixed such that tablenames use tablenames and not filenames in NDB
NDB uses auto partitioning for ENGINE=NDB tables
Warning for very large tables
Set RANGE data
Set LIST data
New method to set-up partition info
Set Default number of partitions flag
Set linear hash flag
Set node group array
Set number of fragments
Set max rows
Set tablespace names
New method to get number of partitions of table to use at open table
sql/ha_ndbcluster.h:
Removed partition_flags and alter_table_flags from handler class
A couple of new and changed method headers
sql/ha_ndbcluster_binlog.cc:
Use new method headers
sql/ha_partition.cc:
New handlerton methods
Lots of new function headers
Use #P# as separator between table name and partition name and
#SP# as separator between partition name and subpartition name
Use filename encoding for files both of table name part and of
partition name parts
New method to drop partitions based on partition state
New method to rename partitions based on partition state
New methods to optimize, analyze, check and repair partitions
New methods to optimize, analyze, check and repair table
Helper method to create new partition, open it and external lock
it, not needed to lock it internally since no one else knows about
it yet.
Cleanup method at error for new partitions
New methods to perform bulk of work at ADD/REORGANIZE partitions
(change_partitions, copy_partitions)
sql/ha_partition.h:
New methods and variables
A few dropped ones and a few changed ones
sql/handler.cc:
Handlerton interface changes
New flag to open_table_from_share
sql/handler.h:
New alter_table_flags
New partition flags
New partition states
More states for default handling
Lots of new, dropped and changed interfaces
sql/lex.h:
Added REBUILD and changed name of REORGANISE to REORGANIZE
sql/lock.cc:
Method to downgrade locks
Able to specify if locks upgraded on abort locks
sql/log.cc:
New handlerton methods
sql/mysql_priv.h:
Lots of new interfaces
sql/share/errmsg.txt:
Lots of new, dropped and changed error messages
sql/sql_base.cc:
Adapted to new method headers
New method to abort and upgrade lock
New method to close open tables and downgrade lock
New method to wait for completed table
sql/sql_lex.h:
New flags
sql/sql_partition.cc:
Return int instead of bool in get_partition_id
More defaults handling
Make use of new mem_alloc_error method
More work on function headers
Changes to generate partition syntax to cater for intermediate
partition states
Lots of new code with large comments describing new features for
Partition Management:
ADD/DROP/REORGANIZE/OPTIMIZE/ANALYZE/CHECK/REPAIR partitions
sql/sql_show.cc:
Minors
sql/sql_table.cc:
Moved a couple of methods
New methods to copy create lists and key lists
for use with mysql_prepare_table
New method to write frm file
New handling of handlers with auto partitioning
Fix CREATE TABLE LIKE
Moved code for ADD/DROP/REORGANIZE partitions
Use handlerton method for alter_table_flags
sql/sql_yacc.yy:
More memory alloc error checks
New syntax for REBUILD, ANALYZE, CHECK, OPTIMIZE, REPAIR partitions
sql/table.cc:
Fix length of extra part to be 4 bytes
Partition state introduced in frm file
sql/table.h:
Partition state introduced
sql/unireg.cc:
Partition state introduced
Default partition
storage/csv/ha_tina.cc:
New handlerton methods
storage/example/ha_example.cc:
New handlerton methods
storage/ndb/include/kernel/ndb_limits.h:
RANGE DATA
storage/ndb/include/kernel/signaldata/AlterTable.hpp:
New interfaces in ALTER TABLE towards NDB kernel
storage/ndb/include/kernel/signaldata/DiAddTab.hpp:
New section
storage/ndb/include/kernel/signaldata/DictTabInfo.hpp:
Lots of new parts of table description
storage/ndb/include/kernel/signaldata/LqhFrag.hpp:
tablespace id specified in LQHFRAGREQ
storage/ndb/include/ndbapi/NdbDictionary.hpp:
Lots of new methods in NDB dictionary
storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
New error insertion
storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp:
a few extra jam's
storage/ndb/src/ndbapi/NdbBlob.cpp:
Changes to definition of blob tables
storage/ndb/src/ndbapi/NdbDictionary.cpp:
Lots of new stuff in NDB dictionary
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
Lots of new stuff in NDB dictionary
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp:
Lots of new stuff in NDB dictionary
storage/ndb/test/ndbapi/test_event.cpp:
removed use of methods no longer in existence
storage/ndb/tools/restore/Restore.cpp:
Renamed variable
2006-01-17 08:40:00 +01:00
|
|
|
|
2016-11-21 09:00:52 +01:00
|
|
|
/*
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
MODULE condition pushdown
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
const COND *cond_push(const COND *cond) override;
|
|
|
|
void cond_pop() override;
|
|
|
|
int info_push(uint info_type, void *info) override;
|
2016-11-21 09:00:52 +01:00
|
|
|
|
WL #2604: Partition Management
Optimised version of ADD/DROP/REORGANIZE partitions for
non-NDB storage engines.
New syntax to handle REBUILD/OPTIMIZE/ANALYZE/CHECK/REPAIR partitions
Quite a few bug fixes
include/thr_lock.h:
New method to downgrade locks from TL_WRITE_ONLY
Possibility to upgrade lock while aborting locks
mysql-test/r/ndb_autodiscover.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_bitfield.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_gis.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_partition_key.result:
New test case
mysql-test/r/partition.result:
New test case
mysql-test/r/partition_error.result:
New test case
mysql-test/r/partition_mgm_err.result:
Fix of test case results
mysql-test/t/disabled.def:
partition_03ndb still has bug
mysql-test/t/ndb_partition_key.test:
New test cases for new functionality and bugs
mysql-test/t/partition.test:
New test cases for new functionality and bugs
mysql-test/t/partition_error.test:
New test cases for new functionality and bugs
mysql-test/t/partition_mgm_err.test:
New test cases for new functionality and bugs
mysys/thr_lock.c:
New method to downgrade TL_WRITE_ONLY locks
Possibility to specify if locks are to be upgraded at abort locks
sql/ha_archive.cc:
New handlerton methods
sql/ha_berkeley.cc:
New handlerton methods
sql/ha_blackhole.cc:
New handlerton methods
sql/ha_federated.cc:
New handlerton methods
sql/ha_heap.cc:
New handlerton methods
sql/ha_innodb.cc:
New handlerton methods
sql/ha_myisam.cc:
New handlerton methods
sql/ha_myisammrg.cc:
New handlerton methods
sql/ha_ndbcluster.cc:
New handlerton methods
Moved out packfrm and unpackfrm methods
Adapted many parts to use table_share instead of table->s
Ensured that .ndb file uses filename and not tablename
according to new encoding of names (WL 1324)
All NDB tables are partitioned and set up partition info
Fixed such that tablenames use tablenames and not filenames in NDB
NDB uses auto partitioning for ENGINE=NDB tables
Warning for very large tables
Set RANGE data
Set LIST data
New method to set-up partition info
Set Default number of partitions flag
Set linear hash flag
Set node group array
Set number of fragments
Set max rows
Set tablespace names
New method to get number of partitions of table to use at open table
sql/ha_ndbcluster.h:
Removed partition_flags and alter_table_flags from handler class
A couple of new and changed method headers
sql/ha_ndbcluster_binlog.cc:
Use new method headers
sql/ha_partition.cc:
New handlerton methods
Lots of new function headers
Use #P# as separator between table name and partition name and
#SP# as separator between partition name and subpartition name
Use filename encoding for files both of table name part and of
partition name parts
New method to drop partitions based on partition state
New method to rename partitions based on partition state
New methods to optimize, analyze, check and repair partitions
New methods to optimize, analyze, check and repair table
Helper method to create new partition, open it and external lock
it, not needed to lock it internally since no one else knows about
it yet.
Cleanup method at error for new partitions
New methods to perform bulk of work at ADD/REORGANIZE partitions
(change_partitions, copy_partitions)
sql/ha_partition.h:
New methods and variables
A few dropped ones and a few changed ones
sql/handler.cc:
Handlerton interface changes
New flag to open_table_from_share
sql/handler.h:
New alter_table_flags
New partition flags
New partition states
More states for default handling
Lots of new, dropped and changed interfaces
sql/lex.h:
Added REBUILD and changed name of REORGANISE to REORGANIZE
sql/lock.cc:
Method to downgrade locks
Able to specify if locks upgraded on abort locks
sql/log.cc:
New handlerton methods
sql/mysql_priv.h:
Lots of new interfaces
sql/share/errmsg.txt:
Lots of new, dropped and changed error messages
sql/sql_base.cc:
Adapted to new method headers
New method to abort and upgrade lock
New method to close open tables and downgrade lock
New method to wait for completed table
sql/sql_lex.h:
New flags
sql/sql_partition.cc:
Return int instead of bool in get_partition_id
More defaults handling
Make use of new mem_alloc_error method
More work on function headers
Changes to generate partition syntax to cater for intermediate
partition states
Lots of new code with large comments describing new features for
Partition Management:
ADD/DROP/REORGANIZE/OPTIMIZE/ANALYZE/CHECK/REPAIR partitions
sql/sql_show.cc:
Minors
sql/sql_table.cc:
Moved a couple of methods
New methods to copy create lists and key lists
for use with mysql_prepare_table
New method to write frm file
New handling of handlers with auto partitioning
Fix CREATE TABLE LIKE
Moved code for ADD/DROP/REORGANIZE partitions
Use handlerton method for alter_table_flags
sql/sql_yacc.yy:
More memory alloc error checks
New syntax for REBUILD, ANALYZE, CHECK, OPTIMIZE, REPAIR partitions
sql/table.cc:
Fix length of extra part to be 4 bytes
Partition state introduced in frm file
sql/table.h:
Partition state introduced
sql/unireg.cc:
Partition state introduced
Default partition
storage/csv/ha_tina.cc:
New handlerton methods
storage/example/ha_example.cc:
New handlerton methods
storage/ndb/include/kernel/ndb_limits.h:
RANGE DATA
storage/ndb/include/kernel/signaldata/AlterTable.hpp:
New interfaces in ALTER TABLE towards NDB kernel
storage/ndb/include/kernel/signaldata/DiAddTab.hpp:
New section
storage/ndb/include/kernel/signaldata/DictTabInfo.hpp:
Lots of new parts of table description
storage/ndb/include/kernel/signaldata/LqhFrag.hpp:
tablespace id specified in LQHFRAGREQ
storage/ndb/include/ndbapi/NdbDictionary.hpp:
Lots of new methods in NDB dictionary
storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
New error insertion
storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp:
a few extra jam's
storage/ndb/src/ndbapi/NdbBlob.cpp:
Changes to definition of blob tables
storage/ndb/src/ndbapi/NdbDictionary.cpp:
Lots of new stuff in NDB dictionary
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
Lots of new stuff in NDB dictionary
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp:
Lots of new stuff in NDB dictionary
storage/ndb/test/ndbapi/test_event.cpp:
removed use of methods no longer in existence
storage/ndb/tools/restore/Restore.cpp:
Renamed variable
2006-01-17 08:40:00 +01:00
|
|
|
private:
|
2008-10-10 20:12:38 +02:00
|
|
|
int handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, uint flags);
|
2013-11-28 12:10:44 +01:00
|
|
|
int handle_opt_part(THD *thd, HA_CHECK_OPT *check_opt, uint part_id,
|
|
|
|
uint flag);
|
|
|
|
/**
|
|
|
|
Check if the rows are placed in the correct partition. If the given
|
|
|
|
argument is true, then move the rows to the correct partition.
|
|
|
|
*/
|
|
|
|
int check_misplaced_rows(uint read_part_id, bool repair);
|
|
|
|
void append_row_to_str(String &str);
|
WL #2604: Partition Management
Optimised version of ADD/DROP/REORGANIZE partitions for
non-NDB storage engines.
New syntax to handle REBUILD/OPTIMIZE/ANALYZE/CHECK/REPAIR partitions
Quite a few bug fixes
include/thr_lock.h:
New method to downgrade locks from TL_WRITE_ONLY
Possibility to upgrade lock while aborting locks
mysql-test/r/ndb_autodiscover.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_bitfield.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_gis.result:
Fix for lowercase and that all NDB tables are now partitioned
mysql-test/r/ndb_partition_key.result:
New test case
mysql-test/r/partition.result:
New test case
mysql-test/r/partition_error.result:
New test case
mysql-test/r/partition_mgm_err.result:
Fix of test case results
mysql-test/t/disabled.def:
partition_03ndb still has bug
mysql-test/t/ndb_partition_key.test:
New test cases for new functionality and bugs
mysql-test/t/partition.test:
New test cases for new functionality and bugs
mysql-test/t/partition_error.test:
New test cases for new functionality and bugs
mysql-test/t/partition_mgm_err.test:
New test cases for new functionality and bugs
mysys/thr_lock.c:
New method to downgrade TL_WRITE_ONLY locks
Possibility to specify if locks are to be upgraded at abort locks
sql/ha_archive.cc:
New handlerton methods
sql/ha_berkeley.cc:
New handlerton methods
sql/ha_blackhole.cc:
New handlerton methods
sql/ha_federated.cc:
New handlerton methods
sql/ha_heap.cc:
New handlerton methods
sql/ha_innodb.cc:
New handlerton methods
sql/ha_myisam.cc:
New handlerton methods
sql/ha_myisammrg.cc:
New handlerton methods
sql/ha_ndbcluster.cc:
New handlerton methods
Moved out packfrm and unpackfrm methods
Adapted many parts to use table_share instead of table->s
Ensured that .ndb file uses filename and not tablename
according to new encoding of names (WL 1324)
All NDB tables are partitioned and set up partition info
Fixed such that tablenames use tablenames and not filenames in NDB
NDB uses auto partitioning for ENGINE=NDB tables
Warning for very large tables
Set RANGE data
Set LIST data
New method to set-up partition info
Set Default number of partitions flag
Set linear hash flag
Set node group array
Set number of fragments
Set max rows
Set tablespace names
New method to get number of partitions of table to use at open table
sql/ha_ndbcluster.h:
Removed partition_flags and alter_table_flags from handler class
A couple of new and changed method headers
sql/ha_ndbcluster_binlog.cc:
Use new method headers
sql/ha_partition.cc:
New handlerton methods
Lots of new function headers
Use #P# as separator between table name and partition name and
#SP# as separator between partition name and subpartition name
Use filename encoding for files both of table name part and of
partition name parts
New method to drop partitions based on partition state
New method to rename partitions based on partition state
New methods to optimize, analyze, check and repair partitions
New methods to optimize, analyze, check and repair table
Helper method to create new partition, open it and external lock
it, not needed to lock it internally since no one else knows about
it yet.
Cleanup method at error for new partitions
New methods to perform bulk of work at ADD/REORGANIZE partitions
(change_partitions, copy_partitions)
sql/ha_partition.h:
New methods and variables
A few dropped ones and a few changed ones
sql/handler.cc:
Handlerton interface changes
New flag to open_table_from_share
sql/handler.h:
New alter_table_flags
New partition flags
New partition states
More states for default handling
Lots of new, dropped and changed interfaces
sql/lex.h:
Added REBUILD and changed name of REORGANISE to REORGANIZE
sql/lock.cc:
Method to downgrade locks
Able to specify if locks upgraded on abort locks
sql/log.cc:
New handlerton methods
sql/mysql_priv.h:
Lots of new interfaces
sql/share/errmsg.txt:
Lots of new, dropped and changed error messages
sql/sql_base.cc:
Adapted to new method headers
New method to abort and upgrade lock
New method to close open tables and downgrade lock
New method to wait for completed table
sql/sql_lex.h:
New flags
sql/sql_partition.cc:
Return int instead of bool in get_partition_id
More defaults handling
Make use of new mem_alloc_error method
More work on function headers
Changes to generate partition syntax to cater for intermediate
partition states
Lots of new code with large comments describing new features for
Partition Management:
ADD/DROP/REORGANIZE/OPTIMIZE/ANALYZE/CHECK/REPAIR partitions
sql/sql_show.cc:
Minors
sql/sql_table.cc:
Moved a couple of methods
New methods to copy create lists and key lists
for use with mysql_prepare_table
New method to write frm file
New handling of handlers with auto partitioning
Fix CREATE TABLE LIKE
Moved code for ADD/DROP/REORGANIZE partitions
Use handlerton method for alter_table_flags
sql/sql_yacc.yy:
More memory alloc error checks
New syntax for REBUILD, ANALYZE, CHECK, OPTIMIZE, REPAIR partitions
sql/table.cc:
Fix length of extra part to be 4 bytes
Partition state introduced in frm file
sql/table.h:
Partition state introduced
sql/unireg.cc:
Partition state introduced
Default partition
storage/csv/ha_tina.cc:
New handlerton methods
storage/example/ha_example.cc:
New handlerton methods
storage/ndb/include/kernel/ndb_limits.h:
RANGE DATA
storage/ndb/include/kernel/signaldata/AlterTable.hpp:
New interfaces in ALTER TABLE towards NDB kernel
storage/ndb/include/kernel/signaldata/DiAddTab.hpp:
New section
storage/ndb/include/kernel/signaldata/DictTabInfo.hpp:
Lots of new parts of table description
storage/ndb/include/kernel/signaldata/LqhFrag.hpp:
tablespace id specified in LQHFRAGREQ
storage/ndb/include/ndbapi/NdbDictionary.hpp:
Lots of new methods in NDB dictionary
storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
Lots of new variables in table description
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
New error insertion
storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp:
a few extra jam's
storage/ndb/src/ndbapi/NdbBlob.cpp:
Changes to definition of blob tables
storage/ndb/src/ndbapi/NdbDictionary.cpp:
Lots of new stuff in NDB dictionary
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
Lots of new stuff in NDB dictionary
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp:
Lots of new stuff in NDB dictionary
storage/ndb/test/ndbapi/test_event.cpp:
removed use of methods no longer in existence
storage/ndb/tools/restore/Restore.cpp:
Renamed variable
2006-01-17 08:40:00 +01:00
|
|
|
public:
|
2013-08-12 20:56:35 +02:00
|
|
|
|
2020-02-28 13:01:27 +01:00
|
|
|
int pre_calculate_checksum() override;
|
|
|
|
int calculate_checksum() override;
|
2019-06-10 17:25:08 +02:00
|
|
|
|
2009-09-10 11:14:23 +02:00
|
|
|
/* Enabled keycache for performance reasons, WL#4571 */
|
2020-02-28 13:01:27 +01:00
|
|
|
int assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt) override;
|
|
|
|
int preload_keys(THD* thd, HA_CHECK_OPT* check_opt) override;
|
|
|
|
TABLE_LIST *get_next_global_for_child() override;
|
2005-07-18 13:31:02 +02:00
|
|
|
|
2006-05-04 21:15:25 +02:00
|
|
|
/*
|
2005-07-18 13:31:02 +02:00
|
|
|
-------------------------------------------------------------------------
|
|
|
|
MODULE enable/disable indexes
|
|
|
|
-------------------------------------------------------------------------
|
2006-05-04 21:15:25 +02:00
|
|
|
Enable/Disable Indexes are only supported by HEAP and MyISAM.
|
2005-07-18 13:31:02 +02:00
|
|
|
-------------------------------------------------------------------------
|
2006-05-04 21:15:25 +02:00
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
int disable_indexes(uint mode) override;
|
|
|
|
int enable_indexes(uint mode) override;
|
|
|
|
int indexes_are_disabled() override;
|
2005-07-18 13:31:02 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
MODULE append_create_info
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
append_create_info is only used by MyISAM MERGE tables and the partition
|
|
|
|
handler will not support this handler as underlying handler.
|
|
|
|
Implement this??
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
virtual void append_create_info(String *packet)
|
|
|
|
*/
|
2010-05-11 16:49:23 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
the following heavily relies on the fact that all partitions
|
|
|
|
are in the same storage engine.
|
|
|
|
|
|
|
|
When this limitation is lifted, the following hack should go away,
|
|
|
|
and a proper interface for engines needs to be introduced:
|
|
|
|
|
|
|
|
an PARTITION_SHARE structure that has a pointer to the TABLE_SHARE.
|
|
|
|
is given to engines everywhere where TABLE_SHARE is used now
|
|
|
|
has members like option_struct, ha_data
|
|
|
|
perhaps TABLE needs to be split the same way too...
|
|
|
|
|
|
|
|
this can also be done before partition will support a mix of engines,
|
|
|
|
but preferably together with other incompatible API changes.
|
|
|
|
*/
|
2020-02-28 13:01:27 +01:00
|
|
|
handlerton *partition_ht() const override
|
2010-05-11 16:49:23 +02:00
|
|
|
{
|
|
|
|
handlerton *h= m_file[0]->ht;
|
2010-07-17 00:41:44 +02:00
|
|
|
for (uint i=1; i < m_tot_parts; i++)
|
2010-05-11 16:49:23 +02:00
|
|
|
DBUG_ASSERT(h == m_file[i]->ht);
|
|
|
|
return h;
|
|
|
|
}
|
2014-03-11 16:45:08 +01:00
|
|
|
|
2021-03-30 16:06:55 +02:00
|
|
|
bool partition_engine() override { return 1;}
|
2020-08-25 21:21:08 +02:00
|
|
|
ha_rows part_records(partition_element *part_elem)
|
2016-12-11 18:04:11 +01:00
|
|
|
{
|
|
|
|
DBUG_ASSERT(m_part_info);
|
|
|
|
uint32 sub_factor= m_part_info->num_subparts ? m_part_info->num_subparts : 1;
|
|
|
|
uint32 part_id= part_elem->id * sub_factor;
|
|
|
|
uint32 part_id_end= part_id + sub_factor;
|
|
|
|
DBUG_ASSERT(part_id_end <= m_tot_parts);
|
|
|
|
ha_rows part_recs= 0;
|
|
|
|
for (; part_id < part_id_end; ++part_id)
|
|
|
|
{
|
|
|
|
handler *file= m_file[part_id];
|
2017-12-18 17:03:51 +01:00
|
|
|
file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK | HA_STATUS_OPEN);
|
2016-12-11 18:04:11 +01:00
|
|
|
part_recs+= file->stats.records;
|
|
|
|
}
|
|
|
|
return part_recs;
|
|
|
|
}
|
|
|
|
|
2021-01-28 13:15:01 +01:00
|
|
|
int notify_tabledef_changed(LEX_CSTRING *db, LEX_CSTRING *table,
|
|
|
|
LEX_CUSTRING *frm, LEX_CUSTRING *version);
|
|
|
|
|
2014-03-11 16:45:08 +01:00
|
|
|
friend int cmp_key_rowid_part_id(void *ptr, uchar *ref1, uchar *ref2);
|
2017-09-28 15:38:10 +02:00
|
|
|
friend int cmp_key_part_id(void *key_p, uchar *ref1, uchar *ref2);
|
2020-02-28 09:59:05 +01:00
|
|
|
|
2022-10-26 12:48:03 +02:00
|
|
|
bool can_convert_nocopy(const Field &field,
|
|
|
|
const Column_definition &new_field) const override;
|
2005-07-18 13:31:02 +02:00
|
|
|
};
|
2009-09-23 23:32:31 +02:00
|
|
|
#endif /* HA_PARTITION_INCLUDED */
|