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

Small bug fixes + code for DELETE QUICK

parent f2f515e5
...@@ -427,7 +427,7 @@ Functions for use in @code{SELECT} and @code{WHERE} clauses ...@@ -427,7 +427,7 @@ Functions for use in @code{SELECT} and @code{WHERE} clauses
MySQL table types MySQL table types
* MyISAM:: MyISAM tables * MyISAM:: MyISAM tables
* MERGE:: * MERGE:: MERGE tables
* ISAM:: ISAM tables * ISAM:: ISAM tables
* HEAP:: HEAP tables * HEAP:: HEAP tables
* BDB:: BDB or Berkeley_db tables * BDB:: BDB or Berkeley_db tables
...@@ -2345,21 +2345,21 @@ from the local @strong{MySQL} list. ...@@ -2345,21 +2345,21 @@ from the local @strong{MySQL} list.
The following @strong{MySQL} mailing lists exist: The following @strong{MySQL} mailing lists exist:
@table @code @table @code
@item announce @item announce (@email{announce-subscribe@@lists.mysql.com})
This is for announcement of new versions of @strong{MySQL} and related This is for announcement of new versions of @strong{MySQL} and related
programs. This is a low volume list that we think all @strong{MySQL} programs. This is a low volume list that we think all @strong{MySQL}
users should be on. users should be on.
@item mysql @item mysql (@email{mysql-subscribe@@lists.mysql.com})
The main list for general @strong{MySQL} discussion. Please note that some The main list for general @strong{MySQL} discussion. Please note that some
topics are better discussed on the more-specialized lists. If you post to the topics are better discussed on the more-specialized lists. If you post to the
wrong list, you may not get an answer! wrong list, you may not get an answer!
@item mysql-digest @item mysql-digest (@email{mysql-digest-subscribe@@lists.mysql.com})
The @code{mysql} list in digest form. That means you get all individual The @code{mysql} list in digest form. That means you get all individual
messages, sent as one large mail message once a day. messages, sent as one large mail message once a day.
@item bugs @item bugs (@email{bugs-subscribe@@lists.mysql.com})
On this list you should only post a full, repeatable bug report, using On this list you should only post a full, repeatable bug report, using
the @code{mysqlbug} script (if you are running on Windows, you should the @code{mysqlbug} script (if you are running on Windows, you should
include a description of the operating system and the @strong{MySQL} version). include a description of the operating system and the @strong{MySQL} version).
...@@ -2371,45 +2371,45 @@ this list will be corrected or documented in the next @strong{MySQL} release! ...@@ -2371,45 +2371,45 @@ this list will be corrected or documented in the next @strong{MySQL} release!
If there are only small code changes involved, we will also post a patch that If there are only small code changes involved, we will also post a patch that
fixes the problem. fixes the problem.
@item bugs-digest @item bugs-digest (@email{bugs-digest-subscribe@@lists.mysql.com})
The @code{bugs} list in digest form The @code{bugs} list in digest form
@item developer @item developer (@email{developer-subscribe@@lists.mysql.com})
A list for people who work on the @strong{MySQL} code. On this list one A list for people who work on the @strong{MySQL} code. On this list one
can also discuss @strong{MySQL} development and post patches. can also discuss @strong{MySQL} development and post patches.
@item developer-digest @item developer-digest (@email{developer-digest-subscribe@@lists.mysql.com})
A digest version of the @code{developer} list. A digest version of the @code{developer} list.
@item java @item java (@email{java-subscribe@@lists.mysql.com})
Discussion about @strong{MySQL} and Java. Mostly about the JDBC drivers. Discussion about @strong{MySQL} and Java. Mostly about the JDBC drivers.
@item java-digest @item java-digest (@email{java-digest-subscribe@@lists.mysql.com})
A digest version of the @code{java} list. A digest version of the @code{java} list.
@item win32 @item win32 (@email{win32-subscribe@@lists.mysql.com})
All things concerning @strong{MySQL} on Microsoft operating systems such as All things concerning @strong{MySQL} on Microsoft operating systems such as
Win95, Win98, NT and Win2000. Win95, Win98, NT and Win2000.
@item win32-digest @item win32-digest (@email{win32-digest-subscribe@@lists.mysql.com})
A digest version of the @code{win32} list. A digest version of the @code{win32} list.
@item myodbc @item myodbc (@email{myodbc-subscribe@@lists.mysql.com})
All things concerning connecting to @strong{MySQL} with ODBC. All things concerning connecting to @strong{MySQL} with ODBC.
@item myodbc-digest @item myodbc-digest (@email{myodbc-digest-subscribe@@lists.mysql.com})
A digest version of the @code{myodbc} list. A digest version of the @code{myodbc} list.
@item plusplus @item plusplus (@email{plusplus-digest-subscribe@@lists.mysql.com})
All things concerning programming with the C++ API to @strong{MySQL}. All things concerning programming with the C++ API to @strong{MySQL}.
@item plusplus-digest @item plusplus-digest (@email{plusplus-digest-subscribe@@lists.mysql.com})
A digest version of the @code{plusplus} list. A digest version of the @code{plusplus} list.
@item msql-mysql-modules @item msql-mysql-modules (@email{msql-mysql-modules-subscribe@@lists.mysql.com})
A list about the Perl support in @strong{MySQL}. A list about the Perl support in @strong{MySQL}.
@item msql-mysql-modules-digest @item msql-mysql-modules-digest (@email{msql-mysql-modules-digest-subscribe@@lists.mysql.com})
A digest version of the @code{msql-mysql-modules} list. A digest version of the @code{msql-mysql-modules} list.
@end table @end table
...@@ -4720,7 +4720,7 @@ shell> /usr/sbin/swinstall -s /path/to/depot mysql.developer ...@@ -4720,7 +4720,7 @@ shell> /usr/sbin/swinstall -s /path/to/depot mysql.developer
The depot places binaries and libraries in @file{/opt/mysql} and data in The depot places binaries and libraries in @file{/opt/mysql} and data in
@file{/var/opt/mysql}. The depot also creates the appropriate entries in @file{/var/opt/mysql}. The depot also creates the appropriate entries in
@file{/sbin/init.d} and @file{/sbin/rc2.d} to start the server automatically @file{/etc/init.d} and @file{/etc/rc2.d} to start the server automatically
at boot time. Obviously, this entails being @code{root} to install. at boot time. Obviously, this entails being @code{root} to install.
To install the HP-UX tar.gz distribution, you must have a copy of GNU To install the HP-UX tar.gz distribution, you must have a copy of GNU
...@@ -17715,6 +17715,8 @@ If you specify the keyword @code{LOW_PRIORITY}, execution of the ...@@ -17715,6 +17715,8 @@ If you specify the keyword @code{LOW_PRIORITY}, execution of the
In this case the client has to wait until the insert statement is completed, In this case the client has to wait until the insert statement is completed,
which may take a long time if the table is in heavy use. This is in which may take a long time if the table is in heavy use. This is in
contrast to @code{INSERT DELAYED} which lets the client continue at once. contrast to @code{INSERT DELAYED} which lets the client continue at once.
Note that @code{LOW_PRIORITY} should normally not be used with @code{MyISAM}
tables as this disables concurrent inserts.@xref{MyISAM}.
@item @item
If you specify the keyword @code{IGNORE} in an @code{INSERT} with many value If you specify the keyword @code{IGNORE} in an @code{INSERT} with many value
...@@ -18518,7 +18520,7 @@ the @code{mysql} database. ...@@ -18518,7 +18520,7 @@ the @code{mysql} database.
@item @code{TABLES table_name [,table_name...]} @tab Flush only the given tables @item @code{TABLES table_name [,table_name...]} @tab Flush only the given tables
@item @code{TABLES WITH READ LOCK} @tab Closes all open tables and locks all tables for all databases with a read until one executes @code{UNLOCK TABLES}. @item @code{TABLES WITH READ LOCK} @tab Closes all open tables and locks all tables for all databases with a read until one executes @code{UNLOCK TABLES}. This is very convinient way to get backups if you have a file system, like Veritas,that can take snapshots in time.
@item @code{STATUS} @tab Resets most status variables to zero. @item @code{STATUS} @tab Resets most status variables to zero.
@end multitable @end multitable
...@@ -19686,7 +19688,10 @@ table in the server and implemented with @code{pthread_mutex_lock()} and ...@@ -19686,7 +19688,10 @@ table in the server and implemented with @code{pthread_mutex_lock()} and
See @ref{Internal locking}, for more information on locking policy. See @ref{Internal locking}, for more information on locking policy.
You can also lock all tables in all databases with read locks with the You can also lock all tables in all databases with read locks with the
@code{FLUSH TABLES WITH READ LOCK} command. @xref{FLUSH}. @code{FLUSH TABLES WITH READ LOCK} command. @xref{FLUSH}. This is very
convinient way to get backups if you have a file system, like Veritas,
that can take snapshots in time.
@findex SET OPTION @findex SET OPTION
@node SET OPTION, GRANT, LOCK TABLES, Reference @node SET OPTION, GRANT, LOCK TABLES, Reference
...@@ -21351,6 +21356,14 @@ article (item number) for certain traders (dealers). Supposing that each ...@@ -21351,6 +21356,14 @@ article (item number) for certain traders (dealers). Supposing that each
trader has a single fixed price per article, then (@code{item}, trader has a single fixed price per article, then (@code{item},
@code{trader}) is a primary key for the records. @code{trader}) is a primary key for the records.
Start the command line tool @code{mysql} and select a database:
@example
mysql your-database-name
@end example
(In most @strong{MySQL} installations, you can use the database-name 'test').
You can create the example table as: You can create the example table as:
@example @example
...@@ -21486,7 +21499,7 @@ In @strong{MySQL} it's best do it in several steps: ...@@ -21486,7 +21499,7 @@ In @strong{MySQL} it's best do it in several steps:
@enumerate @enumerate
@item @item
Get the list of (article,maxprice). @xref{example-Maximum-column-group-row}. Get the list of (article,maxprice).
@item @item
For each article get the corresponding rows which have the stored maximum For each article get the corresponding rows which have the stored maximum
price. price.
...@@ -21499,11 +21512,11 @@ CREATE TEMPORARY TABLE tmp ( ...@@ -21499,11 +21512,11 @@ CREATE TEMPORARY TABLE tmp (
article INT(4) UNSIGNED ZEROFILL DEFAULT '0000' NOT NULL, article INT(4) UNSIGNED ZEROFILL DEFAULT '0000' NOT NULL,
price DOUBLE(16,2) DEFAULT '0.00' NOT NULL); price DOUBLE(16,2) DEFAULT '0.00' NOT NULL);
LOCK TABLES article read; LOCK TABLES shop read;
INSERT INTO tmp SELECT article, MAX(price) FROM shop GROUP BY article; INSERT INTO tmp SELECT article, MAX(price) FROM shop GROUP BY article;
SELECT article, dealer, price FROM shop, tmp SELECT shop.article, dealer, price FROM shop, tmp
WHERE shop.article=tmp.article AND shop.price=tmp.price; WHERE shop.article=tmp.article AND shop.price=tmp.price;
UNLOCK TABLES; UNLOCK TABLES;
...@@ -28747,6 +28760,10 @@ that when you export data to @strong{MySQL}, the table and column names ...@@ -28747,6 +28760,10 @@ that when you export data to @strong{MySQL}, the table and column names
aren't specified. Another way to around this bug is to upgrade to aren't specified. Another way to around this bug is to upgrade to
MyODBC 2.50.33 and @strong{MySQL} 3.23.x, which together provides a MyODBC 2.50.33 and @strong{MySQL} 3.23.x, which together provides a
workaround for this bug! workaround for this bug!
Note that if you are using @strong{MySQL} 3.22, you must to apply the
MDAC patch and use MyODBC 2.50.32 or 2.50.34 and above to go around
this problem.
@item @item
Set the ``Return matching rows'' MyODBC option field when connecting to Set the ``Return matching rows'' MyODBC option field when connecting to
@strong{MySQL}. @strong{MySQL}.
...@@ -36307,10 +36324,18 @@ though, so 3.23 is not released as a stable version yet. ...@@ -36307,10 +36324,18 @@ though, so 3.23 is not released as a stable version yet.
@appendixsubsec Changes in release 3.23.25 @appendixsubsec Changes in release 3.23.25
@itemize @bullet @itemize @bullet
@item @item
Fixed a bug where @code{FULLTEXT} index always used the koi8_ukr
character set.
@item
Fixed privilege checking for @code{CHECK TABLE}.
@item
The @code{MyISAM} repair/reindex code didn't use the @code{--tempdir}
option for it's temporary files.
@item
Fixed a core dump bug when doing @code{FLUSH MASTER} when one didn't give Fixed a core dump bug when doing @code{FLUSH MASTER} when one didn't give
a filename argument to @code{--log-bin} a filename argument to @code{--log-bin}
@item @item
Added missing ha_berkeley.x files to the MySQL windows source distribution. Added missing ha_berkeley.# files to the windows source distribution.
@item @item
Fixed some mutex bugs in the log code that could cause thread blocks if new Fixed some mutex bugs in the log code that could cause thread blocks if new
log files couldn't be created. log files couldn't be created.
...@@ -1218,7 +1218,7 @@ AC_CHECK_FUNCS(alarm bmove \ ...@@ -1218,7 +1218,7 @@ AC_CHECK_FUNCS(alarm bmove \
pthread_setschedparam pthread_attr_setprio pthread_attr_setschedparam \ pthread_setschedparam pthread_attr_setprio pthread_attr_setschedparam \
pthread_attr_create pthread_getsequence_np pthread_attr_setstacksize \ pthread_attr_create pthread_getsequence_np pthread_attr_setstacksize \
pthread_condattr_create rwlock_init pthread_rwlock_rdlock \ pthread_condattr_create rwlock_init pthread_rwlock_rdlock \
crypt dlopen dlerror fchmod getpass getpassphrase initgroups, mlockall) crypt dlopen dlerror fchmod getpass getpassphrase initgroups mlockall)
# Sanity check: We chould not have any fseeko symbol unless # Sanity check: We chould not have any fseeko symbol unless
# large_file_support=yes # large_file_support=yes
......
...@@ -290,6 +290,7 @@ inline double ulonglong2double(ulonglong value) ...@@ -290,6 +290,7 @@ inline double ulonglong2double(ulonglong value)
#define MY_NFILE 127 /* This is only used to save filenames */ #define MY_NFILE 127 /* This is only used to save filenames */
#define DO_NOT_REMOVE_THREAD_WRAPPERS
#define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V)) #define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V))
/* The following is only used for statistics, so it should be good enough */ /* The following is only used for statistics, so it should be good enough */
#ifdef __NT__ /* This should also work on Win98 but .. */ #ifdef __NT__ /* This should also work on Win98 but .. */
......
...@@ -43,6 +43,7 @@ typedef struct st_ft_doclist { ...@@ -43,6 +43,7 @@ typedef struct st_ft_doclist {
extern const char *ft_precompiled_stopwords[]; extern const char *ft_precompiled_stopwords[];
int ft_init_stopwords(const char **); int ft_init_stopwords(const char **);
void ft_free_stopwords(void);
FT_DOCLIST * ft_init_search(void *, uint, byte *, uint, my_bool); FT_DOCLIST * ft_init_search(void *, uint, byte *, uint, my_bool);
int ft_read_next(FT_DOCLIST *, char *); int ft_read_next(FT_DOCLIST *, char *);
......
...@@ -55,6 +55,7 @@ struct timespec { /* For pthread_cond_timedwait() */ ...@@ -55,6 +55,7 @@ struct timespec { /* For pthread_cond_timedwait() */
long tv_nsec; long tv_nsec;
}; };
typedef int pthread_mutexattr_t;
#define win_pthread_self my_thread_var->pthread_self #define win_pthread_self my_thread_var->pthread_self
#define pthread_handler_decl(A,B) unsigned __cdecl A(void *B) #define pthread_handler_decl(A,B) unsigned __cdecl A(void *B)
typedef unsigned (__cdecl *pthread_handler)(void *); typedef unsigned (__cdecl *pthread_handler)(void *);
...@@ -215,42 +216,6 @@ extern int my_pthread_getprio(pthread_t thread_id); ...@@ -215,42 +216,6 @@ extern int my_pthread_getprio(pthread_t thread_id);
#define pthread_handler_decl(A,B) void *A(void *B) #define pthread_handler_decl(A,B) void *A(void *B)
typedef void *(* pthread_handler)(void *); typedef void *(* pthread_handler)(void *);
/* safe mutex for debugging */
typedef struct st_safe_mutex_t
{
pthread_mutex_t global,mutex;
char *file;
uint line,count;
pthread_t thread;
} safe_mutex_t;
int safe_mutex_init(safe_mutex_t *mp, const pthread_mutexattr_t *attr);
int safe_mutex_lock(safe_mutex_t *mp,const char *file, uint line);
int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line);
int safe_mutex_destroy(safe_mutex_t *mp,const char *file, uint line);
int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp,const char *file,
uint line);
int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
struct timespec *abstime, const char *file, uint line);
#ifdef SAFE_MUTEX
#undef pthread_mutex_init
#undef pthread_mutex_lock
#undef pthread_mutex_unlock
#undef pthread_mutex_destroy
#undef pthread_mutex_wait
#undef pthread_mutex_timedwait
#undef pthread_mutex_t
#define pthread_mutex_init(A,B) safe_mutex_init((A),(B))
#define pthread_mutex_lock(A) safe_mutex_lock((A),__FILE__,__LINE__)
#define pthread_mutex_unlock(A) safe_mutex_unlock((A),__FILE__,__LINE__)
#define pthread_mutex_destroy(A) safe_mutex_destroy((A),__FILE__,__LINE__)
#define pthread_cond_wait(A,B) safe_cond_wait((A),(B),__FILE__,__LINE__)
#define pthread_cond_timedwait(A,B,C) safe_cond_timedwait((A),(B),(C),__FILE__,__LINE__)
#define pthread_mutex_t safe_mutex_t
#endif
/* Test first for RTS or FSU threads */ /* Test first for RTS or FSU threads */
#if defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) #if defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM)
...@@ -424,7 +389,44 @@ struct hostent *my_gethostbyname_r(const char *name, ...@@ -424,7 +389,44 @@ struct hostent *my_gethostbyname_r(const char *name,
#endif /* defined(__WIN__) */ #endif /* defined(__WIN__) */
/* READ-WRITE thread locking */ /* safe_mutex adds checking to mutex for easier debugging */
typedef struct st_safe_mutex_t
{
pthread_mutex_t global,mutex;
char *file;
uint line,count;
pthread_t thread;
} safe_mutex_t;
int safe_mutex_init(safe_mutex_t *mp, const pthread_mutexattr_t *attr);
int safe_mutex_lock(safe_mutex_t *mp,const char *file, uint line);
int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line);
int safe_mutex_destroy(safe_mutex_t *mp,const char *file, uint line);
int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp,const char *file,
uint line);
int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
struct timespec *abstime, const char *file, uint line);
/* Wrappers if safe mutex is actually used */
#ifdef SAFE_MUTEX
#undef pthread_mutex_init
#undef pthread_mutex_lock
#undef pthread_mutex_unlock
#undef pthread_mutex_destroy
#undef pthread_mutex_wait
#undef pthread_mutex_timedwait
#undef pthread_mutex_t
#define pthread_mutex_init(A,B) safe_mutex_init((A),(B))
#define pthread_mutex_lock(A) safe_mutex_lock((A),__FILE__,__LINE__)
#define pthread_mutex_unlock(A) safe_mutex_unlock((A),__FILE__,__LINE__)
#define pthread_mutex_destroy(A) safe_mutex_destroy((A),__FILE__,__LINE__)
#define pthread_cond_wait(A,B) safe_cond_wait((A),(B),__FILE__,__LINE__)
#define pthread_cond_timedwait(A,B,C) safe_cond_timedwait((A),(B),(C),__FILE__,__LINE__)
#define pthread_mutex_t safe_mutex_t
#endif /* SAFE_MUTEX */
/* READ-WRITE thread locking */
#if defined(USE_MUTEX_INSTEAD_OF_RW_LOCKS) #if defined(USE_MUTEX_INSTEAD_OF_RW_LOCKS)
/* use these defs for simple mutex locking */ /* use these defs for simple mutex locking */
......
...@@ -104,6 +104,7 @@ SUFFIXES = .sh ...@@ -104,6 +104,7 @@ SUFFIXES = .sh
-e 's!@''PERL_DBD_VERSION''@!@PERL_DBD_VERSION@!' \ -e 's!@''PERL_DBD_VERSION''@!@PERL_DBD_VERSION@!' \
-e 's!@''PERL_DATA_DUMPER''@!@PERL_DATA_DUMPER@!' \ -e 's!@''PERL_DATA_DUMPER''@!@PERL_DATA_DUMPER@!' \
$< > $@-t $< > $@-t
@CHMOD@ +x $@-t
@MV@ $@-t $@ @MV@ $@-t $@
# Don't update the files from bitkeeper # Don't update the files from bitkeeper
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
const MI_KEYSEG ft_keysegs[FT_SEGS]={ const MI_KEYSEG ft_keysegs[FT_SEGS]={
{ {
HA_KEYTYPE_VARTEXT, /* type */ HA_KEYTYPE_VARTEXT, /* type */
7, /* language */ 7, /* language (will be overwritten) */
0, 0, 0, /* null_bit, bit_start, bit_end */ 0, 0, 0, /* null_bit, bit_start, bit_end */
HA_VAR_LENGTH | HA_PACK_KEY, /* flag */ HA_VAR_LENGTH | HA_PACK_KEY, /* flag */
HA_FT_MAXLEN, /* length */ HA_FT_MAXLEN, /* length */
......
...@@ -51,8 +51,8 @@ int ft_init_stopwords(const char **sws) ...@@ -51,8 +51,8 @@ int ft_init_stopwords(const char **sws)
if( (sw.len= (uint) strlen(sw.pos=*sws)) < MIN_WORD_LEN) continue; if( (sw.len= (uint) strlen(sw.pos=*sws)) < MIN_WORD_LEN) continue;
if(!tree_insert(stopwords3, &sw, 0)) if(!tree_insert(stopwords3, &sw, 0))
{ {
delete_tree(stopwords3); delete_tree(stopwords3); /* purecov: inspected */
return -1; return -1; /* purecov: inspected */
} }
} }
return 0; return 0;
...@@ -66,3 +66,12 @@ int is_stopword(char *word, uint len) ...@@ -66,3 +66,12 @@ int is_stopword(char *word, uint len)
return tree_search(stopwords3,&sw) != NULL; return tree_search(stopwords3,&sw) != NULL;
} }
void ft_free_stopwords()
{
if (stopwords3)
{
delete_tree(stopwords3); /* purecov: inspected */
stopwords3=0;
}
}
...@@ -511,8 +511,12 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -511,8 +511,12 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
if (mi_keyseg_write(file, &keydefs[i].seg[j])) if (mi_keyseg_write(file, &keydefs[i].seg[j]))
goto err; goto err;
for (j=0 ; j < ft_segs ; j++) /* SerG */ for (j=0 ; j < ft_segs ; j++) /* SerG */
if (mi_keyseg_write(file, &ft_keysegs[j])) {
MI_KEYSEG seg=ft_keysegs[j];
seg.language= keydefs[i].seg[0].language;
if (mi_keyseg_write(file, &seg))
goto err; goto err;
}
} }
/* Create extra keys for unique definitions */ /* Create extra keys for unique definitions */
offset=reclength-uniques*MI_UNIQUE_HASH_LENGTH; offset=reclength-uniques*MI_UNIQUE_HASH_LENGTH;
......
...@@ -247,9 +247,9 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -247,9 +247,9 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
{ /* On leaf page */ { /* On leaf page */
if (_mi_write_keypage(info,keyinfo,page,anc_buff)) if (_mi_write_keypage(info,keyinfo,page,anc_buff))
DBUG_RETURN(-1); DBUG_RETURN(-1);
if (length <= (uint) keyinfo->underflow_block_length) /* Page will be update later if we return 1 */
DBUG_RETURN(1); /* Page will be update later */ DBUG_RETURN(test(length <= (info->quick_mode ? MI_MIN_KEYBLOCK_LENGTH :
DBUG_RETURN(0); (uint) keyinfo->underflow_block_length)));
} }
save_flag=1; save_flag=1;
ret_value=del(info,keyinfo,key,anc_buff,leaf_page,leaf_buff,keypos, ret_value=del(info,keyinfo,key,anc_buff,leaf_page,leaf_buff,keypos,
...@@ -385,7 +385,9 @@ static int del(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *key, ...@@ -385,7 +385,9 @@ static int del(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *key,
_mi_kpointer(info,keypos - share->base.key_reflength,next_block); _mi_kpointer(info,keypos - share->base.key_reflength,next_block);
mi_putint(anc_buff,a_length+length,share->base.key_reflength); mi_putint(anc_buff,a_length+length,share->base.key_reflength);
DBUG_RETURN( mi_getint(leaf_buff) <= (uint) keyinfo->underflow_block_length); DBUG_RETURN( mi_getint(leaf_buff) <=
(info->quick_mode ? MI_MIN_KEYBLOCK_LENGTH :
(uint) keyinfo->underflow_block_length));
err: err:
DBUG_RETURN(-1); DBUG_RETURN(-1);
} /* del */ } /* del */
...@@ -537,7 +539,8 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -537,7 +539,8 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
} }
if (_mi_write_keypage(info,keyinfo,leaf_page,leaf_buff)) if (_mi_write_keypage(info,keyinfo,leaf_page,leaf_buff))
goto err; goto err;
DBUG_RETURN(anc_length <= (uint) keyinfo->underflow_block_length); DBUG_RETURN(anc_length <= ((info->quick_mode ? MI_MIN_BLOCK_LENGTH :
(uint) keyinfo->underflow_block_length)));
} }
DBUG_PRINT("test",("use left page")); DBUG_PRINT("test",("use left page"));
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "myisamdef.h" #include "fulltext.h"
/* if flag == HA_PANIC_CLOSE then all misam files are closed */ /* if flag == HA_PANIC_CLOSE then all misam files are closed */
/* if flag == HA_PANIC_WRITE then all misam files are unlocked and /* if flag == HA_PANIC_WRITE then all misam files are unlocked and
...@@ -103,7 +103,10 @@ int mi_panic(enum ha_panic_function flag) ...@@ -103,7 +103,10 @@ int mi_panic(enum ha_panic_function flag)
} }
} }
if (flag == HA_PANIC_CLOSE) if (flag == HA_PANIC_CLOSE)
{
VOID(mi_log(0)); /* Close log if neaded */ VOID(mi_log(0)); /* Close log if neaded */
ft_free_stopwords();
}
pthread_mutex_unlock(&THR_LOCK_myisam); pthread_mutex_unlock(&THR_LOCK_myisam);
if (!error) if (!error)
DBUG_RETURN(0); DBUG_RETURN(0);
......
...@@ -44,7 +44,8 @@ static void copy_key(struct st_myisam_info *info,uint inx, ...@@ -44,7 +44,8 @@ static void copy_key(struct st_myisam_info *info,uint inx,
static int verbose=0,testflag=0, static int verbose=0,testflag=0,
first_key=0,async_io=0,key_cacheing=0,write_cacheing=0,locking=0, first_key=0,async_io=0,key_cacheing=0,write_cacheing=0,locking=0,
rec_pointer_size=0,pack_fields=1,use_log=0,silent=0; rec_pointer_size=0,pack_fields=1,use_log=0,silent=0,
opt_quick_mode=0;
static int pack_seg=HA_SPACE_PACK,pack_type=HA_PACK_KEY,remove_count=-1, static int pack_seg=HA_SPACE_PACK,pack_type=HA_PACK_KEY,remove_count=-1,
create_flag=0; create_flag=0;
static ulong key_cache_size=IO_SIZE*16; static ulong key_cache_size=IO_SIZE*16;
...@@ -212,6 +213,8 @@ int main(int argc, char **argv) ...@@ -212,6 +213,8 @@ int main(int argc, char **argv)
mi_lock_database(file,F_WRLCK); mi_lock_database(file,F_WRLCK);
if (write_cacheing) if (write_cacheing)
mi_extra(file,HA_EXTRA_WRITE_CACHE); mi_extra(file,HA_EXTRA_WRITE_CACHE);
if (opt_quick_mode)
mi_extra(file,HA_EXTRA_QUICK);
for (i=0 ; i < recant ; i++) for (i=0 ; i < recant ; i++)
{ {
...@@ -778,6 +781,8 @@ int main(int argc, char **argv) ...@@ -778,6 +781,8 @@ int main(int argc, char **argv)
puts("Key cacheing used"); puts("Key cacheing used");
if (write_cacheing) if (write_cacheing)
puts("Write cacheing used"); puts("Write cacheing used");
if (write_cacheing)
puts("quick mode");
if (async_io && locking) if (async_io && locking)
puts("Asyncron io with locking used"); puts("Asyncron io with locking used");
else if (locking) else if (locking)
...@@ -885,6 +890,9 @@ static void get_options(int argc, char **argv) ...@@ -885,6 +890,9 @@ static void get_options(int argc, char **argv)
case 't': case 't':
testflag=atoi(++pos); /* testmod */ testflag=atoi(++pos); /* testmod */
break; break;
case 'q':
opt_quick_mode=1;
break;
case 'c': case 'c':
create_flag|= HA_CREATE_CHECKSUM; create_flag|= HA_CREATE_CHECKSUM;
break; break;
...@@ -894,9 +902,9 @@ static void get_options(int argc, char **argv) ...@@ -894,9 +902,9 @@ static void get_options(int argc, char **argv)
case '?': case '?':
case 'I': case 'I':
case 'V': case 'V':
printf("%s Ver 1.1 for %s at %s\n",progname,SYSTEM_TYPE,MACHINE_TYPE); printf("%s Ver 1.2 for %s at %s\n",progname,SYSTEM_TYPE,MACHINE_TYPE);
puts("By Monty, for your professional use\n"); puts("By Monty, for your professional use\n");
printf("Usage: %s [-?AbBcDIKLPRSsVWltv] [-k#] [-f#] [-m#] [-t#]\n", printf("Usage: %s [-?AbBcDIKLPRqSsVWltv] [-k#] [-f#] [-m#] [-t#]\n",
progname); progname);
exit(0); exit(0);
case '#': case '#':
......
...@@ -221,7 +221,7 @@ static void usage(void) ...@@ -221,7 +221,7 @@ static void usage(void)
extreme cases as myisamchk should normally be able to\n\ extreme cases as myisamchk should normally be able to\n\
find out if the table is ok even without this switch\n\ find out if the table is ok even without this switch\n\
-F, --fast Check only tables that hasn't been closed properly\n\ -F, --fast Check only tables that hasn't been closed properly\n\
-C, --check-changed-tables\n\ -C, --check-only-changed\n\
Check only tables that has changed since last check\n\ Check only tables that has changed since last check\n\
-f, --force Restart with -r if there are any errors in the table\n\ -f, --force Restart with -r if there are any errors in the table\n\
-i, --information Print statistics information about table that is checked\n\ -i, --information Print statistics information about table that is checked\n\
......
...@@ -360,6 +360,7 @@ struct st_myisam_info { ...@@ -360,6 +360,7 @@ struct st_myisam_info {
#define MI_MAX_KEY_BLOCK_SIZE (MI_MAX_KEY_BLOCK_LENGTH/MI_KEY_BLOCK_LENGTH) #define MI_MAX_KEY_BLOCK_SIZE (MI_MAX_KEY_BLOCK_LENGTH/MI_KEY_BLOCK_LENGTH)
#define MI_BLOCK_SIZE(key_length,data_pointer,key_pointer) ((((key_length+data_pointer+key_pointer)*4+key_pointer+2)/MI_KEY_BLOCK_LENGTH+1)*MI_KEY_BLOCK_LENGTH) #define MI_BLOCK_SIZE(key_length,data_pointer,key_pointer) ((((key_length+data_pointer+key_pointer)*4+key_pointer+2)/MI_KEY_BLOCK_LENGTH+1)*MI_KEY_BLOCK_LENGTH)
#define MI_MAX_KEYPTR_SIZE 5 /* For calculating block lengths */ #define MI_MAX_KEYPTR_SIZE 5 /* For calculating block lengths */
#define MI_MIN_KEYBLOCK_LENGTH 50 /* When to split delete blocks */
/* The UNIQUE check is done with a hashed long key */ /* The UNIQUE check is done with a hashed long key */
......
...@@ -95,13 +95,14 @@ my_string fn_format(my_string to, const char *name, const char *dsk, ...@@ -95,13 +95,14 @@ my_string fn_format(my_string to, const char *name, const char *dsk,
bmove(buff,(char*) name,length); /* Save name for last copy */ bmove(buff,(char*) name,length); /* Save name for last copy */
name=buff; name=buff;
} }
(void) strmov(strnmov(strmov(to,dev),name,length),ext); pos=strnmov(strmov(to,dev),name,length);
#ifdef FN_UPPER_CASE #ifdef FN_UPPER_CASE
caseup_str(to); caseup_str(to);
#endif #endif
#ifdef FN_LOWER_CASE #ifdef FN_LOWER_CASE
casedn_str(to); casedn_str(to);
#endif #endif
(void) strmov(pos,ext); /* Don't convert extension */
} }
/* Purify gives a lot of UMR errors when using realpath */ /* Purify gives a lot of UMR errors when using realpath */
#if defined(HAVE_REALPATH) && !defined(HAVE_purify) #if defined(HAVE_REALPATH) && !defined(HAVE_purify)
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
** The following is a simple implementation of posix conditions ** The following is a simple implementation of posix conditions
*****************************************************************************/ *****************************************************************************/
#undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */
#include "mysys_priv.h" #include "mysys_priv.h"
#if defined(THREAD) && defined(__WIN__) #if defined(THREAD) && defined(__WIN__)
#include <m_string.h> #include <m_string.h>
......
...@@ -107,12 +107,17 @@ int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line) ...@@ -107,12 +107,17 @@ int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line)
abort(); abort();
} }
mp->count--; mp->count--;
#ifdef __WIN__
pthread_mutex_unlock(&mp->mutex);
error=0;
#else
error=pthread_mutex_unlock(&mp->mutex); error=pthread_mutex_unlock(&mp->mutex);
if (error) if (error)
{ {
fprintf(stderr,"safe_mutex: Got error: %d when trying to unlock mutex at %s, line %d\n", error, file, line); fprintf(stderr,"safe_mutex: Got error: %d when trying to unlock mutex at %s, line %d\n", error, file, line);
abort(); abort();
} }
#endif /* __WIN__ */
pthread_mutex_unlock(&mp->global); pthread_mutex_unlock(&mp->global);
return error; return error;
} }
...@@ -201,14 +206,23 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp, ...@@ -201,14 +206,23 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line) int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line)
{ {
int error;
if (mp->count != 0) if (mp->count != 0)
{ {
fprintf(stderr,"safe_mutex: Trying to destroy a mutex that was locked at %s, line %d at %s, line %d\n", fprintf(stderr,"safe_mutex: Trying to destroy a mutex that was locked at %s, line %d at %s, line %d\n",
mp->file,mp->line, file, line); mp->file,mp->line, file, line);
abort(); abort();
} }
#ifdef __WIN__
error=0;
pthread_mutex_destroy(&mp->global); pthread_mutex_destroy(&mp->global);
return pthread_mutex_destroy(&mp->mutex); pthread_mutex_destroy(&mp->mutex);
#else
if (pthread_mutex_destroy(&mp->global) ||
pthread_mutex_destroy(&mp->mutex))
error=1;
#endif
return error;
} }
#endif /* THREAD && SAFE_MUTEX */ #endif /* THREAD && SAFE_MUTEX */
...@@ -353,7 +353,8 @@ check_or_range("id3","select_range_key2"); ...@@ -353,7 +353,8 @@ check_or_range("id3","select_range_key2");
# Check reading on direct key on id and id3 # Check reading on direct key on id and id3
check_select_key("id","select_key_prefix"); check_select_key("id","select_key_prefix");
check_select_key("id3","select_key_key2"); check_select_key2("id","id2","select_key");
check_select_key("id3","select_key2");
#### ####
#### A lot of simple selects on ranges #### A lot of simple selects on ranges
...@@ -921,7 +922,7 @@ if (!$opt_skip_delete) ...@@ -921,7 +922,7 @@ if (!$opt_skip_delete)
} }
$end_time=new Benchmark; $end_time=new Benchmark;
print "Time for delete_big ($count): " . print "Time for delete_all ($count): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n"; timestr(timediff($end_time, $loop_time),"all") . "\n\n";
if ($opt_lock_tables) if ($opt_lock_tables)
...@@ -1113,6 +1114,7 @@ $count=0; ...@@ -1113,6 +1114,7 @@ $count=0;
for ($i=0 ; $i < 128 ; $i++) for ($i=0 ; $i < 128 ; $i++)
{ {
$count++;
$dbh->do("delete from bench1 where field1 = $i") or die $DBI::errstr; $dbh->do("delete from bench1 where field1 = $i") or die $DBI::errstr;
} }
...@@ -1258,6 +1260,38 @@ sub check_select_key ...@@ -1258,6 +1260,38 @@ sub check_select_key
timestr(timediff($end_time, $loop_time),"all") . "\n"; timestr(timediff($end_time, $loop_time),"all") . "\n";
} }
# Same as above, but select on 2 columns
sub check_select_key2
{
my ($column,$column2,$check)= @_;
my ($loop_time,$end_time,$i,$tmp_var,$tmp,$count,$row_count,$estimated);
$estimated=0;
$loop_time=new Benchmark;
$count=0;
for ($i=1 ; $i <= $opt_loop_count; $i++)
{
$count+=2;
$tmpvar^= ((($tmpvar + 63) + $i)*3 % $opt_loop_count);
$tmp=$tmpvar % ($total_rows);
fetch_all_rows($dbh,"select * from bench1 where $column=$tmp and $column2=$tmp")
or die $DBI::errstr;
$tmp+=$total_rows;
defined($row_count=fetch_all_rows($dbh,"select * from bench1 where $column=$tmp and $column2=$tmp")) or die $DBI::errstr;
die "Found $row_count rows on impossible id: $tmp\n" if ($row_count);
$end_time=new Benchmark;
last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$i,
$opt_loop_count));
}
if ($estimated)
{ print "Estimated time"; }
else
{ print "Time"; }
print " for $check ($count): " .
timestr(timediff($end_time, $loop_time),"all") . "\n";
}
# #
# Search using some very simple queries # Search using some very simple queries
# #
......
2000-09-17 Michael Widenius <monty@mysql.com>
* Added option QUICK to DELETE to tell MySQL not to balance the
trees on delete.
2000-09-15 Michael Widenius <monty@mysql.com> 2000-09-15 Michael Widenius <monty@mysql.com>
* Added a thd argument to log::write() to get more speed. * Added a thd argument to log::write() to get more speed.
......
...@@ -433,7 +433,8 @@ int ha_myisam::optimize(THD* thd, HA_CHECK_OPT *check_opt) ...@@ -433,7 +433,8 @@ int ha_myisam::optimize(THD* thd, HA_CHECK_OPT *check_opt)
param.op_name = (char*) "optimize"; param.op_name = (char*) "optimize";
param.testflag = (check_opt->flags | T_SILENT | T_FORCE_CREATE | param.testflag = (check_opt->flags | T_SILENT | T_FORCE_CREATE |
T_REP_BY_SORT | T_STATISTICS | T_SORT_INDEX); T_REP_BY_SORT | T_STATISTICS | T_SORT_INDEX);
param.opt_rep_quick++; if (check_opt->quick)
param.opt_rep_quick++;
param.sort_buffer_length= check_opt->sort_buffer_size; param.sort_buffer_length= check_opt->sort_buffer_size;
return repair(thd,param,1); return repair(thd,param,1);
} }
...@@ -456,8 +457,10 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize) ...@@ -456,8 +457,10 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
VOID(fn_format(fixed_name,file->filename,"",MI_NAME_IEXT, VOID(fn_format(fixed_name,file->filename,"",MI_NAME_IEXT,
4+ (param.opt_follow_links ? 16 : 0))); 4+ (param.opt_follow_links ? 16 : 0)));
if (!optimize || file->state->del || if (!optimize ||
share->state.split != file->state->records) ((file->state->del || share->state.split != file->state->records) &&
(!param.opt_rep_quick ||
!(share->state.changed & STATE_NOT_OPTIMIZED_KEYS))))
{ {
optimize_done=1; optimize_done=1;
if (mi_test_if_sort_rep(file,file->state->records)) if (mi_test_if_sort_rep(file,file->state->records))
...@@ -564,7 +567,7 @@ bool ha_myisam::activate_all_index(THD *thd) ...@@ -564,7 +567,7 @@ bool ha_myisam::activate_all_index(THD *thd)
myisamchk_init(&param); myisamchk_init(&param);
param.op_name = (char*) "recreating_index"; param.op_name = (char*) "recreating_index";
param.testflag = (T_SILENT | T_REP_BY_SORT | param.testflag = (T_SILENT | T_REP_BY_SORT |
T_STATISTICS | T_CREATE_MISSING_KEYS | T_TRUST_HEADER); T_CREATE_MISSING_KEYS | T_TRUST_HEADER);
param.myf_rw&= ~MY_WAIT_IF_FULL; param.myf_rw&= ~MY_WAIT_IF_FULL;
param.sort_buffer_length= myisam_sort_buffer_size; param.sort_buffer_length= myisam_sort_buffer_size;
param.opt_rep_quick++; param.opt_rep_quick++;
......
...@@ -158,9 +158,9 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg, ...@@ -158,9 +158,9 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
if (log_type == LOG_NORMAL) if (log_type == LOG_NORMAL)
{ {
#ifdef __NT__ #ifdef __NT__
fprintf( file, "%s, Version: %s, started with:\nTCP Port: %d, Named Pipe: %s\n", my_progname, server_version, mysql_port, mysql_unix_port); fprintf(file, "%s, Version: %s, started with:\nTCP Port: %d, Named Pipe: %s\n", my_progname, server_version, mysql_port, mysql_unix_port);
#else #else
fprintf(file,"%s, Version: %s, started with:\nTcp port: %d Unix socket: %s\n", my_progname,server_version,mysql_port,mysql_unix_port); fprintf(file, "%s, Version: %s, started with:\nTcp port: %d Unix socket: %s\n", my_progname,server_version,mysql_port,mysql_unix_port);
#endif #endif
fprintf(file,"Time Id Command Argument\n"); fprintf(file,"Time Id Command Argument\n");
(void) fflush(file); (void) fflush(file);
......
...@@ -156,6 +156,7 @@ void sql_element_free(void *ptr); ...@@ -156,6 +156,7 @@ void sql_element_free(void *ptr);
#define OPTION_BIN_LOG OPTION_BUFFER_RESULT*2 #define OPTION_BIN_LOG OPTION_BUFFER_RESULT*2
#define OPTION_AUTO_COMMIT OPTION_BIN_LOG*2 #define OPTION_AUTO_COMMIT OPTION_BIN_LOG*2
#define OPTION_BEGIN OPTION_AUTO_COMMIT*2 #define OPTION_BEGIN OPTION_AUTO_COMMIT*2
#define OPTION_QUICK OPTION_BEGIN*2
#define RAID_BLOCK_SIZE 1024 #define RAID_BLOCK_SIZE 1024
...@@ -324,7 +325,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table,List<Item> &fields, ...@@ -324,7 +325,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table,List<Item> &fields,
thr_lock_type lock_type); thr_lock_type lock_type);
void kill_delayed_threads(void); void kill_delayed_threads(void);
int mysql_delete(THD *thd,TABLE_LIST *table,COND *conds,ha_rows rows, int mysql_delete(THD *thd,TABLE_LIST *table,COND *conds,ha_rows rows,
thr_lock_type lock_type); thr_lock_type lock_type, ulong options);
TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update); TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update);
TABLE *open_table(THD *thd,const char *db,const char *table,const char *alias, TABLE *open_table(THD *thd,const char *db,const char *table,const char *alias,
bool *refresh); bool *refresh);
......
...@@ -26,6 +26,10 @@ ...@@ -26,6 +26,10 @@
#include <thr_alarm.h> #include <thr_alarm.h>
#include <ft_global.h> #include <ft_global.h>
#ifndef DBUG_OFF
#define ONE_THREAD
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { // Because of SCO 3.2V4.2 extern "C" { // Because of SCO 3.2V4.2
#endif #endif
...@@ -915,7 +919,7 @@ void end_thread(THD *thd, bool put_in_cache) ...@@ -915,7 +919,7 @@ void end_thread(THD *thd, bool put_in_cache)
(void) pthread_cond_broadcast(&COND_thread_count); (void) pthread_cond_broadcast(&COND_thread_count);
(void) pthread_mutex_unlock(&LOCK_thread_count); (void) pthread_mutex_unlock(&LOCK_thread_count);
DBUG_PRINT("info", ("unlocked thread_count mutex")) DBUG_PRINT("info", ("unlocked thread_count mutex"))
#ifndef DBUG_OFF #ifdef ONE_THREAD
if (!(test_flags & TEST_NO_THREADS)) // For debugging under Linux if (!(test_flags & TEST_NO_THREADS)) // For debugging under Linux
#endif #endif
{ {
...@@ -1805,7 +1809,7 @@ static void create_new_thread(THD *thd) ...@@ -1805,7 +1809,7 @@ static void create_new_thread(THD *thd)
thd->real_id=pthread_self(); // Keep purify happy thd->real_id=pthread_self(); // Keep purify happy
/* Start a new thread to handle connection */ /* Start a new thread to handle connection */
#ifndef DBUG_OFF #ifdef ONE_THREAD
if (test_flags & TEST_NO_THREADS) // For debugging under Linux if (test_flags & TEST_NO_THREADS) // For debugging under Linux
{ {
thread_cache_size=0; // Safety thread_cache_size=0; // Safety
...@@ -2256,7 +2260,7 @@ static struct option long_options[] = { ...@@ -2256,7 +2260,7 @@ static struct option long_options[] = {
{"memlock", no_argument, 0, (int) OPT_MEMLOCK}, {"memlock", no_argument, 0, (int) OPT_MEMLOCK},
{"new", no_argument, 0, 'n'}, {"new", no_argument, 0, 'n'},
{"old-protocol", no_argument, 0, 'o'}, {"old-protocol", no_argument, 0, 'o'},
#ifndef DBUG_OFF #ifdef ONE_THREAD
{"one-thread", no_argument, 0, (int) OPT_ONE_THREAD}, {"one-thread", no_argument, 0, (int) OPT_ONE_THREAD},
#endif #endif
{"pid-file", required_argument, 0, (int) OPT_PID_FILE}, {"pid-file", required_argument, 0, (int) OPT_PID_FILE},
...@@ -2509,7 +2513,7 @@ static void print_version(void) ...@@ -2509,7 +2513,7 @@ static void print_version(void)
static void use_help(void) static void use_help(void)
{ {
print_version(); print_version();
printf("Use %s --help for a list of available options\n",my_progname); printf("Use '--help' or '--no-defaults --help' for a list of available options\n");
} }
static void usage(void) static void usage(void)
...@@ -2569,7 +2573,7 @@ static void usage(void) ...@@ -2569,7 +2573,7 @@ static void usage(void)
-n, --new Use very new possible 'unsafe' functions\n\ -n, --new Use very new possible 'unsafe' functions\n\
-o, --old-protocol Use the old (3.20) protocol\n\ -o, --old-protocol Use the old (3.20) protocol\n\
-P, --port=... Port number to use for connection\n"); -P, --port=... Port number to use for connection\n");
#ifndef DBUG_OFF #ifdef ONE_THREAD
puts("\ puts("\
--one-thread Only use one thread (for debugging under Linux)\n"); --one-thread Only use one thread (for debugging under Linux)\n");
#endif #endif
......
...@@ -275,8 +275,8 @@ class THD :public ilink { ...@@ -275,8 +275,8 @@ class THD :public ilink {
~THD(); ~THD();
bool store_globals(); bool store_globals();
inline time_t query_start() { query_start_used=1; return start_time; } inline time_t query_start() { query_start_used=1; return start_time; }
inline void set_time() { if (!user_time) time(&start_time); } inline void set_time() { if (!user_time) time_after_lock=time(&start_time); }
inline void set_time(time_t t) { start_time=t; user_time=1; } inline void set_time(time_t t) { time_after_lock=start_time=t; user_time=1; }
inline void lock_time() { time(&time_after_lock); } inline void lock_time() { time(&time_after_lock); }
inline void insert_id(ulonglong id) inline void insert_id(ulonglong id)
{ last_insert_id=id; insert_id_used=1; } { last_insert_id=id; insert_id_used=1; }
......
...@@ -101,7 +101,7 @@ int generate_table(THD *thd, TABLE_LIST *table_list, ...@@ -101,7 +101,7 @@ int generate_table(THD *thd, TABLE_LIST *table_list,
int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit, int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit,
thr_lock_type lock_type) thr_lock_type lock_type, ulong options)
{ {
int error; int error;
TABLE *table; TABLE *table;
...@@ -162,6 +162,8 @@ int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit, ...@@ -162,6 +162,8 @@ int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit,
} }
(void) table->file->extra(HA_EXTRA_NO_READCHECK); (void) table->file->extra(HA_EXTRA_NO_READCHECK);
if (options & OPTION_QUICK)
(void) table->file->extra(HA_EXTRA_QUICK);
init_read_record(&info,thd,table,select,1,1); init_read_record(&info,thd,table,select,1,1);
ulong deleted=0L; ulong deleted=0L;
thd->proc_info="updating"; thd->proc_info="updating";
...@@ -188,7 +190,9 @@ int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit, ...@@ -188,7 +190,9 @@ int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit,
} }
thd->proc_info="end"; thd->proc_info="end";
end_read_record(&info); end_read_record(&info);
VOID(table->file->extra(HA_EXTRA_READCHECK)); (void) table->file->extra(HA_EXTRA_READCHECK);
if (options & OPTION_QUICK)
(void) table->file->extra(HA_EXTRA_NORMAL);
if (deleted) if (deleted)
{ {
mysql_update_log.write(thd,thd->query, thd->query_length); mysql_update_log.write(thd,thd->query, thd->query_length);
......
...@@ -394,6 +394,7 @@ pthread_handler_decl(handle_one_connection,arg) ...@@ -394,6 +394,7 @@ pthread_handler_decl(handle_one_connection,arg)
thd->client_capabilities|=CLIENT_IGNORE_SPACE; thd->client_capabilities|=CLIENT_IGNORE_SPACE;
thd->proc_info=0; // Remove 'login' thd->proc_info=0; // Remove 'login'
thd->command=COM_SLEEP;
thd->version=refresh_version; thd->version=refresh_version;
thd->set_time(); thd->set_time();
init_sql_alloc(&thd->mem_root,8192,8192); init_sql_alloc(&thd->mem_root,8192,8192);
...@@ -754,7 +755,7 @@ bool do_command(THD *thd) ...@@ -754,7 +755,7 @@ bool do_command(THD *thd)
{ {
mysql_log.write(thd,command,NullS); mysql_log.write(thd,command,NullS);
char buff[200]; char buff[200];
ulong uptime = (ulong) (time((time_t*) 0) - start_time); ulong uptime = (ulong) (thd->start_time - start_time);
sprintf((char*) buff, sprintf((char*) buff,
"Uptime: %ld Threads: %d Questions: %lu Slow queries: %ld Opens: %ld Flush tables: %ld Open tables: %d Queries per second avg: %.3f", "Uptime: %ld Threads: %d Questions: %lu Slow queries: %ld Opens: %ld Flush tables: %ld Open tables: %d Queries per second avg: %.3f",
uptime, uptime,
...@@ -813,7 +814,9 @@ bool do_command(THD *thd) ...@@ -813,7 +814,9 @@ bool do_command(THD *thd)
time_t start_of_query=thd->start_time; time_t start_of_query=thd->start_time;
thd->set_time(); thd->set_time();
if ((ulong) (thd->start_time - start_of_query) > long_query_time) /* If not reading from backup and if the query took too long */
if (!thd->user_time &&
(ulong) (thd->start_time - start_of_query) > long_query_time)
{ {
long_query_count++; long_query_count++;
mysql_slow_log.write(thd, thd->query, thd->query_length, start_of_query); mysql_slow_log.write(thd, thd->query, thd->query_length, start_of_query);
...@@ -1355,7 +1358,7 @@ mysql_execute_command(void) ...@@ -1355,7 +1358,7 @@ mysql_execute_command(void)
// Set privilege for the WHERE clause // Set privilege for the WHERE clause
tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege); tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege);
res = mysql_delete(thd,tables,lex->where,lex->select_limit, res = mysql_delete(thd,tables,lex->where,lex->select_limit,
lex->lock_option); lex->lock_option, lex->options);
#ifdef DELETE_ITEMS #ifdef DELETE_ITEMS
delete lex->where; delete lex->where;
#endif #endif
...@@ -1818,7 +1821,10 @@ check_table_access(THD *thd,uint want_access,TABLE_LIST *tables) ...@@ -1818,7 +1821,10 @@ check_table_access(THD *thd,uint want_access,TABLE_LIST *tables)
return TRUE; // Access denied return TRUE; // Access denied
} }
if (grant_option) if (grant_option)
{
want_access &= ~EXTRA_ACL; // Remove SHOW attribute
return check_grant(thd,want_access,org_tables); return check_grant(thd,want_access,org_tables);
}
return FALSE; return FALSE;
} }
......
...@@ -1015,7 +1015,11 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -1015,7 +1015,11 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
{ {
strmov(new_name_buff,new_name); strmov(new_name_buff,new_name);
fn_same(new_name_buff,table_name,3); fn_same(new_name_buff,table_name,3);
#ifdef FN_LOWER_CASE
if (!strcasecmp(new_name_buff,table_name)) // Check if name changed
#else
if (!strcmp(new_name_buff,table_name)) // Check if name changed if (!strcmp(new_name_buff,table_name)) // Check if name changed
#endif
new_name=table_name; // No. Make later check easier new_name=table_name; // No. Make later check easier
else else
{ {
......
...@@ -501,6 +501,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -501,6 +501,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
grant revoke set lock unlock string_list field_options field_option grant revoke set lock unlock string_list field_options field_option
field_opt_list opt_binary table_lock_list table_lock varchar field_opt_list opt_binary table_lock_list table_lock varchar
references opt_on_delete opt_on_delete_list opt_on_delete_item use references opt_on_delete opt_on_delete_list opt_on_delete_item use
opt_delete_options opt_delete_option
opt_outer table_list table opt_option opt_place opt_low_priority opt_outer table_list table opt_option opt_place opt_low_priority
opt_attribute opt_attribute_list attribute column_list column_list_id opt_attribute opt_attribute_list attribute column_list column_list_id
opt_column_list grant_privileges opt_table user_list grant_option opt_column_list grant_privileges opt_table user_list grant_option
...@@ -2085,10 +2086,21 @@ opt_low_priority: ...@@ -2085,10 +2086,21 @@ opt_low_priority:
/* Delete rows from a table */ /* Delete rows from a table */
delete: delete:
DELETE_SYM opt_low_priority FROM table where_clause delete_limit_clause DELETE_SYM
{ Lex->sql_command= SQLCOM_DELETE; } { Lex->sql_command= SQLCOM_DELETE; Lex->options=0;
Lex->lock_option= current_thd->update_lock_default; }
opt_delete_options FROM table
where_clause delete_limit_clause
opt_delete_options:
/* empty */ {}
| opt_delete_option opt_delete_options {}
opt_delete_option:
QUICK { Lex->options|= OPTION_QUICK; }
| LOW_PRIORITY { Lex->lock_option= TL_WRITE_LOW_PRIORITY; }
/* Show things */ /* Show things */
show: SHOW { Lex->wild=0;} show_param show: SHOW { Lex->wild=0;} show_param
......
...@@ -44,7 +44,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, ...@@ -44,7 +44,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
{ {
reg1 uint i; reg1 uint i;
reg2 uchar *strpos; reg2 uchar *strpos;
int j,flag,error; int j,error;
uint rec_buff_length,n_length,int_length,records,key_parts,keys, uint rec_buff_length,n_length,int_length,records,key_parts,keys,
interval_count,interval_parts,read_length,db_create_options; interval_count,interval_parts,read_length,db_create_options;
ulong pos; ulong pos;
...@@ -80,8 +80,8 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, ...@@ -80,8 +80,8 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
if (!outparam->real_name || !outparam->table_name) if (!outparam->real_name || !outparam->table_name)
goto err_end; goto err_end;
flag= (prgflag & CHANGE_FRM) ? O_RDWR : O_RDONLY | O_SHARE; if ((file=my_open(fn_format(index_file,name,"",reg_ext,4),
if ((file=my_open(fn_format(index_file,name,"",reg_ext,4),flag, O_RDONLY | O_SHARE,
MYF(0))) MYF(0)))
< 0) < 0)
{ {
......
...@@ -40,12 +40,10 @@ ...@@ -40,12 +40,10 @@
void bmove512(register gptr to, register const gptr from, register uint length) void bmove512(register gptr to, register const gptr from, register uint length)
{ {
reg1 LONG *f,*t; reg1 LONG *f,*t,*end= (LONG*) ((char*) from+length);
reg3 int len;
f= (LONG*) from; f= (LONG*) from;
t= (LONG*) to; t= (LONG*) to;
len= (int) length;
#if defined(m88k) || defined(sparc) || defined(HAVE_LONG_LONG) #if defined(m88k) || defined(sparc) || defined(HAVE_LONG_LONG)
do { do {
...@@ -86,7 +84,7 @@ void bmove512(register gptr to, register const gptr from, register uint length) ...@@ -86,7 +84,7 @@ void bmove512(register gptr to, register const gptr from, register uint length)
t[124]=f[124]; t[125]=f[125]; t[126]=f[126]; t[127]=f[127]; t[124]=f[124]; t[125]=f[125]; t[126]=f[126]; t[127]=f[127];
t+=128; f+=128; t+=128; f+=128;
#endif #endif
} while ((len-=512) > 0); } while (f < end);
#else #else
do { do {
*t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++;
...@@ -121,7 +119,7 @@ void bmove512(register gptr to, register const gptr from, register uint length) ...@@ -121,7 +119,7 @@ void bmove512(register gptr to, register const gptr from, register uint length)
*t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++;
*t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++;
*t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++;
} while ((len-=512) > 0); } while (f < end);
#endif #endif
return; return;
} /* bmove512 */ } /* bmove512 */
......
...@@ -45,8 +45,9 @@ do ...@@ -45,8 +45,9 @@ do
# This could easily be rewritten to gather [xxxxx]-specific entries, # This could easily be rewritten to gather [xxxxx]-specific entries,
# but for now it looks like only the mysqld ones are needed for # but for now it looks like only the mysqld ones are needed for
# server startup scripts # server startup scripts
thevar=""
eval `sed -n -e '/^$/d' -e '/^#/d' -e 's,[ ],,g' -e '/=/p' $c |\ eval `sed -n -e '/^$/d' -e '/^#/d' -e 's,[ ],,g' -e '/=/p' $c |\
# awk -F= -v v=$v '{if ($1 == v) printf ("thevar=\"%s\"\n", $2)}'` awk -F= -v v=$v '{if ($1 == v) printf ("thevar=\"%s\"\n", $2)}'`
# it would be easier if the my.cnf and variable values were # it would be easier if the my.cnf and variable values were
# all matched, but since they aren't we need to map them here. # all matched, but since they aren't we need to map them here.
......
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