Commit graph

68 commits

Author SHA1 Message Date
marko
56c0cbb36e branches/zip: fsp0fsp.c: Add some missing in/out and const qualifiers. 2009-12-08 09:13:36 +00:00
marko
64096ab555 branches/zip: Clean up after a crash during DROP INDEX.
When InnoDB crashes while dropping an index, ensure that
the index will be completely dropped during crash recovery.

row_merge_drop_index(): Before dropping an index, rename the index to
start with TEMP_INDEX_PREFIX_STR and commit the change, so that
row_merge_drop_temp_indexes() will drop the index after crash
recovery if the server crashes while dropping the index.

fseg_inode_try_get(): New function, forked from fseg_inode_get().
Return NULL if the file segment index node is free.

fseg_inode_get(): Assert that the file segment index node is not free.

fseg_free_step(): If the file segment index node is already free,
print a diagnostic message and return TRUE.

fsp_free_seg_inode(): Write a nonzero number to FSEG_MAGIC_N, so that
allocated-and-freed file segment index nodes can be better
distinguished from uninitialized ones.

This is rb://174, addressing Issue #348.

Tested by restarting mysqld upon the completion of the added
log_write_up_to() invocation below, during DROP INDEX.  The index was
dropped after crash recovery, and re-issuing the DROP INDEX did not
crash the server.

  Index: btr/btr0btr.c
  ===================================================================
  --- btr/btr0btr.c	(revision 6026)
  +++ btr/btr0btr.c	(working copy)
  @@ -42,6 +42,7 @@ Created 6/2/1994 Heikki Tuuri
   #include "ibuf0ibuf.h"
   #include "trx0trx.h"
  +#include "log0log.h"
   
   /*
   Latching strategy of the InnoDB B-tree
   --------------------------------------
  @@ -873,6 +874,8 @@ leaf_loop:
   
   		goto leaf_loop;
   	}
  +
  +	log_write_up_to(mtr.end_lsn, LOG_WAIT_ALL_GROUPS, TRUE);
   top_loop:
   	mtr_start(&mtr);
2009-10-01 10:24:33 +00:00
marko
a5877b47bc branches/zip: Add some debug assertions for checking FSEG_MAGIC_N. 2009-09-30 06:18:24 +00:00
marko
b14d74348f branches/zip: Fix warnings and errors when UNIV_HOTBACKUP is defined. 2009-09-24 06:47:56 +00:00
calvin
5af4815f80 branches/zip: Merge revisions 2584:2956 from branches/6.0,
except c2932.

Bug#37232 and bug#31183 were fixed in the 6.0 branch only.
They should be fixed in the plugin too, specially MySQL 6.0
is discontinued at this point.

    ------------------------------------------------------------------------
    r2604 | inaam | 2008-08-21 09:37:06 -0500 (Thu, 21 Aug 2008) | 8 lines

    branches/6.0     bug#37232

    Relax locking behaviour for REPLACE INTO t SELECT ... FROM t1.
    Now SELECT on t1 is performed as a consistent read when the isolation
    level is set to READ COMMITTED.

    Reviewed by: Heikki
    ------------------------------------------------------------------------
    r2605 | inaam | 2008-08-21 09:59:33 -0500 (Thu, 21 Aug 2008) | 7 lines

    branches/6.0

    Added a comment to clarify why distinct calls to read MySQL binary
    log file name and log position do not entail any race condition.

    Suggested by: Heikki
    ------------------------------------------------------------------------
    r2956 | inaam | 2008-11-04 04:47:30 -0600 (Tue, 04 Nov 2008) | 11 lines

    branches/6.0  bug#31183

    If the system tablespace runs out of space because 'autoextend' is
    not specified with innodb_data_file_path there was no error message
    printed to the error log. The client would get 'table full' error.
    This patch prints an appropriate error message to the error log.

    rb://43

    Approved by: Marko
    ------------------------------------------------------------------------
2009-09-19 06:14:25 +00:00
calvin
173f74eabe branches/zip: remove duplicate "the" in comments. 2009-08-06 22:04:03 +00:00
marko
f4a5ab606c branches/zip: fseg_validate(): Enclose in #ifdef UNIV_DEBUG.
This function is unused, but it could turn out to be a useful debugging aid.
2009-06-30 08:15:22 +00:00
marko
6a44d90b74 branches/zip: fseg_free(): Remove this unused function. 2009-06-30 08:10:32 +00:00
marko
413654b5dd branches/zip: Replace <= in a function comment. 2009-06-04 05:59:51 +00:00
marko
68a1ee9960 branches/zip: Add some Doxygen comments for many structs, typedefs,
#defines and global variables.  Many are still missing.
2009-05-26 12:28:49 +00:00
marko
c25f65d00f branches/zip: Enclose some #error checks inside #ifndef DOXYGEN
to prevent bogus Doxygen errors.
2009-05-25 10:52:20 +00:00
marko
11ff89d994 branches/zip: Add @file comments, and convert decorative
/*********************************
comments to Doxygen /** style like this:
/*****************************//**

This conversion was performed by the following command:

perl -i -e 'while(<ARGV>){if (m|^/\*{30}\**$|) {
s|\*{4}$|//**| if ++$com>1; $_ .= "\@file $ARGV\n" if $com==2}
print; if(eof){$.=0;undef $com}}' */*[ch] include/univ.i
2009-05-25 09:52:29 +00:00
marko
d075e80c49 branches/zip: Split some long lines that were introduced in r5091. 2009-05-25 08:09:45 +00:00
marko
e49dee377b branches/zip: Convert the function comments to Doxygen format.
This patch was created by running the following commands:

for i in */*[ch]; do doxygenify.pl $i; done
perl -i -pe 's#\*{3} \*/$#****/#' */*[ch]

where doxygenify.pl is
https://svn.innodb.com/svn/misc/trunk/tools/doxygenify.pl r510

Verified the consistency as follows:

(0) not too many /* in: */ or /* out: */ comments left in the code:
grep -l '/\*\s*\(in\|out\)[,:/]' */*[ch]

(1) no difference when ignoring blank lines, after stripping all
C90-style /* comments */, including multi-line ones, before and after
applying this patch:

perl -i -e 'undef $/;while(<ARGV>){s#/\*(.*?)\*/##gs;print}' */*[ch]
diff -I'^\s*$' --exclude .svn -ru TREE1 TREE2

(2) after stripping @return comments and !<, generated a diff and omitted
the hunks where /* out: */ function return comments were removed:

perl -i -e'undef $/;while(<ARGV>){s#!<##g;s#\n\@return\t.*?\*/# \*/#gs;print}'\
 */*[ch]
svn diff|
perl -e 'undef $/;$_=<>;s#\n-\s*/\* out[:,]([^\n]*?)(\n-[^\n]*?)*\*/##gs;print'

Some unintended changes were left.  These will be removed in a
subsequent patch.
2009-05-25 05:30:14 +00:00
marko
a0714b182c branches/zip: univ.i: Define REFMAN as the base URL of the
MySQL Reference Manual and use it in every string.
This fixes Issue #221.
2009-04-16 12:02:27 +00:00
marko
d90bea085a branches/zip: Remove unneeded definitions and dependencies
from UNIV_HOTBACKUP builds.
2009-03-23 14:21:34 +00:00
marko
184ee4885c branches/zip: Non-functional change for reducing dependencies in InnoDB Hot Backup:
Replace srv_sys->dummy_ind1 and srv_sys->dummy_ind2 with
dict_ind_redundant and dict_ind_compact, initialized in dict_init().
2009-03-20 10:33:33 +00:00
vasil
4e0e5e1e53 branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal

[Step 2/28]
2009-02-17 08:15:06 +00:00
marko
d32ffdd1a3 branches/zip: Clean up the insert buffer subsystem.
Originally, there were provisions in InnoDB for multiple insert buffer
B-trees, apparently one for each tablespace.

When Heikki implemented innodb_file_per_table (multiple InnoDB
tablespaces) in MySQL 4.1, he made the insert buffer live only in the
system tablespace (space 0) but left the provisions in the code.

When Osku Salerma implemented delete buffering, he also cleaned up the
insert buffer subsystem so that only one insert buffer B-tree exists.
This patch applies the clean-up to the InnoDB Plugin.

Having a separate patch of the insert buffer clean-up should help us
better compare the essential changes of the InnoDB Plugin and InnoDB+
and to track down bugs that are specific to InnoDB+.

IBUF_SPACE_ID: New constant, defined as 0.

ibuf_data_t: Remove.

ibuf_t: Add the applicable fields from ibuf_data_t.  There is only one
insert buffer tree from now on.

ibuf_page_low(), ibuf_page(): Merge to a single function ibuf_page().

fil_space_t: Remove ibuf_data.

fil_space_get_ibuf_data(): Remove.  There is only one ibuf_data, for
space IBUF_SPACE_ID.

fil_ibuf_init_at_db_start(): Remove.

ibuf_init_at_db_start(): Fuse with ibuf_data_init_for_space().

ibuf_validate_low(): Remove.  There is only one ibuf tree.

ibuf_free_excess_pages(), ibuf_header_page_get(),
ibuf_free_excess_pages(): Remove the parameter space, which was always
0.

ibuf_tree_root_get(): Remove the parameters space and data.  There is
only one ibuf tree, for space IBUF_SPACE_ID.

ibuf_data_sizes_update(): Rename to ibuf_size_update(), and remove the
parameter data.  There is only one ibuf data struct.

ibuf_build_entry_pre_4_1_x(): New function, refactored from
ibuf_build_entry_from_ibuf_rec().

ibuf_data_enough_free_for_insert(), ibuf_data_too_much_free(): Remove
the parameter data.  There is only one insert buffer tree.

ibuf_add_free_page(), ibuf_remove_free_page(): Remove the parameters
space and data.  There is only one insert buffer tree.

ibuf_get_merge_page_nos(): Add parenthesis, to reduce diffs to
branches/innodb+.

ibuf_contract_ext(): Do not pick an insert buffer tree at random.
There is only one.

ibuf_print(): Print the single insert buffer tree.

rb://19 approved by Heikki on IM
2008-12-12 14:08:23 +00:00
marko
9f4643996f branches/zip: fsp0fsp.c: Revert r2681 in a sense, by turning the
ut_a() assertions into ut_ad() assertions.
2008-09-26 09:09:43 +00:00
marko
28be7aea0f branches/zip: fsp0fsp.c: Turn some ut_ad() assertions to ut_a() and
add some ut_a() assertions to track down file space header corruption
that is the probable cause of Mantis issue #63.
2008-09-24 18:29:19 +00:00
marko
d9317eb699 branches/zip: Non-functional change:
buf_block_dbg_add_level(block, level): Define as an empty macro when
UNIV_SYNC_DEBUG is not defined.  Remove #ifdef UNIV_SYNC_DEBUG around
all invocations.
2008-09-22 06:59:58 +00:00
marko
cd124b7524 branches/zip: Always display a newline after ut_print_buf(stderr, ...). 2008-08-06 08:10:21 +00:00
marko
15c670988f branches/zip: Pass the tablespace flags correctly when creating or opening
single-table tablespaces.  This bug was reported by Sunny as Mantis issue #26.

fil_space_create(), fil_create_new_single_table_tablespace(),
fil_open_single_table_tablespace(), fsp_header_init_fields():
Add ut_a(flags != DICT_TF_COMPACT).

dict_build_table_def_step(), row_import_tablespace_for_mysql(),
row_truncate_table_for_mysql(): Pass correct flags to
fil_create_new_single_table_tablespace() or fil_open_single_table_tablespace().
2008-03-18 10:10:51 +00:00
marko
86361e032b branches/zip: Implement the configuration parameter and settable global
variable innodb_file_format.  Implement file format version stamping of
*.ibd files and SYS_TABLES.TYPE.

This change breaks introduces an incompatible change for for
compressed tables.  We can do this, as we have not released yet.

innodb-zip.test: Add tests for stricter KEY_BLOCK_SIZE and ROW_FORMAT
checks.

DICT_TF_COMPRESSED_MASK, DICT_TF_COMPRESSED_SHIFT: Replace with
DICT_TF_ZSSIZE_MASK, DICT_TF_ZSSIZE_SHIFT.

DICT_TF_FORMAT_MASK, DICT_TF_FORMAT_SHIFT, DICT_TF_FORMAT_51,
DICT_TF_FORMAT_ZIP: File format version, stored in table->flags,
in the .ibd file header, and in SYS_TABLES.TYPE.

dict_create_sys_tables_tuple(): Write the table flags to SYS_TABLES.TYPE
if the format is at least DICT_TF_FORMAT_ZIP.  For old formats
(DICT_TF_FORMAT_51), write DICT_TABLE_ORDINARY as the table type.

DB_TABLE_ZIP_NO_IBD: Remove the error code.  The error handling is done
in ha_innodb.cc; as a failsafe measure, dict_build_table_def_step() will
silently clear the compression and format flags instead of returning this
error.

dict_mem_table_create(): Assert that no extra bits are set in the flags.

dict_sys_tables_get_zip_size(): Rename to dict_sys_tables_get_flags().
Check all flag bits, and return ULINT_UNDEFINED if the combination is
unsupported.

dict_boot(): Document the SYS_TABLES columns N_COLS and TYPE.

dict_table_get_format(), dict_table_set_format(),
dict_table_flags_to_zip_size(): New accessors to table->flags.

dtuple_convert_big_rec(): Introduce the auxiliary variables
local_len, local_prefix_len.  Store a 768-byte prefix locally
if the file format is less than DICT_TF_FORMAT_ZIP.

dtuple_convert_back_big_rec(): Restore the columns.

srv_file_format: New variable: innodb_file_format.

fil_create_new_single_table_tablespace(): Replace the parameter zip_size
with table->flags.

fil_open_single_table_tablespace(): Replace the parameter zip_size_in_k
with table->flags.  Check the flags.

fil_space_struct, fil_space_create(), fil_op_write_log():
Replace zip_size with flags.

fil_node_open_file(): Note a TODO item for InnoDB Hot Backup.
Check that the tablespace flags match.

fil_space_get_zip_size(): Rename to fil_space_get_flags().  Add a
wrapper for fil_space_get_zip_size().

fsp_header_get_flags(): New function.

fsp_header_init_fields(): Replace zip_size with flags.

FSP_SPACE_FLAGS: New name for the tablespace flags.  This field used
to be called FSP_PAGE_ZIP_SIZE, or FSP_LOWEST_NO_WRITE.  It has always
been written as 0 in MySQL/InnoDB versions 4.1 to 5.1.

MLOG_ZIP_FILE_CREATE: Rename to MLOG_FILE_CREATE2.  Add a 32-bit
parameter for the tablespace flags.

ha_innobase::create(): Check the table attributes ROW_FORMAT and
KEY_BLOCK_SIZE.  Issue errors if they are inappropriate, or warnings
if the inherited attributes (in ALTER TABLE) will be ignored.

PAGE_ZIP_MIN_SIZE_SHIFT: New constant: the 2-logarithm of PAGE_ZIP_MIN_SIZE.
2008-03-10 11:05:32 +00:00
marko
71d8314d4d branches/zip: fseg_print(): Enclose inside #ifdef UNIV_BTR_PRINT. 2008-03-06 12:29:16 +00:00
marko
30e94affc3 branches/zip: fsp_header_get_free_limit(), fsp_header_get_tablespace_size():
Remove the redundant parameter "space".
2008-03-05 12:40:29 +00:00
marko
09da651894 branches/zip: ut_is_2pow(), ut_2pow_round(), ut_2pow_remainder(): Define
as type-independent macros instead of functions.  Because ut_2pow_round()
and ut_2pow_remainder() no longer assert ut_is_2pow(m), add the assertions
to callers when needed.  Also add parentheses to assist the compiler in
common subexpression elimination.
2008-03-05 09:41:51 +00:00
marko
2c2b06ad75 branches/zip: Introduce UNIV_INTERN, a linkage specifier for InnoDB-global
symbols.  Use it for all definitions of non-static variables and functions.

lexyy.c, make_flex.sh: Declare yylex as UNIV_INTERN, not static.  It is
referenced from pars0grm.c.

Actually, according to
	nm .libs/ha_innodb.so|grep -w '[ABCE-TVXYZ]'
the following symbols are still global:

* The vtable for class ha_innodb
* pars0grm.c: The function yyparse() and the variables yychar, yylval, yynerrs

The required changes to the Bison-generated file pars0grm.c will be addressed
in a separate commit, which will add a script similar to make_flex.sh.

The class ha_innodb is renamed from class ha_innobase by a #define.  Thus,
there will be no clash with the builtin InnoDB.  However, there will be some
overhead for invoking virtual methods of class ha_innodb.  Ideas for making
the vtable hidden are welcome.  -fvisibility=hidden is not available in GCC 3.
2008-02-06 14:17:36 +00:00
marko
8a88208139 branches/zip: Allow a build with UNIV_PAGE_SIZE set to 4096.
TRX_RSEG_N_SLOTS: Make the definition dependent of UNIV_PAGE_SIZE.

FSP_EXTENT_SIZE: Define as 1 megabyte, as assumed by the code elsewhere.

fseg_create_general(): Add a debug assertion against page overflow.
2007-12-20 22:09:22 +00:00
marko
d662c3c656 branches/zip: Merge 1575:1664 from trunk. 2007-08-01 11:18:43 +00:00
marko
d75e64f98a branches/zip: Merge 1493:1533 from trunk.
Make use of UT_BITS_IN_BYTES().
2007-05-29 08:48:16 +00:00
marko
a8b6524b14 branches/zip: Use ut_dulint_zero and ut_dulint_is_zero whenever possible. 2007-05-18 11:01:58 +00:00
marko
e7284367dc branches/zip: Merge revisions 1402:1493 from trunk.
Remove mysql.patch, because the configuration parameter interface has changed.
2007-05-14 09:07:15 +00:00
marko
d8536b0de8 branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. 2007-01-18 18:29:12 +00:00
marko
c712838401 branches/zip: Merge revisions 1165:1206 from trunk. 2007-01-18 12:58:39 +00:00
marko
fff329cd3d branches/zip: Remove the fil_space_get_zip_size() call from
buf_page_get_gen().  This saves one mutex operation per block request.

buf_page_get_gen(), various macros and functions: Add parameter zip_size.

btr_node_ptr_get_child(): Add parameter index.

fil_space_get_latch(): Add optional output parameter zip_size.

fil_space_get_zip_size(): Return 0 for space id==0, because the
system tablespace is never compressed.

fsp_header_init(): Remove the parameter zip_size.

ibuf_free_excess_pages(): Remove the parameter zip_size.

trx_rseg_t, trx_undo_t: Add field zip_size.

xdes_lst_get_next(): Remove, unused.
2007-01-18 09:59:00 +00:00
marko
82dfd0f6c7 branches/zip: page_zip_des_t: Rename "size" to "ssize" and reduce the
storage size from 16 to 3 bits.

page_zip_get_size(), page_zip_set_size(): New functions.

Replace direct references to page_zip_des_t:size with calls to
buf_block_get_zip_size(), page_zip_get_size(), and page_zip_set_size().
2006-11-27 13:44:32 +00:00
marko
816089073b branches/zip: Replace most references to block->state, block->offset,
and block->space with buf_block_get_state(block), buf_block_get_page_no(block),
and buf_block_get_space(block).

enum buf_block_state: Replaces the #define'd buf_block_t.state values.

buf_block_get_state(): New function.

buf_block_get_frame(): Add __attribute__((const)).
2006-11-23 13:26:01 +00:00
marko
a3d72680f6 branches/zip: Add const qualifiers to read-only pointers.
rec_get_nth_field_offs_old(): Split from rec_get_nth_field_old().

rec_get_nth_field_old(): Reimplement as a constness-preserving macro.

dict_drop_index_tree(), dict_truncate_index_tree(): Note that rec is
an in/out parameter, as the B-tree root page number will be updated.
2006-10-26 08:52:14 +00:00
marko
91f8a3dde5 branches/zip: Remove many fil_space_get_zip_size() calls.
ibuf_page(), ibuf_page_low(), ibuf_free_excess_pages(), ibuf_insert(),
buf_read_page(), buf_read_ahead_linear(), buf_read_recv_pages():
Add parameter zip_size.
2006-10-19 11:07:50 +00:00
marko
a3860f7126 branches/zip: Remove some more buf_block_align() calls.
btr_search_build_page_hash_index(), fsp_parse_init_file_page(),
ibuf_parse_bitmap_init(): Replace page_t* with buf_block_t*.

buf_read_ibuf_merge_pages(): Add const qualifiers.  Retrieve zip_size.

ibuf_merge_or_delete_for_page(): Replace page_t* with buf_block_t*.
Add parameter zip_size.
2006-10-19 08:27:34 +00:00
marko
c755e88727 branches/zip: Reduce the number of buf_block_align() calls.
btr_block_get(): New function to return buf_block_t.

btr_page_alloc(), buf_page_get_release_on_io(), buf_page_get_gen(),
buf_page_create(), fseg_create(), fseg_create_general(): Return buf_block_t.

buf_page_get_known_nowait(): Expect buf_block_t instead of buf_frame_t.

buf_frame_get_newest_modification(): Replace with
buf_block_get_newest_modification().

buf_page_dbg_add_level(): Replace with buf_block_dbg_add_level().

buf_block_get_zip_size(): New function.

buf_block_get_page_zip(): Reintroduce.

recv_recover_page(): Replace page, space, page_no with block.

ibuf_bitmap_page_init(): Replace page, zip_size with block.

ibuf_parse_bitmap_init(): Remove the parameter zip_size.

btr_search_drop_page_hash_index(): Replace page with block.
2006-10-12 11:05:22 +00:00
marko
d61d296ccd branches/zip: Replace buf_frame_get_page_no() and buf_frame_get_space_id()
with page_get_page_no() and page_get_space_id().  We want to avoid
buf_block_align() calls, and the page_no and space_id are now stamped
on the pages early on.
2006-10-12 07:02:36 +00:00
marko
606bd38428 branches/zip: Stamp (space_id, page_no) on buffer pool pages early on.
buf_flush_init_for_writing(): Remove parameters space, page_no.

fsp_init_file_page_low(): Wriet space_id and page_no to the page.

fil_create_new_single_table_tablespace(): Write space_id to the page.
2006-10-10 12:26:37 +00:00
marko
5a10ee2721 branches/zip: Add function mtr_memo_contains_page() #ifdef UNIV_DEBUG.
Replace ut_ad(mtr_memo_contains(mtr, buf_block_align(ptr), ...))
with ut_ad(mtr_memo_contains_page(mtr, ptr, ...)) in order to reduce the
number of buf_block_align() calls.
2006-10-09 19:36:58 +00:00
marko
3fffefd3d6 branches/zip: Replace buf_frame_align() with page_align(), page_offset(),
ut_align_down(), or ut_align_offset().
2006-10-09 16:22:47 +00:00
marko
11cd834bb1 branches/zip: buf_block_get_page_zip(): Replace with buf_frame_get_page_zip(). 2006-10-09 15:37:19 +00:00
marko
35905f6266 branches/zip: Merge revisions 838:861 from trunk. 2006-09-22 10:22:03 +00:00
marko
9a16aac783 branches/zip: Merge revisions 804:838 from trunk. 2006-09-19 10:14:07 +00:00