2004-04-15 09:14:14 +02:00
|
|
|
/* Copyright (C) 2000-2003 MySQL AB
|
|
|
|
|
|
|
|
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; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
|
|
|
|
/*
|
|
|
|
This file defines the NDB Cluster handler: the interface between MySQL and
|
|
|
|
NDB Cluster
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* The class defining a handle to an NDB Cluster table */
|
|
|
|
|
2005-05-04 15:05:56 +02:00
|
|
|
#ifdef USE_PRAGMA_INTERFACE
|
2004-04-15 09:14:14 +02:00
|
|
|
#pragma interface /* gcc class implementation */
|
|
|
|
#endif
|
|
|
|
|
2006-01-25 22:22:50 +01:00
|
|
|
/* Blob tables and events are internal to NDB and must never be accessed */
|
|
|
|
#define IS_NDB_BLOB_PREFIX(A) is_prefix(A, "NDB$BLOB")
|
|
|
|
|
2005-11-07 16:25:06 +01:00
|
|
|
#include <NdbApi.hpp>
|
2004-04-15 09:14:14 +02:00
|
|
|
#include <ndbapi_limits.h>
|
|
|
|
|
2006-02-10 17:40:22 +01:00
|
|
|
#define NDB_HIDDEN_PRIMARY_KEY_LENGTH 8
|
|
|
|
|
2004-04-15 09:14:14 +02:00
|
|
|
class Ndb; // Forward declaration
|
|
|
|
class NdbOperation; // Forward declaration
|
2004-12-23 11:21:01 +01:00
|
|
|
class NdbTransaction; // Forward declaration
|
2004-04-15 09:14:14 +02:00
|
|
|
class NdbRecAttr; // Forward declaration
|
2004-06-11 13:49:22 +02:00
|
|
|
class NdbScanOperation;
|
2004-12-17 21:13:22 +01:00
|
|
|
class NdbScanFilter;
|
2004-06-11 13:49:22 +02:00
|
|
|
class NdbIndexScanOperation;
|
2004-07-22 12:38:09 +02:00
|
|
|
class NdbBlob;
|
2005-09-15 02:33:28 +02:00
|
|
|
class NdbIndexStat;
|
2005-11-06 00:20:37 +01:00
|
|
|
class NdbEventOperation;
|
2004-04-15 09:14:14 +02:00
|
|
|
|
2004-08-20 18:10:47 +02:00
|
|
|
// connectstring to cluster if given by mysqld
|
|
|
|
extern const char *ndbcluster_connectstring;
|
2005-02-01 15:43:08 +01:00
|
|
|
extern ulong ndb_cache_check_time;
|
2006-01-12 19:51:02 +01:00
|
|
|
#ifdef HAVE_NDB_BINLOG
|
2005-11-06 00:20:37 +01:00
|
|
|
extern ulong ndb_report_thresh_binlog_epoch_slip;
|
|
|
|
extern ulong ndb_report_thresh_binlog_mem_usage;
|
2006-01-12 19:51:02 +01:00
|
|
|
#endif
|
2004-08-18 19:13:39 +02:00
|
|
|
|
2004-04-15 09:14:14 +02:00
|
|
|
typedef enum ndb_index_type {
|
|
|
|
UNDEFINED_INDEX = 0,
|
|
|
|
PRIMARY_KEY_INDEX = 1,
|
2004-05-24 12:35:39 +02:00
|
|
|
PRIMARY_KEY_ORDERED_INDEX = 2,
|
|
|
|
UNIQUE_INDEX = 3,
|
|
|
|
UNIQUE_ORDERED_INDEX = 4,
|
|
|
|
ORDERED_INDEX = 5
|
2004-04-15 09:14:14 +02:00
|
|
|
} NDB_INDEX_TYPE;
|
|
|
|
|
2006-01-11 12:35:28 +01:00
|
|
|
typedef enum ndb_index_status {
|
|
|
|
UNDEFINED = 0,
|
2006-01-11 12:41:38 +01:00
|
|
|
ACTIVE = 1,
|
|
|
|
TO_BE_DROPPED = 2
|
2006-01-11 12:35:28 +01:00
|
|
|
} NDB_INDEX_STATUS;
|
|
|
|
|
2004-08-18 19:13:39 +02:00
|
|
|
typedef struct ndb_index_data {
|
|
|
|
NDB_INDEX_TYPE type;
|
2006-01-11 12:35:28 +01:00
|
|
|
NDB_INDEX_STATUS status;
|
2004-08-18 19:13:39 +02:00
|
|
|
void *index;
|
|
|
|
void *unique_index;
|
2005-01-26 11:31:46 +01:00
|
|
|
unsigned char *unique_index_attrid_map;
|
2005-09-15 02:33:28 +02:00
|
|
|
// In this version stats are not shared between threads
|
|
|
|
NdbIndexStat* index_stat;
|
|
|
|
uint index_stat_cache_entries;
|
|
|
|
// Simple counter mechanism to decide when to connect to db
|
|
|
|
uint index_stat_update_freq;
|
|
|
|
uint index_stat_query_count;
|
2004-08-18 19:13:39 +02:00
|
|
|
} NDB_INDEX_DATA;
|
2004-04-15 09:14:14 +02:00
|
|
|
|
2005-11-06 00:20:37 +01:00
|
|
|
typedef union { const NdbRecAttr *rec; NdbBlob *blob; void *ptr; } NdbValue;
|
|
|
|
|
2006-01-25 22:22:50 +01:00
|
|
|
int get_ndb_blobs_value(TABLE* table, NdbValue* value_array,
|
|
|
|
byte*& buffer, uint& buffer_size,
|
|
|
|
my_ptrdiff_t ptrdiff);
|
|
|
|
|
2005-11-06 00:20:37 +01:00
|
|
|
typedef enum {
|
|
|
|
NSS_INITIAL= 0,
|
2006-01-17 12:53:49 +01:00
|
|
|
NSS_DROPPED,
|
|
|
|
NSS_ALTERED
|
2005-11-06 00:20:37 +01:00
|
|
|
} NDB_SHARE_STATE;
|
|
|
|
|
2004-04-15 09:14:14 +02:00
|
|
|
typedef struct st_ndbcluster_share {
|
2006-01-17 12:53:49 +01:00
|
|
|
NDB_SHARE_STATE state;
|
2005-11-06 00:20:37 +01:00
|
|
|
MEM_ROOT mem_root;
|
2004-04-15 09:14:14 +02:00
|
|
|
THR_LOCK lock;
|
|
|
|
pthread_mutex_t mutex;
|
2005-11-06 00:20:37 +01:00
|
|
|
char *key;
|
|
|
|
uint key_length;
|
|
|
|
THD *util_lock;
|
|
|
|
uint use_count;
|
2005-03-15 15:03:25 +01:00
|
|
|
uint commit_count_lock;
|
2005-02-07 13:46:13 +01:00
|
|
|
ulonglong commit_count;
|
2005-11-06 00:20:37 +01:00
|
|
|
char *db;
|
|
|
|
char *table_name;
|
2006-01-12 19:51:02 +01:00
|
|
|
#ifdef HAVE_NDB_BINLOG
|
|
|
|
uint32 flags;
|
|
|
|
NdbEventOperation *op;
|
|
|
|
NdbEventOperation *op_old; // for rename table
|
|
|
|
char *old_names; // for rename table
|
|
|
|
TABLE_SHARE *table_share;
|
|
|
|
TABLE *table;
|
|
|
|
NdbValue *ndb_value[2];
|
|
|
|
MY_BITMAP *subscriber_bitmap;
|
|
|
|
#endif
|
2004-04-15 09:14:14 +02:00
|
|
|
} NDB_SHARE;
|
|
|
|
|
2006-02-01 10:21:48 +01:00
|
|
|
inline
|
|
|
|
NDB_SHARE_STATE
|
|
|
|
get_ndb_share_state(NDB_SHARE *share)
|
|
|
|
{
|
|
|
|
NDB_SHARE_STATE state;
|
|
|
|
pthread_mutex_lock(&share->mutex);
|
|
|
|
state= share->state;
|
|
|
|
pthread_mutex_unlock(&share->mutex);
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
void
|
|
|
|
set_ndb_share_state(NDB_SHARE *share, NDB_SHARE_STATE state)
|
|
|
|
{
|
|
|
|
pthread_mutex_lock(&share->mutex);
|
|
|
|
share->state= state;
|
|
|
|
pthread_mutex_unlock(&share->mutex);
|
|
|
|
}
|
|
|
|
|
2006-01-12 19:51:02 +01:00
|
|
|
#ifdef HAVE_NDB_BINLOG
|
|
|
|
/* NDB_SHARE.flags */
|
|
|
|
#define NSF_HIDDEN_PK 1 /* table has hidden primary key */
|
2006-01-25 22:22:50 +01:00
|
|
|
#define NSF_BLOB_FLAG 2 /* table has blob attributes */
|
2006-01-17 07:36:50 +01:00
|
|
|
#define NSF_NO_BINLOG 4 /* table should not be binlogged */
|
2006-01-12 19:51:02 +01:00
|
|
|
#endif
|
|
|
|
|
2004-12-17 21:13:22 +01:00
|
|
|
typedef enum ndb_item_type {
|
|
|
|
NDB_VALUE = 0, // Qualified more with Item::Type
|
|
|
|
NDB_FIELD = 1, // Qualified from table definition
|
2005-01-07 15:33:24 +01:00
|
|
|
NDB_FUNCTION = 2,// Qualified from Item_func::Functype
|
|
|
|
NDB_END_COND = 3 // End marker for condition group
|
2004-12-17 21:13:22 +01:00
|
|
|
} NDB_ITEM_TYPE;
|
|
|
|
|
2005-08-01 11:50:43 +02:00
|
|
|
typedef enum ndb_func_type {
|
|
|
|
NDB_EQ_FUNC = 0,
|
|
|
|
NDB_NE_FUNC = 1,
|
|
|
|
NDB_LT_FUNC = 2,
|
|
|
|
NDB_LE_FUNC = 3,
|
|
|
|
NDB_GT_FUNC = 4,
|
|
|
|
NDB_GE_FUNC = 5,
|
|
|
|
NDB_ISNULL_FUNC = 6,
|
|
|
|
NDB_ISNOTNULL_FUNC = 7,
|
|
|
|
NDB_LIKE_FUNC = 8,
|
|
|
|
NDB_NOTLIKE_FUNC = 9,
|
|
|
|
NDB_NOT_FUNC = 10,
|
|
|
|
NDB_UNKNOWN_FUNC = 11,
|
|
|
|
NDB_COND_AND_FUNC = 12,
|
|
|
|
NDB_COND_OR_FUNC = 13,
|
|
|
|
NDB_UNSUPPORTED_FUNC = 14
|
|
|
|
} NDB_FUNC_TYPE;
|
|
|
|
|
2004-12-17 21:13:22 +01:00
|
|
|
typedef union ndb_item_qualification {
|
|
|
|
Item::Type value_type;
|
2005-08-01 11:50:43 +02:00
|
|
|
enum_field_types field_type; // Instead of Item::FIELD_ITEM
|
|
|
|
NDB_FUNC_TYPE function_type; // Instead of Item::FUNC_ITEM
|
2004-12-17 21:13:22 +01:00
|
|
|
} NDB_ITEM_QUALIFICATION;
|
|
|
|
|
|
|
|
typedef struct ndb_item_field_value {
|
|
|
|
Field* field;
|
|
|
|
int column_no;
|
|
|
|
} NDB_ITEM_FIELD_VALUE;
|
|
|
|
|
|
|
|
typedef union ndb_item_value {
|
2005-02-11 22:05:24 +01:00
|
|
|
const Item *item;
|
2004-12-17 21:13:22 +01:00
|
|
|
NDB_ITEM_FIELD_VALUE *field_value;
|
2005-05-18 14:32:05 +02:00
|
|
|
uint arg_count;
|
2004-12-17 21:13:22 +01:00
|
|
|
} NDB_ITEM_VALUE;
|
|
|
|
|
2005-02-18 21:43:51 +01:00
|
|
|
struct negated_function_mapping
|
|
|
|
{
|
2005-08-01 11:50:43 +02:00
|
|
|
NDB_FUNC_TYPE pos_fun;
|
|
|
|
NDB_FUNC_TYPE neg_fun;
|
2005-02-18 21:43:51 +01:00
|
|
|
};
|
|
|
|
|
2005-08-22 11:41:37 +02:00
|
|
|
|
2005-08-01 11:50:43 +02:00
|
|
|
/*
|
|
|
|
Define what functions can be negated in condition pushdown.
|
|
|
|
Note, these HAVE to be in the same order as in definition enum
|
|
|
|
*/
|
2005-02-18 21:43:51 +01:00
|
|
|
static const negated_function_mapping neg_map[]=
|
|
|
|
{
|
2005-08-01 11:50:43 +02:00
|
|
|
{NDB_EQ_FUNC, NDB_NE_FUNC},
|
|
|
|
{NDB_NE_FUNC, NDB_EQ_FUNC},
|
|
|
|
{NDB_LT_FUNC, NDB_GE_FUNC},
|
|
|
|
{NDB_LE_FUNC, NDB_GT_FUNC},
|
|
|
|
{NDB_GT_FUNC, NDB_LE_FUNC},
|
|
|
|
{NDB_GE_FUNC, NDB_LT_FUNC},
|
|
|
|
{NDB_ISNULL_FUNC, NDB_ISNOTNULL_FUNC},
|
|
|
|
{NDB_ISNOTNULL_FUNC, NDB_ISNULL_FUNC},
|
|
|
|
{NDB_LIKE_FUNC, NDB_NOTLIKE_FUNC},
|
|
|
|
{NDB_NOTLIKE_FUNC, NDB_LIKE_FUNC},
|
|
|
|
{NDB_NOT_FUNC, NDB_UNSUPPORTED_FUNC},
|
|
|
|
{NDB_UNKNOWN_FUNC, NDB_UNSUPPORTED_FUNC},
|
|
|
|
{NDB_COND_AND_FUNC, NDB_UNSUPPORTED_FUNC},
|
|
|
|
{NDB_COND_OR_FUNC, NDB_UNSUPPORTED_FUNC},
|
|
|
|
{NDB_UNSUPPORTED_FUNC, NDB_UNSUPPORTED_FUNC}
|
2005-02-18 21:43:51 +01:00
|
|
|
};
|
|
|
|
|
2005-02-16 14:18:32 +01:00
|
|
|
/*
|
2005-02-23 15:51:26 +01:00
|
|
|
This class is the construction element for serialization of Item tree
|
|
|
|
in condition pushdown.
|
|
|
|
An instance of Ndb_Item represents a constant, table field reference,
|
|
|
|
unary or binary comparison predicate, and start/end of AND/OR.
|
|
|
|
Instances of Ndb_Item are stored in a linked list implemented by Ndb_cond
|
|
|
|
class.
|
|
|
|
The order of elements produced by Ndb_cond::next corresponds to
|
2005-02-28 09:55:40 +01:00
|
|
|
breadth-first traversal of the Item (i.e. expression) tree in prefix order.
|
2005-02-23 15:51:26 +01:00
|
|
|
AND and OR have arbitrary arity, so the end of AND/OR group is marked with
|
|
|
|
Ndb_item with type == NDB_END_COND.
|
|
|
|
NOT items represent negated conditions and generate NAND/NOR groups.
|
|
|
|
*/
|
2004-12-17 21:13:22 +01:00
|
|
|
class Ndb_item {
|
|
|
|
public:
|
2005-02-11 22:05:24 +01:00
|
|
|
Ndb_item(NDB_ITEM_TYPE item_type) : type(item_type) {};
|
2004-12-17 21:13:22 +01:00
|
|
|
Ndb_item(NDB_ITEM_TYPE item_type,
|
2005-02-16 14:18:32 +01:00
|
|
|
NDB_ITEM_QUALIFICATION item_qualification,
|
|
|
|
const Item *item_value)
|
2005-02-11 22:05:24 +01:00
|
|
|
: type(item_type), qualification(item_qualification)
|
|
|
|
{
|
|
|
|
switch(item_type) {
|
|
|
|
case(NDB_VALUE):
|
|
|
|
value.item= item_value;
|
|
|
|
break;
|
|
|
|
case(NDB_FIELD): {
|
|
|
|
NDB_ITEM_FIELD_VALUE *field_value= new NDB_ITEM_FIELD_VALUE();
|
|
|
|
Item_field *field_item= (Item_field *) item_value;
|
|
|
|
field_value->field= field_item->field;
|
|
|
|
field_value->column_no= -1; // Will be fetched at scan filter generation
|
|
|
|
value.field_value= field_value;
|
2005-01-11 17:26:19 +01:00
|
|
|
break;
|
|
|
|
}
|
2005-02-11 22:05:24 +01:00
|
|
|
case(NDB_FUNCTION):
|
2005-02-23 15:51:26 +01:00
|
|
|
value.item= item_value;
|
2005-05-18 14:32:05 +02:00
|
|
|
value.arg_count= ((Item_func *) item_value)->argument_count();
|
2005-02-23 15:51:26 +01:00
|
|
|
break;
|
2005-02-11 22:05:24 +01:00
|
|
|
case(NDB_END_COND):
|
|
|
|
break;
|
2005-01-11 17:26:19 +01:00
|
|
|
}
|
2005-02-11 22:05:24 +01:00
|
|
|
};
|
|
|
|
Ndb_item(Field *field, int column_no) : type(NDB_FIELD)
|
|
|
|
{
|
|
|
|
NDB_ITEM_FIELD_VALUE *field_value= new NDB_ITEM_FIELD_VALUE();
|
|
|
|
qualification.field_type= field->type();
|
|
|
|
field_value->field= field;
|
|
|
|
field_value->column_no= column_no;
|
|
|
|
value.field_value= field_value;
|
|
|
|
};
|
2005-02-23 15:51:26 +01:00
|
|
|
Ndb_item(Item_func::Functype func_type, const Item *item_value)
|
|
|
|
: type(NDB_FUNCTION)
|
2005-02-11 22:05:24 +01:00
|
|
|
{
|
2005-08-01 11:50:43 +02:00
|
|
|
qualification.function_type= item_func_to_ndb_func(func_type);
|
2005-02-23 15:51:26 +01:00
|
|
|
value.item= item_value;
|
2005-05-18 14:32:05 +02:00
|
|
|
value.arg_count= ((Item_func *) item_value)->argument_count();
|
|
|
|
};
|
|
|
|
Ndb_item(Item_func::Functype func_type, uint no_args)
|
|
|
|
: type(NDB_FUNCTION)
|
|
|
|
{
|
2005-08-01 11:50:43 +02:00
|
|
|
qualification.function_type= item_func_to_ndb_func(func_type);
|
2005-05-18 14:32:05 +02:00
|
|
|
value.arg_count= no_args;
|
2005-02-11 22:05:24 +01:00
|
|
|
};
|
|
|
|
~Ndb_item()
|
|
|
|
{
|
|
|
|
if (type == NDB_FIELD)
|
|
|
|
{
|
2005-02-16 14:18:32 +01:00
|
|
|
delete value.field_value;
|
|
|
|
value.field_value= NULL;
|
2005-02-11 22:05:24 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
uint32 pack_length()
|
|
|
|
{
|
|
|
|
switch(type) {
|
2005-02-18 21:43:51 +01:00
|
|
|
case(NDB_VALUE):
|
|
|
|
if(qualification.value_type == Item::STRING_ITEM)
|
|
|
|
return value.item->str_value.length();
|
|
|
|
break;
|
2005-02-11 22:05:24 +01:00
|
|
|
case(NDB_FIELD):
|
|
|
|
return value.field_value->field->pack_length();
|
2005-01-11 17:26:19 +01:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2005-02-11 22:05:24 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
};
|
2005-02-18 21:43:51 +01:00
|
|
|
|
2005-02-11 22:05:24 +01:00
|
|
|
Field * get_field() { return value.field_value->field; };
|
2005-02-18 21:43:51 +01:00
|
|
|
|
2005-02-11 22:05:24 +01:00
|
|
|
int get_field_no() { return value.field_value->column_no; };
|
2005-02-18 21:43:51 +01:00
|
|
|
|
2005-02-23 15:51:26 +01:00
|
|
|
int argument_count()
|
|
|
|
{
|
2005-05-18 14:32:05 +02:00
|
|
|
return value.arg_count;
|
2005-02-23 15:51:26 +01:00
|
|
|
};
|
|
|
|
|
2005-02-18 21:43:51 +01:00
|
|
|
const char* get_val()
|
|
|
|
{
|
|
|
|
switch(type) {
|
|
|
|
case(NDB_VALUE):
|
|
|
|
if(qualification.value_type == Item::STRING_ITEM)
|
|
|
|
return value.item->str_value.ptr();
|
|
|
|
break;
|
|
|
|
case(NDB_FIELD):
|
|
|
|
return value.field_value->field->ptr;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
};
|
|
|
|
|
2005-02-11 22:05:24 +01:00
|
|
|
void save_in_field(Ndb_item *field_item)
|
|
|
|
{
|
|
|
|
Field *field = field_item->value.field_value->field;
|
|
|
|
const Item *item= value.item;
|
2005-01-11 17:26:19 +01:00
|
|
|
|
2005-02-11 22:05:24 +01:00
|
|
|
if (item && field)
|
|
|
|
((Item *)item)->save_in_field(field, false);
|
2005-02-18 21:43:51 +01:00
|
|
|
};
|
|
|
|
|
2005-08-01 11:50:43 +02:00
|
|
|
static NDB_FUNC_TYPE item_func_to_ndb_func(Item_func::Functype fun)
|
|
|
|
{
|
|
|
|
switch (fun) {
|
|
|
|
case (Item_func::EQ_FUNC): { return NDB_EQ_FUNC; }
|
|
|
|
case (Item_func::NE_FUNC): { return NDB_NE_FUNC; }
|
|
|
|
case (Item_func::LT_FUNC): { return NDB_LT_FUNC; }
|
|
|
|
case (Item_func::LE_FUNC): { return NDB_LE_FUNC; }
|
|
|
|
case (Item_func::GT_FUNC): { return NDB_GT_FUNC; }
|
|
|
|
case (Item_func::GE_FUNC): { return NDB_GE_FUNC; }
|
|
|
|
case (Item_func::ISNULL_FUNC): { return NDB_ISNULL_FUNC; }
|
|
|
|
case (Item_func::ISNOTNULL_FUNC): { return NDB_ISNOTNULL_FUNC; }
|
|
|
|
case (Item_func::LIKE_FUNC): { return NDB_LIKE_FUNC; }
|
|
|
|
case (Item_func::NOT_FUNC): { return NDB_NOT_FUNC; }
|
|
|
|
case (Item_func::UNKNOWN_FUNC): { return NDB_UNKNOWN_FUNC; }
|
|
|
|
case (Item_func::COND_AND_FUNC): { return NDB_COND_AND_FUNC; }
|
|
|
|
case (Item_func::COND_OR_FUNC): { return NDB_COND_OR_FUNC; }
|
|
|
|
default: { return NDB_UNSUPPORTED_FUNC; }
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static NDB_FUNC_TYPE negate(NDB_FUNC_TYPE fun)
|
2005-02-18 21:43:51 +01:00
|
|
|
{
|
2005-08-01 11:50:43 +02:00
|
|
|
uint i= (uint) fun;
|
|
|
|
DBUG_ASSERT(fun == neg_map[i].pos_fun);
|
2005-02-18 21:43:51 +01:00
|
|
|
return neg_map[i].neg_fun;
|
|
|
|
};
|
2005-02-11 22:05:24 +01:00
|
|
|
|
2004-12-17 21:13:22 +01:00
|
|
|
NDB_ITEM_TYPE type;
|
|
|
|
NDB_ITEM_QUALIFICATION qualification;
|
|
|
|
private:
|
|
|
|
NDB_ITEM_VALUE value;
|
|
|
|
};
|
|
|
|
|
2005-02-16 14:18:32 +01:00
|
|
|
/*
|
|
|
|
This class implements a linked list used for storing a
|
|
|
|
serialization of the Item tree for condition pushdown.
|
|
|
|
*/
|
|
|
|
class Ndb_cond
|
|
|
|
{
|
2004-12-17 21:13:22 +01:00
|
|
|
public:
|
|
|
|
Ndb_cond() : ndb_item(NULL), next(NULL), prev(NULL) {};
|
|
|
|
~Ndb_cond()
|
|
|
|
{
|
|
|
|
if (ndb_item) delete ndb_item;
|
|
|
|
ndb_item= NULL;
|
|
|
|
if (next) delete next;
|
|
|
|
next= prev= NULL;
|
|
|
|
};
|
|
|
|
Ndb_item *ndb_item;
|
|
|
|
Ndb_cond *next;
|
|
|
|
Ndb_cond *prev;
|
|
|
|
};
|
|
|
|
|
2005-02-16 14:18:32 +01:00
|
|
|
/*
|
|
|
|
This class implements a stack for storing several conditions
|
|
|
|
for pushdown (represented as serialized Item trees using Ndb_cond).
|
|
|
|
The current implementation only pushes one condition, but is
|
|
|
|
prepared for handling several (C1 AND C2 ...) if the logic for
|
|
|
|
pushing conditions is extended in sql_select.
|
|
|
|
*/
|
|
|
|
class Ndb_cond_stack
|
|
|
|
{
|
2004-12-17 21:13:22 +01:00
|
|
|
public:
|
|
|
|
Ndb_cond_stack() : ndb_cond(NULL), next(NULL) {};
|
|
|
|
~Ndb_cond_stack()
|
|
|
|
{
|
|
|
|
if (ndb_cond) delete ndb_cond;
|
|
|
|
ndb_cond= NULL;
|
2005-05-18 14:32:05 +02:00
|
|
|
if (next) delete next;
|
2004-12-17 21:13:22 +01:00
|
|
|
next= NULL;
|
|
|
|
};
|
|
|
|
Ndb_cond *ndb_cond;
|
|
|
|
Ndb_cond_stack *next;
|
|
|
|
};
|
|
|
|
|
2005-05-18 14:32:05 +02:00
|
|
|
class Ndb_rewrite_context
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Ndb_rewrite_context(Item_func *func)
|
|
|
|
: func_item(func), left_hand_item(NULL), count(0) {};
|
|
|
|
~Ndb_rewrite_context()
|
|
|
|
{
|
|
|
|
if (next) delete next;
|
|
|
|
}
|
|
|
|
const Item_func *func_item;
|
|
|
|
const Item *left_hand_item;
|
|
|
|
uint count;
|
|
|
|
Ndb_rewrite_context *next;
|
|
|
|
};
|
|
|
|
|
2005-02-16 14:18:32 +01:00
|
|
|
/*
|
|
|
|
This class is used for storing the context when traversing
|
|
|
|
the Item tree. It stores a reference to the table the condition
|
|
|
|
is defined on, the serialized representation being generated,
|
|
|
|
if the condition found is supported, and information what is
|
|
|
|
expected next in the tree inorder for the condition to be supported.
|
|
|
|
*/
|
|
|
|
class Ndb_cond_traverse_context
|
|
|
|
{
|
2004-12-17 21:13:22 +01:00
|
|
|
public:
|
2005-02-16 14:18:32 +01:00
|
|
|
Ndb_cond_traverse_context(TABLE *tab, void* ndb_tab, Ndb_cond_stack* stack)
|
2004-12-17 21:13:22 +01:00
|
|
|
: table(tab), ndb_table(ndb_tab),
|
2005-02-16 14:18:32 +01:00
|
|
|
supported(TRUE), stack_ptr(stack), cond_ptr(NULL),
|
2005-05-18 14:32:05 +02:00
|
|
|
expect_mask(0), expect_field_result_mask(0), skip(0), collation(NULL),
|
|
|
|
rewrite_stack(NULL)
|
2004-12-17 21:13:22 +01:00
|
|
|
{
|
|
|
|
if (stack)
|
|
|
|
cond_ptr= stack->ndb_cond;
|
|
|
|
};
|
2005-05-18 14:32:05 +02:00
|
|
|
~Ndb_cond_traverse_context()
|
|
|
|
{
|
|
|
|
if (rewrite_stack) delete rewrite_stack;
|
|
|
|
}
|
2004-12-17 21:13:22 +01:00
|
|
|
void expect(Item::Type type)
|
|
|
|
{
|
|
|
|
expect_mask|= (1 << type);
|
|
|
|
};
|
|
|
|
void dont_expect(Item::Type type)
|
|
|
|
{
|
|
|
|
expect_mask&= ~(1 << type);
|
|
|
|
};
|
|
|
|
bool expecting(Item::Type type)
|
|
|
|
{
|
|
|
|
return (expect_mask & (1 << type));
|
|
|
|
};
|
|
|
|
void expect_nothing()
|
|
|
|
{
|
|
|
|
expect_mask= 0;
|
|
|
|
};
|
2005-01-11 17:26:19 +01:00
|
|
|
void expect_only(Item::Type type)
|
|
|
|
{
|
|
|
|
expect_mask= 0;
|
|
|
|
expect(type);
|
|
|
|
};
|
2004-12-17 21:13:22 +01:00
|
|
|
|
|
|
|
void expect_field_result(Item_result result)
|
|
|
|
{
|
|
|
|
expect_field_result_mask|= (1 << result);
|
|
|
|
};
|
|
|
|
bool expecting_field_result(Item_result result)
|
|
|
|
{
|
|
|
|
return (expect_field_result_mask & (1 << result));
|
|
|
|
};
|
|
|
|
void expect_no_field_result()
|
|
|
|
{
|
|
|
|
expect_field_result_mask= 0;
|
|
|
|
};
|
2005-01-11 17:26:19 +01:00
|
|
|
void expect_only_field_result(Item_result result)
|
|
|
|
{
|
|
|
|
expect_field_result_mask= 0;
|
|
|
|
expect_field_result(result);
|
|
|
|
};
|
2005-02-23 15:51:26 +01:00
|
|
|
void expect_collation(CHARSET_INFO* col)
|
|
|
|
{
|
|
|
|
collation= col;
|
|
|
|
};
|
|
|
|
bool expecting_collation(CHARSET_INFO* col)
|
|
|
|
{
|
|
|
|
bool matching= (!collation) ? true : (collation == col);
|
|
|
|
collation= NULL;
|
|
|
|
|
|
|
|
return matching;
|
|
|
|
};
|
2004-12-17 21:13:22 +01:00
|
|
|
|
|
|
|
TABLE* table;
|
|
|
|
void* ndb_table;
|
2005-02-16 14:18:32 +01:00
|
|
|
bool supported;
|
2004-12-17 21:13:22 +01:00
|
|
|
Ndb_cond_stack* stack_ptr;
|
|
|
|
Ndb_cond* cond_ptr;
|
|
|
|
uint expect_mask;
|
|
|
|
uint expect_field_result_mask;
|
2005-02-11 22:05:24 +01:00
|
|
|
uint skip;
|
2005-02-23 15:51:26 +01:00
|
|
|
CHARSET_INFO* collation;
|
2005-05-18 14:32:05 +02:00
|
|
|
Ndb_rewrite_context *rewrite_stack;
|
2004-12-17 21:13:22 +01:00
|
|
|
};
|
|
|
|
|
2004-09-14 14:47:34 +02:00
|
|
|
/*
|
|
|
|
Place holder for ha_ndbcluster thread specific data
|
|
|
|
*/
|
|
|
|
|
2006-01-12 19:51:02 +01:00
|
|
|
enum THD_NDB_OPTIONS
|
|
|
|
{
|
|
|
|
TNO_NO_LOG_SCHEMA_OP= 1 << 0
|
|
|
|
};
|
|
|
|
|
2006-04-19 18:29:25 +02:00
|
|
|
struct Ndb_local_table_statistics {
|
|
|
|
int no_uncommitted_rows_count;
|
|
|
|
ulong last_count;
|
|
|
|
ha_rows records;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct st_thd_ndb_share {
|
|
|
|
const void *key;
|
|
|
|
struct Ndb_local_table_statistics stat;
|
|
|
|
} THD_NDB_SHARE;
|
|
|
|
|
2005-02-16 14:18:32 +01:00
|
|
|
class Thd_ndb
|
|
|
|
{
|
2004-09-14 14:47:34 +02:00
|
|
|
public:
|
|
|
|
Thd_ndb();
|
|
|
|
~Thd_ndb();
|
2006-04-19 18:29:25 +02:00
|
|
|
|
|
|
|
void init_open_tables();
|
|
|
|
THD_NDB_SHARE *get_open_table(THD *thd, const void *key);
|
|
|
|
|
2004-09-14 14:47:34 +02:00
|
|
|
Ndb *ndb;
|
|
|
|
ulong count;
|
|
|
|
uint lock_count;
|
2005-02-17 22:52:40 +01:00
|
|
|
NdbTransaction *all;
|
|
|
|
NdbTransaction *stmt;
|
2004-09-14 18:17:01 +02:00
|
|
|
int error;
|
2006-01-12 19:51:02 +01:00
|
|
|
uint32 options;
|
2005-03-15 15:03:25 +01:00
|
|
|
List<NDB_SHARE> changed_tables;
|
2006-04-19 18:29:25 +02:00
|
|
|
HASH open_tables;
|
2004-09-14 14:47:34 +02:00
|
|
|
};
|
|
|
|
|
2004-04-15 09:14:14 +02:00
|
|
|
class ha_ndbcluster: public handler
|
|
|
|
{
|
|
|
|
public:
|
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
|
|
|
ha_ndbcluster(TABLE_SHARE *table);
|
2004-04-15 09:14:14 +02:00
|
|
|
~ha_ndbcluster();
|
|
|
|
|
|
|
|
int open(const char *name, int mode, uint test_if_locked);
|
|
|
|
int close(void);
|
|
|
|
|
|
|
|
int write_row(byte *buf);
|
|
|
|
int update_row(const byte *old_data, byte *new_data);
|
|
|
|
int delete_row(const byte *buf);
|
2005-07-18 13:31:02 +02:00
|
|
|
int index_init(uint index, bool sorted);
|
2004-04-15 09:14:14 +02:00
|
|
|
int index_end();
|
|
|
|
int index_read(byte *buf, const byte *key, uint key_len,
|
2005-02-16 14:18:32 +01:00
|
|
|
enum ha_rkey_function find_flag);
|
2004-04-15 09:14:14 +02:00
|
|
|
int index_read_idx(byte *buf, uint index, const byte *key, uint key_len,
|
2005-02-16 14:18:32 +01:00
|
|
|
enum ha_rkey_function find_flag);
|
2004-04-15 09:14:14 +02:00
|
|
|
int index_next(byte *buf);
|
|
|
|
int index_prev(byte *buf);
|
|
|
|
int index_first(byte *buf);
|
|
|
|
int index_last(byte *buf);
|
2004-12-20 15:12:42 +01:00
|
|
|
int index_read_last(byte * buf, const byte * key, uint key_len);
|
2004-06-25 17:49:36 +02:00
|
|
|
int rnd_init(bool scan);
|
2004-04-15 09:14:14 +02:00
|
|
|
int rnd_end();
|
|
|
|
int rnd_next(byte *buf);
|
|
|
|
int rnd_pos(byte *buf, byte *pos);
|
|
|
|
void position(const byte *record);
|
2004-04-30 13:38:41 +02:00
|
|
|
int read_range_first(const key_range *start_key,
|
2005-02-16 14:18:32 +01:00
|
|
|
const key_range *end_key,
|
|
|
|
bool eq_range, bool sorted);
|
2004-09-07 16:22:42 +02:00
|
|
|
int read_range_first_to_buf(const key_range *start_key,
|
2005-02-16 14:18:32 +01:00
|
|
|
const key_range *end_key,
|
|
|
|
bool eq_range, bool sorted,
|
|
|
|
byte* buf);
|
2004-05-24 12:35:39 +02:00
|
|
|
int read_range_next();
|
2006-01-11 11:35:25 +01:00
|
|
|
int alter_tablespace(st_alter_tablespace *info);
|
2004-04-30 13:38:41 +02:00
|
|
|
|
2004-11-17 10:07:52 +01:00
|
|
|
/**
|
|
|
|
* Multi range stuff
|
|
|
|
*/
|
2004-12-28 17:01:07 +01:00
|
|
|
int read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
|
2005-02-16 14:18:32 +01:00
|
|
|
KEY_MULTI_RANGE*ranges, uint range_count,
|
|
|
|
bool sorted, HANDLER_BUFFER *buffer);
|
2004-12-28 17:01:07 +01:00
|
|
|
int read_multi_range_next(KEY_MULTI_RANGE **found_range_p);
|
2004-11-17 10:07:52 +01:00
|
|
|
|
2004-05-24 12:35:39 +02:00
|
|
|
bool get_error_message(int error, String *buf);
|
2004-04-15 09:14:14 +02:00
|
|
|
void info(uint);
|
2006-01-10 16:44:04 +01:00
|
|
|
void get_dynamic_partition_info(PARTITION_INFO *stat_info, uint part_id);
|
2004-04-15 09:14:14 +02:00
|
|
|
int extra(enum ha_extra_function operation);
|
|
|
|
int extra_opt(enum ha_extra_function operation, ulong cache_size);
|
|
|
|
int external_lock(THD *thd, int lock_type);
|
2005-09-30 20:20:10 +02:00
|
|
|
int start_stmt(THD *thd, thr_lock_type lock_type);
|
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 print_error(int error, myf errflag);
|
2004-11-17 09:15:53 +01:00
|
|
|
const char * table_type() const;
|
2004-04-15 09:14:14 +02:00
|
|
|
const char ** bas_ext() const;
|
2004-11-17 09:15:53 +01:00
|
|
|
ulong table_flags(void) const;
|
2006-04-11 14:06:32 +02:00
|
|
|
void prepare_for_alter();
|
2006-01-13 11:51:30 +01:00
|
|
|
int add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys);
|
|
|
|
int prepare_drop_index(TABLE *table_arg, uint *key_num, uint num_of_keys);
|
|
|
|
int final_drop_index(TABLE *table_arg);
|
2005-11-25 09:11:52 +01:00
|
|
|
void set_part_info(partition_info *part_info);
|
2004-07-08 14:45:25 +02:00
|
|
|
ulong index_flags(uint idx, uint part, bool all_parts) const;
|
2004-11-17 09:15:53 +01:00
|
|
|
uint max_supported_record_length() const;
|
|
|
|
uint max_supported_keys() const;
|
|
|
|
uint max_supported_key_parts() const;
|
|
|
|
uint max_supported_key_length() const;
|
2006-02-07 19:57:31 +01:00
|
|
|
uint max_supported_key_part_length() const;
|
2004-04-15 09:14:14 +02:00
|
|
|
|
|
|
|
int rename_table(const char *from, const char *to);
|
|
|
|
int delete_table(const char *name);
|
|
|
|
int create(const char *name, TABLE *form, HA_CREATE_INFO *info);
|
2006-02-01 10:06:07 +01:00
|
|
|
int create_handler_files(const char *file, const char *old_name,
|
2006-04-20 03:22:35 +02:00
|
|
|
int action_flag, HA_CREATE_INFO *info);
|
2005-07-18 13:31:02 +02:00
|
|
|
int get_default_no_partitions(ulonglong max_rows);
|
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
|
|
|
bool get_no_parts(const char *name, uint *no_parts);
|
|
|
|
void set_auto_partitions(partition_info *part_info);
|
|
|
|
|
2004-04-15 09:14:14 +02:00
|
|
|
THR_LOCK_DATA **store_lock(THD *thd,
|
2005-02-16 14:18:32 +01:00
|
|
|
THR_LOCK_DATA **to,
|
|
|
|
enum thr_lock_type lock_type);
|
2004-04-15 09:14:14 +02:00
|
|
|
|
2004-11-17 09:15:53 +01:00
|
|
|
bool low_byte_first() const;
|
|
|
|
bool has_transactions();
|
2006-01-12 19:51:02 +01:00
|
|
|
|
|
|
|
virtual bool is_injective() const { return true; }
|
|
|
|
|
2004-11-17 09:15:53 +01:00
|
|
|
const char* index_type(uint key_number);
|
2004-04-15 09:14:14 +02:00
|
|
|
|
|
|
|
double scan_time();
|
2004-05-16 13:48:32 +02:00
|
|
|
ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key);
|
2004-04-29 14:38:35 +02:00
|
|
|
void start_bulk_insert(ha_rows rows);
|
|
|
|
int end_bulk_insert();
|
2004-04-15 09:14:14 +02:00
|
|
|
|
2004-09-14 14:47:34 +02:00
|
|
|
static Thd_ndb* seize_thd_ndb();
|
|
|
|
static void release_thd_ndb(Thd_ndb* thd_ndb);
|
2004-12-17 21:13:22 +01:00
|
|
|
|
2005-04-22 17:38:28 +02:00
|
|
|
static void set_dbname(const char *pathname, char *dbname);
|
|
|
|
static void set_tabname(const char *pathname, char *tabname);
|
|
|
|
|
2004-12-17 21:13:22 +01:00
|
|
|
/*
|
|
|
|
Condition pushdown
|
|
|
|
*/
|
2005-02-23 15:51:26 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
Push condition down to the table handler.
|
|
|
|
SYNOPSIS
|
|
|
|
cond_push()
|
|
|
|
cond Condition to be pushed. The condition tree must not be
|
|
|
|
modified by the by the caller.
|
|
|
|
RETURN
|
|
|
|
The 'remainder' condition that caller must use to filter out records.
|
|
|
|
NULL means the handler will not return rows that do not match the
|
|
|
|
passed condition.
|
|
|
|
NOTES
|
|
|
|
The pushed conditions form a stack (from which one can remove the
|
|
|
|
last pushed condition using cond_pop).
|
|
|
|
The table handler filters out rows using (pushed_cond1 AND pushed_cond2
|
|
|
|
AND ... AND pushed_condN)
|
|
|
|
or less restrictive condition, depending on handler's capabilities.
|
|
|
|
|
|
|
|
handler->extra(HA_EXTRA_RESET) call empties the condition stack.
|
|
|
|
Calls to rnd_init/rnd_end, index_init/index_end etc do not affect the
|
|
|
|
condition stack.
|
|
|
|
The current implementation supports arbitrary AND/OR nested conditions
|
|
|
|
with comparisons between columns and constants (including constant
|
|
|
|
expressions and function calls) and the following comparison operators:
|
|
|
|
=, !=, >, >=, <, <=, like, "not like", "is null", and "is not null".
|
|
|
|
Negated conditions are supported by NOT which generate NAND/NOR groups.
|
|
|
|
*/
|
2004-12-17 21:13:22 +01:00
|
|
|
const COND *cond_push(const COND *cond);
|
2005-02-23 15:51:26 +01:00
|
|
|
/*
|
|
|
|
Pop the top condition from the condition stack of the handler instance.
|
|
|
|
SYNOPSIS
|
|
|
|
cond_pop()
|
|
|
|
Pops the top if condition stack, if stack is not empty
|
|
|
|
*/
|
2004-12-17 21:13:22 +01:00
|
|
|
void cond_pop();
|
|
|
|
|
2004-11-17 09:15:53 +01:00
|
|
|
uint8 table_cache_type();
|
2005-02-04 10:56:53 +01:00
|
|
|
my_bool register_query_cache_table(THD *thd, char *table_key,
|
2005-02-16 14:18:32 +01:00
|
|
|
uint key_length,
|
|
|
|
qc_engine_callback *engine_callback,
|
|
|
|
ulonglong *engine_data);
|
2005-07-22 22:43:59 +02:00
|
|
|
|
2005-08-18 12:24:52 +02:00
|
|
|
bool check_if_incompatible_data(HA_CREATE_INFO *info,
|
|
|
|
uint table_changes);
|
2005-07-22 22:43:59 +02:00
|
|
|
|
2005-02-04 10:56:53 +01:00
|
|
|
private:
|
2005-11-07 16:25:06 +01:00
|
|
|
friend int ndbcluster_drop_database_impl(const char *path);
|
2006-02-17 09:44:12 +01:00
|
|
|
friend int ndb_handle_schema_change(THD *thd,
|
|
|
|
Ndb *ndb, NdbEventOperation *pOp,
|
|
|
|
NDB_SHARE *share);
|
|
|
|
|
2004-12-06 14:51:10 +01:00
|
|
|
int alter_table_name(const char *to);
|
2005-11-06 00:20:37 +01:00
|
|
|
static int delete_table(ha_ndbcluster *h, Ndb *ndb,
|
|
|
|
const char *path,
|
|
|
|
const char *db,
|
|
|
|
const char *table_name);
|
2006-01-11 12:35:28 +01:00
|
|
|
int drop_ndb_table();
|
|
|
|
int create_ndb_index(const char *name, KEY *key_info, bool unique);
|
2004-04-30 12:25:31 +02:00
|
|
|
int create_ordered_index(const char *name, KEY *key_info);
|
|
|
|
int create_unique_index(const char *name, KEY *key_info);
|
2006-01-11 12:35:28 +01:00
|
|
|
int create_index(const char *name, KEY *key_info,
|
|
|
|
NDB_INDEX_TYPE idx_type, uint idx_no);
|
|
|
|
int drop_ndb_index(const char *name);
|
2006-01-17 12:53:49 +01:00
|
|
|
int table_changed(const void *pack_frm_data, uint pack_frm_len);
|
2006-01-11 12:35:28 +01:00
|
|
|
// Index list management
|
|
|
|
int create_indexes(Ndb *ndb, TABLE *tab);
|
|
|
|
void clear_index(int i);
|
|
|
|
void clear_indexes();
|
2006-02-17 09:44:12 +01:00
|
|
|
int open_indexes(Ndb *ndb, TABLE *tab, bool ignore_error);
|
2006-01-27 17:23:14 +01:00
|
|
|
void renumber_indexes(Ndb *ndb, TABLE *tab);
|
2006-01-11 12:35:28 +01:00
|
|
|
int drop_indexes(Ndb *ndb, TABLE *tab);
|
|
|
|
int add_index_handle(THD *thd, NdbDictionary::Dictionary *dict,
|
|
|
|
KEY *key_info, const char *index_name, uint index_no);
|
2004-08-19 11:10:35 +02:00
|
|
|
int initialize_autoincrement(const void *table);
|
2004-04-15 09:14:14 +02:00
|
|
|
int get_metadata(const char* path);
|
|
|
|
void release_metadata();
|
|
|
|
NDB_INDEX_TYPE get_index_type(uint idx_no) const;
|
|
|
|
NDB_INDEX_TYPE get_index_type_from_table(uint index_no) const;
|
2006-03-09 13:41:11 +01:00
|
|
|
NDB_INDEX_TYPE get_index_type_from_key(uint index_no, KEY *key_info,
|
|
|
|
bool primary) const;
|
2004-11-22 10:35:03 +01:00
|
|
|
int check_index_fields_not_null(uint index_no);
|
|
|
|
|
2005-07-18 13:31:02 +02:00
|
|
|
uint set_up_partition_info(partition_info *part_info,
|
|
|
|
TABLE *table,
|
|
|
|
void *tab);
|
2006-02-13 21:55:49 +01:00
|
|
|
char* get_tablespace_name(THD *thd);
|
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 set_range_data(void *tab, partition_info* part_info);
|
|
|
|
int set_list_data(void *tab, partition_info* part_info);
|
2006-03-01 15:24:46 +01:00
|
|
|
int complemented_read(const byte *old_data, byte *new_data,
|
|
|
|
uint32 old_part_id);
|
2005-07-18 13:31:02 +02:00
|
|
|
int pk_read(const byte *key, uint key_len, byte *buf, uint32 part_id);
|
2004-04-30 13:38:41 +02:00
|
|
|
int ordered_index_scan(const key_range *start_key,
|
2005-02-16 14:18:32 +01:00
|
|
|
const key_range *end_key,
|
2005-07-18 13:31:02 +02:00
|
|
|
bool sorted, bool descending, byte* buf,
|
|
|
|
part_id_range *part_spec);
|
2004-04-15 09:14:14 +02:00
|
|
|
int full_table_scan(byte * buf);
|
2005-07-18 13:31:02 +02:00
|
|
|
|
2006-03-24 10:42:55 +01:00
|
|
|
bool check_all_operations_for_error(NdbTransaction *trans,
|
|
|
|
const NdbOperation *first,
|
|
|
|
const NdbOperation *last,
|
|
|
|
uint errcode);
|
|
|
|
int peek_indexed_rows(const byte *record);
|
2005-07-18 13:31:02 +02:00
|
|
|
int unique_index_read(const byte *key, uint key_len,
|
|
|
|
byte *buf);
|
2004-12-08 00:36:40 +01:00
|
|
|
int fetch_next(NdbScanOperation* op);
|
2004-04-15 09:14:14 +02:00
|
|
|
int next_result(byte *buf);
|
2004-05-10 14:12:28 +02:00
|
|
|
int define_read_attrs(byte* buf, NdbOperation* op);
|
2004-04-15 09:14:14 +02:00
|
|
|
int filtered_scan(const byte *key, uint key_len,
|
2005-02-16 14:18:32 +01:00
|
|
|
byte *buf,
|
|
|
|
enum ha_rkey_function find_flag);
|
2004-05-11 13:59:22 +02:00
|
|
|
int close_scan();
|
2004-04-15 09:14:14 +02:00
|
|
|
void unpack_record(byte *buf);
|
2004-07-22 12:38:09 +02:00
|
|
|
int get_ndb_lock_type(enum thr_lock_type type);
|
2004-04-15 09:14:14 +02:00
|
|
|
|
|
|
|
void set_dbname(const char *pathname);
|
|
|
|
void set_tabname(const char *pathname);
|
|
|
|
|
|
|
|
bool set_hidden_key(NdbOperation*,
|
2005-02-16 14:18:32 +01:00
|
|
|
uint fieldnr, const byte* field_ptr);
|
2004-04-15 09:14:14 +02:00
|
|
|
int set_ndb_key(NdbOperation*, Field *field,
|
2005-02-16 14:18:32 +01:00
|
|
|
uint fieldnr, const byte* field_ptr);
|
2005-11-06 00:20:37 +01:00
|
|
|
int set_ndb_value(NdbOperation*, Field *field, uint fieldnr,
|
|
|
|
int row_offset= 0, bool *set_blob_value= 0);
|
2004-09-20 20:50:48 +02:00
|
|
|
int get_ndb_value(NdbOperation*, Field *field, uint fieldnr, byte*);
|
2006-03-20 09:35:56 +01:00
|
|
|
int get_ndb_partition_id(NdbOperation *);
|
2004-07-29 10:44:53 +02:00
|
|
|
friend int g_get_ndb_blobs_value(NdbBlob *ndb_blob, void *arg);
|
2004-07-22 12:38:09 +02:00
|
|
|
int get_ndb_blobs_value(NdbBlob *last_ndb_blob);
|
2004-04-15 09:14:14 +02:00
|
|
|
int set_primary_key(NdbOperation *op, const byte *key);
|
2005-07-06 11:23:36 +02:00
|
|
|
int set_primary_key_from_record(NdbOperation *op, const byte *record);
|
2006-03-24 10:42:55 +01:00
|
|
|
int set_index_key_from_record(NdbOperation *op, const byte *record,
|
|
|
|
uint keyno);
|
2005-09-15 02:33:28 +02:00
|
|
|
int set_bounds(NdbIndexScanOperation*, uint inx, bool rir,
|
|
|
|
const key_range *keys[2], uint= 0);
|
2004-04-15 09:14:14 +02:00
|
|
|
int key_cmp(uint keynr, const byte * old_row, const byte * new_row);
|
2004-11-30 13:37:03 +01:00
|
|
|
int set_index_key(NdbOperation *, const KEY *key_info, const byte *key_ptr);
|
2004-04-15 09:14:14 +02:00
|
|
|
void print_results();
|
|
|
|
|
2004-09-15 21:10:31 +02:00
|
|
|
ulonglong get_auto_increment();
|
2006-04-19 14:54:39 +02:00
|
|
|
int invalidate_dictionary_cache(bool global,
|
|
|
|
const NdbDictionary::Table *ndbtab);
|
2004-12-23 11:21:01 +01:00
|
|
|
int ndb_err(NdbTransaction*);
|
2005-04-28 14:45:27 +02:00
|
|
|
bool uses_blob_value();
|
2004-04-15 09:14:14 +02:00
|
|
|
|
2005-02-01 10:03:37 +01:00
|
|
|
char *update_table_comment(const char * comment);
|
|
|
|
|
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 write_ndb_file(const char *name);
|
2004-09-13 14:46:38 +02:00
|
|
|
|
2005-03-15 15:03:25 +01:00
|
|
|
int check_ndb_connection(THD* thd= current_thd);
|
2004-04-15 09:14:14 +02:00
|
|
|
|
2004-12-17 21:13:22 +01:00
|
|
|
void set_rec_per_key();
|
|
|
|
void records_update();
|
|
|
|
void no_uncommitted_rows_execute_failure();
|
|
|
|
void no_uncommitted_rows_update(int);
|
|
|
|
void no_uncommitted_rows_reset(THD *);
|
|
|
|
|
|
|
|
/*
|
2005-02-11 22:05:24 +01:00
|
|
|
Condition pushdown
|
2004-12-17 21:13:22 +01:00
|
|
|
*/
|
|
|
|
void cond_clear();
|
|
|
|
bool serialize_cond(const COND *cond, Ndb_cond_stack *ndb_cond);
|
2005-01-07 15:33:24 +01:00
|
|
|
int build_scan_filter_predicate(Ndb_cond* &cond,
|
2005-02-18 21:43:51 +01:00
|
|
|
NdbScanFilter* filter,
|
|
|
|
bool negated= false);
|
2005-01-07 15:33:24 +01:00
|
|
|
int build_scan_filter_group(Ndb_cond* &cond,
|
2005-02-23 15:51:26 +01:00
|
|
|
NdbScanFilter* filter);
|
2005-01-07 15:33:24 +01:00
|
|
|
int build_scan_filter(Ndb_cond* &cond, NdbScanFilter* filter);
|
|
|
|
int generate_scan_filter(Ndb_cond_stack* cond_stack,
|
2005-02-16 14:18:32 +01:00
|
|
|
NdbScanOperation* op);
|
2004-12-17 21:13:22 +01:00
|
|
|
|
2004-12-29 09:54:48 +01:00
|
|
|
friend int execute_commit(ha_ndbcluster*, NdbTransaction*);
|
2005-11-06 00:20:37 +01:00
|
|
|
friend int execute_no_commit_ignore_no_key(ha_ndbcluster*, NdbTransaction*);
|
2004-12-29 09:54:48 +01:00
|
|
|
friend int execute_no_commit(ha_ndbcluster*, NdbTransaction*);
|
|
|
|
friend int execute_no_commit_ie(ha_ndbcluster*, NdbTransaction*);
|
2004-12-17 21:13:22 +01:00
|
|
|
|
2004-12-23 11:21:01 +01:00
|
|
|
NdbTransaction *m_active_trans;
|
2004-12-08 00:36:40 +01:00
|
|
|
NdbScanOperation *m_active_cursor;
|
2006-04-19 14:54:39 +02:00
|
|
|
const NdbDictionary::Table *m_table;
|
2005-04-27 18:17:41 +02:00
|
|
|
int m_table_version;
|
2006-04-19 18:29:25 +02:00
|
|
|
struct Ndb_local_table_statistics *m_table_info;
|
2004-04-15 09:14:14 +02:00
|
|
|
char m_dbname[FN_HEADLEN];
|
|
|
|
//char m_schemaname[FN_HEADLEN];
|
|
|
|
char m_tabname[FN_HEADLEN];
|
|
|
|
ulong m_table_flags;
|
|
|
|
THR_LOCK_DATA m_lock;
|
|
|
|
NDB_SHARE *m_share;
|
2004-08-18 19:13:39 +02:00
|
|
|
NDB_INDEX_DATA m_index[MAX_KEY];
|
2006-04-19 18:29:25 +02:00
|
|
|
THD_NDB_SHARE *m_thd_ndb_share;
|
2004-07-22 12:38:09 +02:00
|
|
|
// NdbRecAttr has no reference to blob
|
|
|
|
NdbValue m_value[NDB_MAX_ATTRIBUTES_IN_TABLE];
|
2006-02-10 17:40:22 +01:00
|
|
|
byte m_ref[NDB_HIDDEN_PRIMARY_KEY_LENGTH];
|
2005-07-18 13:31:02 +02:00
|
|
|
partition_info *m_part_info;
|
2006-03-14 15:27:38 +01:00
|
|
|
uint32 m_part_id;
|
2005-07-18 13:31:02 +02:00
|
|
|
byte *m_rec0;
|
|
|
|
Field **m_part_field_array;
|
|
|
|
bool m_use_partition_function;
|
|
|
|
bool m_sorted;
|
2004-04-15 09:14:14 +02:00
|
|
|
bool m_use_write;
|
2004-11-18 12:11:56 +01:00
|
|
|
bool m_ignore_dup_key;
|
2006-03-24 10:42:55 +01:00
|
|
|
bool m_has_unique_index;
|
2004-11-03 15:53:26 +01:00
|
|
|
bool m_primary_key_update;
|
2005-04-28 14:45:27 +02:00
|
|
|
bool m_write_op;
|
2005-11-06 00:20:37 +01:00
|
|
|
bool m_ignore_no_key;
|
2004-11-03 15:53:26 +01:00
|
|
|
ha_rows m_rows_to_insert;
|
|
|
|
ha_rows m_rows_inserted;
|
|
|
|
ha_rows m_bulk_insert_rows;
|
2005-03-15 15:03:25 +01:00
|
|
|
ha_rows m_rows_changed;
|
2004-11-03 15:53:26 +01:00
|
|
|
bool m_bulk_insert_not_flushed;
|
|
|
|
ha_rows m_ops_pending;
|
|
|
|
bool m_skip_auto_increment;
|
|
|
|
bool m_blobs_pending;
|
2004-07-22 12:38:09 +02:00
|
|
|
// memory for blobs in one tuple
|
2004-11-03 15:53:26 +01:00
|
|
|
char *m_blobs_buffer;
|
|
|
|
uint32 m_blobs_buffer_size;
|
|
|
|
uint m_dupkey;
|
2004-11-22 14:41:46 +01:00
|
|
|
// set from thread variables at external lock
|
2004-11-17 09:15:53 +01:00
|
|
|
bool m_ha_not_exact_count;
|
|
|
|
bool m_force_send;
|
|
|
|
ha_rows m_autoincrement_prefetch;
|
|
|
|
bool m_transaction_on;
|
2004-12-17 21:13:22 +01:00
|
|
|
Ndb_cond_stack *m_cond_stack;
|
2004-11-17 10:07:52 +01:00
|
|
|
bool m_disable_multi_read;
|
2004-12-08 00:36:40 +01:00
|
|
|
byte *m_multi_range_result_ptr;
|
2004-12-28 17:01:07 +01:00
|
|
|
KEY_MULTI_RANGE *m_multi_ranges;
|
|
|
|
KEY_MULTI_RANGE *m_multi_range_defined;
|
2004-12-08 00:36:40 +01:00
|
|
|
const NdbOperation *m_current_multi_operation;
|
|
|
|
NdbIndexScanOperation *m_multi_cursor;
|
|
|
|
byte *m_multi_range_cursor_result_ptr;
|
2004-12-01 12:43:30 +01:00
|
|
|
int setup_recattr(const NdbRecAttr*);
|
2004-12-30 19:56:09 +01:00
|
|
|
Ndb *get_ndb();
|
2004-04-15 09:14:14 +02:00
|
|
|
};
|
|
|
|
|
2006-01-07 16:27:40 +01:00
|
|
|
extern SHOW_VAR ndb_status_variables[];
|
2005-01-14 12:32:33 +01:00
|
|
|
|
2004-09-13 14:46:38 +02:00
|
|
|
int ndbcluster_discover(THD* thd, const char* dbname, const char* name,
|
2005-02-16 14:18:32 +01:00
|
|
|
const void** frmblob, uint* frmlen);
|
2004-09-21 12:13:58 +02:00
|
|
|
int ndbcluster_find_files(THD *thd,const char *db,const char *path,
|
2005-02-16 14:18:32 +01:00
|
|
|
const char *wild, bool dir, List<char> *files);
|
BUG#10365 Cluster handler uses non-standard error codes
- Added better error messages when trying to open a table that can't be discovered or unpacked. The most likely cause of this is that it does not have any frm data, probably since it has been created from NdbApi or is a NDB system table.
- Separated functionality that was in ha_create_table_from_engine into two functions. One that checks if the table exists and another one that tries to create the table from the engine.
mysql-test/r/ndb_autodiscover.result:
Add tests for reading from a table that can't be discovered(SYSTAB_0)
Discovery is not performed during create table anymore.
mysql-test/t/ndb_autodiscover.test:
Add tests for reading from a table that can't be discovered(SYSTAB_0)
Discovery is not performed during create table anymore.
ndb/test/ndbapi/create_tab.cpp:
Set connectstring before creating Ndb object.
sql/ha_ndbcluster.cc:
Rename and use the function ndbcluster_table_exists_in_engine.
Correct return valu from ndbcluster_discover
Remove old code "ndb_discover_tables"
sql/ha_ndbcluster.h:
Rename function ndbcluster_table_exists to ndb ndbcluster_table_exists_in_engine
sql/handler.cc:
Update comment of ha_create_table_from_engine
Remove parameter create_if_found from ha_create_table_from_engine, the function ha_table_exists_in_engine is now used toi check if table is found in engine.
Cleanup return codes from ha_create_table_from_engine.
Change name of ha_table_exists to ha_table_exists_in_engine, update comment and returne codes.
sql/handler.h:
Remove paramter create_if_cound from ha_create_table_from_engine
Rename ha_table_exists to ha_table_exists_in_engine
sql/sql_base.cc:
Use the function ha_table_exists_in_engine to detect if table exists in enegine.
If it exists, call function ha_create_table_from_engine to try and create it.
If create of table fails, set correct error message.
sql/sql_table.cc:
Add comments, remove parameter create_if_found to ha_create_table_from_engine.
When dropping a table, try to discover it from engine. If discover fails, use same error message as if the table didn't exists.
Maybe another message should be displayed here, ex: "Table could not be dropped, unpack failed"
When creating a new table, use ha_table_exists_in_engine to check if a table with the given name already exists.
2005-06-08 13:31:59 +02:00
|
|
|
int ndbcluster_table_exists_in_engine(THD* thd,
|
|
|
|
const char *db, const char *name);
|
2004-07-02 16:14:08 +02:00
|
|
|
void ndbcluster_print_error(int error, const NdbOperation *error_op);
|