mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 11:01:52 +01:00
cc589bef15
Maria is now used for internal temporary tables in MySQL Better usage of VARCHAR and long strings in temporary tables Use packed fields if BLOCK_RECORD is used null_bytes are not anymore stored in a separate field New interface to remember and restore scan position Fixed bugs in unique handling Don't sync Maria temporary tables Lock control file while it's used to stop several processes from using it Changed value of MA_DONT_OVERWRITE_FILE as it collided with MY_SYNC_DIR Split MY_DONT_WAIT into MY_NO_WAIT and MY_SHORT_WAIT (for my_lock()) Added MY_FORCE_LOCK include/my_sys.h: Changed value of MA_DONT_OVERWRITE_FILE as it collided with MY_SYNC_DIR Split MY_DONT_WAIT into MY_NO_WAIT and MY_SHORT_WAIT (for my_lock()) Added MY_FORCE_LOCK include/myisam.h: Make MyISAM columndef compile time compatible with Maria mysql-test/lib/mtr_process.pl: Removed confusing warning (It's common that there is a lot of other files than pid files) mysql-test/mysql-test-run.pl: Added --sync-frm to speed up tests mysql-test/r/maria-recovery.result: Updated results from wrong push mysql-test/suite/rpl/t/rpl_innodb_bug28430.test: Marked test as --big mysys/my_lock.c: If MY_FORCE_LOCK is given, use locking even if my_disable_locking is given If MY_NO_WAIT is given, return at once if lock is occupied If MY_SHORT_WAIT is given, wait some time for lock before returning (This was called MY_DONT_WAIT before) mysys/my_thr_init.c: Fix that we don't give name to thread before it's properly initied sql/handler.cc: Added myisam.h sql/handler.h: Changes to use Maria for internal temporary tables Removed not needed argument to restart_rnd_next() Added function remember_rnd_pos() sql/my_lock.c: If MY_FORCE_LOCK is given, use locking even if my_disable_locking is given If MY_NO_WAIT is given, return at once if lock is occupied If MY_SHORT_WAIT is given, wait some time for lock before returning (This was called MY_DONT_WAIT before) sql/mysql_priv.h: Added maria_hton sql/sql_class.h: Changes to use Maria for internal temporary tables sql/sql_select.cc: Changes to use Maria for internal temporary tables Temporary tables didn't properly switch to dynamic row format if long strings was used Better usage of VARCHAR in temporary tables Use new interface to restart scan in duplicate removal sql/sql_select.h: Changes to use Maria for internal temporary tables sql/sql_show.cc: Changes to use Maria for internal temporary tables Removed all end space sql/sql_table.cc: Set HA_OPTION_PACK_RECORD if we are not using default or static record sql/sql_union.cc: If MY_FORCE_LOCK is given, use locking even if my_disable_locking is given If MY_NO_WAIT is given, return at once if lock is occupied If MY_SHORT_WAIT is given, wait some time for lock before returning (This was called MY_DONT_WAIT before) sql/sql_update.cc: If MY_FORCE_LOCK is given, use locking even if my_disable_locking is given If MY_NO_WAIT is given, return at once if lock is occupied If MY_SHORT_WAIT is given, wait some time for lock before returning (This was called MY_DONT_WAIT before) storage/maria/ha_maria.cc: Use packed fields null_bytes are not anymore stored in a separate field Changes to use Maria for internal temporary tables Give warning if we try to do an ALTER TABLE to a unusable row format storage/maria/ha_maria.h: Allow Maria with block format to restart scanning at given position storage/maria/ma_blockrec.c: Added functions to remember and restore scan position Allocate cur_row.extents so that we don't have to do a malloc on first read Fixed bug when using packed row without packed strings Removed unneeded calls to free_full_pages() Fixed unlikely bug when using old bitmap to read head page and head page had gone away Remember row position when doing undo of delete and update row (needed for undo of key delete) storage/maria/ma_blockrec.h: Added functions to remember and restore scan position storage/maria/ma_close.c: Don't sync temporary tables storage/maria/ma_control_file.c: Lock control file while it's used to stop several processes from using it storage/maria/ma_create.c: Fixed bug when using FIELD_NORMAL that was longer than FULL_PAGE_SIZE Fixed bug that casued fields to not be ordered according to offset Fixed bug in unique creation storage/maria/ma_delete.c: Don't write record reference when deleting key. (Rowid is likely to be different when we undo this) storage/maria/ma_dynrec.c: Fixed core dump when comparing records (happended in unique handling) storage/maria/ma_extra.c: MY_DONT_WAIT -> MY_SHORT_WAIT Removed TODO comment. (Was not relevant as all other instances are guranteed to be closed when we the code is excecuted) Added DBUG_ASSERT() to prove above. storage/maria/ma_key_recover.c: CLR's for UNDO_ROW_DELETE and UNDO_ROW_UPDATE now include rowid for the row. This was needed for undo_key_delete to work, as undo of delete row is likely to put row in a new position. undo_delete_key now doesn't include row position storage/maria/ma_open.c: Added virtual functions for remembering and restoring scan position Fixed wrong key search method when using multi-byte character sets (Bug#32705) Store original column number in index file NOTE: Index files are now incompatible with previous versions! (Ok as we haven't yet made a public Maria release) storage/maria/ma_recovery.c: Set info->cur_row.lastpos when reading CLR's for UNDO_ROW_DELETE or UNDO_ROW_UPDATE storage/maria/ma_scan.c: Added default function to remember and restore scan position storage/maria/maria_def.h: Added virtual functions & variables to remember and restore scan position Added MARIA_MAX_CONTROL_FILE_LOCK_RETRY storage/myisam/ha_myisam.cc: Fixed compiler errors as columdef->type is now an enum, not an integer Added functions to remember and restore scan position storage/myisam/ha_myisam.h: Added functions to remember and restore scan position storage/myisam/mi_check.c: MY_DONT_WAIT -> MY_SHORT_WAIT storage/myisam/mi_extra.c: MY_DONT_WAIT -> MY_SHORT_WAIT storage/myisam/mi_open.c: MY_DONT_WAIT -> MY_SHORT_WAIT storage/myisam/myisamdef.h: MY_DONT_WAIT -> MY_SHORT_WAIT
155 lines
5.9 KiB
C++
155 lines
5.9 KiB
C++
/* Copyright (C) 2006,2004 MySQL AB & MySQL Finland AB & TCX DataKonsult 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; version 2 of the License.
|
|
|
|
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 */
|
|
|
|
|
|
#ifdef USE_PRAGMA_INTERFACE
|
|
#pragma interface /* gcc class implementation */
|
|
#endif
|
|
|
|
/* class for the maria handler */
|
|
|
|
#include <maria.h>
|
|
|
|
#define HA_RECOVER_NONE 0 /* No automatic recover */
|
|
#define HA_RECOVER_DEFAULT 1 /* Automatic recover active */
|
|
#define HA_RECOVER_BACKUP 2 /* Make a backupfile on recover */
|
|
#define HA_RECOVER_FORCE 4 /* Recover even if we loose rows */
|
|
#define HA_RECOVER_QUICK 8 /* Don't check rows in data file */
|
|
|
|
extern ulong maria_sort_buffer_size;
|
|
extern TYPELIB maria_recover_typelib;
|
|
extern ulong maria_recover_options;
|
|
|
|
class ha_maria :public handler
|
|
{
|
|
MARIA_HA *file;
|
|
ulonglong int_table_flags;
|
|
MARIA_RECORD_POS remember_pos;
|
|
char *data_file_name, *index_file_name;
|
|
enum data_file_type data_file_type;
|
|
bool can_enable_indexes;
|
|
int repair(THD * thd, HA_CHECK ¶m, bool optimize);
|
|
|
|
public:
|
|
ha_maria(handlerton *hton, TABLE_SHARE * table_arg);
|
|
~ha_maria() {}
|
|
handler *clone(MEM_ROOT *mem_root);
|
|
const char *table_type() const
|
|
{ return "MARIA"; }
|
|
const char *index_type(uint key_number);
|
|
const char **bas_ext() const;
|
|
ulonglong table_flags() const
|
|
{ return int_table_flags; }
|
|
ulong index_flags(uint inx, uint part, bool all_parts) const
|
|
{
|
|
return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ?
|
|
0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
|
|
HA_READ_ORDER | HA_KEYREAD_ONLY);
|
|
}
|
|
uint max_supported_keys() const
|
|
{ return MARIA_MAX_KEY; }
|
|
uint max_supported_key_length() const;
|
|
uint max_supported_key_part_length() const
|
|
{ return max_supported_key_length(); }
|
|
enum row_type get_row_type() const;
|
|
uint checksum() const;
|
|
virtual double scan_time();
|
|
|
|
int open(const char *name, int mode, uint test_if_locked);
|
|
int close(void);
|
|
int write_row(uchar * buf);
|
|
int update_row(const uchar * old_data, uchar * new_data);
|
|
int delete_row(const uchar * buf);
|
|
int index_read_map(uchar * buf, const uchar * key, key_part_map keypart_map,
|
|
enum ha_rkey_function find_flag);
|
|
int index_read_idx_map(uchar * buf, uint idx, const uchar * key,
|
|
key_part_map keypart_map,
|
|
enum ha_rkey_function find_flag);
|
|
int index_read_last_map(uchar * buf, const uchar * key,
|
|
key_part_map keypart_map);
|
|
int index_next(uchar * buf);
|
|
int index_prev(uchar * buf);
|
|
int index_first(uchar * buf);
|
|
int index_last(uchar * buf);
|
|
int index_next_same(uchar * buf, const uchar * key, uint keylen);
|
|
int ft_init()
|
|
{
|
|
if (!ft_handler)
|
|
return 1;
|
|
ft_handler->please->reinit_search(ft_handler);
|
|
return 0;
|
|
}
|
|
FT_INFO *ft_init_ext(uint flags, uint inx, String * key)
|
|
{
|
|
return maria_ft_init_search(flags, file, inx,
|
|
(uchar *) key->ptr(), key->length(),
|
|
key->charset(), table->record[0]);
|
|
}
|
|
int ft_read(uchar * buf);
|
|
int rnd_init(bool scan);
|
|
int rnd_end(void);
|
|
int rnd_next(uchar * buf);
|
|
int rnd_pos(uchar * buf, uchar * pos);
|
|
int remember_rnd_pos();
|
|
int restart_rnd_next(uchar * buf);
|
|
void position(const uchar * record);
|
|
int info(uint);
|
|
int extra(enum ha_extra_function operation);
|
|
int extra_opt(enum ha_extra_function operation, ulong cache_size);
|
|
int reset(void);
|
|
int external_lock(THD * thd, int lock_type);
|
|
int start_stmt(THD *thd, thr_lock_type lock_type);
|
|
int delete_all_rows(void);
|
|
int disable_indexes(uint mode);
|
|
int enable_indexes(uint mode);
|
|
int indexes_are_disabled(void);
|
|
void start_bulk_insert(ha_rows rows);
|
|
int end_bulk_insert();
|
|
ha_rows records_in_range(uint inx, key_range * min_key, key_range * max_key);
|
|
void update_create_info(HA_CREATE_INFO * create_info);
|
|
int create(const char *name, TABLE * form, HA_CREATE_INFO * create_info);
|
|
THR_LOCK_DATA **store_lock(THD * thd, THR_LOCK_DATA ** to,
|
|
enum thr_lock_type lock_type);
|
|
virtual void get_auto_increment(ulonglong offset, ulonglong increment,
|
|
ulonglong nb_desired_values,
|
|
ulonglong *first_value,
|
|
ulonglong *nb_reserved_values);
|
|
int rename_table(const char *from, const char *to);
|
|
int delete_table(const char *name);
|
|
int check(THD * thd, HA_CHECK_OPT * check_opt);
|
|
int analyze(THD * thd, HA_CHECK_OPT * check_opt);
|
|
int repair(THD * thd, HA_CHECK_OPT * check_opt);
|
|
bool check_and_repair(THD * thd);
|
|
bool is_crashed() const;
|
|
bool auto_repair() const
|
|
{ return maria_recover_options != 0; }
|
|
int optimize(THD * thd, HA_CHECK_OPT * check_opt);
|
|
int restore(THD * thd, HA_CHECK_OPT * check_opt);
|
|
int backup(THD * thd, HA_CHECK_OPT * check_opt);
|
|
int assign_to_keycache(THD * thd, HA_CHECK_OPT * check_opt);
|
|
int preload_keys(THD * thd, HA_CHECK_OPT * check_opt);
|
|
bool check_if_incompatible_data(HA_CREATE_INFO * info, uint table_changes);
|
|
#ifdef HAVE_REPLICATION
|
|
int dump(THD * thd, int fd);
|
|
int net_read_dump(NET * net);
|
|
#endif
|
|
#ifdef HAVE_QUERY_CACHE
|
|
my_bool register_query_cache_table(THD *thd, char *table_key,
|
|
uint key_length,
|
|
qc_engine_callback
|
|
*engine_callback,
|
|
ulonglong *engine_data);
|
|
#endif
|
|
};
|