Commit graph

6896 commits

Author SHA1 Message Date
Marko Mäkelä
52ea152294 Bug#14758405: ALTER TABLE: ADDING SERIAL NULL DATATYPE: ASSERTION:
LEN <= SIZEOF(ULONGLONG)

This bug was caught in the WL#6255 ALTER TABLE...ADD COLUMN in MySQL
5.6, but there is a bug in all InnoDB versions that support
auto-increment columns.

row_search_autoinc_read_column(): When reading the maximum value of
the auto-increment column, and the column only contains NULL values,
return 0. This corresponds to the case when the table is empty in
row_search_max_autoinc().

rb:1415 approved by Sunny Bains
2012-10-18 17:03:06 +03:00
unknown
69a7b04add Merge mdev-452 with the latest 10.0-base. 2012-10-18 15:57:12 +03:00
unknown
bc4a456758 MDEV-452 Add full support for auto-initialized/updated timestamp and datetime
Generalized support for auto-updated and/or auto-initialized timestamp
and datetime columns. This patch is a reimplementation of MySQL's
"WL#5874: CURRENT_TIMESTAMP as DEFAULT for DATETIME columns". In order to
ease future merges, this implementation reused few function and variable
names from MySQL's patch, however the implementation is quite different.

TODO:
The only unresolved problem in this patch is the semantics of LOAD DATA for
TIMESTAMP and DATETIME columns in the cases when there are missing or NULL
columns. I couldn't fully comprehend the logic behind MySQL's behavior and
its relationship with their own documentation, so I left the results to be
more consistent with all other LOAD cases.

The problematic test cases can be seen by running the test file function_defaults,
and observing the test case differences. Those were left on purpose for discussion.
2012-10-17 15:43:56 +03:00
Yasufumi Kinoshita
bdc6895d35 Bug #13702112 : WAIT_FOR_READ IS STUCK IN THE 90S
rb://1334
approved by: Inaam Rana
2012-10-17 16:16:45 +09:00
Yasufumi Kinoshita
39e6eafc20 Bug #13702112 : WAIT_FOR_READ IS STUCK IN THE 90S
rb://1334
approved by: Inaam Rana
2012-10-17 15:28:31 +09:00
Marko Mäkelä
bb371b649d Merge mysql-5.1 to mysql-5.5. 2012-10-16 14:35:19 +03:00
Marko Mäkelä
aec624762b Bug#14729221 IN-PLACE ALTER TABLE REPORTS '' INSTEAD OF
REAL DUPLICATE VALUE FOR PREFIX KEYS

innobase_rec_to_mysql(): Invoke dict_index_get_nth_col_or_prefix_pos()
instead of dict_index_get_nth_col_pos() to find the column.
2012-10-16 14:24:15 +03:00
Sergei Golubchik
ee9afef271 mysql-5.5.28 2012-10-16 13:04:42 +02:00
Sergei Golubchik
d9a8799205 XtraDB 1.1.8-29.0 2012-10-16 10:36:28 +02:00
Krunal Bauskar krunal.bauskar@oracle.com
ed6732dd16 bug#14704286
SECONDARY INDEX UPDATES MAKE CONSISTENT READS DO O(N^2) UNDO PAGE
LOOKUPS (honoring kill query while accessing sec_index)

If secondary index is being used for select query evaluation and this
query is operating with consistent read snapshot it might take good time for
secondary index to return back control to mysql as MVCC would kick in.

If user issues "kill query <id>" while query is actively accessing
secondary index it will not be honored as there is no hook to check
for this condition. Added hook for this check.

-----
Parallely secondary index taking too long to evaluate for consistent
read snapshot case is being examined for performance improvement. WL#6540.
2012-10-15 09:49:50 +05:30
Krunal Bauskar krunal.bauskar@oracle.com
9bfc910f2f bug#14704286
SECONDARY INDEX UPDATES MAKE CONSISTENT READS DO O(N^2) UNDO PAGE
LOOKUPS (honoring kill query while accessing sec_index)

If secondary index is being used for select query evaluation and this
query is operating with consistent read snapshot it might take good time for
secondary index to return back control to mysql as MVCC would kick in.

If user issues "kill query <id>" while query is actively accessing
secondary index it will not be honored as there is no hook to check
for this condition. Added hook for this check.

-----
Parallely secondary index taking too long to evaluate for consistent
read snapshot case is being examined for performance improvement. WL#6540.
2012-10-15 09:24:33 +05:30
Sergei Golubchik
c2da54ef26 simplify future xtradb merges (hopefully) 2012-10-12 18:15:38 +02:00
Vasil Dimov
1d16fc16dc Fix compilation error in debug mode:
os/os0file.c:1332: error: ISO C90 forbids mixed declarations and code
2012-10-10 22:22:10 +03:00
Vasil Dimov
61bd7d0ce9 Merge mysql-5.1 -> mysql-5.5 2012-10-09 16:41:13 +03:00
Vasil Dimov
4cefe863ae Port the test for Bug#14708715 from 5.1/innodb_plugin into 5.1/innodb
although the bug does not exist in 5.1/innodb.
2012-10-09 16:29:00 +03:00
Vasil Dimov
8baabf3090 Update the ChangeLog with the fix of Bug#14708715 2012-10-09 16:08:06 +03:00
Vasil Dimov
93398c307f Fix Bug#14708715 CREATE TABLE MEMORY LEAK ON DB_OUT_OF_FILE_SPACE
The problem is in the error handling in row_create_table_for_mysql().
In the 'disk full' case we may forget to call dict_mem_table_free() on
the table object.

Approved by:	Marko (rb:1377 and rb:1386)
2012-10-09 16:02:58 +03:00
Annamalai Gurusami
378a7d1ef5 Bug #14036214 MYSQLD CRASHES WHEN EXECUTING UPDATE IN TRX WITH
CONSISTENT SNAPSHOT OPTION

A transaction is started with a consistent snapshot.  After 
the transaction is started new indexes are added to the 
table.  Now when we issue an update statement, the optimizer
chooses an index.  When the index scan is being initialized
via ha_innobase::change_active_index(), InnoDB reports 
the error code HA_ERR_TABLE_DEF_CHANGED, with message 
stating that "insufficient history for index".

This error message is propagated up to the SQL layer.  But
the my_error() api is never called.  The statement level
diagnostics area is not updated with the correct error 
status (it remains in Diagnostics_area::DA_EMPTY).  

Hence the following check in the Protocol::end_statement()
fails.

 516   case Diagnostics_area::DA_EMPTY:
 517   default:
 518     DBUG_ASSERT(0);
 519     error= send_ok(thd->server_status, 0, 0, 0, NULL);
 520     break;

The fix is to backport the fix of bugs 14365043, 11761652 
and 11746399. 

14365043 PROTOCOL::END_STATEMENT(): ASSERTION `0' FAILED
11761652 HA_RND_INIT() RESULT CODE NOT CHECKED
11746399 RETURN VALUES OF HA_INDEX_INIT() AND INDEX_INIT() IGNORED

rb://1227 approved by guilhem and mattiasj.
2012-10-08 19:40:30 +05:30
Marko Mäkelä
52a4ef95e8 Merge mysql-5.1 to mysql-5.5.
Also, add debug check for trx_id sanity to row_upd_rec_sys_fields().
2012-10-08 16:18:54 +03:00
Marko Mäkelä
b06620868e Bug#14731482 UPDATE OR DELETE CORRUPTS A RECORD WITH A LONG PRIMARY KEY
We did not allocate enough bits for index->trx_id_offset, causing an
UPDATE or DELETE of a table with a PRIMARY KEY longer than 1024 bytes
to corrupt the PRIMARY KEY.

dict_index_t: Allocate enough bits.

dict_index_build_internal_clust(): Check for overflow of
index->trx_id_offset. Trip a debug assertion when overflow occurs.

rb:1380 approved by Jimmy Yang
2012-10-08 16:01:50 +03:00
Michael Widenius
00433b1b04 Automatic merge with 5.5 2012-10-05 00:00:21 +03:00
Michael Widenius
ea6a4eef3a Fixed issues found by buildbot & valgrind:
- Wrong thd uses in Item_subselect, could lead to crash
- Inititalize uninitialized variable in new autoincrement handling code


sql/handler.cc:
  More DBUG_PRINT
sql/item_subselect.cc:
  Wrong thd uses in Item_subselect, could lead to crash
storage/innobase/handler/ha_innodb.cc:
  Initialize variable needed by upper level. This only happens when auto-increment value wraps over.
storage/xtradb/handler/ha_innodb.cc:
  Initialize variable needed by upper level. This only happens when auto-increment value wraps over.
2012-10-04 23:52:11 +03:00
Michael Widenius
f3261f912e Automatic merge 2012-10-04 02:15:48 +03:00
Michael Widenius
3734a364f2 Automatic merge 2012-10-04 01:03:55 +03:00
Michael Widenius
572560f38c Changed SHOW_FUNC variabels that don't return SHOW_ARRAY to SHOW_SIMPLE_FUNC.
This allows us to avoid calculating variables (including those involving mutex) that doesn't match the given
wildcard in SHOW STATUS LIKE '...'
Removed all references to active_mi that could cause problems for multi-source replication.

Added START|STOP ALL SLAVES
Added SHOW ALL SLAVES STATUS


include/mysql/plugin.h:
  Added SHOW_SIMPLE_FUNC
include/mysql/plugin_audit.h.pp:
  Updated .pp file
include/mysql/plugin_auth.h.pp:
  Updated .pp file
include/mysql/plugin_ftparser.h.pp:
  Updated .pp file
mysql-test/suite/multi_source/info_logs.result:
  New columns in SHOW ALL SLAVES STATUS
mysql-test/suite/multi_source/info_logs.test:
  Test new syntax
mysql-test/suite/multi_source/simple.result:
  New columns in SHOW ALL SLAVES STATUS
mysql-test/suite/multi_source/simple.test:
  test new syntax
mysql-test/suite/multi_source/syntax.result:
  Updated result
mysql-test/suite/multi_source/syntax.test:
  Test new syntax
mysql-test/suite/rpl/r/rpl_skip_replication.result:
  Updated result
plugin/semisync/semisync_master_plugin.cc:
  SHOW_FUNC -> SHOW_SIMPLE_FUNC
sql/item_create.cc:
  Simplify code
sql/lex.h:
  Added SLAVES keyword
sql/log.cc:
  Constant -> define
sql/log_event.cc:
  Added comment
sql/mysqld.cc:
  SHOW_FUNC -> SHOW_SIMPLE_FUNC
  Made slave_retried_trans, slave_received_heartbeats and heartbeat_period multi-source safe
  Clear variable denied_connections and slave_retried_transactions on startup
sql/mysqld.h:
  Added slave_retried_transactions
sql/rpl_mi.cc:
  create_signed_file_name -> create_logfile_name_with_suffix
  Added start_all_slaves() and stop_all_slaves()
sql/rpl_mi.h:
  Added prototypes
sql/rpl_rli.cc:
  create_signed_file_name -> create_logfile_name_with_suffix
  added executed_entries
sql/rpl_rli.h:
  Added executed_entries
sql/share/errmsg-utf8.txt:
  More and better error messages
sql/slave.cc:
  Added more fields to SHOW ALL SLAVES STATUS
  Added slave_retried_transactions
  Changed constants -> defines
sql/sql_class.h:
  Added comment
sql/sql_insert.cc:
  active_mi.rli -> thd->rli_slave
sql/sql_lex.h:
  Added SQLCOM_SLAVE_ALL_START & SQLCOM_SLAVE_ALL_STOP
sql/sql_load.cc:
  active_mi.rli -> thd->rli_slave
sql/sql_parse.cc:
  Added START|STOP ALL SLAVES
sql/sql_prepare.cc:
  Added SQLCOM_SLAVE_ALL_START & SQLCOM_SLAVE_ALL_STOP
sql/sql_reload.cc:
  Made REFRESH RELAY LOG multi-source safe
sql/sql_repl.cc:
  create_signed_file_name -> create_logfile_name_with_suffix
  Don't send my_ok() from start_slave() or stop_slave() so that we can call it for all master connections
sql/sql_show.cc:
  Compare wild cards early for all variables
sql/sql_yacc.yy:
  Added START|STOP ALL SLAVES
  Added SHOW ALL SLAVES STATUS
sql/sys_vars.cc:
  Made replicate_events_marked_for_skip,slave_net_timeout and rpl_filter multi-source safe.
sql/sys_vars.h:
  Simplify Sys_var_rpl_filter
2012-10-03 01:44:54 +03:00
unknown
82eb2c6de0 fixed MDEV-568: Wrong result for a hash index look-up if the index is unique and the key is NULL
Check ability of index to be NULL as it made in MyISAM. UNIQUE with NULL could have several NULL entries so we have to continue even if ve have found a row.
2012-10-02 12:53:20 +03:00
Sergei Golubchik
416d0aebbf more fixes for test cases
mysql-test/suite/innodb/include/restart_and_reinit.inc:
  drop and recreate mysql.innodb* tables when deleting innodb table spaces
mysql-test/t/ssl_8k_key-master.opt:
  with loose- prefix ssl errors are ignored
sql-common/client.c:
  compiler warnings
sql/field.cc:
  use the new function
sql/item.cc:
  don't convert time to double or decimal via longlong,
  this loses sub-second part.
  Use dedicated functions.
sql/item.h:
  incorrect cast_to_int type for params
sql/item_strfunc.cc:
  use the new function
sql/lex.h:
  unused
sql/my_decimal.h:
  helper macro
sql/sql_plugin.cc:
  workaround for a compiler warning
sql/sql_yacc.yy:
  unused
sql/transaction.cc:
  fix the merge for SERVER_STATUS_IN_TRANS_READONLY protocol flag
storage/sphinx/CMakeLists.txt:
  compiler warnings
2012-10-01 13:15:29 +02:00
unknown
ce8484548b Fix of MDEV-565: Server crashes in ha_cassandra::write_row on inserting NULL into a dynamic column
Fixed incorrect initialization of variable which caused freeing memory by random address in case of error.
2012-09-29 16:01:24 +03:00
Annamalai Gurusami
b59a64e2f3 Bug #13249921 ASSERT !BPAGE->FILE_PAGE_WAS_FREED, USUALLY IN
TRANSACTION ROLLBACK

Description:  During the rollback operation, a blob page 
is removed earlier than desired.  Consider following scenario:

1. create table t1(a int primary key,b blob) engine=innodb;
2. insert into t1 values (1,repeat('b',9000));
3. begin;
4. update t1 set b=concat(b,'b');
5. update t1 set a=a+1;
6. insert into t1 values (1,repeat('b',9000));
7. rollback;

The update operation in line 5 produces 2 undo log record. The first
undo record (TRX_UNDO_DEL_MARK_REC) goes to trx->update_undo and the
second undo record (TRX_UNDO_INSERT_REC) goes to trx->insert_undo.
During rollback, they are executed out of order.

When the undo record TRX_UNDO_DEL_MARK_REC is applied/executed,
the blob ownership is also reset.  Because of this the blob page
is released earlier than desired.  This blob page must have been
freed only as part of applying/executing the undo record
TRX_UNDO_INSERT_REC.

This problem can be avoided by executing the undo records in
order.  This patch will make innodb to execute the undo records
in order.

rb://1125 approved by Marko.
2012-09-28 16:02:58 +05:30
Sergey Petrunya
aec2c55ac2 Fix compile: expect Thrift where it is at buildbot. 2012-09-28 14:02:59 +04:00
Sergey Petrunya
40d62823cd Fix compile warnings 2012-09-28 14:01:52 +04:00
unknown
3f8eaf7e87 Ending spaces removed. 2012-09-28 15:30:49 +03:00
unknown
245298f25d MDEV-506 Cassandra dynamic columns access 2012-09-28 15:27:16 +03:00
Sergei Golubchik
474fe6d9d9 fixes for test failures
and small collateral changes

mysql-test/lib/My/Test.pm:
  somehow with "print" we get truncated writes sometimes
mysql-test/suite/perfschema/r/digest_table_full.result:
  md5 hashes of statement digests differ, because yacc token codes are different in mariadb
mysql-test/suite/perfschema/r/dml_handler.result:
  host table is not ported over yet
mysql-test/suite/perfschema/r/information_schema.result:
  host table is not ported over yet
mysql-test/suite/perfschema/r/nesting.result:
  this differs, because we don't rewrite general log queries, and multi-statement
  packets are logged as a one entry. this result file is identical to what mysql-5.6.5
  produces with the --log-raw option.
mysql-test/suite/perfschema/r/relaylog.result:
  MariaDB modifies the binlog index file directly, while MySQL 5.6 has a feature "crash-safe binlog index" and modifies a special "crash-safe" shadow copy of the index file and then moves it over. That's why this test shows "NONE" index file writes in MySQL and "MANY" in MariaDB.
mysql-test/suite/perfschema/r/server_init.result:
  MariaDB initializes the "manager" resources from the "manager" thread, and starts this thread only when --flush-time is not 0. MySQL 5.6 initializes "manager" resources unconditionally on server startup.
mysql-test/suite/perfschema/r/stage_mdl_global.result:
  this differs, because MariaDB disables query cache when query_cache_size=0. MySQL does not
  do that, and this causes useless mutex locks and waits.
mysql-test/suite/perfschema/r/statement_digest.result:
  md5 hashes of statement digests differ, because yacc token codes are different in mariadb
mysql-test/suite/perfschema/r/statement_digest_consumers.result:
  md5 hashes of statement digests differ, because yacc token codes are different in mariadb
mysql-test/suite/perfschema/r/statement_digest_long_query.result:
  md5 hashes of statement digests differ, because yacc token codes are different in mariadb
mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result:
  will be updated to match 5.6 when alfranio.correia@oracle.com-20110512172919-c1b5kmum4h52g0ni and anders.song@greatopensource.com-20110105052107-zoab0bsf5a6xxk2y are merged
mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result:
  will be updated to match 5.6 when anders.song@greatopensource.com-20110105052107-zoab0bsf5a6xxk2y is merged
2012-09-27 20:09:46 +02:00
Sergei Golubchik
352d7cad1b merge 2012-09-27 15:02:17 +02:00
Sergey Petrunya
4db207d56d Cassandra SE: lazy connections
- Don't connect right away in ha_cassandra::open. If we do this, it becomes 
  impossible to do SHOW CREATE TABLE when the server is not present. 
- Note: CREATE TABLE still requires that connection is present, as it needs 
  to check whether the specified DDL can be used with Cassandra.  We could
  delay that check also, but then one would not be able to find out about 
  errors in table DDL until they do a SELECT.
2012-09-27 16:08:28 +04:00
Sergey Petrunya
2d88c4befb Cassandra SE
- Support UPDATE statements
- Follow what CQL does: don't show deleted rows (they show up as rows without any columns in reads)
2012-09-27 11:59:14 +04:00
Sergey Petrunya
c69a8fa616 - Update testcases
- Better error messages.
2012-09-26 19:02:12 +04:00
Sergey Petrunya
0362968be8 Cassandra SE:
- Add a test for ALTER TABLE
2012-09-26 14:57:45 +04:00
Sergey Petrunya
344c0ea423 Cassandra SE: Add capability to retry failed API calls
- Add capability to retry calls that have failed with UnavailableException or
  [Cassandra's] TimedOutException. 
- We don't retry for Thrift errors yet, although could easily do, now.
2012-09-26 14:13:03 +04:00
unknown
37155bf74a Fix some failures in 5.1 Buildbot:
- Fix some warnings in newer GCC (-Werror ...).
 - Fix wrong STACK_DIRECTION detected by configure due to compiler inlining.
2012-09-26 15:30:08 +02:00
unknown
7ca49db57c Merge from 5.1. 2012-09-26 18:29:49 +02:00
Sergey Petrunya
73dfd5782b Cassandra SE: more datatypes support
- Support mapping Cassandra's timestamp to INT64
- Support mapping Cassadnra's decimal to VARBINARY.
2012-09-25 16:20:19 +04:00
unknown
2f7d7c9f7f makes mi_test_all.sh & ma_test_all.sh working (MDEV-285) 2012-09-25 13:45:11 +03:00
Sergey Petrunya
366638718c Cassandra SE: varint datatype support:
- allow only VARBINARY(n), all other types can get meaningless data after conversions
- more comments
2012-09-24 20:58:26 +04:00
Sergey Petrunya
bce2e6683a Cassandra SE
- Add support for Cassandra's 'varint' datatype, mappable to VARBINARY.
2012-09-24 19:15:12 +04:00
Sergey Petrunya
c59faf95ae Cassandra SE: make consistency settings user-settable. 2012-09-22 23:30:29 +04:00
Michael Widenius
620d14f8c3 Automatic merge 2012-09-22 17:11:40 +03:00
Michael Widenius
3e83c4e8f9 Automatic merge 2012-09-22 15:30:24 +03:00
Sergey Petrunya
004e024775 Cassandra SE:
- Added @@cassandra_thrift_host global variable.
2012-09-20 14:22:36 +04:00
Marko Mäkelä
6bbe24e9a0 Bug#14636528 INNODB CHANGE BUFFERING IS NOT ENTIRELY CRASH-SAFE
Delete-mark change buffer records when resorting to a pessimistic
delete from the change buffer B-tree. Skip delete-marked records in
the change buffer merge and when estimating whether an operation can
be buffered. Without this fix, we could try to apply the same buffered
changes multiple times if the server was killed at the right moment.

In MySQL 5.5 and later: ibuf_get_volume_buffered_count_func(): Ignore
delete-marked (already processed) records.

ibuf_delete_rec(): Add a crash point before optimistic delete. If the
optimistic delete fails, flag the record processed before
mtr_commit().

ibuf_merge_or_delete_for_page(): Ignore delete-marked (already
processed) records.

Backport to 5.1: Rename btr_cur_del_unmark_for_ibuf() to
btr_cur_set_deleted_flag_for_ibuf() and add a parameter.

rb:1307 approved by Jimmy Yang
2012-09-19 22:35:38 +03:00
Michael Widenius
ae5bc05988 Fix for MDEV-533: Confusing error code when doing auto-increment insert for out-of-range values
create table t1 (a smallint primary key auto_increment);
insert into t1 values(32767);
insert into t1 values(NULL);
ERROR 1062 (23000): Duplicate entry '32767' for key 'PRIMARY

Now on always gets error HA_ERR_AUTOINC_RANGE=167 "Out of range value for column", independent of
store engine, SQL Mode or number of inserted rows. This is an unique error that is easier to test for in replication.

Another bug fix is that we now get an error when trying to insert a too big auto-generated value, even in non-strict mode.
Before one get insted the max column value inserted.
This patch also fixes some issues with inserting negative numbers in an auto-increment column.
Fixed the ER_DUP_ENTRY and HA_ERR_AUTOINC_ERANGE are compared the same between master and slave.
This ensures that replication works between an old server to a new slave for auto-increment overflow errors.
Added SQLSTATE errors for handler errors

Smaller bug fixes:
* Added warnings for duplicate key errors when using INSERT IGNORE
* Fixed bug when using --skip-log-bin followed by --log-bin, which did set log-bin to "0"
* Allow one to see how cmake is called by using --just-print --just-configure


BUILD/FINISH.sh:
  --just-print --just-configure now shows how cmake would be invoked. Good for understanding parameters to cmake.
cmake/configure.pl:
  --just-print --just-configure now shows how cmake would be invoked. Good for understanding parameters to cmake.
include/CMakeLists.txt:
  Added handler_state.h
include/handler_state.h:
  SQLSTATE for handler error messages.
  Required for HA_ERR_AUTOINC_ERANGE, but solves also some other cases.
mysql-test/extra/binlog_tests/binlog.test:
  Fixed old wrong behaviour
  Added more tests
mysql-test/extra/binlog_tests/binlog_insert_delayed.test:
  Reset binary log to only print what's necessary in show_binlog_events
mysql-test/extra/rpl_tests/rpl_auto_increment.test:
  Update to new error codes
mysql-test/extra/rpl_tests/rpl_insert_delayed.test:
  Ignore warnings as this depends on how the test is run
mysql-test/include/strict_autoinc.inc:
  On now gets an error on overflow
mysql-test/r/auto_increment.result:
  Update results after fixing error message
mysql-test/r/auto_increment_ranges_innodb.result:
  Test new behaviour
mysql-test/r/auto_increment_ranges_myisam.result:
  Test new behaviour
mysql-test/r/commit_1innodb.result:
  Added warnings for duplicate key error
mysql-test/r/create.result:
  Added warnings for duplicate key error
mysql-test/r/insert.result:
  Added warnings for duplicate key error
mysql-test/r/insert_select.result:
  Added warnings for duplicate key error
mysql-test/r/insert_update.result:
  Added warnings for duplicate key error
mysql-test/r/mix2_myisam.result:
  Added warnings for duplicate key error
mysql-test/r/myisam_mrr.result:
  Added warnings for duplicate key error
mysql-test/r/null_key.result:
  Added warnings for duplicate key error
mysql-test/r/replace.result:
  Update to new error codes
mysql-test/r/strict_autoinc_1myisam.result:
  Update to new error codes
mysql-test/r/strict_autoinc_2innodb.result:
  Update to new error codes
mysql-test/r/strict_autoinc_3heap.result:
  Update to new error codes
mysql-test/r/trigger.result:
  Added warnings for duplicate key error
mysql-test/r/xtradb_mrr.result:
  Added warnings for duplicate key error
mysql-test/suite/binlog/r/binlog_innodb_row.result:
  Updated result
mysql-test/suite/binlog/r/binlog_row_binlog.result:
  Out of range data for auto-increment is not inserted anymore
mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result:
  Updated result
mysql-test/suite/binlog/r/binlog_stm_binlog.result:
  Out of range data for auto-increment is not inserted anymore
mysql-test/suite/binlog/r/binlog_unsafe.result:
  Updated result
mysql-test/suite/innodb/r/innodb-autoinc.result:
  Update to new error codes
mysql-test/suite/innodb/r/innodb-lock.result:
  Updated results
mysql-test/suite/innodb/r/innodb.result:
  Updated results
mysql-test/suite/innodb/r/innodb_bug56947.result:
  Updated results
mysql-test/suite/innodb/r/innodb_mysql.result:
  Updated results
mysql-test/suite/innodb/t/innodb-autoinc.test:
  Update to new error codes
mysql-test/suite/maria/maria3.result:
  Updated result
mysql-test/suite/maria/mrr.result:
  Updated result
mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result:
  Updated result
mysql-test/suite/rpl/r/rpl_auto_increment.result:
  Update to new error codes
mysql-test/suite/rpl/r/rpl_insert_delayed,stmt.rdiff:
  Updated results
mysql-test/suite/rpl/r/rpl_loaddatalocal.result:
  Updated results
mysql-test/t/auto_increment.test:
  Update to new error codes
mysql-test/t/auto_increment_ranges.inc:
  Test new behaviour
mysql-test/t/auto_increment_ranges_innodb.test:
  Test new behaviour
mysql-test/t/auto_increment_ranges_myisam.test:
  Test new behaviour
mysql-test/t/replace.test:
  Update to new error codes
mysys/my_getopt.c:
  Fixed bug when using --skip-log-bin followed by --log-bin, which did set log-bin to "0"
sql/handler.cc:
  Ignore negative values for signed auto-increment columns
  Always give an error if we get an overflow for an auto-increment-column (instead of inserting the max value)
  Ensure that the row number is correct for the out-of-range-value error message.
  
  
  ******
  Fixed wrong printing of column namn for "Out of range value" errors
  Fixed that INSERT_ID is correctly replicated also for out-of-range autoincrement values
  Fixed that print_keydup_error() can also be used to generate warnings
  ******
  Return HA_ERR_AUTOINC_ERANGE (167) instead of ER_WARN_DATA_OUT_OF_RANGE for auto-increment overflow
sql/handler.h:
  Allow INSERT IGNORE to continue also after out-of-range inserts.
  Fixed that print_keydup_error() can also be used to generate warnings
sql/log_event.cc:
  Added DBUG_PRINT
  Fixed the ER_AUTOINC_READ_FAILED, ER_DUP_ENTRY and HA_ERR_AUTOINC_ERANGE are compared the same between master and slave.
  This ensures that replication works between an old server to a new slave for auto-increment overflow errors.
sql/sql_insert.cc:
  Add warnings for duplicate key errors when using INSERT IGNORE
sql/sql_state.c:
  Added handler errors
sql/sql_table.cc:
  Update call to print_keydup_error()
storage/innobase/handler/ha_innodb.cc:
  Fixed increment handling of auto-increment columns to be consistent with rest of MariaDB.
storage/xtradb/handler/ha_innodb.cc:
  Fixed increment handling of auto-increment columns to be consistent with rest of MariaDB.
2012-09-18 15:14:19 +03:00
Marko Mäkelä
300f3fb77f Bug#12701488 ASSERT PAGE_ZIP_VALIDATE, UNIV_ZIP_DEBUG
page_zip_validate(), page_zip_validate_low(): Add a parameter for the
B-tree index.

page_zip_validate_low(): If the page contents does not match, check
that the record link chains match. Furthermore, if dict_index_t is
passed, check that the records match. (This reduces coverage a bit: if
index=NULL, we will ignore differences in record contents, that is,
the page payload.)

rb:1264 approved by Inaam Rana
2012-09-17 14:21:00 +03:00
Sergey Petrunya
eb63b07ace Cassandra SE:
- added option thrift_port which allows to specify which port to connect to
- not adding username/password - it turns out, there are no authentication
  schemes in stock cassandra distribution.
2012-09-16 12:22:21 +04:00
Michael Widenius
cd9f773020 Automatic merge 2012-09-15 13:58:12 +03:00
Sergey Petrunya
c3de7c977a MDEV-530: Cassandra SE: Locking is incorrect
- Use more permissive locking.
2012-09-14 09:25:42 +04:00
Sergey Petrunya
c7b41e5d46 Cassandra SE
- Also provide handling for generic Thrift exceptions. These are not listed in the 'throws' clause
  of API definition but still can happen.
2012-09-14 09:03:25 +04:00
Sergey Petrunya
d6f2d692c1 Cassandra SE
- Catch all kinds of exceptions when calling Thrift code.
2012-09-14 08:44:34 +04:00
unknown
288eeb3a31 MDEV-232: Remove one fsync() from commit phase.
Introduce a new storage engine API method commit_checkpoint_request().
This is used to replace the fsync() at the end of every storage engine
commit with a single fsync() when a binlog is rotated.

Binlog rotation is now done during group commit instead of being
delayed until unlog(), removing some server stall and avoiding an
expensive lock/unlock of LOCK_log inside unlog().
2012-09-13 14:31:29 +02:00
Sergey Petrunya
16fec32ecc Cassandra SE: small optimization: StringCopyConverter::mariadb_to_cassandra doesn't need to make NULL-terminated strings. 2012-09-12 20:52:23 +04:00
Michael Widenius
1539f91267 Fixed Bug#1002564: Wrong result for a lookup query from a heap table
mysql-test/suite/heap/heap_hash.result:
  Added test case
mysql-test/suite/heap/heap_hash.test:
  Added test case
storage/heap/hp_hash.c:
  Limit key data length to max key length
2012-09-10 16:46:33 +03:00
Annamalai Gurusami
356c42d2c2 Merge from mysql-5.1 to mysql-5.5. 2012-09-28 16:42:31 +05:30
Inaam Rana
76e4d6acf0 Bug#14594600 ASSERT FROM DROP TABLE CONCURRENT WITH IBUF MERGES
rb://1293
approved by: Marko Makela

There is race when dropping a single table tablespace where a reader
thread can initiate a read request before the delete flag is set and
before it is finished the deleting thread can attempt to free the
fil_node.

This patch checks the status in fil_io() to make sure that the
tablespace is not being deleted. If it is being deleted then
an error is returned instead of attempting IO.
2012-09-20 08:44:33 -04:00
Marko Mäkelä
161a91d39f Merge mysql-5.1 to mysql-5.5. 2012-09-19 22:55:26 +03:00
Marko Mäkelä
d7089f6f3e Merge mysql-5.1 to mysql-5.5. 2012-09-17 14:32:07 +03:00
Sergey Petrunya
a3f33268ec Cassandra SE: add support for reading counter type values 2012-09-10 14:40:07 +04:00
Sergey Petrunya
4986de84ad Cassandra SE: added support for boolean type. 2012-09-07 15:32:43 +04:00
Sergei Golubchik
6af914f8b9 XtraDB from Percona-Server-5.5.27-rel28.1 2012-09-05 13:14:37 +02:00
Michael Widenius
1999be8d4e Automatic merge with 5.5 2012-09-01 00:54:54 +03:00
Michael Widenius
d13b5812b8 Updated TODO
Next step of merge

storage/myisam/mi_create.c:
  Merge from 5.6
2012-08-31 23:52:08 +03:00
Annamalai Gurusami
f3a6816fe5 Bug #13453036 ERROR CODE 1118: ROW SIZE TOO LARGE - EVEN
THOUGH IT IS NOT.

The following error message is misleading because it claims 
that the BLOB space is not counted.  

"ERROR 1118 (42000): Row size too large. The maximum row size for 
the used table type, not counting BLOBs, is 8126. You have to 
change some columns to TEXT or BLOBs"

When the ROW_FORMAT=compact or ROW_FORMAT=REDUNDANT is used,
the BLOB prefix is stored inline along with the row.  So 
the above error message is changed as follows depending on
the row format used:

For ROW_FORMAT=COMPRESSED or ROW_FORMAT=DYNAMIC, the error
message is as follows:

"ERROR 42000: Row size too large (> 8126). Changing some
columns to TEXT or BLOB may help. In current row format, 
BLOB prefix of 0 bytes is stored inline."

For ROW_FORMAT=COMPACT or ROW_FORMAT=REDUNDANT, the error
message is as follows:

"ERROR 42000: Row size too large (> 8126). Changing some
columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or 
ROW_FORMAT=COMPRESSED may help. In current row
format, BLOB prefix of 768 bytes is stored inline."

rb://1252 approved by Marko Makela
2012-08-31 15:42:00 +05:30
Sergey Petrunya
12ab6a4f3c MDEV-498: Cassandra: Inserting a timestamp does not work on a 32-bit system
- Make an attempt at fixing.
2012-08-31 11:03:59 +04:00
Sergey Petrunya
6cce520472 Cassandra SE
- add support for Cassandra's UUID datatype. We map it to CHAR(36).
2012-08-31 10:49:36 +04:00
Marko Mäkelä
d37f6298cf Bug#14554000 CRASH IN PAGE_REC_GET_NTH_CONST(NTH=0) DURING COMPRESSED
PAGE SPLIT

page_rec_get_nth_const(): Map nth==0 to the page infimum.

btr_compress(adjust=TRUE): Add a debug assertion for nth>0. The cursor
should never be positioned on the page infimum.

btr_index_page_validate(): Add test instrumentation for checking the
return values of page_rec_get_nth_const() during CHECK TABLE, and for
checking that the page directory slot 0 always contains only one
record, the predefined page infimum record.

page_cur_delete_rec(), page_delete_rec_list_end(): Add debug
assertions guarding against accessing the page slot 0.

page_copy_rec_list_start(): Clarify a comment about ret_pos==0.

rb:1248 approved by Jimmy Yang
2012-08-30 21:53:41 +03:00
Marko Mäkelä
961486e524 Bug#14547952: DEBUG BUILD FAILS ASSERTION IN RECORDS_IN_RANGE()
ha_innodb::records_in_range(): Remove a debug assertion
that prohibits an open range (full table).

The patch by Jorgen Loland only removed the assertion from the
built-in InnoDB, not from the InnoDB Plugin.
2012-08-30 21:49:24 +03:00
Sergey Petrunya
29e9406a82 Cassandra SE: fix batched insert to flush its buffers after insert operation. 2012-08-29 20:27:11 +04:00
Sergey Petrunya
6a827daf61 Fix for the previous cset: Field::store_TIME() accepts microseconds fraction, not millisecond. 2012-08-29 11:14:04 +04:00
Sergey Petrunya
fd53cbbff6 Cassandra SE: Timestamp data type support. 2012-08-29 11:05:46 +04:00
Sergey Petrunya
22e71e4cc1 Cassandra SE
- Add mapping for INT datatype
- Primary key column should now be named like CQL's primary key, 
  or 'rowkey' if CF has key_alias.
2012-08-29 10:05:21 +04:00
Sergey Petrunya
c34b24ff88 Cassandra storage engine: add @@rnd_batch_size variable. 2012-08-29 07:39:22 +04:00
Sergey Petrunya
c943dfd8b2 MDEV-494, part #1: phantom row for big full-scan selects
- Full table scan internally uses LIMIT n, and re-starts the scan from
  the last seen rowkey value.  rowkey ranges are inclusive, so we will
  see the same rowkey again. We should ignore it.
2012-08-28 20:22:45 +04:00
Jorgen Loland
816a8b5384 Bug#14547952: DEBUG BUILD FAILS ASSERTION IN RECORDS_IN_RANGE()
ha_innobase::records_in_range(): Remove a debug assertion
that prohibits an open range (full table).
This assertion catches unnecessary calls to this method, 
but such calls are not harming correctness.
2012-08-28 14:51:01 +02:00
Sergey Petrunya
869826d770 MDEV-480: TRUNCATE TABLE on a Cassandra table does not remove rows
- Remove HTON_CAN_RECREATE flag, re-create won't delete rows in cassandra.
2012-08-28 12:53:33 +04:00
Sergey Petrunya
8eb16159e1 Cassandra storage engine: BKA support
- We use HA_MRR_NO_ASSOC ("optimizer_switch=join_cache_hashed") mode
- Not able to use BKA's buffers yet.
- There is a variable to control batch size
- There are status counters.
- Nedeed to make some fixes in BKA code (to be checked with Igor)
2012-08-27 08:44:58 +04:00
Sergey Petrunya
fdab0300c1 Cassandra storage engine: bulk INSERT support
- bulk inserts themselves
- control variable and counters.
2012-08-26 16:06:39 +04:00
Alexey Botchkov
d99b8004e6 SQL syntax extended with START TRANSACTION READ ONLY|READ WRITE
and SET TRANSACTION READ ONLT|READ WRITE
statements.


per-file comments:
  mysql-test/include/check-warnings.test
        READ ONLY transaction flag cleaned.
  mysql-test/r/commit.result
        result updated
  mysql-test/r/read_only.result
        result updated
  mysql-test/t/commit.test
        tests added.
  mysql-test/t/read_only.test
        tests added
  sql/lex.h
        ONLY symbol added.
  sql/sql_base.cc
        DBUG_RETURN added.
  sql/sql_parse.cc
        implementations added.
  sql/sql_yacc.yy
        SQL syntax extended.
  storage/perfschema/gen_pfs_lex_token
        changes forced by lex.h
  storage/perfschema/pfs_lex_token.h
        changes forced by lex.h
2012-08-25 20:57:17 +05:00
Sergei Golubchik
e988c4dde6 MDEV-336 oqgraph 5.5 crashes in buildbot
force -fno-strict-aliasing for oqgraph
2012-08-24 23:43:18 +02:00
Annamalai Gurusami
9d41d7c57b Bug #14500557 CRASH WHEN USING LONG INNODB INDEXES
The ha_innobase table handler contained two search key buffers
(srch_key_val1, srch_key_val2) of fixed size used to store the search
key.  The size of these buffers where fixed at
REC_VERSION_56_MAX_INDEX_COL_LEN + 2.  But this size is not sufficient
to hold the search key.  Hence the following assert in
row_sel_convert_mysql_key_to_innobase() failed.

2438                 /* Storing may use at most data_len bytes of buf */
2439 
2440                 if (UNIV_LIKELY(!is_null)) {
2441                         ut_a(buf + data_len <= original_buf + buf_len);
2442                         row_mysql_store_col_in_innobase_format(
2443                                 dfield, buf,
2444                                 FALSE, /* MySQL key value format col */
2445                                 key_ptr + data_offset, data_len,
2446                                 dict_table_is_comp(index->table));
2447                         buf += data_len;
2448                 }

The buffer size is now calculated with the formula
MAX_KEY_LENGTH + MAX_REF_PARTS*2.  This properly takes into account
the extra bytes needed to store the length for each column.  An index
can contain a maximum of MAX_REF_PARTS columns in it, and for each
column 2 bytes are needed to store length.  

rb://1238 approved by Marko and Vasil Dimov.
2012-09-04 14:33:56 +05:30
Annamalai Gurusami
3f0e739e3e Merge from mysql-5.1 to mysql-5.5. 2012-09-01 11:27:53 +05:30
Marko Mäkelä
22c0db6c3b Merge mysql-5.1 to mysql-5.5. 2012-08-30 22:01:23 +03:00
Aditya A
30aadd6b41 Bug#14145950 AUTO_INCREMENT ON DOUBLE WILL FAIL ON WINDOWS
Backport from mysql-5.6 the fix
(revision-id sunny.bains@oracle.com-20120315045831-20rgfa4cozxmz7kz)

  Bug#13839886 - CRASH IN INNOBASE_NEXT_AUTOINC
  
  The assertion introduce in the fix for Bug#13817703 
  is too strong, a negative  number can be greater 
  than the column max value, when the column value is
  a negative number.
  
  rb://978 Approved by Jimmy Yang.

rb:1236 approved by Marko Makela
2012-08-27 15:42:11 +05:30
Marc Alff
9bc328a41a Bug#13417440 : 63340: ARCHIVE FILE IO NOT INSTRUMENTED
WARNING

This patch is for mysql-5.5 only,
to be null-merged to mysql-5.6 and mysql-trunk.

This is a partial rollback of the file io instrumentation,
removing the instrumentation for mysql_file_stat in the archive engine.

See the bug comments for details.
2012-08-24 10:01:59 +02:00
Sergey Petrunya
38a3df4a2c - Enable mapping of CHAR(n)
- preparations for support of bulk INSERT.
2012-08-23 21:16:01 +04:00
Sergey Petrunya
38d4e02559 # MDEV-476: Cassandra: Server crashes in calculate_key_len on DELETE with ORDER BY
- Fix typo in ha_cassandra::rnd_pos().
- in ::index_read_map(), do not assume that pk column is part of table->read_set.
2012-08-23 16:15:28 +04:00
Sergei Golubchik
4201939d57 remove mysql-5.1 assert that is already absent in mysql-5.5 2012-08-23 13:52:36 +02:00
Sergei Golubchik
f72a765997 5.2 merge.
two tests still fail:
  main.innodb_icp and main.range_vs_index_merge_innodb
  call records_in_range() with both range ends being open
  (which triggers an assert)
2012-08-22 16:45:25 +02:00
Sergei Golubchik
1fd8150a5b 5.1 merge
increase xtradb verson from 13.0 to 13.01
2012-08-22 16:13:54 +02:00
Sergei Golubchik
115a296756 merge with XtraDB as of Percona-Server-5.1.63-rel13.4 2012-08-22 16:10:31 +02:00
Sergei Golubchik
cefc30b166 merge with MySQL 5.1.65 2012-08-22 11:40:39 +02:00
Sergei Golubchik
0af0e7a70a merge XtraDB 1.1.8-27.0 from Percona-Server-5.5.25a-rel27.1 2012-08-22 09:56:20 +02:00
Sergey Petrunya
06ea60d221 Make ha_cassandra work with filesort(). 2012-08-21 18:38:27 +04:00
Marko Mäkelä
3f249921f8 Fix regression from Bug#12845774 OPTIMISTIC INSERT/UPDATE USES WRONG
HEURISTICS FOR COMPRESSED PAGE SIZE

The fix of Bug#12845774 was supposed to skip known-to-fail
btr_cur_optimistic_insert() calls. There was only one such call, in
btr_cur_pessimistic_update(). All other callers of
btr_cur_pessimistic_insert() would release and reacquire the B-tree
page latch before attempting the pessimistic insert. This would allow
other threads to restructure the B-tree, allowing (and requiring) the
insert to succeed as an optimistic (single-page) operation.

Failure to attempt an optimistic insert before a pessimistic one would
trigger an attempt to split an empty page.

rb:1234 approved by Sunny Bains
2012-08-21 10:47:17 +03:00
Michael Widenius
75e8ce6d73 Ensure we don't assert with debug binaries if SHOW INNODB STATUS returns with an error.
sql/handler.cc:
  SHOW INNODB STATUS sometimes returns 0 even if it has generated an error.
  This code is here to catch it until InnoDB some day is fixed.
storage/innobase/handler/ha_innodb.cc:
  Catch at least one of the possible errors from SHOW INNODB STATUS to provide a correct return code.
storage/xtradb/handler/ha_innodb.cc:
  Catch at least one of the possible errors from SHOW INNODB STATUS to provide a correct return code.
support-files/my-huge.cnf.sh:
  Fixed typo
2012-08-20 22:54:15 +03:00
Sergey Petrunya
81817412aa Read records in batches when doing full table scan. 2012-08-20 12:08:29 +04:00
Sergey Petrunya
38bc66fb1a position() and rnd_pos() implementations. 2012-08-19 14:54:58 +04:00
Sergey Petrunya
62c1c3f0c5 MDEV-431: Cassandra storage engine
- Partial support for DELETE ... WHERE.
2012-08-19 13:21:23 +04:00
Sergey Petrunya
d36259703b MDEV-431: Cassandra storage engine
- Descriptive error messages
- Unpack PK column on range scans
2012-08-19 12:50:53 +04:00
Sergey Petrunya
9cdf5eeec9 MDEV-431: Cassandra storage engine
- Support "DELETE FROM cassandra_table"
2012-08-18 21:29:31 +04:00
Sergey Petrunya
ab28174122 MDEV-431: Cassandra storage engine
- Got range reads to work (except for unpacking of the rowkey value)
2012-08-18 21:21:50 +04:00
Sergey Petrunya
0d840d4d23 MDEV-431: Cassandra storage engine
- Introduce type converters (so far rather trivial)
- switch INSERT to using batch_mutate()
2012-08-18 16:28:35 +04:00
Sergey Petrunya
c15914f761 Initial commit for Cassandra storage engine. 2012-08-17 21:13:20 +04:00
Marko Mäkelä
b252933551 Merge mysql-5.1 to mysql-5.5. 2012-08-21 10:59:11 +03:00
Michael Widenius
f1159b18d9 More fixes 2012-08-17 16:46:34 +03:00
Marko Mäkelä
bd6dbf21bb Merge mysql-5.1 to mysql-5.5. 2012-08-16 18:47:26 +03:00
Marko Mäkelä
e288e649c5 Bug#12595091 POSSIBLY INVALID ASSERTION IN BTR_CUR_PESSIMISTIC_UPDATE()
Facebook got a case where the page compresses really well so that
btr_cur_optimistic_update() returns DB_UNDERFLOW, but when a record
gets updated, the compression rate radically changes so that
btr_cur_insert_if_possible() can not insert in place despite
reorganizing/recompressing the page, leading to the assertion failing.

rb:1220 approved by Sunny Bains
2012-08-16 17:45:39 +03:00
Marko Mäkelä
6d7f6baa22 Bug#12845774 OPTIMISTIC INSERT/UPDATE USES WRONG HEURISTICS FOR
COMPRESSED PAGE SIZE

This was submitted as MySQL Bug 61456 and a patch provided by
Facebook. This patch follows the same idea, but instead of adding a
parameter to btr_cur_pessimistic_insert(), we simply remove the
btr_cur_optimistic_insert() call there and add it to the only caller
that needs it.

btr_cur_pessimistic_insert(): Do not try btr_cur_optimistic_insert().

btr_insert_on_non_leaf_level_func(): Invoke btr_cur_optimistic_insert()
before invoking btr_cur_pessimistic_insert().

btr_cur_pessimistic_update(): Clarify in a comment why it is not
necessary to invoke btr_cur_optimistic_insert().

btr_root_raise_and_insert(): Assert that the root page is not empty.
This could happen if a pessimistic insert (involving a split or merge)
is performed without first attempting an optimistic (intra-page) insert.

rb:1219 approved by Sunny Bains
2012-08-16 17:37:52 +03:00
Marko Mäkelä
95247de260 Bug#13523839 ASSERTION FAILURES ON COMPRESSED INNODB TABLES
btr_cur_optimistic_insert(): Remove a bogus assertion. The insert may
fail after reorganizing the page.

btr_cur_optimistic_update(): Do not attempt to reorganize compressed pages,
because compression may fail after reorganization.

page_copy_rec_list_start(): Use page_rec_get_nth() to restore to the
ret_pos, which may also be the page infimum.

rb:1221
2012-08-16 17:31:23 +03:00
Michael Widenius
dd8bd2e4c3 Fixed compiler warnings
sql/item_subselect.cc:
  Added purecov info
sql/sql_select.cc:
  Added cast
storage/innobase/handler/ha_innodb.cc:
  Added cast
storage/xtradb/btr/btr0btr.c:
  Added buf_block_get_frame_fast() to avoid compiler warning
storage/xtradb/handler/ha_innodb.cc:
  Added cast
storage/xtradb/include/buf0buf.h:
  Innodb has buf_block_get_frame(block) defined as (block)->frame.
  Didn't want to do a big change to break xtradb as it may use block_get_frame() differently, so I mad this quick hack to patch one compiler warning.
2012-08-15 09:34:18 +03:00
Michael Widenius
b886cac712 Fixed compiler errors
Updated test to also work on 32 bit

mysql-test/suite/heap/heap.test:
  Updated test to also work on 32 bit
2012-08-14 19:59:28 +03:00
Michael Widenius
60589aeee0 Next part of merge. See TODO for details 2012-08-14 17:23:34 +03:00
Michael Widenius
c0f04fa31c Automatic merge 2012-08-13 23:45:16 +03:00
Michael Widenius
cee888acb3 Fixed compiler warnings (A few of these was bugs)
client/mysqldump.c:
  Slave needs to be initialized with 0
dbug/dbug.c:
  Removed not existing function
plugin/semisync/semisync_master.cc:
  Fixed compiler warning
sql/opt_range.cc:
  thd needs to be set early as it's used in some error conditions.
sql/sql_table.cc:
  Changed to use uchar* to make array indexing portable
storage/innobase/handler/ha_innodb.cc:
  Removed not used variable
storage/maria/ma_delete.c:
  Fixed compiler warning
storage/maria/ma_write.c:
  Fixed compiler warning
2012-08-13 22:23:28 +03:00
Sergei Golubchik
c9b95de246 MDEV-336 oqgraph 5.5 crashes in buildbot
compile oqgraph with -fno-strict-aliasing
2012-08-11 10:31:10 +02:00
Sergei Golubchik
d11829654c merge with MySQL 5.5.27
manually checked every change, reverted incorrect or stupid changes.
2012-08-09 17:22:00 +02:00
Marko Mäkelä
05c6614d01 Merge mysql-5.1 to mysql-5.5. 2012-08-09 10:06:59 +03:00
Marko Mäkelä
bb84947969 Bug#14399148 INNODB TABLES UNDER LOAD PRODUCE DUPLICATE COPIES OF ROWS
IN QUERIES

This bug was caused by an incorrect fix of
Bug#13807811 BTR_PCUR_RESTORE_POSITION() CAN SKIP A RECORD

There was nothing wrong with btr_pcur_restore_position(), but with the
use of it in the table scan during index creation.

rb:1206 approved by Jimmy Yang
2012-08-09 09:55:29 +03:00
Michael Widenius
b39e6e3d09 Added support of thd->tx_read_only
Moved timestamp handling from all handler::write() methods in the storage engines to handler::ha_write

sql/handler.cc:
  Added PSI_CALL's
2012-08-07 07:25:15 +03:00
Michael Widenius
f2d7609ac0 Use less memory when growing HEAP tables. See MDEV-436
mysql-test/suite/heap/heap.result:
  Added test case for MDEV-436
mysql-test/suite/heap/heap.test:
  Added test case for MDEV-436
storage/heap/hp_block.c:
  Don't allocate a set of HP_PTRS when not needed. This saves us about 1024 bytes for most allocations.
storage/heap/hp_create.c:
  Made the initial allocation of block sizes depending on min_records and max_records.
2012-08-07 01:58:05 +03:00
Michael Widenius
a7123f5075 Fixed compiler warnings
sql/log.h:
  Fixed compiler warnings reported for gcc 2.7.1
storage/xtradb/handler/ha_innodb.cc:
  Remove not used variables
2012-08-06 16:33:11 +03:00
Michael Widenius
0a70eb33d1 Fixed test failures (part of merge) 2012-08-01 21:16:18 +03:00
Sergei Golubchik
6ed4a283fd MDEV-399 Combinations defined in the base suite cannot be skipped by overlay
When appliying parent combinations to the overlay,
filter them through the %skip_combinations using the overlayed filename
2012-08-01 19:57:36 +02:00
Vladislav Vaintroub
bd39599668 fix oqgraph on MSVC 2012-08-02 23:17:27 +02:00
Michael Widenius
1d0f70c2f8 Temporary commit of merge of MariaDB 10.0-base and MySQL 5.6 2012-08-01 17:27:34 +03:00
Sergei Golubchik
6d4acc43e5 MDEV-336 oqgraph 5.5 crashes in buildbot
make CMakeLists.txt to detect if the installed boost can be compiled with the
installed compile and specified set of compiler options.

Background: even sufficiently new Boost cannot be compiled with the sufficiently old gcc
in the presence of -fno-rtti
2012-07-31 22:39:33 +02:00
Sergei Golubchik
0117a92fed MDEV-419 ensure that all HAVE_XXX constants can be set by cmake
add missing checks to configure.cmake
remove dead code and unused HAVE_xxx constants from the sources
2012-07-31 19:29:07 +02:00
Venkata Sidagam
fdaafddd80 Bug #12876932 - INCORRECT SELECT RESULT ON FEDERATED TABLE
Merged from mysql-5.1 to mysql-5.5
2012-07-26 15:29:19 +05:30
Venkata Sidagam
aef1982be0 Bug #12876932 - INCORRECT SELECT RESULT ON FEDERATED TABLE
Problem description:
Table 't' created with two colums having compound index on both the 
columns under innodb/myisam engine at remote machine. In the local 
machine same table is created undet the federated engine.
A select having where clause with along 'AND' operation gives wrong 
results on local machine.

Analysis: 
The given query at federated engine is wrongly transformed by 
federated::create_where_from_key() function and the same was sent to 
the remote machine. Hence the local machine is showing wrong results.

Given query "select c1 from t where c1 <= 2 and c2 = 1;"
Query transformed, after ha_federated::create_where_from_key() function is:
SELECT `c1`, `c2` FROM `t` WHERE  (`c1` IS NOT NULL ) AND 
( (`c1` >= 2)  AND  (`c2` <= 1) ) and the same sent to real_query().
In the above the '<=' and '=' conditions were transformed to '>=' and 
'<=' respectively.

ha_federated::create_where_from_key() function behaving as below:
The key_range is having both the start_key and end_key. The start_key 
is used to get "(`c1` IS NOT NULL )" part of the where clause, this 
transformation is correct. The end_key is used to get "( (`c1` >= 2) 
AND  (`c2` <= 1) )", which is wrong, here the given conditions('<=' and '=') 
are changed as wrong conditions('>=' and '<=').
The end_key is having {key = 0x39fa6d0 "", length = 10, keypart_map = 3, 
flag = HA_READ_AFTER_KEY}

The store_length is having value '5'. Based on store_length and length 
values the condition values is applied in HA_READ_AFTER_KEY switch case.
The switch case 'HA_READ_AFTER_KEY' is applicable to only the last part of 
the end_key and for previous parts it is going to 'HA_READ_KEY_OR_NEXT' case, 
here the '>=' is getting added as a condition instead of '<='.

Fix:
Updated the 'if' condition in 'HA_READ_AFTER_KEY' case to affect for all 
parts of the end_key. i.e 'i > 0' will used for end_key, Hence added it in 
the if condition.


mysql-test/suite/federated/federated.test:
  modified the federated.inc file location
mysql-test/suite/federated/federated_archive.test:
  modified the federated.inc file location
mysql-test/suite/federated/federated_bug_13118.test:
  modified the federated.inc file location
mysql-test/suite/federated/federated_bug_25714.test:
  modified the federated.inc file location
mysql-test/suite/federated/federated_bug_35333.test:
  modified the federated.inc file location
mysql-test/suite/federated/federated_debug.test:
  modified the federated.inc file location
mysql-test/suite/federated/federated_innodb.test:
  modified the federated.inc file location
mysql-test/suite/federated/federated_server.test:
  modified the federated.inc file location
mysql-test/suite/federated/federated_transactions.test:
  modified the federated.inc file location
mysql-test/suite/federated/include/federated.inc:
  moved the file from federated suite to federated/include folder
mysql-test/suite/federated/include/federated_cleanup.inc:
  moved the file from federated suite to federated/include folder
mysql-test/suite/federated/include/have_federated_db.inc:
  moved the file from federated suite to federated/include folder
storage/federated/ha_federated.cc:
  updated the 'if condition' in ha_federated::create_where_from_key() 
  function.
2012-07-26 15:09:22 +05:30
Annamalai Gurusami
1383660024 Bug #13113026 INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRUFROM 5.6 BACKPORT
Backporting the WL#5716, "Information schema table for InnoDB 
buffer pool information". Backporting revisions 2876.244.113, 
2876.244.102 from mysql-trunk.

rb://1175 approved by Jimmy Yang.
2012-07-25 13:51:39 +05:30
Annamalai Gurusami
1c6f78e337 Bug #13113026 INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRUFROM 5.6 BACKPORT
Backporting the WL#5716, "Information schema table for InnoDB
buffer pool information". Backporting revisions 2876.244.113,
2876.244.102 from mysql-trunk.

rb://1177 approved by Jimmy Yang.
2012-07-25 10:48:16 +05:30
Ashish Agarwal
d15e2f7214 BUG#13555854: CHECK AND REPAIR TABLE SHOULD BE MORE ROBUST [1]
ISSUE: Incorrect key file. Key file is corrupted,
       Reading incorrect key information (keyseg)
       from index file. Key definition in .MYI
       and .FRM file differs. Starting pointer
       to read the keyseg information is changed
       to a value greater than the pack_reclength.
       Memcpy tries to read keyseg information from
       unallocated memory which causes the crash.

SOLUTION: One more check added to compare the
          the key definition in .MYI and .FRM
          file. If the definition differ, server
          produces an error.
2012-07-23 14:05:13 +05:30
Axel Schwenke
1b1b36ab3e merged with maria/5.5 2012-07-19 13:21:53 +02:00
Sergey Petrunya
79c4b4e440 Merge 5.3->5.5 2012-07-18 22:40:15 +04:00
Sergey Petrunya
7e6bec87c1 MDEV-398: Sergv related to spacial queries
- index_merge/intersection is unable to work on GIS indexes, because:
  1. index scans have no Rowid-Ordered-Retrieval property
  2. When one does an index-only read over a GIS index, they do not 
     get the index tuple, because index only contains bounding box of the geometry.
     This is why key_copy() call crashed.
This patch fixes #1, which makes the problem go away. Theoretically, it would 
be nice to check #2, too, but SE API semantics is not sufficiently precise to do it.
2012-07-18 15:03:05 +04:00
Elena Stepanova
72a5542f0e MDEV-11: Generic storage engine test suite 2012-07-16 06:17:56 +04:00
unknown
9f6a1c5842 fixed MySQL bug#53775:
Now partition engine adds underlying tables to the QC and ask underlying tables engine permittion to cache the query and return result of the query.

Incorrect QC cleanup in case of table registration failure fixe.

Unified interface for myisammrg & partitioned engnes for QC.
2012-07-13 22:17:32 +03:00
Jon Olav Hauglid
a47e778a61 Bug#12623923 Server can crash after failure to create
primary key with innodb tables

The bug was triggered if a single ALTER TABLE statement both
added and dropped indexes and ALTER TABLE failed during drop
(e.g. because the index was needed in a foreign key constraint).
In such cases, the server index information would get out of
sync with InnoDB - the added index would be present inside
InnoDB, but not in the server. This could then lead to InnoDB
error messages and/or server crashes.

The root cause is that new indexes are added before old indexes
are dropped. This means that if ALTER TABLE fails while dropping
indexes, index changes will be reverted in the server but not
inside InnoDB.

This patch fixes the problem by dropping any added indexes
if drop fails (for ALTER TABLE statements that both adds
and drops indexes). 

However, this won't work if we added a primary key as this
key might not be possible to drop inside InnoDB. Therefore,
we resort to the copy algorithm if a primary key is added
by an ALTER TABLE statement that also drops an index.

In 5.6 this bug is more properly fixed by the handler interface
changes done in the scope of WL#5534 "Online ALTER".
2012-07-10 16:13:02 +02:00
Michael Widenius
5a86a61219 Fixed wrong error codes from InnoDB/XtraDB that caused %M to give system dependent error messages (for unknown error code)
- InnoDB now returns handler specific HA_WRONG_CREATE_OPTION instead of MySQL specific ER_ILLEGAL_HA_CREATE_OPTION
- This changes the user level error message from "Unknown error" to "Wrong create options"


mysql-test/r/lowercase_table2.result:
  Updated result file
mysql-test/r/partition_innodb_plugin.result:
  Updated to new error message
mysql-test/r/partition_open_files_limit.result:
  Updated result file
mysql-test/r/row-checksum-old.result:
  Updated to new error message
mysql-test/r/row-checksum.result:
  Updated to new error message
mysql-test/r/symlink.result:
  Updated result file
mysql-test/suite/innodb/r/innodb-create-options.result:
  Updated to new error message
mysql-test/suite/innodb/r/innodb-zip.result:
  Updated to new error message
mysql-test/suite/innodb/r/innodb.result:
  Updated to new error message
storage/innobase/handler/ha_innodb.cc:
  Return HA_WRONG_CREATE_OPTION instead of ER_ILLEGAL_HA_CREATE_OPTION
  This gives more clear and OS indepedent error messages
storage/xtradb/handler/ha_innodb.cc:
  Return HA_WRONG_CREATE_OPTION instead of ER_ILLEGAL_HA_CREATE_OPTION
  This gives more clear and OS indepedent error messages
2012-07-06 19:10:18 +03:00
Ashish Agarwal
5f313125d4 BUG#13555854: CHECK AND REPAIR TABLE SHOULD BE MORE ROBUST [1]
ISSUE: Incorrect key file. Key file is corrupted,
       Reading incorrect key information (keyseg)
       from index file. Key definition in .MYI
       and .FRM file differs. Starting pointer
       to read the keyseg information is changed
       to a value greater than the pack_reclength.
       Memcpy tries to read keyseg information from
       unallocated memory which causes the crash.

SOLUTION: One more check added to compare the
          the key definition in .MYI and .FRM
          file. If the definition differ, server
          produces an error.
2012-07-02 15:20:23 +05:30
Jon Olav Hauglid
66ef5b0d48 Bug#14238406 NEW COMPILATION WARNINGS WITH GCC 4.7 (-WERROR=NARROWING)
Manual merge from mysql-5.1 to mysql-5.5
2012-06-29 13:36:01 +02:00
Jon Olav Hauglid
1ede2dd814 Bug#14238406 NEW COMPILATION WARNINGS WITH GCC 4.7 (-WERROR=NARROWING)
This patch fixes various compilation warnings of the type
"error: narrowing conversion of 'x' from 'datatype1' to
'datatype2'
2012-06-29 13:25:57 +02:00