Commit 4f32ec18 authored by unknown's avatar unknown

fix for the IM linking problem


BitKeeper/etc/ignore:
  Added mysql-5.0.2-alpha.tar.gz server-tools/instance-manager/client.c server-tools/instance-manager/client_settings.h server-tools/instance-manager/errmsg.c to the ignore list
server-tools/instance-manager/instance_map.cc:
  Comment updated
server-tools/instance-manager/priv.cc:
  added variables needed by net_serv.cc
server-tools/instance-manager/priv.h:
  declared variables needed by net_serv.cc
sql/net_serv.cc:
  added some IM-specific defines
parent 5a7c1085
...@@ -940,3 +940,7 @@ vio/test-sslclient ...@@ -940,3 +940,7 @@ vio/test-sslclient
vio/test-sslserver vio/test-sslserver
vio/viotest-ssl vio/viotest-ssl
server-tools/instance-manager/thr_alarm.c server-tools/instance-manager/thr_alarm.c
mysql-5.0.2-alpha.tar.gz
server-tools/instance-manager/client.c
server-tools/instance-manager/client_settings.h
server-tools/instance-manager/errmsg.c
...@@ -16,14 +16,14 @@ ...@@ -16,14 +16,14 @@
INCLUDES= -I$(top_srcdir)/include INCLUDES= -I$(top_srcdir)/include
DEFS= -DMYSQL_INSTANCE_MANAGER DEFS= -DMYSQL_INSTANCE_MANAGER -DMYSQL_SERVER
# As all autoconf variables depend from ${prefix} and being resolved only when # As all autoconf variables depend from ${prefix} and being resolved only when
# make is run, we can not put these defines to a header file (e.g. to # make is run, we can not put these defines to a header file (e.g. to
# default_options.h, generated from default_options.h.in) # default_options.h, generated from default_options.h.in)
# See automake/autoconf docs for details # See automake/autoconf docs for details
noinst_LIBRARIES= liboptions.a libnet.a libalarm.a noinst_LIBRARIES= liboptions.a libnet.a
liboptions_a_CPPFLAGS= $(CPPFLAGS) \ liboptions_a_CPPFLAGS= $(CPPFLAGS) \
-DDEFAULT_PID_FILE_NAME="$(localstatedir)/mysqlmanager.pid" \ -DDEFAULT_PID_FILE_NAME="$(localstatedir)/mysqlmanager.pid" \
...@@ -34,7 +34,7 @@ liboptions_a_CPPFLAGS= $(CPPFLAGS) \ ...@@ -34,7 +34,7 @@ liboptions_a_CPPFLAGS= $(CPPFLAGS) \
-DDEFAULT_USER="root" \ -DDEFAULT_USER="root" \
-DDEFAULT_PASSWORD="" \ -DDEFAULT_PASSWORD="" \
-DDEFAULT_MONITORING_INTERVAL="5" \ -DDEFAULT_MONITORING_INTERVAL="5" \
-DDEFAULT_PORT="3406" \ -DDEFAULT_PORT="33006" \
-DPROTOCOL_VERSION=@PROTOCOL_VERSION@ -DPROTOCOL_VERSION=@PROTOCOL_VERSION@
liboptions_a_SOURCES= options.h options.cc priv.h priv.cc liboptions_a_SOURCES= options.h options.cc priv.h priv.cc
...@@ -42,37 +42,28 @@ liboptions_a_SOURCES= options.h options.cc priv.h priv.cc ...@@ -42,37 +42,28 @@ liboptions_a_SOURCES= options.h options.cc priv.h priv.cc
# MySQL sometimes uses symlinks to reuse code # MySQL sometimes uses symlinks to reuse code
# All symlinked files are grouped in libnet.a # All symlinked files are grouped in libnet.a
nodist_libnet_a_SOURCES= password.c pack.c sql_state.c net_serv.cc nodist_libnet_a_SOURCES= net_serv.cc client.c errmsg.c
nodist_libnet_a_CPPFLAGS= $(CPPFLAGS) -DMYSQL_SERVER libnet_a_LIBADD= $(top_builddir)/sql/password.$(OBJEXT) \
$(top_builddir)/sql/pack.$(OBJEXT) \
$(top_builddir)/sql/sql_state.$(OBJEXT)
nodist_libalarm_a_SOURCES= thr_alarm.c CLEANFILES= net_serv.cc client.c client_settings.h errmsg.c
nodist_libalarm_a_CPPFLAGS= $(CPPFLAGS) -DMYSQL_SERVER
libalarm_a_LIBADD= $(top_builddir)/mysys/mf_qsort2.$(OBJEXT) \
$(top_builddir)/mysys/queues.$(OBJEXT) \
$(top_builddir)/mysys/my_new.$(OBJEXT)
CLEANFILES= net_serv.cc password.c pack.c sql_state.c thr_alarm.c
net_serv.cc: Makefile net_serv.cc: Makefile
rm -f $(srcdir)/net_serv.cc rm -f $(srcdir)/net_serv.cc
@LN_CP_F@ $(top_srcdir)/sql/net_serv.cc $(srcdir)/net_serv.cc @LN_CP_F@ $(top_srcdir)/sql/net_serv.cc $(srcdir)/net_serv.cc
password.c: Makefile client.c: Makefile
rm -f $(srcdir)/password.c rm -f $(srcdir)/client.c
@LN_CP_F@ $(top_srcdir)/sql/password.c $(srcdir)/password.c @LN_CP_F@ $(top_srcdir)/sql-common/client.c $(srcdir)/client.c
pack.c: Makefile
rm -f $(srcdir)/pack.c
@LN_CP_F@ $(top_srcdir)/sql-common/pack.c $(srcdir)/pack.c
sql_state.c: Makefile errmsg.c: Makefile
rm -f $(srcdir)/sql_state.c rm -f $(srcdir)/errmsg.c
@LN_CP_F@ $(top_srcdir)/sql/sql_state.c $(srcdir)/sql_state.c @LN_CP_F@ $(top_srcdir)/libmysql/errmsg.c $(srcdir)/errmsg.c
thr_alarm.c: Makefile client_settings.h: Makefile
rm -f $(srcdir)/thr_alarm.c rm -f $(srcdir)/client_settings.h
@LN_CP_F@ $(top_srcdir)/mysys/thr_alarm.c $(srcdir)/thr_alarm.c @LN_CP_F@ $(top_srcdir)/sql/client_settings.h $(srcdir)/client_settings.h
bin_PROGRAMS= mysqlmanager bin_PROGRAMS= mysqlmanager
...@@ -90,15 +81,16 @@ mysqlmanager_SOURCES= command.cc command.h mysqlmanager.cc \ ...@@ -90,15 +81,16 @@ mysqlmanager_SOURCES= command.cc command.h mysqlmanager.cc \
instance_map.h instance_map.cc\ instance_map.h instance_map.cc\
instance_options.h instance_options.cc \ instance_options.h instance_options.cc \
buffer.h buffer.cc parse.cc parse.h \ buffer.h buffer.cc parse.cc parse.h \
guardian.cc guardian.h common_structures.h \ guardian.cc guardian.h \
mysql_manager_error.h mysql_manager_error.h client_func.c
mysqlmanager_LDADD= liboptions.a \ mysqlmanager_LDADD= liboptions.a \
libnet.a \ libnet.a \
libalarm.a \
$(top_builddir)/vio/libvio.a \ $(top_builddir)/vio/libvio.a \
$(top_builddir)/libmysql_r/libmysqlclient_r.la \ $(top_builddir)/mysys/libmysys.a \
$(top_builddir)/dbug/libdbug.a -lz $(top_builddir)/strings/libmystrings.a \
$(top_builddir)/dbug/libdbug.a \
@openssl_libs@ @ZLIB_LIBS@
tags: tags:
......
#include <my_global.h>
#include <my_sys.h>
#include <mysql.h>
/*
Currently we cannot use libmysqlclient directly becouse of the linking
issues. Here we provide needed libmysqlclient functions.
TODO: to think how to use libmysqlclient code instead of copy&paste.
The other possible solution is to use simple_command directly.
*/
const char * STDCALL
mysql_get_server_info(MYSQL *mysql)
{
return((char*) mysql->server_version);
}
int STDCALL
mysql_ping(MYSQL *mysql)
{
DBUG_ENTER("mysql_ping");
DBUG_RETURN(simple_command(mysql,COM_PING,0,0,0));
}
int STDCALL
mysql_shutdown(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level)
{
uchar level[1];
DBUG_ENTER("mysql_shutdown");
level[0]= (uchar) shutdown_level;
DBUG_RETURN(simple_command(mysql, COM_SHUTDOWN, (char *)level, 1, 0));
}
...@@ -27,10 +27,9 @@ ...@@ -27,10 +27,9 @@
#include <m_string.h> #include <m_string.h>
/* /*
TODO: Currently there are some mysql-connection specific functions. Note: As we are going to suppost different types of connections,
As we are going to suppost different types of connections, we shouldn't we shouldn't have connection-specific functions. To avoid it we could
have them here in future. To avoid it we could put such put such functions to the Command-derived class instead.
connection-specific functions to the Command-derived class instead.
The command could be easily constructed for a specific connection if The command could be easily constructed for a specific connection if
we would provide a special factory for each connection. we would provide a special factory for each connection.
*/ */
......
...@@ -32,3 +32,8 @@ unsigned long net_write_timeout= 60; // same as in mysqld ...@@ -32,3 +32,8 @@ unsigned long net_write_timeout= 60; // same as in mysqld
unsigned long net_retry_count= 10; // same as in mysqld unsigned long net_retry_count= 10; // same as in mysqld
/* needed by net_serv.cc */
unsigned int test_flags= 0;
unsigned long bytes_sent = 0L, bytes_received = 0L;
unsigned long mysqld_net_retry_count = 10L;
unsigned long open_files_limit;
...@@ -56,5 +56,9 @@ extern unsigned long net_write_timeout; ...@@ -56,5 +56,9 @@ extern unsigned long net_write_timeout;
*/ */
extern unsigned long net_retry_count; extern unsigned long net_retry_count;
extern unsigned int test_flags;
extern unsigned long bytes_sent, bytes_received;
extern unsigned long mysqld_net_retry_count;
extern unsigned long open_files_limit;
#endif // INCLUDES_MYSQL_INSTANCE_MANAGER_PRIV_H #endif // INCLUDES_MYSQL_INSTANCE_MANAGER_PRIV_H
...@@ -78,7 +78,7 @@ my_bool net_flush(NET *net); ...@@ -78,7 +78,7 @@ my_bool net_flush(NET *net);
can't normally do this the client should have a bigger max_allowed_packet. can't normally do this the client should have a bigger max_allowed_packet.
*/ */
#if (defined(__WIN__) || (!defined(MYSQL_SERVER) && !defined(MYSQL_INSTANCE_MANAGER))) #if defined(__WIN__) || !defined(MYSQL_SERVER)
/* The following is because alarms doesn't work on windows. */ /* The following is because alarms doesn't work on windows. */
#define NO_ALARM #define NO_ALARM
#endif #endif
...@@ -93,7 +93,6 @@ void sql_print_error(const char *format,...); ...@@ -93,7 +93,6 @@ void sql_print_error(const char *format,...);
#include "thr_alarm.h" #include "thr_alarm.h"
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
#define USE_QUERY_CACHE
/* /*
The following variables/functions should really not be declared The following variables/functions should really not be declared
extern, but as it's hard to include mysql_priv.h here, we have to extern, but as it's hard to include mysql_priv.h here, we have to
...@@ -102,9 +101,14 @@ void sql_print_error(const char *format,...); ...@@ -102,9 +101,14 @@ void sql_print_error(const char *format,...);
extern uint test_flags; extern uint test_flags;
extern ulong bytes_sent, bytes_received, net_big_packet_count; extern ulong bytes_sent, bytes_received, net_big_packet_count;
extern pthread_mutex_t LOCK_bytes_sent , LOCK_bytes_received; extern pthread_mutex_t LOCK_bytes_sent , LOCK_bytes_received;
#ifndef MYSQL_INSTANCE_MANAGER
extern void query_cache_insert(NET *net, const char *packet, ulong length); extern void query_cache_insert(NET *net, const char *packet, ulong length);
#define USE_QUERY_CACHE
#define update_statistics(A) A #define update_statistics(A) A
#else #endif /* MYSQL_INSTANCE_MANGER */
#endif /* defined(MYSQL_SERVER) && !defined(MYSQL_INSTANCE_MANAGER) */
#if !defined(MYSQL_SERVER) || defined(MYSQL_INSTANCE_MANAGER)
#define update_statistics(A) #define update_statistics(A)
#define thd_increment_bytes_sent() #define thd_increment_bytes_sent()
#endif #endif
...@@ -453,7 +457,8 @@ net_real_write(NET *net,const char *packet,ulong len) ...@@ -453,7 +457,8 @@ net_real_write(NET *net,const char *packet,ulong len)
my_bool net_blocking = vio_is_blocking(net->vio); my_bool net_blocking = vio_is_blocking(net->vio);
DBUG_ENTER("net_real_write"); DBUG_ENTER("net_real_write");
#if defined(MYSQL_SERVER) && defined(HAVE_QUERY_CACHE) #if defined(MYSQL_SERVER) && defined(HAVE_QUERY_CACHE) \
&& !defined(MYSQL_INSTANCE_MANAGER)
if (net->query_cache_query != 0) if (net->query_cache_query != 0)
query_cache_insert(net, packet, len); query_cache_insert(net, packet, len);
#endif #endif
...@@ -663,13 +668,6 @@ static my_bool my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed, ...@@ -663,13 +668,6 @@ static my_bool my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed,
} }
#endif /* NO_ALARM */ #endif /* NO_ALARM */
/*
If we are inside of the instance manageer, we need to simulate mysql
server for the following function.
*/
#ifdef MYSQL_INSTANCE_MANAGER
#define MYSQL_SERVER
#endif
/* /*
Reads one packet to net->buff + net->where_b Reads one packet to net->buff + net->where_b
...@@ -859,9 +857,6 @@ my_real_read(NET *net, ulong *complen) ...@@ -859,9 +857,6 @@ my_real_read(NET *net, ulong *complen)
return(len); return(len);
} }
#ifdef MYSQL_INSTANCE_MANAGER
#undef MYSQL_SERVER
#endif
/* /*
Read a packet from the client/server and return it without the internal Read a packet from the client/server and return it without the internal
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment