Below is the list of changes that have just been committed into a local
5.2 repository of patg. When patg 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, 2006-09-22 13:41:22-07:00, patg@stripped +3 -0
WL# 3031
sql_servers.cc
Don't set empty string if server->socket is not set. Just set NULL
ha_federated.cc, ha_federated.h
Added new members to the share. Changed HASH keying key from using connect
string to using db/table combo.
sql/sql_servers.cc@stripped, 2006-09-22 13:41:20-07:00, patg@stripped +1 -1
WL# 3031
Don't set empty string if server->socket is not set. Just set NULL
storage/federated/ha_federated.cc@stripped, 2006-09-22 13:41:20-07:00, patg@stripped
+11 -10
WL# 3031
Added share_key and share_key_length to federated share. In a fix to bug# 19773,
I changed to using share->scheme, thinking this would be unique. However, this
will not work very well for 3031 because share->scheme/connection_string will
simply be server name, which can be the same for multiple tables. This would
make it impossible to hash 1 share per table. share_key is simply the value
from "name" as passed to ::open, which is "dbname/tablename", which _is_
unique.
Also added a 'parsed' bool to the share. This says whether the values in
the share were parsed via the connection string, or via servers table given
server name. The reason for this (there has to be a BETTER way) is to avoid
freeing anything in "free_share" allocated in sql_servers.cc via MEM ROOT.
The only thing right now is share->socket, which is freed in free_share.
storage/federated/ha_federated.h@stripped, 2006-09-22 13:41:20-07:00, patg@stripped
+4 -0
WL# 3031
Added share_key and share_key_length to federated share. In a fix to bug# 19773,
I changed to using share->scheme, thinking this would be unique. However, this
will not work very well for 3031 because share->scheme/connection_string will
simply be server name, which can be the same for multiple tables. This would
make it impossible to hash 1 share per table. share_key is simply the value
from "name" as passed to ::open, which is "dbname/tablename", which _is_
unique.
Also added a 'parsed' bool to the share. This says whether the values in
the share were parsed via the connection string, or via servers table given
server name. The reason for this (there has to be a BETTER way) is to avoid
freeing anything in "free_share" allocated in sql_servers.cc via MEM ROOT.
The only thing right now is share->socket, which is freed in free_share.
# 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: patg
# Host: govinda.patg.net
# Root: /home/patg/mysql-build/mysql-5.2-wl3031.clone2
--- 1.3/sql/sql_servers.cc 2006-09-22 13:41:30 -07:00
+++ 1.4/sql/sql_servers.cc 2006-09-22 13:41:30 -07:00
@@ -285,7 +285,7 @@
server->port= server->sport ? atoi(server->sport) : 0;
ptr= get_field(&mem, table->field[6]);
- server->socket= ptr ? ptr : blank;
+ server->socket= ptr && strlen(ptr) ? ptr : NULL;
ptr= get_field(&mem, table->field[7]);
server->scheme= ptr ? ptr : blank;
ptr= get_field(&mem, table->field[8]);
--- 1.59/storage/federated/ha_federated.cc 2006-09-22 13:41:30 -07:00
+++ 1.60/storage/federated/ha_federated.cc 2006-09-22 13:41:30 -07:00
@@ -380,8 +380,8 @@
static byte *federated_get_key(FEDERATED_SHARE *share, uint *length,
my_bool not_used __attribute__ ((unused)))
{
- *length= share->connect_string_length;
- return (byte*) share->scheme;
+ *length= share->share_key_length;
+ return (byte*) share->share_key;
}
/*
@@ -729,6 +729,7 @@
share->connection_string",
share->connection_string, share->connection_string));
+ share->parsed= FALSE;
if ((error_num= get_connection(share)))
goto error;
@@ -742,6 +743,7 @@
}
else
{
+ share->parsed= TRUE;
// Add a null for later termination of table name
share->connection_string[table->s->connect_string.length]= 0;
share->scheme= share->connection_string;
@@ -1438,14 +1440,17 @@
pthread_mutex_lock(&federated_mutex);
+ tmp_share.share_key= table_name;
+ tmp_share.share_key_length= strlen(table_name);
if (parse_url(&tmp_share, table, 0))
goto error;
+
/* TODO: change tmp_share.scheme to LEX_STRING object */
if (!(share= (FEDERATED_SHARE *) hash_search(&federated_open_tables,
- (byte*) tmp_share.scheme,
+ (byte*) tmp_share.share_key,
tmp_share.
- connect_string_length)))
+ share_key_length)))
{
query.set_charset(system_charset_info);
query.append(STRING_WITH_LEN("SELECT "));
@@ -1512,14 +1517,10 @@
if (!--share->use_count)
{
hash_delete(&federated_open_tables, (byte*) share);
- my_free((gptr) share->socket, MYF(MY_ALLOW_ZERO_PTR));
+ if (share->parsed)
+ my_free((gptr) share->socket, MYF(MY_ALLOW_ZERO_PTR));
my_free((gptr) share->connection_string, MYF(MY_ALLOW_ZERO_PTR));
share->connection_string= 0;
- if (share->socket)
- {
- my_free((gptr) share->socket, MYF(MY_ALLOW_ZERO_PTR));
- share->socket= 0;
- }
thr_lock_delete(&share->lock);
VOID(pthread_mutex_destroy(&share->mutex));
my_free((gptr) share, MYF(0));
--- 1.30/storage/federated/ha_federated.h 2006-09-22 13:41:30 -07:00
+++ 1.31/storage/federated/ha_federated.h 2006-09-22 13:41:30 -07:00
@@ -43,6 +43,9 @@
The example implements the minimum of what you will probably need.
*/
typedef struct st_federated_share {
+ bool parsed;
+ /* this key is unique db/tablename */
+ const char *share_key;
/*
the primary select query to be used in rnd_init
*/
@@ -62,6 +65,7 @@
char *table;
char *socket;
char *sport;
+ int share_key_length;
ushort port;
uint table_name_length, server_name_length, connect_string_length, use_count;
pthread_mutex_t mutex;
| Thread |
|---|
| • bk commit into 5.2 tree (patg:1.2334) | Patrick Galbraith | 29 Sep |