Commit 47265938 authored by monty@donna.mysql.com's avatar monty@donna.mysql.com

Fixes for FULLTEXT and TIME type

parent f2d930c3
......@@ -3368,7 +3368,7 @@ encounter per year, but we are always very flexible towards our customers!
* Source install system issues:: System-specific issues
* Windows:: Windows notes
* OS/2:: OS/2 notes
* MySQL binaries::
* MySQL binaries:: MySQL binaries
* Post-installation:: Post-installation setup and testing
* Upgrade:: Is there anything special to do when upgrading/downgrading @strong{MySQL}?
@end menu
......@@ -6020,9 +6020,14 @@ patch could do - use at your own risk. We have also been told by the
Linux kernel developers that this problem is fixed in 2.4, although we
have not yet done any testing.
We have also tested @strong{MySQL} on Linux 2.4 on a 2 CPU machine and
@strong{MySQL} scales MUCH better on this! If your plan to set up a
dedicated Linux SMP machine to run @code{MySQL} under heavy, we
recommend that you give 2.4 a try!
The current implementation of mutex in Linuxthreads is also very bad for
programs with many threads that only holds the mutex for a short time.
We have made a patch availlable for glibc 2.1,
We have made a patch available for glibc 2.1,
@uref{http://www.mysql.com/Downloads/Linux/linuxthreads-2.1-patch,linuxthreads-2.1-patch}
and for glibc 2.2,
@uref{http://www.mysql.com/Downloads/Linux/linuxthreads-2.2-patch,linuxthreads-2.2-patch}.
......@@ -6376,9 +6381,6 @@ Using @code{gcc-2.9-final}:
CFLAGS="-O2" CXX=gcc CXXFLAGS="-O2 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charsets=complex
@end example
After this you have to edit @file{config.h} and remove the
@code{HAVE_ATOMIC_ADD} line.
After @code{make} you will get an error that @code{sql/opt_range.cc}
will not compile (internal compiler error). To fix this, go to the sql
directory and type @code{make} again. Copy the compile line, but change
......@@ -7540,6 +7542,7 @@ able to mix @code{INSERT} and @code{SELECT}. Currently we use mutexes
to emulate @code{pread()}/@code{pwrite()}. We will in the long run
replace the file level interface with a virtual interface so that we can
use the @code{readfile()}/@code{writefile()} interface on NT to get more speed.
@item Blocking read
@strong{MySQL} uses a blocking read for each connection.
This means that:
......@@ -7561,7 +7564,8 @@ If a connection ``hangs,'' it's impossible to break it without killing
connections.
@end itemize
We plan to fix this in the near future.
We plan to fix this when our windows developers have figured out a nice
workaround for this :)
@item UDF functions
For the moment, @strong{MySQL}-Windows does not support user definable
......@@ -8072,6 +8076,19 @@ The expected results are shown in the @file{./tests/auto_increment.res} file.
@node mysql_install_db, Starting server, Post-installation, Post-installation
@subsection Problems running @code{mysql_install_db}
The purpose of the @code{mysql_install_db} script is to generate new
@strong{MySQL} privilege tables. It will not affect any other data!
It will also not do anything if you have already have MySQL privilege
tables installed!
If you want to recreate your privilege tables, you should take down
the mysqld server, if its running, and then do something like:
@example
mv mysql-data-directory/mysql mysql-data-directory/mysql-old
mysql_install_db
@end example
This section lists problems you might encounter when you run
@code{mysql_install_db}:
......@@ -8153,7 +8170,6 @@ shell> export TMPDIR MYSQL_UNIX_PORT
@file{some_tmp_dir} should be the path to some directory for which you
have write permission. @xref{Environment variables}.
After this you should be able to run @code{mysql_install_db} and start
the server with these commands:
......@@ -11237,7 +11253,7 @@ shell> mysqladmin -u root password new_password
Only user with write/update access to the mysql database can change the
password for others user. All normal users (not anonymous ones) can only
change his own password with either of the above commands or with
@code{SET PASSWORD PASSWORD('new password')}
@code{SET PASSWORD=PASSWORD('new password')}
Note that if you update the password in the @code{user} table directly using
the first method, you must tell the server to reread the grant tables (with
......@@ -61,6 +61,7 @@ void init_tree(TREE *tree,uint default_alloc_size, int element_size,
qsort_cmp compare, my_bool with_delete,
void (*free_element)(void*));
void delete_tree(TREE*);
#define is_tree_inited(tree) ((tree)->root != 0)
/* Functions on leafs */
TREE_ELEMENT *tree_insert(TREE *tree,void *key,uint key_size);
......
......@@ -86,8 +86,8 @@ FT_WORD * ft_linearize(MI_INFO *info, uint keynr, byte *keybuf, TREE *wtree)
tree_walk(wtree,(tree_walk_action)&walk_and_copy,&docstat,left_root_right);
}
delete_tree(wtree);
free(wtree);
if(wlist==NULL)
my_free((char*) wtree,MYF(0));
if (wlist==NULL)
return NULL;
docstat.list->pos=NULL;
......@@ -127,24 +127,24 @@ TREE * ft_parse(TREE *wtree, byte *doc, int doclen)
byte *end=doc+doclen;
FT_WORD w;
if(!wtree)
if (!wtree)
{
if(!(wtree=(TREE *)my_malloc(sizeof(TREE),MYF(0)))) return NULL;
if (!(wtree=(TREE *)my_malloc(sizeof(TREE),MYF(0)))) return NULL;
init_tree(wtree,0,sizeof(FT_WORD),(qsort_cmp)&FT_WORD_cmp,0,NULL);
}
w.weight=0;
while(doc<end)
while (doc<end)
{
for(;doc<end;doc++)
if(word_char(*doc)) break;
for(w.pos=doc; doc<end; doc++)
if(!word_char(*doc)) break;
if((w.len= (uint) (doc-w.pos)) < MIN_WORD_LEN) continue;
if(!tree_insert(wtree, &w, 0))
for (;doc<end;doc++)
if (word_char(*doc)) break;
for (w.pos=doc; doc<end; doc++)
if (!word_char(*doc)) break;
if ((w.len= (uint) (doc-w.pos)) < MIN_WORD_LEN) continue;
if (!tree_insert(wtree, &w, 0))
{
delete_tree(wtree);
free(wtree);
my_free((char*) wtree,MYF(0));
return NULL;
}
}
......
......@@ -176,17 +176,18 @@ FT_DOCLIST * ft_init_search(void *info, uint keynr, byte *key,
saved_lastpos=aio.info->lastpos;
if(!(wtree=ft_parse(NULL,key,key_len))) return NULL;
if (!(wtree=ft_parse(NULL,key,key_len))) return NULL;
init_tree(&aio.dtree,0,sizeof(FT_SUPERDOC),(qsort_cmp)&FT_SUPERDOC_cmp,0,
NULL);
NULL);
if(tree_walk(wtree, (tree_walk_action)&walk_and_match, &aio,
left_root_right))
if (tree_walk(wtree, (tree_walk_action)&walk_and_match, &aio,
left_root_right))
goto err;
dlist=(FT_DOCLIST *)my_malloc(sizeof(FT_DOCLIST)+sizeof(FT_DOC)*(aio.dtree.elements_in_tree-1),MYF(0));
if(!dlist)
dlist=(FT_DOCLIST *) my_malloc(sizeof(FT_DOCLIST)+sizeof(FT_DOC)*
(aio.dtree.elements_in_tree-1),MYF(0));
if (!dlist)
goto err;
dlist->ndocs=aio.dtree.elements_in_tree;
......@@ -194,9 +195,10 @@ FT_DOCLIST * ft_init_search(void *info, uint keynr, byte *key,
dlist->info=aio.info;
dptr=dlist->doc;
tree_walk(&aio.dtree, (tree_walk_action)&walk_and_copy, &dptr, left_root_right);
tree_walk(&aio.dtree, (tree_walk_action)&walk_and_copy, &dptr,
left_root_right);
if(presort)
if (presort)
{
qsort(dlist->doc, dlist->ndocs, sizeof(FT_DOC), (qsort_cmp)&FT_DOC_cmp);
}
......@@ -205,7 +207,7 @@ err:
aio.info->lastpos=saved_lastpos;
delete_tree(&aio.dtree);
delete_tree(wtree);
free(wtree);
my_free((char*) wtree,MYF(0));
return dlist;
}
......
......@@ -29,7 +29,8 @@
/* parses a document i.e. calls _mi_ft_parse for every keyseg */
static FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr, byte *keybuf, const byte *record)
static FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr, byte *keybuf,
const byte *record)
{
TREE *parsed=NULL;
MI_KEYSEG *keyseg;
......@@ -62,7 +63,7 @@ static FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr, byte *keybuf, con
len=keyseg->length;
parsed=ft_parse(parsed, pos, len);
if(parsed==NULL) return NULL;
if (parsed==NULL) return NULL;
}
return ft_linearize(info, keynr, keybuf, parsed);
}
......@@ -150,23 +151,36 @@ int _mi_ft_cmp(MI_INFO *info, uint keynr, const byte *rec1, const byte *rec2)
}
/* adds a document to the collection */
int _mi_ft_add(MI_INFO *info, uint keynr, byte *keybuf, const byte *record, my_off_t pos)
int _mi_ft_add(MI_INFO *info, uint keynr, byte *keybuf, const byte *record,
my_off_t pos)
{
int error= -1;
FT_WORD *wlist;
if(!(wlist=_mi_ft_parserecord(info, keynr, keybuf, record))) return -1;
return _mi_ft_store(info,keynr,keybuf,wlist,pos);
if ((wlist=_mi_ft_parserecord(info, keynr, keybuf, record)))
{
error=_mi_ft_store(info,keynr,keybuf,wlist,pos);
my_free((char*) wlist,MYF(0));
}
return error;
}
/* removes a document from the collection */
int _mi_ft_del(MI_INFO *info, uint keynr, byte *keybuf, const byte *record, my_off_t pos)
int _mi_ft_del(MI_INFO *info, uint keynr, byte *keybuf, const byte *record,
my_off_t pos)
{
int error= -1;
FT_WORD *wlist;
if(!(wlist=_mi_ft_parserecord(info, keynr, keybuf, record))) return -1;
return _mi_ft_erase(info,keynr,keybuf,wlist,pos);
if ((wlist=_mi_ft_parserecord(info, keynr, keybuf, record)))
{
error=_mi_ft_erase(info,keynr,keybuf,wlist,pos);
my_free((char*) wlist,MYF(0));
}
return error;
}
uint _ft_make_key(MI_INFO *info, uint keynr, byte *keybuf, FT_WORD *wptr, my_off_t filepos)
uint _ft_make_key(MI_INFO *info, uint keynr, byte *keybuf, FT_WORD *wptr,
my_off_t filepos)
{
byte buf[HA_FT_MAXLEN+16];
......
......@@ -88,16 +88,24 @@ then
fi
NOHUP_NICENESS=`nohup nice`
if test $? -ne 0 || test x"$NOHUP_NICENESS" = x0 || test ! nice --1 echo foo > /dev/null 2>&1; then
NOHUP_NICENESS="nohup"
else
NOHUP_NICENESS="nice --$NOHUP_NICENESS nohup"
NOHUP_NICENESS="nohup"
if test -w /
then
NOHUP_NICENESS=`nohup nice`
if test $? -ne 0 || test x"$NOHUP_NICENESS" = x0 || test ! nice --1 echo foo > /dev/null 2>&1; then
NOHUP_NICENESS="nohup"
else
NOHUP_NICENESS="nice --$NOHUP_NICENESS nohup"
fi
fi
export MYSQL_UNIX_PORT
export MYSQL_TCP_PORT
touch $err_log; chown $user $err_log
if test -w /
then
# If we are root, change the err log to the right user.
touch $err_log; chown $user $err_log
fi
#
# If there exists an old pid file, check if the daemon is already running
......
# This file describes how to run MySQL benchmarks with MySQL
#
# The test was run on a Intel Xeon 2x 550 Mzh machine with 1G memory,
# 9G hard disk. The OS is Suse 6.4, with Linux 2.2.14 compiled with SMP
# support
# Both the perl client and the database server is run
# on the same machine. No other cpu intensive process was used during
# the benchmark.
#
#
# First, install MySQL from RPM or compile it according to the
# recommendations in the MySQL manual
#
# Start MySQL
bin/safe_mysqld -O key_buffer=16M &
#
# Now we run the test that can be found in the sql-bench directory in the
# MySQL 3.23 source distribution with and without --fast
#
# Note that if you want to make a results that is comparead to some database,
# You should add "--cmp=databasename" as an extra option to the test
#
$CMP=--cmp=pg
run-all-tests --comment="Intel Xeon, 2x550 Mhz, 1G, key_buffer=16M" $CMP
run-all-tests --comment="Intel Xeon, 2x550 Mhz, 1G, key_buffer=16M" --fast $CMP
# If you want to store the results in a output/RUN-xxx file, you should
# repeate the benchmark with the extra option --log --use-old-result
# This will create a the RUN file based of the previous results
#
run-all-tests --comment="Intel Xeon, 2x550 Mhz, 1G, key_buffer=16M" --log --use-old-result $CMP
run-all-tests --comment="Intel Xeon, 2x550 Mhz, 1G, key_buffer=16M" --fast --log --use-old-result $CMP
......@@ -116,6 +116,7 @@ sub new
$self->{'blob'} = "blob";
$self->{'text'} = "text";
$self->{'double_quotes'} = 1; # Can handle: 'Walker''s'
$self->{'vacuum'} = 1; # When using with --fast
$limits{'max_conditions'} = 9999; # (Actually not a limit)
$limits{'max_columns'} = 2000; # Max number of columns in table
......@@ -308,6 +309,26 @@ sub reconnect_on_errors
return 0;
}
#
# Optimize tables for better performance
#
sub vacuum
{
my ($self,$full_vacuum,$dbh_ref,@tables)=@_;
my ($loop_time,$end_time,$dbh);
if ($#tables >= 0)
{
$dbh=$$dbh_ref;
$loop_time=new Benchmark;
$dbh->do("OPTIMIZE TABLE " . join(',',@tables)) || die "Got error: $DBI::errstr when executing 'OPTIMIZE TABLE'\n";
$end_time=new Benchmark;
print "Time for book-keeping (1): " .
Benchmark::timestr(Benchmark::timediff($end_time, $loop_time),"all") . "\n\n";
}
}
#############################################################################
# Definitions for mSQL
#############################################################################
......
......@@ -71,10 +71,10 @@ if (!$opt_skip_create)
print "Time for create_table (" . ($#tables+1) ."): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
if ($opt_fast && defined($server->{vacuum}))
{
$server->vacuum(0,\$dbh);
}
if ($opt_fast && defined($server->{vacuum}))
{
$server->vacuum(0,\$dbh);
}
####
#### Insert data
......@@ -130,22 +130,26 @@ if ($opt_fast && defined($server->{vacuum}))
}
close(DATA);
}
if ($opt_lock_tables)
{
$dbh->do("UNLOCK TABLES");
}
$end_time=new Benchmark;
print "Time to insert ($row_count): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
}
elsif ($opt_lock_tables)
{
@tmp=@table_names; push(@tmp,@extra_names);
$sth = $dbh->do("LOCK TABLES " . join(" READ,", @tmp) . " READ") ||
die $DBI::errstr;
}
if ($opt_fast && defined($server->{vacuum}))
{
$server->vacuum(0,\$dbh);
$server->vacuum(0,\$dbh,@table_names);
}
if ($opt_lock_tables)
{
@tmp=@table_names; push(@tmp,@extra_names);
$sth = $dbh->do("LOCK TABLES " . join(" READ,", @tmp) . " READ") ||
die $DBI::errstr;
}
#
# Now the fun begins. Let's do some simple queries on the result
#
......
......@@ -206,9 +206,17 @@ $end_time=new Benchmark;
print "Time for insert (" . ($total_rows) . "): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
if ($opt_lock_tables)
{
$sth = $dbh->do("UNLOCK TABLES") || die $DBI::errstr;
}
if ($opt_fast && defined($server->{vacuum}))
{
$server->vacuum(1,\$dbh);
$server->vacuum(1,\$dbh,"bench1");
}
if ($opt_lock_tables)
{
$sth = $dbh->do("LOCK TABLES bench1 WRITE") || die $DBI::errstr;
}
####
......@@ -235,10 +243,10 @@ $end_time=new Benchmark;
print "Time for insert_duplicates (" . ($total_rows) . "): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
if ($opt_fast && defined($server->{vacuum}))
{
$server->vacuum(1,\$dbh);
}
#if ($opt_fast && defined($server->{vacuum}))
#{
# $server->vacuum(1,\$dbh);
#}
####
#### Do some selects on the table
......@@ -605,9 +613,17 @@ if ($limits->{'functions'})
print "Time for update_of_key ($range_loop_count): " .
timestr(timediff($end_time, $loop_time),"all") . "\n";
if ($opt_lock_tables)
{
do_query($dbh,"UNLOCK TABLES");
}
if ($opt_fast && defined($server->{vacuum}))
{
$server->vacuum(1,\$dbh);
$server->vacuum(1,\$dbh,"bench1");
}
if ($opt_lock_tables)
{
$sth = $dbh->do("LOCK TABLES bench1 WRITE") || die $DBI::errstr;
}
if ($server->small_rollback_segment())
......@@ -735,7 +751,15 @@ else
if ($opt_fast && defined($server->{vacuum}))
{
$server->vacuum(1,\$dbh);
if ($opt_lock_tables)
{
do_query($dbh,"UNLOCK TABLES");
}
$server->vacuum(1,\$dbh,"bench1");
if ($opt_lock_tables)
{
$sth = $dbh->do("LOCK TABLES bench1 WRITE") || die $DBI::errstr;
}
}
#
......@@ -902,7 +926,7 @@ if (!$opt_skip_delete)
if ($opt_lock_tables)
{
$sth = $dbh->do("UNLOCK TABLES ") || die $DBI::errstr;
$sth = $dbh->do("UNLOCK TABLES") || die $DBI::errstr;
}
$sth = $dbh->do("drop table bench1") or die $DBI::errstr;
}
......@@ -1029,7 +1053,15 @@ if ($server->small_rollback_segment())
}
if ($opt_fast && defined($server->{vacuum}))
{
$server->vacuum(1,\$dbh);
if ($opt_lock_tables)
{
do_query($dbh,"UNLOCK TABLES");
}
$server->vacuum(1,\$dbh,"bench1");
if ($opt_lock_tables)
{
$sth = $dbh->do("LOCK TABLES bench1 WRITE") || die $DBI::errstr;
}
}
#
......@@ -1054,7 +1086,15 @@ if ($server->small_rollback_segment())
}
if ($opt_fast && defined($server->{vacuum}))
{
$server->vacuum(1,\$dbh);
if ($opt_lock_tables)
{
do_query($dbh,"UNLOCK TABLES");
}
$server->vacuum(1,\$dbh,"bench1");
if ($opt_lock_tables)
{
$sth = $dbh->do("LOCK TABLES bench1 WRITE") || die $DBI::errstr;
}
}
if ($server->small_rollback_segment())
......
......@@ -109,9 +109,19 @@ $end_time=new Benchmark;
print "Time to insert ($opt_loop_count): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
if ($opt_lock_tables)
{
do_query($dbh,"UNLOCK TABLES");
}
if ($opt_fast && defined($server->{vacuum}))
{
$server->vacuum(0,\$dbh);
$server->vacuum(0,\$dbh,"bench1");
}
if ($opt_lock_tables)
{
do_query($dbh,"LOCK TABLES bench1 WRITE");
}
####
......
......@@ -65,10 +65,10 @@ if (!$opt_skip_create)
print "Time for create_table ($#tables): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
if ($opt_fast && defined($server->{vacuum}))
{
$server->vacuum(1,\$dbh);
}
if ($opt_fast && defined($server->{vacuum}))
{
$server->vacuum(1,\$dbh);
}
####
......@@ -124,6 +124,10 @@ else
}
close(DATA);
}
if ($opt_lock_tables)
{
do_query($dbh,"UNLOCK TABLES");
}
$end_time=new Benchmark;
print "Time to insert ($row_count): " .
timestr(timediff($end_time, $loop_time),"all") . "\n";
......@@ -138,7 +142,14 @@ if ($server->small_rollback_segment())
if ($opt_fast && defined($server->{vacuum}))
{
$server->vacuum(0,\$dbh);
$server->vacuum(0,\$dbh,@table_names);
}
if ($opt_lock_tables)
{
@tmp=@table_names; push(@tmp,@extra_names);
$sth = $dbh->do("LOCK TABLES " . join(" WRITE,", @tmp) . " WRITE") ||
die $DBI::errstr;
}
$loop_time= $end_time;
......
......@@ -2620,9 +2620,9 @@ bool Field_time::get_time(TIME *ltime)
ltime->neg= 1;
tmp=-tmp;
}
ltime->day=tmp/10000;
tmp-=ltime->day*10000;
ltime->hour= tmp/100;
ltime->hour=tmp/10000;
tmp-=ltime->hour*10000;
ltime->minute= tmp/100;
ltime->second= tmp % 100;
ltime->second_part=0;
return 0;
......
......@@ -848,7 +848,8 @@ public:
{
if (!master)
{
ft_close_search(ft_handler);
if (ft_handler)
ft_close_search(ft_handler);
if(join_key)
table->file->ft_handler=0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment