2007-01-18 20:38:14 +01:00
|
|
|
/* Copyright (C) 2007 Michael Widenius
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-03-02 11:20:23 +01:00
|
|
|
the Free Software Foundation; version 2 of the License.
|
2007-01-18 20:38:14 +01:00
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
|
|
|
|
/*
|
|
|
|
Storage of records in block
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define LSN_SIZE 7
|
2007-04-19 12:18:56 +02:00
|
|
|
#define DIR_COUNT_SIZE 1 /* Stores number of rows on page */
|
2007-01-18 20:38:14 +01:00
|
|
|
#define EMPTY_SPACE_SIZE 2 /* Stores empty space on page */
|
|
|
|
#define PAGE_TYPE_SIZE 1
|
|
|
|
#define PAGE_SUFFIX_SIZE 0 /* Bytes for page suffix */
|
2007-04-19 12:18:56 +02:00
|
|
|
#define PAGE_HEADER_SIZE (LSN_SIZE + DIR_COUNT_SIZE + EMPTY_SPACE_SIZE +\
|
2007-01-18 20:38:14 +01:00
|
|
|
PAGE_TYPE_SIZE)
|
|
|
|
#define PAGE_OVERHEAD_SIZE (PAGE_HEADER_SIZE + DIR_ENTRY_SIZE + \
|
|
|
|
PAGE_SUFFIX_SIZE)
|
|
|
|
#define BLOCK_RECORD_POINTER_SIZE 6
|
|
|
|
|
|
|
|
#define FULL_PAGE_SIZE(block_size) ((block_size) - LSN_SIZE - PAGE_TYPE_SIZE)
|
|
|
|
|
|
|
|
#define ROW_EXTENT_PAGE_SIZE 5
|
|
|
|
#define ROW_EXTENT_COUNT_SIZE 2
|
|
|
|
#define ROW_EXTENT_SIZE (ROW_EXTENT_PAGE_SIZE + ROW_EXTENT_COUNT_SIZE)
|
|
|
|
#define TAIL_BIT 0x8000 /* Bit in page_count to signify tail */
|
2007-04-19 12:18:56 +02:00
|
|
|
/* Number of extents reserved MARIA_BITMAP_BLOCKS to store head part */
|
2007-01-18 20:38:14 +01:00
|
|
|
#define ELEMENTS_RESERVED_FOR_MAIN_PART 4
|
2007-04-19 12:18:56 +02:00
|
|
|
/* Fields before 'row->null_field_lengths' used by find_where_to_split_row */
|
2007-01-18 20:38:14 +01:00
|
|
|
#define EXTRA_LENGTH_FIELDS 3
|
|
|
|
|
2007-04-19 12:18:56 +02:00
|
|
|
/* Size for the different parts in the row header (and head page) */
|
|
|
|
|
2007-01-18 20:38:14 +01:00
|
|
|
#define FLAG_SIZE 1
|
|
|
|
#define TRANSID_SIZE 6
|
|
|
|
#define VERPTR_SIZE 7
|
|
|
|
#define DIR_ENTRY_SIZE 4
|
2007-04-19 12:18:56 +02:00
|
|
|
#define FIELD_OFFSET_SIZE 2 /* size of pointers to field starts */
|
2007-01-18 20:38:14 +01:00
|
|
|
|
|
|
|
/* Minimum header size needed for a new row */
|
|
|
|
#define BASE_ROW_HEADER_SIZE FLAG_SIZE
|
|
|
|
#define TRANS_ROW_EXTRA_HEADER_SIZE TRANSID_SIZE
|
|
|
|
|
|
|
|
#define PAGE_TYPE_MASK 127
|
|
|
|
enum en_page_type { UNALLOCATED_PAGE, HEAD_PAGE, TAIL_PAGE, BLOB_PAGE, MAX_PAGE_TYPE };
|
|
|
|
|
|
|
|
#define PAGE_TYPE_OFFSET LSN_SIZE
|
2007-04-19 12:18:56 +02:00
|
|
|
#define DIR_COUNT_OFFSET LSN_SIZE+PAGE_TYPE_SIZE
|
|
|
|
#define EMPTY_SPACE_OFFSET (DIR_COUNT_OFFSET + DIR_COUNT_SIZE)
|
2007-01-18 20:38:14 +01:00
|
|
|
|
|
|
|
#define PAGE_CAN_BE_COMPACTED 128 /* Bit in PAGE_TYPE */
|
|
|
|
|
2007-07-02 19:45:15 +02:00
|
|
|
/* Bits used for flag uchar (one byte, first in record) */
|
2007-01-18 20:38:14 +01:00
|
|
|
#define ROW_FLAG_TRANSID 1
|
|
|
|
#define ROW_FLAG_VER_PTR 2
|
|
|
|
#define ROW_FLAG_DELETE_TRANSID 4
|
|
|
|
#define ROW_FLAG_NULLS_EXTENDED 8
|
|
|
|
#define ROW_FLAG_EXTENTS 128
|
|
|
|
#define ROW_FLAG_ALL (1+2+4+8+128)
|
|
|
|
|
2007-04-19 12:18:56 +02:00
|
|
|
/******** Variables that affects how data pages are utilized ********/
|
|
|
|
|
|
|
|
/* Minium size of tail segment */
|
2007-01-18 20:38:14 +01:00
|
|
|
#define MIN_TAIL_SIZE 32
|
|
|
|
|
2007-04-19 12:18:56 +02:00
|
|
|
/*
|
|
|
|
Fixed length part of Max possible header size; See row data structure
|
|
|
|
table in ma_blockrec.c.
|
|
|
|
*/
|
2007-01-18 20:38:14 +01:00
|
|
|
#define MAX_FIXED_HEADER_SIZE (FLAG_SIZE + 3 + ROW_EXTENT_SIZE + 3)
|
|
|
|
#define TRANS_MAX_FIXED_HEADER_SIZE (MAX_FIXED_HEADER_SIZE + \
|
2007-04-05 13:38:05 +02:00
|
|
|
TRANSID_SIZE + VERPTR_SIZE + \
|
2007-01-18 20:38:14 +01:00
|
|
|
TRANSID_SIZE)
|
|
|
|
|
2007-07-02 19:45:15 +02:00
|
|
|
/* We use 1 uchar in record header to store number of directory entries */
|
2007-01-18 20:38:14 +01:00
|
|
|
#define MAX_ROWS_PER_PAGE 255
|
|
|
|
|
|
|
|
/* Bits for MARIA_BITMAP_BLOCKS->used */
|
2007-04-19 12:18:56 +02:00
|
|
|
/* We stored data on disk in the block */
|
2007-01-18 20:38:14 +01:00
|
|
|
#define BLOCKUSED_USED 1
|
2007-04-19 12:18:56 +02:00
|
|
|
/* Bitmap on disk is block->org_bitmap_value ; Happens only on update */
|
2007-01-18 20:38:14 +01:00
|
|
|
#define BLOCKUSED_USE_ORG_BITMAP 2
|
2007-04-19 12:18:56 +02:00
|
|
|
/* We stored tail data on disk for the block */
|
2007-01-18 20:38:14 +01:00
|
|
|
#define BLOCKUSED_TAIL 4
|
|
|
|
|
2007-04-19 12:18:56 +02:00
|
|
|
/******* defines that affects allocation (density) of data *******/
|
2007-01-18 20:38:14 +01:00
|
|
|
|
2007-04-19 12:18:56 +02:00
|
|
|
/*
|
- WL#3239 "log CREATE TABLE in Maria"
- WL#3240 "log DROP TABLE in Maria"
- similarly, log RENAME TABLE, REPAIR/OPTIMIZE TABLE, and
DELETE no_WHERE_clause (== the DELETE which just truncates the files)
- create_rename_lsn added to MARIA_SHARE's state
- all these operations (except DROP TABLE) also update the table's
create_rename_lsn, which is needed for the correctness of
Recovery (see function comment of _ma_repair_write_log_record()
in ma_check.c)
- write a COMMIT record when transaction commits.
- don't log REDOs/UNDOs if this is an internal temporary table
like inside ALTER TABLE (I expect this to be a big win). There was
already no logging for user-created "CREATE TEMPORARY" tables.
- don't fsync files/directories if the table is not transactional
- in translog_write_record(), autogenerate a 2-byte-id for the table
and log the "id->name" pair (LOGREC_FILE_ID); log
LOGREC_LONG_TRANSACTION_ID; automatically store
the table's 2-byte-id in any log record.
- preparations for Checkpoint: translog_get_horizon(); pausing Checkpoint
when some dirty pages are unknown; capturing trn->rec_lsn,
trn->first_undo_lsn for Checkpoint and log's low-water-mark computing.
- assertions, comments.
storage/maria/Makefile.am:
more files to build
storage/maria/ha_maria.cc:
- logging a REPAIR log record if REPAIR/OPTIMIZE was successful.
- ha_maria::data_file_type does not have to be set in every info()
call, just do it once in open().
- if caller said that transactionality can be disabled (like if
caller is ALTER TABLE) i.e. thd->transaction.on==FALSE, then we
temporarily disable transactionality of the table in external_lock();
that will ensure that no REDOs/UNDOs are logged for this possibly
massive write operation (they are not needed, as if any write fails,
the table will be dropped). We re-enable in external_lock(F_UNLCK),
which in ALTER TABLE happens before the tmp table replaces the original
one (which is good, as thus the final table will have a REDO RENAME
and a correct create_rename_lsn).
- when we commit we also have to write a log record, so
trnman_commit_trn() calls become ma_commit() calls
- at end of engine's initialization, we are potentially entering a
multi-threaded dangerous world (clients are going to be accepted)
and so some assertions of mutex-owning become enforceable, for that
we set maria_multi_threaded=TRUE (see ma_control_file.c)
storage/maria/ha_maria.h:
new member ha_maria::save_transactional (see also ha_maria.cc)
storage/maria/ma_blockrec.c:
- fixing comments according to discussion with Monty
- if a table is transactional but temporarily non-transactional
(like in ALTER TABLE), we need to give a sensible LSN to the pages
(and, if we give 0, pagecache asserts).
- translog_write_record() now takes care of storing the share's
2-byte-id in the log record
storage/maria/ma_blockrec.h:
fixing comment according to discussion with Monty
storage/maria/ma_check.c:
When REPAIR/OPTIMIZE modify the data/index file, if this is a
transactional table, they must sync it; if they remove files or rename
files, they must sync the directory, so that everything is durable.
This is just applying to REPAIR/OPTIMIZE the logic already implemented
in CREATE/DROP/RENAME a few months ago.
Adding a function to write a LOGREC_REPAIR_TABLE at end of
REPAIR/OPTIMIZE (called only by ha_maria, not by maria_chk), and
to update the table's create_rename_lsn.
storage/maria/ma_close.c:
fix for a future bug
storage/maria/ma_control_file.c:
ensuring that if Maria is running in multi-threaded mode, anybody
wanting to write to the control file and update
last_checkpoint_lsn/last_logno owns the log's lock.
storage/maria/ma_control_file.h:
see ma_control_file.c
storage/maria/ma_create.c:
when creating a table:
- sync it and its directory only if this is a transactional table
and there is a log (no point in syncing in maria_chk)
- decouple the two uses of linkname/linkname_ptr (for index file and
for data file) into more variables, as we need to know all links
until the moment we write the LOGREC_CREATE_TABLE.
- set share.data_file_type early so that _ma_initialize_data_file()
knows it (Monty's bugfix so that a table always has at least a bitmap
page when it is created; so data-file is not 0 bytes anymore).
- log a LOGREC_CREATE_TABLE; it contains the bytes which we have
just written to the index file's header. Update table's
create_rename_lsn.
- syncing of kfile had been bugified in a previous merge, correcting
- syncing of dfile is now needed as it's not empty anymore
- in _ma_initialize_data_file(), use share's block_size and not the
global one. This is a gratuitous change, both variables are equal,
just that I find it more future-proof to use share-bound variable
rather than global one.
storage/maria/ma_delete_all.c:
log a LOGREC_DELETE_ALL record when doing ma_delete_all_rows();
update create_rename_lsn then.
storage/maria/ma_delete_table.c:
- logging LOGREC_DROP_TABLE; knowing if this is needed, requires
knowing if the table is transactional, which requires opening the
table.
- we need to sync directories only if the table is transactional
storage/maria/ma_extra.c:
questions
storage/maria/ma_init.c:
when maria_end() is called, engine is not multithreaded
storage/maria/ma_loghandler.c:
- translog_inited has to be visible to ma_create() (see how it is used
in ma_create())
- checkpoint record will be a single record, not three
- no REDO for TRUNCATE (TRUNCATE calls ma_create() internally so will
log a REDO_CREATE)
- adding REDO for DELETE no_WHERE_clause (fast DELETE of all rows by
truncating the files), REPAIR.
- MY_WAIT_IF_FULL to wait&retry if a log write hits a full disk
- in translog_write_record(), if MARIA_SHARE does not yet have a
2-byte-id, generate one for it and log LOGREC_FILE_ID; automatically
store this short id into log records.
- in translog_write_record(), if transaction has not logged its
long trid, log LOGREC_LONG_TRANSACTION_ID.
- For Checkpoint, we need to know the current end-of-log: adding
translog_get_horizon().
- For Control File, adding an assertion that the thread owns the
log's lock (control file is protected by this lock)
storage/maria/ma_loghandler.h:
Changes in log records (see ma_loghandler.c).
new prototypes, new functions.
storage/maria/ma_loghandler_lsn.h:
adding a type LSN_WITH_FLAGS especially for TRN::first_undo_lsn,
where the most significant byte is used for flags.
storage/maria/ma_open.c:
storing the create_rename_lsn in the index file's header (in the
state, precisely) and retrieving it from there.
storage/maria/ma_pagecache.c:
- my set_if_bigger was wrong, correcting it
- if the first_in_switch list is not empty, it means that
changed_blocks misses some dirty pages, so Checkpoint cannot run and
needs to wait. A variable missing_blocks_in_changed_list is added to
tell that (should it be named missing_blocks_in_changed_blocks?)
- pagecache_collect_changed_blocks_with_lsn() now also tells the
minimum rec_lsn (needed for low-water mark computation).
storage/maria/ma_pagecache.h:
see ma_pagecache.c
storage/maria/ma_panic.c:
comment
storage/maria/ma_range.c:
comment
storage/maria/ma_rename.c:
- logging LOGREC_RENAME_TABLE; knowing if this is needed, requires
knowing if the table is transactional, which requires opening the
table.
- update create_rename_lsn
- we need to sync directories only if the table is transactional
storage/maria/ma_static.c:
comment
storage/maria/ma_test_all.sh:
- tip for Valgrind-ing ma_test_all
- do "export maria_path=somepath" before calling ma_test_all,
if you want to run ma_test_all out of storage/maria (useful
to have parallel runs, like one normal and one Valgrind, they
must not use the same tables so need to run in different directories)
storage/maria/maria_def.h:
- state now contains, in memory and on disk, the create_rename_lsn
- share now contains a 2-byte-id
storage/maria/trnman.c:
preparations for Checkpoint: capture trn->rec_lsn, trn->first_undo_lsn;
minimum first_undo_lsn needed to know log's low-water-mark
storage/maria/trnman.h:
using most significant byte of first_undo_lsn to hold miscellaneous
flags, for now TRANSACTION_LOGGED_LONG_ID.
dummy_transaction_object is already declared in ma_static.c.
storage/maria/trnman_public.h:
dummy_transaction_object was declared in all files including
trnman_public.h, while in fact it's a single object.
new prototype
storage/maria/unittest/ma_test_loghandler-t.c:
update for new prototype
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
update for new prototype
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
update for new prototype
storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
update for new prototype
storage/maria/ma_commit.c:
function which wraps:
- writing a LOGREC_COMMIT record (==commit on disk)
- calling trnman_commit_trn() (=commit in memory)
storage/maria/ma_commit.h:
new header file
.tree-is-private:
this file is now needed to keep our tree private (don't push it
to public trees). When 5.1 is merged into mysql-maria, we can abandon
our maria-specific post-commit trigger; .tree_is_private will take
care of keeping commit mails private. Don't push this file to public
trees.
2007-06-22 14:49:37 +02:00
|
|
|
If the tail part (from the main block or a blob) would use more than 75 % of
|
2007-04-19 12:18:56 +02:00
|
|
|
the size of page, store the tail on a full page instead of a shared
|
|
|
|
tail page.
|
|
|
|
*/
|
2007-01-18 20:38:14 +01:00
|
|
|
#define MAX_TAIL_SIZE(block_size) ((block_size) *3 / 4)
|
|
|
|
|
This patch is a collection of patches from from Sanja, Sergei and Monty.
Added logging and pinning of pages to block format.
Integration of transaction manager, log handler.
Better page cache intergration
Split trnman.h into two files, so that we don't have to include my_atomic.h into C++ programs.
Renaming of structures, more comments, more debugging etc.
Fixed problem with small head block + long varchar.
Added extra argument to delete_record() and update_record() (needed for UNDO logging)
Small changes to interface of pagecache and log handler.
Change initialization of log_record_type_descriptors to not be depending on enum order.
Use array of LEX_STRING's to send data to log handler
Added 'dummy' transaction option to MARIA_INFO so that we can always assume 'trn' exists.
include/lf.h:
Interface fixes
Rename of structures
(Patch from Sergei via Sanja)
include/my_atomic.h:
More comments
include/my_global.h:
Added MY_ERRPTR
include/pagecache.h:
Added undo LSN when unlocking pages
mysql-test/r/maria.result:
Updated results
mysql-test/t/maria.test:
Added autocommit around lock tables
(Patch from Sanja)
mysys/lf_alloc-pin.c:
Post-review fixes, simple optimizations
More comments
Struct slot renames
Check amount of memory on stack
(Patch from Sergei)
mysys/lf_dynarray.c:
More comments
mysys/lf_hash.c:
More comments
After review fixes
(Patch from Sergei)
storage/maria/ha_maria.cc:
Split trnman.h into two files, so that we don't have to include my_atomic.h into the .cc program.
(Temporary fix to avoid bug in gcc)
Move out all deferencing of the transaction structure.
Transaction manager integrated (Patch from Sergei)
storage/maria/ha_maria.h:
Added prototype for start_stmt()
storage/maria/lockman.c:
Function call rename
storage/maria/ma_bitmap.c:
Mark deleted pages free from page cache
storage/maria/ma_blockrec.c:
Offset -> rownr
More debugging
Fixed problem with small head block + long varchar
Added logging of changed pages
Added logging of undo (Including only loggging of changed fields in case of update)
Added pinning/unpinning of all changed pages
More comments
Added free_full_pages() as the same code was used in several places.
fill_rows_parts() renamed as fill_insert_undo_parts()
offset -> rownr
Added some optimization of not transactional tables
_ma_update_block_record() has new parameter, as we need original row to do efficent undo for update
storage/maria/ma_blockrec.h:
Added ROW_EXTENTS_ON_STACK
Changed prototype for update and delete of row
storage/maria/ma_check.c:
Added original row to delete_record() call
storage/maria/ma_control_file.h:
Added ifdefs for C++
storage/maria/ma_delete.c:
Added original row to delete_record() call
(Needed for efficent undo logging)
storage/maria/ma_dynrec.c:
Added extra argument to delete_record() and update_record()
Removed not used variable
storage/maria/ma_init.c:
Initialize log handler
storage/maria/ma_loghandler.c:
Removed not used variable
Change initialization of log_record_type_descriptors to not be depending on enum order
Use array of LEX_STRING's to send data to log handler
storage/maria/ma_loghandler.h:
New defines
Use array of LEX_STRING's to send data to log handler
storage/maria/ma_open.c:
Added 'dummy' transaction option to MARIA_INFO so that we can always assume 'trn' exists.
Store in MARIA_SHARE->page_type if pages will have up to date LSN's
storage/maria/ma_pagecache.c:
Don't decrease number of readers when using pagecache_write()/pagecache_read()
In pagecache_write() decrement request count if page was left pinned
Added pagecache_delete_pages()
Removed some casts
Make trace output consistent with rest of code
Simplify calling of DBUG_ASSERT(0)
Only update LSN if the LSN is bigger than what's already on the page
Added LSN parameter pagecache_unpin_page(), pagecache_unpin(), and pagecache_unlock()
(Part of patch from Sanja)
storage/maria/ma_static.c:
Added 'dummy' transaction option to MARIA_INFO so that we can always assume 'trn' exists.
Added default page cache
storage/maria/ma_statrec.c:
Added extra argument to delete_record() and update_record()
storage/maria/ma_test1.c:
Added option -T for transactions
storage/maria/ma_test2.c:
Added option -T for transactions
storage/maria/ma_test_all.sh:
Test with transactions
storage/maria/ma_update.c:
Changed prototype for update of row
storage/maria/maria_def.h:
Changed prototype for update & delete of row as block records need to access the old row
Store in MARIA_SHARE->page_type if pages will have up to date LSN's
Added MARIA_MAX_TREE_LEVELS to allow us to calculate the number of possible pinned pages we may need.
Removed not used 'empty_bits_buffer'
Added pointer to transaction object
Added array for pinned pages
Added log_row_parts array for logging of field data.
Added MARIA_PINNED_PAGE to store pinned pages
storage/maria/trnman.c:
Added accessor functions to transaction object
Added missing DBUG_RETURN()
More debugging
More comments
Changed // comment of code to #ifdef NOT_USED
Transaction manager integrated.
Post review fixes
Part of patch originally from Sergei
storage/maria/trnman.h:
Split trnman.h into two files, so that we don't have to include my_atomic.h into the .cc program.
(Temporary fix to avoid bug in gcc)
storage/maria/unittest/ma_pagecache_single.c:
Added missing argument
Added SKIP_BIG_TESTS
(Patch from Sanja)
storage/maria/unittest/ma_test_loghandler-t.c:
Test logging with new LEX_STRING parameter
(Patch from Sanja)
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
Test logging with new LEX_STRING parameter
(Patch from Sanja)
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
Test logging with new LEX_STRING parameter
(Patch from Sanja)
storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
Test logging with new LEX_STRING parameter
(Patch from Sanja)
storage/maria/unittest/trnman-t.c:
Stack overflow detection
(Patch from Sergei)
unittest/unit.pl:
Command-line options --big and --verbose
(Patch from Sergei)
unittest/mytap/tap.c:
Detect --big
(Patch from Sergei)
unittest/mytap/tap.h:
Skip_big_tests and SKIP_BIG_TESTS
(Patch from Sergei)
storage/maria/trnman_public.h:
New BitKeeper file ``storage/maria/trnman_public.h''
2007-05-29 19:13:56 +02:00
|
|
|
/* Don't allocate memory for too many row extents on the stack */
|
|
|
|
#define ROW_EXTENTS_ON_STACK 32
|
|
|
|
|
2007-04-19 12:18:56 +02:00
|
|
|
extern uchar maria_bitmap_marker[2];
|
|
|
|
|
2007-01-18 20:38:14 +01:00
|
|
|
/* Functions to convert MARIA_RECORD_POS to/from page:offset */
|
|
|
|
|
2007-04-19 12:18:56 +02:00
|
|
|
static inline MARIA_RECORD_POS ma_recordpos(ulonglong page, uint dir_entry)
|
2007-01-18 20:38:14 +01:00
|
|
|
{
|
2007-04-19 12:18:56 +02:00
|
|
|
DBUG_ASSERT(dir_entry <= 255);
|
|
|
|
return (MARIA_RECORD_POS) ((page << 8) | dir_entry);
|
2007-01-18 20:38:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline my_off_t ma_recordpos_to_page(MARIA_RECORD_POS record_pos)
|
|
|
|
{
|
|
|
|
return record_pos >> 8;
|
|
|
|
}
|
|
|
|
|
2007-04-19 12:18:56 +02:00
|
|
|
static inline my_off_t ma_recordpos_to_dir_entry(MARIA_RECORD_POS record_pos)
|
2007-01-18 20:38:14 +01:00
|
|
|
{
|
|
|
|
return record_pos & 255;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ma_blockrec.c */
|
|
|
|
void _ma_init_block_record_data(void);
|
2007-04-19 12:18:56 +02:00
|
|
|
my_bool _ma_once_init_block_record(MARIA_SHARE *share, File dfile);
|
|
|
|
my_bool _ma_once_end_block_record(MARIA_SHARE *share);
|
|
|
|
my_bool _ma_init_block_record(MARIA_HA *info);
|
|
|
|
void _ma_end_block_record(MARIA_HA *info);
|
2007-01-18 20:38:14 +01:00
|
|
|
|
|
|
|
my_bool _ma_update_block_record(MARIA_HA *info, MARIA_RECORD_POS pos,
|
2007-07-02 19:45:15 +02:00
|
|
|
const uchar *oldrec, const uchar *newrec);
|
|
|
|
my_bool _ma_delete_block_record(MARIA_HA *info, const uchar *record);
|
|
|
|
int _ma_read_block_record(MARIA_HA *info, uchar *record,
|
2007-01-18 20:38:14 +01:00
|
|
|
MARIA_RECORD_POS record_pos);
|
2007-07-02 19:45:15 +02:00
|
|
|
int _ma_read_block_record2(MARIA_HA *info, uchar *record,
|
|
|
|
uchar *data, uchar *end_of_data);
|
|
|
|
int _ma_scan_block_record(MARIA_HA *info, uchar *record,
|
2007-01-18 20:38:14 +01:00
|
|
|
MARIA_RECORD_POS, my_bool);
|
|
|
|
my_bool _ma_cmp_block_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
|
2007-07-02 19:45:15 +02:00
|
|
|
const uchar *record, MARIA_RECORD_POS pos);
|
2007-01-18 20:38:14 +01:00
|
|
|
my_bool _ma_scan_init_block_record(MARIA_HA *info);
|
|
|
|
void _ma_scan_end_block_record(MARIA_HA *info);
|
|
|
|
|
|
|
|
MARIA_RECORD_POS _ma_write_init_block_record(MARIA_HA *info,
|
2007-07-02 19:45:15 +02:00
|
|
|
const uchar *record);
|
|
|
|
my_bool _ma_write_block_record(MARIA_HA *info, const uchar *record);
|
2007-01-18 20:38:14 +01:00
|
|
|
my_bool _ma_write_abort_block_record(MARIA_HA *info);
|
|
|
|
my_bool _ma_compare_block_record(register MARIA_HA *info,
|
2007-07-02 19:45:15 +02:00
|
|
|
register const uchar *record);
|
2007-01-18 20:38:14 +01:00
|
|
|
|
|
|
|
/* ma_bitmap.c */
|
|
|
|
my_bool _ma_bitmap_init(MARIA_SHARE *share, File file);
|
|
|
|
my_bool _ma_bitmap_end(MARIA_SHARE *share);
|
|
|
|
my_bool _ma_flush_bitmap(MARIA_SHARE *share);
|
|
|
|
my_bool _ma_bitmap_find_place(MARIA_HA *info, MARIA_ROW *row,
|
|
|
|
MARIA_BITMAP_BLOCKS *result_blocks);
|
|
|
|
my_bool _ma_bitmap_release_unused(MARIA_HA *info, MARIA_BITMAP_BLOCKS *blocks);
|
2007-07-02 19:45:15 +02:00
|
|
|
my_bool _ma_bitmap_free_full_pages(MARIA_HA *info, const uchar *extents,
|
2007-01-18 20:38:14 +01:00
|
|
|
uint count);
|
|
|
|
my_bool _ma_bitmap_set(MARIA_HA *info, ulonglong pos, my_bool head,
|
|
|
|
uint empty_space);
|
|
|
|
my_bool _ma_reset_full_page_bits(MARIA_HA *info, MARIA_FILE_BITMAP *bitmap,
|
|
|
|
ulonglong page, uint page_count);
|
|
|
|
uint _ma_free_size_to_head_pattern(MARIA_FILE_BITMAP *bitmap, uint size);
|
|
|
|
my_bool _ma_bitmap_find_new_place(MARIA_HA *info, MARIA_ROW *new_row,
|
|
|
|
ulonglong page, uint free_size,
|
|
|
|
MARIA_BITMAP_BLOCKS *result_blocks);
|
|
|
|
my_bool _ma_check_bitmap_data(MARIA_HA *info,
|
|
|
|
enum en_page_type page_type, ulonglong page,
|
|
|
|
uint empty_space, uint *bitmap_pattern);
|
|
|
|
my_bool _ma_check_if_right_bitmap_type(MARIA_HA *info,
|
|
|
|
enum en_page_type page_type,
|
|
|
|
ulonglong page,
|
|
|
|
uint *bitmap_pattern);
|
2007-04-12 11:05:30 +02:00
|
|
|
void _ma_bitmap_delete_all(MARIA_SHARE *share);
|
2007-07-03 23:50:17 +02:00
|
|
|
uint _ma_apply_redo_insert_row_head_or_tail(MARIA_HA *info, LSN lsn,
|
|
|
|
uint page_type,
|
|
|
|
const byte *header,
|
|
|
|
const byte *data,
|
|
|
|
size_t data_length);
|
|
|
|
uint _ma_apply_redo_purge_row_head_or_tail(MARIA_HA *info, LSN lsn,
|
|
|
|
uint page_type,
|
|
|
|
const byte *header);
|