summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@mysql.com/narttu.mysql.fi>2008-01-10 21:21:36 +0200
committerunknown <monty@mysql.com/narttu.mysql.fi>2008-01-10 21:21:36 +0200
commit5ad477f6cb765025ce240a47b71532bb7e5f286b (patch)
treef80ba0ad0ff5d6b22ddac6f540ae77af5b199319
parent5d68fbc19050d8dc46faf917d2f9969cc0d5dd9b (diff)
downloadmariadb-git-5ad477f6cb765025ce240a47b71532bb7e5f286b.tar.gz
Added --with-maria-tmp-tables (default one) to allow on to configure if Maria should be used for internal temporary tables
Abort mysqld if Maria engine didn't start and we are using Maria for temporary tables Fixed bug that caused update of big blobs to crash Use pagecache_page_no_t as type for pages (to get rid of compiler warnings) Added cast to get rid of compiler warning Fixed wrong types of variables and arguments that caused lost information Fixed wrong DBUG_ASSERT() that caused REDO of big blobs to fail Removed some historical ifdefs that caused problem with windows compilations BUILD/SETUP.sh: Added --with-maria-tmp-tables include/maria.h: Use pagecache_page_no_t as type for pages Use my_bool as parameter for 'rep_quick' option include/my_base.h: Added comment mysql-test/r/maria-big.result: Added test that uses big blobs mysql-test/t/maria-big.test: Added test that uses big blobs sql/mysqld.cc: Abort mysqld if Maria engine didn't start and we are using Maria for temporary tables sql/sql_class.h: Don't use Maria for temporary tables if --with-maria-tmp-tables is not defined sql/sql_select.cc: Don't use Maria for temporary tables if --with-maria-tmp-tables is not defined storage/maria/ha_maria.cc: Fixed compiler warnings reported by MCC - Fixed usage of wrong types that caused data loss - Changed parameter for rep_quick to my_bool - Added safe casts Fixed indentation storage/maria/ma_bitmap.c: Use pagecache_page_no_t as type for pages Fixed compiler warnings Fixed bug that caused update of big blobs to crash storage/maria/ma_blockrec.c: Use pagecache_page_no_t as type for pages Use my_bool as parameter for 'rep_quick' option Fixed compiler warnings Fixed wrong DBUG_ASSERT() storage/maria/ma_blockrec.h: Use pagecache_page_no_t as type for pages storage/maria/ma_check.c: Fixed some wrong parameters where we didn't get all bits for test_flag Changed rep_quick to be of type my_bool Use pagecache_page_no_t as type for pages Added cast's to get rid of compiler warnings Changed type of record_pos to get rid of compiler warning storage/maria/ma_create.c: Added safe cast's to get rid of compiler warnings storage/maria/ma_dynrec.c: Fixed usage of wrong type storage/maria/ma_key.c: Fixed compiler warning storage/maria/ma_key_recover.c: Use pagecache_page_no_t as type for pages storage/maria/ma_loghandler_lsn.h: Added cast's to get rid of compiler warnings storage/maria/ma_page.c: Changed variable name from 'page' to 'pos' as it was an offset and not a page address Moved page_size inside block to get rid of compiler warning storage/maria/ma_pagecache.c: Fixed compiler warnings Replaced compile time assert with TODO storage/maria/ma_pagecache.h: Use pagecache_page_no_t as type for pages storage/maria/ma_pagecrc.c: Allow bitmap pages that is all zero storage/maria/ma_preload.c: Added cast to get rid of compiler warning storage/maria/ma_recovery.c: Changed types to get rid of compiler warnings Use bool for quick_repair to get rid of compiler warning Fixed some variables that was wrongly declared (not enough precission) Added cast to get rid of compiler warning storage/maria/ma_test2.c: Remove historical undefs storage/maria/maria_chk.c: Changed rep_quick to bool Fixed wrong parameter to maria_chk_data_link() storage/maria/maria_def.h: Use pagecache_page_no_t as type for pages storage/maria/maria_pack.c: Renamed isam -> maria storage/maria/plug.in: Added option --with-maria-tmp-tables storage/maria/trnman.c: Added cast to get rid of compiler warning storage/myisam/mi_test2.c: Remove historical undefs
-rwxr-xr-xBUILD/SETUP.sh2
-rw-r--r--include/maria.h12
-rw-r--r--include/my_base.h5
-rw-r--r--mysql-test/r/maria-big.result162
-rw-r--r--mysql-test/t/maria-big.test34
-rw-r--r--sql/mysqld.cc7
-rw-r--r--sql/sql_class.h2
-rw-r--r--sql/sql_select.cc2
-rw-r--r--storage/maria/ha_maria.cc129
-rw-r--r--storage/maria/ma_bitmap.c67
-rw-r--r--storage/maria/ma_blockrec.c54
-rw-r--r--storage/maria/ma_blockrec.h27
-rw-r--r--storage/maria/ma_check.c52
-rw-r--r--storage/maria/ma_create.c8
-rw-r--r--storage/maria/ma_dynrec.c2
-rw-r--r--storage/maria/ma_key.c7
-rw-r--r--storage/maria/ma_key_recover.c12
-rw-r--r--storage/maria/ma_loghandler_lsn.h4
-rw-r--r--storage/maria/ma_page.c50
-rwxr-xr-xstorage/maria/ma_pagecache.c15
-rw-r--r--storage/maria/ma_pagecache.h5
-rw-r--r--storage/maria/ma_pagecrc.c20
-rw-r--r--storage/maria/ma_preload.c3
-rw-r--r--storage/maria/ma_recovery.c29
-rw-r--r--storage/maria/ma_test2.c6
-rw-r--r--storage/maria/maria_chk.c7
-rw-r--r--storage/maria/maria_def.h8
-rw-r--r--storage/maria/maria_pack.c42
-rw-r--r--storage/maria/plug.in11
-rw-r--r--storage/maria/trnman.c3
-rw-r--r--storage/myisam/mi_test2.c6
31 files changed, 520 insertions, 273 deletions
diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh
index 34bdfecf995..07c308b9a26 100755
--- a/BUILD/SETUP.sh
+++ b/BUILD/SETUP.sh
@@ -145,7 +145,7 @@ base_configs="--prefix=$prefix --enable-assembler "
base_configs="$base_configs --with-extra-charsets=complex "
base_configs="$base_configs --enable-thread-safe-client "
base_configs="$base_configs --with-big-tables"
-base_configs="$base_configs --with-plugin-maria"
+base_configs="$base_configs --with-plugin-maria --with-maria-tmp-tables"
if test -d "$path/../cmd-line-utils/readline"
then
diff --git a/include/maria.h b/include/maria.h
index 00c01075d05..f2b0fc6516a 100644
--- a/include/maria.h
+++ b/include/maria.h
@@ -338,7 +338,7 @@ typedef struct st_maria_sort_info
SORT_KEY_BLOCKS *key_block, *key_block_end;
SORT_FT_BUF *ft_buf;
my_off_t filelength, dupp, buff_length;
- ulonglong page;
+ pgcache_page_no_t page;
ha_rows max_records;
uint current_key, total_keys;
uint got_error, threads_running;
@@ -392,17 +392,17 @@ typedef struct st_maria_sort_param
/* functions in maria_check */
void maria_chk_init(HA_CHECK *param);
int maria_chk_status(HA_CHECK *param, MARIA_HA *info);
-int maria_chk_del(HA_CHECK *param, MARIA_HA *info, uint test_flag);
+int maria_chk_del(HA_CHECK *param, MARIA_HA *info, ulonglong test_flag);
int maria_chk_size(HA_CHECK *param, MARIA_HA *info);
int maria_chk_key(HA_CHECK *param, MARIA_HA *info);
-int maria_chk_data_link(HA_CHECK *param, MARIA_HA *info, int extend);
-int maria_repair(HA_CHECK *param, MARIA_HA *info, char * name, uint rep_quick);
+int maria_chk_data_link(HA_CHECK *param, MARIA_HA *info, my_bool extend);
+int maria_repair(HA_CHECK *param, MARIA_HA *info, char * name, my_bool);
int maria_sort_index(HA_CHECK *param, MARIA_HA *info, char * name);
int maria_zerofill(HA_CHECK *param, MARIA_HA *info, const char *name);
int maria_repair_by_sort(HA_CHECK *param, MARIA_HA *info,
- const char *name, uint rep_quick);
+ const char *name, my_bool rep_quick);
int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info,
- const char *name, uint rep_quick);
+ const char *name, my_bool rep_quick);
int maria_change_to_newfile(const char *filename, const char *old_ext,
const char *new_ext, myf myflags);
void maria_lock_memory(HA_CHECK *param);
diff --git a/include/my_base.h b/include/my_base.h
index fdf8d248879..04de6f55f44 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -235,7 +235,10 @@ enum ha_base_keytype {
#define HA_MAX_KEYTYPE 31 /* Must be log2-1 */
- /* These flags kan be OR:ed to key-flag */
+/*
+ These flags kan be OR:ed to key-flag
+ Note that these can only be up to 16 bits!
+*/
#define HA_NOSAME 1 /* Set if not dupplicated records */
#define HA_PACK_KEY 2 /* Pack string key to previous key */
diff --git a/mysql-test/r/maria-big.result b/mysql-test/r/maria-big.result
index 8f7bbc74123..b45816367a5 100644
--- a/mysql-test/r/maria-big.result
+++ b/mysql-test/r/maria-big.result
@@ -61,3 +61,165 @@ count(*)
affected rows: 1
drop table t1, t2;
affected rows: 0
+set @@max_allowed_packet=400000000;
+affected rows: 0
+create table t1 (a int, b longtext);
+affected rows: 0
+insert into t1 values (1,"123456789012345678901234567890"),(2,"09876543210987654321");
+affected rows: 2
+info: Records: 2 Duplicates: 0 Warnings: 0
+update t1 set b=CONCAT(b,b);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=CONCAT(b,b);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=CONCAT(b,b);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=CONCAT(b,b);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=CONCAT(b,b);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=CONCAT(b,b);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=CONCAT(b,b);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=CONCAT(b,b);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=CONCAT(b,b);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=CONCAT(b,b);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=CONCAT(b,b);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=CONCAT(b,b);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=CONCAT(b,b);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=CONCAT(b,b);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=CONCAT(b,b);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=CONCAT(b,b);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=CONCAT(b,b);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=CONCAT(b,b);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=CONCAT(b,b);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=CONCAT(b,b);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=CONCAT(b,b);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=CONCAT(b,b);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=CONCAT(b,b);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+select a,length(b) from t1;
+a length(b)
+1 251658240
+2 167772160
+affected rows: 2
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+affected rows: 1
+update t1 set b=mid(b,1,length(b)/2);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=mid(b,1,length(b)/2);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=mid(b,1,length(b)/2);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=mid(b,1,length(b)/2);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=mid(b,1,length(b)/2);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=mid(b,1,length(b)/2);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=mid(b,1,length(b)/2);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=mid(b,1,length(b)/2);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=mid(b,1,length(b)/2);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=mid(b,1,length(b)/2);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=mid(b,1,length(b)/2);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=mid(b,1,length(b)/2);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=mid(b,1,length(b)/2);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=mid(b,1,length(b)/2);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=mid(b,1,length(b)/2);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=mid(b,1,length(b)/2);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=mid(b,1,length(b)/2);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=mid(b,1,length(b)/2);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=mid(b,1,length(b)/2);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=mid(b,1,length(b)/2);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=mid(b,1,length(b)/2);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+update t1 set b=mid(b,1,length(b)/2);
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+select a,length(b) from t1;
+a length(b)
+1 60
+2 40
+affected rows: 2
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+affected rows: 1
+drop table t1;
+affected rows: 0
diff --git a/mysql-test/t/maria-big.test b/mysql-test/t/maria-big.test
index 168bf800ea6..fd687bf925f 100644
--- a/mysql-test/t/maria-big.test
+++ b/mysql-test/t/maria-big.test
@@ -6,6 +6,12 @@ set global maria_log_file_size=4294967295;
disable_warnings;
drop table if exists t1, t2;
enable_warnings;
+
+#
+# Test generating data with insert select
+# This test case failed once a long time ago
+#
+
create table t1(a char(3));
insert into t1 values("abc");
insert into t1 select "def" from t1;
@@ -25,4 +31,30 @@ create table t2 select * from t1;
select count(*) from t1;
select count(*) from t2;
drop table t1, t2;
-disable_info;
+
+#
+# Test creating a really big blob (up to 16M)
+#
+
+set @@max_allowed_packet=400000000;
+create table t1 (a int, b longtext);
+insert into t1 values (1,"123456789012345678901234567890"),(2,"09876543210987654321");
+
+let $loop=23;
+while ($loop)
+{
+ update t1 set b=CONCAT(b,b);
+ dec $loop;
+}
+select a,length(b) from t1;
+check table t1;
+let $loop=22;
+while ($loop)
+{
+ update t1 set b=mid(b,1,length(b)/2);
+ dec $loop;
+}
+select a,length(b) from t1;
+check table t1;
+
+drop table t1;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 18f3b8cf55a..c78e6c40211 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -3762,6 +3762,13 @@ server.");
global_system_variables.table_plugin= plugin;
}
}
+#if defined(WITH_MARIA_STORAGE_ENGINE) && defined(USE_MARIA_FOR_TMP_TABLES)
+ if (!ha_storage_engine_is_enabled(maria_hton))
+ {
+ sql_print_error("Maria engine is not enabled or did not start. The Maria engine must be enabled to continue as mysqld was configured with --with-maria-tmp-tables");
+ unireg_abort(1);
+ }
+#endif
tc_log= (total_ha_2pc > 1 ? (opt_bin_log ?
(TC_LOG *) &mysql_bin_log :
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 3689bb343d5..2342f7326a2 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -2371,7 +2371,7 @@ public:
};
-#ifdef WITH_MARIA_STORAGE_ENGINE
+#if defined(WITH_MARIA_STORAGE_ENGINE) && defined(USE_MARIA_FOR_TMP_TABLES)
#include <maria.h>
#define ENGINE_COLUMNDEF MARIA_COLUMNDEF
#else
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 3267df95b63..d8b06f978bd 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -35,7 +35,7 @@
#include <my_bit.h>
#include <hash.h>
#include <ft_global.h>
-#ifdef WITH_MARIA_STORAGE_ENGINE
+#if defined(WITH_MARIA_STORAGE_ENGINE) && defined(USE_MARIA_FOR_TMP_TABLES)
#include "../storage/maria/ha_maria.h"
#define TMP_ENGINE_HTON maria_hton
#else
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index 4e7d2b04471..0a1c7bfe078 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -302,7 +302,8 @@ static int table2maria(TABLE *table_arg, data_file_type row_type,
pos= table_arg->key_info;
for (i= 0; i < share->keys; i++, pos++)
{
- keydef[i].flag= (pos->flags & (HA_NOSAME | HA_FULLTEXT | HA_SPATIAL));
+ keydef[i].flag= (uint16) (pos->flags & (HA_NOSAME | HA_FULLTEXT |
+ HA_SPATIAL));
keydef[i].key_alg= pos->algorithm == HA_KEY_ALG_UNDEF ?
(pos->flags & HA_SPATIAL ? HA_KEY_ALG_RTREE : HA_KEY_ALG_BTREE) :
pos->algorithm;
@@ -927,7 +928,7 @@ int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt)
error= maria_chk_status(&param, file); // Not fatal
error= maria_chk_size(&param, file);
if (!error)
- error |= maria_chk_del(&param, file, param.testflag);
+ error|= maria_chk_del(&param, file, param.testflag);
if (!error)
error= maria_chk_key(&param, file);
if (!error)
@@ -937,13 +938,14 @@ int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt)
(HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD)) ||
(param.testflag & (T_EXTEND | T_MEDIUM)))) || maria_is_crashed(file))
{
- uint old_testflag= param.testflag;
+ ulonglong old_testflag= param.testflag;
param.testflag |= T_MEDIUM;
if (!(error= init_io_cache(&param.read_cache, file->dfile.file,
my_default_record_cache_size, READ_CACHE,
share->pack.header_length, 1, MYF(MY_WME))))
{
- error= maria_chk_data_link(&param, file, param.testflag & T_EXTEND);
+ error= maria_chk_data_link(&param, file,
+ test(param.testflag & T_EXTEND));
end_io_cache(&(param.read_cache));
}
param.testflag= old_testflag;
@@ -961,8 +963,9 @@ int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt)
share->state.changed &= ~(STATE_CHANGED | STATE_CRASHED |
STATE_CRASHED_ON_REPAIR);
if (!(table->db_stat & HA_READ_ONLY))
- error= maria_update_state_info(&param, file, UPDATE_TIME | UPDATE_OPEN_COUNT |
- UPDATE_STAT);
+ error= maria_update_state_info(&param, file,
+ UPDATE_TIME | UPDATE_OPEN_COUNT |
+ UPDATE_STAT);
pthread_mutex_unlock(&share->intern_lock);
info(HA_STATUS_NO_LOCK | HA_STATUS_TIME | HA_STATUS_VARIABLE |
HA_STATUS_CONST);
@@ -1226,7 +1229,7 @@ int ha_maria::optimize(THD * thd, HA_CHECK_OPT *check_opt)
int ha_maria::repair(THD *thd, HA_CHECK &param, bool do_optimize)
{
int error= 0;
- uint local_testflag= param.testflag;
+ ulonglong local_testflag= param.testflag;
bool optimize_done= !do_optimize, statistics_done= 0;
const char *old_proc_info= thd->proc_info;
char fixed_name[FN_REFLEN];
@@ -1278,7 +1281,7 @@ int ha_maria::repair(THD *thd, HA_CHECK &param, bool do_optimize)
ulonglong key_map= ((local_testflag & T_CREATE_MISSING_KEYS) ?
maria_get_mask_all_keys_active(share->base.keys) :
share->state.key_map);
- uint save_testflag= param.testflag;
+ ulonglong save_testflag= param.testflag;
if (maria_test_if_sort_rep(file, file->state->records, key_map, 0) &&
(local_testflag & T_REP_BY_SORT))
{
@@ -1295,7 +1298,7 @@ int ha_maria::repair(THD *thd, HA_CHECK &param, bool do_optimize)
thd_proc_info(thd, buf);
param.testflag|= T_REP_PARALLEL;
error= maria_repair_parallel(&param, file, fixed_name,
- param.testflag & T_QUICK);
+ test(param.testflag & T_QUICK));
/* to reset proc_info, as it was pointing to local buffer */
thd_proc_info(thd, "Repair done");
}
@@ -1304,14 +1307,15 @@ int ha_maria::repair(THD *thd, HA_CHECK &param, bool do_optimize)
thd_proc_info(thd, "Repair by sorting");
param.testflag|= T_REP_BY_SORT;
error= maria_repair_by_sort(&param, file, fixed_name,
- param.testflag & T_QUICK);
+ test(param.testflag & T_QUICK));
}
}
else
{
thd_proc_info(thd, "Repair with keycache");
param.testflag &= ~(T_REP_BY_SORT | T_REP_PARALLEL);
- error= maria_repair(&param, file, fixed_name, param.testflag & T_QUICK);
+ error= maria_repair(&param, file, fixed_name,
+ test(param.testflag & T_QUICK));
/**
@todo RECOVERY BUG we do things with the index file
(maria_sort_index() after the above which already has logged the
@@ -2551,69 +2555,68 @@ bool maria_show_status(handlerton *hton,
enum ha_stat_type stat)
{
char engine_name[]= "maria";
- switch (stat)
- {
+ switch (stat) {
case HA_ENGINE_LOGS:
+ {
+ TRANSLOG_ADDRESS horizon= translog_get_horizon();
+ uint32 last_file= LSN_FILE_NO(horizon);
+ uint32 first_needed= translog_get_first_needed_file();
+ uint32 first_file= translog_get_first_file(horizon);
+ uint32 i;
+ const char unknown[]= "unknown";
+ const char needed[]= "in use";
+ const char unneeded[]= "free";
+ char path[FN_REFLEN];
+
+ if (first_file == 0)
+ {
+ const char error[]= "error";
+ print(thd, engine_name, sizeof(engine_name),
+ STRING_WITH_LEN(""), error, sizeof(error));
+ break;
+ }
+
+ for (i= first_file; i <= last_file; i++)
{
- TRANSLOG_ADDRESS horizon= translog_get_horizon();
- uint32 last_file= LSN_FILE_NO(horizon);
- uint32 first_needed= translog_get_first_needed_file();
- uint32 first_file= translog_get_first_file(horizon);
- uint32 i;
- const char unknown[]= "unknown";
- const char needed[]= "in use";
- const char unneeded[]= "free";
- char path[FN_REFLEN];
-
- if (first_file == 0)
+ char *file;
+ const char *status;
+ uint length, status_len;
+ MY_STAT stat_buff, *stat;
+ const char error[]= "can't stat";
+ char object[SHOW_MSG_LEN];
+ file= translog_filename_by_fileno(i, path);
+ if (!(stat= my_stat(file, &stat_buff, MYF(MY_WME))))
{
- const char error[]= "error";
- print(thd, engine_name, sizeof(engine_name),
- STRING_WITH_LEN(""), error, sizeof(error));
- break;
+ status= error;
+ status_len= sizeof(error);
+ length= snprintf(object, SHOW_MSG_LEN, "Size unknown ; %s", file);
}
-
- for (i= first_file; i <= last_file; i++)
+ else
{
- char *file;
- const char *status;
- uint length, status_len;
- MY_STAT stat_buff, *stat;
- const char error[]= "can't stat";
- char object[SHOW_MSG_LEN];
- file= translog_filename_by_fileno(i, path);
- if (!(stat= my_stat(file, &stat_buff, MYF(MY_WME))))
+ if (first_needed == 0)
{
- status= error;
- status_len= sizeof(error);
- length= snprintf(object, SHOW_MSG_LEN, "Size unknown ; %s", file);
+ status= unknown;
+ status_len= sizeof(unknown);
+ }
+ else if (i < first_needed)
+ {
+ status= unneeded;
+ status_len= sizeof(unneeded);
}
else
{
- if (first_needed == 0)
- {
- status= unknown;
- status_len= sizeof(unknown);
- }
- else if (i < first_needed)
- {
- status= unneeded;
- status_len= sizeof(unneeded);
- }
- else
- {
- status= needed;
- status_len= sizeof(needed);
- }
- length= snprintf(object, SHOW_MSG_LEN, "Size %12lu ; %s",
- (ulong) stat->st_size, file);
+ status= needed;
+ status_len= sizeof(needed);
}
-
- print(thd, engine_name, sizeof(engine_name),
- object, length, status, status_len);
+ length= snprintf(object, SHOW_MSG_LEN, "Size %12lu ; %s",
+ (ulong) stat->st_size, file);
}
- break;
+
+ print(thd, engine_name, sizeof(engine_name),
+ object, length, status, status_len);
}
+ break;
+ }
case HA_ENGINE_STATUS:
case HA_ENGINE_MUTEX:
default:
@@ -2641,7 +2644,7 @@ static int ha_maria_init(void *p)
maria_tmpdir= &mysql_tmpdir_list; /* For REDO */
res= maria_init() || ma_control_file_create_or_open() ||
!init_pagecache(maria_pagecache,
- pagecache_buffer_size, pagecache_division_limit,
+ (size_t) pagecache_buffer_size, pagecache_division_limit,
pagecache_age_threshold, MARIA_KEY_BLOCK_LENGTH, 0) ||
!init_pagecache(maria_log_pagecache,
TRANSLOG_PAGECACHE_SIZE, 0, 0,
diff --git a/storage/maria/ma_bitmap.c b/storage/maria/ma_bitmap.c
index e35658f55f1..5e9fa0ca08e 100644
--- a/storage/maria/ma_bitmap.c
+++ b/storage/maria/ma_bitmap.c
@@ -132,7 +132,7 @@
static my_bool _ma_read_bitmap_page(MARIA_SHARE *share,
MARIA_FILE_BITMAP *bitmap,
- ulonglong page);
+ pgcache_page_no_t page);
/* Write bitmap page to key cache */
@@ -237,7 +237,7 @@ my_bool _ma_bitmap_init(MARIA_SHARE *share, File file)
_ma_bitmap_reset_cache(share);
- if (share->state.first_bitmap_with_space == ~(ulonglong) 0)
+ if (share->state.first_bitmap_with_space == ~(pgcache_page_no_t) 0)
{
/* Start scanning for free space from start of file */
share->state.first_bitmap_with_space = 0;
@@ -678,7 +678,7 @@ static void _ma_print_bitmap_changes(MARIA_FILE_BITMAP *bitmap)
/* Print content of bitmap for debugging */
void _ma_print_bitmap(MARIA_FILE_BITMAP *bitmap, uchar *data,
- ulonglong page)
+ pgcache_page_no_t page)
{
uchar *pos, *end;
char llbuff[22];
@@ -744,7 +744,7 @@ void _ma_print_bitmap(MARIA_FILE_BITMAP *bitmap, uchar *data,
static my_bool _ma_read_bitmap_page(MARIA_SHARE *share,
MARIA_FILE_BITMAP *bitmap,
- ulonglong page)
+ pgcache_page_no_t page)
{
my_off_t end_of_page= (page + 1) * bitmap->block_size;
my_bool res;
@@ -832,7 +832,7 @@ static my_bool _ma_read_bitmap_page(MARIA_SHARE *share,
static my_bool _ma_change_bitmap_page(MARIA_HA *info,
MARIA_FILE_BITMAP *bitmap,
- ulonglong page)
+ pgcache_page_no_t page)
{
DBUG_ENTER("_ma_change_bitmap_page");
@@ -867,7 +867,7 @@ static my_bool _ma_change_bitmap_page(MARIA_HA *info,
static my_bool move_to_next_bitmap(MARIA_HA *info, MARIA_FILE_BITMAP *bitmap)
{
- ulonglong page= bitmap->page;
+ pgcache_page_no_t page= bitmap->page;
MARIA_STATE_INFO *state= &info->s->state;
DBUG_ENTER("move_to_next_bitmap");
@@ -988,7 +988,7 @@ static my_bool allocate_head(MARIA_FILE_BITMAP *bitmap, uint size,
continue;
for (i= 0; i < 16 ; i++, bits >>= 3)
{
- uint pattern= bits & 7;
+ uint pattern= (uint) (bits & 7);
if (pattern <= min_bits)
{
/* There is enough space here */
@@ -1074,7 +1074,7 @@ static my_bool allocate_tail(MARIA_FILE_BITMAP *bitmap, uint size,
continue;
for (i= 0; i < 16; i++, bits >>= 3)
{
- uint pattern= bits & 7;
+ uint pattern= (uint) (bits & 7);
if (pattern <= min_bits && (!pattern || pattern >= 5))
{
if ((int) pattern > (int) best_bits)
@@ -1538,7 +1538,7 @@ static my_bool allocate_blobs(MARIA_HA *info, MARIA_ROW *row)
This is used on update where we are updating an existing head page
*/
-static void use_head(MARIA_HA *info, ulonglong page, uint size,
+static void use_head(MARIA_HA *info, pgcache_page_no_t page, uint size,
uint block_position)
{
MARIA_FILE_BITMAP *bitmap= &info->s->bitmap;
@@ -1817,7 +1817,7 @@ abort:
*/
my_bool _ma_bitmap_find_new_place(MARIA_HA *info, MARIA_ROW *row,
- ulonglong page, uint free_size,
+ pgcache_page_no_t page, uint free_size,
MARIA_BITMAP_BLOCKS *blocks)
{
MARIA_SHARE *share= info->s;
@@ -1833,12 +1833,6 @@ my_bool _ma_bitmap_find_new_place(MARIA_HA *info, MARIA_ROW *row,
info->bitmap_blocks.elements= ELEMENTS_RESERVED_FOR_MAIN_PART;
pthread_mutex_lock(&share->bitmap.bitmap_lock);
- bitmap_page= page / share->bitmap.pages_covered;
- bitmap_page*= share->bitmap.pages_covered;
-
- if (share->bitmap.page != bitmap_page &&
- _ma_change_bitmap_page(info, &share->bitmap, bitmap_page))
- goto abort;
/*
First allocate all blobs (so that we can find out the needed size for
@@ -1847,6 +1841,14 @@ my_bool _ma_bitmap_find_new_place(MARIA_HA *info, MARIA_ROW *row,
if (row->blob_length && allocate_blobs(info, row))
goto abort;
+ /* Switch bitmap to current head page */
+ bitmap_page= page / share->bitmap.pages_covered;
+ bitmap_page*= share->bitmap.pages_covered;
+
+ if (share->bitmap.page != bitmap_page &&
+ _ma_change_bitmap_page(info, &share->bitmap, bitmap_page))
+ goto abort;
+
extents_length= row->extents_count * ROW_EXTENT_SIZE;
if ((head_length= (row->head_length + extents_length + 3)) <= free_size)
{
@@ -1909,9 +1911,9 @@ abort:
*/
static my_bool set_page_bits(MARIA_HA *info, MARIA_FILE_BITMAP *bitmap,
- ulonglong page, uint fill_pattern)
+ pgcache_page_no_t page, uint fill_pattern)
{
- ulonglong bitmap_page;
+ pgcache_page_no_t bitmap_page;
uint offset_page, offset, tmp, org_tmp;
uchar *data;
DBUG_ENTER("set_page_bits");
@@ -1922,7 +1924,7 @@ static my_bool set_page_bits(MARIA_HA *info, MARIA_FILE_BITMAP *bitmap,
DBUG_RETURN(1);
/* Find page number from start of bitmap */
- offset_page= page - bitmap->page - 1;
+ offset_page= (uint) (page - bitmap->page - 1);
/*
Mark place used by reading/writing 2 bytes at a time to handle
bitmaps in overlapping bytes
@@ -1967,9 +1969,9 @@ static my_bool set_page_bits(MARIA_HA *info, MARIA_FILE_BITMAP *bitmap,
*/
uint _ma_bitmap_get_page_bits(MARIA_HA *info, MARIA_FILE_BITMAP *bitmap,
- ulonglong page)
+ pgcache_page_no_t page)
{
- ulonglong bitmap_page;
+ pgcache_page_no_t bitmap_page;
uint offset_page, offset, tmp;
uchar *data;
DBUG_ENTER("_ma_bitmap_get_page_bits");
@@ -1980,7 +1982,7 @@ uint _ma_bitmap_get_page_bits(MARIA_HA *info, MARIA_FILE_BITMAP *bitmap,
DBUG_RETURN(~ (uint) 0);
/* Find page number from start of bitmap */
- offset_page= page - bitmap->page - 1;
+ offset_page= (uint) (page - bitmap->page - 1);
/*
Mark place used by reading/writing 2 bytes at a time to handle
bitmaps in overlapping bytes
@@ -2014,7 +2016,8 @@ uint _ma_bitmap_get_page_bits(MARIA_HA *info, MARIA_FILE_BITMAP *bitmap,
my_bool _ma_bitmap_reset_full_page_bits(MARIA_HA *info,
MARIA_FILE_BITMAP *bitmap,
- ulonglong page, uint page_count)
+ pgcache_page_no_t page,
+ uint page_count)
{
ulonglong bitmap_page;
uint offset, bit_start, bit_count, tmp;
@@ -2031,10 +2034,10 @@ my_bool _ma_bitmap_reset_full_page_bits(MARIA_HA *info,
DBUG_RETURN(1);
/* Find page number from start of bitmap */
- page= page - bitmap->page - 1;
+ offset= (uint) (page - bitmap->page - 1);
/* Clear bits from 'page * 3' -> '(page + page_count) * 3' */
- bit_start= page * 3;
+ bit_start= offset * 3;
bit_count= page_count * 3;
data= bitmap->map + bit_start / 8;
@@ -2092,7 +2095,7 @@ my_bool _ma_bitmap_reset_full_page_bits(MARIA_HA *info,
my_bool _ma_bitmap_set_full_page_bits(MARIA_HA *info,
MARIA_FILE_BITMAP *bitmap,
- ulonglong page, uint page_count)
+ pgcache_page_no_t page, uint page_count)
{
ulonglong bitmap_page;
uint offset, bit_start, bit_count, tmp;
@@ -2107,10 +2110,10 @@ my_bool _ma_bitmap_set_full_page_bits(MARIA_HA *info,
DBUG_RETURN(1);
/* Find page number from start of bitmap */
- page= page - bitmap->page - 1;
+ offset= (uint) (page - bitmap->page - 1);
/* Set bits from 'page * 3' -> '(page + page_count) * 3' */
- bit_start= page * 3;
+ bit_start= offset * 3;
bit_count= page_count * 3;
data= bitmap->map + bit_start / 8;
@@ -2394,7 +2397,7 @@ my_bool _ma_bitmap_free_full_pages(MARIA_HA *info, const uchar *extents,
pthread_mutex_lock(&bitmap->bitmap_lock);
for (; count--; extents+= ROW_EXTENT_SIZE)
{
- ulonglong page= uint5korr(extents);
+ pgcache_page_no_t page= uint5korr(extents);
uint page_count= (uint2korr(extents + ROW_EXTENT_PAGE_SIZE) &
~START_EXTENT_BIT);
if (!(page_count & TAIL_BIT))
@@ -2430,7 +2433,7 @@ my_bool _ma_bitmap_free_full_pages(MARIA_HA *info, const uchar *extents,
1 error
*/
-my_bool _ma_bitmap_set(MARIA_HA *info, ulonglong page, my_bool head,
+my_bool _ma_bitmap_set(MARIA_HA *info, pgcache_page_no_t page, my_bool head,
uint empty_space)
{
MARIA_FILE_BITMAP *bitmap= &info->s->bitmap;
@@ -2469,7 +2472,7 @@ my_bool _ma_bitmap_set(MARIA_HA *info, ulonglong page, my_bool head,
*/
my_bool _ma_check_bitmap_data(MARIA_HA *info,
- enum en_page_type page_type, ulonglong page,
+ enum en_page_type page_type, pgcache_page_no_t page,
uint empty_space, uint *bitmap_pattern)
{
uint bits;
@@ -2517,7 +2520,7 @@ my_bool _ma_check_bitmap_data(MARIA_HA *info,
my_bool _ma_check_if_right_bitmap_type(MARIA_HA *info,
enum en_page_type page_type,
- ulonglong page,
+ pgcache_page_no_t page,
uint *bitmap_pattern)
{
if ((*bitmap_pattern= _ma_bitmap_get_page_bits(info, &info->s->bitmap,
diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c
index a13db94534c..5e54ca00921 100644
--- a/storage/maria/ma_blockrec.c
+++ b/storage/maria/ma_blockrec.c
@@ -290,7 +290,7 @@ typedef struct st_maria_extent_cursor
/* Position to all tails in the row. Updated when reading a row */
MARIA_RECORD_POS *tail_positions;
/* Current page */
- ulonglong page;
+ pgcache_page_no_t page;
/* How many pages in the page region */
uint page_count;
/* What kind of lock to use for tail pages */
@@ -332,7 +332,7 @@ typedef struct st_maria_extent_cursor
static my_bool delete_tails(MARIA_HA *info, MARIA_RECORD_POS *tails);
static my_bool delete_head_or_tail(MARIA_HA *info,
- ulonglong page, uint record_number,
+ pgcache_page_no_t page, uint record_number,
my_bool head, my_bool from_update);
#ifndef DBUG_OFF
static void _ma_print_directory(uchar *buff, uint block_size);
@@ -1870,7 +1870,7 @@ static my_bool write_full_pages(MARIA_HA *info,
MARIA_BITMAP_BLOCK *block,
uchar *data, ulong length)
{
- my_off_t page;
+ pgcache_page_no_t page;
MARIA_SHARE *share= info->s;
uint block_size= share->block_size;
uint data_size= FULL_PAGE_SIZE(block_size);
@@ -1993,7 +1993,7 @@ static uchar *store_page_range(uchar *to, MARIA_BITMAP_BLOCK *block,
ranges= 0;
do
{
- ulonglong page;
+ pgcache_page_no_t page;
page= block->page;
page_count= block->page_count;
block++;
@@ -2097,7 +2097,7 @@ static void store_extent_info(uchar *to,
static my_bool extent_to_bitmap_blocks(MARIA_HA *info,
MARIA_BITMAP_BLOCKS *blocks,
- ulonglong head_page,
+ pgcache_page_no_t head_page,
uint extent_count,
const uchar *extent_info)
{
@@ -2262,7 +2262,8 @@ static my_bool free_full_pages(MARIA_HA *info, MARIA_ROW *row)
1 error
*/
-static my_bool free_full_page_range(MARIA_HA *info, ulonglong page, uint count)
+static my_bool free_full_page_range(MARIA_HA *info, pgcache_page_no_t page,
+ uint count)
{
my_bool res= 0;
MARIA_SHARE *share= info->s;
@@ -3355,7 +3356,7 @@ my_bool _ma_write_abort_block_record(MARIA_HA *info)
if (_ma_write_clr(info, info->cur_row.orig_undo_lsn,
LOGREC_UNDO_ROW_INSERT,
share->calc_checksum != 0,
- -info->cur_row.checksum,
+ (ha_checksum) 0 - info->cur_row.checksum,
&lsn, (void*) 0))
res= 1;
}
@@ -3387,7 +3388,7 @@ static my_bool _ma_update_block_record2(MARIA_HA *info,
uint rownr, org_empty_size, head_length;
uint block_size= info->s->block_size;
uchar *dir;
- ulonglong page;
+ pgcache_page_no_t page;
struct st_row_pos_info row_pos;
my_bool res;
ha_checksum old_checksum;
@@ -3523,7 +3524,7 @@ err:
*/
static my_bool _ma_update_at_original_place(MARIA_HA *info,
- ulonglong page,
+ pgcache_page_no_t page,
uint rownr,
uint length_on_head_page,
uint extent_count,
@@ -3779,7 +3780,7 @@ static int delete_dir_entry(uchar *buff, uint block_size, uint record_number,
*/
static my_bool delete_head_or_tail(MARIA_HA *info,
- ulonglong page, uint record_number,
+ pgcache_page_no_t page, uint record_number,
my_bool head, my_bool from_update)
{
MARIA_SHARE *share= info->s;
@@ -3915,7 +3916,7 @@ static my_bool delete_tails(MARIA_HA *info, MARIA_RECORD_POS *tails)
my_bool _ma_delete_block_record(MARIA_HA *info, const uchar *record)
{
- ulonglong page;
+ pgcache_page_no_t page;
uint record_number;
MARIA_SHARE *share= info->s;
LSN lsn= LSN_IMPOSSIBLE;
@@ -3959,7 +3960,7 @@ my_bool _ma_delete_block_record(MARIA_HA *info, const uchar *record)
info->log_row_parts[TRANSLOG_INTERNAL_PARTS].length=
sizeof(log_data) - HA_CHECKSUM_STORE_SIZE;
store_checksum_in_rec(share, checksum_delta,
- - info->cur_row.checksum, log_pos,
+ (ha_checksum) 0 - info->cur_row.checksum, log_pos,
info->log_row_parts[TRANSLOG_INTERNAL_PARTS +
0].length);
info->log_row_parts[TRANSLOG_INTERNAL_PARTS+1].str=
@@ -4673,7 +4674,7 @@ static my_bool read_row_extent_info(MARIA_HA *info, uchar *buff,
extents < end;
extents+= ROW_EXTENT_SIZE)
{
- ulonglong page= uint5korr(extents);
+ pgcache_page_no_t page= uint5korr(extents);
uint page_count= uint2korr(extents + ROW_EXTENT_PAGE_SIZE);
if (page_count & TAIL_BIT)
*(tail_pos++)= ma_recordpos(page, (page_count & ~ (TAIL_BIT |
@@ -4799,7 +4800,7 @@ my_bool _ma_scan_init_block_record(MARIA_HA *info)
/* Set scan variables to get _ma_scan_block() to start with reading bitmap */
info->scan.number_of_rows= 0;
info->scan.bitmap_pos= info->scan.bitmap_end;
- info->scan.bitmap_page= (ulong) - (long) share->bitmap.pages_covered;
+ info->scan.bitmap_page= (pgcache_page_no_t) 0 - share->bitmap.pages_covered;
/*
We have to flush bitmap as we will read the bitmap from the page cache
while scanning rows
@@ -4980,7 +4981,7 @@ restart_bitmap_scan:
{
while (likely(bits))
{
- uint pattern= bits & 7;
+ uint pattern= (uint) (bits & 7);
bits >>= 3;
bit_pos++;
if (pattern > 0 && pattern <= 4)
@@ -5756,7 +5757,7 @@ uint _ma_apply_redo_insert_row_head_or_tail(MARIA_HA *info, LSN lsn,
size_t data_length)
{
MARIA_SHARE *share= info->s;
- ulonglong page;
+ pgcache_page_no_t page;
uint rownr, empty_space;
uint block_size= share->block_size;
uint rec_offset;
@@ -5954,7 +5955,7 @@ uint _ma_apply_redo_purge_row_head_or_tail(MARIA_HA *info, LSN lsn,
const uchar *header)
{
MARIA_SHARE *share= info->s;
- ulonglong page;
+ pgcache_page_no_t page;
uint rownr, empty_space;
uint block_size= share->block_size;
uchar *buff= info->keyread_buff;
@@ -6062,7 +6063,7 @@ uint _ma_apply_redo_free_blocks(MARIA_HA *info,
{
my_bool res;
uint page_range;
- ulonglong page, start_page;
+ pgcache_page_no_t page, start_page;
start_page= page= page_korr(header);
header+= PAGE_STORE_SIZE;
@@ -6108,7 +6109,7 @@ uint _ma_apply_redo_free_head_or_tail(MARIA_HA *info, LSN lsn,
{
MARIA_SHARE *share= info->s;
uchar *buff;
- ulonglong page;
+ pgcache_page_no_t page;
MARIA_PINNED_PAGE page_link;
my_bool res;
DBUG_ENTER("_ma_apply_redo_free_head_or_tail");
@@ -6211,14 +6212,15 @@ uint _ma_apply_redo_insert_row_blobs(MARIA_HA *info,
header+= SUB_RANGE_SIZE;
empty_space= uint2korr(header);
header+= BLOCK_FILLER_SIZE;
- DBUG_ASSERT(sub_ranges <= blob_count + 1 && empty_space < data_size);
+ DBUG_ASSERT(sub_ranges <= ranges && empty_space < data_size);
+ ranges-= sub_ranges;
while (sub_ranges--)
{
uint i;
uint res;
uint page_range;
- ulonglong page, start_page;
+ pgcache_page_no_t page, start_page;
uchar *buff;
start_page= page= page_korr(header);
@@ -6346,7 +6348,7 @@ err:
my_bool _ma_apply_undo_row_insert(MARIA_HA *info, LSN undo_lsn,
const uchar *header)
{
- ulonglong page;
+ pgcache_page_no_t page;
uint rownr;
uchar *buff;
my_bool res= 1;
@@ -6388,7 +6390,7 @@ my_bool _ma_apply_undo_row_insert(MARIA_HA *info, LSN undo_lsn,
checksum= 0;
if (share->calc_checksum)
- checksum= -ha_checksum_korr(header);
+ checksum= (ha_checksum) 0 - ha_checksum_korr(header);
if (_ma_write_clr(info, undo_lsn, LOGREC_UNDO_ROW_INSERT,
share->calc_checksum != 0, checksum, &lsn, (void*) 0))
goto err;
@@ -6416,7 +6418,7 @@ my_bool _ma_apply_undo_row_delete(MARIA_HA *info, LSN undo_lsn,
struct st_row_pos_info row_pos;
uchar *record;
const uchar *null_bits, *field_length_data, *extent_info;
- ulonglong page;
+ pgcache_page_no_t page;
ulong *blob_lengths;
uint *null_field_lengths, extent_count, rownr, length_on_head_page;
DBUG_ENTER("_ma_apply_undo_row_delete");
@@ -6445,7 +6447,7 @@ my_bool _ma_apply_undo_row_delete(MARIA_HA *info, LSN undo_lsn,
We extract the checksum delta here, saving a recomputation in
allocate_and_write_block_record(). It's only an optimization.
*/
- row.checksum= - ha_checksum_korr(header);
+ row.checksum= (ha_checksum) 0 - ha_checksum_korr(header);
header+= HA_CHECKSUM_STORE_SIZE;
}
extent_info= header;
@@ -6657,7 +6659,7 @@ my_bool _ma_apply_undo_row_update(MARIA_HA *info, LSN undo_lsn,
MARIA_RECORD_POS record_pos;
const uchar *field_length_data, *field_length_data_end, *extent_info;
uchar *current_record, *orig_record;
- ulonglong page;
+ pgcache_page_no_t page;
ha_checksum checksum_delta;
uint rownr, field_length_header, extent_count, length_on_head_page;
int error= 1;
diff --git a/storage/maria/ma_blockrec.h b/storage/maria/ma_blockrec.h
index 77191d14609..a8411adc274 100644
--- a/storage/maria/ma_blockrec.h
+++ b/storage/maria/ma_blockrec.h
@@ -119,15 +119,16 @@ enum en_page_type { UNALLOCATED_PAGE, HEAD_PAGE, TAIL_PAGE, BLOB_PAGE, MAX_PAGE_
/* Functions to convert MARIA_RECORD_POS to/from page:offset */
-static inline MARIA_RECORD_POS ma_recordpos(ulonglong page, uint dir_entry)
+static inline MARIA_RECORD_POS ma_recordpos(pgcache_page_no_t page,
+ uint dir_entry)
{
DBUG_ASSERT(dir_entry <= 255);
- return (MARIA_RECORD_POS) ((page << 8) | dir_entry);
+ return (MARIA_RECORD_POS) (((ulonglong) page << 8) | dir_entry);
}
-static inline my_off_t ma_recordpos_to_page(MARIA_RECORD_POS record_pos)
+static inline pgcache_page_no_t ma_recordpos_to_page(MARIA_RECORD_POS record_pos)
{
- return record_pos >> 8;
+ return (pgcache_page_no_t) (record_pos >> 8);
}
static inline uint ma_recordpos_to_dir_entry(MARIA_RECORD_POS record_pos)
@@ -189,27 +190,29 @@ my_bool _ma_bitmap_find_place(MARIA_HA *info, MARIA_ROW *row,
my_bool _ma_bitmap_release_unused(MARIA_HA *info, MARIA_BITMAP_BLOCKS *blocks);
my_bool _ma_bitmap_free_full_pages(MARIA_HA *info, const uchar *extents,
uint count);
-my_bool _ma_bitmap_set(MARIA_HA *info, ulonglong pos, my_bool head,
+my_bool _ma_bitmap_set(MARIA_HA *info, pgcache_page_no_t pos, my_bool head,
uint empty_space);
my_bool _ma_bitmap_reset_full_page_bits(MARIA_HA *info,
MARIA_FILE_BITMAP *bitmap,
- ulonglong page, uint page_count);
+ pgcache_page_no_t page,
+ uint page_count);
my_bool _ma_bitmap_set_full_page_bits(MARIA_HA *info,
MARIA_FILE_BITMAP *bitmap,
- ulonglong page, uint page_count);
+ pgcache_page_no_t 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,
+ pgcache_page_no_t 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,
+ enum en_page_type page_type,
+ pgcache_page_no_t 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,
+ pgcache_page_no_t page,
uint *bitmap_pattern);
uint _ma_bitmap_get_page_bits(MARIA_HA *info, MARIA_FILE_BITMAP *bitmap,
- ulonglong page);
+ pgcache_page_no_t page);
void _ma_bitmap_delete_all(MARIA_SHARE *share);
int _ma_bitmap_create_first(MARIA_SHARE *share);
void _ma_bitmap_flushable(MARIA_HA *info, int non_flushable_inc);
@@ -217,7 +220,7 @@ void _ma_bitmap_set_pagecache_callbacks(PAGECACHE_FILE *file,
MARIA_SHARE *share);
#ifndef DBUG_OFF
void _ma_print_bitmap(MARIA_FILE_BITMAP *bitmap, uchar *data,
- ulonglong page);
+ pgcache_page_no_t page);
#endif
uint _ma_apply_redo_insert_row_head_or_tail(MARIA_HA *info, LSN lsn,
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index da6b6d0aa57..1acea96d05a 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -151,7 +151,8 @@ int maria_chk_status(HA_CHECK *param, register MARIA_HA *info)
Check delete links in row data
*/
-int maria_chk_del(HA_CHECK *param, register MARIA_HA *info, uint test_flag)
+int maria_chk_del(HA_CHECK *param, register MARIA_HA *info,
+ ulonglong test_flag)
{
MARIA_SHARE *share= info->s;
reg2 ha_rows i;
@@ -313,7 +314,8 @@ static int check_k_link(HA_CHECK *param, register MARIA_HA *info,
DBUG_ASSERT(share->pagecache->block_size == block_size);
if (!(buff= pagecache_read(share->pagecache,
- &share->kfile, next_link/block_size,
+ &share->kfile,
+ (pgcache_page_no_t) (next_link / block_size),
DFLT_INIT_HITS,
(uchar*) info->buff,
PAGECACHE_READ_UNKNOWN_PAGE,
@@ -1632,7 +1634,8 @@ static my_bool check_head_page(HA_CHECK *param, MARIA_HA *info, uchar *record,
/* Check that bitmap has the right marker for the found extents */
for (i= 0 ; i < info->cur_row.extents_count ; i++)
{
- uint extent_page, page_count, page_type;
+ pgcache_page_no_t extent_page;
+ uint page_count, page_type;
extent_page= uint5korr(extents);
page_count= uint2korr(extents+5) & ~START_EXTENT_BIT;
extents+= ROW_EXTENT_SIZE;
@@ -1683,7 +1686,7 @@ static int check_block_record(HA_CHECK *param, MARIA_HA *info, int extend,
{
MARIA_SHARE *share= info->s;
my_off_t pos;
- ulonglong page;
+ pgcache_page_no_t page;
uchar *page_buff, *bitmap_buff, *data;
char llbuff[22], llbuff2[22];
uint block_size= share->block_size;
@@ -1739,7 +1742,7 @@ static int check_block_record(HA_CHECK *param, MARIA_HA *info, int extend,
continue;
}
/* Skip pages marked as empty in bitmap */
- offset_page= ((page % share->bitmap.pages_covered) -1) * 3;
+ offset_page= (uint) ((page % share->bitmap.pages_covered) -1) * 3;
offset= offset_page & 7;
data= bitmap_buff + offset_page / 8;
bitmap_pattern= uint2korr(data);
@@ -1844,7 +1847,7 @@ static int check_block_record(HA_CHECK *param, MARIA_HA *info, int extend,
{
/* Not at end of bitmap */
uint bitmap_pattern;
- offset_page= ((page % share->bitmap.pages_covered) -1) * 3;
+ offset_page= (uint) ((page % share->bitmap.pages_covered) -1) * 3;
offset= offset_page & 7;
data= bitmap_buff + offset_page / 8;
bitmap_pattern= uint2korr(data);
@@ -1887,7 +1890,7 @@ err:
/* Check that record-link is ok */
-int maria_chk_data_link(HA_CHECK *param, MARIA_HA *info,int extend)
+int maria_chk_data_link(HA_CHECK *param, MARIA_HA *info, my_bool extend)
{
MARIA_SHARE *share= info->s;
int error;
@@ -2077,7 +2080,7 @@ static int initialize_variables_for_repair(HA_CHECK *param,
MARIA_SORT_INFO *sort_info,
MARIA_SORT_PARAM *sort_param,
MARIA_HA *info,
- uint rep_quick)
+ my_bool rep_quick)
{
MARIA_SHARE *share= info->s;
@@ -2095,7 +2098,7 @@ static int initialize_variables_for_repair(HA_CHECK *param,
param->org_key_map= share->state.key_map;
sort_param->sort_info= sort_info;
- sort_param->fix_datafile= (my_bool) (! rep_quick);
+ sort_param->fix_datafile= ! rep_quick;
sort_param->calc_checksum= test(param->testflag & T_CALC_CHECKSUM);
sort_info->info= sort_info->new_info= info;
sort_info->param= param;
@@ -2158,7 +2161,7 @@ static int initialize_variables_for_repair(HA_CHECK *param,
*/
int maria_repair(HA_CHECK *param, register MARIA_HA *info,
- char *name, uint rep_quick)
+ char *name, my_bool rep_quick)
{
int error, got_error;
uint i;
@@ -2343,7 +2346,7 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info,
sort_param.current_filepos= sort_param.filepos;
}
}
- if (error > 0 || maria_write_data_suffix(&sort_info, (my_bool)!rep_quick) ||
+ if (error > 0 || maria_write_data_suffix(&sort_info, !rep_quick) ||
flush_io_cache(&sort_info.new_info->rec_cache) ||
param->read_cache.error < 0)
goto err;
@@ -2780,7 +2783,8 @@ err2:
static void put_crc(char *buff, my_off_t pos, MARIA_SHARE *share)
{
- maria_page_crc_set_index(buff, pos / share->block_size, (uchar*) share);
+ maria_page_crc_set_index(buff, (pgcache_page_no_t) (pos / share->block_size),
+ (uchar*) share);
}
@@ -2891,7 +2895,7 @@ static my_bool maria_zerofill_index(HA_CHECK *param, MARIA_HA *info,
MARIA_PINNED_PAGE page_link;
char llbuff[21];
uchar *buff;
- ulonglong page;
+ pgcache_page_no_t page;
my_off_t pos;
my_off_t key_file_length= share->state.state.key_file_length;
uint block_size= share->block_size;
@@ -2961,7 +2965,7 @@ static my_bool maria_zerofill_data(HA_CHECK *param, MARIA_HA *info,
MARIA_PINNED_PAGE page_link;
char llbuff[21];
my_off_t pos;
- ulonglong page;
+ pgcache_page_no_t page;
uint block_size= share->block_size;
MARIA_FILE_BITMAP *bitmap= &share->bitmap;
DBUG_ENTER("maria_zerofill_data");
@@ -3169,7 +3173,7 @@ err:
*/
int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info,
- const char * name, uint rep_quick)
+ const char * name, my_bool rep_quick)
{
int got_error;
uint i;
@@ -3515,7 +3519,7 @@ int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info,
goto err;
}
- if (rep_quick & T_FORCE_UNIQUENESS)
+ if (rep_quick && (param->testflag & T_FORCE_UNIQUENESS))
{
my_off_t skr= (info->state->data_file_length +
(sort_info.org_data_file_type == COMPRESSED_RECORD) ?
@@ -3657,7 +3661,7 @@ err:
*/
int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info,
- const char * name, uint rep_quick)
+ const char * name, my_bool rep_quick)
{
#ifndef THREAD
return maria_repair_by_sort(param, info, name, rep_quick);
@@ -3725,7 +3729,7 @@ int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info,
position 'new_header_length'.
}
*/
- DBUG_PRINT("info", ("is quick repair: %d", rep_quick));
+ DBUG_PRINT("info", ("is quick repair: %d", (int) rep_quick));
/* Initialize pthread structures before goto err. */
pthread_mutex_init(&sort_info.mutex, MY_MUTEX_INIT_FAST);
@@ -3901,7 +3905,7 @@ int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info,
}
sort_info.total_keys=i;
sort_param[0].master= 1;
- sort_param[0].fix_datafile= (my_bool)(! rep_quick);
+ sort_param[0].fix_datafile= ! rep_quick;
sort_param[0].calc_checksum= test(param->testflag & T_CALC_CHECKSUM);
sort_info.got_error=0;
@@ -4024,7 +4028,7 @@ int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info,
goto err;
}
- if (rep_quick & T_FORCE_UNIQUENESS)
+ if (rep_quick && (param->testflag & T_FORCE_UNIQUENESS))
{
my_off_t skr= (info->state->data_file_length +
(sort_info.org_data_file_type == COMPRESSED_RECORD) ?
@@ -6040,8 +6044,8 @@ static int _ma_safe_scan_block_record(MARIA_SORT_INFO *sort_info,
MARIA_HA *info, uchar *record)
{
MARIA_SHARE *share= info->s;
- uint record_pos= info->cur_row.nextpos;
- ulonglong page= sort_info->page;
+ MARIA_RECORD_POS record_pos= info->cur_row.nextpos;
+ pgcache_page_no_t page= sort_info->page;
DBUG_ENTER("_ma_safe_scan_block_record");
for (;;)
@@ -6078,7 +6082,7 @@ static int _ma_safe_scan_block_record(MARIA_SORT_INFO *sort_info,
{
_ma_check_print_info(sort_info->param,
"Wrong directory entry %3u at page %s",
- record_pos, llstr(page, llbuff));
+ (uint) record_pos, llstr(page, llbuff));
record_pos++;
continue;
}
@@ -6100,7 +6104,7 @@ read_next_page:
page++;
if (!(page % share->bitmap.pages_covered))
page++; /* Skip bitmap */
- if ((page + 1) * share->block_size > sort_info->filelength)
+ if ((my_off_t) (page + 1) * share->block_size > sort_info->filelength)
DBUG_RETURN(HA_ERR_END_OF_FILE);
if (!(pagecache_read(share->pagecache,
&info->dfile,
diff --git a/storage/maria/ma_create.c b/storage/maria/ma_create.c
index 7d3376cc4ec..89107e1736b 100644
--- a/storage/maria/ma_create.c
+++ b/storage/maria/ma_create.c
@@ -632,7 +632,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
my_errno=HA_WRONG_CREATE_OPTION;
goto err_no_lock;
}
- keydef->block_length= maria_block_size;
+ keydef->block_length= (uint16) maria_block_size;
keydef->keylength= (uint16) key_length;
keydef->minlength= (uint16) min_key_length;
keydef->maxlength= (uint16) length;
@@ -1007,12 +1007,12 @@ int maria_create(const char *name, enum data_file_type datafile_type,
uint k;
LSN lsn;
log_array[TRANSLOG_INTERNAL_PARTS + 1].length= 1 + 2 + 2 +
- kfile_size_before_extension;
+ (uint) kfile_size_before_extension;
/* we are needing maybe 64 kB, so don't use the stack */
log_data= my_malloc(log_array[TRANSLOG_INTERNAL_PARTS + 1].length, MYF(0));
if ((log_data == NULL) ||
- my_pread(file, 1 + 2 + 2 + log_data, kfile_size_before_extension,
- 0, MYF(MY_NABP)))
+ my_pread(file, 1 + 2 + 2 + log_data,
+ (size_t) kfile_size_before_extension, 0, MYF(MY_NABP)))
goto err;
/*
remember if the data file was created or not, to know if Recovery can
diff --git a/storage/maria/ma_dynrec.c b/storage/maria/ma_dynrec.c
index 3b4c8215eac..b1c46d9b9bb 100644
--- a/storage/maria/ma_dynrec.c
+++ b/storage/maria/ma_dynrec.c
@@ -1490,7 +1490,7 @@ my_bool _ma_cmp_dynamic_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
const uchar *record, MARIA_RECORD_POS pos)
{
uchar *old_rec_buff,*old_record;
- my_off_t old_rec_buff_size;
+ size_t old_rec_buff_size;
my_bool error;
DBUG_ENTER("_ma_cmp_dynamic_unique");
diff --git a/storage/maria/ma_key.c b/storage/maria/ma_key.c
index b13c24cce83..73152d4d475 100644
--- a/storage/maria/ma_key.c
+++ b/storage/maria/ma_key.c
@@ -139,11 +139,12 @@ uint _ma_make_key(register MARIA_HA *info, uint keynr, uchar *key,
else if (keyseg->flag & HA_BLOB_PART)
{
uint tmp_length= _ma_calc_blob_length(keyseg->bit_start,pos);
- memcpy_fixed(&pos,pos+keyseg->bit_start,sizeof(char*));
+ uchar *blob_pos;
+ memcpy_fixed(&blob_pos, pos+keyseg->bit_start,sizeof(char*));
set_if_smaller(length,tmp_length);
- FIX_LENGTH(cs, pos, length, char_length);
+ FIX_LENGTH(cs, blob_pos, length, char_length);
store_key_length_inc(key,char_length);
- memcpy(key,pos,(size_t) char_length);
+ memcpy(key, blob_pos, (size_t) char_length);
key+= char_length;
continue;
}
diff --git a/storage/maria/ma_key_recover.c b/storage/maria/ma_key_recover.c
index fc543538e2a..eec65007b8d 100644
--- a/storage/maria/ma_key_recover.c
+++ b/storage/maria/ma_key_recover.c
@@ -112,7 +112,7 @@ my_bool _ma_write_clr(MARIA_HA *info, LSN undo_lsn,
{
/* Key root changed. Store new key root */
struct st_msg_to_write_hook_for_undo_key *undo_msg= extra_msg;
- ulonglong page;
+ pgcache_page_no_t page;
key_nr_store(log_pos, undo_msg->keynr);
page= (undo_msg->value == HA_OFFSET_ERROR ? IMPOSSIBLE_PAGE_NO :
undo_msg->value / info->s->block_size);
@@ -526,8 +526,8 @@ my_bool _ma_log_add(MARIA_HA *info, my_off_t page, uchar *buff,
uint _ma_apply_redo_index_new_page(MARIA_HA *info, LSN lsn,
const uchar *header, uint length)
{
- ulonglong root_page= page_korr(header);
- ulonglong free_page= page_korr(header + PAGE_STORE_SIZE);
+ pgcache_page_no_t root_page= page_korr(header);
+ pgcache_page_no_t free_page= page_korr(header + PAGE_STORE_SIZE);
uint key_nr= key_nr_korr(header + PAGE_STORE_SIZE * 2);
my_bool page_type_flag= header[PAGE_STORE_SIZE * 2 + KEY_NR_STORE_SIZE];
enum pagecache_page_lock unlock_method;
@@ -647,8 +647,8 @@ uint _ma_apply_redo_index_free_page(MARIA_HA *info,
LSN lsn,
const uchar *header)
{
- ulonglong page= page_korr(header);
- ulonglong free_page= page_korr(header + PAGE_STORE_SIZE);
+ pgcache_page_no_t page= page_korr(header);
+ pgcache_page_no_t free_page= page_korr(header + PAGE_STORE_SIZE);
my_off_t old_link;
MARIA_PINNED_PAGE page_link;
MARIA_SHARE *share= info->s;
@@ -745,7 +745,7 @@ uint _ma_apply_redo_index(MARIA_HA *info,
LSN lsn, const uchar *header, uint head_length)
{
MARIA_SHARE *share= info->s;
- ulonglong page= page_korr(header);
+ pgcache_page_no_t page= page_korr(header);
MARIA_PINNED_PAGE page_link;
uchar *buff;
const uchar *header_end= header + head_length;
diff --git a/storage/maria/ma_loghandler_lsn.h b/storage/maria/ma_loghandler_lsn.h
index 7d4b5338836..c5ffb3cdc96 100644
--- a/storage/maria/ma_loghandler_lsn.h
+++ b/storage/maria/ma_loghandler_lsn.h
@@ -41,7 +41,7 @@ typedef int64 TRANSLOG_ADDRESS;
typedef TRANSLOG_ADDRESS LSN;
/* Gets file number part of a LSN/log address */
-#define LSN_FILE_NO(L) ((L) >> 32)
+#define LSN_FILE_NO(L) (uint32) ((L) >> 32)
/* Gets raw file number part of a LSN/log address */
#define LSN_FILE_NO_PART(L) ((L) & ((int64)0xFFFFFF00000000LL))
@@ -50,7 +50,7 @@ typedef TRANSLOG_ADDRESS LSN;
#define LSN_IN_PARTS(L) (ulong)LSN_FILE_NO(L),(ulong)LSN_OFFSET(L)
/* Gets record offset of a LSN/log address */
-#define LSN_OFFSET(L) ((L) & 0xFFFFFFFFL)
+#define LSN_OFFSET(L) (ulong) ((L) & 0xFFFFFFFFL)
/* Makes lsn/log address from file number and record offset */
#define MAKE_LSN(F,S) ((LSN) ((((uint64)(F)) << 32) | (S)))
diff --git a/storage/maria/ma_page.c b/storage/maria/ma_page.c
index 86d4bd7dd35..46a53c61df5 100644
--- a/storage/maria/ma_page.c
+++ b/storage/maria/ma_page.c
@@ -23,21 +23,20 @@
uchar *_ma_fetch_keypage(register MARIA_HA *info,
MARIA_KEYDEF *keyinfo __attribute__ ((unused)),
- my_off_t page, enum pagecache_page_lock lock,
+ my_off_t pos, enum pagecache_page_lock lock,
int level, uchar *buff,
int return_buffer __attribute__ ((unused)),
MARIA_PINNED_PAGE **page_link_res)
{
uchar *tmp;
- uint page_size __attribute__((unused));
MARIA_PINNED_PAGE page_link;
MARIA_SHARE *share= info->s;
uint block_size= share->block_size;
DBUG_ENTER("_ma_fetch_keypage");
- DBUG_PRINT("enter",("page: %ld", (long) page));
+ DBUG_PRINT("enter",("pos: %ld", (long) pos));
tmp= pagecache_read(share->pagecache, &share->kfile,
- page / block_size, level, buff,
+ (pgcache_page_no_t) (pos / block_size), level, buff,
share->page_type, lock, &page_link.link);
if (lock != PAGECACHE_LOCK_LEFT_UNLOCKED)
@@ -61,20 +60,22 @@ uchar *_ma_fetch_keypage(register MARIA_HA *info,
my_errno=HA_ERR_CRASHED;
DBUG_RETURN(0);
}
- info->last_keypage=page;
+ info->last_keypage= pos;
#ifdef EXTRA_DEBUG
- page_size= _ma_get_page_used(share, tmp);
- if (page_size < 4 || page_size > block_size ||
- _ma_get_keynr(share, tmp) != keyinfo->key_nr)
{
- DBUG_PRINT("error",("page %lu had wrong page length: %u keynr: %u",
- (ulong) page, page_size,
- _ma_get_keynr(share, tmp)));
- DBUG_DUMP("page", (char*) tmp, page_size);
- info->last_keypage = HA_OFFSET_ERROR;
- maria_print_error(share, HA_ERR_CRASHED);
- my_errno= HA_ERR_CRASHED;
- tmp= 0;
+ uint page_size= _ma_get_page_used(share, tmp);
+ if (page_size < 4 || page_size > block_size ||
+ _ma_get_keynr(share, tmp) != keyinfo->key_nr)
+ {
+ DBUG_PRINT("error",("page %lu had wrong page length: %u keynr: %u",
+ (ulong) (pos / block_size), page_size,
+ _ma_get_keynr(share, tmp)));
+ DBUG_DUMP("page", (char*) tmp, page_size);
+ info->last_keypage = HA_OFFSET_ERROR;
+ maria_print_error(share, HA_ERR_CRASHED);
+ my_errno= HA_ERR_CRASHED;
+ tmp= 0;
+ }
}
#endif
DBUG_RETURN(tmp);
@@ -85,7 +86,7 @@ uchar *_ma_fetch_keypage(register MARIA_HA *info,
int _ma_write_keypage(register MARIA_HA *info,
register MARIA_KEYDEF *keyinfo __attribute__((unused)),
- my_off_t page, enum pagecache_page_lock lock,
+ my_off_t pos, enum pagecache_page_lock lock,
int level, uchar *buff)
{
MARIA_SHARE *share= info->s;
@@ -98,20 +99,20 @@ int _ma_write_keypage(register MARIA_HA *info,
{
uint page_length, nod;
_ma_get_used_and_nod(share, buff, page_length, nod);
- if (page < share->base.keystart ||
- page+block_size > info->state->key_file_length ||
- (page & (MARIA_MIN_KEY_BLOCK_LENGTH-1)))
+ if (pos < share->base.keystart ||
+ pos+block_size > info->state->key_file_length ||
+ (pos & (MARIA_MIN_KEY_BLOCK_LENGTH-1)))
{
DBUG_PRINT("error",("Trying to write inside key status region: "
"key_start: %lu length: %lu page: %lu",
(long) share->base.keystart,
(long) info->state->key_file_length,
- (long) page));
+ (long) pos));
my_errno=EINVAL;
DBUG_ASSERT(0);
DBUG_RETURN((-1));
}
- DBUG_PRINT("page",("write page at: %lu",(long) page));
+ DBUG_PRINT("page",("write page at: %lu",(long) pos));
DBUG_DUMP("buff", buff, page_length);
DBUG_ASSERT(page_length >= share->keypage_header + nod +
keyinfo->minlength || maria_in_recovery);
@@ -140,7 +141,7 @@ int _ma_write_keypage(register MARIA_HA *info,
DBUG_ASSERT(share->pagecache->block_size == block_size);
res= pagecache_write(share->pagecache,
- &share->kfile, page / block_size,
+ &share->kfile, (pgcache_page_no_t) (pos / block_size),
level, buff, share->page_type,
lock,
lock == PAGECACHE_LOCK_LEFT_WRITELOCKED ?
@@ -313,7 +314,8 @@ my_off_t _ma_new(register MARIA_HA *info, int level,
pos= share->current_key_del; /* Protected */
DBUG_ASSERT(share->pagecache->block_size == block_size);
if (!(buff= pagecache_read(share->pagecache,
- &share->kfile, pos / block_size, level,
+ &share->kfile,
+ (pgcache_page_no_t) (pos / block_size), level,
0, share->page_type,
PAGECACHE_LOCK_WRITE, &(*page_link)->link)))
pos= HA_OFFSET_ERROR;
diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c
index 4b0dada3a6b..c5d5bdf2ed2 100755
--- a/storage/maria/ma_pagecache.c
+++ b/storage/maria/ma_pagecache.c
@@ -2212,10 +2212,10 @@ static my_bool get_wrlock(PAGECACHE *pagecache,
pgcache_page_no_t pageno= block->hash_link->pageno;
DBUG_ENTER("get_wrlock");
DBUG_PRINT("info", ("the block 0x%lx "
- "files %d(%d) pages %d(%d)",
- (ulong)block,
- file.file, block->hash_link->file.file,
- pageno, block->hash_link->pageno));
+ "files %d(%d) pages %lu(%lu)",
+ (ulong) block,
+ file.file, block->hash_link->file.file,
+ (ulong) pageno, (ulong) block->hash_link->pageno));
PCBLOCK_INFO(block);
while (block->wlocks && block->write_locker != user_file)
{
@@ -2242,10 +2242,10 @@ static my_bool get_wrlock(PAGECACHE *pagecache,
pageno != block->hash_link->pageno)
{
DBUG_PRINT("info", ("the block 0x%lx changed => need retry "
- "status: %x files %d != %d or pages %d != %d",
+ "status: %x files %d != %d or pages %lu != %lu",
(ulong)block, block->status,
file.file, block->hash_link->file.file,
- pageno, block->hash_link->pageno));
+ (ulong) pageno, (ulong) block->hash_link->pageno));
DBUG_RETURN(1);
}
}
@@ -4267,13 +4267,14 @@ my_bool pagecache_collect_changed_blocks_with_lsn(PAGECACHE *pagecache,
MARIA_SHARE *share;
if (block->type != PAGECACHE_LSN_PAGE)
continue; /* no need to store it in the checkpoint record */
- compile_time_assert(sizeof(block->hash_link->pageno) <= 4);
share= (MARIA_SHARE *)(block->hash_link->file.callback_data);
table_id= share->id;
int2store(ptr, table_id);
ptr+= 2;
ptr[0]= (share->kfile.file == block->hash_link->file.file);
ptr++;
+ /* TODO: We should fix the code here to handle 5 byte page numbers */
+ DBUG_ASSERT(block->hash_link->pageno <= UINT_MAX32);
int4store(ptr, block->hash_link->pageno);
ptr+= 4;
lsn_store(ptr, block->rec_lsn);
diff --git a/storage/maria/ma_pagecache.h b/storage/maria/ma_pagecache.h
index 412e867f116..930322e132a 100644
--- a/storage/maria/ma_pagecache.h
+++ b/storage/maria/ma_pagecache.h
@@ -75,7 +75,7 @@ enum pagecache_write_mode
};
/* page number for maria */
-typedef uint32 pgcache_page_no_t;
+typedef ulonglong pgcache_page_no_t;
/* file descriptor for Maria */
typedef struct st_pagecache_file
@@ -186,7 +186,8 @@ enum pagecache_flush_filter_result
};
/** @brief a filter function type for flush_pagecache_blocks_with_filter() */
typedef enum pagecache_flush_filter_result
-(*PAGECACHE_FLUSH_FILTER)(enum pagecache_page_type type, pgcache_page_no_t page,
+(*PAGECACHE_FLUSH_FILTER)(enum pagecache_page_type type,
+ pgcache_page_no_t page,
LSN rec_lsn, void *arg);
/* The default key cache */
diff --git a/storage/maria/ma_pagecrc.c b/storage/maria/ma_pagecrc.c
index 10cb82e46f7..0e413418ef8 100644
--- a/storage/maria/ma_pagecrc.c
+++ b/storage/maria/ma_pagecrc.c
@@ -78,6 +78,24 @@ static my_bool maria_page_crc_check(uchar *page,
res= test(new_crc != crc);
if (res)
{
+ /*
+ Bitmap pages may be totally zero filled in some cases.
+ This happens when we get a crash after the pagecache has written
+ out a page that is on a newly created bitmap page and we get
+ a crash before the bitmap page is written out.
+
+ We handle this case with the following logic:
+ When reading, approve of bitmap pages where all bytes are zero
+ (This is after all a bitmap pages where no data is reserved and
+ the CRC will be corrected at next write)
+ */
+ if (no_crc_val == MARIA_NO_CRC_BITMAP_PAGE &&
+ crc == 0 && _ma_check_if_zero(page, data_length))
+ {
+ DBUG_PRINT("warning", ("Found bitmap page that was not initialized"));
+ DBUG_RETURN(0);
+ }
+
DBUG_PRINT("error", ("Page: %lu crc: %lu calculated crc: %lu",
(ulong) page_no, (ulong) crc, (ulong) new_crc));
my_errno= HA_ERR_WRONG_CRC;
@@ -104,7 +122,7 @@ my_bool maria_page_crc_set_normal(uchar *page,
MARIA_SHARE *share= (MARIA_SHARE *)data_ptr;
int data_length= share->block_size - CRC_SIZE;
uint32 crc= maria_page_crc(page_no & UINT_MAX32, page, data_length);
- DBUG_ENTER("maria_page_crc_set");
+ DBUG_ENTER("maria_page_crc_set_normal");
DBUG_PRINT("info", ("Page %lu crc: %lu", (ulong) page_no, (ulong)crc));
/* crc is on the stack so it is aligned, pagecache buffer is aligned, too */
diff --git a/storage/maria/ma_preload.c b/storage/maria/ma_preload.c
index c2a6d405932..6f519b09eac 100644
--- a/storage/maria/ma_preload.c
+++ b/storage/maria/ma_preload.c
@@ -80,7 +80,8 @@ int maria_preload(MARIA_HA *info, ulonglong key_map, my_bool ignore_leaves)
{
DBUG_ASSERT(share->pagecache->block_size == block_length);
if (pagecache_write(share->pagecache,
- &share->kfile, pos / block_length,
+ &share->kfile,
+ (pgcache_page_no_t) (pos / block_length),
DFLT_INIT_HITS,
(uchar*) buff,
PAGECACHE_PLAIN_PAGE,
diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c
index 4c8910ce632..922895fa1cc 100644
--- a/storage/maria/ma_recovery.c
+++ b/storage/maria/ma_recovery.c
@@ -376,7 +376,7 @@ int maria_apply_log(LSN from_lsn, enum maria_apply_log_way apply,
now= my_getsystime();
if (recovery_message_printed == REC_MSG_REDO)
{
- float phase_took= (now - old_now)/10000000.0;
+ double phase_took= (now - old_now)/10000000.0;
/*
Detailed progress info goes to stderr, because ma_message_no_user()
cannot put several messages on one line.
@@ -428,7 +428,7 @@ int maria_apply_log(LSN from_lsn, enum maria_apply_log_way apply,
now= my_getsystime();
if (recovery_message_printed == REC_MSG_UNDO)
{
- float phase_took= (now - old_now)/10000000.0;
+ double phase_took= (now - old_now)/10000000.0;
procent_printed= 1;
fprintf(stderr, " (%.1f seconds); ", phase_took);
}
@@ -447,7 +447,7 @@ int maria_apply_log(LSN from_lsn, enum maria_apply_log_way apply,
now= my_getsystime();
if (recovery_message_printed == REC_MSG_FLUSH)
{
- float phase_took= (now - old_now)/10000000.0;
+ double phase_took= (now - old_now)/10000000.0;
procent_printed= 1;
fprintf(stderr, " (%.1f seconds); ", phase_took);
}
@@ -1008,7 +1008,7 @@ prototype_redo_exec_hook(REDO_REPAIR_TABLE)
MARIA_HA *info;
HA_CHECK param;
char *name;
- uint quick_repair;
+ my_bool quick_repair;
DBUG_ENTER("exec_REDO_LOGREC_REDO_REPAIR_TABLE");
if (skip_DDLs)
@@ -1036,8 +1036,7 @@ prototype_redo_exec_hook(REDO_REPAIR_TABLE)
DBUG_ASSERT(maria_tmpdir);
info->s->state.key_map= uint8korr(rec->header + FILEID_STORE_SIZE + 8);
- quick_repair= param.testflag & T_QUICK;
-
+ quick_repair= test(param.testflag & T_QUICK);
if (param.testflag & T_REP_PARALLEL)
{
@@ -2748,7 +2747,8 @@ static MARIA_HA *get_MARIA_HA_from_UNDO_record(const
static LSN parse_checkpoint_record(LSN lsn)
{
- ulong i, nb_dirty_pages;
+ ulong i;
+ ulonglong nb_dirty_pages;
TRANSLOG_HEADER_BUFFER rec;
TRANSLOG_ADDRESS start_address;
int len;
@@ -3078,11 +3078,14 @@ void _ma_reenable_logging_for_table(MARIA_HA *info)
static void print_redo_phase_progress(TRANSLOG_ADDRESS addr)
{
- static int end_logno= FILENO_IMPOSSIBLE, end_offset, percentage_printed= 0;
+ static uint end_logno= FILENO_IMPOSSIBLE, percentage_printed= 0;
+ static ulong end_offset;
static ulonglong initial_remainder= -1;
- int cur_logno, cur_offset;
+
+ uint cur_logno;
+ ulong cur_offset;
ulonglong local_remainder;
- int percentage_done;
+ uint percentage_done;
if (tracef == stdout)
return;
@@ -3107,12 +3110,12 @@ static void print_redo_phase_progress(TRANSLOG_ADDRESS addr)
end_offset);
if (initial_remainder == (ulonglong)(-1))
initial_remainder= local_remainder;
- percentage_done= ((initial_remainder - local_remainder) * ULL(100) /
- initial_remainder);
+ percentage_done= (uint) ((initial_remainder - local_remainder) * ULL(100) /
+ initial_remainder);
if ((percentage_done - percentage_printed) >= 10)
{
percentage_printed= percentage_done;
- fprintf(stderr, " %d%%", percentage_done);
+ fprintf(stderr, " %u%%", percentage_done);
procent_printed= 1;
}
}
diff --git a/storage/maria/ma_test2.c b/storage/maria/ma_test2.c
index 6b6a1e8079d..bdda66747e3 100644
--- a/storage/maria/ma_test2.c
+++ b/storage/maria/ma_test2.c
@@ -18,12 +18,6 @@
#ifndef USE_MY_FUNC /* We want to be able to dbug this !! */
#define USE_MY_FUNC
#endif
-#ifdef DBUG_OFF
-#undef DBUG_OFF
-#endif
-#ifndef SAFEMALLOC
-#define SAFEMALLOC
-#endif
#include "maria_def.h"
#include "trnman.h"
#include <m_ctype.h>
diff --git a/storage/maria/maria_chk.c b/storage/maria/maria_chk.c
index 90c4238ad91..f1a6cf05c2d 100644
--- a/storage/maria/maria_chk.c
+++ b/storage/maria/maria_chk.c
@@ -850,7 +850,7 @@ static void get_options(register int *argc,register char ***argv)
static int maria_chk(HA_CHECK *param, char *filename)
{
int error,lock_type,recreate;
- int rep_quick= param->testflag & (T_QUICK | T_FORCE_UNIQUENESS);
+ my_bool rep_quick= test(param->testflag & (T_QUICK | T_FORCE_UNIQUENESS));
MARIA_HA *info;
File datafile;
char llbuff[22],llbuff2[22];
@@ -1013,7 +1013,7 @@ static int maria_chk(HA_CHECK *param, char *filename)
param->testflag|=T_REP_BY_SORT; /* if only STATISTICS */
if (!(param->testflag & T_SILENT))
printf("- '%s' has old table-format. Recreating index\n",filename);
- rep_quick|=T_QUICK;
+ rep_quick= 1;
}
share= info->s;
share->tot_locks-= share->r_locks;
@@ -1215,7 +1215,8 @@ static int maria_chk(HA_CHECK *param, char *filename)
maria_lock_memory(param);
if ((info->s->data_file_type != STATIC_RECORD) ||
(param->testflag & (T_EXTEND | T_MEDIUM)))
- error|=maria_chk_data_link(param, info, param->testflag & T_EXTEND);
+ error|=maria_chk_data_link(param, info,
+ test(param->testflag & T_EXTEND));
error|= _ma_flush_table_files_after_repair(param, info);
VOID(end_io_cache(&param->read_cache));
}
diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h
index 05a1dbe2d56..f7acb49d60e 100644
--- a/storage/maria/maria_def.h
+++ b/storage/maria/maria_def.h
@@ -83,7 +83,7 @@ typedef struct st_maria_state_info
MARIA_STATUS_INFO state;
ha_rows split; /* number of split blocks */
my_off_t dellink; /* Link to next removed block */
- ulonglong first_bitmap_with_space;
+ pgcache_page_no_t first_bitmap_with_space;
ulonglong auto_increment;
ulong process; /* process that updated table last */
ulong unique; /* Unique number for this process */
@@ -220,7 +220,7 @@ typedef struct st_maria_pack
typedef struct st_maria_file_bitmap
{
uchar *map;
- ulonglong page; /* Page number for current bitmap */
+ pgcache_page_no_t page; /* Page number for current bitmap */
uint used_size; /* Size of bitmap head that is not 0 */
my_bool changed; /* 1 if page needs to be flushed */
my_bool flush_all_requested; /**< If _ma_bitmap_flush_all waiting */
@@ -373,7 +373,7 @@ typedef uchar MARIA_BITMAP_BUFFER;
typedef struct st_maria_bitmap_block
{
- ulonglong page; /* Page number */
+ pgcache_page_no_t page; /* Page number */
/* Number of continuous pages. TAIL_BIT is set if this is a tail page */
uint page_count;
uint empty_space; /* Set for head and tail pages */
@@ -422,7 +422,7 @@ typedef struct st_maria_block_scan
{
uchar *bitmap_buff, *bitmap_pos, *bitmap_end, *page_buff;
uchar *dir, *dir_end;
- ulong bitmap_page;
+ pgcache_page_no_t bitmap_page;
ulonglong bits;
uint number_of_rows, bit_pos;
MARIA_RECORD_POS row_base_page;
diff --git a/storage/maria/maria_pack.c b/storage/maria/maria_pack.c
index dc0afdd4b64..5232ddf9b63 100644
--- a/storage/maria/maria_pack.c
+++ b/storage/maria/maria_pack.c
@@ -122,8 +122,8 @@ typedef struct st_isam_mrg {
extern int main(int argc,char * *argv);
static void get_options(int *argc,char ***argv);
-static MARIA_HA *open_isam_file(char *name,int mode);
-static bool open_isam_files(PACK_MRG_INFO *mrg,char **names,uint count);
+static MARIA_HA *open_maria_file(char *name,int mode);
+static bool open_maria_files(PACK_MRG_INFO *mrg,char **names,uint count);
static int compress(PACK_MRG_INFO *file,char *join_name);
static HUFF_COUNTS *init_huff_count(MARIA_HA *info,my_off_t records);
static void free_counts_and_tree_and_queue(HUFF_TREE *huff_trees,
@@ -158,7 +158,7 @@ static uint *make_offset_code_tree(HUFF_TREE *huff_tree,
HUFF_ELEMENT *element,
uint *offset);
static uint max_bit(uint value);
-static int compress_isam_file(PACK_MRG_INFO *file,HUFF_COUNTS *huff_counts);
+static int compress_maria_file(PACK_MRG_INFO *file,HUFF_COUNTS *huff_counts);
static char *make_new_name(char *new_name,char *old_name);
static char *make_old_name(char *new_name,char *old_name);
static void init_file_buffer(File file,pbool read_buffer);
@@ -216,14 +216,14 @@ int main(int argc, char **argv)
error=ok=isamchk_neaded=0;
if (join_table)
{ /* Join files into one */
- if (open_isam_files(&merge,argv,(uint) argc) ||
+ if (open_maria_files(&merge,argv,(uint) argc) ||
compress(&merge,join_table))
error=1;
}
else while (argc--)
{
MARIA_HA *isam_file;
- if (!(isam_file=open_isam_file(*argv++,O_RDWR)))
+ if (!(isam_file=open_maria_file(*argv++,O_RDWR)))
error=1;
else
{
@@ -400,11 +400,11 @@ static void get_options(int *argc,char ***argv)
}
-static MARIA_HA *open_isam_file(char *name,int mode)
+static MARIA_HA *open_maria_file(char *name,int mode)
{
MARIA_HA *isam_file;
MARIA_SHARE *share;
- DBUG_ENTER("open_isam_file");
+ DBUG_ENTER("open_maria_file");
if (!(isam_file=maria_open(name,mode,
(opt_wait ? HA_OPEN_WAIT_IF_LOCKED :
@@ -439,7 +439,7 @@ static MARIA_HA *open_isam_file(char *name,int mode)
}
-static bool open_isam_files(PACK_MRG_INFO *mrg,char **names,uint count)
+static bool open_maria_files(PACK_MRG_INFO *mrg,char **names,uint count)
{
uint i,j;
mrg->count=0;
@@ -449,7 +449,7 @@ static bool open_isam_files(PACK_MRG_INFO *mrg,char **names,uint count)
mrg->src_file_has_indexes_disabled= 0;
for (i=0; i < count ; i++)
{
- if (!(mrg->file[i]=open_isam_file(names[i],O_RDONLY)))
+ if (!(mrg->file[i]=open_maria_file(names[i],O_RDONLY)))
goto error;
mrg->src_file_has_indexes_disabled|=
@@ -489,7 +489,7 @@ static bool open_isam_files(PACK_MRG_INFO *mrg,char **names,uint count)
static int compress(PACK_MRG_INFO *mrg,char *result_table)
{
int error;
- File new_file,join_isam_file;
+ File new_file,join_maria_file;
MARIA_HA *isam_file;
MARIA_SHARE *share;
char org_name[FN_REFLEN],new_name[FN_REFLEN],temp_name[FN_REFLEN];
@@ -501,7 +501,7 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
isam_file=mrg->file[0]; /* Take this as an example */
share=isam_file->s;
- new_file=join_isam_file= -1;
+ new_file=join_maria_file= -1;
trees=fields=0;
huff_trees=0;
huff_counts=0;
@@ -529,14 +529,14 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
uchar *buff;
strmov(org_name,result_table); /* Fix error messages */
VOID(fn_format(new_name,result_table,"",MARIA_NAME_IEXT,2));
- if ((join_isam_file=my_create(new_name,0,tmpfile_createflag,MYF(MY_WME)))
+ if ((join_maria_file=my_create(new_name,0,tmpfile_createflag,MYF(MY_WME)))
< 0)
goto err;
length=(uint) share->base.keystart;
if (!(buff= (uchar*) my_malloc(length,MYF(MY_WME))))
goto err;
if (my_pread(share->kfile.file, buff, length, 0L, MYF(MY_WME | MY_NABP)) ||
- my_write(join_isam_file,buff,length,
+ my_write(join_maria_file,buff,length,
MYF(MY_WME | MY_NABP | MY_WAIT_IF_FULL)))
{
my_free(buff,MYF(0));
@@ -653,7 +653,7 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
DBUG_PRINT("info", ("- Compressing file"));
if (write_loop || verbose)
VOID(printf("- Compressing file\n"));
- error=compress_isam_file(mrg,huff_counts);
+ error=compress_maria_file(mrg,huff_counts);
new_length=file_buffer.pos_in_file;
if (!error && !test_only)
{
@@ -701,7 +701,7 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
{
if (result_table)
{
- error=save_state_mrg(join_isam_file,mrg,new_length,glob_crc);
+ error=save_state_mrg(join_maria_file,mrg,new_length,glob_crc);
}
else
{
@@ -742,8 +742,8 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
}
}
error|=mrg_close(mrg);
- if (join_isam_file >= 0)
- error|=my_close(join_isam_file,MYF(MY_WME));
+ if (join_maria_file >= 0)
+ error|=my_close(join_maria_file,MYF(MY_WME));
if (error)
{
VOID(fprintf(stderr, "Aborting: %s is not compressed\n", org_name));
@@ -766,8 +766,8 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
free_counts_and_tree_and_queue(huff_trees,trees,huff_counts,fields);
if (new_file >= 0)
VOID(my_close(new_file,MYF(0)));
- if (join_isam_file >= 0)
- VOID(my_close(join_isam_file,MYF(0)));
+ if (join_maria_file >= 0)
+ VOID(my_close(join_maria_file,MYF(0)));
mrg_close(mrg);
VOID(fprintf(stderr, "Aborted: %s is not compressed\n", org_name));
DBUG_RETURN(-1);
@@ -2413,7 +2413,7 @@ static uint max_bit(register uint value)
}
-static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
+static int compress_maria_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
{
int error;
uint i,max_calc_length,pack_ref_length,min_record_length,max_record_length;
@@ -2426,7 +2426,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
HUFF_TREE *tree;
MARIA_HA *isam_file=mrg->file[0];
uint pack_version= (uint) isam_file->s->pack.version;
- DBUG_ENTER("compress_isam_file");
+ DBUG_ENTER("compress_maria_file");
/* Allocate a buffer for the records (excluding blobs). */
if (!(record=(uchar*) my_alloca(isam_file->s->base.reclength)))
diff --git a/storage/maria/plug.in b/storage/maria/plug.in
index 1ce64f6e2bb..01ef2443978 100644
--- a/storage/maria/plug.in
+++ b/storage/maria/plug.in
@@ -6,3 +6,14 @@ MYSQL_PLUGIN_STATIC(maria, [libmaria.a])
# Maria will probably go first into max builds, not all builds,
# so we don't declare it mandatory.
MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(maria, [ha_maria.cc])
+
+AC_ARG_WITH(maria-tmp-tables,
+ [ --with-maria-tmp-tables Use Maria for internal temporary tables.],
+ [with_maria_tmp_tables=$withval],
+ [with_maria_tmp_tables=yes]
+)
+
+if test "$with_maria_tmp_tables" = "yes"
+then
+ AC_DEFINE([USE_MARIA_FOR_TMP_TABLES], [1], [Maria is used for internal temporary tables])
+fi
diff --git a/storage/maria/trnman.c b/storage/maria/trnman.c
index 147675456aa..11ac8614e29 100644
--- a/storage/maria/trnman.c
+++ b/storage/maria/trnman.c
@@ -221,7 +221,8 @@ static TrID new_trid()
static void set_short_trid(TRN *trn)
{
- int i= (global_trid_generator + (intptr)trn) * 312089 % SHORT_TRID_MAX + 1;
+ int i= (int) ((global_trid_generator + (intptr)trn) * 312089 %
+ SHORT_TRID_MAX + 1);
for ( ; !trn->short_id ; i= 1)
{
my_atomic_rwlock_wrlock(&LOCK_short_trid_to_trn);
diff --git a/storage/myisam/mi_test2.c b/storage/myisam/mi_test2.c
index e75a09702ce..c29d495194f 100644
--- a/storage/myisam/mi_test2.c
+++ b/storage/myisam/mi_test2.c
@@ -18,12 +18,6 @@
#ifndef USE_MY_FUNC /* We want to be able to dbug this !! */
#define USE_MY_FUNC
#endif
-#ifdef DBUG_OFF
-#undef DBUG_OFF
-#endif
-#ifndef SAFEMALLOC
-#define SAFEMALLOC
-#endif
#include "myisamdef.h"
#include <m_ctype.h>
#include <my_bit.h>