mirror of
https://gitee.com/wangbin579/cetus.git
synced 2024-11-30 02:47:35 +08:00
unused code
This commit is contained in:
parent
918eec9f76
commit
5af0d54307
@ -1078,7 +1078,6 @@ void admin_update_backend(network_mysqld_con* con, GList* equations,
|
|||||||
void admin_delete_backend(network_mysqld_con* con, char *key, char *val)
|
void admin_delete_backend(network_mysqld_con* con, char *key, char *val)
|
||||||
{
|
{
|
||||||
chassis_private *g = con->srv->priv;
|
chassis_private *g = con->srv->priv;
|
||||||
int affected_rows = 0;
|
|
||||||
int backend_ndx = -1;
|
int backend_ndx = -1;
|
||||||
if (strcasecmp(key, "backend_ndx")==0) {
|
if (strcasecmp(key, "backend_ndx")==0) {
|
||||||
backend_ndx = atoi(val);
|
backend_ndx = atoi(val);
|
||||||
|
@ -51,10 +51,6 @@
|
|||||||
#include "chassis-options-utils.h"
|
#include "chassis-options-utils.h"
|
||||||
#include "chassis-sql-log.h"
|
#include "chassis-sql-log.h"
|
||||||
|
|
||||||
#ifdef NETWORK_DEBUG_TRACE_STATE_CHANGES
|
|
||||||
#include "cetus-query-queue.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PLUGIN_VERSION
|
#ifndef PLUGIN_VERSION
|
||||||
#ifdef CHASSIS_BUILD_TAG
|
#ifdef CHASSIS_BUILD_TAG
|
||||||
#define PLUGIN_VERSION CHASSIS_BUILD_TAG
|
#define PLUGIN_VERSION CHASSIS_BUILD_TAG
|
||||||
@ -253,10 +249,6 @@ NETWORK_MYSQLD_PLUGIN_PROTO(proxy_read_query)
|
|||||||
con->state = ST_ERROR;
|
con->state = ST_ERROR;
|
||||||
return NETWORK_SOCKET_SUCCESS;
|
return NETWORK_SOCKET_SUCCESS;
|
||||||
}
|
}
|
||||||
#ifdef NETWORK_DEBUG_TRACE_STATE_CHANGES
|
|
||||||
query_queue_append(con->recent_queries, p.data);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int is_process_stopped = 0;
|
int is_process_stopped = 0;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@ -964,9 +956,6 @@ process_rv_use_previous_tran_conns(network_mysqld_con *con, sharding_plan_t *pla
|
|||||||
con->is_auto_commit_trans_buffered = 0;
|
con->is_auto_commit_trans_buffered = 0;
|
||||||
con->is_start_trans_buffered = 0;
|
con->is_start_trans_buffered = 0;
|
||||||
g_debug("%s: buffer_and_send_fake_resp set true:%p", G_STRLOC, con);
|
g_debug("%s: buffer_and_send_fake_resp set true:%p", G_STRLOC, con);
|
||||||
#ifdef NETWORK_DEBUG_TRACE_STATE_CHANGES
|
|
||||||
query_queue_dump(con->recent_queries);
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
if (con->servers->len > 1) {
|
if (con->servers->len > 1) {
|
||||||
if (!con->dist_tran) {
|
if (!con->dist_tran) {
|
||||||
@ -2178,7 +2167,6 @@ static gchar*
|
|||||||
show_proxy_read_only_backend_address(gpointer param) {
|
show_proxy_read_only_backend_address(gpointer param) {
|
||||||
gchar *ret = NULL;
|
gchar *ret = NULL;
|
||||||
struct external_param *opt_param = (struct external_param *)param;
|
struct external_param *opt_param = (struct external_param *)param;
|
||||||
chassis *srv = opt_param->chas;
|
|
||||||
gint opt_type = opt_param->opt_type;
|
gint opt_type = opt_param->opt_type;
|
||||||
network_backends_t *bs = opt_param->chas->priv->backends;
|
network_backends_t *bs = opt_param->chas->priv->backends;
|
||||||
if(CAN_SAVE_OPTS_PROPERTY(opt_type)) {
|
if(CAN_SAVE_OPTS_PROPERTY(opt_type)) {
|
||||||
@ -2208,7 +2196,6 @@ static gchar*
|
|||||||
show_proxy_backend_addresses(gpointer param) {
|
show_proxy_backend_addresses(gpointer param) {
|
||||||
gchar *ret = NULL;
|
gchar *ret = NULL;
|
||||||
struct external_param *opt_param = (struct external_param *)param;
|
struct external_param *opt_param = (struct external_param *)param;
|
||||||
chassis *srv = opt_param->chas;
|
|
||||||
gint opt_type = opt_param->opt_type;
|
gint opt_type = opt_param->opt_type;
|
||||||
network_backends_t *bs = opt_param->chas->priv->backends;
|
network_backends_t *bs = opt_param->chas->priv->backends;
|
||||||
if(CAN_SAVE_OPTS_PROPERTY(opt_type)) {
|
if(CAN_SAVE_OPTS_PROPERTY(opt_type)) {
|
||||||
|
@ -97,10 +97,6 @@ if (HAVE_OPENSSL)
|
|||||||
list(APPEND proxy_sources network-ssl.c)
|
list(APPEND proxy_sources network-ssl.c)
|
||||||
endif(HAVE_OPENSSL)
|
endif(HAVE_OPENSSL)
|
||||||
|
|
||||||
if(NETWORK_DEBUG_TRACE_STATE_CHANGES)
|
|
||||||
list(APPEND proxy_sources cetus-query-queue.c)
|
|
||||||
endif(NETWORK_DEBUG_TRACE_STATE_CHANGES)
|
|
||||||
|
|
||||||
ADD_LIBRARY(mysql-chassis SHARED ${chassis_sources})
|
ADD_LIBRARY(mysql-chassis SHARED ${chassis_sources})
|
||||||
ADD_LIBRARY(mysql-chassis-proxy SHARED ${proxy_sources})
|
ADD_LIBRARY(mysql-chassis-proxy SHARED ${proxy_sources})
|
||||||
ADD_LIBRARY(mysql-chassis-glibext SHARED ${glibext_sources})
|
ADD_LIBRARY(mysql-chassis-glibext SHARED ${glibext_sources})
|
||||||
|
@ -1,129 +0,0 @@
|
|||||||
/* $%BEGINLICENSE%$
|
|
||||||
Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
|
|
||||||
|
|
||||||
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; version 2 of the
|
|
||||||
License.
|
|
||||||
|
|
||||||
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., 51 Franklin St, Fifth Floor, Boston, MA
|
|
||||||
02110-1301 USA
|
|
||||||
|
|
||||||
$%ENDLICENSE%$ */
|
|
||||||
|
|
||||||
#include "cetus-query-queue.h"
|
|
||||||
|
|
||||||
#include <mysql.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "glib-ext.h"
|
|
||||||
#include "network-mysqld-proto.h"
|
|
||||||
|
|
||||||
struct query_entry_t {
|
|
||||||
enum enum_server_command command;
|
|
||||||
GString *sql;
|
|
||||||
time_t recv_time;
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
|
||||||
query_entry_free(struct query_entry_t *entry)
|
|
||||||
{
|
|
||||||
if (entry->sql) {
|
|
||||||
g_string_free(entry->sql, TRUE);
|
|
||||||
}
|
|
||||||
g_free(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
query_queue_t *
|
|
||||||
query_queue_new(int len)
|
|
||||||
{
|
|
||||||
query_queue_t *q = g_new0(struct query_queue_t, 1);
|
|
||||||
q->chunks = g_queue_new();
|
|
||||||
q->max_len = len;
|
|
||||||
return q;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
query_queue_free(query_queue_t *q)
|
|
||||||
{
|
|
||||||
g_queue_foreach(q->chunks, (GFunc) query_entry_free, NULL);
|
|
||||||
g_queue_free(q->chunks);
|
|
||||||
g_free(q);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
query_queue_append(query_queue_t *q, GString *data)
|
|
||||||
{
|
|
||||||
network_packet packet = { data, 0 };
|
|
||||||
guint8 command = 0;
|
|
||||||
if (packet.data) {
|
|
||||||
network_mysqld_proto_skip_network_header(&packet);
|
|
||||||
if (network_mysqld_proto_get_int8(&packet, &command) != 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
g_warning("%s: packet data is nill ", G_STRLOC);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct query_entry_t *entry = g_new0(struct query_entry_t, 1);
|
|
||||||
entry->command = command;
|
|
||||||
if (command == COM_QUERY) {
|
|
||||||
gsize sql_len = packet.data->len - packet.offset;
|
|
||||||
entry->sql = g_string_sized_new(sql_len + 1);
|
|
||||||
network_mysqld_proto_get_gstr_len(&packet, sql_len, entry->sql);
|
|
||||||
}
|
|
||||||
entry->recv_time = time(0);
|
|
||||||
|
|
||||||
if (g_queue_get_length(q->chunks) >= q->max_len) { /* TODO: slow */
|
|
||||||
struct query_entry_t *old = g_queue_pop_head(q->chunks);
|
|
||||||
query_entry_free(old);
|
|
||||||
}
|
|
||||||
g_queue_push_tail(q->chunks, entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *
|
|
||||||
command_name(enum enum_server_command cmd)
|
|
||||||
{
|
|
||||||
static char number[8];
|
|
||||||
switch (cmd) {
|
|
||||||
case COM_QUERY:
|
|
||||||
return "COM_QUERY";
|
|
||||||
case COM_QUIT:
|
|
||||||
return "COM_QUIT";
|
|
||||||
case COM_INIT_DB:
|
|
||||||
return "COM_INIT_DB";
|
|
||||||
case COM_FIELD_LIST:
|
|
||||||
return "COM_FIELD_LIST";
|
|
||||||
default:
|
|
||||||
snprintf(number, sizeof(number), "COM_<%d>", cmd); /* TODO: only works for 1 cmd */
|
|
||||||
return number;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
query_entry_dump(gpointer data, gpointer user_data)
|
|
||||||
{
|
|
||||||
struct query_entry_t *entry = (struct query_entry_t *)data;
|
|
||||||
struct tm *tm = localtime(&entry->recv_time);
|
|
||||||
char tm_str[16] = { 0 };
|
|
||||||
snprintf(tm_str, sizeof(tm_str), "%d:%d:%d", tm->tm_hour, tm->tm_min, tm->tm_sec);
|
|
||||||
g_message("%s %s %s", tm_str, command_name(entry->command), entry->sql ? entry->sql->str : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
query_queue_dump(query_queue_t *q)
|
|
||||||
{
|
|
||||||
if (!g_queue_is_empty(q->chunks)) {
|
|
||||||
g_message("recent queries:");
|
|
||||||
g_queue_foreach(q->chunks, query_entry_dump, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
/* $%BEGINLICENSE%$
|
|
||||||
Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
|
|
||||||
|
|
||||||
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; version 2 of the
|
|
||||||
License.
|
|
||||||
|
|
||||||
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., 51 Franklin St, Fifth Floor, Boston, MA
|
|
||||||
02110-1301 USA
|
|
||||||
|
|
||||||
$%ENDLICENSE%$ */
|
|
||||||
|
|
||||||
#ifndef _CETUS_QUERY_QUEUE_H_
|
|
||||||
#define _CETUS_QUERY_QUEUE_H_
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
|
|
||||||
typedef struct query_queue_t {
|
|
||||||
GQueue *chunks;
|
|
||||||
int max_len;
|
|
||||||
} query_queue_t;
|
|
||||||
|
|
||||||
query_queue_t *query_queue_new(int max_len);
|
|
||||||
void query_queue_free(query_queue_t *);
|
|
||||||
void query_queue_append(query_queue_t *, GString *);
|
|
||||||
void query_queue_dump(query_queue_t *);
|
|
||||||
|
|
||||||
#endif /* _CETUS_QUERY_QUEUE_H_ */
|
|
@ -72,10 +72,6 @@
|
|||||||
#include "cetus-monitor.h"
|
#include "cetus-monitor.h"
|
||||||
#include "cetus-variable.h"
|
#include "cetus-variable.h"
|
||||||
#include "plugin-common.h"
|
#include "plugin-common.h"
|
||||||
#ifdef NETWORK_DEBUG_TRACE_STATE_CHANGES
|
|
||||||
#include "cetus-query-queue.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "network-compress.h"
|
#include "network-compress.h"
|
||||||
#include "network-ssl.h"
|
#include "network-ssl.h"
|
||||||
#include "chassis-sql-log.h"
|
#include "chassis-sql-log.h"
|
||||||
@ -291,9 +287,6 @@ network_mysqld_con_new()
|
|||||||
|
|
||||||
con->wait_clt_next_sql.tv_sec = 0;
|
con->wait_clt_next_sql.tv_sec = 0;
|
||||||
con->wait_clt_next_sql.tv_usec = 256 * 1000;
|
con->wait_clt_next_sql.tv_usec = 256 * 1000;
|
||||||
#ifdef NETWORK_DEBUG_TRACE_STATE_CHANGES
|
|
||||||
con->recent_queries = query_queue_new(20);
|
|
||||||
#endif
|
|
||||||
return con;
|
return con;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -406,9 +399,6 @@ network_mysqld_con_free(network_mysqld_con *con)
|
|||||||
con->srv->priv->listen_conns = g_list_remove(con->srv->priv->listen_conns, con);
|
con->srv->priv->listen_conns = g_list_remove(con->srv->priv->listen_conns, con);
|
||||||
con->srv->allow_new_conns = TRUE;
|
con->srv->allow_new_conns = TRUE;
|
||||||
|
|
||||||
#ifdef NETWORK_DEBUG_TRACE_STATE_CHANGES
|
|
||||||
query_queue_free(con->recent_queries);
|
|
||||||
#endif
|
|
||||||
g_free(con);
|
g_free(con);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -649,7 +649,6 @@ struct network_mysqld_con {
|
|||||||
char last_backends_type[MAX_SERVER_NUM];
|
char last_backends_type[MAX_SERVER_NUM];
|
||||||
|
|
||||||
struct sharding_plan_t *sharding_plan;
|
struct sharding_plan_t *sharding_plan;
|
||||||
struct query_queue_t *recent_queries;
|
|
||||||
void *data;
|
void *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user