developers
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
May 2009
- 24 participants
- 74 discussions
Hi all:
when compiling on x64 systems (i.e. CentOS & Fedora core 10) and using the
BUILD/compile-pentium64-max, I'm getting the -lz error "/usr/bin/ld: cannot
find -lz" and when I simplify the ./comfigure line to a --without-zlib it
works. So, after modifing the configure flags that results into:
./configure --prefix=/u02/local/mysql-5.1.34 --enable-assembler
--with-extra-charsets=complex --enable-thread-safe-client --with-big-tables
--with-readline --with-ssl --with-plugins=max --with-embedded-server
--with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static
--without-zlib --enable-local-infile
It still has problems with the -lz flag, so does anybody know what is
bringing the -lz into the configure? Note: I've also tried
--with-zlibdir=/usr/lib64, but same error.
Thanks tons.
4
11
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2700)
by knielsenīŧ knielsen-hq.org 18 May '09
by knielsenīŧ knielsen-hq.org 18 May '09
18 May '09
#At lp:maria
2700 knielsen(a)knielsen-hq.org 2009-05-18
Fix support-files/build-tags for newer bzr which do not default to --recursive on bzr ls.
modified:
support-files/build-tags
=== modified file 'support-files/build-tags'
--- a/support-files/build-tags 2008-08-06 20:25:25 +0000
+++ b/support-files/build-tags 2009-05-18 07:29:14 +0000
@@ -4,7 +4,7 @@ rm -f TAGS
filter='\.cc$\|\.c$\|\.h$\|\.yy$'
list="find . -type f"
-bzr root >/dev/null 2>/dev/null && list="bzr ls --kind=file --versioned"
+bzr root >/dev/null 2>/dev/null && list="bzr ls --recursive --kind=file --versioned"
$list |grep $filter |while read f;
do
1
0
[Maria-developers] ptr_compare replace with memcmp and associated performance
by Stewart Smith 17 May '09
by Stewart Smith 17 May '09
17 May '09
So i broke out mtaylor's patch that we were bumming around with at the UC
to replace ptr_compare with a simple memcmp call.
At the UC I benched that this patch actually caused a measurable performance
regresssion.
So what's the difference?
(same benchmark and machine as in previous mail)
MAX_FIELDS=64 with std::bitset
read/write requests: 70000 (3374.50 per sec.)
read/write requests: 70000 (3102.42 per sec.)
read/write requests: 70000 (3113.47 per sec.)
read/write requests: 70000 (3401.89 per sec.)
read/write requests: 70000 (3164.61 per sec.)
AVERAGE= 3231.37
With ptr_compare replaced with memcmp:
read/write requests: 70000 (3090.33 per sec.)
read/write requests: 70000 (3066.97 per sec.)
read/write requests: 70000 (2954.93 per sec.)
read/write requests: 70000 (2875.57 per sec.)
read/write requests: 70000 (2953.99 per sec.)
AVERAGE= 2988.35
With ptr_compare replaced with __builtin_memcmp:
read/write requests: 70000 (3245.37 per sec.)
read/write requests: 70000 (3001.91 per sec.)
read/write requests: 70000 (3254.99 per sec.)
read/write requests: 70000 (3177.13 per sec.)
read/write requests: 70000 (3195.49 per sec.)
AVERAGE= 3174.97
So, I thought that with just using the __builtin_memcmp automatically, we
may be okay with merging this.
However... I do have the following concerns:
1) I'm pretty sure that __builtin_memcmp is gcc only, and that SunStudio
may have an issue (yay - wrappers!)
2) Is this perf difference going to be true on different platforms?
3) the various memcmp implementations do seem to be dependent on a few
things for performance: alignment, size of data.
For what we're seeing in sysbench, the parameters are things like this:
"SELECT c from sbtest where id between 9942 and 10041 order by c"
0xc30780,0xc2c340,240
0xc2e560,0xc2c340,240
0xc30780,0xc2e560,240
0xc37390,0xc32f50,240
0xc35170,0xc32f50,240
0xc37390,0xc35170,240
0xc3dcc8,0xc39888,240
0xc3baa8,0xc2e560,240
0xc35170,0xc2e560,240
0xc3baa8,0xc35170,240
0xc2c340,0xc35170,240
0xc35170,0xc3dcc8,240
0xc2c618,0xc35170,240
0xc35170,0xc3d9f0,240
0xc2c8f0,0xc35170,240
0x7fbed85f10f0,0x7fbed85eccb0,240
and from the CREATE TABLE:
`c` VARCHAR(120) NOT NULL COLLATE utf8_general_ci DEFAULT `` ,
So here it's large, and aligned.
For some other micro-benchmarks I've clocked things looking much
different.... so it's possibly query dependent as to what ends up being
better (i.e. how much data we're comparing).
(1st parameter is number of repetitions, 2nd is number of bytes to memcmp)
For comparing equal values:
stewart@willster:~/src/test/memcmp$ ./a.out 168435455 8
168435455 repetitions
Testing memcmp ..... done, 7.432 seconds
Testing builtin memcmp ....... done, 16.313 seconds
Testing loop .... done, 6.144 seconds
Testing loop32 .... done, 2.764 seconds
Testing loop64 .... done, 2.128 seconds
Testing no-op .... done, 1.488 seconds
stewart@willster:~/src/test/memcmp$ ./a.out 168435455 16
168435455 repetitions
Testing memcmp ..... done, 5.912 seconds
Testing builtin memcmp ....... done, 26.418 seconds
Testing loop .... done, 11.201 seconds
Testing loop32 .... done, 3.980 seconds
Testing loop64 .... done, 2.564 seconds
Testing no-op .... done, 1.492 seconds
stewart@willster:~/src/test/memcmp$ ./a.out 168435455 32
168435455 repetitions
Testing memcmp ..... done, 6.828 seconds
Testing builtin memcmp ....... done, 46.891 seconds
Testing loop .... done, 21.473 seconds
Testing loop32 .... done, 6.536 seconds
Testing loop64 .... done, 3.804 seconds
Testing no-op .... done, 1.476 seconds
stewart@willster:~/src/test/memcmp$ ./a.out 168435455 64
168435455 repetitions
Testing memcmp ..... done, 9.549 seconds
Testing builtin memcmp ....... done, 87.513 seconds
Testing loop .... done, 41.455 seconds
Testing loop32 .... done, 11.669 seconds
Testing loop64 .... done, 6.368 seconds
Testing no-op .... done, 1.468 seconds
stewart@willster:~/src/test/memcmp$ ./a.out 168435455 128
168435455 repetitions
Testing memcmp ..... done, 15.081 seconds
Testing builtin memcmp ....... done, 169.143 seconds
Testing loop .... done, 86.397 seconds
Testing loop32 .... done, 21.877 seconds
Testing loop64 .... done, 11.445 seconds
Testing no-op .... done, 1.488 seconds
stewart@willster:~/src/test/memcmp$ gcc -O3 -fno-builtin memcmpbench.c
stewart@willster:~/src/test/memcmp$ ./a.out 168435455 256
168435455 repetitions
Testing memcmp ..... done, 26.134 seconds
Testing loop64 .... done, 21.549 seconds
Testing no-op .... done, 1.500 seconds
Completely inequal values are all about the same:
stewart@willster:~/src/test/memcmp$ ./a.out 168435455 8
168435455 repetitions
Testing memcmp ..... done, 3.204 seconds
Testing builtin memcmp ....... done, 13.945 seconds
Testing loop .... done, 1.896 seconds
Testing loop32 .... done, 2.092 seconds
Testing loop64 .... done, 2.136 seconds
Testing no-op .... done, 1.488 seconds
stewart@willster:~/src/test/memcmp$ ./a.out 168435455 240
168435455 repetitions
Testing memcmp ..... done, 5.520 seconds
Testing builtin memcmp ....... done, 13.973 seconds
Testing loop .... done, 1.912 seconds
Testing loop32 .... done, 2.124 seconds
Testing loop64 .... done, 2.104 seconds
Testing no-op .... done, 1.468 seconds
For half the same:
stewart@willster:~/src/test/memcmp$ ./a.out 168435455 8
168435455 repetitions
Testing memcmp ..... done, 7.340 seconds
Testing builtin memcmp ....... done, 19.193 seconds
Testing loop .... done, 4.212 seconds
Testing loop32 .... done, 2.956 seconds
Testing loop64 .... done, 2.112 seconds
Testing no-op .... done, 1.476 seconds
stewart@willster:~/src/test/memcmp$ ./a.out 168435455 32
168435455 repetitions
Testing memcmp ..... done, 5.920 seconds
Testing builtin memcmp ....... done, 34.526 seconds
Testing loop .... done, 11.885 seconds
Testing loop32 .... done, 4.444 seconds
Testing loop64 .... done, 3.388 seconds
Testing no-op .... done, 1.468 seconds
stewart@willster:~/src/test/memcmp$ ./a.out 168435455 64
168435455 repetitions
Testing memcmp ..... done, 6.948 seconds
Testing builtin memcmp ....... done, 54.923 seconds
Testing loop .... done, 22.081 seconds
Testing loop32 .... done, 7.000 seconds
Testing loop64 .... done, 4.444 seconds
Testing no-op .... done, 1.488 seconds
Is concurrency an issue here and not raw single threaded performance?
Let's try with 64 threads (on the same 2 core box):
64 threads, __builtin_memcmp:
read/write requests: 70000 (3184.20 per sec.)
read/write requests: 70000 (3184.87 per sec.)
read/write requests: 70000 (3166.83 per sec.)
read/write requests: 70000 (3085.69 per sec.)
AVERAGE=3155.39
64 threads, memcmp:
read/write requests: 70000 (3218.07 per sec.)
read/write requests: 70000 (3219.04 per sec.)
read/write requests: 70000 (3222.48 per sec.)
read/write requests: 70000 (3116.00 per sec.)
AVERAGE=3193.89
64 threads, 32bit cmp loop:
read/write requests: 70000 (3173.76 per sec.)
read/write requests: 70000 (3156.23 per sec.)
read/write requests: 70000 (3206.70 per sec.)
read/write requests: 70000 (3247.61 per sec.)
AVERAGE=3196.07
64 threads, 64bit cmp loop:
read/write requests: 70000 (3210.02 per sec.)
read/write requests: 70000 (3218.87 per sec.)
read/write requests: 70000 (3225.98 per sec.)
read/write requests: 70000 (3131.60 per sec.)
AVERAGE= 3196.61
64 threads, baseline (using original ptr_compare):
read/write requests: 70000 (3542.95 per sec.)
read/write requests: 70000 (3556.15 per sec.)
read/write requests: 70000 (3560.71 per sec.)
read/write requests: 70000 (3476.80 per sec.)
AVERAGE=3534.15
i.e. the old ptr_compare whoops the arse of any of the memcmp calls with
higher concurrency.
So, after this I can conclude:
- memcmp is nothing if not consistent across various microbenchmarks
- builtin_memcmp seems to help a bit at lower concurrency, not at all at
higher and is seldom useful in micro benchmark.
- the 64bit loop isn't so good at higher concurrency
- the 64bit loop is favourable in microbenchmarks
- memcmp is close to the 64bit loop performance (at most only 2x slower)
Unrolling loops being the key?
Testing loop .... done, 11.813 seconds
Testing unrollloop .... done, 7.628 seconds
Testing unrollloop32 .... done, 2.532 seconds
Testing unrollloop64 .... done, 2.536 seconds
Testing loop32 .... done, 4.432 seconds
Testing loop64 .... done, 3.792 seconds
Testing no-op .... done, 1.276 seconds
(32 and 64 do 32,64 bit compares in an unrolled loop)
Questions:
- Why does my 64bit compare loop not equal performance of ptr_compare
unrolled loop? (in a microbenchmark, it beats it). Concurrency again?
So what should we do?
Certainly a call to memcmp is easier to understand and keeps the code
nice and simple, but we're talking up to a 10% speed hit here at higher
concurrency (at least on my hardware).
I wonder what the difference is on various other hardware setups.
I'd be very interested to see what happens on sparc.
I'd also like to see it micro-benchmarked - preferably something we
could repeat in future (even in ./configure ? on server startup ?)
I'm voting to keep the current ptr_compare code, and hope that somebody
provides further explanation on top of what I've looked at here.
Below is the patch, followed by the code i used for microbenchmarking
(note the commented out 64bit loop i used for the above loop tests):
=== modified file 'drizzled/filesort.cc'
--- drizzled/filesort.cc 2009-04-28 00:17:10 +0000
+++ drizzled/filesort.cc 2009-05-08 05:59:11 +0000
@@ -1135,7 +1135,7 @@ int merge_buffers(SORTPARAM *param, IO_C
}
else
{
- cmp= get_ptr_compare(sort_length);
+ cmp= (qsort2_cmp)ptr_compare;
first_cmp_arg= (void*) &sort_length;
}
priority_queue<BUFFPEK *, vector<BUFFPEK *>, compare_functor >
=== modified file 'mysys/mf_sort.cc'
--- mysys/mf_sort.cc 2009-04-17 21:01:47 +0000
+++ mysys/mf_sort.cc 2009-05-08 05:59:11 +0000
@@ -34,7 +34,7 @@ void my_string_ptr_sort(unsigned char *b
{
if (size && items)
{
- my_qsort2(base,items, sizeof(unsigned char*), get_ptr_compare(size),
+ my_qsort2(base,items, sizeof(unsigned char*), (qsort2_cmp)ptr_compare,
(void*) &size);
}
}
=== modified file 'mysys/my_sys.h'
--- mysys/my_sys.h 2009-04-27 22:05:43 +0000
+++ mysys/my_sys.h 2009-05-08 05:59:11 +0000
@@ -420,7 +420,12 @@ extern void my_qsort(void *base_ptr, siz
qsort_cmp cmp);
extern void my_qsort2(void *base_ptr, size_t total_elems, size_t size,
qsort2_cmp cmp, void *cmp_argument);
-extern qsort2_cmp get_ptr_compare(size_t);
+
+#if defined(__cplusplus)
+extern "C"
+#endif
+int ptr_compare(size_t *compare_length, unsigned char **a, unsigned char **b);
+
void my_store_ptr(unsigned char *buff, size_t pack_length, my_off_t pos);
my_off_t my_get_ptr(unsigned char *ptr, size_t pack_length);
File create_temp_file(char *to, const char *dir, const char *pfx,
=== modified file 'mysys/ptr_cmp.cc'
--- mysys/ptr_cmp.cc 2009-04-26 16:53:32 +0000
+++ mysys/ptr_cmp.cc 2009-05-08 05:59:11 +0000
@@ -21,137 +21,33 @@
#include "mysys/mysys_priv.h"
#include "plugin/myisam/myisampack.h"
-
-static int ptr_compare(size_t *compare_length, unsigned char **a, unsigned char **b);
-static int ptr_compare_0(size_t *compare_length, unsigned char **a, unsigned char **b);
-static int ptr_compare_1(size_t *compare_length, unsigned char **a, unsigned char **b);
-static int ptr_compare_2(size_t *compare_length, unsigned char **a, unsigned char **b);
-static int ptr_compare_3(size_t *compare_length, unsigned char **a, unsigned char **b);
-
- /* Get a pointer to a optimal byte-compare function for a given size */
-
-qsort2_cmp get_ptr_compare (size_t size)
-{
- if (size < 4)
- return (qsort2_cmp) ptr_compare;
- switch (size & 3) {
- case 0: return (qsort2_cmp) ptr_compare_0;
- case 1: return (qsort2_cmp) ptr_compare_1;
- case 2: return (qsort2_cmp) ptr_compare_2;
- case 3: return (qsort2_cmp) ptr_compare_3;
- }
- return 0; /* Impossible */
-}
-
+#include <string.h>
/*
Compare to keys to see witch is smaller.
- Loop unrolled to make it quick !!
*/
-#define cmp(N) if (first[N] != last[N]) return (int) first[N] - (int) last[N]
-
-static int ptr_compare(size_t *compare_length, unsigned char **a, unsigned char **b)
-{
- register int length= *compare_length;
- register unsigned char *first,*last;
-
- first= *a; last= *b;
- while (--length)
- {
- if (*first++ != *last++)
- return (int) first[-1] - (int) last[-1];
- }
- return (int) first[0] - (int) last[0];
-}
-
-
-static int ptr_compare_0(size_t *compare_length,unsigned char **a, unsigned char **b)
+extern "C"
+int ptr_compare(size_t *compare_length, unsigned char **a, unsigned char **b)
{
- register int length= *compare_length;
- register unsigned char *first,*last;
-
- first= *a; last= *b;
- loop:
- cmp(0);
- cmp(1);
- cmp(2);
- cmp(3);
- if ((length-=4))
+/* size_t l= *compare_length / sizeof(uint64_t);
+ uint64_t *aa= (uint64_t*)*a;
+ uint64_t *bb= (uint64_t*)*b;
+ while(l--)
{
- first+=4;
- last+=4;
- goto loop;
- }
- return (0);
-}
-
-
-static int ptr_compare_1(size_t *compare_length,unsigned char **a, unsigned char **b)
-{
- register int length= *compare_length-1;
- register unsigned char *first,*last;
-
- first= *a+1; last= *b+1;
- cmp(-1);
- loop:
- cmp(0);
- cmp(1);
- cmp(2);
- cmp(3);
- if ((length-=4))
- {
- first+=4;
- last+=4;
- goto loop;
- }
- return (0);
-}
-
-static int ptr_compare_2(size_t *compare_length,unsigned char **a, unsigned char **b)
-{
- register int length= *compare_length-2;
- register unsigned char *first,*last;
-
- first= *a +2 ; last= *b +2;
- cmp(-2);
- cmp(-1);
- loop:
- cmp(0);
- cmp(1);
- cmp(2);
- cmp(3);
- if ((length-=4))
- {
- first+=4;
- last+=4;
- goto loop;
+ if(*aa != *bb)
+ {
+ if(*aa < *bb)
+ return -1;
+ else
+ return 1;
+ }
+ aa++, bb++;
}
- return (0);
+ return 0;
+*/ return memcmp(*a, *b, *compare_length);
}
-static int ptr_compare_3(size_t *compare_length,unsigned char **a, unsigned char **b)
-{
- register int length= *compare_length-3;
- register unsigned char *first,*last;
-
- first= *a +3 ; last= *b +3;
- cmp(-3);
- cmp(-2);
- cmp(-1);
- loop:
- cmp(0);
- cmp(1);
- cmp(2);
- cmp(3);
- if ((length-=4))
- {
- first+=4;
- last+=4;
- goto loop;
- }
- return (0);
-}
void my_store_ptr(unsigned char *buff, size_t pack_length, my_off_t pos)
{
For those interested, i started with the code at
http://gcc.gnu.org/ml/gcc/2002-10/msg01666.html
and ended up with something like this:
#include <sys/resource.h>
#include <sys/time.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
char s1[256];
char s2[256];
int cmpsize= 240;
int
speed_memcmp ()
{
return memcmp (s1, s2, cmpsize);
}
int
speed_bimemcmp ()
{
return __builtin_memcmp (s1, s2, cmpsize);
}
int
speed_loop ()
{
int i=cmpsize;
char *a= s1;
char *b= s2;
while(i--)
{
if(*a != *b)
return -1;
a++, b++;
};
return 0;
}
int
speed_loop32 ()
{
int i=cmpsize/4;
int *a= (int*)s1;
int *b= (int*)s2;
while(i--)
{
if(*a != *b)
return -1;
a++, b++;
};
return 0;
}
int
speed_loop64 ()
{
int i=cmpsize/8;
long long *a= (long long*)s1;
long long *b= (long long*)s2;
while(i--)
{
if(*a != *b)
return -1;
a++, b++;
};
return 0;
}
int speed_null()
{
return 0;
}
double
do_test (int repetitions, int (*test_function) ())
{
struct rusage r1, r2;
getrusage(RUSAGE_SELF, &r1);
while (repetitions--)
test_function ();
getrusage(RUSAGE_SELF, &r2);
return (r2.ru_utime.tv_sec - r1.ru_utime.tv_sec) +
(r2.ru_utime.tv_usec - r1.ru_utime.tv_usec) / 1000000.0;
}
main(int argc, char **argv)
{
int repetitions = (argc == 1) ? 0x0fffffff : atoi(argv[1]);
cmpsize = (argc == 2) ? 240 : atoi(argv[2]);
memset(s1, 42, 256);
memset(s2, 42, 256);
memset(s2+(cmpsize/2), 55, cmpsize/2);
printf ("%d repetitions\n\n", repetitions);
printf ("Testing memcmp .....");
fflush (stdout);
printf (" done, %10.3f seconds\n", do_test (repetitions, speed_memcmp));
printf ("Testing builtin memcmp .......");
fflush (stdout);
printf (" done, %10.3f seconds\n", do_test (repetitions, speed_bimemcmp));
printf ("Testing loop ....");
fflush (stdout);
printf (" done, %10.3f seconds\n", do_test (repetitions, speed_loop));
printf ("Testing loop32 ....");
fflush (stdout);
printf (" done, %10.3f seconds\n", do_test (repetitions, speed_loop32));
printf ("Testing loop64 ....");
fflush (stdout);
printf (" done, %10.3f seconds\n", do_test (repetitions, speed_loop64));
printf ("Testing no-op ....");
fflush (stdout);
printf (" done, %10.3f seconds\n", do_test (repetitions, speed_null));
exit (0);
}
--
Stewart Smith
6
5
Antony mentioned on IRC about CMake changes that let you not use
config.js and other nasty things when building on Win32 (and Win64).
These are all just in the MySQL Cluster branch - namely 7.0.
Who knows when this gets back into any mainline branch though...
--
Stewart Smith
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2699)
by knielsenīŧ knielsen-hq.org 15 May '09
by knielsenīŧ knielsen-hq.org 15 May '09
15 May '09
#At lp:maria
2699 knielsen(a)knielsen-hq.org 2009-05-15
test commit 1
modified:
README
=== modified file 'README'
--- a/README 2008-03-26 10:15:03 +0000
+++ b/README 2009-05-15 06:31:51 +0000
@@ -33,3 +33,4 @@ file.
IMPORTANT:
Bug or error reports should be sent to http://bugs.mysql.com.
+
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2689)
by knielsenīŧ knielsen-hq.org 13 May '09
by knielsenīŧ knielsen-hq.org 13 May '09
13 May '09
#At lp:maria
2689 knielsen(a)knielsen-hq.org 2009-03-31
Fix build error after last push with --with-debug=full due to SAFEMALLOC now being
defined in my_config.h (as opposed to in CFLAGS before.)
modified:
mysys/my_malloc.c
mysys/my_once.c
mysys/my_realloc.c
per-file messages:
mysys/my_malloc.c
Need to include my_global.h before messing with SAFEMALLOC, as now that macro may be
re-defined in my_config.h, which is included from my_global.h
mysys/my_once.c
Need to include my_global.h before messing with SAFEMALLOC, as now that macro may be
re-defined in my_config.h, which is included from my_global.h
mysys/my_realloc.c
Need to include my_global.h before messing with SAFEMALLOC, as now that macro may be
re-defined in my_config.h, which is included from my_global.h
=== modified file 'mysys/my_malloc.c'
--- a/mysys/my_malloc.c 2007-10-02 07:32:33 +0000
+++ b/mysys/my_malloc.c 2009-03-31 08:06:51 +0000
@@ -13,6 +13,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+/* my_global.h may define SAFEMALLOC (through my_config.h). */
+#include <my_global.h>
+
#ifdef SAFEMALLOC /* We don't need SAFEMALLOC here */
#undef SAFEMALLOC
#endif
=== modified file 'mysys/my_once.c'
--- a/mysys/my_once.c 2007-05-10 09:59:39 +0000
+++ b/mysys/my_once.c 2009-03-31 08:06:51 +0000
@@ -15,6 +15,9 @@
/* Not MT-SAFE */
+/* my_global.h may define SAFEMALLOC (through my_config.h). */
+#include <my_global.h>
+
#ifdef SAFEMALLOC /* We don't need SAFEMALLOC here */
#undef SAFEMALLOC
#endif
=== modified file 'mysys/my_realloc.c'
--- a/mysys/my_realloc.c 2008-04-28 16:24:05 +0000
+++ b/mysys/my_realloc.c 2009-03-31 08:06:51 +0000
@@ -13,6 +13,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+/* my_global.h may define SAFEMALLOC (through my_config.h). */
+#include <my_global.h>
+
#ifdef SAFEMALLOC /* We don't need SAFEMALLOC here */
#undef SAFEMALLOC
#endif
8
29
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2698)
by knielsenīŧ knielsen-hq.org 10 May '09
by knielsenīŧ knielsen-hq.org 10 May '09
10 May '09
#At lp:maria
2698 knielsen(a)knielsen-hq.org 2009-05-05 [merge]
test merge.
modified:
BUILD/compile-solaris-amd64
BUILD/compile-solaris-amd64-debug*
BUILD/compile-solaris-amd64-forte
BUILD/compile-solaris-amd64-forte-debug*
storage/innobase/include/univ.i
storage/pbxt/src/Makefile.am
storage/pbxt/src/lock_xt.h
storage/pbxt/src/pbms.h
=== modified file 'BUILD/compile-solaris-amd64'
--- a/BUILD/compile-solaris-amd64 2007-04-12 11:20:38 +0000
+++ b/BUILD/compile-solaris-amd64 2009-05-04 14:36:55 +0000
@@ -1,55 +1,34 @@
-#!/usr/bin/bash
+#!/bin/sh
-function _find_mysql_root () (
- while [ "x$PWD" != "x/" ]; do
- # Check if some directories are present
- if [ -d BUILD -a -d sql -a -d mysys ]; then
- echo "$PWD"
- return 0
- fi
- cd ..
- done
- return 1
-)
+# Pre-requisites for Solaris 10:
+#
+# setup:
+# ln -s `which perl` /usr/local/bin
+# your $PATH needs to include (in this order):
+# /usr/local/bin:/usr/sfw/bin:/usr/ccs/bin
+#
+# packages from http://sunfreeware.com/indexintel10.html :
+# automake-1.10.2-sol10-x86-local.gz
+# autoconf-2.63-sol10-x86-local.gz
+# m4-1.4.12-sol10-x86-local.gz
+# libsigsegv-2.6-sol10-x86-local.gz
+# libtool-1.5.24-sol10-x86-local.gz
+# ( how to install these packages:
+ # wget ftp://ftp.sunfreeware.com/pub/freeware/intel/10/automake-1.10.2-sol10-x86-lâĻ
+ # gunzip automake-1.10.2-sol10-x86-local.gz
+ # pkgadd -d automake-1.10.2-sol10-x86-local
+# )
+
+#
+# if using --with-libevent, install that library from
+# http://www.monkey.org/~provos/libevent/
-make -k clean || true
-/bin/rm -f */.deps/*.P config.cache
-
path=`dirname $0`
-. "$path/autorun.sh"
-
-warning_flags="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Wunused"
-compiler_flags="-g -O3 -fno-omit-frame-pointer"
+. "$path/SETUP.sh"
+extra_flags="$amd64_cflags -D__sun -m64 -mtune=athlon64"
+extra_configs="$amd64_configs $max_configs --with-libevent"
-export CC CXX CFLAGS CXXFLAGS LDFLAGS LIBS
-CC="gcc"
-CXX="gcc"
-CFLAGS="$warning_flags $compiler_flags"
-CXXFLAGS=""
-LDFLAGS="-O3 -g -static-libgcc"
-LIBS=-lmtmalloc
-root=$(_find_mysql_root)
+LDFLAGS="-lmtmalloc -static-libgcc"
+export LDFLAGS
-$root/configure \
- --prefix=/usr/local/mysql \
- --localstatedir=/usr/local/mysql/data \
- --libexecdir=/usr/local/mysql/bin \
- --with-extra-charsets=complex \
- --enable-thread-safe-client \
- --enable-local-infile \
- --with-zlib-dir=bundled \
- --with-big-tables \
- --with-readline \
- --with-archive-storage-engine \
- --with-named-curses=-lcurses \
- --with-big-tables \
- --with-innodb \
- --with-berkeley-db \
- --with-example-storage-engine \
- --with-blackhole-storage-engine \
- --with-ndbcluster \
- --with-federated-storage-engine \
- --with-csv-storage-engine \
- --with-ssl \
- --with-embedded-server \
- --disable-shared
+. "$path/FINISH.sh"
=== modified file 'BUILD/compile-solaris-amd64-debug' (properties changed: -x to +x)
--- a/BUILD/compile-solaris-amd64-debug 2007-11-10 10:03:07 +0000
+++ b/BUILD/compile-solaris-amd64-debug 2009-05-04 14:36:55 +0000
@@ -1,10 +1,11 @@
-#! /bin/sh
+#!/bin/sh
+
path=`dirname $0`
. "$path/SETUP.sh"
-amd64_cflags="-m64 -mtune=athlon64"
-extra_flags="$amd64_cflags $debug_cflags $max_cflags"
-c_warnings="$c_warnings $debug_extra_warnings"
-cxx_warnings="$cxx_warnings $debug_extra_warnings"
-extra_configs="$amd64_configs $debug_configs $max_configs --enable-thread-safe-client"
+extra_flags="$amd64_cflags -D__sun -m64 $debug_cflags"
+extra_configs="$amd64_configs $debug_configs $max_configs --with-libevent"
+
+LDFLAGS="-lmtmalloc -static-libgcc"
+export LDFLAGS
. "$path/FINISH.sh"
=== modified file 'BUILD/compile-solaris-amd64-forte'
--- a/BUILD/compile-solaris-amd64-forte 2008-09-30 20:57:48 +0000
+++ b/BUILD/compile-solaris-amd64-forte 2009-05-04 15:48:27 +0000
@@ -1,53 +1,35 @@
-#! /bin/sh
+#!/bin/sh
-gmake -k clean || true
-/bin/rm -f */.deps/*.P config.cache
-
-path=`dirname $0`
-. "$path/autorun.sh"
+# See file compile-solaris-amd64 for basic pre-requisites.
+
+# This build uses the Sun Studio compilers (cc, CC).
+# http://developers.sun.com/sunstudio/downloads/index.jsp
+# Note that you may want to apply current patches, as the downloaded version
+# is typically out of date. Download the PKG version if you intend to patch!
+
+# After installing, add /opt/SUNWspro/bin to your $PATH
-# For "optimal" code for this computer add -fast to EXTRA
-# To compile 64 bit, add -m64 to EXTRA_64_BIT
-EXTRA_64_BIT="-m64"
-EXTRA="-fast"
+path=`dirname $0`
+. "$path/SETUP.sh"
+
+extra_flags="-m64 -mt -D_FORTEC_ -xbuiltin=%all -xlibmil -xlibmopt -fns=no -xprefetch=auto -xprefetch_level=3"
+extra_configs="$max_configs --with-libevent"
-#
-# The following should not need to be touched
-#
-
-export CC CXX CFLAGS CXXFLAGS LIBS
-STD="-g -mt -D_FORTEC_ $EXTRA $EXTRA_64_BIT"
-ASFLAGS="$EXTRA_64_BIT"
-CC=cc-5.0
-CFLAGS="-Xa -xstrconst $STD"
+# I want this for my buildbot, which has limited zone resources
+#export AM_MAKEFLAGS
+#AM_MAKEFLAGS=""
+
+export warnings c_warnings cxx_warnings base_cxxflags
+warnings=""
+c_warnings=""
+cxx_warnings=""
+base_cxxflags="-noex"
+
+export CC CXX CFLAGS CXXFLAGS LDFLAGS
+CC=cc
+CFLAGS="-xstrconst"
CXX=CC
-CXXFLAGS="-noex $STD"
-LIBS=-lmtmalloc
-./configure \
- --prefix=/usr/local/mysql \
- --localstatedir=/usr/local/mysql/data \
- --libexecdir=/usr/local/mysql/bin \
- --with-extra-charsets=complex \
- --enable-thread-safe-client \
- --enable-local-infile \
- --with-zlib-dir=bundled \
- --with-big-tables \
- --with-readline \
- --with-archive-storage-engine \
- --with-named-curses=-lcurses \
- --with-big-tables \
- --with-innodb \
- --with-example-storage-engine \
- --with-blackhole-storage-engine \
- --with-federated-storage-engine \
- --with-csv-storage-engine \
- --with-ssl \
- --enable-assembler
-
-# Not including:
-# --with-ndbcluster
-# --with-berkeley-db
+LDFLAGS="-lmtmalloc"
-gmake -j4
-test $? = 0 && make test
+. "$path/FINISH.sh"
=== modified file 'BUILD/compile-solaris-amd64-forte-debug' (properties changed: -x to +x)
--- a/BUILD/compile-solaris-amd64-forte-debug 2008-09-30 20:57:48 +0000
+++ b/BUILD/compile-solaris-amd64-forte-debug 2009-05-04 15:48:27 +0000
@@ -1,54 +1,28 @@
-#! /bin/sh
+#!/bin/sh
-gmake -k clean || true
-/bin/rm -f */.deps/*.P config.cache
-
path=`dirname $0`
-. "$path/autorun.sh"
+. "$path/SETUP.sh"
-# To compile 64 bit, add -m64 to EXTRA_64_BIT
-EXTRA_64_BIT="-m64"
-
-# For "optimal" code for this computer add -fast to EXTRA. Note that
-# this causes problem with debugging the program since -fast implies
-# -xO5.
-EXTRA=""
-
-#
-# The following should not need to be touched
-#
-
-export CC CXX CFLAGS CXXFLAGS
-STD="-g -mt -D_FORTEC_ $EXTRA $EXTRA_64_BIT $debug_cflags"
-ASFLAGS="$EXTRA_64_BIT"
-CC=cc-5.0
-CFLAGS="-Xa -xstrconst $STD"
+# take only #define options - the others are gcc specific
+DEFS=""
+for F in $debug_cflags ; do
+ expr "$F" : "^-D" && DEFS="$DEFS $F"
+done
+debug_cflags="-O0 -g $DEFS"
+
+extra_flags="-m64 -mt -D_FORTEC_ -xlibmopt -fns=no $debug_cflags"
+extra_configs="$max_configs --with-libevent $debug_configs"
+
+export warnings c_warnings cxx_warnings base_cxxflags debug_cflags
+warnings=""
+c_warnings=""
+cxx_warnings=""
+base_cxxflags="-noex"
+
+export CC CXX CFLAGS CXXFLAGS LDFLAGS
+CC=cc
+CFLAGS="-xstrconst"
CXX=CC
-CXXFLAGS="-noex $STD"
-./configure \
- --prefix=/usr/local/mysql \
- --localstatedir=/usr/local/mysql/data \
- --libexecdir=/usr/local/mysql/bin \
- --with-extra-charsets=complex \
- --enable-thread-safe-client \
- --enable-local-infile \
- --with-zlib-dir=bundled \
- --with-big-tables \
- --with-readline \
- --with-archive-storage-engine \
- --with-named-curses=-lcurses \
- --with-big-tables \
- --with-innodb \
- --with-example-storage-engine \
- --with-blackhole-storage-engine \
- --with-federated-storage-engine \
- --with-csv-storage-engine \
- --with-ssl \
- --with-debug \
- --enable-assembler
-
-# Not including:
-# --with-ndbcluster
-# --with-berkeley-db
+LDFLAGS="-lmtmalloc"
-gmake -j4
+. "$path/FINISH.sh"
=== modified file 'storage/innobase/include/univ.i'
--- a/storage/innobase/include/univ.i 2008-03-27 01:40:45 +0000
+++ b/storage/innobase/include/univ.i 2009-05-04 14:54:10 +0000
@@ -58,7 +58,7 @@ of the 32-bit x86 assembler in mutex ope
/* We only try to do explicit inlining of functions with gcc and
Microsoft Visual C++ */
-# if !defined(__GNUC__)
+# if !defined(__GNUC__) && !defined(__SUNPRO_C)
# undef UNIV_MUST_NOT_INLINE /* Remove compiler warning */
# define UNIV_MUST_NOT_INLINE
# endif
=== modified file 'storage/pbxt/src/Makefile.am'
--- a/storage/pbxt/src/Makefile.am 2009-04-01 06:40:11 +0000
+++ b/storage/pbxt/src/Makefile.am 2009-05-04 14:36:55 +0000
@@ -46,7 +46,7 @@ libpbxt_la_CFLAGS = $(AM_CFLAGS) -DMYSQ
EXTRA_LIBRARIES = libpbxt.a
noinst_LIBRARIES = libpbxt.a
libpbxt_a_SOURCES = $(libpbxt_la_SOURCES)
-libpbxt_a_CXXFLAGS = $(AM_CXXFLAGS) -Wno-long-long
+libpbxt_a_CXXFLAGS = $(AM_CXXFLAGS)
libpbxt_a_CFLAGS = $(AM_CFLAGS) -std=c99
EXTRA_DIST = CMakeLists.txt
=== modified file 'storage/pbxt/src/lock_xt.h'
--- a/storage/pbxt/src/lock_xt.h 2009-04-02 10:03:14 +0000
+++ b/storage/pbxt/src/lock_xt.h 2009-05-04 14:36:55 +0000
@@ -208,9 +208,9 @@ inline void xt_atomic_dec2(volatile xtWo
#elif defined(__GNUC__)
__sync_fetch_and_sub(mptr, 1);
#elif defined(XT_SPL_SOLARIS_LIB)
- val1 = atomic_dec_16_nv(mptr);
+ atomic_dec_16_nv(mptr);
#else
- val1 = --(*mptr);
+ --(*mptr);
#endif
}
=== modified file 'storage/pbxt/src/pbms.h'
--- a/storage/pbxt/src/pbms.h 2009-03-26 12:18:01 +0000
+++ b/storage/pbxt/src/pbms.h 2009-05-03 16:31:02 +0000
@@ -782,21 +782,28 @@ private:
void deleteTempFiles()
{
- struct dirent entry;
+ struct dirent *entry;
struct dirent *result;
DIR *odir;
int err;
+ size_t sz;
char temp_file[100];
+#ifdef XT_SOLARIS
+ sz = sizeof(struct dirent) + pathconf("/tmp/", _PC_NAME_MAX); // Solaris, see readdir(3C)
+#else
+ sz = sizeof(struct dirent);
+#endif
+ entry = (struct dirent*)malloc(sz);
if (!(odir = opendir("/tmp/")))
return;
- err = readdir_r(odir, &entry, &result);
+ err = readdir_r(odir, entry, &result);
while (!err && result) {
const char **prefix = temp_prefix;
while (*prefix) {
- if (startsWith(entry.d_name, *prefix)) {
- int pid = atoi(entry.d_name + strlen(*prefix));
+ if (startsWith(entry->d_name, *prefix)) {
+ int pid = atoi(entry->d_name + strlen(*prefix));
/* If the process does not exist: */
if (kill(pid, 0) == -1 && errno == ESRCH) {
@@ -807,9 +814,10 @@ private:
prefix++;
}
- err = readdir_r(odir, &entry, &result);
+ err = readdir_r(odir, entry, &result);
}
closedir(odir);
+ free(entry);
}
};
#endif // PBMS_API
4
10
On 9 May 2009, at 10:22, Jim Idle wrote:
> Antony T Curtis wrote:
>>
>> On 9 May 2009, at 00:35, Michael Widenius wrote:
>>
>>>
>>> jim> Indeed. Obviously syntactical changes are just slog really and
>>> jim> most of that is ensuring that there is enough coverage in
>>> regression
>>> jim> tests to exercise all the syntactic differences between T-SQL
>>> and
>>> jim> MySql, or rather, all the syntax of MySQL. A lot of
>>> commonality but
>>> jim> still a fair bit of work. What is the definitive language
>>> reference
>>> jim> for MySQL Marina? I can locate reference manuals and ANSI
>>> specs of
>>> jim> course, but if you have one particular document in mind, then
>>> it would
>>> jim> be useful to work off that so I can evaluate the syntactical
>>> changes I
>>> jim> would need to make.
>>>
>>> Unfortunately there is no other spec than the sql_yacc.yy file that
>>> comes with the MySQL source code.
>>
>> I have a tool somewhere which can build .dot files from the .yy
>> files in the same way how ANTLRworks draws its syntax diagrams....
>> Copies of the tool exist somewhere on the old MySQL internal
>> repositories but I am sure I have a backup copy somewhere.
> Yes, I added this ability to ANTLR C runtime too. You can see the
> effect here:
>
> http://www.temporal-wave.com/index.php?option=com_psrrun&view=psrrun&ItemidâĻ
What I mean was... Feed in the sql_yacc.yy file and output a human
understandable syntax diagram.
>
>>
>>>
>>> jim>
>>> jim> I would like to do this in two steps:
>>> jim>
>>> jim> a) Replace the mysql_yacc.yy file, with as few changes as
>>> possible in
>>> jim> the rest of the MySQL source.
>>> jim>
>>> jim>
>>> jim> ANTLR is essentially the same gestalt as bison: one or more
>>> source files define the grammar and contain actions in C,
>>> triggered at the parse points; These grammar definition files are
>>> converted into C source by invoking an external program (in the
>>> case of ANTLR it is a Java program) and the resulting .c/.h files
>>> are compiled with the rest of the code.
>>> jim>
>>> jim> I wrote the C output to be machine independent. The idea
>>> being that you can generate the .c files on one machine, check
>>> that source code in and use it on any other machine without re-
>>> generating. This can be useful when targeting systems without Java
>>> machines (or ones that don't work very well). So, like many other
>>> systems you can have a 'build completely from scratch' option and
>>> a 'use pre-generated files option'.
>>> jim>
>>> jim> In the main then, I suspect that the bigger changes to the
>>> MySQL base would be build changes. I say this based upon the
>>> assumption that any new parser should build the same AST for a
>>> query as the yacc based version does. This means the new parser
>>> makes the same calls as the old one and thus the code external to
>>> the parser would probably require little, if anything in the way
>>> of change (but see b below).
>>>
>>> That sounds very good.
>>
>> Not possible to build the same AST as the yacc/bison based parser
>> because there is no AST.
>> The execution structures are directly built during the parsing phase.
> Sure - for AST, you can read execution structures - there didn't
> really seem to be any nomenclature but when I discussed this with
> some people at Sun a while back, they used the terms AST and tree,
> so I just copied them :-) So I think I would use the AST I already
> build, to generate the execution structures there currently. Having
> an AST means that there is a structure that can be later used for
> optimization (should that be any better than optimization the
> current execution structures).
For a few of us, AST != execution structures .... mostly because the
execution structures are very much not "abstract" and were dictated by
historical and implementation issues.
I have argued years ago that a good AST would allow better
optimization later cheaply.
For example, right now, there is a lot of work to try to simplify the
Item trees for boolean expressions. This work would be better done
with ASTs without wasting as much memory.
>
>>
>>> Agree
>>
>> You will have to implement an all-new AST which then can be used to
>> 'compile' the execution structures.
>> (this was a minor sticking part of an earlier attempt to replace
>> the parser - there were objections to building an AST and adding an
>> additional stage to the execution)
> Yeah - I just wrote that before I read this paragraph ;-) As I
> already have this structure, it can be shown to pretty much zero
> overhead compared to query optimization and execution time. A good
> AST mostly simplifies rather than complicates things of course.
> Whether my current AST needs shaping to optimally generate MySQL
> remains to be seen, but it is easy to change if needed.
++Agree
The only tricky issues is to try to generate exactly the same
structures but in some instances later, there will be scope for
actually creating simpler structures than what MySQL currently
generates.
>
>>
>>> n more generic structures. That should be easy to define.
>>>
>>> The MySQL code doesn't rely on bison structures at all (as far as
>>> I know).
>>
>> AFAIK, MySQL does not use any Bison internals as such.
> Yes - I could not see any reliance myself.
>> A past project from many years ago, I put into MySQL a PCCTS (pre-
>> ANTLR) LL parser, basically keeping MySQL's custom lexer but it
>> generated Token objects instead suitable for the PCCTS generated
>> parser. The project was never completed because integration of
>> Stored Procedures became the objective for MySQL 5.0 instead of
>> implementation of a new parser.
>>
>> I have asked Stewart Smith to see if he can help make public that
>> old source repository as a Bazaar repository as people may be able
>> to learn from it how to replace the parser without major pain.
> Sure - any prior work obviously helps, but I think that the lexing
> is already good. I might make changes to keyword detection to become
> MySql friendly; T-SQL is a historically a bit unsure exactly when
> keywords can be used. This would reduce the DFA sizes for the parser.
>>
>>>
>>> Did you get time to do the analyse?
>>>
>>> jim>
>>> jim> A few other things that may be of note:
>>> jim>
>>> jim> 1) The ANTLR generated code is free threading so long as any
>>> action code that you place withing the parser is also free
>>> threading.
>>>
>>> In other words, same as with bison
>>
>> The ANTLR runtime does, of course, require Java.
> This, this would be my C runtime as Java is way too slow for this.
> There is no Java required at runtime, only for developers to
> generate the C.
>> So developers who wish to extend the grammar do have to have the
>> Java Runtime installed as well as the ANTLR jars.
> For grammar yes as the ANTLR tool runs in Java. In practice this
> isn't really a problem I think?
Yeah. When I wrote "ANTLR runtime", I meant "ANTLR compiler".
>
>>
>> I too am interested to help if at all possible.
> One thing that this would need would be a good regression testing
> suite. Right now I have 1300 .sql files that prove the lexer/parser/
> ast, but there would need to be more of these and runtime testing
> and so on.
There will have to be proper unit tests to show that a certain AST
builds the correct required MySQL execution structures (Item trees,
JOIN, TABLE_LIST etc etc).
The best part of such an effort would be "At last! a formal
specification of how the execution structures should look like".
This would be exciting and cool if we can (at last) have a sane
parser... especially as LL parsers always generate much nicer error
messages for the users.
Regards,
Antony.
1
0
Hi!
I fixed the maria-developers address so that everyone else can follow
and participate in the discussion.
jim> jim> Monty,
jim> jim>
jim> jim> My T-SQL parser is now complete and a number of people are using
jim> jim> the Java, C# and C version. Would you like to have a look at it?
jim>
jim> Monty> Yes, I would be intrested to know more about this!
jim>
jim> OK - I have my demo online now. If you visit http://www.temporal-wave.com
jim>
jim> and take the Online Demos->T-SQL menu option you can enter T-SQL
jim> batches and see the parse results. Over the next day or so, I am
jim> adding demos of my C# and VB.Net parsers, so if the site goes up and
jim> down then just wait a few minutes and try again :-) Once I have
jim> evaluated some of the things you mention below then I will let you
jim> have a scan at the source code.
ok. I will take a look as soon as I have got through the emails that
has batched up during the last 3 weeks.
jim> jim> I think that I could steal a lot of common syntax from this for a
jim> new MySQL parser. There are 1100 regression tests culled from the
jim> T-SQL language spec and user examples; on my Linux system the parse
jim> time, including building and walking the AST is:
jim> jim>
jim> jim> jimi(50_64)-clean: wc -l *.sql
jim> jim> ...
jim> jim> 12923 total
jim> jim>
jim> jim> jimi(50_64)-clean: time tsqlc . >out
jim> jim> 0.15user 0.19system 0:00.34elapsed 100%CPU (0avgtext+0avgdata
jim> 0maxresident)k
jim> jim> 0inputs+232outputs (0major+102772minor)pagefaults 0swaps
jim>
jim> jim> Which includes the time taken to read each of the 1100 files from
jim> the file system and to print a message for each saying the parse was
jim> successful of course.
jim> jim> Anyway, if you want to take a look at the code, just let me know :-)
jim>
jim> Monty> The big question is how much work it would be to
jim> replace the MySQLparser with your T-SQL parser.
jim> Indeed. Obviously syntactical changes are just slog really and
jim> most of that is ensuring that there is enough coverage in regression
jim> tests to exercise all the syntactic differences between T-SQL and
jim> MySql, or rather, all the syntax of MySQL. A lot of commonality but
jim> still a fair bit of work. What is the definitive language reference
jim> for MySQL Marina? I can locate reference manuals and ANSI specs of
jim> course, but if you have one particular document in mind, then it would
jim> be useful to work off that so I can evaluate the syntactical changes I
jim> would need to make.
Unfortunately there is no other spec than the sql_yacc.yy file that
comes with the MySQL source code.
jim>
jim> I would like to do this in two steps:
jim>
jim> a) Replace the mysql_yacc.yy file, with as few changes as possible in
jim> the rest of the MySQL source.
jim>
jim>
jim> ANTLR is essentially the same gestalt as bison: one or more source files define the grammar and contain actions in C, triggered at the parse points; These grammar definition files are converted into C source by invoking an external program (in the case of ANTLR it is a Java program) and the resulting .c/.h files are compiled with the rest of the code.
jim>
jim> I wrote the C output to be machine independent. The idea being that you can generate the .c files on one machine, check that source code in and use it on any other machine without re-generating. This can be useful when targeting systems without Java machines (or ones that don't work very well). So, like many other systems you can have a 'build completely from scratch' option and a 'use pre-generated files option'.
jim>
jim> In the main then, I suspect that the bigger changes to the MySQL base would be build changes. I say this based upon the assumption that any new parser should build the same AST for a query as the yacc based version does. This means the new parser makes the same calls as the old one and thus the code external to the parser would probably require little, if anything in the way of change (but see b below).
That sounds very good.
jim> b) Optimze MySQL to be even faster, with the new parser at a base.
jim>
jim> Obviously there are two aspects, being the speed of the parser itself, which I don't think will be an issue, and then what kind of transformations are done on the resulting AST for optimization purposes. If we use exactly the same AST as MySQL does now, then improving MySQL performance is the same problem domain as it is now. However, perhaps there is opportunity for a new parser to provide more information about the query that would aid optimization. Possibilities here include modifications to the AST, external information structures that current code can use when walking the AST, or even a completely new AST. The latter would probably have quite an effect on the front end of the parse->AST->execution phase of course, so I would think that the first step is to try to achieve your step a with the existing AST as output.
Agree.
jim> Of course maintaining and changing an ANTLR based grammar is somewhat easier than changing bison/yacc, if for no other reason than ANTLR doesn't need much in the way of code assists for correct parsing, whereas Bison quite often does.
jim> The a) option is quite important to be able to do easy merges with the
jim> main MySQL tree.
jim>
jim> I have time this week to take a look at this. Mechanically I know it is easy enough, but I need to look at the calls that are made from the current yacc/bison parser and see if there is anything in there that would be awkward. The only things I could think of would be if the existing code relies on internal structures of bison rather than more generic structures. That should be easy to define.
The MySQL code doesn't rely on bison structures at all (as far as I know).
Did you get time to do the analyse?
jim>
jim> A few other things that may be of note:
jim>
jim> 1) The ANTLR generated code is free threading so long as any action code that you place withing the parser is also free threading.
In other words, same as with bison
jim> 2) The only system calls it uses is {m|c|re}alloc/free, which the C runtime component can re-direct (say to the MySQL overrides). For completely free threading, those calls also need to be free threading and so they are the only limit to threading of course.
Sounds perfect.
I would *really* like to see a new parser for MariaDB. Anything that
we can do to help get this done ?
Regards,
Monty
2
1
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2698)
by knielsenīŧ knielsen-hq.org 06 May '09
by knielsenīŧ knielsen-hq.org 06 May '09
06 May '09
#At lp:maria
2698 knielsen(a)knielsen-hq.org 2009-05-06
We are now using Valgrind rather than purify, and have for quite some time.
Consequently, rename HAVE_purify to HAVE_valgrind, and related changes.
Leave some comments about purify when not clear that they apply also to Valgrind.
Fix redundant IF_VALGRIND declaration.
Misc. small fixes:
- Fixes for pool-of-threads patch.
- Fixes for push of PBXT storage engine.
- mysql-test-run.pl fix.
- Fix build problem in compile-pentium64-max.
modified:
BUILD/SETUP.sh
BUILD/build_mccge.sh
BUILD/compile-dist
BUILD/compile-pentium64-max
BUILD/compile-solaris-sparc-purify
include/m_string.h
include/my_global.h
mysql-test/Makefile.am
mysql-test/lib/mtr_unique.pm
mysql-test/t/pool_of_threads.cnf
mysys/mf_qsort.c
mysys/my_alloc.c
mysys/my_init.c
mysys/my_rnd.c
mysys/safemalloc.c
scripts/mysql_config.pl.in
scripts/mysql_config.sh
sql/field_conv.cc
sql/filesort.cc
sql/ha_partition.cc
sql/hostname.cc
sql/item_timefunc.cc
sql/log_event.cc
sql/log_event_old.cc
sql/my_decimal.h
sql/mysqld.cc
sql/opt_range.cc
sql/opt_range.h
sql/records.cc
sql/rpl_rli.cc
sql/rpl_rli.h
sql/set_var.cc
sql/slave.cc
sql/sql_base.cc
sql/sql_binlog.cc
sql/sql_class.cc
sql/sql_list.h
sql/sql_load.cc
sql/sql_select.cc
sql/table.cc
storage/archive/azio.c
storage/innobase/buf/buf0buf.c
storage/innobase/include/univ.i
storage/innobase/srv/srv0start.c
storage/maria/ha_maria.cc
storage/maria/ma_blockrec.c
storage/maria/ma_check.c
storage/maria/ma_loghandler.c
storage/maria/ma_packrec.c
storage/maria/ma_page.c
storage/maria/ma_pagecrc.c
storage/maria/ma_search.c
storage/myisam/mi_check.c
storage/myisam/mi_page.c
storage/myisam/mi_search.c
storage/myisammrg/ha_myisammrg.cc
strings/bcmp.c
strings/decimal.c
strings/strmake.c
per-file messages:
BUILD/SETUP.sh
Rename purify -> valgrind.
BUILD/build_mccge.sh
Rename purify -> valgrind.
BUILD/compile-dist
Fix that PBXT was missing in source tarball after `BUILD/compile-dist && make dist`
BUILD/compile-pentium64-max
Fix a build problem with BUILD/compile-pentium64-max on CentOS/Fedora Core 10 amd64.
On these systems, there is libz.so but no libz.a. Finding libz.so, ./configure decides
to use system zlib. But since BUILD/compile-pentium64-max builds a fully static binary
with -all-static, the link of mysqld fails due to missing libz.a.
Fix by using bundled zlib in the build script.
BUILD/compile-solaris-sparc-purify
Rename purify -> valgrind.
include/m_string.h
Rename purify -> valgrind.
include/my_global.h
Rename purify -> valgrind.
mysql-test/Makefile.am
Fix that PBXT test suite was missing from `make dist` source tarball.
mysql-test/lib/mtr_unique.pm
Better fix to avoid races when chmod'ing the semaphore file.
(Though using chmod 666 shared files in /tmp/ is still not a very good solution).
mysql-test/t/pool_of_threads.cnf
Fix that test case pool_of_threads fails if run on mysqld with no --with-libevent support.
mysys/mf_qsort.c
Rename purify -> valgrind.
mysys/my_alloc.c
Rename purify -> valgrind.
mysys/my_init.c
Rename purify -> valgrind.
mysys/my_rnd.c
Rename purify -> valgrind.
mysys/safemalloc.c
Rename purify -> valgrind.
scripts/mysql_config.pl.in
Rename purify -> valgrind.
scripts/mysql_config.sh
Rename purify -> valgrind.
sql/field_conv.cc
Rename purify -> valgrind.
sql/filesort.cc
Rename purify -> valgrind.
sql/ha_partition.cc
Rename purify -> valgrind.
sql/hostname.cc
Rename purify -> valgrind.
sql/item_timefunc.cc
Rename purify -> valgrind.
sql/log_event.cc
Rename purify -> valgrind.
sql/log_event_old.cc
Rename purify -> valgrind.
sql/my_decimal.h
Rename purify -> valgrind.
sql/mysqld.cc
Rename purify -> valgrind.
Fix redundant IF_VALGRIND declaration.
sql/opt_range.cc
Rename purify -> valgrind.
sql/opt_range.h
Rename purify -> valgrind.
sql/records.cc
Rename purify -> valgrind.
sql/rpl_rli.cc
Rename purify -> valgrind.
sql/rpl_rli.h
Rename purify -> valgrind.
sql/set_var.cc
Fix missing static declaration on pool_of_threads.
sql/slave.cc
Rename purify -> valgrind.
sql/sql_base.cc
Rename purify -> valgrind.
sql/sql_binlog.cc
Rename purify -> valgrind.
sql/sql_class.cc
Rename purify -> valgrind.
sql/sql_list.h
Rename purify -> valgrind.
sql/sql_load.cc
Rename purify -> valgrind.
sql/sql_select.cc
Rename purify -> valgrind.
sql/table.cc
Rename purify -> valgrind.
storage/archive/azio.c
Rename purify -> valgrind.
storage/innobase/buf/buf0buf.c
Rename purify -> valgrind.
storage/innobase/include/univ.i
Rename purify -> valgrind.
storage/innobase/srv/srv0start.c
Rename purify -> valgrind.
storage/maria/ha_maria.cc
Rename purify -> valgrind.
storage/maria/ma_blockrec.c
Rename purify -> valgrind.
storage/maria/ma_check.c
Rename purify -> valgrind.
storage/maria/ma_loghandler.c
Rename purify -> valgrind.
storage/maria/ma_packrec.c
Rename purify -> valgrind.
storage/maria/ma_page.c
Rename purify -> valgrind.
storage/maria/ma_pagecrc.c
Rename purify -> valgrind.
storage/maria/ma_search.c
Rename purify -> valgrind.
storage/myisam/mi_check.c
Rename purify -> valgrind.
storage/myisam/mi_page.c
Rename purify -> valgrind.
storage/myisam/mi_search.c
Rename purify -> valgrind.
storage/myisammrg/ha_myisammrg.cc
Rename purify -> valgrind.
strings/bcmp.c
Rename purify -> valgrind.
strings/decimal.c
Rename purify -> valgrind.
strings/strmake.c
Rename purify -> valgrind.
=== modified file 'BUILD/SETUP.sh'
--- a/BUILD/SETUP.sh 2009-03-22 12:16:09 +0000
+++ b/BUILD/SETUP.sh 2009-05-06 12:03:24 +0000
@@ -119,7 +119,7 @@ fi
# Set flags for various build configurations.
# Used in -valgrind builds
-valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify "
+valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_valgrind "
valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
#
# Used in -debug builds
=== modified file 'BUILD/build_mccge.sh'
--- a/BUILD/build_mccge.sh 2008-02-07 23:12:34 +0000
+++ b/BUILD/build_mccge.sh 2009-05-06 12:03:24 +0000
@@ -938,7 +938,7 @@ set_up_ccache()
set_valgrind_flags()
{
if test "x$valgrind_flag" = "xyes" ; then
- loc_valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify "
+ loc_valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_valgrind "
loc_valgrind_flags="$loc_valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
compiler_flags="$compiler_flags $loc_valgrind_flags"
fi
=== modified file 'BUILD/compile-dist'
--- a/BUILD/compile-dist 2009-02-19 09:01:25 +0000
+++ b/BUILD/compile-dist 2009-05-06 12:03:24 +0000
@@ -60,8 +60,6 @@ fi
# Make sure to enable all features that affect "make dist"
# Remember that configure restricts the man pages to the configured features !
./configure \
- --with-maria-storage-engine \
- --with-embedded-server \
- --with-ndbcluster
-$gmake
-
+ --with-plugins=max-no-ndb \
+ --with-embedded-server
+$gmake -j4
=== modified file 'BUILD/compile-pentium64-max'
--- a/BUILD/compile-pentium64-max 2007-04-11 12:12:00 +0000
+++ b/BUILD/compile-pentium64-max 2009-05-06 12:03:24 +0000
@@ -4,7 +4,10 @@ path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium64_cflags $fast_cflags"
-extra_configs="$pentium_configs $max_configs $static_link"
+# On CentOS/Fedora Core 10 amd64, there is system libz.so but not
+# libz.a, so need to use bundled zlib when building static
+# binary. Hence we use --with-zlib-dir=bundled
+extra_configs="$pentium_configs $max_configs $static_link --with-zlib-dir=bundled"
CC="$CC --pipe"
strip=yes
=== modified file 'BUILD/compile-solaris-sparc-purify'
--- a/BUILD/compile-solaris-sparc-purify 2007-02-26 15:12:40 +0000
+++ b/BUILD/compile-solaris-sparc-purify 2009-05-06 12:03:24 +0000
@@ -37,7 +37,7 @@ make -k maintainer-clean || true
path=`dirname $0`
. "$path/autorun.sh"
-CFLAGS="-g -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings -Wunused -DHAVE_purify -DEXTRA_DEBUG -O2" CXX=gcc CXXLD=g++ CXXFLAGS="-g -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti -DHAVE_purify -DEXTRA_DEBUG -O2" ./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-embedded-server --with-innodb $EXTRA_CONFIG_FLAGS
+CFLAGS="-g -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings -Wunused -DHAVE_valgrind -DEXTRA_DEBUG -O2" CXX=gcc CXXLD=g++ CXXFLAGS="-g -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti -DHAVE_valgrind -DEXTRA_DEBUG -O2" ./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-embedded-server --with-innodb $EXTRA_CONFIG_FLAGS
make -j 4
=== modified file 'include/m_string.h'
--- a/include/m_string.h 2008-06-26 15:10:11 +0000
+++ b/include/m_string.h 2009-05-06 12:03:24 +0000
@@ -108,7 +108,7 @@ extern const double log_10[309];
#define memcpy_fixed(A,B,C) memcpy((A),(B),(C))
#endif
-#if (!defined(USE_BMOVE512) || defined(HAVE_purify)) && !defined(bmove512)
+#if (!defined(USE_BMOVE512) || defined(HAVE_valgrind)) && !defined(bmove512)
#define bmove512(A,B,C) memcpy(A,B,C)
#endif
@@ -125,14 +125,14 @@ extern void bzero(uchar * dst,size_t len
#if !defined(bcmp) && !defined(HAVE_BCMP)
extern size_t bcmp(const uchar *s1,const uchar *s2,size_t len);
#endif
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
extern size_t my_bcmp(const uchar *s1,const uchar *s2,size_t len);
#undef bcmp
#define bcmp(A,B,C) my_bcmp((A),(B),(C))
-#define bzero_if_purify(A,B) bzero(A,B)
+#define bzero_if_valgrind(A,B) bzero(A,B)
#else
-#define bzero_if_purify(A,B)
-#endif /* HAVE_purify */
+#define bzero_if_valgrind(A,B)
+#endif /* HAVE_valgrind */
#if defined(_lint) || defined(FORCE_INIT_OF_VARS)
#define LINT_INIT_STRUCT(var) bzero(&var, sizeof(var)) /* No uninitialize-warning */
=== modified file 'include/my_global.h'
--- a/include/my_global.h 2009-04-08 16:55:26 +0000
+++ b/include/my_global.h 2009-05-06 12:03:24 +0000
@@ -563,16 +563,16 @@ int __void__;
#define LINT_INIT(var)
#endif
-#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(HAVE_purify)
-#define PURIFY_OR_LINT_INIT(var) var=0
+#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(HAVE_valgrind)
+#define VALGRIND_OR_LINT_INIT(var) var=0
#else
-#define PURIFY_OR_LINT_INIT(var)
+#define VALGRIND_OR_LINT_INIT(var)
#endif
-#ifdef HAVE_purify
-#define IF_PURIFY(A,B) (A)
+#ifdef HAVE_valgrind
+#define IF_VALGRIND(A,B) (A)
#else
-#define IF_PURIFY(A,B) (B)
+#define IF_VALGRIND(A,B) (B)
#endif
#if !defined(HAVE_UINT)
@@ -1174,7 +1174,7 @@ typedef char bool; /* Ordinary boolean
((uint32) (uchar) (A)[0])))
#define sint4korr(A) (*((const long *) (A)))
#define uint2korr(A) (*((const uint16 *) (A)))
-#if defined(HAVE_purify) && !defined(_WIN32)
+#if defined(HAVE_valgrind) && !defined(_WIN32)
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
(((uint32) ((uchar) (A)[1])) << 8) +\
(((uint32) ((uchar) (A)[2])) << 16))
@@ -1186,7 +1186,7 @@ typedef char bool; /* Ordinary boolean
It means, that you have to provide enough allocated space !
*/
#define uint3korr(A) (long) (*((const unsigned int *) (A)) & 0xFFFFFF)
-#endif /* HAVE_purify && !_WIN32 */
+#endif /* HAVE_valgrind && !_WIN32 */
#define uint4korr(A) (*((const uint32 *) (A)))
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
(((uint32) ((uchar) (A)[1])) << 8) +\
=== modified file 'mysql-test/Makefile.am'
--- a/mysql-test/Makefile.am 2009-02-13 12:25:41 +0000
+++ b/mysql-test/Makefile.am 2009-05-06 12:03:24 +0000
@@ -98,7 +98,8 @@ TEST_DIRS = t r include std_data std_dat
suite/stress/include suite/stress/t suite/stress/r \
suite/ndb suite/ndb/t suite/ndb/r \
suite/rpl_ndb suite/rpl_ndb/t suite/rpl_ndb/r \
- suite/parts suite/parts/t suite/parts/r suite/parts/inc
+ suite/parts suite/parts/t suite/parts/r suite/parts/inc \
+ suite/pbxt/t suite/pbxt/r
# Used by dist-hook and install-data-local to copy all
# test files into either dist or install directory
=== modified file 'mysql-test/lib/mtr_unique.pm'
--- a/mysql-test/lib/mtr_unique.pm 2009-04-08 16:55:26 +0000
+++ b/mysql-test/lib/mtr_unique.pm 2009-05-06 12:03:24 +0000
@@ -62,14 +62,14 @@ sub mtr_get_unique_id($$) {
die 'lock file is a symbolic link';
}
+ my $save_umask= umask(0);
open SEM, ">", "$file.sem" or die "can't write to $file.sem";
- chmod 0777, "$file.sem";
flock SEM, LOCK_EX or die "can't lock $file.sem";
if(! -e $file) {
open FILE, ">", $file or die "can't create $file";
close FILE;
}
- chmod 0777, $file;
+ umask($save_umask);
msg("HAVE THE LOCK");
@@ -135,8 +135,8 @@ sub mtr_release_unique_id($) {
die 'lock file is a symbolic link';
}
+ my $save_umask= umask(0);
open SEM, ">", "$file.sem" or die "can't write to $file.sem";
- chmod 0777, "$file.sem";
flock SEM, LOCK_EX or die "can't lock $file.sem";
msg("HAVE THE LOCK");
@@ -149,7 +149,7 @@ sub mtr_release_unique_id($) {
open FILE, ">", $file or die "can't create $file";
close FILE;
}
- chmod 0777, "$file.sem";
+ umask($save_umask);
open FILE, "+<", $file or die "can't open $file";
#select undef,undef,undef,0.2;
seek FILE, 0, 0;
=== modified file 'mysql-test/t/pool_of_threads.cnf'
--- a/mysql-test/t/pool_of_threads.cnf 2009-03-18 15:46:32 +0000
+++ b/mysql-test/t/pool_of_threads.cnf 2009-05-06 12:03:24 +0000
@@ -2,8 +2,8 @@
[mysqld.1]
test-ignore-wrong-options
-thread-handling= pool-of-threads
-thread_pool_size= 2
+loose-thread-handling= pool-of-threads
+loose-thread_pool_size= 2
extra-port= @mysqld.1.#extra-port
extra-max-connections=1
=== modified file 'mysys/mf_qsort.c'
--- a/mysys/mf_qsort.c 2007-10-17 16:08:58 +0000
+++ b/mysys/mf_qsort.c 2009-05-06 12:03:24 +0000
@@ -108,7 +108,7 @@ qsort_t my_qsort(void *base_ptr, size_t
low = (char*) base_ptr;
high = low+ size * (count - 1);
stack_ptr = stack + 1;
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
/* The first element in the stack will be accessed for the last POP */
stack[0].low=stack[0].high=0;
#endif
=== modified file 'mysys/my_alloc.c'
--- a/mysys/my_alloc.c 2009-01-15 18:11:25 +0000
+++ b/mysys/my_alloc.c 2009-05-06 12:03:24 +0000
@@ -56,7 +56,7 @@ void init_alloc_root(MEM_ROOT *mem_root,
mem_root->block_num= 4; /* We shift this with >>2 */
mem_root->first_block_usage= 0;
-#if !(defined(HAVE_purify) && defined(EXTRA_DEBUG))
+#if !(defined(HAVE_valgrind) && defined(EXTRA_DEBUG))
if (pre_alloc_size)
{
if ((mem_root->free= mem_root->pre_alloc=
@@ -96,7 +96,7 @@ void reset_root_defaults(MEM_ROOT *mem_r
DBUG_ASSERT(alloc_root_inited(mem_root));
mem_root->block_size= block_size - ALLOC_ROOT_MIN_BLOCK_SIZE;
-#if !(defined(HAVE_purify) && defined(EXTRA_DEBUG))
+#if !(defined(HAVE_valgrind) && defined(EXTRA_DEBUG))
if (pre_alloc_size)
{
size_t size= pre_alloc_size + ALIGN_SIZE(sizeof(USED_MEM));
@@ -147,7 +147,7 @@ void reset_root_defaults(MEM_ROOT *mem_r
void *alloc_root(MEM_ROOT *mem_root, size_t length)
{
-#if defined(HAVE_purify) && defined(EXTRA_DEBUG)
+#if defined(HAVE_valgrind) && defined(EXTRA_DEBUG)
reg1 USED_MEM *next;
DBUG_ENTER("alloc_root");
DBUG_PRINT("enter",("root: 0x%lx", (long) mem_root));
=== modified file 'mysys/my_init.c'
--- a/mysys/my_init.c 2009-02-19 09:01:25 +0000
+++ b/mysys/my_init.c 2009-05-06 12:03:24 +0000
@@ -170,7 +170,7 @@ void my_end(int infoflag)
{
#ifdef HAVE_GETRUSAGE
struct rusage rus;
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
/* Purify assumes that rus is uninitialized after getrusage call */
bzero((char*) &rus, sizeof(rus));
#endif
=== modified file 'mysys/my_rnd.c'
--- a/mysys/my_rnd.c 2007-12-14 08:47:00 +0000
+++ b/mysys/my_rnd.c 2009-05-06 12:03:24 +0000
@@ -26,7 +26,7 @@
void my_rnd_init(struct my_rnd_struct *rand_st, ulong seed1, ulong seed2)
{
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
bzero((char*) rand_st,sizeof(*rand_st)); /* Avoid UMC varnings */
#endif
rand_st->max_value= 0x3FFFFFFFL;
=== modified file 'mysys/safemalloc.c'
--- a/mysys/safemalloc.c 2008-10-10 15:28:41 +0000
+++ b/mysys/safemalloc.c 2009-05-06 12:03:24 +0000
@@ -304,7 +304,7 @@ void _myfree(void *ptr, const char *file
sf_malloc_count--;
pthread_mutex_unlock(&THR_LOCK_malloc);
-#ifndef HAVE_purify
+#ifndef HAVE_valgrind
/* Mark this data as free'ed */
if (!sf_malloc_quick)
bfill(ptr, irem->datasize, (pchar) FREE_VAL);
=== modified file 'scripts/mysql_config.pl.in'
--- a/scripts/mysql_config.pl.in 2008-11-10 21:12:15 +0000
+++ b/scripts/mysql_config.pl.in 2009-05-06 12:03:24 +0000
@@ -44,7 +44,7 @@ use strict;
my @exclude_cflags =
qw/DDBUG_OFF DSAFEMALLOC USAFEMALLOC DSAFE_MUTEX
DPEDANTIC_SAFEMALLOC DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS
- DEXTRA_DEBUG DHAVE_purify O O[0-9] xO[0-9] W[-A-Za-z]*
+ DEXTRA_DEBUG DHAVE_valgrind O O[0-9] xO[0-9] W[-A-Za-z]*
Xa xstrconst xc99=none
unroll2 ip mp restrict/;
=== modified file 'scripts/mysql_config.sh'
--- a/scripts/mysql_config.sh 2008-11-10 21:12:15 +0000
+++ b/scripts/mysql_config.sh 2009-05-06 12:03:24 +0000
@@ -129,7 +129,7 @@ include="-I$pkgincludedir"
# to make --cflags usable for HP C++ (aCC)
for remove in DDBUG_OFF DSAFEMALLOC USAFEMALLOC DSAFE_MUTEX \
DPEDANTIC_SAFEMALLOC DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS \
- DEXTRA_DEBUG DHAVE_purify O 'O[0-9]' 'xO[0-9]' 'W[-A-Za-z]*' \
+ DEXTRA_DEBUG DHAVE_valgrind O 'O[0-9]' 'xO[0-9]' 'W[-A-Za-z]*' \
'mtune=[-A-Za-z0-9]*' 'mcpu=[-A-Za-z0-9]*' 'march=[-A-Za-z0-9]*' \
Xa xstrconst "xc99=none" AC99 \
unroll2 ip mp restrict
=== modified file 'sql/field_conv.cc'
--- a/sql/field_conv.cc 2009-01-31 21:22:44 +0000
+++ b/sql/field_conv.cc 2009-05-06 12:03:24 +0000
@@ -773,7 +773,7 @@ int field_conv(Field *to,Field *from)
((Field_varstring*)from)->length_bytes ==
((Field_varstring*)to)->length_bytes))
{ // Identical fields
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
/* This may happen if one does 'UPDATE ... SET x=x' */
if (to->ptr != from->ptr)
#endif
=== modified file 'sql/filesort.cc'
--- a/sql/filesort.cc 2009-02-19 09:01:25 +0000
+++ b/sql/filesort.cc 2009-05-06 12:03:24 +0000
@@ -953,13 +953,13 @@ static void make_sortkey(register SORTPA
if (addonf->null_bit && field->is_null())
{
nulls[addonf->null_offset]|= addonf->null_bit;
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
bzero(to, addonf->length);
#endif
}
else
{
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
uchar *end= field->pack(to, field->ptr);
uint length= (uint) ((to + addonf->length) - end);
DBUG_ASSERT((int) length >= 0);
=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc 2009-02-19 09:01:25 +0000
+++ b/sql/ha_partition.cc 2009-05-06 12:03:24 +0000
@@ -3548,10 +3548,10 @@ void ha_partition::position(const uchar
(ref_length - PARTITION_BYTES_IN_POS));
#ifdef SUPPORTING_PARTITION_OVER_DIFFERENT_ENGINES
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
bzero(ref + PARTITION_BYTES_IN_POS + ref_length,
max_ref_length-ref_length);
-#endif /* HAVE_purify */
+#endif /* HAVE_valgrind */
#endif
DBUG_VOID_RETURN;
}
=== modified file 'sql/hostname.cc'
--- a/sql/hostname.cc 2007-10-11 17:29:09 +0000
+++ b/sql/hostname.cc 2009-05-06 12:03:24 +0000
@@ -175,7 +175,7 @@ char * ip_to_hostname(struct in_addr *in
char buff[GETHOSTBYADDR_BUFF_SIZE],buff2[GETHOSTBYNAME_BUFF_SIZE];
int tmp_errno;
struct hostent tmp_hostent, tmp_hostent2;
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
bzero(buff,sizeof(buff)); // Bug in purify
#endif
if (!(hp=gethostbyaddr_r((char*) in,sizeof(*in),
=== modified file 'sql/item_timefunc.cc'
--- a/sql/item_timefunc.cc 2009-02-15 10:58:34 +0000
+++ b/sql/item_timefunc.cc 2009-05-06 12:03:24 +0000
@@ -290,8 +290,8 @@ static bool extract_date_time(DATE_TIME_
LINT_INIT(strict_week_number);
/* Remove valgrind varnings when using gcc 3.3 and -O1 */
- PURIFY_OR_LINT_INIT(strict_week_number_year_type);
- PURIFY_OR_LINT_INIT(sunday_first_n_first_week_non_iso);
+ VALGRIND_OR_LINT_INIT(strict_week_number_year_type);
+ VALGRIND_OR_LINT_INIT(sunday_first_n_first_week_non_iso);
if (!sub_pattern_end)
bzero((char*) l_time, sizeof(*l_time));
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2009-02-19 09:01:25 +0000
+++ b/sql/log_event.cc 2009-05-06 12:03:24 +0000
@@ -6990,7 +6990,7 @@ int Rows_log_event::do_add_row_data(ucha
Don't print debug messages when running valgrind since they can
trigger false warnings.
*/
-#ifndef HAVE_purify
+#ifndef HAVE_valgrind
DBUG_DUMP("row_data", row_data, min(length, 32));
#endif
@@ -7771,7 +7771,7 @@ Table_map_log_event::Table_map_log_event
Don't print debug messages when running valgrind since they can
trigger false warnings.
*/
-#ifndef HAVE_purify
+#ifndef HAVE_valgrind
DBUG_DUMP("event buffer", (uchar*) buf, event_len);
#endif
@@ -8674,7 +8674,7 @@ int Rows_log_event::find_row(const Relay
Don't print debug messages when running valgrind since they can
trigger false warnings.
*/
-#ifndef HAVE_purify
+#ifndef HAVE_valgrind
DBUG_DUMP("key data", m_key, table->key_info->key_length);
#endif
@@ -8704,7 +8704,7 @@ int Rows_log_event::find_row(const Relay
Don't print debug messages when running valgrind since they can
trigger false warnings.
*/
-#ifndef HAVE_purify
+#ifndef HAVE_valgrind
DBUG_PRINT("info",("found first matching record"));
DBUG_DUMP("record[0]", table->record[0], table->s->reclength);
#endif
@@ -9067,7 +9067,7 @@ Update_rows_log_event::do_exec_row(const
Now we have the right row to update. The old row (the one we're
looking for) is in record[1] and the new row is in record[0].
*/
-#ifndef HAVE_purify
+#ifndef HAVE_valgrind
/*
Don't print debug messages when running valgrind since they can
trigger false warnings.
=== modified file 'sql/log_event_old.cc'
--- a/sql/log_event_old.cc 2009-01-31 21:22:44 +0000
+++ b/sql/log_event_old.cc 2009-05-06 12:03:24 +0000
@@ -724,7 +724,7 @@ static int find_and_fetch_row(TABLE *tab
Don't print debug messages when running valgrind since they can
trigger false warnings.
*/
-#ifndef HAVE_purify
+#ifndef HAVE_valgrind
DBUG_DUMP("table->record[0]", table->record[0], table->s->reclength);
DBUG_DUMP("table->record[1]", table->record[1], table->s->reclength);
#endif
@@ -750,7 +750,7 @@ static int find_and_fetch_row(TABLE *tab
Don't print debug messages when running valgrind since they can
trigger false warnings.
*/
-#ifndef HAVE_purify
+#ifndef HAVE_valgrind
DBUG_DUMP("table->record[0]", table->record[0], table->s->reclength);
DBUG_DUMP("table->record[1]", table->record[1], table->s->reclength);
#endif
@@ -1404,7 +1404,7 @@ int Old_rows_log_event::do_add_row_data(
Don't print debug messages when running valgrind since they can
trigger false warnings.
*/
-#ifndef HAVE_purify
+#ifndef HAVE_valgrind
DBUG_DUMP("row_data", row_data, min(length, 32));
#endif
@@ -2353,7 +2353,7 @@ int Old_rows_log_event::find_row(const R
Don't print debug messages when running valgrind since they can
trigger false warnings.
*/
-#ifndef HAVE_purify
+#ifndef HAVE_valgrind
DBUG_DUMP("key data", m_key, table->key_info->key_length);
#endif
@@ -2383,7 +2383,7 @@ int Old_rows_log_event::find_row(const R
Don't print debug messages when running valgrind since they can
trigger false warnings.
*/
-#ifndef HAVE_purify
+#ifndef HAVE_valgrind
DBUG_PRINT("info",("found first matching record"));
DBUG_DUMP("record[0]", table->record[0], table->s->reclength);
#endif
@@ -2878,7 +2878,7 @@ Update_rows_log_event_old::do_exec_row(c
Now we have the right row to update. The old row (the one we're
looking for) is in record[1] and the new row is in record[0].
*/
-#ifndef HAVE_purify
+#ifndef HAVE_valgrind
/*
Don't print debug messages when running valgrind since they can
trigger false warnings.
=== modified file 'sql/my_decimal.h'
--- a/sql/my_decimal.h 2008-05-20 07:38:17 +0000
+++ b/sql/my_decimal.h 2009-05-06 12:03:24 +0000
@@ -99,7 +99,7 @@ public:
{
len= DECIMAL_BUFF_LENGTH;
buf= buffer;
-#if !defined (HAVE_purify) && !defined(DBUG_OFF)
+#if !defined (HAVE_valgrind) && !defined(DBUG_OFF)
/* Set buffer to 'random' value to find wrong buffer usage */
for (uint i= 0; i < DECIMAL_BUFF_LENGTH; i++)
buffer[i]= i;
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2009-04-08 21:16:10 +0000
+++ b/sql/mysqld.cc 2009-05-06 12:03:24 +0000
@@ -57,12 +57,6 @@
#define mysqld_charset &my_charset_latin1
-#ifdef HAVE_purify
-#define IF_PURIFY(A,B) (A)
-#else
-#define IF_PURIFY(A,B) (B)
-#endif
-
#if SIZEOF_CHARP == 4
#define MAX_MEM_TABLE_SIZE ~(ulong) 0
#else
@@ -76,9 +70,9 @@
char pstack_file_name[80];
#endif /* __linux__ */
-/* We have HAVE_purify below as this speeds up the shutdown of MySQL */
+/* We have HAVE_valgrind below as this speeds up the shutdown of MySQL */
-#if defined(HAVE_DEC_3_2_THREADS) || defined(SIGNALS_DONT_BREAK_READ) || defined(HAVE_purify) && defined(__linux__)
+#if defined(HAVE_DEC_3_2_THREADS) || defined(SIGNALS_DONT_BREAK_READ) || defined(HAVE_valgrind) && defined(__linux__)
#define HAVE_CLOSE_SERVER_SOCK 1
#endif
@@ -6520,7 +6514,7 @@ log and this option does nothing anymore
purify. These are not suppressed: instead we disable symlinks
option if compiled with valgrind support.
*/
- IF_PURIFY(0,1), 0, 0, 0, 0, 0},
+ IF_VALGRIND(0,1), 0, 0, 0, 0, 0},
{"sysdate-is-now", OPT_SYSDATE_IS_NOW,
"Non-default option to alias SYSDATE() to NOW() to make it safe-replicable. Since 5.0, SYSDATE() returns a `dynamic' value different for different invocations, even within the same statement.",
(uchar**) &global_system_variables.sysdate_is_now,
@@ -6561,7 +6555,7 @@ log and this option does nothing anymore
0, 0, 0, 0, 0},
{"use-symbolic-links", 's', "Enable symbolic link support. Deprecated option; use --symbolic-links instead.",
(uchar**) &my_use_symdir, (uchar**) &my_use_symdir, 0, GET_BOOL, NO_ARG,
- IF_PURIFY(0,1), 0, 0, 0, 0, 0},
+ IF_VALGRIND(0,1), 0, 0, 0, 0, 0},
{"user", 'u', "Run mysqld daemon as user.", 0, 0, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Used with --help option for detailed help",
@@ -7661,7 +7655,7 @@ static int mysql_init_variables(void)
/* Things reset to zero */
opt_skip_slave_start= opt_reckless_slave = 0;
mysql_home[0]= pidfile_name[0]= log_error_file[0]= 0;
-#if defined(HAVE_REALPATH) && !defined(HAVE_purify) && !defined(HAVE_BROKEN_REALPATH)
+#if defined(HAVE_REALPATH) && !defined(HAVE_valgrind) && !defined(HAVE_BROKEN_REALPATH)
/* We can only test for sub paths if my_symlink.c is using realpath */
myisam_test_invalid_symlink= test_if_data_home_dir;
#endif
=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc 2009-02-19 09:01:25 +0000
+++ b/sql/opt_range.cc 2009-05-06 12:03:24 +0000
@@ -8347,7 +8347,7 @@ int QUICK_RANGE_SELECT::reset()
multi_range_buff->buffer= mrange_buff;
multi_range_buff->buffer_end= mrange_buff + mrange_bufsiz;
multi_range_buff->end_of_used_area= mrange_buff;
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
/*
We need this until ndb will use the buffer efficiently
(Now ndb stores complete row in here, instead of only the used fields
=== modified file 'sql/opt_range.h'
--- a/sql/opt_range.h 2008-08-25 17:18:22 +0000
+++ b/sql/opt_range.h 2009-05-06 12:03:24 +0000
@@ -44,7 +44,7 @@ class QUICK_RANGE :public Sql_alloc {
uint16 min_length,max_length,flag;
key_part_map min_keypart_map, // bitmap of used keyparts in min_key
max_keypart_map; // bitmap of used keyparts in max_key
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
uint16 dummy; /* Avoid warnings on 'flag' */
#endif
QUICK_RANGE(); /* Full range */
@@ -61,7 +61,7 @@ class QUICK_RANGE :public Sql_alloc {
min_keypart_map(min_keypart_map_arg),
max_keypart_map(max_keypart_map_arg)
{
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
dummy=0;
#endif
}
=== modified file 'sql/records.cc'
--- a/sql/records.cc 2008-07-17 18:26:55 +0000
+++ b/sql/records.cc 2009-05-06 12:03:24 +0000
@@ -520,7 +520,7 @@ static int init_rr_cache(THD *thd, READ_
info->struct_length+1,
MYF(0))))
DBUG_RETURN(1);
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
// Avoid warnings in qsort
bzero(info->cache,rec_cache_size+info->cache_records* info->struct_length+1);
#endif
=== modified file 'sql/rpl_rli.cc'
--- a/sql/rpl_rli.cc 2009-02-19 09:01:25 +0000
+++ b/sql/rpl_rli.cc 2009-05-06 12:03:24 +0000
@@ -34,7 +34,7 @@ Relay_log_info::Relay_log_info()
no_storage(FALSE), replicate_same_server_id(::replicate_same_server_id),
info_fd(-1), cur_log_fd(-1), save_temporary_tables(0),
cur_log_old_open_count(0), group_relay_log_pos(0), event_relay_log_pos(0),
-#if HAVE_purify
+#if HAVE_valgrind
is_fake(FALSE),
#endif
group_master_log_pos(0), log_space_total(0), ignore_log_space_limit(0),
=== modified file 'sql/rpl_rli.h'
--- a/sql/rpl_rli.h 2008-02-27 17:46:06 +0000
+++ b/sql/rpl_rli.h 2009-05-06 12:03:24 +0000
@@ -154,7 +154,7 @@ public:
ulonglong event_relay_log_pos;
ulonglong future_event_relay_log_pos;
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
bool is_fake; /* Mark that this is a fake relay log info structure */
#endif
=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc 2009-04-08 16:55:26 +0000
+++ b/sql/set_var.cc 2009-05-06 12:03:24 +0000
@@ -642,8 +642,8 @@ static sys_var_long_ptr sys_table_lock_w
static sys_var_long_ptr sys_thread_cache_size(&vars, "thread_cache_size",
&thread_cache_size);
#if HAVE_POOL_OF_THREADS == 1
-sys_var_long_ptr sys_thread_pool_size(&vars, "thread_pool_size",
- &thread_pool_size);
+static sys_var_long_ptr sys_thread_pool_size(&vars, "thread_pool_size",
+ &thread_pool_size);
#endif
static sys_var_thd_enum sys_tx_isolation(&vars, "tx_isolation",
&SV::tx_isolation,
=== modified file 'sql/slave.cc'
--- a/sql/slave.cc 2009-02-19 09:01:25 +0000
+++ b/sql/slave.cc 2009-05-06 12:03:24 +0000
@@ -2014,7 +2014,7 @@ int apply_event_and_update_pos(Log_event
if (exec_res == 0)
{
int error= ev->update_pos(rli);
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
if (!rli->is_fake)
#endif
{
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc 2009-02-19 09:01:25 +0000
+++ b/sql/sql_base.cc 2009-05-06 12:03:24 +0000
@@ -3000,7 +3000,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *
table->pos_in_table_list= table_list;
table_list->updatable= 1; // It is not derived table nor non-updatable VIEW
table->clear_column_bitmaps();
-#if !defined(DBUG_OFF) && !defined(HAVE_purify)
+#if !defined(DBUG_OFF) && !defined(HAVE_valgrind)
/*
Fill record with random values to find bugs where we access fields
without first reading them.
@@ -7363,7 +7363,7 @@ int setup_wild(THD *thd, TABLE_LIST *tab
/* make * substituting permanent */
SELECT_LEX *select_lex= thd->lex->current_select;
select_lex->with_wild= 0;
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
if (&select_lex->item_list != &fields) // Avoid warning
#endif
select_lex->item_list= fields;
=== modified file 'sql/sql_binlog.cc'
--- a/sql/sql_binlog.cc 2009-01-09 12:49:24 +0000
+++ b/sql/sql_binlog.cc 2009-05-06 12:03:24 +0000
@@ -59,7 +59,7 @@ void mysql_client_binlog_statement(THD*
if (!thd->rli_fake)
{
thd->rli_fake= new Relay_log_info;
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
thd->rli_fake->is_fake= TRUE;
#endif
have_fd_event= FALSE;
@@ -95,7 +95,7 @@ void mysql_client_binlog_statement(THD*
char const *endptr= 0;
int bytes_decoded= base64_decode(strptr, coded_len, buf, &endptr);
-#ifndef HAVE_purify
+#ifndef HAVE_valgrind
/*
This debug printout should not be used for valgrind builds
since it will read from unassigned memory.
@@ -188,7 +188,7 @@ void mysql_client_binlog_statement(THD*
bufptr += event_len;
DBUG_PRINT("info",("ev->get_type_code()=%d", ev->get_type_code()));
-#ifndef HAVE_purify
+#ifndef HAVE_valgrind
/*
This debug printout should not be used for valgrind builds
since it will read from unassigned memory.
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc 2009-03-12 22:27:35 +0000
+++ b/sql/sql_class.cc 2009-05-06 12:03:24 +0000
@@ -3480,7 +3480,7 @@ int THD::binlog_update_row(TABLE* table,
Don't print debug messages when running valgrind since they can
trigger false warnings.
*/
-#ifndef HAVE_purify
+#ifndef HAVE_valgrind
DBUG_DUMP("before_record", before_record, table->s->reclength);
DBUG_DUMP("after_record", after_record, table->s->reclength);
DBUG_DUMP("before_row", before_row, before_size);
=== modified file 'sql/sql_list.h'
--- a/sql/sql_list.h 2009-01-15 18:11:25 +0000
+++ b/sql/sql_list.h 2009-05-06 12:03:24 +0000
@@ -43,7 +43,7 @@ public:
static void operator delete[](void *ptr, MEM_ROOT *mem_root)
{ /* never called */ }
static void operator delete[](void *ptr, size_t size) { TRASH(ptr, size); }
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
bool dummy;
inline Sql_alloc() :dummy(0) {}
inline ~Sql_alloc() {}
=== modified file 'sql/sql_load.cc'
--- a/sql/sql_load.cc 2009-01-31 21:22:44 +0000
+++ b/sql/sql_load.cc 2009-05-06 12:03:24 +0000
@@ -581,7 +581,7 @@ read_fixed_length(THD *thd, COPY_INFO &i
}
it.rewind();
uchar *pos=read_info.row_start;
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
read_info.row_end[0]=0;
#endif
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2009-04-08 16:55:26 +0000
+++ b/sql/sql_select.cc 2009-05-06 12:03:24 +0000
@@ -1818,7 +1818,7 @@ JOIN::exec()
curr_join->having= curr_join->tmp_having= 0; // Allready done
/* Change sum_fields reference to calculated fields in tmp_table */
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
if (curr_join != this)
#endif
curr_join->all_fields= *curr_all_fields;
@@ -1840,7 +1840,7 @@ JOIN::exec()
fields_list.elements, all_fields))
DBUG_VOID_RETURN;
}
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
if (curr_join != this)
#endif
{
@@ -1994,7 +1994,7 @@ JOIN::exec()
tmp_fields_list2, tmp_all_fields2,
fields_list.elements, tmp_all_fields1))
DBUG_VOID_RETURN;
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
/*
Some GCCs use memcpy() for struct assignment, even for x=x.
GCC bug 19410: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19410
@@ -2059,7 +2059,7 @@ JOIN::exec()
tmp_table_param.save_copy_field= curr_join->tmp_table_param.copy_field;
tmp_table_param.save_copy_field_end=
curr_join->tmp_table_param.copy_field_end;
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
if (curr_join != this)
#endif
{
@@ -3848,7 +3848,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_AR
continue;
}
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
/* Valgrind complains about overlapped memcpy when save_pos==use. */
if (save_pos != use)
#endif
@@ -15138,7 +15138,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PA
DBUG_ASSERT (param->field_count > (uint) (copy - copy_start));
copy->set(tmp, item->result_field);
item->result_field->move_field(copy->to_ptr,copy->to_null_ptr,1);
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
copy->to_ptr[copy->from_length]= 0;
#endif
copy++;
=== modified file 'sql/table.cc'
--- a/sql/table.cc 2009-02-19 09:01:25 +0000
+++ b/sql/table.cc 2009-05-06 12:03:24 +0000
@@ -1694,7 +1694,7 @@ int open_table_from_share(THD *thd, TABL
outparam->record[1]= outparam->record[0]; // Safety
}
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
/*
We need this because when we read var-length rows, we are not updating
bytes after end of varchar
@@ -1916,7 +1916,7 @@ partititon_err:
}
}
-#if defined(HAVE_purify) && !defined(DBUG_OFF)
+#if defined(HAVE_valgrind) && !defined(DBUG_OFF)
bzero((char*) bitmaps, bitmap_size*3);
#endif
=== modified file 'storage/archive/azio.c'
--- a/storage/archive/azio.c 2009-04-08 16:55:26 +0000
+++ b/storage/archive/azio.c 2009-05-06 12:03:24 +0000
@@ -63,7 +63,7 @@ void read_header(azio_stream *s, unsigne
*/
static void *az_allocator(void *dummy, uInt items, uInt size)
{
- return my_malloc((size_t)items*(size_t)size, IF_PURIFY(MY_ZEROFILL, MYF(0)));
+ return my_malloc((size_t)items*(size_t)size, IF_VALGRIND(MY_ZEROFILL, MYF(0)));
}
static void az_free(void *dummy, void *address)
=== modified file 'storage/innobase/buf/buf0buf.c'
--- a/storage/innobase/buf/buf0buf.c 2008-08-20 00:37:41 +0000
+++ b/storage/innobase/buf/buf0buf.c 2009-05-06 12:03:24 +0000
@@ -756,7 +756,7 @@ buf_pool_init(
/* Wipe contents of frame to eliminate a Purify
warning */
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
memset(block->frame, '\0', UNIV_PAGE_SIZE);
#endif
if (srv_use_awe) {
=== modified file 'storage/innobase/include/univ.i'
--- a/storage/innobase/include/univ.i 2008-03-27 01:40:45 +0000
+++ b/storage/innobase/include/univ.i 2009-05-06 12:03:24 +0000
@@ -107,7 +107,7 @@ operations (very slow); also UNIV_DEBUG
#define UNIV_BTR_DEBUG /* check B-tree links */
#define UNIV_LIGHT_MEM_DEBUG /* light memory debugging */
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
/* The following sets all new allocated memory to zero before use:
this can be used to eliminate unnecessary Purify warnings, but note that
it also masks many bugs Purify could detect. For detailed Purify analysis it
=== modified file 'storage/innobase/srv/srv0start.c'
--- a/storage/innobase/srv/srv0start.c 2008-12-14 19:21:24 +0000
+++ b/storage/innobase/srv/srv0start.c 2009-05-06 12:03:24 +0000
@@ -104,7 +104,7 @@ static char* srv_monitor_file_name;
/* Avoid warnings when using purify */
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
static int inno_bcmp(register const char *s1, register const char *s2,
register uint len)
{
=== modified file 'storage/maria/ha_maria.cc'
--- a/storage/maria/ha_maria.cc 2009-02-19 09:01:25 +0000
+++ b/storage/maria/ha_maria.cc 2009-05-06 12:03:24 +0000
@@ -3166,7 +3166,7 @@ static int ha_maria_init(void *p)
ma_checkpoint_init(checkpoint_interval);
maria_multi_threaded= maria_in_ha_maria= TRUE;
-#if defined(HAVE_REALPATH) && !defined(HAVE_purify) && !defined(HAVE_BROKEN_REALPATH)
+#if defined(HAVE_REALPATH) && !defined(HAVE_valgrind) && !defined(HAVE_BROKEN_REALPATH)
/* We can only test for sub paths if my_symlink.c is using realpath */
maria_test_invalid_symlink= test_if_data_home_dir;
#endif
=== modified file 'storage/maria/ma_blockrec.c'
--- a/storage/maria/ma_blockrec.c 2009-04-08 08:47:30 +0000
+++ b/storage/maria/ma_blockrec.c 2009-05-06 12:03:24 +0000
@@ -1594,7 +1594,7 @@ static void make_empty_page(MARIA_HA *in
bzero(buff, PAGE_HEADER_SIZE);
-#if !defined(DONT_ZERO_PAGE_BLOCKS) || defined(HAVE_purify)
+#if !defined(DONT_ZERO_PAGE_BLOCKS) || defined(HAVE_valgrind)
/*
We zero the rest of the block to avoid getting old memory information
to disk and to allow the file to be compressed better if archived.
=== modified file 'storage/maria/ma_check.c'
--- a/storage/maria/ma_check.c 2009-02-19 09:01:25 +0000
+++ b/storage/maria/ma_check.c 2009-05-06 12:03:24 +0000
@@ -4522,7 +4522,7 @@ static int sort_key_read(MARIA_SORT_PARA
sort_param->current_filepos,
0);
sort_param->real_key_length= int_key.data_length + int_key.ref_length;
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
bzero(key+sort_param->real_key_length,
(sort_param->key_length-sort_param->real_key_length));
#endif
@@ -4567,7 +4567,7 @@ static int sort_maria_ft_key_read(MARIA_
sort_param->current_filepos);
sort_param->real_key_length= int_key.data_length + int_key.ref_length;
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
if (sort_param->key_length > sort_param->real_key_length)
bzero(key+sort_param->real_key_length,
(sort_param->key_length-sort_param->real_key_length));
@@ -5104,7 +5104,7 @@ static int sort_get_next_record(MARIA_SO
llstr(sort_param->pos,llbuff));
continue;
}
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
bzero(sort_param->rec_buff + block_info.rec_len,
share->base.extra_rec_buff_size);
#endif
=== modified file 'storage/maria/ma_loghandler.c'
--- a/storage/maria/ma_loghandler.c 2009-03-17 19:05:01 +0000
+++ b/storage/maria/ma_loghandler.c 2009-05-06 12:03:24 +0000
@@ -6194,12 +6194,12 @@ my_bool translog_write_record(LSN *lsn,
{
uint i;
uint len= 0;
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
ha_checksum checksum= 0;
#endif
for (i= TRANSLOG_INTERNAL_PARTS; i < part_no; i++)
{
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
/* Find unitialized bytes early */
checksum+= my_checksum(checksum, parts_data[i].str,
parts_data[i].length);
=== modified file 'storage/maria/ma_packrec.c'
--- a/storage/maria/ma_packrec.c 2009-01-09 04:23:25 +0000
+++ b/storage/maria/ma_packrec.c 2009-05-06 12:03:24 +0000
@@ -256,7 +256,7 @@ static my_bool _ma_read_pack_info(MARIA_
(uint) (share->pack.header_length-sizeof(header)),
MYF(MY_NABP)))
goto err2;
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
/* Zero bytes accessed by fill_buffer */
bzero(disk_cache + (share->pack.header_length-sizeof(header)),
share->base.extra_rec_buff_size);
=== modified file 'storage/maria/ma_page.c'
--- a/storage/maria/ma_page.c 2008-09-01 17:31:40 +0000
+++ b/storage/maria/ma_page.c 2009-05-06 12:03:24 +0000
@@ -200,7 +200,7 @@ my_bool _ma_write_keypage(MARIA_PAGE *pa
/* Verify that keynr is correct */
DBUG_ASSERT(_ma_get_keynr(share, buff) == page->keyinfo->key_nr);
-#if defined(EXTRA_DEBUG) && defined(HAVE_purify) && defined(NOT_ANYMORE)
+#if defined(EXTRA_DEBUG) && defined(HAVE_valgrind) && defined(NOT_ANYMORE)
{
/* This is here to catch uninitialized bytes */
uint length= page->size;
=== modified file 'storage/maria/ma_pagecrc.c'
--- a/storage/maria/ma_pagecrc.c 2008-03-04 11:58:21 +0000
+++ b/storage/maria/ma_pagecrc.c 2009-05-06 12:03:24 +0000
@@ -318,7 +318,7 @@ my_bool maria_page_filler_set_none(uchar
__attribute__((unused)),
uchar *data_ptr __attribute__((unused)))
{
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
int4store_aligned(page + ((MARIA_SHARE *)data_ptr)->block_size - CRC_SIZE,
0);
#endif
=== modified file 'storage/maria/ma_search.c'
--- a/storage/maria/ma_search.c 2009-01-12 11:12:00 +0000
+++ b/storage/maria/ma_search.c 2009-05-06 12:03:24 +0000
@@ -2172,7 +2172,7 @@ int _ma_calc_bin_pack_key_length(const M
s_temp->totlength= key_length= (int_key->data_length + int_key->ref_length+
nod_flag);
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
s_temp->n_length= s_temp->n_ref_length=0; /* For valgrind */
#endif
s_temp->key=key;
=== modified file 'storage/myisam/mi_check.c'
--- a/storage/myisam/mi_check.c 2009-02-19 09:01:25 +0000
+++ b/storage/myisam/mi_check.c 2009-05-06 12:03:24 +0000
@@ -3147,7 +3147,7 @@ static int sort_key_read(MI_SORT_PARAM *
(info->s->rec_reflength+
_mi_make_key(info, sort_param->key, (uchar*) key,
sort_param->record, sort_param->filepos));
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
bzero(key+sort_param->real_key_length,
(sort_param->key_length-sort_param->real_key_length));
#endif
@@ -3187,7 +3187,7 @@ static int sort_ft_key_read(MI_SORT_PARA
sort_param->real_key_length=(info->s->rec_reflength+
_ft_make_key(info, sort_param->key,
key, wptr++, sort_param->filepos));
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
if (sort_param->key_length > sort_param->real_key_length)
bzero(key+sort_param->real_key_length,
(sort_param->key_length-sort_param->real_key_length));
=== modified file 'storage/myisam/mi_page.c'
--- a/storage/myisam/mi_page.c 2008-08-28 12:43:44 +0000
+++ b/storage/myisam/mi_page.c 2009-05-06 12:03:24 +0000
@@ -86,7 +86,7 @@ int _mi_write_keypage(register MI_INFO *
if ((length=keyinfo->block_length) > IO_SIZE*2 &&
info->state->key_file_length != page+length)
length= ((mi_getint(buff)+IO_SIZE-1) & (uint) ~(IO_SIZE-1));
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
{
length=mi_getint(buff);
bzero((uchar*) buff+length,keyinfo->block_length-length);
=== modified file 'storage/myisam/mi_search.c'
--- a/storage/myisam/mi_search.c 2008-08-28 18:52:23 +0000
+++ b/storage/myisam/mi_search.c 2009-05-06 12:03:24 +0000
@@ -1749,7 +1749,7 @@ _mi_calc_bin_pack_key_length(MI_KEYDEF *
uint length,key_length,ref_length;
s_temp->totlength=key_length=_mi_keylength(keyinfo,key)+nod_flag;
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
s_temp->n_length= s_temp->n_ref_length=0; /* For valgrind */
#endif
s_temp->key=key;
=== modified file 'storage/myisammrg/ha_myisammrg.cc'
--- a/storage/myisammrg/ha_myisammrg.cc 2008-12-04 00:36:55 +0000
+++ b/storage/myisammrg/ha_myisammrg.cc 2009-05-06 12:03:24 +0000
@@ -837,7 +837,7 @@ int ha_myisammrg::info(uint flag)
{
if (table->s->key_parts && mrg_info.rec_per_key)
{
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
/*
valgrind may be unhappy about it, because optimizer may access values
between file->keys and table->key_parts, that will be uninitialized.
=== modified file 'strings/bcmp.c'
--- a/strings/bcmp.c 2007-05-10 09:59:39 +0000
+++ b/strings/bcmp.c 2009-05-06 12:03:24 +0000
@@ -24,7 +24,7 @@
#include <my_global.h>
#include "m_string.h"
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
#undef bcmp
#undef HAVE_BCMP
#endif
@@ -50,7 +50,7 @@ uint len; /* 0 <= len <= 65535 */
#else
-#ifndef HAVE_purify
+#ifndef HAVE_valgrind
size_t bcmp(register const uchar *s1,register const uchar *s2,
register size_t len)
#else
=== modified file 'strings/decimal.c'
--- a/strings/decimal.c 2008-08-15 19:49:43 +0000
+++ b/strings/decimal.c 2009-05-06 12:03:24 +0000
@@ -144,7 +144,7 @@ static double scaler1[]= {
1.0, 10.0, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9
};
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
#define sanity(d) DBUG_ASSERT((d)->len > 0)
#else
#define sanity(d) DBUG_ASSERT((d)->len >0 && ((d)->buf[0] | \
=== modified file 'strings/strmake.c'
--- a/strings/strmake.c 2008-04-28 16:24:05 +0000
+++ b/strings/strmake.c 2009-05-06 12:03:24 +0000
@@ -51,11 +51,11 @@ char *strmake(register char *dst, regist
*/
if (length)
{
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
dst[length-1]= 'Z';
#else
bfill(dst, length-1, (int) 'Z');
-#endif /* HAVE_purify */
+#endif /* HAVE_valgrind */
}
#endif /* EXTRA_DEBUG */
return dst-1;
1
0