gettimeofday() can fail and presumably, so can time().
Keep an eye on it.
Since we have no data on this at all so far, we just
retry on failure (and log the event), assuming that
this is just an intermittant failure. This might of
course hang the threat until we succeed. Once we know
more about these failures, an appropriate more clever
scheme may be picked (only try so many times per thread,
etc., if that fails, return last "good" time() we got or
some such). Using sql_print_information() to log as this
probably only occurs in high load scenarios where the debug-
trace likely is disabled (or might interfere with testing
the effect). No test-case as this is a non-deterministic
issue.
sql/mysql_priv.h:
Bug#27198: Error returns from time() are ignored
move declarations for log.cc to before inclusion of
sql_class.h as we now use sql_print_information() in
there.
sql/sql_class.h:
Bug#27198: Error returns from time() are ignored
gettimeofday() can fail and presumably, so can time().
Keep an eye on it.
Move get_thread_lib to mysys/my_pthread.c
Set 'thr_client_alarm' to signal number used by thr_alarm to give alarms
include/my_global.h:
Fixed to be same as in 5.1
include/my_pthread.h:
Move things around to be more in line with rest of code
include/thr_alarm.h:
extern of thr_client_alarm
mysys/default.c:
Fixed two wrong pointer incrementations.
mysys/my_pthread.c:
Cleanup: Use variable thr_client_alarm
mysys/my_thr_init.c:
Detect thread library at startup
mysys/thr_alarm.c:
Set thr_client_alarm depending on which thread library we are using
sql/mysqld.cc:
Move get_thread_lib to mysys/my_pthread.c
Fix to check library in use during runtime.
Fix for Bug#16995, "idle connections not being killed due to timeout when NPTL is used".
BUILD/SETUP.sh:
To avoid warnings during compilation.
configure.in:
Fixed configure so that it can correctly detect
between NPTL and Linuxthreads.
include/my_global.h:
Fix for Linuxthreads.
include/my_pthread.h:
Added defines for different libraries that can be detected.
Currently only 'other', 'nptl', and 'lt' (linuxthreads) are
being used.
changed sigset() and signal() to my_sigset() and my_signal()
include/thr_alarm.h:
Removed defines for Linuxthreads. This is now detected during
runtime and handled in the thr_alarm.c
mysys/my_pthread.c:
Runtime check for library.
mysys/thr_alarm.c:
Runtime checks for library and corresponding
signals.
sql/mysqld.cc:
Added function for detecting thread library in use
during start-up.
THR_KILL_SIGNAL removed, setting signals during runtime.
server
The problem was that when memory was exhausted HEAP engine could crash
(GROUP BY uses HEAP TABLE). Alternatively, if SET was used, it could
report an error "You may only use constant expressions with SET" instead
of "Out of memory (Needed NNNNNN bytes)".
The solution is:
- pass MY_WME to (some) calls to my_malloc() to get correct message.
- fix heap_write() so that the first key is skipped during cleanup
on ENOMEM because it wasn't inserted and doesn't have to be
deleted.
No test case is provided because we can't test out-of-memory behaviour
in our current test framework.
heap/hp_block.c:
If allocation fails, write an error message.
heap/hp_write.c:
On ENOMEM, skip the first key in cleanup, as it wasn't inserted yet.
sql/item_func.cc:
Add MY_WME so that OOM error will be reported.
(back-port to 4.0)
Socket timeouts in client library were used only on Windows.
Additionally, in 4.0 write operations erroneously set read timeout.
The solution is to use socket timeouts in client library on all
systems were they are supported, and to differentiate between read
and write timeouts.
No test case is provided because it is impossible to simulate network
failure in current test suite.
include/violite.h:
Add argument to vio_timeout() to determine which timeout should be set:
for read (false) or for write (true).
libmysqld/lib_vio.c:
Add argument to vio_timeout() to determine which timeout should be set:
for read (false) or for write (true).
sql/net_serv.cc:
Add argument to vio_timeout() to determine which timeout should be set:
for read (false) or for write (true).
vio/viosocket.c:
Add argument to vio_timeout() to determine which timeout should be set:
for read (false) or for write (true).
Implement socket timeouts on POSIX systems.
The previous bug fix didn't work when using partial keys.
Don't use GNUC min/max operations are they are depricated.
Fixed valgrind warning
BitKeeper/etc/ignore:
Added */.libs/*
include/my_global.h:
Don't use GNUC min/max operations are they are depricated
myisam/mi_rkey.c:
Better bug fix for #14400 "Query joins wrong rows from table which is subject of "concurrent insert""
The previous bug fix didn't work when using partial keys.
myisam/mi_test_all.res:
Updated results to match mi_test_all.sh
myisam/mi_test_all.sh:
Removed confusing warning
mysql-test/r/myisam.result:
Added test case for #14400
mysql-test/t/myisam.test:
Added test case for #14400
sql/sql_select.cc:
Fixed valgrind warning (in field_string::val_int())
On exactly-sized Strings, the String::c_ptr() function peeked beyond the
end of the buffer, possibly into unititialized space to see whether the
buffer was NUL-terminated.
In a place that did peek improperly, we now use a c_ptr_safe() function,
which doesn't peek where it shouldn't.
client/sql_string.h:
Back-port String::c_ptr_safe().
sql/item_func.h:
Describe side-effect behavior.
sql/item_strfunc.cc:
Use the "_safe" version of c_ptr to avoid looking for a terminating
NUL character outside the initialized memory area. Valgrind hates it
when one does that, and it theoretically could lead to a SEGV.
sql/sql_string.h:
Back-port String::c_ptr_safe().
It was possible that fetching a record by an exact key value
(including the record pointer) could return a record with a
different key value. This happened only if a concurrent insert
added a record with the searched key value after the fetching
statement locked the table for read.
The search succeded on the key value, but the record was
rejected as it was past the file length that was remembered
at start of the fetching statement. With other words it was
rejected as being a concurrently inserted record.
The action to recover from this problem was to fetch the
record that is pointed at by the next key of the index.
This was repeated until a record below the file length was
found.
I do now avoid this loop if an exact match was searched.
If this match is beyond the file length, it is now treated
as "key not found". There cannot be another key with the
same record pointer.
myisam/mi_rkey.c:
Bug#14400 - Query joins wrong rows from table which is subject of "concurrent insert"
Added a check for exact key match before searching for
the next key that was not concurrently inserted. If an
exact key match finds a concurrently inserted row, this
must be treated as "key not found".
sql/sql_class.cc:
Bug#14400 - Query joins wrong rows from table which is subject of "concurrent insert"
Fixed some DBUG_ENTER strings.
mysql-test/r/func_str.result:
Fix for bug #12728: Very strange behaviour of ELT
- test case
mysql-test/t/func_str.test:
Fix for bug #12728: Very strange behaviour of ELT
- test result
sql/item_strfunc.cc:
Fix for bug #12728: Very strange behaviour of ELT
- Item_func_elt::eq() introduced: check 'item' member as well
(to distinguish for instance elt(1, 'a', 'b') and elt(2, 'a', 'b')
sql/item_strfunc.h:
Fix for bug #12728: Very strange behaviour of ELT
- Item_func_elt::eq() introduced: check 'item' member as well
(to distinguish for instance elt(1, 'a', 'b') and elt(2, 'a', 'b')
When setup_fields() function finds field named '*' it expands it to the list
of all table fields. It does so by checking that the first char of
field_name is '*', but it doesn't checks that the '* is the only char.
Due to this, when updating table with a field named like '*name', such field
is wrongly treated as '*' and expanded. This leads to making list of fields
to update being longer than list of the new values. Later, the fill_record()
function crashes by dereferencing null when there is left fields to update,
but no more values.
Added check in the setup_fields() function which ensures that the field
expanding will be done only when '*' is the only char in the field name.
mysql-test/t/update.test:
Added test case for bug#16510: Updating field named like '*name' caused server crash
mysql-test/r/update.result:
Added test case for bug#16510: Updating field named like '*name' caused server crash
sql/sql_base.cc:
Fixed bug #16510: Updating field named like '*name' caused server crash.
Added check in the setup_fields() function which ensures that the field
expanding will be done only when '*' is the only char in the field name.
After-fix optimizations proposed and finally
implemented by Monty.
mysql-test/r/lock.result:
BUG#5390 - problems with merge tables
After-fix optimizations proposed and finally
implemented by Monty.
Additional test results.
mysql-test/t/lock.test:
BUG#5390 - problems with merge tables
After-fix optimizations proposed and finally
implemented by Monty.
Additional tests.
sql/lock.cc:
BUG#5390 - problems with merge tables
After-fix optimizations proposed and finally
implemented by Monty.
get_lock_data() gets a flag for storing the lock
positions in the new TABLE elements.
mysql_lock_remove() can now remove a lock faster
and more precisely as it has needed info in TABLE now.
mysql_unlock_read_tables() and mysql_lock_merge() must
now adjust the new elements of TABLE when modifying locks.
mysql_lock_have_duplicate() can now work faster on
the existing lock as the positions in the lock
arrays are known for each table.
get_lock_data() assigns the new TABLE elements
on request of the new flag.
sql/table.h:
BUG#5390 - problems with merge tables
After-fix optimizations proposed and finally
implemented by Monty.
Additional elements of TABLE.
Changes to Netware specific mysqld_safe.c
include/config-netware.h:
NetWare specific change to increase thread stack size.
innobase/os/os0thread.c:
NetWare specific change to increase thread stack size.
netware/mysqld_safe.c:
NetWare specific change to make multiple mysqld_safe instances
work when called through a NCF file.
sql/mysqld.cc:
NetWare specific change to increase thread stack size.
Remove wrong fix for Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
Safety fix for bug #13855 "select distinct with group by caused server crash"
client/mysqlimport.c:
Remove not used variable
myisam/myisam_ftdump.c:
Fixed compiler warning
sql/item_cmpfunc.cc:
Removed compiler warning
sql/sql_handler.cc:
Remove wrong fix for Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash.
It's better to let mysql_lock_tables reopen the TABLE object in case of OPTIMIZE TABLE and fix items AFTER mysql_lock_table() instead of before
sql/sql_select.cc:
Safety fix for bug #13855 "select distinct with group by caused server crash"
The previous patch only removed the symptomps, this fix removed the cause of the problem
(Which was that not all hidden_fields was stored in the temporary table)
Problem #1: INSERT...SELECT
INSERT ... SELECT with the same table on both sides (hidden
below a MERGE table) does now work by buffering the select result.
The duplicate detection works now after open_and_lock_tables()
on the locks.
I did not find a test case that failed without the change in
sql_update.cc. I made the change anyway as it should in theory
fix a possible MERGE table problem with multi-table update.
mysql-test/r/create.result:
BUG#5390 - problems with merge tables
Removed a duplicate test.
mysql-test/r/merge.result:
BUG#5390 - problems with merge tables
Problem #1: INSERT...SELECT
Added test results.
mysql-test/t/create.test:
BUG#5390 - problems with merge tables
Removed a duplicate test.
mysql-test/t/merge.test:
BUG#5390 - problems with merge tables
Problem #1: INSERT...SELECT
Added tests.
sql/lock.cc:
BUG#5390 - problems with merge tables
Problem #1: INSERT...SELECT
Added a new function to find a duplicate lock in a list of tables.
sql/mysql_priv.h:
BUG#5390 - problems with merge tables
Problem #1: INSERT...SELECT
Added a declaration for the new function.
sql/sql_parse.cc:
BUG#5390 - problems with merge tables
Problem #1: INSERT...SELECT
Changed the duplicate tables detection for INSERT ... SELECT
to use the new function, which does also work for MERGE tables.
sql/sql_update.cc:
BUG#5390 - problems with merge tables
Changed the duplicate tables detection for UPDATE
to use the new function, which does also work for MERGE tables.
Initialized usable_keys from table->keys_in_use instead of ~0
in test_if_skip_sort_order(). It was possible that a disabled
index was used for sorting.
mysql-test/r/myisam.result:
Bug#14616 - Freshly imported table returns error 124 when using LIMIT
The test result.
mysql-test/t/myisam.test:
Bug#14616 - Freshly imported table returns error 124 when using LIMIT
The test case.
Version for 4.0.
It fixes two problems:
1. The cause of the bug was that we did not check the table version for
the HANDLER ... READ commands. We did not notice when a table was
replaced by a new one. This can happen during ALTER TABLE, REPAIR
TABLE, and OPTIMIZE TABLE (there might be more cases). I call the fix
for this problem "the primary bug fix".
2. mysql_ha_flush() was not always called with a locked LOCK_open.
Though the function comment clearly said it must.
I changed the code so that the locking is done when required. I call
the fix for this problem "the secondary fix".
mysql-test/r/handler.result:
Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
The test result.
mysql-test/t/handler.test:
Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
The test case.
sql/mysql_priv.h:
Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
Changed a definition for the secondary fix.
sql/sql_base.cc:
Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
Changed function calls for the secondary fix.
sql/sql_class.cc:
Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
Changed a function call for the secondary fix.
sql/sql_handler.cc:
Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
The first two diffs make the primary bug fix.
The rest is for the secondary fix.
sql/sql_table.cc:
Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
Changed function calls for the secondary fix.
DISTINCT wasn't optimized away and caused creation of tmp table in wrong
case. This result in integer overrun and running out of memory.
Fix backported from 4.1. Now if optimizer founds that in result be only 1
row it removes distinct.
sql/sql_select.cc:
Fix bug #13855 select distinct with group by caused server crash
mysql-test/r/select.result:
Test case for bug#13855 select distinct with group by caused server crash
mysql-test/t/select.test:
Test case for bug#13855 select distinct with group by caused server crash
When fixing Item_func_plus in ORDER BY clause field c is searched in all
opened tables, but because c is an alias it wasn't found there.
This patch adds a flag to select_lex which allows Item_field::fix_fields()
to look up in select's item_list to find aliased fields.
sql/item.cc:
Fix bug#7672 Unknown column error in order clause
When fixing fields in ORDER BY clause allow Item_field::fix_fields() to look up items in select's item list to find aliased fields.
sql/sql_lex.cc:
Fix bug#7672 Unknown column error in order clause
sql/sql_lex.h:
Fix bug#7672 Unknown column error in order clause
Added flag to select_lex allowing Item_field::fix_fields to look up items in select's item list.
sql/sql_select.cc:
Fix bug#7672 Unknown column error in order clause
mysql-test/t/select.test:
Test case for bug#7672 Unknown column error in order clause
mysql-test/r/select.result:
Test case for bug#7672 Unknown column error in order clause
in SHOW CREATE TABLE if a temporary file cannot be created.
(Bug #13002)
sql/ha_innodb.cc:
ha_innobase::get_foreign_key_create_info(): Display an error
message to the user if a temporary file cannot be created.
Solution for 4.0 and 4.1.
If the caller cannot re-open table(s), it gives a NULL
'refresh' argument to open_table(). We used to ignore
flushes then. Now we ignore drops too.
sql/mysql_priv.h:
initialisation moved to mysqld.cc
sql/mysqld.cc:
initialisation moved to mysqld.cc
sql/sql_cache.cc:
support of concurent query cache resizing:
- resizing made atomic
- check stack size after each quard mutex lock
sql/sql_cache.h:
initialisation moved to mysqld.cc
removed uneed parameter (now it is always under guard mutex protection or called from destruction)
read timeout properly on win32.
include/my_global.h:
Added win32 specific socket timeout error code.
include/violite.h:
Added vio_was_interrupted function that returns true if operation was
not completed due to timeout.
sql/mini_client.cc:
added a check that replication read was not completed due to timeout.
sql/net_serv.cc:
net->last_errno should be equal to ER_NET_READ_INTERRUPTED in case if read
operation was not completed due to timeout.
vio/vio.c:
added initialization code for vio_was_interrupted() function.
vio/viosocket.c:
Added vio_was_interrupted function that returns true if operation was
not completed due to timeout.
client/client_priv.h:
Added option auto close for Netware.
client/mysql.cc:
Added option auto close for Netware.
client/mysqladmin.c:
Added option auto close for Netware.
client/mysqlbinlog.cc:
Added option auto close for Netware.
client/mysqlcheck.c:
Added option auto close for Netware.
client/mysqldump.c:
Added option auto close for Netware.
client/mysqlimport.c:
Added option auto close for Netware.
client/mysqlshow.c:
Added option auto close for Netware.
client/mysqltest.c:
Fixed help messages for Netware.
extra/my_print_defaults.c:
Fixed help messages for Netware.
extra/perror.c:
Fixed help messages for Netware.
extra/resolve_stack_dump.c:
Fixed help messages for Netware.
include/help_end.h:
Fixed help messages for Netware.
include/help_start.h:
Fixed help messages for Netware.
isam/isamchk.c:
Added auto close of window for Netware
isam/pack_isam.c:
Added auto close of window for Netware
myisam/myisamchk.c:
Added auto close of window for Netware
myisam/myisamlog.c:
Added help for Netware.
myisam/myisampack.c:
Added auto close for Netware.
netware/myisamchk.def:
Scrollable screen patch.
netware/mysql.def:
Scrollable screen patch.
netware/mysql_test_run.c:
Fixed strindex for Netware.
netware/mysqladmin.def:
Scrollable screen patch.
netware/mysqlbinlog.def:
Scrollable screen patch.
netware/mysqlcheck.def:
Scrollable screen patch.
netware/mysqld_safe.c:
Removed debug message for Netware.
netware/mysqldump.def:
Scrollable screen patch.
netware/mysqlimport.def:
Scrollable screen patch.
netware/mysqlshow.def:
Scrollable screen patch.
sql/mysqld.cc:
Abnormal end patch when shutting down and volume not ready.
Fix bug #12779 : never give a row count estimate of 0 to the MySQL query optimizer, as then left join optimizer may beleive it KNOWS that the table is empty; note that this fix may change query optimization of many other queries where one table is empty; note that the proper fix would be to make the query optimizer to know that the row count estimates it receives really are just estimates, it cannot assume they are certain
sql/ha_innodb.cc:
Fix bug #12779 : never give a row count estimate of 0 to the MySQL query optimizer, as then left join optimizer may beleive it KNOWS that the table is empty; note that this fix may change query optimization of many other queries where one table is empty; note that the proper fix would be to make the query optimizer to know that the row count estimates it receives really are just estimates, it cannot assume they are certain