Commit graph

63338 commits

Author SHA1 Message Date
Vasil Dimov
eaaea8eb7d Fix Bug#56340 innodb updates index stats too frequently after non-index updates
This is a simple optimization issue. All stats are related to only indexed
columns, index size or number of rows in the whole table. UPDATEs that touch
only non-indexed columns cannot affect stats and we can avoid calling the
function row_update_statistics_if_needed() which may result in unnecessary I/O.

Approved by:	Marko (rb://466)
2010-09-30 15:48:44 +03:00
Bjorn Munch
be7b3c0040 Bug #52828 Tests that use perl fail when perl is not in path
Trying to run perl fails, just like it does when perl is started but fails
Trap the case that perl was not found/could not be started, and skip test
Also force a restart of servers since test may already have done something
mtr now also appends path of current perl to PATH to aid mysqltest
2010-09-30 12:42:37 +02:00
Vasil Dimov
51cdf59546 Fix a potential bug when using __sync_lock_test_and_set()
TYPE __sync_lock_test_and_set (TYPE *ptr, TYPE value, ...)

it is not documented what happens if the two arguments are of different
type like it was before: the first one was lock_word_t (byte) and the
second one was 1 or 0 (int).

Approved by:	Marko (via IRC)
2010-09-30 13:26:18 +03:00
Bjorn Munch
9ec4724866 Small test fix after 56753 2010-09-30 10:28:22 +02:00
Bjorn Munch
dae793978a merge from 5.1 2010-09-29 12:56:10 +02:00
Bjorn Munch
9605bc63fc Bug #56125 MTR2 start-and-exit removes server tmpdir, server becomes not operational
This happens when creating new tmpdir due to too long socket path
Don't delete it if --start-and-exit, but warn user to do it.
2010-09-28 15:58:01 +02:00
Vasil Dimov
3de0aa061b Increment InnoDB Plugin version to 1.0.13.
InnoDB Plugin 1.0.12 has been released with MySQL 5.1.51.
2010-09-28 15:31:33 +03:00
smenon
e73738f13f Backport into mysql-5.1.49sp1-release
> ------------------------------------------------------------
> revno: 3457.3.1
> revision-id: alexey.kopytov@sun.com-20100712145855-niybvwsthe480r69
> parent: mattias.jonsson@oracle.com-20100709130033-fgr7hggrrebf6qkc
> committer: Alexey Kopytov <Alexey.Kopytov@sun.com>
> branch nick: 55061-5.1-bugteam
> timestamp: Mon 2010-07-12 18:58:55 +0400
> message:
>   Bug#55061: Build failing on sol 8 x86 - assembler code vs 
>              compiler problem
>   
>   GCC-style inline assembly is not supported by the Sun Studio
>   compilers prior to version 12.
>   
>   Added a check for the Sun Studio version to avoid using 
>   _FPU_GETCW() / _FPU_SETCW() when inline assembly is
>    unsupported. This can lead to some differences in floating
>   point calculations on Solaris 8/x86 which, however, is not worth
>   bothering with Sun-style assembly .il templates.
2010-09-28 12:39:22 +02:00
smenon
2331ea8edb Backport into mysql-5.1.49sp1-release
> ------------------------------------------------------------
> revno: 3452.1.12
> revision-id: davi.arnaut@oracle.com-20100730121710-sc068t4d2f1c2gi9
> parent: dao-gang.qu@sun.com-20100730035934-8in8err1b1rqu72y
> committer: Davi Arnaut <davi.arnaut@oracle.com>
> branch nick: mysql-5.1-bugteam
> timestamp: Fri 2010-07-30 09:17:10 -0300
> message:
>   Bug#54041: MySQL 5.0.92 fails when tests from Connector/C suite run
>   
>   Fix a regression (due to a typo) which caused spurious incorrect
>   argument errors for long data stream parameters if all forms of
>   logging were disabled (binary, general and slow logs).
2010-09-28 12:36:08 +02:00
unknown
21197c70b8 Set version number for mysql-5.1.49sp1 release 2010-09-28 11:16:30 +02:00
unknown
b3cba90626 Merge from mysql-5.1.51-release 2010-09-28 10:33:22 +02:00
Vasil Dimov
9f3660c6e5 Silence a GCC warning about reaching the end of non-void func
Spotted by:	Marko
2010-09-28 11:12:34 +03:00
Vasil Dimov
57f59c738e Merge mysql-5.1-bugteam -> mysql-5.1-innodb 2010-09-28 09:38:33 +03:00
Davi Arnaut
58dfba2899 Bug#45288: pb2 returns a lot of compilation warnings on linux
Use UNINIT_VAR workaround instead of LINT_INIT. The former can
also be used to silence false-positives in non-debug builds as
it actually does not cause new code to be generated.
2010-09-24 19:13:51 -03:00
Davi Arnaut
930a50f9d3 Bug#45288: pb2 returns a lot of compilation warnings on linux
Temporarily disable strict aliasing warnings in order to get
wider coverage for optimized builds. Once the violations are
fixed and false-positives silenced, this flag should be removed.
2010-09-24 09:36:31 -03:00
Dmitry Shulga
7461d92d45 Follow-up for Bug#42503: fix a compilation warning.
sql/sql_cache.cc:
  Added include of send_data_in_chunks() definiton when macros EMBEDDED_LIBRARY is on.
2010-09-24 19:03:28 +07:00
Luis Soares
66a40d0b8a BUG#55263: assert in check_binlog_magic
The procedure for setting up a fake binary log, by changing the
relay log files manually, is run twice when we issue mtr with
--repeat=2. However, when setting it up for the second time,
neither the sql thread is reset nor the server is restarted. This
means that previous stale relay log IO_CACHE metadata - from 
first run - is left around. As a consequence, when the test is 
run for the second time, the IO_CACHE for the relay log has 
position in file different than zero, triggering the assertion.
            
We fix this by deploying a call to my_b_seek before calling
check_binlog_magic in next_event. This prevents the server 
from asserting, in the cases that the SQL thread was reads
from a hot log (relay.NNNNN), then is stopped, then is restarted 
from a previous cold log (relay.MMMMM), and then it reaches 
the hot log relay.NNNNN again, in which case, the read 
coordinates are not set to zero, but to the old values.

Additionally, some comments to the source code were added.
2010-09-24 10:44:53 +01:00
Sergey Glukhov
b76277fce5 Bug#54494 crash with explain extended and prepared statements
In case of outer join and emtpy WHERE conditon
'always true' condition is created for WHERE clasue.
Later in mysql_select() original SELECT_LEX WHERE
condition is overwritten with created cond.
However SELECT_LEX condition is also used as inital
condition in mysql_select()->JOIN::prepare().
On second execution of PS modified SELECT_LEX condition
is taken and it leads to crash.
The fix is to restore original SELECT_LEX condition
(set to NULL if original cond is NULL) in
 reinit_stmt_before_use().
HAVING clause is fixed too for safety reason
(no test case as I did not manage to think out
 appropriate example).


mysql-test/r/ps.result:
  test case
mysql-test/t/ps.test:
  test case
sql/sql_prepare.cc:
  restore original SELECT_LEX condition
  (set to NULL if original cond is NULL) in
   reinit_stmt_before_use()
2010-09-23 10:43:51 +04:00
Alexey Kopytov
faf54ff95c Bug #56709: Memory leaks at running the 5.1 test suite
Fixed a number of memory leaks discovered by valgrind.

dbug/dbug.c:
  This is actually an addendum to the fix for bug #52629:
  
  - there is no point in limiting the fix to just global
  variables, session ones are also affected.
  - zero all fields when allocating a new 'state' structure so
  that FreeState() does not deal with unitialized data later.
  - add a check for a NULL pointer in DBUGCloseFile()
mysql-test/r/partition_error.result:
  Added a test case for bug #56709.
mysql-test/r/variables_debug.result:
  Added a test case for bug #56709.
mysql-test/t/partition_error.test:
  Added a test case for bug #56709.
mysql-test/t/variables_debug.test:
  Added a test case for bug #56709.
sql/item_timefunc.cc:
  There is no point in declaring 'value' as a member of
  Item_extract and dynamically allocating memory for it in
  Item_extract::fix_length_and_dec(), since this string is only
  used as a temporary storage in Item_extract::val_int().
sql/item_timefunc.h:
  Removed 'value' from the Item_extract class definition.
sql/sql_load.cc:
  - we may need to deallocate 'buffer' even when 'error' is
    non-zero in some cases, since 'error' is public, and there is
    external code modifying it.
  - assign NULL to buffer when deallocating it so that we don't
    do it twice in the destructor
  - there is no point in changing 'error' in the destructor.
2010-09-22 23:33:18 +04:00
Dmitry Shulga
9516e824e0 Fixed bug#56821 - failure to start the MySQL Service.
sql/log.cc:
  reopen_fstreams modified: fixed error in processing of
  stdout/stderr when run mysqld as Windows service.
2010-09-22 19:53:06 +07:00
Bjorn Munch
7b216d7625 Bug #56921 It should be possible to log connection statements in mysqltest
Added --enable-connect-log, somewhet similar to --enable-query-log
If query log is disabled, disable connect log too
Also some related cleanup in mysqltest.test: removing duplicate test loop
2010-09-22 10:57:10 +02:00
Ingo Struewing
b288324a13 Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
Merge from saved bundle.
2010-09-21 16:37:18 +02:00
Bjorn Munch
ee6f8ae1bd test fixes after 56753 2010-09-21 11:16:20 +02:00
Bjorn Munch
c18a34bda6 Bug #55426 mysqltest crashes when trying to unlock not acquired mutex
Follow-up: don't call pthread_join() on Windows
This change only valid for 5.1
2010-09-20 11:21:27 +02:00
Alfranio Correia
0c74cc0d10 merge mysql-5.1-bugteam (local) --> mysql-5.1-bugteam 2010-09-17 14:55:23 +01:00
Sergey Glukhov
31a38c0fc5 Bug#50402 Optimizer producing wrong results when using Index Merge on InnoDB
Subselect executes twice, at JOIN::optimize stage
and at JOIN::execute stage. At optimize stage
Innodb prebuilt struct which is used for the
retrieval of column values is initialized in.
ha_innobase::index_read(), prebuilt->sql_stat_start is true.
After QUICK_ROR_INTERSECT_SELECT finished his job it
restores read_set/write_set bitmaps with initial values
and deactivates one of the handlers used by
QUICK_ROR_INTERSECT_SELECT in JOIN::cleanup
(it's the case when we reuse original handler as one of
 handlers required by QUICK_ROR_INTERSECT_SELECT object).
On second subselect execution inactive handler is activated
in  QUICK_RANGE_SELECT::reset, file->ha_index_init().
In ha_index_init Innodb prebuilt struct is reinitialized
with inappropriate read_set/write_set bitmaps. Further
reinitialization in ha_innobase::index_read() does not
happen as prebuilt->sql_stat_start is false.
It leads to partial retrieval of required field values
and we get a mix of field values from different records
in the record buffer.
The fix is to reset
read_set/write_set bitmaps as these values
are required for proper intialization of
internal InnoDB struct which is used for
the retrieval of column values
(see build_template(), ha_innodb.cc)


mysql-test/include/index_merge_ror_cpk.inc:
  test case
mysql-test/r/index_merge_innodb.result:
  test case
mysql-test/r/index_merge_myisam.result:
  test case
sql/opt_range.cc:
  if ROR merge scan is used we need to reset
  read_set/write_set bitmaps as these values
  are required for proper intialization of
  internal InnoDB struct which is used for
  the retrieval of column values
  (see build_template(), ha_innodb.cc)
2010-09-16 16:13:53 +04:00
Magne Mahre
ebd207baa8 Bug #54606 innodb fast alter table + pack_keys=0 prevents
adding new indexes

A fast alter table requires that the existing (old) table
and indices are unchanged (i.e only new indices can be
added).  To verify this, the layout and flags of the old
table/indices are compared for equality with the new.

The PACK_KEYS option is a no-op in InnoDB, but the flag
exists, and is used in the table compare.  We need to
check this (table) option flag before deciding whether an 
index should be packed or not.  If the table has
explicitly set PACK_KEYS to 0, the created indices should
not be marked as packed/packable.
2010-09-16 12:51:08 +02:00
Dmitry Shulga
0c91b53d10 Fixed bug#42503 - "Lost connection" errors when using
compression protocol.

The loss of connection was caused by a malformed packet
sent by the server in case when query cache was in use.
When storing data in the query cache, the query  cache
memory allocation algorithm had a tendency to reduce
the amount of memory block necessary to store a result
set, up to finally storing the entire result set in a single
block. With a significant result set, this memory block
could turn out to be quite large - 30, 40 MB and on.
When such a result set was sent to the client, the entire
memory block was compressed and written to network as a
single network packet. However, the length of the
network packet is limited by 0xFFFFFF (16MB), since
the packet format only allows 3 bytes for packet length.
As a result, a malformed, overly large packet
with truncated length would be sent to the client
and break the client/server protocol.

The solution is, when sending result sets from the query
cache, to ensure that the data is chopped into
network packets of size <= 16MB, so that there
is no corruption of packet length. This solution,
however, has a shortcoming: since the result set
is still stored in the query cache as a single block,
at the time of sending, we've lost boundaries of individual
logical packets (one logical packet = one row of the result
set) and thus can end up sending a truncated logical
packet in a compressed network packet.

As a result, on the client we may require more memory than 
max_allowed_packet to keep, both, the truncated
last logical packet, and the compressed next packet.
This never (or in practice never) happens without compression,
since without compression it's very unlikely that
a) a truncated logical packet would remain on the client
when it's time to read the next packet
b) a subsequent logical packet that is being read would be
so large that size-of-new-packet + size-of-old-packet-tail >
max_allowed_packet.
To remedy this issue, we send data in 1MB sized packets,
that's below the current client default of 16MB for
max_allowed_packet, but large enough to ensure there is no
unnecessary overhead from too many syscalls per result set.


sql/net_serv.cc:
  net_realloc() modified: consider already used memory
  when compare packet buffer length
sql/sql_cache.cc:
  modified Query_cache::send_result_to_client: send result to client
  in chunks limited by 1 megabyte.
2010-09-16 17:24:27 +07:00
Mattias Jonsson
428f0bdefb Bug#56287: mysql5.1.50 crash when using Partition datetime in sub in query
When having a sub query in partitioned innodb one could
make the partitioning engine to search for a 'index_next_same'
on a partition that had not been initialized.

Problem was that the subselect function looks at table->status
which was not set in the partitioning handler when it skipped
scanning due to no matching partitions found.

Fixed by setting table->status = STATUS_NOT_FOUND when
there was no partitions to scan. (If there are partitions to
scan, it will be set in the partitions handler.)


mysql-test/r/partition_innodb.result:
  added result
mysql-test/t/partition_innodb.test:
  added test
sql/ha_partition.cc:
  set table status to not found, if there ar no partitions to scan.
2010-09-16 11:01:06 +02:00
Mikael Ronstrom
0876ef0513 Updated build_mccge.sh and added support for more cpu's in check-cpu 2010-09-16 08:53:58 +02:00
Vasil Dimov
844a8098aa Fix typo, should be UNIV_SYNC_DEBUG. 2010-09-15 19:58:36 +03:00
Vasil Dimov
da98776bfb (partially) Fix Bug#55227 Fix compiler warnings in innodb with gcc 4.6
Fix compiler warning:
trx/trx0undo.c: In function 'trx_undo_truncate_end':
trx/trx0undo.c:1069:14: error: variable 'rseg' set but not used [-Werror=unused-but-set-variable]
2010-09-15 19:50:05 +03:00
Vasil Dimov
e4996035b2 (partially) Fix Bug#55227 Fix compiler warnings in innodb with gcc 4.6
Fix compiler warning:
trx/trx0undo.c: In function 'trx_undo_set_state_at_prepare':
trx/trx0undo.c:1871:16: error: variable 'page_hdr' set but not used [-Werror=unused-but-set-variable]
2010-09-15 19:49:25 +03:00
Vasil Dimov
7e2a00b27e (partially) Fix Bug#55227 Fix compiler warnings in innodb with gcc 4.6
Fix compiler warning:
trx/trx0trx.c: In function 'trx_prepare_off_kernel':
trx/trx0trx.c:1808:11: error: variable 'update_hdr_page' set but not used [-Werror=unused-but-set-variable]
2010-09-15 19:48:37 +03:00
Vasil Dimov
c8a205c68b (partially) Fix Bug#55227 Fix compiler warnings in innodb with gcc 4.6
Fix compiler warning:
trx/trx0sys.c: In function 'trx_sys_create_doublewrite_buf':
trx/trx0sys.c:244:15: error: variable 'new_block' set but not used [-Werror=unused-but-set-variable]
2010-09-15 19:47:35 +03:00
Vasil Dimov
8968ca7f00 (partially) Fix Bug#55227 Fix compiler warnings in innodb with gcc 4.6
Fix compiler warnings:
trx/trx0roll.c: In function 'trx_undo_arr_remove_info':
trx/trx0roll.c:744:9: error: variable 'n' set but not used [-Werror=unused-but-set-variable]
trx/trx0roll.c:743:9: error: variable 'n_used' set but not used [-Werror=unused-but-set-variable]
2010-09-15 19:06:31 +03:00
Vasil Dimov
7cfe9f4fbd (partially) Fix Bug#55227 Fix compiler warnings in innodb with gcc 4.6
Fix compiler warning:
trx/trx0purge.c: In function 'trx_purge_rec_release':
trx/trx0purge.c:1071:18: error: variable 'arr' set but not used [-Werror=unused-but-set-variable]
2010-09-15 19:05:35 +03:00
Vasil Dimov
7d39b69f59 (partially) Fix Bug#55227 Fix compiler warnings in innodb with gcc 4.6
Fix compiler warning:
trx/trx0purge.c: In function 'trx_purge_rseg_get_next_history_log':
trx/trx0purge.c:660:15: error: variable 'seg_hdr' set but not used [-Werror=unused-but-set-variable]
2010-09-15 18:47:14 +03:00
Vasil Dimov
db656f084c (partially) Fix Bug#55227 Fix compiler warnings in innodb with gcc 4.6
Fix compiler warning:
trx/trx0purge.c: In function 'trx_purge_add_update_undo_to_history':
trx/trx0purge.c:307:15: error: variable 'seg_header' set but not used [-Werror=unused-but-set-variable]
2010-09-15 18:45:57 +03:00
Vasil Dimov
85df29122d (partially) Fix Bug#55227 Fix compiler warnings in innodb with gcc 4.6
Fix compiler warning:
trx/trx0purge.c: In function 'trx_purge_add_update_undo_to_history':
trx/trx0purge.c:309:16: error: variable 'page_header' set but not used [-Werror=unused-but-set-variable]
2010-09-15 18:44:55 +03:00
Vasil Dimov
6c0ad7212b (partially) Fix Bug#55227 Fix compiler warnings in innodb with gcc 4.6
Fix compiler warning:
row/row0vers.c: In function 'row_vers_impl_x_locked_off_kernel':
row/row0vers.c:74:9: error: variable 'err' set but not used [-Werror=unused-but-set-variable]
2010-09-15 18:43:07 +03:00
Vasil Dimov
92c05f1b51 (partially) Fix Bug#55227 Fix compiler warnings in innodb with gcc 4.6
Fix compiler warning:
row/row0umod.c: In function 'row_undo_mod_clust_low':
row/row0umod.c:117:9: error: variable 'success' set but not used [-Werror=unused-but-set-variable]
2010-09-15 18:41:35 +03:00
Vasil Dimov
8d543ffa0b (partially) Fix Bug#55227 Fix compiler warnings in innodb with gcc 4.6
Fix compiler warning:
row/row0purge.c: In function 'row_purge_step':
row/row0purge.c:687:9: error: variable 'err' set but not used [-Werror=unused-but-set-variable]
2010-09-15 18:37:24 +03:00
Vasil Dimov
dac4573273 (partially) Fix Bug#55227 Fix compiler warnings in innodb with gcc 4.6
Fix compiler warning:
que/que0que.c: In function 'que_run_threads_low':
que/que0que.c:1287:9: error: variable 'cumul_resource' set but not used [-Werror=unused-but-set-variable]
2010-09-15 18:35:59 +03:00
Vasil Dimov
fa1b367bcf (partially) Fix Bug#55227 Fix compiler warnings in innodb with gcc 4.6
Fix compiler warnings:
os/os0file.c: In function 'os_file_create':
os/os0file.c:1371:14: error: variable 'purpose_str' set but not used [-Werror=unused-but-set-variable]
os/os0file.c:1370:14: error: variable 'type_str' set but not used [-Werror=unused-but-set-variable]
2010-09-15 18:35:11 +03:00
Vasil Dimov
88c37655fb (partially) Fix Bug#55227 Fix compiler warnings in innodb with gcc 4.6
Fix compiler warning:
log/log0recv.c: In function 'recv_synchronize_groups':
log/log0recv.c:562:14: error: variable 'limit_lsn' set but not used [-Werror=unused-but-set-variable]
2010-09-15 18:32:12 +03:00
Vasil Dimov
ad6165a9d4 (partially) Fix Bug#55227 Fix compiler warnings in innodb with gcc 4.6
Fix compiler warning:
log/log0recv.c: In function 'recv_recovery_from_checkpoint_start_func':
log/log0recv.c:2894:14: error: variable 'archived_lsn' set but not used [-Werror=unused-but-set-variable]
2010-09-15 18:31:16 +03:00
Vasil Dimov
a51ef6f673 (partially) Fix Bug#55227 Fix compiler warnings in innodb with gcc 4.6
Fix compiler warning:
handler/i_s.cc: In function 'int trx_i_s_common_fill_table(THD*, TABLE_LIST*, COND*)':
handler/i_s.cc:931:8: error: variable 'ret' set but not used [-Werror=unused-but-set-variable]
2010-09-15 18:25:24 +03:00
Vasil Dimov
7d0b8b5e5f (partially) Fix Bug#55227 Fix compiler warnings in innodb with gcc 4.6
Fix compiler warning:
handler/ha_innodb.cc: In function 'void innobase_drop_database(handlerton*, char*)':
handler/ha_innodb.cc:7010:6: error: variable 'error' set but not used [-Werror=unused-but-set-variable]
2010-09-15 18:10:10 +03:00
Vasil Dimov
7ed6878c6d (partially) Fix Bug#55227 Fix compiler warnings in innodb with gcc 4.6
Fix compiler warning:
handler/ha_innodb.cc: In function 'bool innodb_show_status(handlerton*, THD*, bool (*)(THD*, const char*, uint, const char*, uint, const char*, uint))':
handler/ha_innodb.cc:8851:7: error: variable 'result' set but not used [-Werror=unused-but-set-variable]
2010-09-15 18:06:46 +03:00