Below is the list of changes that have just been committed into a local
5.1 repository of knielsen. When knielsen does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-05-10 14:12:36+02:00, knielsen@ymer.(none) +2 -0
Merge bk-internal:/home/bk/mysql-5.1-telco
into ymer.(none):/usr/local/mysql/mysql-5.1-telco-ndbrecord
MERGE: 1.2527.1.3
sql/ha_ndbcluster.cc@stripped, 2007-05-10 14:12:34+02:00, knielsen@ymer.(none) +1 -1
Manual merge.
MERGE: 1.460.1.1
sql/structs.h@stripped, 2007-05-10 14:08:20+02:00, knielsen@ymer.(none) +0 -0
Auto merged
MERGE: 1.65.1.2
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: knielsen
# Host: ymer.(none)
# Root: /usr/local/mysql/mysql-5.1-telco-ndbrecord/RESYNC
--- 1.68/sql/structs.h 2007-05-10 14:12:43 +02:00
+++ 1.69/sql/structs.h 2007-05-10 14:12:43 +02:00
@@ -57,12 +57,14 @@ typedef struct st_key_part_info { /* Inf
/*
Number of bytes required to store the keypart value. This may be
different from the "length" field as it also counts
- - possible NULL-flag byte (see HA_KEY_NULL_LENGTH)
+ - possible NULL-flag byte (see HA_KEY_NULL_LENGTH) [if null_bit != 0,
+ the first byte stored at offset is 1 if null, 0 if non-null; the
+ actual value is stored from offset+1].
- possible HA_KEY_BLOB_LENGTH bytes needed to store actual value length.
*/
uint16 store_length;
uint16 key_type;
- uint16 fieldnr; /* Fieldnum in UNIREG */
+ uint16 fieldnr; /* Fieldnum in UNIREG (1,2,3,...) */
uint16 key_part_flag; /* 0 or HA_REVERSE_SORT */
uint8 type;
uint8 null_bit; /* Position to null_bit */
--- 1.463/sql/ha_ndbcluster.cc 2007-05-10 14:12:43 +02:00
+++ 1.464/sql/ha_ndbcluster.cc 2007-05-10 14:12:43 +02:00
@@ -1111,9 +1111,7 @@ int get_ndb_blobs_value(TABLE* table, Nd
i, offset, (long) buf, len, (int)ptrdiff));
DBUG_ASSERT(len == len64);
// Ugly hack assumes only ptr needs to be changed
- field_blob->ptr+= ptrdiff;
- field_blob->set_ptr(len, buf);
- field_blob->ptr-= ptrdiff;
+ field_blob->set_ptr_offset(ptrdiff, len, buf);
}
offset+= size;
}
@@ -1122,9 +1120,7 @@ int get_ndb_blobs_value(TABLE* table, Nd
// have to set length even in this case
char *buf= buffer + offset; // or maybe NULL
uint32 len= 0;
- field_blob->ptr+= ptrdiff;
- field_blob->set_ptr(len, buf);
- field_blob->ptr-= ptrdiff;
+ field_blob->set_ptr_offset(ptrdiff, len, buf);
DBUG_PRINT("info", ("[%u] isNull=%d", i, isNull));
}
}
@@ -3368,7 +3364,7 @@ int ha_ndbcluster::ndb_write_row(byte *r
set_partition_function_value(row, (uint32)func_value);
}
- statistic_increment(thd->status_var.ha_write_count, &LOCK_status);
+ ha_statistic_increment(&SSV::ha_write_count);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
table->timestamp_field->set_time();
@@ -3546,7 +3542,7 @@ int ha_ndbcluster::update_row(const byte
DBUG_RETURN(peek_res);
}
- statistic_increment(thd->status_var.ha_update_count, &LOCK_status);
+ ha_statistic_increment(&SSV::ha_update_count);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
{
table->timestamp_field->set_time();
@@ -3738,7 +3734,7 @@ int ha_ndbcluster::ndb_delete_row(const
int error;
DBUG_ENTER("delete_row");
- statistic_increment(thd->status_var.ha_delete_count,&LOCK_status);
+ ha_statistic_increment(&SSV::ha_delete_count);
m_rows_changed++;
if (m_use_partition_function &&
@@ -4208,8 +4204,7 @@ int ha_ndbcluster::index_read(byte *buf,
int ha_ndbcluster::index_next(byte *buf)
{
DBUG_ENTER("ha_ndbcluster::index_next");
- statistic_increment(current_thd->status_var.ha_read_next_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_next_count);
DBUG_RETURN(next_result(buf));
}
@@ -4217,8 +4212,7 @@ int ha_ndbcluster::index_next(byte *buf)
int ha_ndbcluster::index_prev(byte *buf)
{
DBUG_ENTER("ha_ndbcluster::index_prev");
- statistic_increment(current_thd->status_var.ha_read_prev_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_prev_count);
DBUG_RETURN(next_result(buf));
}
@@ -4226,8 +4220,7 @@ int ha_ndbcluster::index_prev(byte *buf)
int ha_ndbcluster::index_first(byte *buf)
{
DBUG_ENTER("ha_ndbcluster::index_first");
- statistic_increment(current_thd->status_var.ha_read_first_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_first_count);
// Start the ordered index scan and fetch the first row
// Only HA_READ_ORDER indexes get called by index_first
@@ -4238,7 +4231,7 @@ int ha_ndbcluster::index_first(byte *buf
int ha_ndbcluster::index_last(byte *buf)
{
DBUG_ENTER("ha_ndbcluster::index_last");
- statistic_increment(current_thd->status_var.ha_read_last_count,&LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_last_count);
DBUG_RETURN(ordered_index_scan(0, 0, TRUE, TRUE, buf, NULL));
}
@@ -4397,8 +4390,7 @@ int ha_ndbcluster::rnd_end()
int ha_ndbcluster::rnd_next(byte *buf)
{
DBUG_ENTER("rnd_next");
- statistic_increment(current_thd->status_var.ha_read_rnd_next_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_rnd_next_count);
if (!m_active_cursor)
DBUG_RETURN(full_table_scan(buf));
@@ -4416,8 +4408,7 @@ int ha_ndbcluster::rnd_next(byte *buf)
int ha_ndbcluster::rnd_pos(byte *buf, byte *pos)
{
DBUG_ENTER("rnd_pos");
- statistic_increment(current_thd->status_var.ha_read_rnd_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_rnd_count);
// The primary key for the record is stored in pos
// Perform a pk_read using primary key "index"
{
@@ -7769,6 +7760,7 @@ static int connect_callback()
}
extern int ndb_dictionary_is_mysqld;
+extern pthread_mutex_t LOCK_plugin;
static int ndbcluster_init(void *p)
{
@@ -7778,6 +7770,13 @@ static int ndbcluster_init(void *p)
if (ndbcluster_inited)
DBUG_RETURN(FALSE);
+ /*
+ Below we create new THD's. They'll need LOCK_plugin, but it's taken now by
+ plugin initialization code. Release it to avoid deadlocks. It's safe, as
+ there're no threads that may concurrently access plugin control structures.
+ */
+ pthread_mutex_unlock(&LOCK_plugin);
+
pthread_mutex_init(&ndbcluster_mutex,MY_MUTEX_INIT_FAST);
pthread_mutex_init(&LOCK_ndb_util_thread, MY_MUTEX_INIT_FAST);
pthread_cond_init(&COND_ndb_util_thread, NULL);
@@ -7789,7 +7788,7 @@ static int ndbcluster_init(void *p)
{
handlerton *h= ndbcluster_hton;
- h->state= have_ndbcluster;
+ h->state= SHOW_OPTION_YES;
h->db_type= DB_TYPE_NDBCLUSTER;
h->close_connection= ndbcluster_close_connection;
h->commit= ndbcluster_commit;
@@ -7811,9 +7810,6 @@ static int ndbcluster_init(void *p)
h->table_exists_in_engine= ndbcluster_table_exists_in_engine;
}
- if (have_ndbcluster != SHOW_OPTION_YES)
- DBUG_RETURN(0); // nothing else to do
-
// Initialize ndb interface
ndb_init_internal();
@@ -8011,6 +8007,8 @@ static int ndbcluster_init(void *p)
goto ndbcluster_init_error;
}
+ pthread_mutex_lock(&LOCK_plugin);
+
ndbcluster_inited= 1;
DBUG_RETURN(FALSE);
@@ -8037,9 +8035,10 @@ ndbcluster_init_error:
if (g_ndb_cluster_connection)
delete g_ndb_cluster_connection;
g_ndb_cluster_connection= NULL;
- have_ndbcluster= SHOW_OPTION_DISABLED; // If we couldn't use handler
ndbcluster_hton->state= SHOW_OPTION_DISABLED; // If we couldn't use handler
+ pthread_mutex_lock(&LOCK_plugin);
+
DBUG_RETURN(TRUE);
}
@@ -10287,10 +10286,6 @@ ndbcluster_show_status(handlerton *hton,
uint buflen;
DBUG_ENTER("ndbcluster_show_status");
- if (have_ndbcluster != SHOW_OPTION_YES)
- {
- DBUG_RETURN(FALSE);
- }
if (stat_type != HA_ENGINE_STATUS)
{
DBUG_RETURN(FALSE);
| Thread |
|---|
| • bk commit into 5.1 tree (knielsen:1.2530) | knielsen | 10 May |