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
vio/test-sslserver
vio/viotest-ssl
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 @@
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
# 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)
# See automake/autoconf docs for details
noinst_LIBRARIES= liboptions.a libnet.a libalarm.a
noinst_LIBRARIES= liboptions.a libnet.a
liboptions_a_CPPFLAGS= $(CPPFLAGS) \
-DDEFAULT_PID_FILE_NAME="$(localstatedir)/mysqlmanager.pid" \
......@@ -34,7 +34,7 @@ liboptions_a_CPPFLAGS= $(CPPFLAGS) \
-DDEFAULT_USER="root" \
-DDEFAULT_PASSWORD="" \
-DDEFAULT_MONITORING_INTERVAL="5" \
-DDEFAULT_PORT="3406" \
-DDEFAULT_PORT="33006" \
-DPROTOCOL_VERSION=@PROTOCOL_VERSION@
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
# 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_CPPFLAGS= $(CPPFLAGS) -DMYSQL_SERVER
nodist_libnet_a_SOURCES= net_serv.cc client.c errmsg.c
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
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
CLEANFILES= net_serv.cc client.c client_settings.h errmsg.c
net_serv.cc: Makefile
rm -f $(srcdir)/net_serv.cc
@LN_CP_F@ $(top_srcdir)/sql/net_serv.cc $(srcdir)/net_serv.cc
password.c: Makefile
rm -f $(srcdir)/password.c
@LN_CP_F@ $(top_srcdir)/sql/password.c $(srcdir)/password.c
pack.c: Makefile
rm -f $(srcdir)/pack.c
@LN_CP_F@ $(top_srcdir)/sql-common/pack.c $(srcdir)/pack.c
client.c: Makefile
rm -f $(srcdir)/client.c
@LN_CP_F@ $(top_srcdir)/sql-common/client.c $(srcdir)/client.c
sql_state.c: Makefile
rm -f $(srcdir)/sql_state.c
@LN_CP_F@ $(top_srcdir)/sql/sql_state.c $(srcdir)/sql_state.c
errmsg.c: Makefile
rm -f $(srcdir)/errmsg.c
@LN_CP_F@ $(top_srcdir)/libmysql/errmsg.c $(srcdir)/errmsg.c
thr_alarm.c: Makefile
rm -f $(srcdir)/thr_alarm.c
@LN_CP_F@ $(top_srcdir)/mysys/thr_alarm.c $(srcdir)/thr_alarm.c
client_settings.h: Makefile
rm -f $(srcdir)/client_settings.h
@LN_CP_F@ $(top_srcdir)/sql/client_settings.h $(srcdir)/client_settings.h
bin_PROGRAMS= mysqlmanager
......@@ -90,15 +81,16 @@ mysqlmanager_SOURCES= command.cc command.h mysqlmanager.cc \
instance_map.h instance_map.cc\
instance_options.h instance_options.cc \
buffer.h buffer.cc parse.cc parse.h \
guardian.cc guardian.h common_structures.h \
mysql_manager_error.h
guardian.cc guardian.h \
mysql_manager_error.h client_func.c
mysqlmanager_LDADD= liboptions.a \
libnet.a \
libalarm.a \
$(top_builddir)/vio/libvio.a \
$(top_builddir)/libmysql_r/libmysqlclient_r.la \
$(top_builddir)/dbug/libdbug.a -lz
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a \
$(top_builddir)/dbug/libdbug.a \
@openssl_libs@ @ZLIB_LIBS@
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 @@
#include <m_string.h>
/*
TODO: Currently there are some mysql-connection specific functions.
As we are going to suppost different types of connections, we shouldn't
have them here in future. To avoid it we could put such
connection-specific functions to the Command-derived class instead.
Note: As we are going to suppost different types of connections,
we shouldn't have connection-specific functions. To avoid it we could
put such functions to the Command-derived class instead.
The command could be easily constructed for a specific connection if
we would provide a special factory for each connection.
*/
......
......@@ -32,3 +32,8 @@ unsigned long net_write_timeout= 60; // 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;
*/
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
......@@ -78,7 +78,7 @@ my_bool net_flush(NET *net);
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. */
#define NO_ALARM
#endif
......@@ -93,7 +93,6 @@ void sql_print_error(const char *format,...);
#include "thr_alarm.h"
#ifdef MYSQL_SERVER
#define USE_QUERY_CACHE
/*
The following variables/functions should really not be declared
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,...);
extern uint test_flags;
extern ulong bytes_sent, bytes_received, net_big_packet_count;
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);
#define USE_QUERY_CACHE
#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 thd_increment_bytes_sent()
#endif
......@@ -453,7 +457,8 @@ net_real_write(NET *net,const char *packet,ulong len)
my_bool net_blocking = vio_is_blocking(net->vio);
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)
query_cache_insert(net, packet, len);
#endif
......@@ -663,13 +668,6 @@ static my_bool my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed,
}
#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
......@@ -859,9 +857,6 @@ end:
return(len);
}
#ifdef MYSQL_INSTANCE_MANAGER
#undef MYSQL_SERVER
#endif
/*
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