mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Enabled usage of new system variables for ndb
- ndb_use_exact_count - ndb_autoincrement_prefetch_sz - ndb_use_transactions - ndb_force_send moved "inlined" functions to .cc file since they are virtual anyways enabled printout od ndb errors in warnings even if mapping existst to mysql error code sql/ha_ndbcluster.h: Enabled usage of new system variables for ndb - ndb_use_exact_count - ndb_autoincrement_prefetch_sz - ndb_use_transactions - ndb_force_send moved "inlined" functions to .cc file since they are virtual anyways sql/mysqld.cc: Enabled usage of new system variables for ndb - ndb_use_exact_count - ndb_autoincrement_prefetch_sz - ndb_use_transactions - ndb_force_send sql/set_var.cc: Enabled usage of new system variables for ndb - ndb_use_exact_count - ndb_autoincrement_prefetch_sz - ndb_use_transactions - ndb_force_send sql/sql_class.h: Enabled usage of new system variables for ndb - ndb_use_exact_count - ndb_autoincrement_prefetch_sz - ndb_use_transactions - ndb_force_send
This commit is contained in:
@ -39,9 +39,6 @@ static const int parallelism= 240;
|
|||||||
// createable against NDB from this handler
|
// createable against NDB from this handler
|
||||||
static const int max_transactions= 256;
|
static const int max_transactions= 256;
|
||||||
|
|
||||||
// Default value for prefetch of autoincrement values
|
|
||||||
static const ha_rows autoincrement_prefetch= 32;
|
|
||||||
|
|
||||||
// connectstring to cluster if given by mysqld
|
// connectstring to cluster if given by mysqld
|
||||||
const char *ndbcluster_connectstring= 0;
|
const char *ndbcluster_connectstring= 0;
|
||||||
|
|
||||||
@ -103,58 +100,52 @@ struct err_code_mapping
|
|||||||
{
|
{
|
||||||
int ndb_err;
|
int ndb_err;
|
||||||
int my_err;
|
int my_err;
|
||||||
|
int show_warning;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const err_code_mapping err_map[]=
|
static const err_code_mapping err_map[]=
|
||||||
{
|
{
|
||||||
{ 626, HA_ERR_KEY_NOT_FOUND },
|
{ 626, HA_ERR_KEY_NOT_FOUND, 0 },
|
||||||
{ 630, HA_ERR_FOUND_DUPP_KEY },
|
{ 630, HA_ERR_FOUND_DUPP_KEY, 0 },
|
||||||
{ 893, HA_ERR_FOUND_DUPP_UNIQUE },
|
{ 893, HA_ERR_FOUND_DUPP_UNIQUE, 0 },
|
||||||
{ 721, HA_ERR_TABLE_EXIST },
|
{ 721, HA_ERR_TABLE_EXIST, 1 },
|
||||||
{ 4244, HA_ERR_TABLE_EXIST },
|
{ 4244, HA_ERR_TABLE_EXIST, 1 },
|
||||||
|
|
||||||
{ 709, HA_ERR_NO_SUCH_TABLE },
|
{ 709, HA_ERR_NO_SUCH_TABLE, 1 },
|
||||||
{ 284, HA_ERR_NO_SUCH_TABLE },
|
{ 284, HA_ERR_NO_SUCH_TABLE, 1 },
|
||||||
|
|
||||||
{ 266, HA_ERR_LOCK_WAIT_TIMEOUT },
|
{ 266, HA_ERR_LOCK_WAIT_TIMEOUT, 1 },
|
||||||
{ 274, HA_ERR_LOCK_WAIT_TIMEOUT },
|
{ 274, HA_ERR_LOCK_WAIT_TIMEOUT, 1 },
|
||||||
{ 296, HA_ERR_LOCK_WAIT_TIMEOUT },
|
{ 296, HA_ERR_LOCK_WAIT_TIMEOUT, 1 },
|
||||||
{ 297, HA_ERR_LOCK_WAIT_TIMEOUT },
|
{ 297, HA_ERR_LOCK_WAIT_TIMEOUT, 1 },
|
||||||
{ 237, HA_ERR_LOCK_WAIT_TIMEOUT },
|
{ 237, HA_ERR_LOCK_WAIT_TIMEOUT, 1 },
|
||||||
|
|
||||||
{ 623, HA_ERR_RECORD_FILE_FULL },
|
{ 623, HA_ERR_RECORD_FILE_FULL, 1 },
|
||||||
{ 624, HA_ERR_RECORD_FILE_FULL },
|
{ 624, HA_ERR_RECORD_FILE_FULL, 1 },
|
||||||
{ 625, HA_ERR_RECORD_FILE_FULL },
|
{ 625, HA_ERR_RECORD_FILE_FULL, 1 },
|
||||||
{ 826, HA_ERR_RECORD_FILE_FULL },
|
{ 826, HA_ERR_RECORD_FILE_FULL, 1 },
|
||||||
{ 827, HA_ERR_RECORD_FILE_FULL },
|
{ 827, HA_ERR_RECORD_FILE_FULL, 1 },
|
||||||
{ 832, HA_ERR_RECORD_FILE_FULL },
|
{ 832, HA_ERR_RECORD_FILE_FULL, 1 },
|
||||||
|
|
||||||
{ 0, 1 },
|
{ 0, 1, 0 },
|
||||||
|
|
||||||
{ -1, -1 }
|
{ -1, -1, 1 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int ndb_to_mysql_error(const NdbError *err)
|
static int ndb_to_mysql_error(const NdbError *err)
|
||||||
{
|
{
|
||||||
uint i;
|
uint i;
|
||||||
for (i=0 ; err_map[i].ndb_err != err->code ; i++)
|
for (i=0; err_map[i].ndb_err != err->code && err_map[i].my_err != -1; i++);
|
||||||
|
if (err_map[i].show_warning)
|
||||||
{
|
{
|
||||||
if (err_map[i].my_err == -1){
|
// Push the NDB error message as warning
|
||||||
// Push the NDB error message as warning
|
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
|
||||||
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
|
ER_GET_ERRMSG, ER(ER_GET_ERRMSG),
|
||||||
ER_GET_ERRMSG, ER(ER_GET_ERRMSG),
|
err->code, err->message, "NDB");
|
||||||
err->code, err->message, "NDB");
|
|
||||||
return err->code;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Push the NDB error message as warning
|
if (err_map[i].my_err == -1)
|
||||||
// this since e.g. HA_ERR_RECORD_FILE_FULL maps to
|
return err->code;
|
||||||
// several error codes in NDB, and the uses needs
|
|
||||||
// to know which one it is
|
|
||||||
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
|
|
||||||
ER_GET_ERRMSG, ER(ER_GET_ERRMSG),
|
|
||||||
err->code, err->message, "NDB");
|
|
||||||
return err_map[i].my_err;
|
return err_map[i].my_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +159,7 @@ int execute_no_commit(ha_ndbcluster *h, NdbConnection *trans)
|
|||||||
if (m_batch_execute)
|
if (m_batch_execute)
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
return trans->execute(NoCommit,AbortOnError,1);
|
return trans->execute(NoCommit,AbortOnError,h->m_force_send);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
@ -179,7 +170,18 @@ int execute_commit(ha_ndbcluster *h, NdbConnection *trans)
|
|||||||
if (m_batch_execute)
|
if (m_batch_execute)
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
return trans->execute(Commit,AbortOnError,1);
|
return trans->execute(Commit,AbortOnError,h->m_force_send);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
int execute_commit(THD *thd, NdbConnection *trans)
|
||||||
|
{
|
||||||
|
int m_batch_execute= 0;
|
||||||
|
#ifdef NOT_USED
|
||||||
|
if (m_batch_execute)
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
return trans->execute(Commit,AbortOnError,thd->variables.ndb_force_send);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
@ -190,7 +192,7 @@ int execute_no_commit_ie(ha_ndbcluster *h, NdbConnection *trans)
|
|||||||
if (m_batch_execute)
|
if (m_batch_execute)
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
return trans->execute(NoCommit,IgnoreError,1);
|
return trans->execute(NoCommit,IgnoreError,h->m_force_send);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -233,6 +235,8 @@ void ha_ndbcluster::set_rec_per_key()
|
|||||||
|
|
||||||
void ha_ndbcluster::records_update()
|
void ha_ndbcluster::records_update()
|
||||||
{
|
{
|
||||||
|
if (m_ha_not_exact_count)
|
||||||
|
return;
|
||||||
DBUG_ENTER("ha_ndbcluster::records_update");
|
DBUG_ENTER("ha_ndbcluster::records_update");
|
||||||
struct Ndb_table_local_info *info= (struct Ndb_table_local_info *)m_table_info;
|
struct Ndb_table_local_info *info= (struct Ndb_table_local_info *)m_table_info;
|
||||||
DBUG_PRINT("info", ("id=%d, no_uncommitted_rows_count=%d",
|
DBUG_PRINT("info", ("id=%d, no_uncommitted_rows_count=%d",
|
||||||
@ -256,6 +260,8 @@ void ha_ndbcluster::records_update()
|
|||||||
|
|
||||||
void ha_ndbcluster::no_uncommitted_rows_execute_failure()
|
void ha_ndbcluster::no_uncommitted_rows_execute_failure()
|
||||||
{
|
{
|
||||||
|
if (m_ha_not_exact_count)
|
||||||
|
return;
|
||||||
DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_execute_failure");
|
DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_execute_failure");
|
||||||
THD *thd= current_thd;
|
THD *thd= current_thd;
|
||||||
((Thd_ndb*)(thd->transaction.thd_ndb))->error= 1;
|
((Thd_ndb*)(thd->transaction.thd_ndb))->error= 1;
|
||||||
@ -264,6 +270,8 @@ void ha_ndbcluster::no_uncommitted_rows_execute_failure()
|
|||||||
|
|
||||||
void ha_ndbcluster::no_uncommitted_rows_init(THD *thd)
|
void ha_ndbcluster::no_uncommitted_rows_init(THD *thd)
|
||||||
{
|
{
|
||||||
|
if (m_ha_not_exact_count)
|
||||||
|
return;
|
||||||
DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_init");
|
DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_init");
|
||||||
struct Ndb_table_local_info *info= (struct Ndb_table_local_info *)m_table_info;
|
struct Ndb_table_local_info *info= (struct Ndb_table_local_info *)m_table_info;
|
||||||
Thd_ndb *thd_ndb= (Thd_ndb *)thd->transaction.thd_ndb;
|
Thd_ndb *thd_ndb= (Thd_ndb *)thd->transaction.thd_ndb;
|
||||||
@ -281,6 +289,8 @@ void ha_ndbcluster::no_uncommitted_rows_init(THD *thd)
|
|||||||
|
|
||||||
void ha_ndbcluster::no_uncommitted_rows_update(int c)
|
void ha_ndbcluster::no_uncommitted_rows_update(int c)
|
||||||
{
|
{
|
||||||
|
if (m_ha_not_exact_count)
|
||||||
|
return;
|
||||||
DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_update");
|
DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_update");
|
||||||
struct Ndb_table_local_info *info=
|
struct Ndb_table_local_info *info=
|
||||||
(struct Ndb_table_local_info *)m_table_info;
|
(struct Ndb_table_local_info *)m_table_info;
|
||||||
@ -293,6 +303,8 @@ void ha_ndbcluster::no_uncommitted_rows_update(int c)
|
|||||||
|
|
||||||
void ha_ndbcluster::no_uncommitted_rows_reset(THD *thd)
|
void ha_ndbcluster::no_uncommitted_rows_reset(THD *thd)
|
||||||
{
|
{
|
||||||
|
if (m_ha_not_exact_count)
|
||||||
|
return;
|
||||||
DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_reset");
|
DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_reset");
|
||||||
((Thd_ndb*)(thd->transaction.thd_ndb))->count++;
|
((Thd_ndb*)(thd->transaction.thd_ndb))->count++;
|
||||||
((Thd_ndb*)(thd->transaction.thd_ndb))->error= 0;
|
((Thd_ndb*)(thd->transaction.thd_ndb))->error= 0;
|
||||||
@ -1229,7 +1241,8 @@ inline int ha_ndbcluster::next_result(byte *buf)
|
|||||||
DBUG_PRINT("info", ("ops_pending: %d", m_ops_pending));
|
DBUG_PRINT("info", ("ops_pending: %d", m_ops_pending));
|
||||||
if (m_ops_pending)
|
if (m_ops_pending)
|
||||||
{
|
{
|
||||||
if (current_thd->transaction.on)
|
// if (current_thd->transaction.on)
|
||||||
|
if (m_transaction_on)
|
||||||
{
|
{
|
||||||
if (execute_no_commit(this,trans) != 0)
|
if (execute_no_commit(this,trans) != 0)
|
||||||
DBUG_RETURN(ndb_err(trans));
|
DBUG_RETURN(ndb_err(trans));
|
||||||
@ -1715,7 +1728,8 @@ int ha_ndbcluster::write_row(byte *record)
|
|||||||
(int)m_rows_inserted, (int)m_bulk_insert_rows));
|
(int)m_rows_inserted, (int)m_bulk_insert_rows));
|
||||||
|
|
||||||
m_bulk_insert_not_flushed= FALSE;
|
m_bulk_insert_not_flushed= FALSE;
|
||||||
if (thd->transaction.on)
|
// if (thd->transaction.on)
|
||||||
|
if (m_transaction_on)
|
||||||
{
|
{
|
||||||
if (execute_no_commit(this,trans) != 0)
|
if (execute_no_commit(this,trans) != 0)
|
||||||
{
|
{
|
||||||
@ -1888,7 +1902,7 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
|
|||||||
for (i= 0; i < table->fields; i++)
|
for (i= 0; i < table->fields; i++)
|
||||||
{
|
{
|
||||||
Field *field= table->field[i];
|
Field *field= table->field[i];
|
||||||
if ((thd->query_id == field->query_id) &&
|
if (((thd->query_id == field->query_id) || m_retrieve_all_fields) &&
|
||||||
(!(field->flags & PRI_KEY_FLAG)) &&
|
(!(field->flags & PRI_KEY_FLAG)) &&
|
||||||
set_ndb_value(op, field, i))
|
set_ndb_value(op, field, i))
|
||||||
ERR_RETURN(op->getNdbError());
|
ERR_RETURN(op->getNdbError());
|
||||||
@ -2547,14 +2561,17 @@ void ha_ndbcluster::info(uint flag)
|
|||||||
DBUG_PRINT("info", ("HA_STATUS_VARIABLE"));
|
DBUG_PRINT("info", ("HA_STATUS_VARIABLE"));
|
||||||
if (m_table_info)
|
if (m_table_info)
|
||||||
{
|
{
|
||||||
records_update();
|
if (m_ha_not_exact_count)
|
||||||
|
records= 100;
|
||||||
|
else
|
||||||
|
records_update();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Uint64 rows;
|
Uint64 rows= 100;
|
||||||
if(ndb_get_table_statistics(m_ndb, m_tabname, &rows, 0) == 0){
|
if (current_thd->variables.ndb_use_exact_count)
|
||||||
records= rows;
|
ndb_get_table_statistics(m_ndb, m_tabname, &rows, 0);
|
||||||
}
|
records= rows;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flag & HA_STATUS_CONST)
|
if (flag & HA_STATUS_CONST)
|
||||||
@ -2943,6 +2960,15 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
|
|||||||
pointer to point to the NDB transaction.
|
pointer to point to the NDB transaction.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// store thread specific data first to set the right context
|
||||||
|
m_force_send= thd->variables.ndb_force_send;
|
||||||
|
m_ha_not_exact_count= !thd->variables.ndb_use_exact_count;
|
||||||
|
m_autoincrement_prefetch= thd->variables.ndb_autoincrement_prefetch_sz;
|
||||||
|
if (!thd->transaction.on)
|
||||||
|
m_transaction_on= FALSE;
|
||||||
|
else
|
||||||
|
m_transaction_on= thd->variables.ndb_use_transactions;
|
||||||
|
|
||||||
m_active_trans= thd->transaction.all.ndb_tid ?
|
m_active_trans= thd->transaction.all.ndb_tid ?
|
||||||
(NdbConnection*)thd->transaction.all.ndb_tid:
|
(NdbConnection*)thd->transaction.all.ndb_tid:
|
||||||
(NdbConnection*)thd->transaction.stmt.ndb_tid;
|
(NdbConnection*)thd->transaction.stmt.ndb_tid;
|
||||||
@ -3063,7 +3089,7 @@ int ndbcluster_commit(THD *thd, void *ndb_transaction)
|
|||||||
"stmt" : "all"));
|
"stmt" : "all"));
|
||||||
DBUG_ASSERT(ndb && trans);
|
DBUG_ASSERT(ndb && trans);
|
||||||
|
|
||||||
if (execute_commit(0,trans) != 0)
|
if (execute_commit(thd,trans) != 0)
|
||||||
{
|
{
|
||||||
const NdbError err= trans->getNdbError();
|
const NdbError err= trans->getNdbError();
|
||||||
const NdbOperation *error_op= trans->getNdbErrorOperation();
|
const NdbOperation *error_op= trans->getNdbErrorOperation();
|
||||||
@ -3617,11 +3643,11 @@ longlong ha_ndbcluster::get_auto_increment()
|
|||||||
DBUG_ENTER("get_auto_increment");
|
DBUG_ENTER("get_auto_increment");
|
||||||
DBUG_PRINT("enter", ("m_tabname: %s", m_tabname));
|
DBUG_PRINT("enter", ("m_tabname: %s", m_tabname));
|
||||||
int cache_size=
|
int cache_size=
|
||||||
(m_rows_to_insert - m_rows_inserted < autoincrement_prefetch) ?
|
(m_rows_to_insert - m_rows_inserted < m_autoincrement_prefetch) ?
|
||||||
m_rows_to_insert - m_rows_inserted
|
m_rows_to_insert - m_rows_inserted
|
||||||
: (m_rows_to_insert > autoincrement_prefetch) ?
|
: (m_rows_to_insert > m_autoincrement_prefetch) ?
|
||||||
m_rows_to_insert
|
m_rows_to_insert
|
||||||
: autoincrement_prefetch;
|
: m_autoincrement_prefetch;
|
||||||
Uint64 auto_value=
|
Uint64 auto_value=
|
||||||
(m_skip_auto_increment) ?
|
(m_skip_auto_increment) ?
|
||||||
m_ndb->readAutoIncrementValue((const NDBTAB *) m_table)
|
m_ndb->readAutoIncrementValue((const NDBTAB *) m_table)
|
||||||
@ -3659,7 +3685,11 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg):
|
|||||||
m_blobs_pending(0),
|
m_blobs_pending(0),
|
||||||
m_blobs_buffer(0),
|
m_blobs_buffer(0),
|
||||||
m_blobs_buffer_size(0),
|
m_blobs_buffer_size(0),
|
||||||
m_dupkey((uint) -1)
|
m_dupkey((uint) -1),
|
||||||
|
m_ha_not_exact_count(FALSE),
|
||||||
|
m_force_send(TRUE),
|
||||||
|
m_autoincrement_prefetch(32),
|
||||||
|
m_transaction_on(TRUE)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -4309,6 +4339,62 @@ ha_ndbcluster::records_in_range(uint inx, key_range *min_key,
|
|||||||
DBUG_RETURN(10); /* Good guess when you don't know anything */
|
DBUG_RETURN(10); /* Good guess when you don't know anything */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ulong ha_ndbcluster::table_flags(void) const
|
||||||
|
{
|
||||||
|
if (m_ha_not_exact_count)
|
||||||
|
return m_table_flags | HA_NOT_EXACT_COUNT;
|
||||||
|
else
|
||||||
|
return m_table_flags;
|
||||||
|
}
|
||||||
|
const char * ha_ndbcluster::table_type() const
|
||||||
|
{
|
||||||
|
return("ndbcluster");
|
||||||
|
}
|
||||||
|
uint ha_ndbcluster::max_supported_record_length() const
|
||||||
|
{
|
||||||
|
return NDB_MAX_TUPLE_SIZE;
|
||||||
|
}
|
||||||
|
uint ha_ndbcluster::max_supported_keys() const
|
||||||
|
{
|
||||||
|
return MAX_KEY;
|
||||||
|
}
|
||||||
|
uint ha_ndbcluster::max_supported_key_parts() const
|
||||||
|
{
|
||||||
|
return NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY;
|
||||||
|
}
|
||||||
|
uint ha_ndbcluster::max_supported_key_length() const
|
||||||
|
{
|
||||||
|
return NDB_MAX_KEY_SIZE;
|
||||||
|
}
|
||||||
|
bool ha_ndbcluster::low_byte_first() const
|
||||||
|
{
|
||||||
|
#ifdef WORDS_BIGENDIAN
|
||||||
|
return FALSE;
|
||||||
|
#else
|
||||||
|
return TRUE;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
bool ha_ndbcluster::has_transactions()
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
const char* ha_ndbcluster::index_type(uint key_number)
|
||||||
|
{
|
||||||
|
switch (get_index_type(key_number)) {
|
||||||
|
case ORDERED_INDEX:
|
||||||
|
case UNIQUE_ORDERED_INDEX:
|
||||||
|
case PRIMARY_KEY_ORDERED_INDEX:
|
||||||
|
return "BTREE";
|
||||||
|
case UNIQUE_INDEX:
|
||||||
|
case PRIMARY_KEY_INDEX:
|
||||||
|
default:
|
||||||
|
return "HASH";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
uint8 ha_ndbcluster::table_cache_type()
|
||||||
|
{
|
||||||
|
return HA_CACHE_TBL_NOCACHE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Handling the shared NDB_SHARE structure that is needed to
|
Handling the shared NDB_SHARE structure that is needed to
|
||||||
|
@ -118,15 +118,14 @@ class ha_ndbcluster: public handler
|
|||||||
int reset();
|
int reset();
|
||||||
int external_lock(THD *thd, int lock_type);
|
int external_lock(THD *thd, int lock_type);
|
||||||
int start_stmt(THD *thd);
|
int start_stmt(THD *thd);
|
||||||
const char * table_type() const { return("ndbcluster");}
|
const char * table_type() const;
|
||||||
const char ** bas_ext() const;
|
const char ** bas_ext() const;
|
||||||
ulong table_flags(void) const { return m_table_flags; }
|
ulong table_flags(void) const;
|
||||||
ulong index_flags(uint idx, uint part, bool all_parts) const;
|
ulong index_flags(uint idx, uint part, bool all_parts) const;
|
||||||
uint max_supported_record_length() const { return NDB_MAX_TUPLE_SIZE; };
|
uint max_supported_record_length() const;
|
||||||
uint max_supported_keys() const { return MAX_KEY; }
|
uint max_supported_keys() const;
|
||||||
uint max_supported_key_parts() const
|
uint max_supported_key_parts() const;
|
||||||
{ return NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY; };
|
uint max_supported_key_length() const;
|
||||||
uint max_supported_key_length() const { return NDB_MAX_KEY_SIZE;};
|
|
||||||
|
|
||||||
int rename_table(const char *from, const char *to);
|
int rename_table(const char *from, const char *to);
|
||||||
int delete_table(const char *name);
|
int delete_table(const char *name);
|
||||||
@ -135,28 +134,9 @@ class ha_ndbcluster: public handler
|
|||||||
THR_LOCK_DATA **to,
|
THR_LOCK_DATA **to,
|
||||||
enum thr_lock_type lock_type);
|
enum thr_lock_type lock_type);
|
||||||
|
|
||||||
bool low_byte_first() const
|
bool low_byte_first() const;
|
||||||
{
|
bool has_transactions();
|
||||||
#ifdef WORDS_BIGENDIAN
|
const char* index_type(uint key_number);
|
||||||
return FALSE;
|
|
||||||
#else
|
|
||||||
return TRUE;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
bool has_transactions() { return TRUE; }
|
|
||||||
|
|
||||||
const char* index_type(uint key_number) {
|
|
||||||
switch (get_index_type(key_number)) {
|
|
||||||
case ORDERED_INDEX:
|
|
||||||
case UNIQUE_ORDERED_INDEX:
|
|
||||||
case PRIMARY_KEY_ORDERED_INDEX:
|
|
||||||
return "BTREE";
|
|
||||||
case UNIQUE_INDEX:
|
|
||||||
case PRIMARY_KEY_INDEX:
|
|
||||||
default:
|
|
||||||
return "HASH";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
double scan_time();
|
double scan_time();
|
||||||
ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key);
|
ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key);
|
||||||
@ -165,7 +145,7 @@ class ha_ndbcluster: public handler
|
|||||||
|
|
||||||
static Thd_ndb* seize_thd_ndb();
|
static Thd_ndb* seize_thd_ndb();
|
||||||
static void release_thd_ndb(Thd_ndb* thd_ndb);
|
static void release_thd_ndb(Thd_ndb* thd_ndb);
|
||||||
uint8 table_cache_type() { return HA_CACHE_TBL_NOCACHE; }
|
uint8 table_cache_type();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int alter_table_name(const char *from, const char *to);
|
int alter_table_name(const char *from, const char *to);
|
||||||
@ -256,6 +236,10 @@ class ha_ndbcluster: public handler
|
|||||||
char *m_blobs_buffer;
|
char *m_blobs_buffer;
|
||||||
uint32 m_blobs_buffer_size;
|
uint32 m_blobs_buffer_size;
|
||||||
uint m_dupkey;
|
uint m_dupkey;
|
||||||
|
bool m_ha_not_exact_count;
|
||||||
|
bool m_force_send;
|
||||||
|
ha_rows m_autoincrement_prefetch;
|
||||||
|
bool m_transaction_on;
|
||||||
|
|
||||||
void set_rec_per_key();
|
void set_rec_per_key();
|
||||||
void records_update();
|
void records_update();
|
||||||
@ -265,6 +249,8 @@ class ha_ndbcluster: public handler
|
|||||||
void no_uncommitted_rows_reset(THD *);
|
void no_uncommitted_rows_reset(THD *);
|
||||||
|
|
||||||
friend int execute_no_commit(ha_ndbcluster*, NdbConnection*);
|
friend int execute_no_commit(ha_ndbcluster*, NdbConnection*);
|
||||||
|
friend int execute_commit(ha_ndbcluster*, NdbConnection*);
|
||||||
|
friend int execute_no_commit_ie(ha_ndbcluster*, NdbConnection*);
|
||||||
};
|
};
|
||||||
|
|
||||||
bool ndbcluster_init(void);
|
bool ndbcluster_init(void);
|
||||||
|
@ -3947,7 +3947,11 @@ enum options_mysqld
|
|||||||
OPT_INNODB_FILE_PER_TABLE, OPT_CRASH_BINLOG_INNODB,
|
OPT_INNODB_FILE_PER_TABLE, OPT_CRASH_BINLOG_INNODB,
|
||||||
OPT_INNODB_LOCKS_UNSAFE_FOR_BINLOG,
|
OPT_INNODB_LOCKS_UNSAFE_FOR_BINLOG,
|
||||||
OPT_SAFE_SHOW_DB, OPT_INNODB_SAFE_BINLOG,
|
OPT_SAFE_SHOW_DB, OPT_INNODB_SAFE_BINLOG,
|
||||||
OPT_INNODB, OPT_ISAM, OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING, OPT_SKIP_SAFEMALLOC,
|
OPT_INNODB, OPT_ISAM,
|
||||||
|
OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING, OPT_NDB_USE_EXACT_COUNT,
|
||||||
|
OPT_NDB_FORCE_SEND, OPT_NDB_AUTOINCREMENT_PREFETCH_SZ,
|
||||||
|
OPT_NDB_USE_TRANSACTIONS,
|
||||||
|
OPT_SKIP_SAFEMALLOC,
|
||||||
OPT_TEMP_POOL, OPT_TX_ISOLATION,
|
OPT_TEMP_POOL, OPT_TX_ISOLATION,
|
||||||
OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS,
|
OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS,
|
||||||
OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL,
|
OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL,
|
||||||
@ -4386,9 +4390,31 @@ Disable with --skip-ndbcluster (will save memory).",
|
|||||||
(gptr*) &opt_ndbcluster, (gptr*) &opt_ndbcluster, 0, GET_BOOL, NO_ARG, 1, 0, 0,
|
(gptr*) &opt_ndbcluster, (gptr*) &opt_ndbcluster, 0, GET_BOOL, NO_ARG, 1, 0, 0,
|
||||||
0, 0, 0},
|
0, 0, 0},
|
||||||
#ifdef HAVE_NDBCLUSTER_DB
|
#ifdef HAVE_NDBCLUSTER_DB
|
||||||
{"ndb-connectstring", OPT_NDB_CONNECTSTRING, "Connect string for ndbcluster.",
|
{"ndb-connectstring", OPT_NDB_CONNECTSTRING,
|
||||||
(gptr*) &ndbcluster_connectstring, (gptr*) &ndbcluster_connectstring, 0, GET_STR,
|
"Connect string for ndbcluster.",
|
||||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) &ndbcluster_connectstring, (gptr*) &ndbcluster_connectstring,
|
||||||
|
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
|
{"ndb_autoincrement_prefetch_sz", OPT_NDB_AUTOINCREMENT_PREFETCH_SZ,
|
||||||
|
"Specify number of autoincrement values that are prefetched",
|
||||||
|
(gptr*) &global_system_variables.ndb_autoincrement_prefetch_sz,
|
||||||
|
(gptr*) &global_system_variables.ndb_autoincrement_prefetch_sz,
|
||||||
|
0, GET_INT, REQUIRED_ARG, 32, 1, 256, 0, 0, 0},
|
||||||
|
{"ndb_force_send", OPT_NDB_FORCE_SEND,
|
||||||
|
"Force send of buffers to ndb immediately without waiting for other threads",
|
||||||
|
(gptr*) &global_system_variables.ndb_force_send,
|
||||||
|
(gptr*) &global_system_variables.ndb_force_send,
|
||||||
|
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
|
||||||
|
{"ndb_use_exact_count", OPT_NDB_USE_EXACT_COUNT,
|
||||||
|
"Use exact records count during query planning and for "
|
||||||
|
"fast select count(*)",
|
||||||
|
(gptr*) &global_system_variables.ndb_use_exact_count,
|
||||||
|
(gptr*) &global_system_variables.ndb_use_exact_count,
|
||||||
|
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
|
||||||
|
{"ndb_use_transactions", OPT_NDB_USE_TRANSACTIONS,
|
||||||
|
"Use transactions in ndb",
|
||||||
|
(gptr*) &global_system_variables.ndb_use_transactions,
|
||||||
|
(gptr*) &global_system_variables.ndb_use_transactions,
|
||||||
|
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
|
||||||
#endif
|
#endif
|
||||||
{"new", 'n', "Use very new possible 'unsafe' functions.",
|
{"new", 'n', "Use very new possible 'unsafe' functions.",
|
||||||
(gptr*) &global_system_variables.new_mode,
|
(gptr*) &global_system_variables.new_mode,
|
||||||
|
@ -359,6 +359,23 @@ sys_var_thd_bool sys_innodb_table_locks("innodb_table_locks",
|
|||||||
sys_var_long_ptr sys_innodb_autoextend_increment("innodb_autoextend_increment",
|
sys_var_long_ptr sys_innodb_autoextend_increment("innodb_autoextend_increment",
|
||||||
&srv_auto_extend_increment);
|
&srv_auto_extend_increment);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_NDBCLUSTER_DB
|
||||||
|
// ndb thread specific variable settings
|
||||||
|
sys_var_thd_ulong
|
||||||
|
sys_ndb_autoincrement_prefetch_sz("ndb_autoincrement_prefetch_sz",
|
||||||
|
&SV::ndb_autoincrement_prefetch_sz);
|
||||||
|
sys_var_thd_bool
|
||||||
|
sys_ndb_force_send("ndb_force_send",
|
||||||
|
&SV::ndb_force_send);
|
||||||
|
sys_var_thd_bool
|
||||||
|
sys_ndb_use_exact_count("ndb_use_exact_count",
|
||||||
|
&SV::ndb_use_exact_count);
|
||||||
|
sys_var_thd_bool
|
||||||
|
sys_ndb_use_transactions("ndb_use_transactions",
|
||||||
|
&SV::ndb_use_transactions);
|
||||||
|
// ndb server global variable settings
|
||||||
|
// none
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Time/date/datetime formats */
|
/* Time/date/datetime formats */
|
||||||
|
|
||||||
@ -612,7 +629,13 @@ sys_var *sys_variables[]=
|
|||||||
&sys_innodb_table_locks,
|
&sys_innodb_table_locks,
|
||||||
&sys_innodb_max_purge_lag,
|
&sys_innodb_max_purge_lag,
|
||||||
&sys_innodb_autoextend_increment,
|
&sys_innodb_autoextend_increment,
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_NDBCLUSTER_DB
|
||||||
|
&sys_ndb_autoincrement_prefetch_sz,
|
||||||
|
&sys_ndb_force_send,
|
||||||
|
&sys_ndb_use_exact_count,
|
||||||
|
&sys_ndb_use_transactions,
|
||||||
|
#endif
|
||||||
&sys_unique_checks,
|
&sys_unique_checks,
|
||||||
&sys_warning_count
|
&sys_warning_count
|
||||||
};
|
};
|
||||||
@ -772,6 +795,13 @@ struct show_var_st init_vars[]= {
|
|||||||
{sys_myisam_sort_buffer_size.name, (char*) &sys_myisam_sort_buffer_size, SHOW_SYS},
|
{sys_myisam_sort_buffer_size.name, (char*) &sys_myisam_sort_buffer_size, SHOW_SYS},
|
||||||
#ifdef __NT__
|
#ifdef __NT__
|
||||||
{"named_pipe", (char*) &opt_enable_named_pipe, SHOW_MY_BOOL},
|
{"named_pipe", (char*) &opt_enable_named_pipe, SHOW_MY_BOOL},
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_NDBCLUSTER_DB
|
||||||
|
{sys_ndb_autoincrement_prefetch_sz.name,
|
||||||
|
(char*) &sys_ndb_autoincrement_prefetch_sz, SHOW_SYS},
|
||||||
|
{sys_ndb_force_send.name, (char*) &sys_ndb_force_send, SHOW_SYS},
|
||||||
|
{sys_ndb_use_exact_count.name,(char*) &sys_ndb_use_exact_count, SHOW_SYS},
|
||||||
|
{sys_ndb_use_transactions.name,(char*) &sys_ndb_use_transactions, SHOW_SYS},
|
||||||
#endif
|
#endif
|
||||||
{sys_net_buffer_length.name,(char*) &sys_net_buffer_length, SHOW_SYS},
|
{sys_net_buffer_length.name,(char*) &sys_net_buffer_length, SHOW_SYS},
|
||||||
{sys_net_read_timeout.name, (char*) &sys_net_read_timeout, SHOW_SYS},
|
{sys_net_read_timeout.name, (char*) &sys_net_read_timeout, SHOW_SYS},
|
||||||
|
@ -399,6 +399,12 @@ struct system_variables
|
|||||||
#ifdef HAVE_INNOBASE_DB
|
#ifdef HAVE_INNOBASE_DB
|
||||||
my_bool innodb_table_locks;
|
my_bool innodb_table_locks;
|
||||||
#endif /* HAVE_INNOBASE_DB */
|
#endif /* HAVE_INNOBASE_DB */
|
||||||
|
#ifdef HAVE_NDBCLUSTER_DB
|
||||||
|
ulong ndb_autoincrement_prefetch_sz;
|
||||||
|
my_bool ndb_force_send;
|
||||||
|
my_bool ndb_use_exact_count;
|
||||||
|
my_bool ndb_use_transactions;
|
||||||
|
#endif /* HAVE_NDBCLUSTER_DB */
|
||||||
my_bool old_passwords;
|
my_bool old_passwords;
|
||||||
|
|
||||||
/* Only charset part of these variables is sensible */
|
/* Only charset part of these variables is sensible */
|
||||||
|
Reference in New Issue
Block a user