Commit 55a2ab6e authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi
Browse files

Cleanup of alarm macros.

Fixed data corruption bug in query cache.
Made queries be dependent of the database in use.
parent f5a1abd8
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -10200,7 +10200,7 @@ because it can't compile @code{.S} (assembler) files.
The following configure line should work:
@example
CFLAGS="-DHPUX -I/opt/dce/include" CXXFLAGS="-DHPUX -I/opt/dce/include -felide-constructors -fno-exceptions -fno-rtti" CXX=gcc ./configure --with-pthread --with-named-thread-libs='-ldce' --prefix=/usr/local/mysql --disable-shared
CFLAGS="-DHPUX -I/opt/dce/include -fpic" CXXFLAGS="-DHPUX -I/opt/dce/include -felide-constructors -fno-exceptions -fno-rtti" CXX=gcc ./configure --with-pthread --with-named-thread-libs='-ldce' --prefix=/usr/local/mysql --disable-shared
@end example
If you are compiling @code{gcc} 2.95 yourself, you should NOT link it with
@@ -22679,10 +22679,13 @@ file is written in the data directory.
If you supply an extension to @code{--log-bin=filename.extension}, the
extension will be silenty removed.
To the binary log filename @code{mysqld} will append an extension that is a
number that is incremented each time you execute @code{mysqladmin
refresh}, execute @code{mysqladmin flush-logs}, execute the @code{FLUSH LOGS}
statement or restart the server. 
To the binary log filename @code{mysqld} will append an extension that
is a number that is incremented each time you execute @code{mysqladmin
refresh}, execute @code{mysqladmin flush-logs}, execute the @code{FLUSH
LOGS} statement or restart the server. A new binary log will also
automaticly be created when it reaches @code{max_bin_log_size}. You can
delete all not active binary log files with the @code{RESET MASTER}
command. @xref{RESET}.
You can use the following options to @code{mysqld} to affect what is logged
to the binary log:
+0 −1
Original line number Diff line number Diff line
@@ -1717,7 +1717,6 @@ print_table_data_xml(MYSQL_RES *result)
    (void) tee_fputs("\n  <row>\n", PAGER);
    for (uint i=0; i < mysql_num_fields(result); i++)
    {
      char *data;
      ulong *lengths=mysql_fetch_lengths(result);
      tee_fprintf(PAGER, "\t<%s>", (fields[i].name ?
				  (fields[i].name[0] ? fields[i].name :
+9 −10
Original line number Diff line number Diff line
@@ -38,24 +38,23 @@ extern "C" {
#define THR_SERVER_ALARM SIGALRM
#endif

#if defined(DONT_USE_THR_ALARM)
#if defined(DONT_USE_THR_ALARM) || !defined(THREAD)

#define USE_ALARM_THREAD
#undef USE_ONE_SIGNAL_HAND

typedef struct st_thr_alarm_entry
{
  uint crono;
} thr_alarm_entry;
typedef my_bool thr_alarm_t;
typedef my_bool ALARM;

#define thr_alarm_init(A)   (A)->crono=0
#define thr_alarm_in_use(A) (A)->crono
#define thr_alarm_init(A) (*(A))=0
#define thr_alarm_in_use(A) (*(A) != 0)
#define thr_end_alarm(A)
#define thr_alarm(A,B,C) ((*(A)=1)-1)
/* The following should maybe be (*(A)) */
#define thr_got_alarm(A) 0 
#define init_thr_alarm(A)
#define thr_alarm_kill(A)
#define end_thr_alarm()
#define thr_alarm(A,B) (((A)->crono=1)-1)
#define thr_got_alarm(A) (A)->crono
#define thr_end_alarm(A)

#else
#if defined(__WIN__)
+4 −4
Original line number Diff line number Diff line
@@ -2225,7 +2225,7 @@ send_file_to_server(MYSQL *mysql, const char *filename)
    my_net_write(&mysql->net,"",0);		/* Server needs one packet */
    net_flush(&mysql->net);
    mysql->net.last_errno=EE_FILENOTFOUND;
    snprintf(mysql->net.last_error,sizeof(mysql->net.last_error)-1,
    my_snprintf(mysql->net.last_error,sizeof(mysql->net.last_error)-1,
		EE(mysql->net.last_errno),tmp_name, errno);
    goto err;
  }
@@ -2250,7 +2250,7 @@ send_file_to_server(MYSQL *mysql, const char *filename)
  if (readcount < 0)
  {
    mysql->net.last_errno=EE_READ; /* the errmsg for not entire file read */
    snprintf(mysql->net.last_error,sizeof(mysql->net.last_error)-1,
    my_snprintf(mysql->net.last_error,sizeof(mysql->net.last_error)-1,
		tmp_name,errno);
    goto err;
  }
+27 −40
Original line number Diff line number Diff line
@@ -41,68 +41,55 @@
#include <signal.h>
#include <errno.h>

/*
  The following handles the differences when this is linked between the
  client and the server.

  This gives an error if a too big packet is found
  The server can change this with the -O switch, but because the client
  can't normally do this the client should have a bigger max_allowed_packet.
*/

#ifdef MYSQL_SERVER
ulong max_allowed_packet=65536;
extern ulong net_read_timeout,net_write_timeout;
extern uint test_flags;
#else

/*
** Give error if a too big packet is found
** The server can change this with the -O switch, but because the client
** can't normally do this the client should have a bigger max_allowed_packet.
*/

ulong max_allowed_packet=~0L;
ulong max_allowed_packet=16*1024*1024L;
ulong net_read_timeout=  NET_READ_TIMEOUT;
ulong net_write_timeout= NET_WRITE_TIMEOUT;
#endif
ulong net_buffer_length=8192;	/* Default length. Enlarged if necessary */

#if defined(__WIN__) || defined(MSDOS)
#undef MYSQL_SERVER			/* Win32 can't handle interrupts */
#ifdef __WIN__
/* The following is because alarms doesn't work on windows. */
#undef MYSQL_SERVER
#endif

#ifdef MYSQL_SERVER
#include "my_pthread.h"
#include "thr_alarm.h"
void sql_print_error(const char *format,...);
#define RETRY_COUNT mysqld_net_retry_count
extern ulong mysqld_net_retry_count;
#else

#ifdef OS2				/* avoid name conflict */
#define thr_alarm_t  thr_alarm_t_net
#define ALARM        ALARM_net
#endif

typedef my_bool thr_alarm_t;
typedef my_bool ALARM;
#define thr_alarm_init(A) (*(A))=0
#define thr_alarm_in_use(A) (*(A) != 0)
#define thr_end_alarm(A)
#define thr_alarm(A,B,C) local_thr_alarm((A),(B),(C))
inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused)))
{
  *A=1;
  return 0;
}
#define thr_got_alarm(A) 0
#define RETRY_COUNT 1
#endif

#ifdef MYSQL_SERVER
extern ulong bytes_sent, bytes_received;
extern pthread_mutex_t LOCK_bytes_sent , LOCK_bytes_received;

extern void query_cache_insert(NET *net, const char *packet, ulong length);
#else
#undef statistic_add
#define statistic_add(A,B,C)
#endif
#define DONT_USE_THR_ALARM
#define RETRY_COUNT 1
#endif /* MYSQL_SERVER */

#include "thr_alarm.h"

#define TEST_BLOCKING		8
#define MAX_THREE_BYTES 255L*255L*255L

ulong net_buffer_length=8192;	/* Default length. Enlarged if necessary */

static int net_write_buff(NET *net,const char *packet,ulong len);

#define MAX_THREE_BYTES 255L*255L*255L

	/* Init with packet info */

@@ -335,7 +322,7 @@ net_real_write(NET *net,const char *packet,ulong len)
  long int length;
  char *pos,*end;
  thr_alarm_t alarmed;
#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2)
#if defined(MYSQL_SERVER)
  ALARM alarm_buff;
#endif
  uint retry_count=0;
@@ -522,7 +509,7 @@ my_real_read(NET *net, ulong *complen)
  uint i,retry_count=0;
  ulong len=packet_error;
  thr_alarm_t alarmed;
#if (!defined(__WIN__) && !defined(__EMX__) && !defined(OS2)) || defined(MYSQL_SERVER)
#if defined(MYSQL_SERVER)
  ALARM alarm_buff;
#endif
  my_bool net_blocking=vio_is_blocking(net->vio);
@@ -775,7 +762,7 @@ my_net_read(NET *net)

	  if (read_length != MAX_THREE_BYTES)	    /* last package */
	  {
	    multi_byte_packet= 0;		// No last zero length packet
	    multi_byte_packet= 0;		/* No last zero len packet */
	    break;
	  }
	  multi_byte_packet= NET_HEADER_SIZE;
Loading