mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
345959c660
- Fixes some things missed in myisam->maria port - Moved variables that holds the state for the current row to 'cur_row' - Changed most uchar * to byte * to be able to remove a lot of casts - Removed RAID support - Added CHECK for rows-in-block - Added allocate_dynamic() for easier usage of dynamic rows when we know how many entries we will need - Reorder columns after CREATE for more optimal row storage (for rows-in-block) - Removed flag 'RRND_PRESERVER_LASTINX' (not needed) - Extended ma_test_all.sh to test more completely all row formats - New structs and variables to hold rows-in-block and bitmap information - Added org_data_file_type in header to allow easy restore of old record format when doing maria_pack / maria_chk -u - More virtual functions to handle different row types - Pointer to row is now MARIA_RECORD_POS instead of my_off_t - New header signature for MARIA index files - Fixed bugs in ma_test1.c and ma_test2.c - All key and row blocks are now of same size - We now only have one link chain for deleted key blocks include/m_string.h: Define bzero_if_purify include/maria.h: Implementation of rows-in-block include/my_base.h: Implementation of rows-in-block include/my_handler.h: Cleanup macros Added size_to_store_key_length() include/my_sys.h: Added 'allocate_dynamic()' include/myisamchk.h: Implementation of rows-in-block mysys/array.c: Added allocate_dynamic() mysys/mf_keycache.c: Moved DBUG_ENTER to it's right position mysys/my_pread.c: Ensure my_errno is always set sql/filesort.cc: Fixed some compiler warnings sql/gen_lex_hash.cc: Removed not needed 'inline' sql/ha_maria.cc: Implementation of rows-in-block Fixed compiler warnings sql/mysqld.cc: Fixed setting of wrong variable sql/uniques.cc: Fixed compiler warnings storage/maria/Makefile.am: Implementation of rows-in-block storage/maria/ma_check.c: Removed RAID functions Added support for CHECK of rows-in-blocks rows storage/maria/ma_checksum.c: Implementation of rows-in-block storage/maria/ma_close.c: Implementation of rows-in-block storage/maria/ma_create.c: Implementation of rows-in-block: - Reorder columns - All key blocks are now of same size - Removed old RAID support storage/maria/ma_dbug.c: Implementation of rows-in-block storage/maria/ma_delete.c: Implementation of rows-in-block storage/maria/ma_delete_all.c: Implementation of rows-in-block storage/maria/ma_dynrec.c: info->rec_buff is now allocated through _ma_alloc_buffer() Use new info->cur_row structure storage/maria/ma_extra.c: Implementation of rows-in-block storage/maria/ma_ft_boolean_search.c: Removed compiler warnings Indentation fixes storage/maria/ma_ft_nlq_search.c: Removed compiler warnings Indentation fixes storage/maria/ma_ft_update.c: Removed some casts storage/maria/ma_fulltext.h: Changed pointer type storage/maria/ma_info.c: Implementation of rows-in-block More general _ma_report_error() storage/maria/ma_init.c: Implementation of rows-in-block storage/maria/ma_key.c: Implementation of rows-in-block Removed some casts storage/maria/ma_keycache.c: Fixed DBUG entry storage/maria/ma_locking.c: Implementation of rows-in-block storage/maria/ma_open.c: Implementation of rows-in-block storage/maria/ma_packrec.c: Indentation fixes Changed uchar * to byte * to make it possible to remove some casts storage/maria/ma_page.c: Implementation of rows-in-block storage/maria/ma_range.c: Implementation of rows-in-block storage/maria/ma_rfirst.c: Implementation of rows-in-block storage/maria/ma_rkey.c: Implementation of rows-in-block Indentation fixes storage/maria/ma_rlast.c: Implementation of rows-in-block storage/maria/ma_rnext.c: Implementation of rows-in-block storage/maria/ma_rnext_same.c: Implementation of rows-in-block storage/maria/ma_rprev.c: Implementation of rows-in-block storage/maria/ma_rrnd.c: Implementation of rows-in-block Removed flag 'RRND_PRESERVER_LASTINX', by not resetting lastinx (This is reset by maria_scan_init()) storage/maria/ma_rsame.c: Implementation of rows-in-block storage/maria/ma_rsamepos.c: Implementation of rows-in-block storage/maria/ma_rt_index.c: Implementation of rows-in-block storage/maria/ma_rt_index.h: Implementation of rows-in-block storage/maria/ma_rt_key.c: Implementation of rows-in-block storage/maria/ma_rt_key.h: Implementation of rows-in-block storage/maria/ma_rt_mbr.c: Implementation of rows-in-block storage/maria/ma_rt_mbr.h: Implementation of rows-in-block storage/maria/ma_rt_split.c: Implementation of rows-in-block storage/maria/ma_rt_test.c: Indentation fix storage/maria/ma_scan.c: Implementation of rows-in-block Added 'maria_scan_end()' storage/maria/ma_search.c: Implementation of rows-in-block storage/maria/ma_sort.c: Indentation fixes uchar -> byte to be able to remove some casts storage/maria/ma_sp_defs.h: uchar * -> byte * storage/maria/ma_sp_key.c: uchar * -> byte * storage/maria/ma_sp_test.c: Indentation fixes storage/maria/ma_static.c: New header signature for MARIA storage/maria/ma_statrec.c: int -> my_bool functions my_off_t -> MARIA_RECORD_POS Fixed argument order for _ma_read_static_record() storage/maria/ma_test1.c: Implementation of rows-in-block Fixed some bugs in VARCHAR and BLOB testing storage/maria/ma_test2.c: Implementation of rows-in-block Fixed bug in BLOB testing storage/maria/ma_test3.c: Implementation of rows-in-block storage/maria/ma_test_all.sh: Run all tests with dynamic, static and block row formats (For the moment we skip REPAIR test of rows-in-block as this is not yet implemented) storage/maria/ma_unique.c: Implementation of rows-in-block storage/maria/ma_update.c: Implementation of rows-in-block storage/maria/ma_write.c: Implementation of rows-in-block Write of row is split into two parts, as rows-in-block format require us to do write of row before keys (to get row position) in contrast to all other row formats storage/maria/maria_chk.c: Implementation of rows-in-block storage/maria/maria_def.h: Implementation of rows-in-block - New structs and variables to hold rows-in-block and bitmap information - Added org_data_file_type in header to allow easy restore of old record format when doing maria_pack / maria_chk -u - More virtual functions to handle different row types - Pointer to row is now MARIA_RECORD_POS instead of my_off_t - uchar -> byte for many parameters to avoid casts storage/maria/maria_ftdump.c: Implementation of rows-in-block storage/maria/maria_pack.c: Implementation of rows-in-block storage/myisam/mi_check.c: Added new row types into switch to avoid compiler warnings Added some casts to avoid warnings after changing type of lastkey and buff storage/myisam/mi_create.c: Fix that 'pack_fields' is calculated correctly storage/myisam/mi_rsamepos.c: Implementation of rows-in-block storage/myisam/mi_test2.c: Fixed wrong printf storage/myisam/sort.c: uchar * -> byte * support-files/magic: Added support for Maria files Fided wrong entry's for MyISAM files storage/maria/ma_bitmap.c: New BitKeeper file ``storage/maria/ma_bitmap.c'' storage/maria/ma_blockrec.c: New BitKeeper file ``storage/maria/ma_blockrec.c'' storage/maria/ma_blockrec.h: New BitKeeper file ``storage/maria/ma_blockrec.h''
164 lines
5.8 KiB
C
164 lines
5.8 KiB
C
/* Copyright (C) 2006 MySQL AB
|
|
|
|
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
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
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 */
|
|
|
|
/* Definitions needed for myisamchk/mariachk.c */
|
|
|
|
/*
|
|
Entries marked as "QQ to be removed" are NOT used to
|
|
pass check/repair options to xxx_check.c. They are used
|
|
internally by xxxchk.c or/and ha_xxxx.cc and should NOT
|
|
be stored together with other flags. They should be removed
|
|
from the following list to make addition of new flags possible.
|
|
*/
|
|
|
|
#ifndef _myisamchk_h
|
|
#define _myisamchk_h
|
|
|
|
#define T_AUTO_INC 1
|
|
#define T_AUTO_REPAIR 2 /* QQ to be removed */
|
|
#define T_BACKUP_DATA 4
|
|
#define T_CALC_CHECKSUM 8
|
|
#define T_CHECK 16 /* QQ to be removed */
|
|
#define T_CHECK_ONLY_CHANGED 32 /* QQ to be removed */
|
|
#define T_CREATE_MISSING_KEYS 64
|
|
#define T_DESCRIPT 128
|
|
#define T_DONT_CHECK_CHECKSUM 256
|
|
#define T_EXTEND 512
|
|
#define T_FAST (1L << 10) /* QQ to be removed */
|
|
#define T_FORCE_CREATE (1L << 11) /* QQ to be removed */
|
|
#define T_FORCE_UNIQUENESS (1L << 12)
|
|
#define T_INFO (1L << 13)
|
|
#define T_MEDIUM (1L << 14)
|
|
#define T_QUICK (1L << 15) /* QQ to be removed */
|
|
#define T_READONLY (1L << 16) /* QQ to be removed */
|
|
#define T_REP (1L << 17)
|
|
#define T_REP_BY_SORT (1L << 18) /* QQ to be removed */
|
|
#define T_REP_PARALLEL (1L << 19) /* QQ to be removed */
|
|
#define T_RETRY_WITHOUT_QUICK (1L << 20)
|
|
#define T_SAFE_REPAIR (1L << 21)
|
|
#define T_SILENT (1L << 22)
|
|
#define T_SORT_INDEX (1L << 23) /* QQ to be removed */
|
|
#define T_SORT_RECORDS (1L << 24) /* QQ to be removed */
|
|
#define T_STATISTICS (1L << 25)
|
|
#define T_UNPACK (1L << 26)
|
|
#define T_UPDATE_STATE (1L << 27)
|
|
#define T_VERBOSE (1L << 28)
|
|
#define T_VERY_SILENT (1L << 29)
|
|
#define T_WAIT_FOREVER (1L << 30)
|
|
#define T_WRITE_LOOP ((ulong) 1L << 31)
|
|
|
|
#define T_REP_ANY (T_REP | T_REP_BY_SORT | T_REP_PARALLEL)
|
|
|
|
/*
|
|
Flags used by xxxxchk.c or/and ha_xxxx.cc that are NOT passed
|
|
to xxxcheck.c follows:
|
|
*/
|
|
|
|
#define TT_USEFRM 1
|
|
#define TT_FOR_UPGRADE 2
|
|
|
|
#define O_NEW_INDEX 1 /* Bits set in out_flag */
|
|
#define O_NEW_DATA 2
|
|
#define O_DATA_LOST 4
|
|
|
|
typedef struct st_sort_key_blocks /* Used when sorting */
|
|
{
|
|
byte *buff, *end_pos;
|
|
byte lastkey[HA_MAX_POSSIBLE_KEY_BUFF];
|
|
uint last_length;
|
|
int inited;
|
|
} SORT_KEY_BLOCKS;
|
|
|
|
|
|
/*
|
|
MARIA/MYISAM supports several statistics collection
|
|
methods. Currently statistics collection method is not stored in
|
|
MARIA file and has to be specified for each table analyze/repair
|
|
operation in MI_CHECK::stats_method.
|
|
*/
|
|
|
|
typedef enum
|
|
{
|
|
/* Treat NULLs as inequal when collecting statistics (default for 4.1/5.0) */
|
|
MI_STATS_METHOD_NULLS_NOT_EQUAL,
|
|
/* Treat NULLs as equal when collecting statistics (like 4.0 did) */
|
|
MI_STATS_METHOD_NULLS_EQUAL,
|
|
/* Ignore NULLs - count only tuples without NULLs in the index components */
|
|
MI_STATS_METHOD_IGNORE_NULLS
|
|
} enum_handler_stats_method;
|
|
|
|
|
|
typedef struct st_handler_check_param
|
|
{
|
|
char *isam_file_name;
|
|
MY_TMPDIR *tmpdir;
|
|
void *thd;
|
|
const char *db_name, *table_name, *op_name;
|
|
ulonglong auto_increment_value;
|
|
ulonglong max_data_file_length;
|
|
ulonglong keys_in_use;
|
|
ulonglong max_record_length;
|
|
/*
|
|
The next two are used to collect statistics, see update_key_parts for
|
|
description.
|
|
*/
|
|
ulonglong unique_count[HA_MAX_KEY_SEG + 1];
|
|
ulonglong notnull_count[HA_MAX_KEY_SEG + 1];
|
|
|
|
my_off_t search_after_block;
|
|
my_off_t new_file_pos, key_file_blocks;
|
|
my_off_t keydata, totaldata, key_blocks, start_check_pos;
|
|
my_off_t used, empty, splits, del_length, link_used;
|
|
ha_rows total_records, total_deleted, records,del_blocks;
|
|
ha_rows full_page_count, tail_count;
|
|
ha_checksum record_checksum, glob_crc;
|
|
ha_checksum key_crc[HA_MAX_POSSIBLE_KEY];
|
|
ha_checksum tmp_key_crc[HA_MAX_POSSIBLE_KEY];
|
|
ha_checksum tmp_record_checksum;
|
|
ulong use_buffers, read_buffer_length, write_buffer_length;
|
|
ulong sort_buffer_length, sort_key_blocks;
|
|
ulong rec_per_key_part[HA_MAX_KEY_SEG * HA_MAX_POSSIBLE_KEY];
|
|
uint out_flag, warning_printed, error_printed, verbose;
|
|
uint opt_sort_key, total_files, max_level;
|
|
uint testflag, key_cache_block_size;
|
|
int tmpfile_createflag, err_count;
|
|
myf myf_rw;
|
|
uint8 language;
|
|
my_bool using_global_keycache, opt_lock_memory, opt_follow_links;
|
|
my_bool retry_repair, force_sort, calc_checksum, static_row_size;
|
|
char temp_filename[FN_REFLEN];
|
|
IO_CACHE read_cache;
|
|
enum_handler_stats_method stats_method;
|
|
} HA_CHECK;
|
|
|
|
|
|
typedef struct st_sort_ftbuf
|
|
{
|
|
byte *buf, *end;
|
|
int count;
|
|
byte lastkey[HA_MAX_KEY_BUFF];
|
|
} SORT_FT_BUF;
|
|
|
|
|
|
typedef struct st_buffpek {
|
|
my_off_t file_pos; /* Where we are in the sort file */
|
|
byte *base, *key; /* Key pointers */
|
|
ha_rows count; /* Number of rows in table */
|
|
ulong mem_count; /* numbers of keys in memory */
|
|
ulong max_keys; /* Max keys in buffert */
|
|
} BUFFPEK;
|
|
|
|
#endif /* _myisamchk_h */
|