Commit graph

139 commits

Author SHA1 Message Date
jyang
e3e3bdcc9d branches/5.1: Fix bug #49238: Creating/Dropping a temporary table
while at 1023 transactions will cause assert. Handle possible
DB_TOO_MANY_CONCURRENT_TRXS when deleting metadata in
row_drop_table_for_mysql().

rb://220, approved by Marko
2010-01-12 05:59:16 +00:00
sunny
07ce318c4e branches/5.1: This is an interim fix, fix whitepsace issues. 2009-11-25 08:29:03 +00:00
sunny
c8597d1f5a branches/5.1: This is an interim fix, fix tests and make read float/double arg const. 2009-11-25 08:28:35 +00:00
sunny
c6412767e6 branches/5.1: This is an interim fix, fix white space errors. 2009-11-25 08:27:39 +00:00
sunny
ae439e4b0c branches/5.1: Fix BUG#49032 - auto_increment field does not initialize to last value in InnoDB Storage Engine.
We use the appropriate function to read the column value for non-integer
autoinc column types, namely float and double.

rb://208. Approved by Marko.
2009-11-25 08:26:27 +00:00
vasil
b64e197481 branches/5.1:
Fix typo.
2009-10-14 15:30:12 +00:00
jyang
5224d8a7b5 branches/5.1: Block creating table with column name conflicting
with Innodb reserved key words. (Bug #44369) rb://151 approved
by Sunny Bains.
2009-09-10 20:43:05 +00:00
jyang
db933d00cf branches/5.1: This is to revert change 5741. A return status for
create_table_def() needs to be fixed.
2009-09-04 03:07:34 +00:00
jyang
4af9311006 branches/5.1: Block creating table with column name conflicting
with Innodb reserved key words. (Bug #44369) rb://151 approved
by Sunny Bains.
2009-09-03 03:16:01 +00:00
marko
905f8f5cbc branches/5.1: row_unlock_for_mysql(): When the clustered index is unknown,
refuse to unlock the record.
(Bug #45357, caused by the fix of Bug #39320).
rb://132 approved by Sunny Bains.
2009-06-17 08:11:49 +00:00
marko
c0cf5d13c6 branches/5.1: row_unlock_for_mysql(): Do not unlock records that were
modified by the current transaction.  This bug was introduced or unmasked
in r4400.

rb://97 approved by Heikki Tuuri
2009-03-19 13:01:48 +00:00
marko
97e9f4cbd0 branches/5.1: Fix a bug in multi-table semi-consistent reads.
Remember the acquired record locks per table handle (row_prebuilt_t)
rather than per transaction (trx_t), so that unlock_row should successfully
unlock all non-matching rows in multi-table operations.
This deficiency was found while investigating Bug #39320.

rb://94 approved by Heikki Tuuri.
2009-03-12 08:06:44 +00:00
marko
66060b0d08 branches/5.1: row_sel_get_clust_rec_for_mysql(): Store the cursor position
also for unlock_row().  (Bug #39320)

rb://96 approved by Heikki Tuuri.
2009-03-12 07:38:05 +00:00
marko
d32440100b branches/5.1: Make
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
a true replacement of SET GLOBAL INNODB_LOCKS_UNSAFE_FOR_BINLOG=1.
This fixes an error that was introduced in r370, causing
semi-consistent read not to not unlock rows in READ COMMITTED mode.
(Bug #41671, Issue #146)

rb://67 approved by Heikki Tuuri
2008-12-22 14:05:19 +00:00
marko
7f5f09d63a branches/5.1: When converting a record to MySQL format, copy the default
column values for columns that are SQL NULL.  This addresses failures in
row-based replication (Bug #39648).

row_prebuilt_t: Add default_rec, for the default values of the columns in
MySQL format.

row_sel_store_mysql_rec(): Use prebuilt->default_rec instead of
padding columns.

rb://64 approved by Heikki Tuuri
2008-12-18 13:33:36 +00:00
marko
365445704c branches/5.1: row_mysql_store_col_in_innobase_format(): Correct a misleading
comment. In the UTF-8 encoding, ASCII takes 1 byte per character, while
the "latin1" character set (normally ISO-8859-1, but in MySQL it actually
refers to the Windows Code Page 1252 a.k.a. CP1252, WinLatin1)
takes 1 to 3 bytes (1 to 2 bytes for the ISO-8859-1 subset).
2008-11-07 12:54:10 +00:00
sunny
4ef075b54b branches/5.1: Backport changes from branches/zip r2725
Simplify the autoinc initialization code. This removes the
non-determinism related to reading the table's autoinc value for the first
time. This change has also reduced the sizeof dict_table_t by sizeof(ibool)
bytes because we don't need the dict_table_t::autoinc_inited field anymore.

Bug#39830 Table autoinc value not updated on first insert.
Bug#35498 Cannot get table test/table1 auto-inccounter value in ::info
Bug#36411 Failed to read auto-increment value from storage engine" in 5.1.24 auto-inc
rb://16
2008-10-23 04:30:32 +00:00
sunny
2e84d822af branches/5.1: Return the actual error code encountered when allocating
a new autoinc value. The change in behavior (bug) was introduced in 5.1.22
when we introduced the new AUTOINC locking model.

rb://31

Bug#40224 New AUTOINC changes mask reporting of deadlock/timeout errors
2008-10-22 08:01:18 +00:00
marko
be36f37f76 branches/5.1: Backport a fix from branches/zip r2763:
row_drop_database_for_mysql(): Postpone mem_free(table_name), so that
an error printout will not dereference freed memory.
2008-10-13 10:21:02 +00:00
sunny
5ad03895b3 branches/5.1: This bug has always existed but was masked by other errors. The
fix for bug# 38839 triggered this bug. When the offset and increment are > 1
we need to calculate the next value taking into consideration the two
variables. Previously we simply assumed they were 1 particularly offset was
never used. MySQL does its own calculation and that's probably why it seemed
to work in the past. We would return what we thought was the correct next
value and then MySQL would recalculate the actual value from that and return
it to the caller (e.g., handler::write_row()). Several new tests have been
added that try and catch some edge cases. The tests exposed a wrap around
error in MySQL next value calculation which was filed as bug#39828. The tests
will need to be updated once MySQL fix that bug.

One good side effect of this fix is that dict_table_t size has been
reduced by 8 bytes because we have moved the autoinc_increment field to
the row_prebuilt_t structure. See review-board for a detailed discussion.

rb://3
2008-10-03 22:48:04 +00:00
vasil
694b0deb94 branches/5.1:
Fix Bug#38231 Innodb crash in lock_reset_all_on_table() on TRUNCATE + LOCK / UNLOCK

In TRUNCATE TABLE and discard tablespace: do not remove table-level S
and X locks and do not assert on such locks not being wait locks.
Leave such locks alone.

Approved by:	Heikki (rb://14)
2008-10-01 06:13:13 +00:00
marko
06be45c3d1 branches/5.1: Identify SELECT statements by thd_sql_command() == SQLCOM_SELECT
instead of parsing the query string.  This fixes MySQL Bug #37885 without
us having to implement lexical analysis of SQL comments in yet another place.

thd_is_select(): A new predicate.

row_search_for_mysql(): Use thd_is_select().

Approved by Heikki.
2008-08-21 12:25:05 +00:00
sunny
61ab3c5492 branches/5.1: Fix for bug# 36793. This is a back port from branches/zip. This
code has been tested on a big-endian machine too.
2008-05-23 04:29:08 +00:00
vasil
1420a8558f branches/5.1:
Fix Bug#36169 create innodb compressed table with too large row size crashed

Sometimes it is possible that
row_drop_table_for_mysql(index->table_name, trx, FALSE); is invoked in
row_create_index_for_mysql() when the index object is freed so copy the
table name to a safe place beforehand and use the copy.

Approved by:	Sunny
2008-04-24 12:00:30 +00:00
vasil
0f2bbae135 branches/5.1:
Swap the order in which mysql_thd, mysql_query_str and *mysql_query_str
are checked for non-NULL.

Suggested by:	Marko
2008-03-27 12:02:34 +00:00
vasil
ad25389eae branches/5.1:
Check whether *trx->mysql_query_str is != NULL in addition to
trx->mysql_query_str. This adds more safety.

This may or may not fix Bug#35226 RBR event crashes slave.
2008-03-27 06:49:05 +00:00
vasil
063bc007b7 branches/5.1:
Fix Bug#34300 Tinyblob & tinytext fields currupted after export/import and alter in 5.1

Copy the BLOB fields, that are stored internally, to a safe place
(prebuilt->blob_heap) when converting a row from InnoDB format to
MySQL format in row_sel_store_mysql_rec().

The bug was introduced in:

 ------------------------------------------------------------------------
 r587 | osku | 2006-05-23 15:35:58 +0300 (Tue, 23 May 2006) | 3 lines
 
 Optimize BLOB selects by using prebuilt->blob_heap directly instead of first
 reading BLOB data to a temporary heap and then copying it to
 prebuilt->blob_heap.
 ------------------------------------------------------------------------

Approved by:	Heikki
2008-03-26 16:26:54 +00:00
sunny
e89ab3bf1d branches/5.1: Change the InnoDB autoinc type to ulint64. For this added a
new typedef to univ.i (ib_ulonglong). Added checks for overflow and removed
the assertion where it crashed previously, since the type has now changed
to unsigned, it doesn't make sense to check for < 0. Added new tests, to
check for overflow, for the different INT types supported for both
signed and unsigned.

Fixes Bug# 34335
2008-03-05 20:23:39 +00:00
vasil
5b92c4ecb8 branches/5.1:
Fix Bug#34053:
* In CREATE TABLE and DROP TABLE check whether the table in question is one
  of the magic innodb_monitor tables and whether the user has enough rights
  to mess with it before doing anything else.
* Implement a mysql-test testcase.

Approved by:	Heikki
2008-02-07 12:02:06 +00:00
vasil
44a1a6ba94 branches/5.1:
Fix typo in comment.
2008-02-05 14:30:41 +00:00
vasil
792a8e2d42 branches/5.1:
Merge r2160 from trunk/:

Fix Bug#18942 by dropping all foreign key constraints at the end of
DROP DATABASE. Usually, by then, there are no foreign constraints
left because all of them are dropped when the relevant tables are
dropped. This code is to ensure that any orphaned FKs are wiped too.
2007-12-06 08:21:22 +00:00
sunny
0924601f0d Fix for Bug# 31860, in the Bug 16979 fix there was an erroneous assertion that
autoincrement columns can't contain negative values. With the fix, the
autoincrement table counter is set to 0 if the maximum value read from
the autoinc column index is negative.

Add test for the bug fix but the test is not really useful as the server
needs to be restarted half way through the test. It has been added for 
reference only.
2007-10-26 16:51:40 +00:00
marko
62e98cd050 Set an error code when a deadlock occurs in semi-consistent read. (Bug #31494)
innodb-semi-consistent: New tests for InnoDB semi-consistent reads.
Unfortunately, these will not trigger Bug #31494, because there merely
occur lock wait timeouts, not deadlocks.
2007-10-17 05:36:42 +00:00
sunny
ff8221a856 Add debug lock checks to autoinc functions. Add lock guards around an
invocation of dict_table_autoinc_initialize().
2007-09-25 07:16:56 +00:00
sunny
88867daed7 Fix two bugs:
Bug# 30907: We don't rely on *first_value to be 0 when checking whether
get_auto_increment() has been invoked for the first time in a multi-row
INSERT. We instead use trx_t::n_autoinc_rows. Initialize trx::n_autoinc_rows
inside ha_innobase::start_stmt() too.

Bug# 30888: While adding code for the low level read of the AUTOINC value
from the index, the case for MEDIUM ints which are 3 bytes was missed
triggering an assertion.
2007-09-08 20:40:10 +00:00
sunny
7e9e89b3f4 Use the clustered index and not the one selected by the optimizer in the plan,
when building a previous version of the row. This bug is triggered when
running queries via InnoDB's internal SQL parser; when InnoDB's optimizer
selects a secondary index for the plan.
2007-09-06 23:50:26 +00:00
marko
5cace47b4b row_drop_table_for_mysql(): Before calling
dict_table_remove_from_cache(table) and thus freeing the memory
allocated for the table, copy the table name.  This avoids reading
freed memory when name == table->name.

Approved by Sunny.
2007-09-01 17:52:03 +00:00
marko
e06a17049a row_create_table_for_mysql(), row_truncate_table_for_mysql(),
row_drop_table_for_mysql(): Do not mention innodb_force_recovery
when newraw is set.
2007-08-30 14:27:47 +00:00
marko
a837135ef1 Correct the function comments of row_create_table_for_mysql() and
row_drop_table_for_mysql().
2007-08-30 09:01:24 +00:00
sunny
88f2671d65 Add comment that the variable dest should be word aligned. After discussion
on IM with Heikki.
2007-08-30 08:08:04 +00:00
sunny
2dde9e431f Fix a bug that handles the case where the host specific byte order matches
the InnoDB storage byte order, which is big-endian.
2007-08-30 05:46:21 +00:00
sunny
7fc6a02abd Fix for bug# 16979, this is a major change in InnoDB auto-inc handling. There
is one test that fails as of this commit. The updated test case should be
part of the snapshot from MySQL shortly.

Fix for bug# 27950 - Init AUTOINC from delete_row().

Fix for bug# 28781 - Use value specified by MySQL, in update_row().

Summary of structural changes:
==============================
InnoDB needs to hold a table level lock for AUTOINC allocations to overcome
the non-determinism inherent in MySQL SBR for INSERT ... SELECT. In this fix 
for simple INSERT statements (including multi-value inserts), we try and avoid
acquiring the special AUTOINC table level lock unless another transaction has
already reserved the AUTOINC table level lock, in which case we fall back
to the old behavior of acquiring the AUTOINC table level lock.

The max AUTOINC value is now read directly using the low level interface
of InnoDB.
2007-07-24 01:42:16 +00:00
marko
3b074d7bf5 Fix a severe bug that was introduced in r1422 when fixing Bug #21101.
When creating an index containing a too long record, InnoDB would
dereference a NULL pointer when trying to determine the maximum row length.

innodb_check_for_record_too_big_error(): Replace the dict_table_t*
parameter with a Boolean flag.  There is not always a dict_table_t object
when this function is called.

page_get_free_space_of_empty_noninline(): Move the definition and
declaration from row0mysql (!) to page0page.  Make the signature
identical with page_get_free_space_of_empty().

create_clustered_index_when_no_primary(): Add the parameter "comp".
Remove unnecessary casts.
2007-06-12 09:51:03 +00:00
marko
afeb156be6 Revert r799, which was supposed to prevent similar cases as Bug #21638.
In reality, the patch breaks the handling of prefix indexes of
variable-length columns in ROW_FORMAT=COMPACT.  Reverting the patch
is only a partial fix of Bug #28138.
2007-05-28 11:29:45 +00:00
vasil
16a35ea394 Split ut_a(a && b [&& c...]); into separate ut_a(a); ut_a(b); [ut_a(c); ...].
This makes it possible to see which expression was false by looking at the
error message.

Approved by:	Marko
2007-05-21 13:43:36 +00:00
marko
455e07b6a4 Make InnoDB pluggable. That is, merge the modifications from MySQL WL#2936
and adapt some things.

Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
<mysql/plugin.h>.  Until the function is declared there, you can
uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.

Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
storage/innobase/Makefile.am and storage/innobase/plug.in.

plug.in: Declare InnoDB as a dynamic plugin.

ha_innodb.h: Remove the declarations of many global variables.  The variables
are no longer directly referenced outside of storage/innobase.

trx_t: Add the field trx->duplicates.

trx_create(): Initialize the fields trx->active_trans and trx->duplicates.

innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
2007-05-10 11:31:36 +00:00
marko
e5dc455bc5 Minor cleanup.
row_ins_check_foreign_constraint(), row_ins_scan_sec_index_for_duplicate():
Make use of the predicates page_rec_is_infimum() and page_rec_is_supremum().
2007-05-08 10:51:03 +00:00
vasil
a676ff46a5 Reindent with tabs instead of spaces.
Spotted by:	Marko
2007-04-20 22:51:55 +00:00
vasil
9023842b88 Fix phantom reads (http://bugs.mysql.com/27197) following Heikki's
patch in the bug followup.

Approved by:	Heikki
2007-04-20 14:41:06 +00:00
sunny
42d12ae25c Fix for Bug # 18828. Return DB_TOO_MANY_CONCURRENT_TRXS when we run out
of UNDO slots in the rollback segment. This is a partial fix since the
MySQL error code requested to properly report the error condition back
to the client has not yet materialized. Currently we have #ifdef'd the
error code translation in ha_innodb.cc. This will have to be changed
as and when MySQl add the new requested code or an equivalent code
that we can then use.

Given the above, currently we will get the old behaviour, not the "fixed"
and intended behaviour.
2007-04-11 02:43:56 +00:00