Skip to content

Commit f3a186c

Browse files
author
monty@mashka.mysql.fi
committed
Portability fixes.
Improve mysql-test to be more robust. Fix that GRANT doesn't delete SSL options Change innobase_flush_log_at_trx_commit to uint. Don't rotate logs if we read a rotate log entry from the master.
1 parent 5ee7d7e commit f3a186c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+485
-350
lines changed

Docs/manual.texi

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1793,7 +1793,7 @@ and @code{row-level locking}.
17931793

17941794
@item
17951795
Our German, Austrian, and Swiss users will note that we have a new character
1796-
set, @code{latin_de}, which corrects the @emph{German sorting order},
1796+
set, @code{latin1_de}, which corrects the @emph{German sorting order},
17971797
placing German umlauts in the same order as German telephone books.
17981798

17991799
@item
@@ -3409,9 +3409,6 @@ database if you are not using the @code{-A} option or if you are using
34093409
@code{rehash}. This is especially notable when you have a big table
34103410
cache.
34113411

3412-
@item
3413-
The current replication protocol cannot deal with @code{LOAD DATA INFILE}
3414-
and line terminator characters of more than 1 character.
34153412
@end itemize
34163413

34173414
The following problems are known and will be fixed in due time:
@@ -3422,6 +3419,10 @@ The following problems are known and will be fixed in due time:
34223419
When using @code{SET CHARACTER SET}, one can't use translated
34233420
characters in database, table, and column names.
34243421

3422+
@item
3423+
One can't use @code{_} or @code{%} with @code{ESCAPE} in @code{LIKE
3424+
... ESCAPE}.
3425+
34253426
@item
34263427
If you have a @code{DECIMAL} column with a number stored in different
34273428
formats (+01.00, 1.00, 01.00), @code{GROUP BY} may regard each value
@@ -20614,7 +20615,7 @@ but normally this is never needed.
2061420615
@subsubsection German character set
2061520616

2061620617
To get German sorting order, you should start @code{mysqld} with
20617-
@code{--default-character-set=latin_de}. This will give you the following
20618+
@code{--default-character-set=latin1_de}. This will give you the following
2061820619
characteristics.
2061920620

2062020621
When sorting and comparing string's the following mapping is done on the
@@ -50391,6 +50392,19 @@ each individual 4.0.x release.
5039150392

5039250393
@itemize @bullet
5039350394
@item
50395+
@code{SELECT @@@@[global|session].var_name} didn't report
50396+
@code{global | session} in the result column name.
50397+
@item
50398+
Fixed problem in replication that @code{FLUSH LOGS} in a circular
50399+
replication setup created an infinite number of binary log files.
50400+
Now a @code{rotate-binary-log} command in the binary log will not cause slaves
50401+
to rotate logs.
50402+
@item
50403+
Removed @code{STOP EVENT} from binary log when doing @code{FLUSH LOGS}.
50404+
@item
50405+
Disable the use of @code{SHOW NEW MASTER FOR SLAVE} as this needs to be
50406+
completely changed in 4.1.
50407+
@item
5039450408
@code{--log-binary=a.b.c} now properly strips of @code{.b.c}.
5039550409
@item
5039650410
@code{FLUSH LOGS} removed numerical extension for all future update logs.
@@ -50954,7 +50968,7 @@ Secure connections (with SSL).
5095450968
Unsigned @code{BIGINT} constants now work. @code{MIN()} and @code{MAX()}
5095550969
now handle signed and unsigned @code{BIGINT} numbers correctly.
5095650970
@item
50957-
New character set @code{latin_de} which provides correct German sorting.
50971+
New character set @code{latin1_de} which provides correct German sorting.
5095850972
@item
5095950973
@code{STRCMP()} now uses the current character set when doing comparisons,
5096050974
which means that the default comparison behaviour now is case-insensitive.

client/mysqlbinlog.cc

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "log_event.h"
2222

2323
#define BIN_LOG_HEADER_SIZE 4
24-
#define PROBE_HEADER_LEN (BIN_LOG_HEADER_SIZE+EVENT_LEN_OFFSET+4)
24+
#define PROBE_HEADER_LEN (EVENT_LEN_OFFSET+4)
2525

2626

2727
#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES)
@@ -378,31 +378,40 @@ static void dump_remote_log_entries(const char* logname)
378378

379379
static int check_header(IO_CACHE* file)
380380
{
381+
byte header[BIN_LOG_HEADER_SIZE];
381382
byte buf[PROBE_HEADER_LEN];
382383
int old_format=0;
383384

384385
my_off_t pos = my_b_tell(file);
385386
my_b_seek(file, (my_off_t)0);
386-
if (my_b_read(file, buf, sizeof(buf)))
387-
die("Failed reading header");
388-
if (buf[EVENT_TYPE_OFFSET+4] == START_EVENT)
387+
if (my_b_read(file, header, sizeof(header)))
388+
die("Failed reading header; Probably an empty file");
389+
if (memcmp(header, BINLOG_MAGIC, sizeof(header)))
390+
die("File is not a binary log file");
391+
if (!my_b_read(file, buf, sizeof(buf)))
389392
{
390-
uint event_len;
391-
event_len = uint4korr(buf + EVENT_LEN_OFFSET + 4);
392-
old_format = (event_len < LOG_EVENT_HEADER_LEN + START_HEADER_LEN);
393+
if (buf[4] == START_EVENT)
394+
{
395+
uint event_len;
396+
event_len = uint4korr(buf + 4);
397+
old_format = (event_len < LOG_EVENT_HEADER_LEN + START_HEADER_LEN);
398+
}
393399
}
394400
my_b_seek(file, pos);
395401
return old_format;
396402
}
397403

404+
398405
static void dump_local_log_entries(const char* logname)
399406
{
400407
File fd = -1;
401408
IO_CACHE cache,*file= &cache;
402409
ulonglong rec_count = 0;
403-
char last_db[FN_REFLEN+1] = "";
410+
char last_db[FN_REFLEN+1], tmp_buff[BIN_LOG_HEADER_SIZE];
404411
bool old_format = 0;
405412

413+
last_db[0]=0;
414+
406415
if (logname && logname[0] != '-')
407416
{
408417
if ((fd = my_open(logname, O_RDONLY | O_BINARY, MYF(MY_WME))) < 0)
@@ -435,14 +444,7 @@ static void dump_local_log_entries(const char* logname)
435444
}
436445

437446
if (!position)
438-
{
439-
char magic[BIN_LOG_HEADER_SIZE];
440-
if (my_b_read(file, (byte*) magic, sizeof(magic)))
441-
die("I/O error reading binlog magic number");
442-
if (memcmp(magic, BINLOG_MAGIC, 4))
443-
die("Bad magic number; The file is probably not a MySQL binary log");
444-
}
445-
447+
my_b_read(file, tmp_buff, BIN_LOG_HEADER_SIZE); // Skip header
446448
for (;;)
447449
{
448450
char llbuff[21];

client/mysqltest.c

Lines changed: 38 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,8 @@
8787
#define CON_RETRY_SLEEP 2
8888
#define MAX_CON_TRIES 5
8989

90-
#ifndef OS2
9190
#define SLAVE_POLL_INTERVAL 300000 /* 0.3 of a sec */
92-
#else
93-
#defile SLAVE_POLL_INTERVAL 0.3
94-
#endif
91+
9592

9693
enum {OPT_MANAGER_USER=256,OPT_MANAGER_HOST,OPT_MANAGER_PASSWD,
9794
OPT_MANAGER_PORT,OPT_MANAGER_WAIT_TIMEOUT};
@@ -423,6 +420,7 @@ static void free_used_memory()
423420
my_free(embedded_server_args[--embedded_server_arg_count],MYF(0));
424421
delete_dynamic(&q_lines);
425422
dynstr_free(&ds_res);
423+
free_replace();
426424
my_free(pass,MYF(MY_ALLOW_ZERO_PTR));
427425
free_defaults(default_argv);
428426
mysql_server_end();
@@ -687,13 +685,23 @@ int open_file(const char* name)
687685
return 0;
688686
}
689687

688+
static void my_sleep(ulong m_seconds)
689+
{
690+
#ifndef OS2
691+
struct timeval t;
692+
t.tv_sec= m_seconds / 1000000L;
693+
t.tv_usec= m_seconds % 1000000L;
694+
select(0,0,0,0,&t); /* sleep */
695+
#else
696+
DosSleep(m_seconds/1000+1);
697+
#endif
698+
}
699+
700+
690701
/* ugly long name, but we are following the convention */
691702
int do_wait_for_slave_to_stop(struct st_query* q __attribute__((unused)))
692703
{
693704
MYSQL* mysql = &cur_con->mysql;
694-
#ifndef OS2
695-
struct timeval t;
696-
#endif
697705
for (;;)
698706
{
699707
MYSQL_RES* res;
@@ -714,15 +722,8 @@ int do_wait_for_slave_to_stop(struct st_query* q __attribute__((unused)))
714722
mysql_free_result(res);
715723
if (done)
716724
break;
717-
#ifndef OS2
718-
t.tv_sec=0;
719-
t.tv_usec=SLAVE_POLL_INTERVAL;
720-
select(0,0,0,0,&t); /* sleep */
721-
#else
722-
DosSleep(OS2_SLAVE_POLL_INTERVAL);
723-
#endif
725+
my_sleep(SLAVE_POLL_INTERVAL);
724726
}
725-
726727
return 0;
727728
}
728729

@@ -1000,10 +1001,18 @@ int do_sync_with_master2(const char* p)
10001001
die("line %u: empty result in %s", start_lineno, query_buf);
10011002
if (!row[0])
10021003
die("Error on slave while syncing with master");
1003-
mysql_free_result(res); last_result=0;
1004+
mysql_free_result(res);
1005+
last_result=0;
10041006
if (rpl_parse)
10051007
mysql_enable_rpl_parse(mysql);
10061008

1009+
#ifndef TO_BE_REMOVED
1010+
/*
1011+
We need this because wait_for_pos() only waits for the relay log,
1012+
which doesn't guarantee that the slave has executed the statement.
1013+
*/
1014+
my_sleep(2*1000000L);
1015+
#endif
10071016
return 0;
10081017
}
10091018

@@ -1082,53 +1091,15 @@ int do_disable_rpl_parse(struct st_query* q __attribute__((unused)))
10821091
int do_sleep(struct st_query* q, my_bool real_sleep)
10831092
{
10841093
char* p=q->first_argument;
1085-
struct timeval t;
1086-
int dec_mul = 1000000;
1087-
while (*p && isspace(*p)) p++;
1094+
while (*p && isspace(*p))
1095+
p++;
10881096
if (!*p)
10891097
die("Missing argument in sleep\n");
1090-
t.tv_usec = 0;
1091-
1092-
#ifdef OS2
1093-
10941098
if (opt_sleep && !real_sleep)
1095-
DosSleep( opt_sleep * 1000);
1099+
my_sleep(opt_sleep * 1000000L);
10961100
else
1097-
DosSleep( atof( p) * 1000);
1098-
1101+
my_sleep((ulong) (atof(p) * 1000000L));
10991102
return 0;
1100-
1101-
#else
1102-
if (opt_sleep && !real_sleep)
1103-
t.tv_sec = opt_sleep;
1104-
else
1105-
{
1106-
t.tv_sec = atoi(p);
1107-
while (*p && *p != '.' && !isspace(*p))
1108-
p++;
1109-
if (*p == '.')
1110-
{
1111-
int c;
1112-
char *p_end;
1113-
p++;
1114-
p_end = p + 6;
1115-
1116-
for (;p <= p_end; ++p)
1117-
{
1118-
c = (int) (*p - '0');
1119-
if (c < 10 && (int) c >= 0)
1120-
{
1121-
t.tv_usec = t.tv_usec * 10 + c;
1122-
dec_mul /= 10;
1123-
}
1124-
else
1125-
break;
1126-
}
1127-
}
1128-
}
1129-
t.tv_usec *= dec_mul;
1130-
return select(0,0,0,0, &t);
1131-
#endif
11321103
}
11331104

11341105
static void get_file_name(char *filename, struct st_query* q)
@@ -1261,8 +1232,7 @@ static void get_replace(struct st_query *q)
12611232
POINTER_ARRAY to_array,from_array;
12621233
DBUG_ENTER("get_replace");
12631234

1264-
if (glob_replace)
1265-
free_replace();
1235+
free_replace();
12661236

12671237
bzero((char*) &to_array,sizeof(to_array));
12681238
bzero((char*) &from_array,sizeof(from_array));
@@ -1298,9 +1268,12 @@ static void get_replace(struct st_query *q)
12981268
void free_replace()
12991269
{
13001270
DBUG_ENTER("free_replace");
1301-
my_free((char*) glob_replace,MYF(0));
1302-
glob_replace=0;
1303-
free_replace_buffer();
1271+
if (glob_replace)
1272+
{
1273+
my_free((char*) glob_replace,MYF(0));
1274+
glob_replace=0;
1275+
free_replace_buffer();
1276+
}
13041277
DBUG_VOID_RETURN;
13051278
}
13061279

@@ -2077,7 +2050,7 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
20772050
char* query;
20782051
int query_len;
20792052
DBUG_ENTER("run_query");
2080-
2053+
20812054
if (q->type != Q_EVAL)
20822055
{
20832056
query = q->query;
@@ -2090,6 +2063,7 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
20902063
query = eval_query.str;
20912064
query_len = eval_query.length;
20922065
}
2066+
DBUG_PRINT("enter", ("query: '%-.60s'", query));
20932067

20942068
if (q->record_file[0])
20952069
{

configure.in

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ case $SYSTEM_TYPE in
922922
fi
923923
fi
924924
;;
925-
*darwin*)
925+
*darwin5*)
926926
if test "$ac_cv_prog_gcc" = "yes"
927927
then
928928
CFLAGS="$CFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH"
@@ -931,6 +931,14 @@ case $SYSTEM_TYPE in
931931
with_named_curses=""
932932
fi
933933
;;
934+
*darwin6*)
935+
if test "$ac_cv_prog_gcc" = "yes"
936+
then
937+
CFLAGS="$CFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH"
938+
CXXFLAGS="$CXXFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ"
939+
MAX_C_OPTIMIZE="-O"
940+
fi
941+
;;
934942
*freebsd*)
935943
echo "Adding fix for interrupted reads"
936944
CXXFLAGS="$CXXFLAGS -DMYSQLD_NET_RETRY_COUNT=1000000"

include/my_sys.h

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,14 @@ extern int NEAR my_errno; /* Last error in mysys */
126126
/* defines when allocating data */
127127

128128
#ifdef SAFEMALLOC
129-
#define my_malloc(SZ,FLAG) _mymalloc( SZ, __FILE__, __LINE__, FLAG )
130-
#define my_malloc_ci(SZ,FLAG) _mymalloc( SZ, sFile, uLine, FLAG )
131-
#define my_realloc(PTR,SZ,FLAG) _myrealloc( PTR, SZ, __FILE__, __LINE__, FLAG )
129+
#define my_malloc(SZ,FLAG) _mymalloc((SZ), __FILE__, __LINE__, FLAG )
130+
#define my_malloc_ci(SZ,FLAG) _mymalloc((SZ), sFile, uLine, FLAG )
131+
#define my_realloc(PTR,SZ,FLAG) _myrealloc((PTR), (SZ), __FILE__, __LINE__, FLAG )
132132
#define my_checkmalloc() _sanity( __FILE__, __LINE__ )
133-
#define my_free(PTR,FLAG) _myfree( PTR, __FILE__, __LINE__,FLAG)
134-
#define my_memdup(A,B,C) _my_memdup(A,B,__FILE__,__LINE__,C)
135-
#define my_strdup(A,C) _my_strdup(A,__FILE__,__LINE__,C)
133+
#define my_free(PTR,FLAG) _myfree((PTR), __FILE__, __LINE__,FLAG)
134+
#define my_memdup(A,B,C) _my_memdup((A),(B), __FILE__,__LINE__,C)
135+
#define my_strdup(A,C) _my_strdup((A), __FILE__,__LINE__,C)
136+
#define my_strdup_with_length(A,B,C) _my_strdup_with_length((A),(B),__FILE__,__LINE__,C)
136137
#define QUICK_SAFEMALLOC sf_malloc_quick=1
137138
#define NORMAL_SAFEMALLOC sf_malloc_quick=0
138139
extern uint sf_malloc_prehunc,sf_malloc_endhunc,sf_malloc_quick;
@@ -153,6 +154,8 @@ extern gptr my_realloc(gptr oldpoint,uint Size,myf MyFlags);
153154
extern void my_no_flags_free(gptr ptr);
154155
extern gptr my_memdup(const byte *from,uint length,myf MyFlags);
155156
extern my_string my_strdup(const char *from,myf MyFlags);
157+
extern my_string my_strdup_with_length(const char *from,uint length,
158+
myf MyFlags);
156159
#define my_free(PTR,FG) my_no_flags_free(PTR)
157160
#define CALLER_INFO_PROTO /* nothing */
158161
#define CALLER_INFO /* nothing */
@@ -550,6 +553,10 @@ extern gptr _my_memdup(const byte *from,uint length,
550553
const char *sFile, uint uLine,myf MyFlag);
551554
extern my_string _my_strdup(const char *from, const char *sFile, uint uLine,
552555
myf MyFlag);
556+
extern my_string _my_strdup_with_length(const char *from, uint length,
557+
const char *sFile, uint uLine,
558+
myf MyFlag);
559+
553560
#ifndef TERMINATE
554561
extern void TERMINATE(FILE *file);
555562
#endif

0 commit comments

Comments
 (0)