Changed references of dbshard into shardrouter in shardrouter.c

This commit is contained in:
Markus Makela 2015-02-17 12:14:48 +02:00
parent fbda6b8ecb
commit 02e11b96b0
2 changed files with 41 additions and 6 deletions

View File

@ -134,7 +134,7 @@ typedef struct sescmd_cursor_st {
#endif
} sescmd_cursor_t;
typedef struct dbshard_config_st {
typedef struct shardrouter_config_st {
int rw_max_slave_conn_percent;
int rw_max_slave_conn_count;
target_t rw_use_sql_variables_in;
@ -217,8 +217,8 @@ typedef struct router_instance {
int n_services;
SUBSERVICE* all_subsvc;
SPINLOCK lock; /*< Lock for the instance data */
shard_config_t dbshard_config; /*< expanded config info from SERVICE */
int dbshard_version;/*< version number for router's config */
shard_config_t shardrouter_config; /*< expanded config info from SERVICE */
int shardrouter_version;/*< version number for router's config */
unsigned int bitmask; /*< Bitmask to apply to server->status */
unsigned int bitvalue; /*< Required value of server->status */
ROUTER_STATS stats; /*< Statistics for this router */

View File

@ -383,6 +383,15 @@ get_shard_target_name(ROUTER_INSTANCE* router, ROUTER_CLIENT_SES* client, GWBUF*
if((rval = (char*) hashtable_fetch(ht, dbnms[i])))
{
if(strcmp(dbnms[i],"information_schema") == 0)
{
has_dbs = false;
rval = NULL;
}
else
{
skygw_log_write(LOGFILE_TRACE,"shardrouter: Query targets database '%s' on server '%s",dbnms[i],rval);
}
for(j = i; j < sz; j++) free(dbnms[j]);
break;
}
@ -400,19 +409,45 @@ get_shard_target_name(ROUTER_INSTANCE* router, ROUTER_CLIENT_SES* client, GWBUF*
tok = strtok(NULL," ;");
ss_dassert(tok != NULL);
tmp = (char*) hashtable_fetch(ht, tok);
if(tmp)
skygw_log_write(LOGFILE_TRACE,"shardrouter: SHOW TABLES with specific database '%s' on server '%s'", tok, tmp);
}
free(query);
if(tmp == NULL)
{
rval = (char*) hashtable_fetch(ht, client->rses_mysql_session->db);
skygw_log_write(LOGFILE_TRACE,"shardrouter: SHOW TABLES query, current database '%s' on server '%s'",
client->rses_mysql_session->db,rval);
}
else
{
rval = tmp;
rval = tmp;
has_dbs = true;
}
}
if(buffer->hint && buffer->hint->type == HINT_ROUTE_TO_NAMED_SERVER)
{
for(i = 0; i < client->n_subservice; i++)
{
SERVER_REF *srvrf = client->subservice[i]->service->dbref;
while(srvrf)
{
if(strcmp(srvrf->server->unique_name,buffer->hint->data) == 0)
{
rval = srvrf->server->unique_name;
skygw_log_write(LOGFILE_TRACE,"shardrouter: Routing hint found (%s)",rval);
}
srvrf = srvrf->next;
}
}
}
if(rval == NULL && !has_dbs && client->rses_mysql_session->db[0] != '\0')
{
/**
@ -698,7 +733,7 @@ refreshInstance(
}
/**
* Create an instance of dbshard statement router within the MaxScale.
* Create an instance of shardrouter statement router within the MaxScale.
*
*
* @param service The service this router is being create for
@ -787,7 +822,7 @@ createInstance(SERVICE *service, char **options)
* Read config version number from service to inform what configuration
* is used if any.
*/
router->dbshard_version = service->svc_config_version;
router->shardrouter_version = service->svc_config_version;
/**
* We have completed the creation of the router data, so now