diff options
36 files changed, 564 insertions, 309 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi index 365f80bd549..834782257d1 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -5467,9 +5467,10 @@ something that is of course not true. We could make things even worse by just taking the test where PostgreSQL performs worst and claim that MySQL is more than 2000 times faster than PostgreSQL. -The case is that MySQL does a lot of optimizations that PostgreSQL doesn't -do and the other way around. An SQL optimizer is a very complex thing, and -a company could spend years on just making the optimizer faster and faster. +The case is that MySQL does a lot of optimizations that PostgreSQL +doesn't do. This is of course also true the other way around. An SQL +optimizer is a very complex thing, and a company could spend years on +just making the optimizer faster and faster. When looking at the benchmark results you should look for things that you do in your application and just use these results to decide which @@ -5604,12 +5605,14 @@ MySQL with 2000 simultaneous connections doing 400 queries per second. It sounded like he was using a Linux kernel that either had some problems with many threads, such as kernels before 2.4, which had a problem -with this but we have documented how to fix this and Tim should be aware of -this problem. The other possible problem could have been an old glibc -library and that Tim didn't use a MySQL binary from our site, which is -linked with a corrected glibc library, but had compiled a version of his -own with. In any of the above cases, the symptom would have been exactly -what Tim had measured. +with many threads on multi-CPU machines. We have documented in this manual +how to fix this and Tim should be aware of this problem. + +The other possible problem could have been an old glibc library and +that Tim didn't use a MySQL binary from our site, which is linked with +a corrected glibc library, but had compiled a version of his own with. +In any of the above cases, the symptom would have been exactly what Tim +had measured. We asked Tim if we could get access to his data so that we could repeat the benchmark and if he could check the MySQL version on the machine to @@ -5618,6 +5621,16 @@ He has not done that yet. Because of this we can't put any trust in this benchmark either :( +Over time things also changes and the above benchmarks are not that +relevant anymore. MySQL now have a couple of different table handlers +with different speed/concurrency tradeoffs. @xref{Table types}. It +would be interesting to see how the above tests would run with the +different transactional table types in MySQL. PostgreSQL has of course +also got new features since the test was made. As the above test are +not publicly available there is no way for us to know how the +database would preform in the same tests today. + + Conclusion: The only benchmarks that exist today that anyone can download and run @@ -5632,15 +5645,15 @@ The thing we find strange is that every test we have seen about PostgreSQL, that is impossible to reproduce, claims that PostgreSQL is better in most cases while our tests, which anyone can reproduce, clearly shows otherwise. With this we don't want to say that PostgreSQL -isn't good at many things (it is!). We would just like to see a fair test -where they are very good so that we could get some friendly competition -going! +isn't good at many things (it is!) or that it isn't faster than MySQL +under certain conditions. We would just like to see a fair test where +they are very good so that we could get some friendly competition going! For more information about our benchmarks suite @xref{MySQL Benchmarks}. -We are working on an even better benchmark suite, including much better -documentation of what the individual tests really do, and how to add more -tests to the suite. +We are working on an even better benchmark suite, including multi user +tests, and a better documentation of what the individual tests really +do and how to add more tests to the suite. @node TODO, , Comparisons, Introduction @@ -6149,9 +6162,9 @@ Nothing; In the long run we plan to be fully ANSI 92 / ANSI 99 compliant. @menu * Quick Standard Installation:: Quick Standard Installation of MySQL * General Installation Issues:: General Installation Issues -* Installing source:: Installing a MySQL source distribution -* Post-installation:: Post-installation setup and testing -* Upgrade:: Upgrading/Downgrading MySQL +* Installing source:: Installing a MySQL source distribution +* Post-installation:: Post-installation setup and testing +* Upgrade:: Upgrading/Downgrading MySQL * Operating System Specific Notes:: Operating System Specific Notes @end menu @@ -6434,13 +6447,13 @@ Please report bad or out-of-date mirrors to @email{webmaster@@mysql.com}. @item @c Added: 990920 -@c EMAIL: <radek@sopik.cz> (Radek Libovicky) +@c EMAIL: radek@sopik.cz (Radek Libovicky) @image{Flags/czech-republic} Czech Republic [www.sopik.cz] @ @uref{http://www.mysql.cz/, WWW} @item @c Added: 000418 -@c EMAIL: <feela@ipex.cz> (Ondrej Feela Filip) +@c EMAIL: feela@ipex.cz (Ondrej Feela Filip) @image{Flags/czech-republic} Czech Republic [www.gin.cz] @ @uref{http://mysql.gin.cz/, WWW} @uref{ftp://ftp.gin.cz/pub/MIRRORS/www.mysql.com/, FTP} @@ -6448,7 +6461,7 @@ Please report bad or out-of-date mirrors to @email{webmaster@@mysql.com}. @item @c removed 991020 (no DNS entry). New name 991026. Added 991121 @c Statistics at http://mirror.borsen.dk/ -@c EMAIL: mirrorman@borsen.dk (Michael Kyed) +@c EMAIL: guru@borsen.dk (Jesper Angelo) @image{Flags/denmark} Denmark [Borsen] @ @uref{ http://mysql.borsen.dk/, WWW} @@ -6648,7 +6661,7 @@ Please report bad or out-of-date mirrors to @email{webmaster@@mysql.com}. @c @item @c Not ok 20000919; Non-existent (Matt) -@c EMAIL: Equipa de suporte do Leirianet <support@leirianet.pt> +@c EMAIL: support@leirianet.pt (Equipa de suporte do Leirianet) @c @image{Flags/portugal} Portugal [lerianet] @ @c @uref{http://mysql.leirianet.pt, WWW} @c @uref{ftp://ftp.leirianet.pt/pub/mysql/,FTP} @@ -8202,7 +8215,7 @@ If your client programs are using threads, you need to also compile a thread-safe version of the MySQL client library with the @code{--with-thread-safe-client} configure options. This will create a @code{libmysqlclient_r} library with which you should link your threaded -applications. @xref{Thread-safe clients}. +applications. @xref{Threaded clients}. @item Options that pertain to particular systems can be found in the @@ -23603,20 +23616,29 @@ Because the user could issue the @code{FLUSH LOGS} command, we need to know which log is currently active and which ones have been rotated out and in what sequence. This information is stored in the binary log index file. The default is `hostname`.index. You can use this option if you want to -be a rebel. (Example: @code{log-bin-index=db.index}) +be a rebel. + +Example: @code{log-bin-index=db.index}. @item @code{sql-bin-update-same} @tab If set, setting @code{SQL_LOG_BIN} to a value will automatically set @code{SQL_LOG_UPDATE} to the same value and vice versa. @item @code{binlog-do-db=database_name} @tab -Tells the master it should log updates for the specified database, and -exclude all others not explicitly mentioned. -(Example: @code{binlog-do-db=some_database}) +Tells the master that it should log updates to the binary log if the +current database is 'database_name'. All others database are ignored. +Note that if you use this you should ensure that you only do updates in +the current database. + +Example: @code{binlog-do-db=some_database}. @item @code{binlog-ignore-db=database_name} @tab -Tells the master that updates to the given database should not be logged -to the binary log (Example: @code{binlog-ignore-db=some_database}) +Tells the master that updates where the current database is +'database_name' should not be stored in the binary log. Note that if +you use this you should ensure that you only do updates in the current +database. + +Example: @code{binlog-ignore-db=some_database} @end multitable The following table has the options you can use for the @strong{SLAVE}: @@ -23627,65 +23649,79 @@ The following table has the options you can use for the @strong{SLAVE}: @item @code{master-host=host} @tab Master hostname or IP address for replication. If not set, the slave thread will not be started. -(Example: @code{master-host=db-master.mycompany.com}) + +Example: @code{master-host=db-master.mycompany.com}. @item @code{master-user=username} @tab The user the slave thread will us for authentication when connecting to the master. The user must have @code{FILE} privilege. If the master user -is not set, user @code{test} is assumed. (Example: -@code{master-user=scott}) +is not set, user @code{test} is assumed. + +Example: @code{master-user=scott}. @item @code{master-password=password} @tab The password the slave thread will authenticate with when connecting to -the master. If not set, an empty password is assumed. (Example: -@code{master-password=tiger}) +the master. If not set, an empty password is assumed. + +Example: @code{master-password=tiger}. @item @code{master-port=portnumber} @tab The port the master is listening on. If not set, the compiled setting of @code{MYSQL_PORT} is assumed. If you have not tinkered with -@code{configure} options, this should be 3306. (Example: -@code{master-port=3306}) +@code{configure} options, this should be 3306. + +Example: @code{master-port=3306}. @item @code{master-connect-retry=seconds} @tab The number of seconds the slave thread will sleep before retrying to connect to the master in case the master goes down or the connection is -lost. Default is 60. (Example: @code{master-connect-retry=60}) +lost. Default is 60. + +Example: @code{master-connect-retry=60}. @item @code{master-info-file=filename} @tab The location of the file that remembers where we left off on the master during the replication process. The default is master.info in the data directory. Sasha: The only reason I see for ever changing the default -is the desire to be rebelious. (Example: -@code{master-info-file=master.info}) +is the desire to be rebelious. + +Example: @code{master-info-file=master.info}. @item @code{replicate-do-table=db_name.table_name} @tab -Tells the slave thread to restrict replication to the specified database. -To specify more than one table, use the directive multiple times, -once for each table. . -(Example: @code{replicate-do-table=some_db.some_table}) +Tells the slave thread to restrict replication to the specified table. +To specify more than one table, use the directive multiple times, once +for each table. This will work for cross-database updates, in +contrast to @code{replicate-do-db}. + +Example: @code{replicate-do-table=some_db.some_table}. @item @code{replicate-ignore-table=db_name.table_name} @tab Tells the slave thread to not replicate to the specified table. To -specify more than one table to ignore, use the directive multiple -times, once for each table.(Example: -@code{replicate-ignore-table=db_name.some_table}) +specify more than one table to ignore, use the directive multiple times, +once for each table. This will work for cross-datbase updates, +in contrast to @code{replicate-ignore-db}. + +Example: @code{replicate-ignore-table=db_name.some_table}. @item @code{replicate-wild-do-table=db_name.table_name} @tab -Tells the slave thread to restrict replication to the tables that match the -specified wildcard pattern. . -To specify more than one table, use the directive multiple times, -once for each table. . -(Example: @code{replicate-do-table=foo%.bar%} will replicate only updates +Tells the slave thread to restrict replication to the tables that match +the specified wildcard pattern. To specify more than one table, use the +directive multiple times, once for each table. This will work for +cross-database updates. + +Example: @code{replicate-wild-do-table=foo%.bar%} will replicate only updates to tables in all databases that start with foo and whose table names -start with bar) +start with bar. @item @code{replicate-wild-ignore-table=db_name.table_name} @tab -Tells the slave thread to not replicate to the tables that match the given -wild card pattern. To -specify more than one table to ignore, use the directive multiple -times, once for each table.(Example: -@code{replicate-ignore-table=foo%.bar%} - will not upates to tables in all databases that start with foo and whose table names -start with bar) +Tells the slave thread to not replicate to the tables that match the +given wild card pattern. To specify more than one table to ignore, use +the directive multiple times, once for each table. This will work for +cross-database updates. + +Example: @code{replicate-wild-ignore-table=foo%.bar%} will not do updates +to tables in databases that start with foo and whose table names start +with bar. @item @code{replicate-ignore-db=database_name} @tab Tells the slave thread to not replicate to the specified database. To @@ -23693,19 +23729,21 @@ specify more than one database to ignore, use the directive multiple times, once for each database. This option will not work if you use cross database updates. If you need cross database updates to work, make sure you have 3.23.28 or later, and use -@code{replicate-wild-ignore-table=db_name.%}(Example: -@code{replicate-ignore-db=some_db}) +@code{replicate-wild-ignore-table=db_name.%} + +Example: @code{replicate-ignore-db=some_db}. @item @code{replicate-do-db=database_name} @tab -Tells the slave thread to restrict replication to the specified database. -To specify more than one database, use the directive multiple times, -once for each database. Note that this will only work if you do not use -cross-database queries such as @code{UPDATE some_db.some_table SET -foo='bar'} while having selected a different or no database. If you need -cross database updates to work, make sure -you have 3.23.28 or later, and use -@code{replicate-wild-do-table=db_name.%} -(Example: @code{replicate-do-db=some_db}) + +Tells the slave thread to restrict replication to the specified +database. To specify more than one database, use the directive multiple +times, once for each database. Note that this will only work if you do +not use cross-database queries such as @code{UPDATE some_db.some_table +SET foo='bar'} while having selected a different or no database. If you +need cross database updates to work, make sure you have 3.23.28 or +later, and use @code{replicate-wild-do-table=db_name.%} + +Example: @code{replicate-do-db=some_db}. @item @code{log-slave-updates} @tab Tells the slave to log the updates from the slave thread to the binary @@ -23713,8 +23751,9 @@ log. Off by default. You will need to turn it on if you plan to daisy-chain the slaves. @item @code{replicate-rewrite-db=from_name->to_name} @tab -Updates to a database with a different name than the original (Example: -@code{replicate-rewrite-db=master_db_name->slave_db_name} +Updates to a database with a different name than the original + +Example: @code{replicate-rewrite-db=master_db_name->slave_db_name}. @item @code{skip-slave-start} @tab Tells the slave server not to start the slave on the startup. The user @@ -32579,9 +32618,6 @@ The following conditions hold for an @code{INSERT ... SELECT} statement: @itemize @minus @item -The query cannot contain an @code{ORDER BY} clause. - -@item The target table of the @code{INSERT} statement cannot appear in the @code{FROM} clause of the @code{SELECT} part of the query because it's forbidden in ANSI SQL to @code{SELECT} from the same table into which you are @@ -38964,9 +39000,10 @@ likely it is that we can fix the problem! * C API datatypes:: C API Datatypes * C API function overview:: C API Function Overview * C API functions:: C API Function Descriptions +* C Thread functions:: * C API problems:: Common questions and problems when using the C API * Building clients:: Building Client Programs -* Thread-safe clients:: How to Make a Thread-safe Client +* Threaded clients:: How to Make a Threaded Client @end menu The C API code is distributed with MySQL. It is included in the @@ -39007,7 +39044,7 @@ the buffer associated with a connection is not decreased until the connection is closed, at which time client memory is reclaimed. For programming with threads, consult the 'how to make a thread-safe -client' chapter. @xref{Thread-safe clients}. +client' chapter. @xref{Threaded clients}. @node C API datatypes, C API function overview, C, C @@ -39455,7 +39492,7 @@ recently invoked function that can succeed or fail, allowing you to determine when an error occurred and what it was. -@node C API functions, C API problems, C API function overview, C +@node C API functions, C Thread functions, C API function overview, C @subsection C API Function Descriptions @menu @@ -40373,7 +40410,7 @@ of @code{mysql_field_count()} whether or not the statement was a @code{MYSQL_FIELD_OFFSET mysql_field_seek(MYSQL_RES *result, MYSQL_FIELD_OFFSET offset)} -* Thread-safe clients:: How to Make a Thread-safe Client +* Threaded clients:: How to Make a Threaded Client @subsubheading Description Sets the field cursor to the given offset. The next call to @@ -41650,8 +41687,71 @@ The connection to the server was lost during the query. An unknown error occurred. @end table +@node C Thread functions, C API problems, C API functions, C +@subsection C Threaded Function Descriptions + +You need to use the following functions when you want to create a +threaded client. @xref{Threaded clients}. + +@menu +* my_init:: +* my_thread_init():: +* my_thread_end():: +@end menu + +@node my_init, my_thread_init(), C Thread functions, C Thread functions +@subsubsection @code{my_init()} + +@findex @code{my_init()} + +@subsubheading Description + +This function needs to be called once in the program before calling any +MySQL function. This initializes some global variables that MySQL +needs. If you are using a thread safe client library, this will also +call @code{my_thread_init()} for this thread. + +This is automaticly called by @code{mysql_init()} +and @code{mysql_connect()}. + +@subsubheading Return Values + +none. + +@node my_thread_init(), my_thread_end(), my_init, C Thread functions +@subsubsection @code{my_thread_init()} + +@findex @code{my_thread_init()} + +@subsubheading Description + +This function needs to be called for each created thread to initialize +thread specific variables. + +This is automaticly called by @code{my_init()} and @code{mysql_connect()}. + +@subsubheading Return Values + +none. + +@node my_thread_end(), , my_thread_init(), C Thread functions +@subsubsection @code{my_thread_end()} + +@findex @code{my_thread_end()} + +@subsubheading Description + +This function needs to be called before calling @code{pthread_exit()} to +freed memory allocated by @code{my_thread_init()}. + +Note that this function is NOT invoked automaticly be the client +library! + +@subsubheading Return Values + +none. -@node C API problems, Building clients, C API functions, C +@node C API problems, Building clients, C Thread functions, C @subsection Common questions and problems when using the C API @tindex @code{mysql_query()} @@ -41806,7 +41906,7 @@ If this happens on your system, you must include the math library by adding @code{-lm} to the end of the compile/link line. -@node Building clients, Thread-safe clients, C API problems, C +@node Building clients, Threaded clients, C API problems, C @subsection Building Client Programs @cindex client programs, building @@ -41827,11 +41927,11 @@ For clients that use MySQL header files, you may need to specify a files. -@node Thread-safe clients, , Building clients, C -@subsection How to Make a Thread-safe Client +@node Threaded clients, , Building clients, C +@subsection How to Make a Threaded Client -@cindex clients, thread-safe -@cindex thread-safe clients +@cindex clients, threaded +@cindex threaded clients The client library is almost thread safe. The biggest problem is that the subroutines in @file{net.c} that read from sockets are not @@ -41846,20 +41946,21 @@ Windows binaries are by default compiled to be thread safe). Newer binary distributions should have both a normal and a thread-safe client library. -To get a really thread-safe client where you can interrupt the client -from other threads and set timeouts when talking with the MySQL -server, you should use the @code{-lmysys}, @code{-lstring}, and @code{-ldbug} -libraries and the @code{net_serv.o} code that the server uses. +To get a threaded client where you can interrupt the client from other +threads and set timeouts when talking with the MySQL server, you should +use the @code{-lmysys}, @code{-lstring}, and @code{-ldbug} libraries and +the @code{net_serv.o} code that the server uses. If you don't need interrupts or timeouts, you can just compile a thread safe client library @code{(mysqlclient_r)} and use this. @xref{C,, MySQL C API}. In this case you don't have to worry about the @code{net_serv.o} object file or the other MySQL libraries. -When using a threaded client and you want to use timeouts and interrupts, -you can make great use of the routines in the @file{thr_alarm.c} file. -If you are using routines from the @code{mysys} library, the only thing -you must remember is to call @code{my_init()} first! +When using a threaded client and you want to use timeouts and +interrupts, you can make great use of the routines in the +@file{thr_alarm.c} file. If you are using routines from the +@code{mysys} library, the only thing you must remember is to call +@code{my_init()} first! @xref{C Thread functions}. All functions except @code{mysql_real_connect()} are by default thread safe. The following notes describe how to compile a thread safe @@ -41906,11 +42007,38 @@ If you program with POSIX threads, you can use establish and release a mutex lock. @end itemize +You need to know the following if you have a thread that is calling +MySQL functions, but that thread has not created the connection to the +MySQL database: + +When you call @code{mysql_init()} or @code{mysql_connect()}, MySQL will +create a thread specific variable for the thread that is used by the +debug library (among other things). + +If you have in a thread call a MySQL function, before a thread has +called @code{mysql_init()} or @code{mysql_connect()}, the thread will +not have the necessary thread specific variables in place and you are +likely to end up with a core dump sooner or later. + +The get things to work smoothly you have to do the following: + +@enumerate +@item +Call @code{my_init()} at the start of your program if it calls +any other MySQL function before calling @code{mysql_real_connect()}. +@item +Call @code{my_thread_init()} in the thread handler before calling +any MySQL function. +@item +In the thread, call @code{my_thread_end()} before calling +@code{pthread_exit()}. This will free the memory used by MySQL thread +specific variables. +@end enumerate + You may get some errors because of undefined symbols when linking your client with @code{mysqlclient_r}. In most cases this is because you haven't included the thread libraries on the link/compile line. - @node Cplusplus, Java, C, Clients @section MySQL C++ APIs @@ -44221,34 +44349,6 @@ thread that is waiting on the disk-full condition will allow the other threads to continue. @end itemize -You need to know the following if you have a thread that is calling -MySQL functions, but that thread has not created the connection to the -MySQL database: - -When you call @code{mysql_init()} or @code{mysql_connect()}, MySQL will -create a thread specific variable for the thread that is used by the -debug library (among other things). - -If you have in a thread call a MySQL function, before a thread has -called @code{mysql_init()} or @code{mysql_connect()}, the thread will -not have the necessary thread specific variables in place and you are -likely to end up with a core dump sooner or later. - -The get things to work smoothly you have to do the following: - -@enumerate -@item -Call @code{my_init()} at the start of your program if it calls -any other MySQL function before calling @code{mysql_real_connect()}. -@item -Call @code{my_thread_init()} in the thread handler before calling -any MySQL function. -@item -In the thread, call @code{my_thread_end()} before calling -@code{pthread_exit()}. This will free the memory used by MySQL thread -specific variables. -@end enumerate - Exceptions to the above behaveour is when you use @code{REPAIR} or @code{OPTIMIZE} or when the indexes are created in a batch after an @code{LOAD DATA INFILE} or after an @code{ALTER TABLE} statement. @@ -46707,6 +46807,11 @@ not yet 100% confident in this code. @appendixsubsec Changes in release 3.23.42 @itemize @bullet @item +Fixed problem when using @code{LOCK TABLES} and @code{BDB} tables. +@item +Fixed problem with @code{REPAIR TABLE} on MyISAM tables with row lengths +between 65517 - 65520 bytes +@item Fixed rare hang when doing @code{mysqladmin shutdown} when there was a lot of activity in other threads. @item diff --git a/bdb/os_win32/os_rename.c b/bdb/os_win32/os_rename.c index c824820462c..cd53ec02022 100644 --- a/bdb/os_win32/os_rename.c +++ b/bdb/os_win32/os_rename.c @@ -47,7 +47,7 @@ __os_rename(dbenv, old, new) */ if (MoveFileEx(old, new, MOVEFILE_REPLACE_EXISTING) != TRUE) ret = __os_win32_errno(); - if (ret == ENOENT && MoveFile(old, new) == TRUE) + if ((ret == ENOENT || ret == EIO) && MoveFile(old, new) == TRUE) ret = 0; } if (ret != 0) diff --git a/configure.in b/configure.in index 121d54009f1..ddf2aa396e3 100644 --- a/configure.in +++ b/configure.in @@ -797,10 +797,8 @@ case $SYSTEM_TYPE in *darwin*) if test "$ac_cv_prog_gcc" = "yes" then - CFLAGS="$CFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS" - CXXFLAGS="$CXXFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS" - CFLAGS="$CFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE" - CXXFLAGS="$CXXFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE" + CFLAGS="$CFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ" + CXXFLAGS="$CXXFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ" MAX_C_OPTIMIZE="-O" with_named_curses="" fi diff --git a/include/dbug.h b/include/dbug.h index d86b83f4de8..3c86cbb8ac2 100644 --- a/include/dbug.h +++ b/include/dbug.h @@ -66,7 +66,7 @@ extern void _db_unlock_file(); #define DEBUGGER_ON _no_db_=0 #define DBUG_LOCK_FILE { _db_lock_file(); } #define DBUG_UNLOCK_FILE { _db_unlock_file(); } -#define DBUG_ASSERT(A) A +#define DBUG_ASSERT(A) assert(A) #else /* No debugger */ #define DBUG_ENTER(a1) diff --git a/include/my_pthread.h b/include/my_pthread.h index 33ad9ec0401..b54a94f83fc 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -146,6 +146,7 @@ int pthread_mutex_destroy (pthread_mutex_t *); #define pthread_mutex_destroy(A) DeleteCriticalSection(A) #define my_pthread_setprio(A,B) SetThreadPriority(GetCurrentThread(), (B)) #define pthread_kill(A,B) pthread_dummy(0) +#define pthread_exit(A) pthread_dummy() #endif /* OS2 */ /* Dummy defines for easier code */ diff --git a/include/raid.h b/include/raid.h index e7261bb4998..8cbd0f1a442 100644 --- a/include/raid.h +++ b/include/raid.h @@ -33,7 +33,7 @@ const char *my_raid_type(int raid_type); } #endif -#ifdef USE_RAID +#if defined(USE_RAID) && !defined(DONT_USE_RAID) #ifdef __GNUC__ #pragma interface /* gcc class implementation */ diff --git a/innobase/data/data0data.c b/innobase/data/data0data.c index 97db9d72f98..aecc56ec022 100644 --- a/innobase/data/data0data.c +++ b/innobase/data/data0data.c @@ -470,7 +470,8 @@ dtuple_convert_big_rec( } } - if (longest < BTR_EXTERN_FIELD_REF_SIZE + 10) { + if (longest < BTR_EXTERN_FIELD_REF_SIZE + 10 + + REC_1BYTE_OFFS_LIMIT) { /* Cannot shorten more */ @@ -479,26 +480,18 @@ dtuple_convert_big_rec( return(NULL); } - /* Move data from field longest_i to big rec vector, - but do not let data size of the remaining entry + /* Move data from field longest_i to big rec vector; + we do not let data size of the remaining entry drop below 128 which is the limit for the 2-byte - offset storage format in a physical record */ + offset storage format in a physical record. This + we accomplish by storing 128 bytes of data in entry + itself, and only the remaining part to big rec vec. */ dfield = dtuple_get_nth_field(entry, longest_i); vector->fields[n_fields].field_no = longest_i; - if (dtuple_get_data_size(entry) - dfield->len - <= REC_1BYTE_OFFS_LIMIT) { - vector->fields[n_fields].len = - dtuple_get_data_size(entry) + vector->fields[n_fields].len = dfield->len - REC_1BYTE_OFFS_LIMIT; - /* Since dfield will contain at least - a 20-byte reference to the extern storage, - we know that the data size of entry will be - > REC_1BYTE_OFFS_LIMIT */ - } else { - vector->fields[n_fields].len = dfield->len; - } vector->fields[n_fields].data = mem_heap_alloc(heap, vector->fields[n_fields].len); diff --git a/innobase/include/trx0trx.h b/innobase/include/trx0trx.h index fdef041e929..f179e20ad62 100644 --- a/innobase/include/trx0trx.h +++ b/innobase/include/trx0trx.h @@ -397,6 +397,8 @@ struct trx_struct{ wait_thrs; /* query threads belonging to this trx that are in the QUE_THR_LOCK_WAIT state */ + ulint deadlock_mark; /* a mark field used in deadlock + checking algorithm */ /*------------------------------*/ mem_heap_t* lock_heap; /* memory heap for the locks of the transaction; protected by diff --git a/innobase/lock/lock0lock.c b/innobase/lock/lock0lock.c index 819c559ceb4..df35e22005f 100644 --- a/innobase/lock/lock0lock.c +++ b/innobase/lock/lock0lock.c @@ -15,6 +15,10 @@ Created 5/7/1996 Heikki Tuuri #include "usr0sess.h" #include "trx0purge.h" +/* Restricts the length of search we will do in the waits-for +graph of transactions */ +#define LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK 1000000 + /* When releasing transaction locks, this specifies how often we release the kernel mutex for a moment to give also others access to it */ @@ -312,11 +316,14 @@ static ibool lock_deadlock_recursive( /*====================*/ - /* out: TRUE if a deadlock was detected */ + /* out: TRUE if a deadlock was detected + or the calculation took too long */ trx_t* start, /* in: recursion starting point */ trx_t* trx, /* in: a transaction waiting for a lock */ - lock_t* wait_lock); /* in: the lock trx is waiting to be granted */ - + lock_t* wait_lock, /* in: the lock trx is waiting to be granted */ + ulint* cost); /* in/out: number of calculation steps thus + far: if this exceeds LOCK_MAX_N_STEPS_... + we return TRUE */ /************************************************************************* Reserves the kernel mutex. This function is used in this module to allow monitoring the contention degree on the kernel mutex caused by the lock @@ -2655,12 +2662,25 @@ lock_deadlock_occurs( { dict_table_t* table; dict_index_t* index; + trx_t* mark_trx; ibool ret; + ulint cost = 0; ut_ad(trx && lock); ut_ad(mutex_own(&kernel_mutex)); - - ret = lock_deadlock_recursive(trx, trx, lock); + + /* We check that adding this trx to the waits-for graph + does not produce a cycle. First mark all active transactions + with 0: */ + + mark_trx = UT_LIST_GET_FIRST(trx_sys->trx_list); + + while (mark_trx) { + mark_trx->deadlock_mark = 0; + mark_trx = UT_LIST_GET_NEXT(trx_list, mark_trx); + } + + ret = lock_deadlock_recursive(trx, trx, lock, &cost); if (ret) { if (lock_get_type(lock) == LOCK_TABLE) { @@ -2685,10 +2705,14 @@ static ibool lock_deadlock_recursive( /*====================*/ - /* out: TRUE if a deadlock was detected */ + /* out: TRUE if a deadlock was detected + or the calculation took too long */ trx_t* start, /* in: recursion starting point */ trx_t* trx, /* in: a transaction waiting for a lock */ - lock_t* wait_lock) /* in: the lock trx is waiting to be granted */ + lock_t* wait_lock, /* in: the lock trx is waiting to be granted */ + ulint* cost) /* in/out: number of calculation steps thus + far: if this exceeds LOCK_MAX_N_STEPS_... + we return TRUE */ { lock_t* lock; ulint bit_no; @@ -2697,6 +2721,20 @@ lock_deadlock_recursive( ut_a(trx && start && wait_lock); ut_ad(mutex_own(&kernel_mutex)); + if (trx->deadlock_mark == 1) { + /* We have already exhaustively searched the subtree starting + from this trx */ + + return(FALSE); + } + + *cost = *cost + 1; + + if (*cost > LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK) { + + return(TRUE); + } + lock = wait_lock; if (lock_get_type(wait_lock) == LOCK_REC) { @@ -2719,6 +2757,8 @@ lock_deadlock_recursive( } if (lock == NULL) { + /* We can mark this subtree as searched */ + trx->deadlock_mark = 1; return(FALSE); } @@ -2742,7 +2782,7 @@ lock_deadlock_recursive( a lock */ if (lock_deadlock_recursive(start, lock_trx, - lock_trx->wait_lock)) { + lock_trx->wait_lock, cost)) { return(TRUE); } diff --git a/libmysql/Makefile.am b/libmysql/Makefile.am index baf40a389a3..01cc438a72b 100644 --- a/libmysql/Makefile.am +++ b/libmysql/Makefile.am @@ -18,7 +18,7 @@ # This file is public domain and comes with NO WARRANTY of any kind target = libmysqlclient.la -target_defs = -DUNDEF_THREADS_HACK +target_defs = -DUNDEF_THREADS_HACK -DDONT_USE_RAID LIBS = @CLIENT_LIBS@ INCLUDES = -I$(srcdir)/../include -I../include \ -I$(srcdir)/.. -I$(top_srcdir) -I.. diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 469331641c8..0cb6170b25c 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -15,7 +15,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#define DONT_USE_RAID #include <global.h> #if defined(__WIN__) || defined(_WIN32) || defined(_WIN64) #include <winsock.h> diff --git a/libmysql_r/Makefile.am b/libmysql_r/Makefile.am index 110e26797bd..92ff5151ad0 100644 --- a/libmysql_r/Makefile.am +++ b/libmysql_r/Makefile.am @@ -18,7 +18,7 @@ target = libmysqlclient_r.la -target_defs = +target_defs = -DDONT_USE_RAID ## LIBS = @LIBS@ INCLUDES = @MT_INCLUDES@ -I$(srcdir)/../include -I../include \ diff --git a/myisam/mi_check.c b/myisam/mi_check.c index 587f90e0929..aedea3ca78b 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -2480,7 +2480,7 @@ int sort_write_record(SORT_INFO *sort_info) info->checksum=mi_checksum(info,sort_info->record); reclength=_mi_rec_pack(info,from,sort_info->record); info->s->state.checksum+=info->checksum; - block_length=reclength+ 3 +test(reclength > 65532L); + block_length=reclength+ 3 + test(reclength >= (65520-3)); if (block_length < share->base.min_block_length) block_length=share->base.min_block_length; flag=0; diff --git a/myisam/mi_dynrec.c b/myisam/mi_dynrec.c index e090498f3fe..c9fe493744d 100644 --- a/myisam/mi_dynrec.c +++ b/myisam/mi_dynrec.c @@ -178,7 +178,7 @@ static int _mi_find_writepos(MI_INFO *info, { /* No deleted blocks; Allocate a new block */ *filepos=info->state->data_file_length; - if ((*length=reclength+3 + test(reclength > 65520)) < + if ((*length=reclength+3 + test(reclength >= (65520-3))) < info->s->base.min_block_length) *length=info->s->base.min_block_length; else diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result index 39b4962ef58..e66ca657484 100644 --- a/mysql-test/r/bdb.result +++ b/mysql-test/r/bdb.result @@ -524,3 +524,6 @@ a b a b a b 1 1 1 2 +id id2 id3 dummy1 +id id2 id3 dummy1 +NULL NULL NULL NULL diff --git a/mysql-test/r/isam.result b/mysql-test/r/isam.result new file mode 100644 index 00000000000..ba12ca05feb --- /dev/null +++ b/mysql-test/r/isam.result @@ -0,0 +1,10 @@ +Table Op Msg_type Msg_text +test.t1 check status OK +Table Op Msg_type Msg_text +test.t1 repair status OK +Table Op Msg_type Msg_text +test.t1 check status OK +Table Op Msg_type Msg_text +test.t1 repair status OK +Table Op Msg_type Msg_text +test.t1 check status OK diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 694d7429a14..1152ca24f38 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -1,2 +1,12 @@ Table Op Msg_type Msg_text test.t1 check status OK +Table Op Msg_type Msg_text +test.t1 check status OK +Table Op Msg_type Msg_text +test.t1 repair status OK +Table Op Msg_type Msg_text +test.t1 check status OK +Table Op Msg_type Msg_text +test.t1 repair status OK +Table Op Msg_type Msg_text +test.t1 check status OK diff --git a/mysql-test/t/bdb.test b/mysql-test/t/bdb.test index 5e28c31e051..465dc9634cc 100644 --- a/mysql-test/t/bdb.test +++ b/mysql-test/t/bdb.test @@ -727,13 +727,24 @@ DROP TABLE t1,t2; # Test problem with joining table to itself on a multi-part unique key # -drop table if exists t; -create table t (a int(11) not null, b int(11) not null, unique (a,b)) type=bdb; - -insert into t values (1,1), (1,2); +drop table if exists t1; +create table t1 (a int(11) not null, b int(11) not null, unique (a,b)) type=bdb; +insert into t1 values (1,1), (1,2); +select * from t1 where a = 1; +select t1.*, t2.* from t1, t1 t2 where t1.a = t2.a and t2.a = 1; +select * from t1 where a = 1; +drop table t1; -select * from t where a = 1; -select t1.*, t2.* from t t1, t t2 where t1.a = t2.a and t2.a = 1; -select * from t where a = 1; +# +# This caused a deadlock in BDB internal locks +# -drop table t; +create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=bdb; +insert into t1 values (0,0,0,'ABCDEFGHIJ'); +create table t2 (id int NOT NULL,primary key (id)) type=bdb; +LOCK TABLES t1 WRITE, t2 WRITE; +insert into t2 values(1); +SELECT t1.* FROM t1 WHERE id IN (1); +SELECT t1.* FROM t2 left outer join t1 on (t1.id=t2.id); +delete from t1 where id3 >= 0 and id3 <= 0; +drop table t1,t2; diff --git a/mysql-test/t/isam.test b/mysql-test/t/isam.test new file mode 100644 index 00000000000..1cf068b42ba --- /dev/null +++ b/mysql-test/t/isam.test @@ -0,0 +1,19 @@ +# +# Test possible problem with rows that are about 65535 bytes long +# + +create table t1 (a tinyint not null auto_increment, b blob not null, primary key (a)); + +let $1=100; +while ($1) +{ + eval insert into t1 (b) values(repeat(char(65+$1),65540-$1)); + dec $1; +} +check table t1; +repair table t1; +delete from t1 where (a & 1); +check table t1; +repair table t1; +check table t1; +drop table t1; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 84feb5de6d7..0dc7f84efc5 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -16,3 +16,23 @@ INSERT INTO t1 VALUES ('HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH INSERT INTO t1 VALUES ('WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW'); CHECK TABLE t1; drop table t1; + +# +# Test problem with rows that are 65517-65520 bytes long +# + +create table t1 (a tinyint not null auto_increment, b blob not null, primary key (a)); + +let $1=100; +while ($1) +{ + eval insert into t1 (b) values(repeat(char(65+$1),65550-$1)); + dec $1; +} +check table t1; +repair table t1; +delete from t1 where (a & 1); +check table t1; +repair table t1; +check table t1; +drop table t1; diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c index d2b3960d6b5..10c803378df 100644 --- a/mysys/thr_lock.c +++ b/mysys/thr_lock.c @@ -736,7 +736,7 @@ void thr_unlock(THR_LOCK_DATA *data) data->type == TL_WRITE_ALLOW_WRITE)); else { - DBUG_PRINT("lock",("No locks to free")); + DBUG_PRINT("lock",("No waiting read locks to free")); } } else if (data && diff --git a/sql-bench/test-create.sh b/sql-bench/test-create.sh index 09d79c67b04..2853984e393 100644 --- a/sql-bench/test-create.sh +++ b/sql-bench/test-create.sh @@ -39,13 +39,21 @@ $opt_loop_count=10000; # Change this to make test harder/easier chomp($pwd = `pwd`); $pwd = "." if ($pwd eq ''); require "$pwd/bench-init.pl" || die "Can't read Configuration file: $!\n"; +$create_loop_count=$opt_loop_count; if ($opt_small_test) { $opt_loop_count/=100; + $create_loop_count/=1000; } $max_tables=min($limits->{'max_tables'},$opt_loop_count); +if ($opt_small_test) +{ + $max_tables=10; +} + + print "Testing the speed of creating and droping tables\n"; print "Testing with $max_tables tables and $opt_loop_count loop count\n\n"; @@ -177,7 +185,7 @@ print "Testing create+drop\n"; $loop_time=new Benchmark; -for ($i=1 ; $i <= $opt_loop_count ; $i++) +for ($i=1 ; $i <= $create_loop_count ; $i++) { do_many($dbh,$server->create("bench_$i", ["i int NOT NULL", @@ -190,7 +198,7 @@ for ($i=1 ; $i <= $opt_loop_count ; $i++) } $end_time=new Benchmark; -print "Time for create+drop ($opt_loop_count): " . +print "Time for create+drop ($create_loop_count): " . timestr(timediff($end_time, $loop_time),"all") . "\n"; if ($opt_fast && defined($server->{vacuum})) diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 25f8148e52f..9a437607729 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -1181,9 +1181,11 @@ int ha_berkeley::remove_key(DB_TXN *trans, uint keynr, const byte *record, DBUG_ENTER("remove_key"); DBUG_PRINT("enter",("index: %d",keynr)); - if (keynr == primary_key || - ((table->key_info[keynr].flags & (HA_NOSAME | HA_NULL_PART_KEY)) == - HA_NOSAME)) + if (keynr == active_index && cursor) + error=cursor->c_del(cursor,0); + else if (keynr == primary_key || + ((table->key_info[keynr].flags & (HA_NOSAME | HA_NULL_PART_KEY)) == + HA_NOSAME)) { // Unique key dbug_assert(keynr == primary_key || prim_key->data != key_buff2); error=key_file[keynr]->del(key_file[keynr], trans, @@ -1304,7 +1306,7 @@ int ha_berkeley::delete_row(const byte * record) int ha_berkeley::index_init(uint keynr) { int error; - DBUG_ENTER("index_init"); + DBUG_ENTER("ha_berkeley::index_init"); DBUG_PRINT("enter",("table: '%s' key: %d", table->real_name, keynr)); /* @@ -1312,7 +1314,10 @@ int ha_berkeley::index_init(uint keynr) an active cursor at this point */ if (cursor) + { + DBUG_PRINT("note",("Closing active cursor")); cursor->c_close(cursor); + } active_index=keynr; if ((error=key_file[keynr]->cursor(key_file[keynr], transaction, &cursor, table->reginfo.lock_type > @@ -1342,7 +1347,7 @@ int ha_berkeley::index_end() int ha_berkeley::read_row(int error, char *buf, uint keynr, DBT *row, DBT *found_key, bool read_next) { - DBUG_ENTER("read_row"); + DBUG_ENTER("ha_berkeley::read_row"); if (error) { if (error == DB_NOTFOUND || error == DB_KEYEMPTY) @@ -1394,6 +1399,7 @@ int ha_berkeley::index_read_idx(byte * buf, uint keynr, const byte * key, statistic_increment(ha_read_key_count,&LOCK_status); DBUG_ENTER("index_read_idx"); current_row.flags=DB_DBT_REALLOC; + active_index= -1; DBUG_RETURN(read_row(key_file[keynr]->get(key_file[keynr], transaction, pack_key(&last_key, keynr, key_buff, key, key_len), @@ -1408,7 +1414,7 @@ int ha_berkeley::index_read(byte * buf, const byte * key, DBT row; int error; KEY *key_info= &table->key_info[active_index]; - DBUG_ENTER("index_read"); + DBUG_ENTER("ha_berkeley::index_read"); statistic_increment(ha_read_key_count,&LOCK_status); bzero((char*) &row,sizeof(row)); @@ -1513,8 +1519,9 @@ int ha_berkeley::index_last(byte * buf) int ha_berkeley::rnd_init(bool scan) { + DBUG_ENTER("rnd_init"); current_row.flags=DB_DBT_REALLOC; - return index_init(primary_key); + DBUG_RETURN(index_init(primary_key)); } int ha_berkeley::rnd_end() @@ -1529,7 +1536,7 @@ int ha_berkeley::rnd_next(byte *buf) statistic_increment(ha_read_rnd_next_count,&LOCK_status); bzero((char*) &row,sizeof(row)); DBUG_RETURN(read_row(cursor->c_get(cursor, &last_key, &row, DB_NEXT), - (char*) buf, active_index, &row, &last_key, 1)); + (char*) buf, primary_key, &row, &last_key, 1)); } @@ -1559,10 +1566,11 @@ int ha_berkeley::rnd_pos(byte * buf, byte *pos) DBT db_pos; statistic_increment(ha_read_rnd_count,&LOCK_status); + active_index= (uint) -1; // Don't delete via cursor return read_row(file->get(file, transaction, get_pos(&db_pos, pos), ¤t_row, 0), - (char*) buf, active_index, ¤t_row, (DBT*) 0, 0); + (char*) buf, primary_key, ¤t_row, (DBT*) 0, 0); } void ha_berkeley::position(const byte *record) @@ -1577,10 +1585,10 @@ void ha_berkeley::position(const byte *record) void ha_berkeley::info(uint flag) { - DBUG_ENTER("info"); + DBUG_ENTER("ha_berkeley::info"); if (flag & HA_STATUS_VARIABLE) { - records = share->rows; // Just to get optimisations right + records = share->rows + changed_rows; // Just to get optimisations right deleted = 0; } if ((flag & HA_STATUS_CONST) || version != share->version) @@ -1658,12 +1666,15 @@ int ha_berkeley::external_lock(THD *thd, int lock_type) { if (!thd->transaction.bdb_lock_count++) { + DBUG_ASSERT(thd->transaction.stmt.bdb_tid == 0); + transaction=0; // Safety /* First table lock, start transaction */ - if ((thd->options & (OPTION_NOT_AUTO_COMMIT | OPTION_BEGIN)) && + if ((thd->options & (OPTION_NOT_AUTO_COMMIT | OPTION_BEGIN | + OPTION_TABLE_LOCK)) && !thd->transaction.all.bdb_tid) { /* We have to start a master transaction */ - DBUG_PRINT("trans",("starting transaction")); + DBUG_PRINT("trans",("starting transaction all")); if ((error=txn_begin(db_env, 0, (DB_TXN**) &thd->transaction.all.bdb_tid, 0))) @@ -1671,8 +1682,10 @@ int ha_berkeley::external_lock(THD *thd, int lock_type) thd->transaction.bdb_lock_count--; // We didn't get the lock /* purecov: inspected */ DBUG_RETURN(error); /* purecov: inspected */ } + if (thd->in_lock_tables) + DBUG_RETURN(0); // Don't create stmt trans } - DBUG_PRINT("trans",("starting transaction for statement")); + DBUG_PRINT("trans",("starting transaction stmt")); if ((error=txn_begin(db_env, (DB_TXN*) thd->transaction.all.bdb_tid, (DB_TXN**) &thd->transaction.stmt.bdb_tid, @@ -1684,12 +1697,12 @@ int ha_berkeley::external_lock(THD *thd, int lock_type) } } transaction= (DB_TXN*) thd->transaction.stmt.bdb_tid; - changed_rows=0; } else { lock.type=TL_UNLOCK; // Unlocked thread_safe_add(share->rows, changed_rows, &share->mutex); + changed_rows=0; if (!--thd->transaction.bdb_lock_count) { if (thd->transaction.stmt.bdb_tid) @@ -1722,11 +1735,12 @@ int ha_berkeley::start_stmt(THD *thd) DBUG_ENTER("ha_berkeley::start_stmt"); if (!thd->transaction.stmt.bdb_tid) { + DBUG_PRINT("trans",("starting transaction stmt")); error=txn_begin(db_env, (DB_TXN*) thd->transaction.all.bdb_tid, (DB_TXN**) &thd->transaction.stmt.bdb_tid, 0); - transaction= (DB_TXN*) thd->transaction.stmt.bdb_tid; } + transaction= (DB_TXN*) thd->transaction.stmt.bdb_tid; DBUG_RETURN(error); } @@ -1931,6 +1945,8 @@ longlong ha_berkeley::get_auto_increment() longlong nr=1; // Default if error or new key int error; (void) ha_berkeley::extra(HA_EXTRA_KEYREAD); + + /* Set 'active_index' */ ha_berkeley::index_init(table->next_number_index); if (!table->next_number_key_offset) diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h index 3eb793937ae..fda7d2f2069 100644 --- a/sql/ha_berkeley.h +++ b/sql/ha_berkeley.h @@ -93,7 +93,7 @@ class ha_berkeley: public handler HA_BLOB_KEY | HA_NOT_EXACT_COUNT | HA_PRIMARY_KEY_IN_READ_INDEX | HA_DROP_BEFORE_CREATE | HA_AUTO_PART_KEY), - last_dup_key((uint) -1),version(0),using_ignore(0) + changed_rows(0),last_dup_key((uint) -1),version(0),using_ignore(0) { } ~ha_berkeley() {} diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index 2eed5ada680..104aaf8886c 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -21,7 +21,7 @@ InnoDB */ - Ask Monty if strings of different languages can exist in the same database. Answer: in near future yes, but not yet. */ - + #ifdef __GNUC__ #pragma implementation // gcc: Class implementation #endif @@ -2844,7 +2844,7 @@ ha_innobase::info( if (records == 0) { mean_rec_length = 0; } else { - mean_rec_length = (ulong) data_file_length / records; + mean_rec_length = (ulong) (data_file_length / records); } } diff --git a/sql/handler.cc b/sql/handler.cc index bb17d8f2331..1c50634de1f 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -52,7 +52,7 @@ ulong ha_read_count, ha_write_count, ha_delete_count, ha_update_count, const char *ha_table_type[] = { "", "DIAB_ISAM","HASH","MISAM","PISAM","RMS_ISAM","HEAP", "ISAM", - "MRG_ISAM","MYISAM", "MRG_MYISAM", "BDB", "INNOBASE", "GEMINI", "?", "?",NullS + "MRG_ISAM","MYISAM", "MRG_MYISAM", "BDB", "INNODB", "GEMINI", "?", "?",NullS }; TYPELIB ha_table_typelib= {array_elements(ha_table_type)-4,"", @@ -837,8 +837,15 @@ int ha_create_table(const char *name, HA_CREATE_INFO *create_info, } error=table.file->create(name,&table,create_info); VOID(closefrm(&table)); - if (error) - my_error(ER_CANT_CREATE_TABLE,MYF(ME_BELL+ME_WAITTANG),name,my_errno); + if (error) { + if (table.db_type == DB_TYPE_INNOBASE) { + /* Creation of InnoDB table cannot fail because of an OS error: + put error as the number */ + my_error(ER_CANT_CREATE_TABLE,MYF(ME_BELL+ME_WAITTANG),name,error); + } else { + my_error(ER_CANT_CREATE_TABLE,MYF(ME_BELL+ME_WAITTANG),name,my_errno); + } + } DBUG_RETURN(error != 0); } diff --git a/sql/lock.cc b/sql/lock.cc index a8b26c3b17d..aa06822e03f 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -169,8 +169,10 @@ static int lock_external(TABLE **tables,uint count) void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock) { DBUG_ENTER("mysql_unlock_tables"); - thr_multi_unlock(sql_lock->locks,sql_lock->lock_count); - VOID(unlock_external(thd,sql_lock->table,sql_lock->table_count)); + if (sql_lock->lock_count) + thr_multi_unlock(sql_lock->locks,sql_lock->lock_count); + if (sql_lock->table_count) + VOID(unlock_external(thd,sql_lock->table,sql_lock->table_count)); my_free((gptr) sql_lock,MYF(0)); DBUG_VOID_RETURN; } @@ -213,7 +215,7 @@ void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock) if (i != found) { thr_multi_unlock(lock,i-found); - sql_lock->lock_count-=found; + sql_lock->lock_count= found; } /* Then to the same for the external locks */ @@ -232,7 +234,7 @@ void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock) if (i != found) { VOID(unlock_external(thd,table,i-found)); - sql_lock->table_count-=found; + sql_lock->table_count=found; } DBUG_VOID_RETURN; } @@ -314,7 +316,7 @@ static int unlock_external(THD *thd, TABLE **table,uint count) DBUG_ENTER("unlock_external"); error_code=0; - for (; count-- ; table++) + do { if ((*table)->current_lock != F_UNLCK) { @@ -322,7 +324,8 @@ static int unlock_external(THD *thd, TABLE **table,uint count) if ((error=(*table)->file->external_lock(thd, F_UNLCK))) error_code=error; } - } + table++; + } while (--count); if (error_code) print_lock_error(error_code); DBUG_RETURN(error_code); diff --git a/sql/log_event.cc b/sql/log_event.cc index 6e99e031f4a..521e0f7765f 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -272,24 +272,24 @@ void Log_event::print_header(FILE* file) void Log_event::print_timestamp(FILE* file, time_t* ts) { - struct tm tm_tmp; + struct tm tm_tmp, *res; if (!ts) { ts = &when; } #ifdef MYSQL_SERVER - localtime_r(ts,&tm_tmp); + localtime_r(ts,(res= &tm_tmp)); #else - localtime(ts); + res=localtime(ts); #endif fprintf(file,"%02d%02d%02d %2d:%02d:%02d", - tm_tmp.tm_year % 100, - tm_tmp.tm_mon+1, - tm_tmp.tm_mday, - tm_tmp.tm_hour, - tm_tmp.tm_min, - tm_tmp.tm_sec); + res->tm_year % 100, + res->tm_mon+1, + res->tm_mday, + res->tm_hour, + res->tm_min, + res->tm_sec); } diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 06d0b1528f4..841d76928e1 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -163,7 +163,8 @@ void kill_one_thread(THD *thd, ulong id); #define OPTION_BIN_LOG OPTION_BUFFER_RESULT*2 #define OPTION_NOT_AUTO_COMMIT OPTION_BIN_LOG*2 #define OPTION_BEGIN OPTION_NOT_AUTO_COMMIT*2 -#define OPTION_QUICK OPTION_BEGIN*2 +#define OPTION_TABLE_LOCK OPTION_BEGIN*2 +#define OPTION_QUICK OPTION_TABLE_LOCK*2 #define OPTION_QUOTE_SHOW_CREATE OPTION_QUICK*2 #define OPTION_INTERNAL_SUBTRANSACTIONS OPTION_QUOTE_SHOW_CREATE*2 diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 7d6863cb6eb..b7cd101695a 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -636,9 +636,7 @@ static void __cdecl kill_server(int sig_ptr) unireg_abort(1); /* purecov: inspected */ else unireg_end(0); -#ifndef OS2 pthread_exit(0); /* purecov: deadcode */ -#endif RETURN_FROM_KILL_SERVER; } @@ -670,9 +668,7 @@ static sig_handler print_signal_warning(int sig) void unireg_end(int signal_number __attribute__((unused))) { clean_up(); -#ifndef OS2 pthread_exit(0); // Exit is in main thread -#endif } diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 16495ab03b0..624377b688e 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -413,7 +413,10 @@ void close_thread_tables(THD *thd, bool locked) DBUG_ENTER("close_thread_tables"); if (thd->locked_tables) + { + ha_commit_stmt(thd); // If select statement DBUG_VOID_RETURN; // LOCK TABLES in use + } TABLE *table,*next; bool found_old_table=0; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 417484b2ef7..18ab3c45359 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -81,7 +81,8 @@ static void init_signals(void) inline bool end_active_trans(THD *thd) { int error=0; - if (thd->options & (OPTION_NOT_AUTO_COMMIT | OPTION_BEGIN)) + if (thd->options & (OPTION_NOT_AUTO_COMMIT | OPTION_BEGIN | + OPTION_TABLE_LOCK)) { thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE); thd->server_status&= ~SERVER_STATUS_IN_TRANS; @@ -1825,7 +1826,11 @@ mysql_execute_command(void) { thd->lock=thd->locked_tables; thd->locked_tables=0; // Will be automaticly closed + } + if (thd->options & OPTION_TABLE_LOCK) + { end_active_trans(thd); + thd->options&= ~(ulong) (OPTION_TABLE_LOCK); } if (thd->global_read_lock) { @@ -1847,12 +1852,15 @@ mysql_execute_command(void) if (check_db_used(thd,tables) || end_active_trans(thd)) goto error; thd->in_lock_tables=1; + thd->options|= OPTION_TABLE_LOCK; if (!(res=open_and_lock_tables(thd,tables))) { thd->locked_tables=thd->lock; thd->lock=0; send_ok(&thd->net); } + else + thd->options&= ~(ulong) (OPTION_TABLE_LOCK); thd->in_lock_tables=0; break; case SQLCOM_CREATE_DB: diff --git a/sql/sql_select.cc b/sql/sql_select.cc index b30cb6bb639..b6c261d1463 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2516,6 +2516,7 @@ static void join_free(JOIN *join) { JOIN_TAB *tab,*end; + DBUG_ENTER("join_free"); if (join->table) { @@ -2556,6 +2557,7 @@ join_free(JOIN *join) join->tmp_table_param.copy_funcs.delete_elements(); delete [] join->tmp_table_param.copy_field; join->tmp_table_param.copy_field=0; + DBUG_VOID_RETURN; } diff --git a/sql/violite.c b/sql/violite.c index 0d96c71969c..d551b9b8632 100644 --- a/sql/violite.c +++ b/sql/violite.c @@ -154,7 +154,7 @@ int vio_read(Vio * vio, gptr buf, int size) { int r; DBUG_ENTER("vio_read"); - DBUG_PRINT("enter", ("sd=%d, buf=%p, size=%d", vio->sd, buf, size)); + DBUG_PRINT("enter", ("sd=%d size=%d", vio->sd, size)); #if defined( __WIN__) || defined(OS2) if (vio->type == VIO_TYPE_NAMEDPIPE) { @@ -188,7 +188,7 @@ int vio_write(Vio * vio, const gptr buf, int size) { int r; DBUG_ENTER("vio_write"); - DBUG_PRINT("enter", ("sd=%d, buf=%p, size=%d", vio->sd, buf, size)); + DBUG_PRINT("enter", ("sd=%d size=%d", vio->sd, size)); #if defined( __WIN__) || defined(OS2) if ( vio->type == VIO_TYPE_NAMEDPIPE) { @@ -303,7 +303,7 @@ int vio_keepalive(Vio* vio, my_bool set_keep_alive) int r=0; uint opt = 0; DBUG_ENTER("vio_keepalive"); - DBUG_PRINT("enter", ("sd=%d, set_keep_alive=%d", vio->sd, (int) + DBUG_PRINT("enter", ("sd=%d set_keep_alive=%d", vio->sd, (int) set_keep_alive)); if (vio->type != VIO_TYPE_NAMEDPIPE) { diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c index 13d4513ce2d..df6f8c496bc 100644 --- a/strings/ctype-euc_kr.c +++ b/strings/ctype-euc_kr.c @@ -85,22 +85,22 @@ uchar NEAR to_lower_euc_kr[]= 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', '\177', - '\200','\201','\202','\203','\204','\205','\206','\207', - '\210','\211','\212','\213','\214','\215','\216','\217', - '\220','\221','\222','\223','\224','\225','\226','\227', - '\230','\231','\232','\233','\234','\235','\236','\237', - '\240','\241','\242','\243','\244','\245','\246','\247', - '\250','\251','\252','\253','\254','\255','\256','\257', - '\260','\261','\262','\263','\264','\265','\266','\267', - '\270','\271','\272','\273','\274','\275','\276','\277', - '\300','\301','\302','\303','\304','\305','\306','\307', - '\310','\311','\312','\313','\314','\315','\316','\317', - '\320','\321','\322','\323','\324','\325','\326','\327', - '\330','\331','\332','\333','\334','\335','\336','\337', - '\340','\341','\342','\343','\344','\345','\346','\347', - '\350','\351','\352','\353','\354','\355','\356','\357', - '\360','\361','\362','\363','\364','\365','\366','\367', - '\370','\371','\372','\373','\374','\375','\376','\377', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; uchar NEAR to_upper_euc_kr[]= @@ -121,22 +121,22 @@ uchar NEAR to_upper_euc_kr[]= 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '~', '\177', - '\200','\201','\202','\203','\204','\205','\206','\207', - '\210','\211','\212','\213','\214','\215','\216','\217', - '\220','\221','\222','\223','\224','\225','\226','\227', - '\230','\231','\232','\233','\234','\235','\236','\237', - '\240','\241','\242','\243','\244','\245','\246','\247', - '\250','\251','\252','\253','\254','\255','\256','\257', - '\260','\261','\262','\263','\264','\265','\266','\267', - '\270','\271','\272','\273','\274','\275','\276','\277', - '\300','\301','\302','\303','\304','\305','\306','\307', - '\310','\311','\312','\313','\314','\315','\316','\317', - '\320','\321','\322','\323','\324','\325','\326','\327', - '\330','\331','\332','\333','\334','\335','\336','\337', - '\340','\341','\342','\343','\344','\345','\346','\347', - '\350','\351','\352','\353','\354','\355','\356','\357', - '\360','\361','\362','\363','\364','\365','\366','\367', - '\370','\371','\372','\373','\374','\375','\376','\377', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; uchar NEAR sort_order_euc_kr[]= @@ -157,22 +157,22 @@ uchar NEAR sort_order_euc_kr[]= 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '~', '\177', - '\200','\201','\202','\203','\204','\205','\206','\207', - '\210','\211','\212','\213','\214','\215','\216','\217', - '\220','\221','\222','\223','\224','\225','\226','\227', - '\230','\231','\232','\233','\234','\235','\236','\237', - '\240','\241','\242','\243','\244','\245','\246','\247', - '\250','\251','\252','\253','\254','\255','\256','\257', - '\260','\261','\262','\263','\264','\265','\266','\267', - '\270','\271','\272','\273','\274','\275','\276','\277', - '\300','\301','\302','\303','\304','\305','\306','\307', - '\310','\311','\312','\313','\314','\315','\316','\317', - '\320','\321','\322','\323','\324','\325','\326','\327', - '\330','\331','\332','\333','\334','\335','\336','\337', - '\340','\341','\342','\343','\344','\345','\346','\347', - '\350','\351','\352','\353','\354','\355','\356','\357', - '\360','\361','\362','\363','\364','\365','\366','\367', - '\370','\371','\372','\373','\374','\375','\376','\377', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; /* Support for Korean(EUC_KR) characters, by powerm90@tinc.co.kr and mrpark@tinc.co.kr */ diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index 566271be845..9f23d69eb12 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -85,22 +85,22 @@ uchar NEAR to_lower_sjis[]= 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', '\177', - '\200','\201','\202','\203','\204','\205','\206','\207', - '\210','\211','\212','\213','\214','\215','\216','\217', - '\220','\221','\222','\223','\224','\225','\226','\227', - '\230','\231','\232','\233','\234','\235','\236','\237', - '\240','\241','\242','\243','\244','\245','\246','\247', - '\250','\251','\252','\253','\254','\255','\256','\257', - '\260','\261','\262','\263','\264','\265','\266','\267', - '\270','\271','\272','\273','\274','\275','\276','\277', - '\300','\301','\302','\303','\304','\305','\306','\307', - '\310','\311','\312','\313','\314','\315','\316','\317', - '\320','\321','\322','\323','\324','\325','\326','\327', - '\330','\331','\332','\333','\334','\335','\336','\337', - '\340','\341','\342','\343','\344','\345','\346','\347', - '\350','\351','\352','\353','\354','\355','\356','\357', - '\360','\361','\362','\363','\364','\365','\366','\367', - '\370','\371','\372','\373','\374','\375','\376','\377' + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' }; uchar NEAR to_upper_sjis[]= @@ -121,22 +121,22 @@ uchar NEAR to_upper_sjis[]= 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '~', '\177', - '\200','\201','\202','\203','\204','\205','\206','\207', - '\210','\211','\212','\213','\214','\215','\216','\217', - '\220','\221','\222','\223','\224','\225','\226','\227', - '\230','\231','\232','\233','\234','\235','\236','\237', - '\240','\241','\242','\243','\244','\245','\246','\247', - '\250','\251','\252','\253','\254','\255','\256','\257', - '\260','\261','\262','\263','\264','\265','\266','\267', - '\270','\271','\272','\273','\274','\275','\276','\277', - '\300','\301','\302','\303','\304','\305','\306','\307', - '\310','\311','\312','\313','\314','\315','\316','\317', - '\320','\321','\322','\323','\324','\325','\326','\327', - '\330','\331','\332','\333','\334','\335','\336','\337', - '\340','\341','\342','\343','\344','\345','\346','\347', - '\350','\351','\352','\353','\354','\355','\356','\357', - '\360','\361','\362','\363','\364','\365','\366','\367', - '\370','\371','\372','\373','\374','\375','\376','\377' + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' }; uchar NEAR sort_order_sjis[]= @@ -157,22 +157,22 @@ uchar NEAR sort_order_sjis[]= 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '~', '\177', - '\200','\201','\202','\203','\204','\205','\206','\207', - '\210','\211','\212','\213','\214','\215','\216','\217', - '\220','\221','\222','\223','\224','\225','\226','\227', - '\230','\231','\232','\233','\234','\235','\236','\237', - '\240','\241','\242','\243','\244','\245','\246','\247', - '\250','\251','\252','\253','\254','\255','\256','\257', - '\260','\261','\262','\263','\264','\265','\266','\267', - '\270','\271','\272','\273','\274','\275','\276','\277', - '\300','\301','\302','\303','\304','\305','\306','\307', - '\310','\311','\312','\313','\314','\315','\316','\317', - '\320','\321','\322','\323','\324','\325','\326','\327', - '\330','\331','\332','\333','\334','\335','\336','\337', - '\340','\341','\342','\343','\344','\345','\346','\347', - '\350','\351','\352','\353','\354','\355','\356','\357', - '\360','\361','\362','\363','\364','\365','\366','\367', - '\370','\371','\372','\373','\374','\375','\376','\377' + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' }; #define issjishead(c) ((0x81<=(c) && (c)<=0x9f) || \ |