Commit 714f3b73 authored by unknown's avatar unknown

merge of recent MyISAM changes into Maria.

Only failure is ndb_restore - could have been worse!!


include/pagecache.h:
  LSN->lsn
mysys/mf_keycache.c:
  page_status is int
mysys/mf_pagecache.c:
  merge of recent key cache changes
sql/mysqld.cc:
  post-merge fixes
sql/set_var.cc:
  post-merge fixes
storage/maria/ha_maria.cc:
  merge of recent MyISAM changes into Maria
storage/maria/ha_maria.h:
  merge of recent MyISAM changes into Maria
storage/maria/ma_close.c:
  merge of recent MyISAM changes into Maria
storage/maria/ma_create.c:
  merge of recent MyISAM changes into Maria
storage/maria/ma_delete.c:
  merge of recent MyISAM changes into Maria
storage/maria/ma_dynrec.c:
  merge of recent MyISAM changes into Maria
storage/maria/ma_ft_boolean_search.c:
  merge of recent MyISAM changes into Maria
storage/maria/ma_key.c:
  merge of recent MyISAM changes into Maria
storage/maria/ma_keycache.c:
  merge of recent MyISAM changes into Maria
storage/maria/ma_open.c:
  merge of recent MyISAM changes into Maria
storage/maria/ma_page.c:
  merge of recent MyISAM changes into Maria
storage/maria/ma_rsamepos.c:
  merge of recent MyISAM changes into Maria
storage/maria/ma_statrec.c:
  merge of recent MyISAM changes into Maria
storage/maria/ma_unique.c:
  merge of recent MyISAM changes into Maria
storage/maria/maria_chk.c:
  merge of recent MyISAM changes into Maria
storage/maria/maria_pack.c:
  merge of recent MyISAM changes into Maria
storage/myisam/myisampack.c:
  compiler warning
parent 8b998d11
...@@ -221,7 +221,7 @@ extern my_bool pagecache_delete_page(PAGECACHE *pagecache, ...@@ -221,7 +221,7 @@ extern my_bool pagecache_delete_page(PAGECACHE *pagecache,
enum pagecache_page_lock lock, enum pagecache_page_lock lock,
my_bool flush); my_bool flush);
extern void end_pagecache(PAGECACHE *keycache, my_bool cleanup); extern void end_pagecache(PAGECACHE *keycache, my_bool cleanup);
extern my_bool pagecache_collect_changed_blocks_with_LSN(PAGECACHE *pagecache, extern my_bool pagecache_collect_changed_blocks_with_lsn(PAGECACHE *pagecache,
LEX_STRING *str, LEX_STRING *str,
LSN *max_lsn); LSN *max_lsn);
......
...@@ -1642,9 +1642,9 @@ restart: ...@@ -1642,9 +1642,9 @@ restart:
KEYCACHE_DBUG_ASSERT(page_status != -1); KEYCACHE_DBUG_ASSERT(page_status != -1);
*page_st=page_status; *page_st=page_status;
KEYCACHE_DBUG_PRINT("find_key_block", KEYCACHE_DBUG_PRINT("find_key_block",
("fd: %d pos: %lu block->status: %u page_status: %u", ("fd: %d pos: %lu block->status: %u page_status: %d",
file, (ulong) filepos, block->status, file, (ulong) filepos, block->status,
(uint) page_status)); page_status));
#if !defined(DBUG_OFF) && defined(EXTRA_DEBUG) #if !defined(DBUG_OFF) && defined(EXTRA_DEBUG)
DBUG_EXECUTE("check_keycache2", DBUG_EXECUTE("check_keycache2",
......
...@@ -759,9 +759,9 @@ int init_pagecache(PAGECACHE *pagecache, my_size_t use_mem, ...@@ -759,9 +759,9 @@ int init_pagecache(PAGECACHE *pagecache, my_size_t use_mem,
DBUG_PRINT("exit", DBUG_PRINT("exit",
("disk_blocks: %d block_root: 0x%lx hash_entries: %d\ ("disk_blocks: %d block_root: 0x%lx hash_entries: %d\
hash_root: 0x%lx hash_links: %d hash_link_root: 0x%lx", hash_root: 0x%lx hash_links: %d hash_link_root: 0x%lx",
pagecache->disk_blocks, pagecache->block_root, pagecache->disk_blocks, (long) pagecache->block_root,
pagecache->hash_entries, pagecache->hash_root, pagecache->hash_entries, (long) pagecache->hash_root,
pagecache->hash_links, pagecache->hash_link_root)); pagecache->hash_links, (long) pagecache->hash_link_root));
bzero((gptr) pagecache->changed_blocks, bzero((gptr) pagecache->changed_blocks,
sizeof(pagecache->changed_blocks[0]) * sizeof(pagecache->changed_blocks[0]) *
PAGECACHE_CHANGED_BLOCKS_HASH); PAGECACHE_CHANGED_BLOCKS_HASH);
...@@ -985,7 +985,7 @@ void change_pagecache_param(PAGECACHE *pagecache, uint division_limit, ...@@ -985,7 +985,7 @@ void change_pagecache_param(PAGECACHE *pagecache, uint division_limit,
void end_pagecache(PAGECACHE *pagecache, my_bool cleanup) void end_pagecache(PAGECACHE *pagecache, my_bool cleanup)
{ {
DBUG_ENTER("end_pagecache"); DBUG_ENTER("end_pagecache");
DBUG_PRINT("enter", ("key_cache: 0x%lx", pagecache)); DBUG_PRINT("enter", ("key_cache: 0x%lx", (long) pagecache));
if (!pagecache->inited) if (!pagecache->inited)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
...@@ -1004,7 +1004,7 @@ void end_pagecache(PAGECACHE *pagecache, my_bool cleanup) ...@@ -1004,7 +1004,7 @@ void end_pagecache(PAGECACHE *pagecache, my_bool cleanup)
pagecache->blocks_changed= 0; pagecache->blocks_changed= 0;
} }
DBUG_PRINT("status", ("used: %d changed: %d w_requests: %lu " DBUG_PRINT("status", ("used: %lu changed: %lu w_requests: %lu "
"writes: %lu r_requests: %lu reads: %lu", "writes: %lu r_requests: %lu reads: %lu",
pagecache->blocks_used, pagecache->global_blocks_changed, pagecache->blocks_used, pagecache->global_blocks_changed,
(ulong) pagecache->global_cache_w_requests, (ulong) pagecache->global_cache_w_requests,
...@@ -1466,7 +1466,7 @@ static void unreg_request(PAGECACHE *pagecache, ...@@ -1466,7 +1466,7 @@ static void unreg_request(PAGECACHE *pagecache,
if (block->temperature == BLOCK_WARM) if (block->temperature == BLOCK_WARM)
pagecache->warm_blocks--; pagecache->warm_blocks--;
block->temperature= BLOCK_HOT; block->temperature= BLOCK_HOT;
KEYCACHE_DBUG_PRINT("unreg_request", ("#warm_blocks=%u", KEYCACHE_DBUG_PRINT("unreg_request", ("#warm_blocks: %lu",
pagecache->warm_blocks)); pagecache->warm_blocks));
} }
link_block(pagecache, block, hot, (my_bool)at_end); link_block(pagecache, block, hot, (my_bool)at_end);
...@@ -1485,7 +1485,7 @@ static void unreg_request(PAGECACHE *pagecache, ...@@ -1485,7 +1485,7 @@ static void unreg_request(PAGECACHE *pagecache,
pagecache->warm_blocks++; pagecache->warm_blocks++;
block->temperature= BLOCK_WARM; block->temperature= BLOCK_WARM;
} }
KEYCACHE_DBUG_PRINT("unreg_request", ("#warm_blocks=%u", KEYCACHE_DBUG_PRINT("unreg_request", ("#warm_blocks: %lu",
pagecache->warm_blocks)); pagecache->warm_blocks));
} }
} }
...@@ -1789,11 +1789,11 @@ static PAGECACHE_BLOCK_LINK *find_key_block(PAGECACHE *pagecache, ...@@ -1789,11 +1789,11 @@ static PAGECACHE_BLOCK_LINK *find_key_block(PAGECACHE *pagecache,
DBUG_ENTER("find_key_block"); DBUG_ENTER("find_key_block");
KEYCACHE_THREAD_TRACE("find_key_block:begin"); KEYCACHE_THREAD_TRACE("find_key_block:begin");
DBUG_PRINT("enter", ("fd: %u pos %lu wrmode: %lu", DBUG_PRINT("enter", ("fd: %d pos: %lu wrmode: %d",
(uint) file->file, (ulong) pageno, (uint) wrmode)); file->file, (ulong) pageno, wrmode));
KEYCACHE_DBUG_PRINT("find_key_block", ("fd: %u pos: %lu wrmode: %lu", KEYCACHE_DBUG_PRINT("find_key_block", ("fd: %d pos: %lu wrmode: %d",
(uint) file->file, (ulong) pageno, file->file, (ulong) pageno,
(uint) wrmode)); wrmode));
#if !defined(DBUG_OFF) && defined(EXTRA_DEBUG) #if !defined(DBUG_OFF) && defined(EXTRA_DEBUG)
DBUG_EXECUTE("check_pagecache", DBUG_EXECUTE("check_pagecache",
test_key_cache(pagecache, "start of find_key_block", 0);); test_key_cache(pagecache, "start of find_key_block", 0););
...@@ -2103,14 +2103,14 @@ restart: ...@@ -2103,14 +2103,14 @@ restart:
KEYCACHE_DBUG_ASSERT(page_status != -1); KEYCACHE_DBUG_ASSERT(page_status != -1);
*page_st=page_status; *page_st=page_status;
DBUG_PRINT("info", DBUG_PRINT("info",
("block: 0x%lx fd: %u pos %lu block->status %u page_status %lu", ("block: 0x%lx fd: %u pos %lu block->status %u page_status %u",
(ulong) block, (uint) file->file, (ulong) block, (uint) file->file,
(ulong) pageno, block->status, (uint) page_status)); (ulong) pageno, block->status, (uint) page_status));
KEYCACHE_DBUG_PRINT("find_key_block", KEYCACHE_DBUG_PRINT("find_key_block",
("block: 0x%lx fd: %u pos %lu block->status %u page_status %lu", ("block: 0x%lx fd: %d pos: %lu block->status: %u page_status: %d",
(ulong) block, (ulong) block,
(uint) file->file, (ulong) pageno, block->status, file->file, (ulong) pageno, block->status,
(uint) page_status)); page_status));
#if !defined(DBUG_OFF) && defined(EXTRA_DEBUG) #if !defined(DBUG_OFF) && defined(EXTRA_DEBUG)
DBUG_EXECUTE("check_pagecache", DBUG_EXECUTE("check_pagecache",
...@@ -3502,7 +3502,7 @@ static int flush_pagecache_blocks_int(PAGECACHE *pagecache, ...@@ -3502,7 +3502,7 @@ static int flush_pagecache_blocks_int(PAGECACHE *pagecache,
PAGECACHE_BLOCK_LINK *cache_buff[FLUSH_CACHE],**cache; PAGECACHE_BLOCK_LINK *cache_buff[FLUSH_CACHE],**cache;
int last_errno= 0; int last_errno= 0;
DBUG_ENTER("flush_pagecache_blocks_int"); DBUG_ENTER("flush_pagecache_blocks_int");
DBUG_PRINT("enter",("file: %d blocks_used: %d blocks_changed: %d", DBUG_PRINT("enter",("file: %d blocks_used: %lu blocks_changed: %lu",
file->file, pagecache->blocks_used, pagecache->blocks_changed)); file->file, pagecache->blocks_used, pagecache->blocks_changed));
#if !defined(DBUG_OFF) && defined(EXTRA_DEBUG) #if !defined(DBUG_OFF) && defined(EXTRA_DEBUG)
...@@ -3714,7 +3714,7 @@ int flush_pagecache_blocks(PAGECACHE *pagecache, ...@@ -3714,7 +3714,7 @@ int flush_pagecache_blocks(PAGECACHE *pagecache,
{ {
int res; int res;
DBUG_ENTER("flush_pagecache_blocks"); DBUG_ENTER("flush_pagecache_blocks");
DBUG_PRINT("enter", ("pagecache: 0x%lx", pagecache)); DBUG_PRINT("enter", ("pagecache: 0x%lx", (long) pagecache));
if (pagecache->disk_blocks <= 0) if (pagecache->disk_blocks <= 0)
DBUG_RETURN(0); DBUG_RETURN(0);
...@@ -3800,7 +3800,7 @@ int reset_key_cache_counters(const char *name, PAGECACHE *key_cache) ...@@ -3800,7 +3800,7 @@ int reset_key_cache_counters(const char *name, PAGECACHE *key_cache)
of type PAGECACHE_LSN_PAGE. of type PAGECACHE_LSN_PAGE.
SYNOPSIS SYNOPSIS
pagecache_collect_changed_blocks_with_LSN() pagecache_collect_changed_blocks_with_lsn()
pagecache pointer to the page cache pagecache pointer to the page cache
str (OUT) pointer to a LEX_STRING where the allocated buffer, and str (OUT) pointer to a LEX_STRING where the allocated buffer, and
its size, will be put its size, will be put
...@@ -3809,7 +3809,8 @@ int reset_key_cache_counters(const char *name, PAGECACHE *key_cache) ...@@ -3809,7 +3809,8 @@ int reset_key_cache_counters(const char *name, PAGECACHE *key_cache)
DESCRIPTION DESCRIPTION
Does the allocation because the caller cannot know the size itself. Does the allocation because the caller cannot know the size itself.
Memory freeing is done by the caller. Memory freeing is to be done by the caller (if the "str" member of the
LEX_STRING is not NULL).
Ignores all pages of another type than PAGECACHE_LSN_PAGE, because they Ignores all pages of another type than PAGECACHE_LSN_PAGE, because they
are not interesting for a checkpoint record. are not interesting for a checkpoint record.
The caller has the intention of doing checkpoints. The caller has the intention of doing checkpoints.
...@@ -3818,17 +3819,18 @@ int reset_key_cache_counters(const char *name, PAGECACHE *key_cache) ...@@ -3818,17 +3819,18 @@ int reset_key_cache_counters(const char *name, PAGECACHE *key_cache)
0 on success 0 on success
1 on error 1 on error
*/ */
my_bool pagecache_collect_changed_blocks_with_LSN(PAGECACHE *pagecache, my_bool pagecache_collect_changed_blocks_with_lsn(PAGECACHE *pagecache,
LEX_STRING *str, LEX_STRING *str,
LSN *max_lsn) LSN *max_lsn)
{ {
my_bool error; my_bool error;
ulong stored_LRD_size= 0; ulong stored_list_size= 0;
uint file_hash; uint file_hash;
char *ptr; char *ptr;
DBUG_ENTER("pagecache_collect_changed_blocks_with_LSN"); DBUG_ENTER("pagecache_collect_changed_blocks_with_LSN");
*max_lsn= 0; *max_lsn= 0;
DBUG_ASSERT(NULL == str->str);
/* /*
We lock the entire cache but will be quick, just reading/writing a few MBs We lock the entire cache but will be quick, just reading/writing a few MBs
of memory at most. of memory at most.
...@@ -3879,17 +3881,17 @@ my_bool pagecache_collect_changed_blocks_with_LSN(PAGECACHE *pagecache, ...@@ -3879,17 +3881,17 @@ my_bool pagecache_collect_changed_blocks_with_LSN(PAGECACHE *pagecache,
DBUG_ASSERT(0); DBUG_ASSERT(0);
goto err; goto err;
} }
stored_LRD_size++; stored_list_size++;
} }
} }
str->length= 8+(4+4+8)*stored_LRD_size; str->length= 8+(4+4+8)*stored_list_size;
if (NULL == (str->str= my_malloc(str->length, MYF(MY_WME)))) if (NULL == (str->str= my_malloc(str->length, MYF(MY_WME))))
goto err; goto err;
ptr= str->str; ptr= str->str;
int8store(ptr, stored_LRD_size); int8store(ptr, stored_list_size);
ptr+= 8; ptr+= 8;
if (0 == stored_LRD_size) if (0 == stored_list_size)
goto end; goto end;
for (file_hash= 0; file_hash < PAGECACHE_CHANGED_BLOCKS_HASH; file_hash++) for (file_hash= 0; file_hash < PAGECACHE_CHANGED_BLOCKS_HASH; file_hash++)
{ {
......
...@@ -8187,11 +8187,13 @@ void refresh_status(THD *thd) ...@@ -8187,11 +8187,13 @@ void refresh_status(THD *thd)
#undef have_innodb #undef have_innodb
#undef have_ndbcluster #undef have_ndbcluster
#undef have_csv_db #undef have_csv_db
#undef have_maria_db
SHOW_COMP_OPTION have_innodb= SHOW_OPTION_NO; SHOW_COMP_OPTION have_innodb= SHOW_OPTION_NO;
SHOW_COMP_OPTION have_ndbcluster= SHOW_OPTION_NO; SHOW_COMP_OPTION have_ndbcluster= SHOW_OPTION_NO;
SHOW_COMP_OPTION have_csv_db= SHOW_OPTION_NO; SHOW_COMP_OPTION have_csv_db= SHOW_OPTION_NO;
SHOW_COMP_OPTION have_partition_db= SHOW_OPTION_NO; SHOW_COMP_OPTION have_partition_db= SHOW_OPTION_NO;
SHOW_COMP_OPTION have_maria_db= SHOW_OPTION_NO;
#ifndef WITH_INNOBASE_STORAGE_ENGINE #ifndef WITH_INNOBASE_STORAGE_ENGINE
uint innobase_flush_log_at_trx_commit; uint innobase_flush_log_at_trx_commit;
......
...@@ -674,6 +674,7 @@ sys_var_have_variable sys_have_csv_db("have_csv", &have_csv_db); ...@@ -674,6 +674,7 @@ sys_var_have_variable sys_have_csv_db("have_csv", &have_csv_db);
sys_var_have_variable sys_have_dlopen("have_dynamic_loading", &have_dlopen); sys_var_have_variable sys_have_dlopen("have_dynamic_loading", &have_dlopen);
sys_var_have_variable sys_have_geometry("have_geometry", &have_geometry); sys_var_have_variable sys_have_geometry("have_geometry", &have_geometry);
sys_var_have_variable sys_have_innodb("have_innodb", &have_innodb); sys_var_have_variable sys_have_innodb("have_innodb", &have_innodb);
sys_var_have_variable sys_have_maria_db("have_maria", &have_maria_db);
sys_var_have_variable sys_have_ndbcluster("have_ndbcluster", &have_ndbcluster); sys_var_have_variable sys_have_ndbcluster("have_ndbcluster", &have_ndbcluster);
sys_var_have_variable sys_have_openssl("have_openssl", &have_openssl); sys_var_have_variable sys_have_openssl("have_openssl", &have_openssl);
sys_var_have_variable sys_have_partition_db("have_partitioning", sys_var_have_variable sys_have_partition_db("have_partitioning",
...@@ -800,6 +801,7 @@ SHOW_VAR init_vars[]= { ...@@ -800,6 +801,7 @@ SHOW_VAR init_vars[]= {
{sys_have_dlopen.name, (char*) &have_dlopen, SHOW_HAVE}, {sys_have_dlopen.name, (char*) &have_dlopen, SHOW_HAVE},
{sys_have_geometry.name, (char*) &have_geometry, SHOW_HAVE}, {sys_have_geometry.name, (char*) &have_geometry, SHOW_HAVE},
{sys_have_innodb.name, (char*) &have_innodb, SHOW_HAVE}, {sys_have_innodb.name, (char*) &have_innodb, SHOW_HAVE},
{sys_have_maria_db.name, (char*) &have_maria_db, SHOW_HAVE},
{sys_have_ndbcluster.name, (char*) &have_ndbcluster, SHOW_HAVE}, {sys_have_ndbcluster.name, (char*) &have_ndbcluster, SHOW_HAVE},
{sys_have_openssl.name, (char*) &have_openssl, SHOW_HAVE}, {sys_have_openssl.name, (char*) &have_openssl, SHOW_HAVE},
{sys_have_partition_db.name,(char*) &have_partition_db, SHOW_HAVE}, {sys_have_partition_db.name,(char*) &have_partition_db, SHOW_HAVE},
......
...@@ -635,7 +635,7 @@ int ha_maria::repair(THD * thd, HA_CHECK_OPT *check_opt) ...@@ -635,7 +635,7 @@ int ha_maria::repair(THD * thd, HA_CHECK_OPT *check_opt)
{ {
param.testflag &= ~T_RETRY_WITHOUT_QUICK; param.testflag &= ~T_RETRY_WITHOUT_QUICK;
sql_print_information("Retrying repair of: '%s' without quick", sql_print_information("Retrying repair of: '%s' without quick",
table->s->path); table->s->path.str);
continue; continue;
} }
param.testflag &= ~T_QUICK; param.testflag &= ~T_QUICK;
...@@ -643,7 +643,7 @@ int ha_maria::repair(THD * thd, HA_CHECK_OPT *check_opt) ...@@ -643,7 +643,7 @@ int ha_maria::repair(THD * thd, HA_CHECK_OPT *check_opt)
{ {
param.testflag= (param.testflag & ~T_REP_BY_SORT) | T_REP; param.testflag= (param.testflag & ~T_REP_BY_SORT) | T_REP;
sql_print_information("Retrying repair of: '%s' with keycache", sql_print_information("Retrying repair of: '%s' with keycache",
table->s->path); table->s->path.str);
continue; continue;
} }
break; break;
...@@ -654,7 +654,8 @@ int ha_maria::repair(THD * thd, HA_CHECK_OPT *check_opt) ...@@ -654,7 +654,8 @@ int ha_maria::repair(THD * thd, HA_CHECK_OPT *check_opt)
char llbuff[22], llbuff2[22]; char llbuff[22], llbuff2[22];
sql_print_information("Found %s of %s rows when repairing '%s'", sql_print_information("Found %s of %s rows when repairing '%s'",
llstr(file->state->records, llbuff), llstr(file->state->records, llbuff),
llstr(start_records, llbuff2), table->s->path); llstr(start_records, llbuff2),
table->s->path.str);
} }
return error; return error;
} }
...@@ -1183,7 +1184,7 @@ bool ha_maria::check_and_repair(THD *thd) ...@@ -1183,7 +1184,7 @@ bool ha_maria::check_and_repair(THD *thd)
// Don't use quick if deleted rows // Don't use quick if deleted rows
if (!file->state->del && (maria_recover_options & HA_RECOVER_QUICK)) if (!file->state->del && (maria_recover_options & HA_RECOVER_QUICK))
check_opt.flags |= T_QUICK; check_opt.flags |= T_QUICK;
sql_print_warning("Checking table: '%s'", table->s->path); sql_print_warning("Checking table: '%s'", table->s->path.str);
old_query= thd->query; old_query= thd->query;
old_query_length= thd->query_length; old_query_length= thd->query_length;
...@@ -1194,7 +1195,7 @@ bool ha_maria::check_and_repair(THD *thd) ...@@ -1194,7 +1195,7 @@ bool ha_maria::check_and_repair(THD *thd)
if ((marked_crashed= maria_is_crashed(file)) || check(thd, &check_opt)) if ((marked_crashed= maria_is_crashed(file)) || check(thd, &check_opt))
{ {
sql_print_warning("Recovering table: '%s'", table->s->path); sql_print_warning("Recovering table: '%s'", table->s->path.str);
check_opt.flags= check_opt.flags=
((maria_recover_options & HA_RECOVER_BACKUP ? T_BACKUP_DATA : 0) | ((maria_recover_options & HA_RECOVER_BACKUP ? T_BACKUP_DATA : 0) |
(marked_crashed ? 0 : T_QUICK) | (marked_crashed ? 0 : T_QUICK) |
...@@ -1506,6 +1507,7 @@ int ha_maria::create(const char *name, register TABLE *table_arg, ...@@ -1506,6 +1507,7 @@ int ha_maria::create(const char *name, register TABLE *table_arg,
bool found_real_auto_increment= 0; bool found_real_auto_increment= 0;
enum ha_base_keytype type; enum ha_base_keytype type;
char buff[FN_REFLEN]; char buff[FN_REFLEN];
byte *record;
KEY *pos; KEY *pos;
MARIA_KEYDEF *keydef; MARIA_KEYDEF *keydef;
MARIA_COLUMNDEF *recinfo, *recinfo_pos; MARIA_COLUMNDEF *recinfo, *recinfo_pos;
...@@ -1608,6 +1610,7 @@ int ha_maria::create(const char *name, register TABLE *table_arg, ...@@ -1608,6 +1610,7 @@ int ha_maria::create(const char *name, register TABLE *table_arg,
found_real_auto_increment= share->next_number_key_offset == 0; found_real_auto_increment= share->next_number_key_offset == 0;
} }
record= table_arg->record[0];
recpos= 0; recpos= 0;
recinfo_pos= recinfo; recinfo_pos= recinfo;
while (recpos < (uint) share->reclength) while (recpos < (uint) share->reclength)
...@@ -1618,7 +1621,8 @@ int ha_maria::create(const char *name, register TABLE *table_arg, ...@@ -1618,7 +1621,8 @@ int ha_maria::create(const char *name, register TABLE *table_arg,
for (field= table_arg->field; *field; field++) for (field= table_arg->field; *field; field++)
{ {
if ((fieldpos= (*field)->offset()) >= recpos && fieldpos <= minpos) if ((fieldpos=(*field)->offset(record)) >= recpos &&
fieldpos <= minpos)
{ {
/* skip null fields */ /* skip null fields */
if (!(temp_length= (*field)->pack_length_in_rec())) if (!(temp_length= (*field)->pack_length_in_rec()))
...@@ -1633,7 +1637,7 @@ int ha_maria::create(const char *name, register TABLE *table_arg, ...@@ -1633,7 +1637,7 @@ int ha_maria::create(const char *name, register TABLE *table_arg,
} }
} }
DBUG_PRINT("loop", ("found: 0x%lx recpos: %d minpos: %d length: %d", DBUG_PRINT("loop", ("found: 0x%lx recpos: %d minpos: %d length: %d",
found, recpos, minpos, length)); (long) found, recpos, minpos, length));
if (recpos != minpos) if (recpos != minpos)
{ // Reserved space (Null bits?) { // Reserved space (Null bits?)
bzero((char*) recinfo_pos, sizeof(*recinfo_pos)); bzero((char*) recinfo_pos, sizeof(*recinfo_pos));
......
...@@ -36,7 +36,7 @@ extern ulong maria_recover_options; ...@@ -36,7 +36,7 @@ extern ulong maria_recover_options;
class ha_maria :public handler class ha_maria :public handler
{ {
MARIA_HA *file; MARIA_HA *file;
ulong int_table_flags; ulonglong int_table_flags;
char *data_file_name, *index_file_name; char *data_file_name, *index_file_name;
bool can_enable_indexes; bool can_enable_indexes;
int repair(THD * thd, HA_CHECK &param, bool optimize); int repair(THD * thd, HA_CHECK &param, bool optimize);
......
...@@ -28,8 +28,9 @@ int maria_close(register MARIA_HA *info) ...@@ -28,8 +28,9 @@ int maria_close(register MARIA_HA *info)
int error=0,flag; int error=0,flag;
MARIA_SHARE *share=info->s; MARIA_SHARE *share=info->s;
DBUG_ENTER("maria_close"); DBUG_ENTER("maria_close");
DBUG_PRINT("enter",("base: %lx reopen: %u locks: %u", DBUG_PRINT("enter",("base: 0x%lx reopen: %u locks: %u",
info,(uint) share->reopen, (uint) share->tot_locks)); (long) info, (uint) share->reopen,
(uint) share->tot_locks));
pthread_mutex_lock(&THR_LOCK_maria); pthread_mutex_lock(&THR_LOCK_maria);
if (info->lock_type == F_EXTRA_LCK) if (info->lock_type == F_EXTRA_LCK)
......
...@@ -441,9 +441,9 @@ int maria_create(const char *name,uint keys,MARIA_KEYDEF *keydefs, ...@@ -441,9 +441,9 @@ int maria_create(const char *name,uint keys,MARIA_KEYDEF *keydefs,
block_length= max(block_length, MARIA_MIN_KEY_BLOCK_LENGTH); block_length= max(block_length, MARIA_MIN_KEY_BLOCK_LENGTH);
block_length= min(block_length, MARIA_MAX_KEY_BLOCK_LENGTH); block_length= min(block_length, MARIA_MAX_KEY_BLOCK_LENGTH);
keydef->block_length= MARIA_BLOCK_SIZE(length-real_length_diff, keydef->block_length= (uint16) MARIA_BLOCK_SIZE(length-real_length_diff,
pointer,MARIA_MAX_KEYPTR_SIZE, pointer,MARIA_MAX_KEYPTR_SIZE,
block_length); block_length);
if (keydef->block_length > MARIA_MAX_KEY_BLOCK_LENGTH || if (keydef->block_length > MARIA_MAX_KEY_BLOCK_LENGTH ||
length >= HA_MAX_KEY_BUFF) length >= HA_MAX_KEY_BUFF)
{ {
......
...@@ -163,7 +163,7 @@ static int _ma_ck_real_delete(register MARIA_HA *info, MARIA_KEYDEF *keyinfo, ...@@ -163,7 +163,7 @@ static int _ma_ck_real_delete(register MARIA_HA *info, MARIA_KEYDEF *keyinfo,
DBUG_PRINT("error",("Couldn't allocate memory")); DBUG_PRINT("error",("Couldn't allocate memory"));
DBUG_RETURN(my_errno=ENOMEM); DBUG_RETURN(my_errno=ENOMEM);
} }
DBUG_PRINT("info",("root_page: %ld",old_root)); DBUG_PRINT("info",("root_page: %ld", (long) old_root));
if (!_ma_fetch_keypage(info,keyinfo,old_root,DFLT_INIT_HITS,root_buff,0)) if (!_ma_fetch_keypage(info,keyinfo,old_root,DFLT_INIT_HITS,root_buff,0))
{ {
error= -1; error= -1;
...@@ -406,7 +406,7 @@ static int del(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo, uchar *k ...@@ -406,7 +406,7 @@ static int del(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo, uchar *k
MARIA_SHARE *share=info->s; MARIA_SHARE *share=info->s;
MARIA_KEY_PARAM s_temp; MARIA_KEY_PARAM s_temp;
DBUG_ENTER("del"); DBUG_ENTER("del");
DBUG_PRINT("enter",("leaf_page: %ld keypos: 0x%lx", leaf_page, DBUG_PRINT("enter",("leaf_page: %ld keypos: 0x%lx", (long) leaf_page,
(ulong) keypos)); (ulong) keypos));
DBUG_DUMP("leaf_buff",(byte*) leaf_buff,maria_getint(leaf_buff)); DBUG_DUMP("leaf_buff",(byte*) leaf_buff,maria_getint(leaf_buff));
...@@ -593,7 +593,8 @@ static int underflow(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo, ...@@ -593,7 +593,8 @@ static int underflow(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
else else
{ /* Page is full */ { /* Page is full */
endpos=anc_buff+anc_length; endpos=anc_buff+anc_length;
DBUG_PRINT("test",("anc_buff: %lx endpos: %lx",anc_buff,endpos)); DBUG_PRINT("test",("anc_buff: 0x%lx endpos: 0x%lx",
(long) anc_buff, (long) endpos));
if (keypos != anc_buff+2+key_reflength && if (keypos != anc_buff+2+key_reflength &&
!_ma_get_last_key(info,keyinfo,anc_buff,anc_key,keypos,&length)) !_ma_get_last_key(info,keyinfo,anc_buff,anc_key,keypos,&length))
goto err; goto err;
...@@ -771,7 +772,7 @@ static uint remove_key(MARIA_KEYDEF *keyinfo, uint nod_flag, ...@@ -771,7 +772,7 @@ static uint remove_key(MARIA_KEYDEF *keyinfo, uint nod_flag,
int s_length; int s_length;
uchar *start; uchar *start;
DBUG_ENTER("remove_key"); DBUG_ENTER("remove_key");
DBUG_PRINT("enter",("keypos: %lx page_end: %lx",keypos,page_end)); DBUG_PRINT("enter",("keypos: 0x%lx page_end: 0x%lx",(long) keypos, (long) page_end));
start=keypos; start=keypos;
if (!(keyinfo->flag & if (!(keyinfo->flag &
......
...@@ -1240,8 +1240,8 @@ ulong _ma_rec_unpack(register MARIA_HA *info, register byte *to, byte *from, ...@@ -1240,8 +1240,8 @@ ulong _ma_rec_unpack(register MARIA_HA *info, register byte *to, byte *from,
err: err:
my_errno= HA_ERR_WRONG_IN_RECORD; my_errno= HA_ERR_WRONG_IN_RECORD;
DBUG_PRINT("error",("to_end: %lx -> %lx from_end: %lx -> %lx", DBUG_PRINT("error",("to_end: 0x%lx -> 0x%lx from_end: 0x%lx -> 0x%lx",
to,to_end,from,from_end)); (long) to, (long) to_end, (long) from, (long) from_end));
DBUG_DUMP("from",(byte*) info->rec_buff,info->s->base.min_pack_length); DBUG_DUMP("from",(byte*) info->rec_buff,info->s->base.min_pack_length);
DBUG_RETURN(MY_FILE_ERROR); DBUG_RETURN(MY_FILE_ERROR);
} /* _ma_rec_unpack */ } /* _ma_rec_unpack */
......
...@@ -333,7 +333,6 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search) ...@@ -333,7 +333,6 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
MARIA_HA *info=ftb->info; MARIA_HA *info=ftb->info;
uint off, extra=HA_FT_WLEN+info->s->base.rec_reflength; uint off, extra=HA_FT_WLEN+info->s->base.rec_reflength;
byte *lastkey_buf=ftbw->word+ftbw->off; byte *lastkey_buf=ftbw->word+ftbw->off;
LINT_INIT(off);
if (ftbw->flags & FTB_FLAG_TRUNC) if (ftbw->flags & FTB_FLAG_TRUNC)
lastkey_buf+=ftbw->len; lastkey_buf+=ftbw->len;
......
...@@ -52,7 +52,7 @@ static int _ma_put_key_in_record(MARIA_HA *info,uint keynr,byte *record); ...@@ -52,7 +52,7 @@ static int _ma_put_key_in_record(MARIA_HA *info,uint keynr,byte *record);
uint _ma_make_key(register MARIA_HA *info, uint keynr, uchar *key, uint _ma_make_key(register MARIA_HA *info, uint keynr, uchar *key,
const byte *record, my_off_t filepos) const byte *record, my_off_t filepos)
{ {
byte *pos,*end; byte *pos;
uchar *start; uchar *start;
reg1 HA_KEYSEG *keyseg; reg1 HA_KEYSEG *keyseg;
my_bool is_ft= info->s->keyinfo[keynr].flag & HA_FULLTEXT; my_bool is_ft= info->s->keyinfo[keynr].flag & HA_FULLTEXT;
...@@ -107,18 +107,17 @@ uint _ma_make_key(register MARIA_HA *info, uint keynr, uchar *key, ...@@ -107,18 +107,17 @@ uint _ma_make_key(register MARIA_HA *info, uint keynr, uchar *key,
} }
if (keyseg->flag & HA_SPACE_PACK) if (keyseg->flag & HA_SPACE_PACK)
{ {
end= pos + length;
if (type != HA_KEYTYPE_NUM) if (type != HA_KEYTYPE_NUM)
{ {
while (end > pos && end[-1] == ' ') length= cs->cset->lengthsp(cs, pos, length);
end--;
} }
else else
{ {
byte *end= pos + length;
while (pos < end && pos[0] == ' ') while (pos < end && pos[0] == ' ')
pos++; pos++;
length=(uint) (end-pos);
} }
length=(uint) (end-pos);
FIX_LENGTH(cs, pos, length, char_length); FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length); store_key_length_inc(key,char_length);
memcpy((byte*) key,(byte*) pos,(size_t) char_length); memcpy((byte*) key,(byte*) pos,(size_t) char_length);
...@@ -403,8 +402,10 @@ static int _ma_put_key_in_record(register MARIA_HA *info, uint keynr, ...@@ -403,8 +402,10 @@ static int _ma_put_key_in_record(register MARIA_HA *info, uint keynr,
pos= record+keyseg->start; pos= record+keyseg->start;
if (keyseg->type != (int) HA_KEYTYPE_NUM) if (keyseg->type != (int) HA_KEYTYPE_NUM)
{ {
memcpy(pos,key,(size_t) length); memcpy(pos,key,(size_t) length);
bfill(pos+length,keyseg->length-length,' '); keyseg->charset->cset->fill(keyseg->charset,
pos + length, keyseg->length - length,
' ');
} }
else else
{ {
......
...@@ -54,8 +54,8 @@ int maria_assign_to_key_cache(MARIA_HA *info, ...@@ -54,8 +54,8 @@ int maria_assign_to_key_cache(MARIA_HA *info,
int error= 0; int error= 0;
MARIA_SHARE* share= info->s; MARIA_SHARE* share= info->s;
DBUG_ENTER("maria_assign_to_key_cache"); DBUG_ENTER("maria_assign_to_key_cache");
DBUG_PRINT("enter",("old_key_cache_handle: %lx new_key_cache_handle: %lx", DBUG_PRINT("enter",("old_key_cache_handle: 0x%lx new_key_cache_handle: 0x%lx",
share->key_cache, key_cache)); (long) share->key_cache, (long) key_cache));
/* /*
Skip operation if we didn't change key cache. This can happen if we Skip operation if we didn't change key cache. This can happen if we
......
...@@ -340,6 +340,8 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags) ...@@ -340,6 +340,8 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
goto err; goto err;
} }
} }
else if (pos->type == HA_KEYTYPE_BINARY)
pos->charset= &my_charset_bin;
} }
if (share->keyinfo[i].flag & HA_SPATIAL) if (share->keyinfo[i].flag & HA_SPATIAL)
{ {
...@@ -1259,12 +1261,29 @@ int maria_enable_indexes(MARIA_HA *info) ...@@ -1259,12 +1261,29 @@ int maria_enable_indexes(MARIA_HA *info)
RETURN RETURN
0 indexes are not disabled 0 indexes are not disabled
1 all indexes are disabled 1 all indexes are disabled
[2 non-unique indexes are disabled - NOT YET IMPLEMENTED] 2 non-unique indexes are disabled
*/ */
int maria_indexes_are_disabled(MARIA_HA *info) int maria_indexes_are_disabled(MARIA_HA *info)
{ {
MARIA_SHARE *share= info->s; MARIA_SHARE *share= info->s;
return (! maria_is_any_key_active(share->state.key_map) && share->base.keys); /*
No keys or all are enabled. keys is the number of keys. Left shifted
gives us only one bit set. When decreased by one, gives us all all bits
up to this one set and it gets unset.
*/
if (!share->base.keys ||
(maria_is_all_keys_active(share->state.key_map, share->base.keys)))
return 0;
/* All are disabled */
if (maria_is_any_key_active(share->state.key_map))
return 1;
/*
We have keys. Some enabled, some disabled.
Don't check for any non-unique disabled but return directly 2
*/
return 2;
} }
...@@ -27,7 +27,7 @@ uchar *_ma_fetch_keypage(register MARIA_HA *info, MARIA_KEYDEF *keyinfo, ...@@ -27,7 +27,7 @@ uchar *_ma_fetch_keypage(register MARIA_HA *info, MARIA_KEYDEF *keyinfo,
uchar *tmp; uchar *tmp;
uint page_size; uint page_size;
DBUG_ENTER("_ma_fetch_keypage"); DBUG_ENTER("_ma_fetch_keypage");
DBUG_PRINT("enter",("page: %ld",page)); DBUG_PRINT("enter",("page: %ld", (long) page));
tmp=(uchar*) key_cache_read(info->s->key_cache, tmp=(uchar*) key_cache_read(info->s->key_cache,
info->s->kfile, page, level, (byte*) buff, info->s->kfile, page, level, (byte*) buff,
...@@ -80,7 +80,7 @@ int _ma_write_keypage(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo, ...@@ -80,7 +80,7 @@ int _ma_write_keypage(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
my_errno=EINVAL; my_errno=EINVAL;
DBUG_RETURN((-1)); DBUG_RETURN((-1));
} }
DBUG_PRINT("page",("write page at: %lu",(long) page,buff)); DBUG_PRINT("page",("write page at: %lu",(long) page));
DBUG_DUMP("buff",(byte*) buff,maria_getint(buff)); DBUG_DUMP("buff",(byte*) buff,maria_getint(buff));
#endif #endif
......
...@@ -33,7 +33,8 @@ int maria_rsame_with_pos(MARIA_HA *info, byte *record, int inx, my_off_t filepos ...@@ -33,7 +33,8 @@ int maria_rsame_with_pos(MARIA_HA *info, byte *record, int inx, my_off_t filepos
DBUG_ENTER("maria_rsame_with_pos"); DBUG_ENTER("maria_rsame_with_pos");
DBUG_PRINT("enter",("index: %d filepos: %ld", inx, (long) filepos)); DBUG_PRINT("enter",("index: %d filepos: %ld", inx, (long) filepos));
if (inx < -1 || (inx >= 0 && !maria_is_key_active(info->s->state.key_map, inx))) if (inx < -1 ||
(inx >= 0 && ! maria_is_key_active(info->s->state.key_map, inx)))
{ {
DBUG_RETURN(my_errno=HA_ERR_WRONG_INDEX); DBUG_RETURN(my_errno=HA_ERR_WRONG_INDEX);
} }
......
...@@ -251,8 +251,8 @@ int _ma_read_rnd_static_record(MARIA_HA *info, byte *buf, ...@@ -251,8 +251,8 @@ int _ma_read_rnd_static_record(MARIA_HA *info, byte *buf,
if (filepos >= info->state->data_file_length) if (filepos >= info->state->data_file_length)
{ {
DBUG_PRINT("test",("filepos: %ld (%ld) records: %ld del: %ld", DBUG_PRINT("test",("filepos: %ld (%ld) records: %ld del: %ld",
filepos/share->base.reclength,filepos, (long) filepos/share->base.reclength, (long) filepos,
info->state->records, info->state->del)); (long) info->state->records, (long) info->state->del));
fast_ma_writeinfo(info); fast_ma_writeinfo(info);
DBUG_RETURN(my_errno=HA_ERR_END_OF_FILE); DBUG_RETURN(my_errno=HA_ERR_END_OF_FILE);
} }
......
...@@ -57,8 +57,8 @@ my_bool _ma_check_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def, byte *record, ...@@ -57,8 +57,8 @@ my_bool _ma_check_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def, byte *record,
if (_ma_search_next(info,info->s->keyinfo+def->key, info->lastkey, if (_ma_search_next(info,info->s->keyinfo+def->key, info->lastkey,
MARIA_UNIQUE_HASH_LENGTH, SEARCH_BIGGER, MARIA_UNIQUE_HASH_LENGTH, SEARCH_BIGGER,
info->s->state.key_root[def->key]) || info->s->state.key_root[def->key]) ||
memcmp((char*) info->lastkey, (char*) key_buff, bcmp((char*) info->lastkey, (char*) key_buff,
MARIA_UNIQUE_HASH_LENGTH)) MARIA_UNIQUE_HASH_LENGTH))
{ {
info->page_changed=1; /* Can't optimize read next */ info->page_changed=1; /* Can't optimize read next */
info->lastpos=lastpos; info->lastpos=lastpos;
......
...@@ -701,6 +701,7 @@ get_one_option(int optid, ...@@ -701,6 +701,7 @@ get_one_option(int optid,
{ {
int method; int method;
enum_handler_stats_method method_conv; enum_handler_stats_method method_conv;
LINT_INIT(method_conv);
maria_stats_method_str= argument; maria_stats_method_str= argument;
if ((method=find_type(argument, &maria_stats_method_typelib, 2)) <= 0) if ((method=find_type(argument, &maria_stats_method_typelib, 2)) <= 0)
{ {
......
...@@ -1107,18 +1107,18 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts) ...@@ -1107,18 +1107,18 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
my_off_t total_count; my_off_t total_count;
char llbuf[32]; char llbuf[32];
DBUG_PRINT("info", ("column: %3lu", count - huff_counts + 1)); DBUG_PRINT("info", ("column: %3u", (uint) (count - huff_counts + 1)));
if (verbose >= 2) if (verbose >= 2)
VOID(printf("column: %3lu\n", count - huff_counts + 1)); VOID(printf("column: %3u\n", (uint) (count - huff_counts + 1)));
if (count->tree_buff) if (count->tree_buff)
{ {
DBUG_PRINT("info", ("number of distinct values: %lu", DBUG_PRINT("info", ("number of distinct values: %u",
(count->tree_pos - count->tree_buff) / (uint) ((count->tree_pos - count->tree_buff) /
count->field_length)); count->field_length)));
if (verbose >= 2) if (verbose >= 2)
VOID(printf("number of distinct values: %lu\n", VOID(printf("number of distinct values: %u\n",
(count->tree_pos - count->tree_buff) / (uint) ((count->tree_pos - count->tree_buff) /
count->field_length)); count->field_length)));
} }
total_count= 0; total_count= 0;
for (idx= 0; idx < 256; idx++) for (idx= 0; idx < 256; idx++)
...@@ -2038,7 +2038,7 @@ static void write_field_info(HUFF_COUNTS *counts, uint fields, uint trees) ...@@ -2038,7 +2038,7 @@ static void write_field_info(HUFF_COUNTS *counts, uint fields, uint trees)
uint huff_tree_bits; uint huff_tree_bits;
huff_tree_bits=max_bit(trees ? trees-1 : 0); huff_tree_bits=max_bit(trees ? trees-1 : 0);
DBUG_PRINT("info", ("")); DBUG_PRINT("info", (" "));
DBUG_PRINT("info", ("column types:")); DBUG_PRINT("info", ("column types:"));
DBUG_PRINT("info", ("FIELD_NORMAL 0")); DBUG_PRINT("info", ("FIELD_NORMAL 0"));
DBUG_PRINT("info", ("FIELD_SKIP_ENDSPACE 1")); DBUG_PRINT("info", ("FIELD_SKIP_ENDSPACE 1"));
...@@ -2050,12 +2050,12 @@ static void write_field_info(HUFF_COUNTS *counts, uint fields, uint trees) ...@@ -2050,12 +2050,12 @@ static void write_field_info(HUFF_COUNTS *counts, uint fields, uint trees)
DBUG_PRINT("info", ("FIELD_ZERO 7")); DBUG_PRINT("info", ("FIELD_ZERO 7"));
DBUG_PRINT("info", ("FIELD_VARCHAR 8")); DBUG_PRINT("info", ("FIELD_VARCHAR 8"));
DBUG_PRINT("info", ("FIELD_CHECK 9")); DBUG_PRINT("info", ("FIELD_CHECK 9"));
DBUG_PRINT("info", ("")); DBUG_PRINT("info", (" "));
DBUG_PRINT("info", ("pack type as a set of flags:")); DBUG_PRINT("info", ("pack type as a set of flags:"));
DBUG_PRINT("info", ("PACK_TYPE_SELECTED 1")); DBUG_PRINT("info", ("PACK_TYPE_SELECTED 1"));
DBUG_PRINT("info", ("PACK_TYPE_SPACE_FIELDS 2")); DBUG_PRINT("info", ("PACK_TYPE_SPACE_FIELDS 2"));
DBUG_PRINT("info", ("PACK_TYPE_ZERO_FILL 4")); DBUG_PRINT("info", ("PACK_TYPE_ZERO_FILL 4"));
DBUG_PRINT("info", ("")); DBUG_PRINT("info", (" "));
if (verbose >= 2) if (verbose >= 2)
{ {
VOID(printf("\n")); VOID(printf("\n"));
...@@ -2128,7 +2128,7 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees) ...@@ -2128,7 +2128,7 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees)
return 0; return 0;
} }
DBUG_PRINT("info", ("")); DBUG_PRINT("info", (" "));
if (verbose >= 2) if (verbose >= 2)
VOID(printf("\n")); VOID(printf("\n"));
tree_no= 0; tree_no= 0;
...@@ -2139,7 +2139,7 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees) ...@@ -2139,7 +2139,7 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees)
if (huff_tree->tree_number == 0) if (huff_tree->tree_number == 0)
continue; /* Deleted tree */ continue; /* Deleted tree */
tree_no++; tree_no++;
DBUG_PRINT("info", ("")); DBUG_PRINT("info", (" "));
if (verbose >= 3) if (verbose >= 3)
VOID(printf("\n")); VOID(printf("\n"));
/* Count the total number of elements (byte codes or column values). */ /* Count the total number of elements (byte codes or column values). */
...@@ -2281,8 +2281,8 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees) ...@@ -2281,8 +2281,8 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees)
if (bits > 8 * sizeof(code)) if (bits > 8 * sizeof(code))
{ {
VOID(fflush(stdout)); VOID(fflush(stdout));
VOID(fprintf(stderr, "error: Huffman code too long: %u/%lu\n", VOID(fprintf(stderr, "error: Huffman code too long: %u/%u\n",
bits, 8 * sizeof(code))); bits, (uint) (8 * sizeof(code))));
errors++; errors++;
break; break;
} }
...@@ -2331,7 +2331,7 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees) ...@@ -2331,7 +2331,7 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees)
} }
flush_bits(); flush_bits();
} }
DBUG_PRINT("info", ("")); DBUG_PRINT("info", (" "));
if (verbose >= 2) if (verbose >= 2)
VOID(printf("\n")); VOID(printf("\n"));
my_afree((gptr) packed_tree); my_afree((gptr) packed_tree);
...@@ -2509,7 +2509,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts) ...@@ -2509,7 +2509,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
end_pos-=count->max_zero_fill; end_pos-=count->max_zero_fill;
field_length-=count->max_zero_fill; field_length-=count->max_zero_fill;
switch(count->field_type) { switch (count->field_type) {
case FIELD_SKIP_ZERO: case FIELD_SKIP_ZERO:
if (!memcmp((byte*) start_pos,zero_string,field_length)) if (!memcmp((byte*) start_pos,zero_string,field_length))
{ {
...@@ -2925,6 +2925,8 @@ static void flush_bits(void) ...@@ -2925,6 +2925,8 @@ static void flush_bits(void)
bits-= 8; bits-= 8;
*file_buffer.pos++= (uchar) (bit_buffer >> bits); *file_buffer.pos++= (uchar) (bit_buffer >> bits);
} }
if (file_buffer.pos >= file_buffer.end)
VOID(flush_buffer(~ (ulong) 0));
file_buffer.bits= BITS_SAVED; file_buffer.bits= BITS_SAVED;
file_buffer.bitbucket= 0; file_buffer.bitbucket= 0;
} }
......
...@@ -1110,11 +1110,11 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts) ...@@ -1110,11 +1110,11 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
VOID(printf("column: %3u\n", (uint) (count - huff_counts + 1))); VOID(printf("column: %3u\n", (uint) (count - huff_counts + 1)));
if (count->tree_buff) if (count->tree_buff)
{ {
DBUG_PRINT("info", ("number of distinct values: %lu", DBUG_PRINT("info", ("number of distinct values: %u",
(uint) ((count->tree_pos - count->tree_buff) / (uint) ((count->tree_pos - count->tree_buff) /
count->field_length))); count->field_length)));
if (verbose >= 2) if (verbose >= 2)
VOID(printf("number of distinct values: %lu\n", VOID(printf("number of distinct values: %u\n",
(uint) ((count->tree_pos - count->tree_buff) / (uint) ((count->tree_pos - count->tree_buff) /
count->field_length))); count->field_length)));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment