Monday, November 2, 2009

libtool error in sysbench compilation

[root@domU-12-31-38-01-C5-02 sysbench-0.4.12]# make
Making all in doc
make[1]: Entering directory `/db/download/benchmarkTools/sysbench-0.4.12/doc'
Making all in xsl
make[2]: Entering directory `/db/download/benchmarkTools/sysbench-0.4.12/doc/xsl'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/db/download/benchmarkTools/sysbench-0.4.12/doc/xsl'
make[2]: Entering directory `/db/download/benchmarkTools/sysbench-0.4.12/doc'
make[2]: Nothing to be done for `all-am'.
make[2]: Leaving directory `/db/download/benchmarkTools/sysbench-0.4.12/doc'
make[1]: Leaving directory `/db/download/benchmarkTools/sysbench-0.4.12/doc'
Making all in sysbench
make[1]: Entering directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench'
Making all in drivers
make[2]: Entering directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench/drivers'
Making all in mysql
make[3]: Entering directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench/drivers/mysql'
gcc -DHAVE_CONFIG_H -I. -I../../../config -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -DUNIV_LINUX -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench -pthread -g -O2 -MT libsbmysql_a-drv_mysql.o -MD -MP -MF .deps/libsbmysql_a-drv_mysql.Tpo -c -o libsbmysql_a-drv_mysql.o `test -f 'drv_mysql.c' || echo './'`drv_mysql.c
mv -f .deps/libsbmysql_a-drv_mysql.Tpo .deps/libsbmysql_a-drv_mysql.Po
rm -f libsbmysql.a
ar cru libsbmysql.a libsbmysql_a-drv_mysql.o
ranlib libsbmysql.a
make[3]: Leaving directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench/drivers/mysql'
make[3]: Entering directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench/drivers'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench/drivers'
make[2]: Leaving directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench/drivers'
Making all in tests
make[2]: Entering directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench/tests'
Making all in cpu
make[3]: Entering directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench/tests/cpu'
gcc -DHAVE_CONFIG_H -I. -I../../../config -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench -pthread -g -O2 -MT libsbcpu_a-sb_cpu.o -MD -MP -MF .deps/libsbcpu_a-sb_cpu.Tpo -c -o libsbcpu_a-sb_cpu.o `test -f 'sb_cpu.c' || echo './'`sb_cpu.c
mv -f .deps/libsbcpu_a-sb_cpu.Tpo .deps/libsbcpu_a-sb_cpu.Po
rm -f libsbcpu.a
ar cru libsbcpu.a libsbcpu_a-sb_cpu.o
ranlib libsbcpu.a
make[3]: Leaving directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench/tests/cpu'
Making all in fileio
make[3]: Entering directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench/tests/fileio'
gcc -DHAVE_CONFIG_H -I. -I../../../config -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench -pthread -g -O2 -MT libsbfileio_a-sb_fileio.o -MD -MP -MF .deps/libsbfileio_a-sb_fileio.Tpo -c -o libsbfileio_a-sb_fileio.o `test -f 'sb_fileio.c' || echo './'`sb_fileio.c
mv -f .deps/libsbfileio_a-sb_fileio.Tpo .deps/libsbfileio_a-sb_fileio.Po
gcc -DHAVE_CONFIG_H -I. -I../../../config -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench -pthread -g -O2 -MT libsbfileio_a-crc32.o -MD -MP -MF .deps/libsbfileio_a-crc32.Tpo -c -o libsbfileio_a-crc32.o `test -f 'crc32.c' || echo './'`crc32.c
mv -f .deps/libsbfileio_a-crc32.Tpo .deps/libsbfileio_a-crc32.Po
rm -f libsbfileio.a
ar cru libsbfileio.a libsbfileio_a-sb_fileio.o libsbfileio_a-crc32.o
ranlib libsbfileio.a
make[3]: Leaving directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench/tests/fileio'
Making all in memory
make[3]: Entering directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench/tests/memory'
gcc -DHAVE_CONFIG_H -I. -I../../../config -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench -pthread -g -O2 -MT libsbmemory_a-sb_memory.o -MD -MP -MF .deps/libsbmemory_a-sb_memory.Tpo -c -o libsbmemory_a-sb_memory.o `test -f 'sb_memory.c' || echo './'`sb_memory.c
mv -f .deps/libsbmemory_a-sb_memory.Tpo .deps/libsbmemory_a-sb_memory.Po
rm -f libsbmemory.a
ar cru libsbmemory.a libsbmemory_a-sb_memory.o
ranlib libsbmemory.a
make[3]: Leaving directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench/tests/memory'
Making all in threads
make[3]: Entering directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench/tests/threads'
gcc -DHAVE_CONFIG_H -I. -I../../../config -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench -pthread -g -O2 -MT libsbthreads_a-sb_threads.o -MD -MP -MF .deps/libsbthreads_a-sb_threads.Tpo -c -o libsbthreads_a-sb_threads.o `test -f 'sb_threads.c' || echo './'`sb_threads.c
mv -f .deps/libsbthreads_a-sb_threads.Tpo .deps/libsbthreads_a-sb_threads.Po
rm -f libsbthreads.a
ar cru libsbthreads.a libsbthreads_a-sb_threads.o
ranlib libsbthreads.a
make[3]: Leaving directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench/tests/threads'
Making all in mutex
make[3]: Entering directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench/tests/mutex'
gcc -DHAVE_CONFIG_H -I. -I../../../config -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench -pthread -g -O2 -MT libsbmutex_a-sb_mutex.o -MD -MP -MF .deps/libsbmutex_a-sb_mutex.Tpo -c -o libsbmutex_a-sb_mutex.o `test -f 'sb_mutex.c' || echo './'`sb_mutex.c
mv -f .deps/libsbmutex_a-sb_mutex.Tpo .deps/libsbmutex_a-sb_mutex.Po
rm -f libsbmutex.a
ar cru libsbmutex.a libsbmutex_a-sb_mutex.o
ranlib libsbmutex.a
make[3]: Leaving directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench/tests/mutex'
Making all in oltp
make[3]: Entering directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench/tests/oltp'
gcc -DHAVE_CONFIG_H -I. -I../../../config -I./.. -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -DUNIV_LINUX -pthread -g -O2 -MT libsboltp_a-sb_oltp.o -MD -MP -MF .deps/libsboltp_a-sb_oltp.Tpo -c -o libsboltp_a-sb_oltp.o `test -f 'sb_oltp.c' || echo './'`sb_oltp.c
mv -f .deps/libsboltp_a-sb_oltp.Tpo .deps/libsboltp_a-sb_oltp.Po
rm -f libsboltp.a
ar cru libsboltp.a libsboltp_a-sb_oltp.o
ranlib libsboltp.a
make[3]: Leaving directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench/tests/oltp'
make[3]: Entering directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench/tests'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench/tests'
make[2]: Leaving directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench/tests'
Making all in .
make[2]: Entering directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench'
gcc -DHAVE_CONFIG_H -I. -I../config -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../sysbench -pthread -g -O2 -MT sysbench.o -MD -MP -MF .deps/sysbench.Tpo -c -o sysbench.o sysbench.c
mv -f .deps/sysbench.Tpo .deps/sysbench.Po
gcc -DHAVE_CONFIG_H -I. -I../config -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../sysbench -pthread -g -O2 -MT sb_timer.o -MD -MP -MF .deps/sb_timer.Tpo -c -o sb_timer.o sb_timer.c
mv -f .deps/sb_timer.Tpo .deps/sb_timer.Po
gcc -DHAVE_CONFIG_H -I. -I../config -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../sysbench -pthread -g -O2 -MT sb_options.o -MD -MP -MF .deps/sb_options.Tpo -c -o sb_options.o sb_options.c
mv -f .deps/sb_options.Tpo .deps/sb_options.Po
gcc -DHAVE_CONFIG_H -I. -I../config -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../sysbench -pthread -g -O2 -MT sb_logger.o -MD -MP -MF .deps/sb_logger.Tpo -c -o sb_logger.o sb_logger.c
mv -f .deps/sb_logger.Tpo .deps/sb_logger.Po
gcc -DHAVE_CONFIG_H -I. -I../config -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../sysbench -pthread -g -O2 -MT db_driver.o -MD -MP -MF .deps/db_driver.Tpo -c -o db_driver.o db_driver.c
mv -f .deps/db_driver.Tpo .deps/db_driver.Po
/bin/sh ../libtool --tag=CC --mode=link gcc -pthread -g -O2 -o sysbench sysbench.o sb_timer.o sb_options.o sb_logger.o db_driver.o tests/fileio/libsbfileio.a tests/threads/libsbthreads.a tests/memory/libsbmemory.a tests/cpu/libsbcpu.a tests/oltp/libsboltp.a tests/mutex/libsbmutex.a drivers/mysql/libsbmysql.a -rdynamic -L/usr/lib64/mysql -lmysqlclient_r -lz -lcrypt -lnsl -lm -lmygcc -lrt -lm
../libtool: line 838: X--tag=CC: command not found
../libtool: line 871: libtool: ignoring unknown tag : command not found
../libtool: line 838: X--mode=link: command not found
../libtool: line 1004: *** Warning: inferring the mode of operation is deprecated.: command not found
../libtool: line 1005: *** Future versions of Libtool will require --mode=MODE be specified.: command not found
../libtool: line 2231: X-g: command not found
../libtool: line 2231: X-O2: command not found
../libtool: line 2231: X-rdynamic: command not found
../libtool: line 1951: X-L/usr/lib64/mysql: No such file or directory
../libtool: line 2400: Xsysbench: command not found
../libtool: line 2405: X: command not found
../libtool: line 2412: Xsysbench: command not found
../libtool: line 2547: X-lmysqlclient_r: command not found
../libtool: line 2547: X-lz: command not found
../libtool: line 2547: X-lcrypt: command not found
../libtool: line 2547: X-lnsl: command not found
../libtool: line 2547: X-lm: command not found
../libtool: line 2547: X-lmygcc: command not found
../libtool: line 2547: X-lrt: command not found
../libtool: line 2547: X-lm: command not found
../libtool: line 2629: X-L/db/download/benchmarkTools/sysbench-0.4.12/sysbench: No such file or directory
../libtool: line 2547: X-lmysqlclient_r: command not found
../libtool: line 2547: X-lz: command not found
../libtool: line 2547: X-lcrypt: command not found
../libtool: line 2547: X-lnsl: command not found
../libtool: line 2547: X-lmygcc: command not found
../libtool: line 2547: X-lrt: command not found
../libtool: line 2547: X-lm: command not found
../libtool: line 2629: X-L/db/download/benchmarkTools/sysbench-0.4.12/sysbench: No such file or directory
../libtool: line 2547: X-lmysqlclient_r: command not found
../libtool: line 2547: X-lz: command not found
../libtool: line 2547: X-lcrypt: command not found
../libtool: line 2547: X-lnsl: command not found
../libtool: line 2547: X-lmygcc: command not found
../libtool: line 2547: X-lrt: command not found
../libtool: line 2547: X-lm: command not found
../libtool: line 5162: Xgcc -pthread "" "" -o @OUTPUT@ sysbench.o sb_timer.o sb_options.o sb_logger.o db_driver.o "" tests/fileio/libsbfileio.a tests/threads/libsbthreads.a tests/memory/libsbmemory.a tests/cpu/libsbcpu.a tests/oltp/libsboltp.a tests/mutex/libsbmutex.a drivers/mysql/libsbmysql.a -L/db/download/benchmarkTools/sysbench-0.4.12/sysbench -lmysqlclient_r -lz -lcrypt -lnsl -lmygcc -lrt -lm: No such file or directory
../libtool: line 5163: Xgcc -pthread "" "" -o @OUTPUT@ sysbench.o sb_timer.o sb_options.o sb_logger.o db_driver.o "" tests/fileio/libsbfileio.a tests/threads/libsbthreads.a tests/memory/libsbmemory.a tests/cpu/libsbcpu.a tests/oltp/libsboltp.a tests/mutex/libsbmutex.a drivers/mysql/libsbmysql.a -L/db/download/benchmarkTools/sysbench-0.4.12/sysbench -lmysqlclient_r -lz -lcrypt -lnsl -lmygcc -lrt -lm: No such file or directory
../libtool: line 5168: X: command not found
../libtool: line 5172: : command not found
make[2]: Leaving directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench'
make[1]: Leaving directory `/db/download/benchmarkTools/sysbench-0.4.12/sysbench'
make[1]: Entering directory `/db/download/benchmarkTools/sysbench-0.4.12'
make[1]: Nothing to be done for `all-am'.
make[1]: Leaving directory `/db/download/benchmarkTools/sysbench-0.4.12'

just execute ./autogen.sh in sysbench source directory.

then make & make install

super-smack compilation error

make all-recursive
make[1]: Entering directory `/db/download/benchmarkTools/super-smack-1.3'
Making all in src
make[2]: Entering directory `/db/download/benchmarkTools/super-smack-1.3/src'
g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include/mysql -g -O2 -c super-smack.cc
g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include/mysql -g -O2 -c client.cc
g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include/mysql -g -O2 -c engines.cc
g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include/mysql -g -O2 -c die.cc
g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include/mysql -g -O2 -c dictionary.cc
bison -y -d super-smack-yacc.yy && mv y.tab.c super-smack-yacc.cc
if test -f y.tab.h; then \
if cmp -s y.tab.h super-smack-yacc.h; then rm -f y.tab.h; else mv y.tab.h super-smack-yacc.h; fi; \
else :; fi
g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include/mysql -g -O2 -c super-smack-yacc.cc
flex super-smack-lex.ll && mv lex.yy.c super-smack-lex.cc
g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include/mysql -g -O2 -c super-smack-lex.cc
g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include/mysql -g -O2 -c query.cc
query.cc: In member function 'void Query_report::fd_send(int)':
query.cc:200: error: cast from 'char*' to 'unsigned int' loses precision
query.cc:200: error: cast from 'char*' to 'unsigned int' loses precision
query.cc:219: error: cast from 'char*' to 'unsigned int' loses precision
query.cc:219: error: cast from 'char*' to 'unsigned int' loses precision
make[2]: *** [query.o] Error 1
make[2]: Leaving directory `/db/download/benchmarkTools/super-smack-1.3/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/db/download/benchmarkTools/super-smack-1.3'
make: *** [all-recursive-am] Error 2


modify src/query.cc according to gcc-lib and linux kernel version

http://forum.percona.com/index.php/t/706/

this worked for me.

copy and save query.cc

#####################################################
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */

#include "../config.h"

#include
#include
#include
#include
#include
#include

#include "query.h"
#include "die.h"
#include "client.h"

#define MAX_REPORT_LEN 1024
#define MAX_QUERY 8192


void Query::print()
{
cout << "Query:" << "query=" << query << ",name=" << name <<
",has_result_set=" << has_result_set << ",type_name=" <<
type_name << ",parsed=" << parsed << endl;
}

void Query_type_report::update(int num_queries, int max_q_time, int min_q_time)
{
this->num_queries += num_queries;
if(max_time < max_q_time) max_time = max_q_time;
if(min_time > min_q_time) min_time = min_q_time;
}

void Query_type_report::update(int q_time)
{
if(num_queries)
min_time = max_time = q_time;
else
{
if(min_time > q_time) min_time = q_time;
if(max_time < q_time) max_time = q_time;
}

num_queries++;
}

void Query_type_report::print(int t_s, int t_us)
{
char q_per_s[128];
if(t_s == 0 && t_us == 0)
strcpy(q_per_s, "n/a");
else
snprintf(q_per_s, sizeof(q_per_s), "%.2f", (float)num_queries/
(float)(t_s + (float)t_us/1000000.0));

cout << num_queries << "\t" << max_time << "\t" << min_time <<
"\t" << q_per_s << endl;
}

void Query_report::update(const char* type_name, int q_time)
{
Query_type_report *qtr = type_reports[type_name];
if(qtr)
{
qtr->update(q_time);
}
}

void Query_charge::fire(Client* cli)
{
int i;
for(i = 0; i < num_shots; i++)
{
struct timeval start, end;
gettimeofday(&start, NULL);

if(query.parsed)
cli->safe_parsed_query(query.query.c_str(), MAX_QUERY, 1);
else
cli->safe_query(query.query.c_str(), 1);

if(query.has_result_set)
cli->lose_result();

gettimeofday(&end, NULL);
int q_time = (end.tv_sec - start.tv_sec)*1000 +
(end.tv_usec - start.tv_usec)/1000;
cli->qb->update_report(query.type_name, q_time);
}
}

void Query_report::print()
{
//flock(1, LOCK_EX); // lock stdout so that we won't have a conflict from
fcntl(1, F_SETLK, F_WRLCK);
// another client
cout << "Query_type\tnum_queries\tmax_time\tmin_time\tq_per_s" << endl;

map >::iterator i =
type_reports.begin();

if(type_reports.size())
while(i != type_reports.end())
{
Query_type_report *qtr = (*i).second;
if(qtr)
{
cout << (*i).first << "\t" ;
qtr->print(end.tv_sec - start.tv_sec,
end.tv_usec - start.tv_usec );
}
else
die(0, "Internal error: NULL query type report, %d report types",
type_reports.size());
i++;
}
fcntl(1, F_UNLCK, F_WRLCK);
//flock(1, LOCK_UN);
}

void Query_report::start_clock()
{
gettimeofday(&start, NULL);
}

void Query_report::stop_clock()
{
gettimeofday(&end, NULL);
}


void Query_report::update_from_fd(int fd)
{
char buf[MAX_REPORT_LEN];
int q_type_len, data_len, bytes_to_read, num_recs;

if((data_len = read(fd, buf, 1)) < 0)
die(1, "error on read() in update_from_fd()");
if(data_len == 0) return;

num_recs = (int)(*(unsigned char*)buf);
int i;

for(i = 0; i < num_recs; i++)
{
if((data_len = read(fd, buf, 1)) < 0)
die(1, "error on read() in update_from_fd()");
if(data_len == 0) return;
q_type_len = (int) (*(unsigned char*)buf);
bytes_to_read = q_type_len + 3 * sizeof(int);
if((data_len = read(fd, buf, bytes_to_read)) < 0)
die(1, "error on read() in update_from_fd():");

if(data_len < bytes_to_read)
die(1, "incomplete read in update_from_fd(), fix it some day");

char* read_q_type = buf;
// watch this cool hack, moving them, bytes around!
int *p_read_num_queries = (int*)(buf + q_type_len),
*read_max_q_time, *read_min_q_time;
read_max_q_time = p_read_num_queries + 1;
read_min_q_time = read_max_q_time + 1;
int read_num_queries = *p_read_num_queries;
// now that we've save num_queries, it is safe to slap \0
*p_read_num_queries = 0; // 4 bytes at once is OK, even faster
Query_type_report *q = type_reports[read_q_type];
if(q)
q->update(read_num_queries, *read_max_q_time, *read_min_q_time);
else
die(0, "Internal error, invalid q_type '%s'", read_q_type);
}
}

void Query_report::fd_send(int fd)
{
map >::iterator i =
type_reports.begin();
char buf[MAX_REPORT_LEN];
long len = 0; int num_recs = 0;
char* p = (char*)buf + 1, *p_end = (char*)buf+sizeof(buf);

while(i != type_reports.end())
{
string s((*i).first);
long str_len = (*i).first.length();
if((long)p + str_len + 3 *sizeof(int) < (long)p_end )
{
*p++ = (char) str_len;
const char* q_type_name = s.c_str();
memcpy(p,q_type_name , str_len);
p += str_len;
memcpy(p, &((*i).second->num_queries), sizeof(int));
p += sizeof(int);
memcpy(p, &((*i).second->max_time), sizeof(int));
p += sizeof(int);
memcpy(p, &((*i).second->min_time), sizeof(int));
p += sizeof(int);
i++;
num_recs++;
}
else
die(0, "report buffer overflow -- too many query types");
}

len = (long)p - (long)buf;
*(buf) = num_recs;

if(write(fd, buf, len) != len)
die(1, "write error in fd_send:");
}

Query_barrel::~Query_barrel()
{
map >::iterator i =
qr.type_reports.begin();

while(i != qr.type_reports.end())
{
delete (*i).second;
i++;
}

int j;
for(j = 0; j < actions.size(); j++)
delete actions[j];
}
###########################################################

Tuesday, October 27, 2009

A UNIQUE INDEX must include all columns in the table's partitioning function

the partitions rule says all columns in a partition expression must be in all unique keys, in other words every unique key on the table must use every column in the table's partitioning expression.

The same applies for primary keys, otherwise you will get error:
ERROR 1503 (HY000): A PRIMARY KEY must include all columns in the table's partitioning function

The detailed explanation is given at http://dev.mysql.com/doc/refman/5.1/en/partitioning-limitations-partitioning-keys-unique-keys.html

plan partitioning before creating a table, creating partitions in existing table with huge data is very difficult, you might have to alter table to remove all partitions restrictions.