Commit 88d103aa authored by unknown's avatar unknown

Merge bk-internal.mysql.com:/home/bk/mysql-4.1

into mysql.com:/my/mysql-4.1


sql/item_func.cc:
  Auto merged
parents c1dd9540 51591cad
......@@ -40,7 +40,7 @@ main( int argc, char * argv[] )
MYSQL_ROW row ;
//....just curious....
printf( "sizeof( MYSQL ) == %d\n", sizeof( MYSQL ) ) ;
printf( "sizeof( MYSQL ) == %d\n", (int) sizeof( MYSQL ) ) ;
if ( argc == 2 )
{
strcpy( szDB, argv[ 1 ] ) ;
......@@ -49,27 +49,31 @@ main( int argc, char * argv[] )
{
strcpy( szDB, "mysql" ) ;
printf("Some mysql struct information (size and offset):\n");
printf("net:\t%3d %3d\n",sizeof(myData->net),offsetof(MYSQL,net));
printf("host:\t%3d %3d\n",sizeof(myData->host),offsetof(MYSQL,host));
printf("port:\t%3d %3d\n",sizeof(myData->port),offsetof(MYSQL,port));
printf("protocol_version:\t%3d %3d\n",sizeof(myData->protocol_version),
offsetof(MYSQL,protocol_version));
printf("thread_id:\t%3d %3d\n",sizeof(myData->thread_id),
offsetof(MYSQL,thread_id));
printf("affected_rows:\t%3d %3d\n",sizeof(myData->affected_rows),
offsetof(MYSQL,affected_rows));
printf("packet_length:\t%3d %3d\n",sizeof(myData->packet_length),
offsetof(MYSQL,packet_length));
printf("status:\t%3d %3d\n",sizeof(myData->status),
offsetof(MYSQL,status));
printf("fields:\t%3d %3d\n",sizeof(myData->fields),
offsetof(MYSQL,fields));
printf("field_alloc:\t%3d %3d\n",sizeof(myData->field_alloc),
offsetof(MYSQL,field_alloc));
printf("free_me:\t%3d %3d\n",sizeof(myData->free_me),
offsetof(MYSQL,free_me));
printf("options:\t%3d %3d\n",sizeof(myData->options),
offsetof(MYSQL,options));
printf("net:\t%3d %3d\n",(int) sizeof(myData->net),
(int) offsetof(MYSQL,net));
printf("host:\t%3d %3d\n",(int) sizeof(myData->host),
(int) offsetof(MYSQL,host));
printf("port:\t%3d %3d\n", (int) sizeof(myData->port),
(int) offsetof(MYSQL,port));
printf("protocol_version:\t%3d %3d\n",
(int) sizeof(myData->protocol_version),
(int) offsetof(MYSQL,protocol_version));
printf("thread_id:\t%3d %3d\n",(int) sizeof(myData->thread_id),
(int) offsetof(MYSQL,thread_id));
printf("affected_rows:\t%3d %3d\n",(int) sizeof(myData->affected_rows),
(int) offsetof(MYSQL,affected_rows));
printf("packet_length:\t%3d %3d\n",(int) sizeof(myData->packet_length),
(int) offsetof(MYSQL,packet_length));
printf("status:\t%3d %3d\n",(int) sizeof(myData->status),
(int) offsetof(MYSQL,status));
printf("fields:\t%3d %3d\n",(int) sizeof(myData->fields),
(int) offsetof(MYSQL,fields));
printf("field_alloc:\t%3d %3d\n",(int) sizeof(myData->field_alloc),
(int) offsetof(MYSQL,field_alloc));
printf("free_me:\t%3d %3d\n",(int) sizeof(myData->free_me),
(int) offsetof(MYSQL,free_me));
printf("options:\t%3d %3d\n",(int) sizeof(myData->options),
(int) offsetof(MYSQL,options));
puts("");
}
}
......
......@@ -318,6 +318,7 @@ typedef struct st_mi_check_param
ulonglong auto_increment_value;
ulonglong max_data_file_length;
ulonglong keys_in_use;
ulonglong max_record_length;
my_off_t search_after_block;
my_off_t new_file_pos,key_file_blocks;
my_off_t keydata,totaldata,key_blocks,start_check_pos;
......
......@@ -118,7 +118,7 @@ enum enum_server_command
#define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */
#define CLIENT_MULTI_STATEMENTS 65536 /* Enable/disable multi-stmt support */
#define CLIENT_MULTI_RESULTS 131072 /* Enable/disable multi-results */
#define CLIENT_REMEMBER_OPTIONS (1L << 31)
#define CLIENT_REMEMBER_OPTIONS ((ulong) (1L << 31))
#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */
#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */
......
......@@ -600,8 +600,8 @@ btr_page_get_father_for_rec(
"InnoDB: father ptr page no %lu, child page no %lu\n",
(UT_LIST_GET_FIRST(tree->tree_indexes))->table_name,
(UT_LIST_GET_FIRST(tree->tree_indexes))->name,
btr_node_ptr_get_child_page_no(node_ptr),
buf_frame_get_page_no(page));
(unsigned long) btr_node_ptr_get_child_page_no(node_ptr),
(unsigned long) buf_frame_get_page_no(page));
page_rec_print(page_rec_get_next(page_get_infimum_rec(page)));
page_rec_print(node_ptr);
......@@ -877,7 +877,9 @@ btr_page_reorganize_low(
"InnoDB: Error: page old data size %lu new data size %lu\n"
"InnoDB: Error: page old max ins size %lu new max ins size %lu\n"
"InnoDB: Make a detailed bug report and send it to mysql@lists.mysql.com\n",
data_size1, data_size2, max_ins_size1, max_ins_size2);
(unsigned long) data_size1, (unsigned long) data_size2,
(unsigned long) max_ins_size1,
(unsigned long) max_ins_size2);
}
buf_frame_free(new_page);
......@@ -2356,8 +2358,10 @@ btr_index_rec_validate(
"InnoDB: Record in index %s in table %s, page %lu, at offset %lu\n"
"InnoDB: has %lu fields, should have %lu\n",
index->name, index->table_name,
buf_frame_get_page_no(page), (ulint)(rec - page),
rec_get_n_fields(rec), n);
(unsigned long) buf_frame_get_page_no(page),
(unsigned long) (rec - page),
(unsigned long) rec_get_n_fields(rec),
(unsigned long) n);
if (!dump_on_error) {
......@@ -2390,9 +2394,11 @@ btr_index_rec_validate(
"InnoDB: Record in index %s in table %s, page %lu, at offset %lu\n"
"InnoDB: field %lu len is %lu, should be %lu\n",
index->name, index->table_name,
buf_frame_get_page_no(page),
(ulint)(rec - page),
i, len, dtype_get_fixed_size(type));
(unsigned long) buf_frame_get_page_no(page),
(unsigned long) (rec - page),
(unsigned long) i,
(unsigned long) len,
(unsigned long) dtype_get_fixed_size(type));
if (!dump_on_error) {
......@@ -2541,7 +2547,7 @@ btr_validate_level(
fprintf(stderr,
"InnoDB: Error on pages %lu and %lu in index %s table %s\n",
buf_frame_get_page_no(page),
right_page_no,
(unsigned long) right_page_no,
index->name, index->table_name);
fprintf(stderr,
......@@ -2581,7 +2587,7 @@ btr_validate_level(
&mtr)) {
fprintf(stderr,
"InnoDB: Error on page %lu in index %s table %s\n",
buf_frame_get_page_no(page),
(unsigned long) buf_frame_get_page_no(page),
index->name, index->table_name);
fprintf(stderr,
......@@ -2596,7 +2602,7 @@ btr_validate_level(
fprintf(stderr,
"InnoDB: node ptr child page n:o %lu\n",
btr_node_ptr_get_child_page_no(node_ptr));
(unsigned long) btr_node_ptr_get_child_page_no(node_ptr));
rec_sprintf(err_buf, 900,
btr_page_get_father_for_rec(tree, page,
......@@ -2679,7 +2685,7 @@ btr_validate_level(
fprintf(stderr,
"InnoDB: Error on page %lu in index %s table %s\n",
buf_frame_get_page_no(page),
(unsigned long) buf_frame_get_page_no(page),
index->name, index->table_name);
buf_page_print(father_page);
......@@ -2699,7 +2705,7 @@ btr_validate_level(
fprintf(stderr,
"InnoDB: Error on page %lu in index %s table %s\n",
buf_frame_get_page_no(page),
(unsigned long) buf_frame_get_page_no(page),
index->name, index->table_name);
buf_page_print(father_page);
......@@ -2717,7 +2723,7 @@ btr_validate_level(
fprintf(stderr,
"InnoDB: Error on page %lu in index %s table %s\n",
buf_frame_get_page_no(page),
(unsigned long) buf_frame_get_page_no(page),
index->name, index->table_name);
buf_page_print(father_page);
......
......@@ -874,8 +874,8 @@ btr_cur_optimistic_insert(
if (btr_cur_print_record_ops && thr) {
printf(
"Trx with id %lu %lu going to insert to table %s index %s\n",
ut_dulint_get_high(thr_get_trx(thr)->id),
ut_dulint_get_low(thr_get_trx(thr)->id),
(unsigned long) ut_dulint_get_high(thr_get_trx(thr)->id),
(unsigned long) ut_dulint_get_low(thr_get_trx(thr)->id),
index->table_name, index->name);
dtuple_print(entry);
}
......@@ -978,7 +978,8 @@ btr_cur_optimistic_insert(
fprintf(stderr,
"InnoDB: Error: cannot insert tuple %s to index %s of table %s\n"
"InnoDB: max insert size %lu\n",
err_buf, index->name, index->table->name, max_size);
err_buf, index->name, index->table->name,
(unsigned long) max_size);
mem_free(err_buf);
}
......@@ -1343,8 +1344,8 @@ btr_cur_update_sec_rec_in_place(
if (btr_cur_print_record_ops && thr) {
printf(
"Trx with id %lu %lu going to update table %s index %s\n",
ut_dulint_get_high(thr_get_trx(thr)->id),
ut_dulint_get_low(thr_get_trx(thr)->id),
(unsigned long) ut_dulint_get_high(thr_get_trx(thr)->id),
(unsigned long) ut_dulint_get_low(thr_get_trx(thr)->id),
index->table_name, index->name);
rec_print(rec);
}
......@@ -1407,8 +1408,8 @@ btr_cur_update_in_place(
if (btr_cur_print_record_ops && thr) {
printf(
"Trx with id %lu %lu going to update table %s index %s\n",
ut_dulint_get_high(thr_get_trx(thr)->id),
ut_dulint_get_low(thr_get_trx(thr)->id),
(unsigned long) ut_dulint_get_high(thr_get_trx(thr)->id),
(unsigned long) ut_dulint_get_low(thr_get_trx(thr)->id),
index->table_name, index->name);
rec_print(rec);
}
......@@ -1509,8 +1510,8 @@ btr_cur_optimistic_update(
if (btr_cur_print_record_ops && thr) {
printf(
"Trx with id %lu %lu going to update table %s index %s\n",
ut_dulint_get_high(thr_get_trx(thr)->id),
ut_dulint_get_low(thr_get_trx(thr)->id),
(unsigned long) ut_dulint_get_high(thr_get_trx(thr)->id),
(unsigned long) ut_dulint_get_low(thr_get_trx(thr)->id),
index->table_name, index->name);
rec_print(rec);
}
......@@ -2059,8 +2060,8 @@ btr_cur_del_mark_set_clust_rec(
if (btr_cur_print_record_ops && thr) {
printf(
"Trx with id %lu %lu going to del mark table %s index %s\n",
ut_dulint_get_high(thr_get_trx(thr)->id),
ut_dulint_get_low(thr_get_trx(thr)->id),
(unsigned long) ut_dulint_get_high(thr_get_trx(thr)->id),
(unsigned long) ut_dulint_get_low(thr_get_trx(thr)->id),
index->table_name, index->name);
rec_print(rec);
}
......@@ -2199,8 +2200,8 @@ btr_cur_del_mark_set_sec_rec(
if (btr_cur_print_record_ops && thr) {
printf(
"Trx with id %lu %lu going to del mark table %s index %s\n",
ut_dulint_get_high(thr_get_trx(thr)->id),
ut_dulint_get_low(thr_get_trx(thr)->id),
(unsigned long) ut_dulint_get_high(thr_get_trx(thr)->id),
(unsigned long) ut_dulint_get_low(thr_get_trx(thr)->id),
cursor->index->table_name, cursor->index->name);
rec_print(rec);
}
......
......@@ -203,7 +203,7 @@ btr_node_ptr_get_child_page_no(
if (page_no == 0) {
fprintf(stderr,
"InnoDB: a nonsensical page number 0 in a node ptr record at offset %lu\n",
(ulint)(rec - buf_frame_align(rec)));
(unsigned long)(rec - buf_frame_align(rec)));
buf_page_print(buf_frame_align(rec));
}
......
......@@ -219,8 +219,8 @@ buf_block_align(
"InnoDB: corruption. If this happens in an InnoDB database recovery,\n"
"InnoDB: you can look from section 6.1 at http://www.innodb.com/ibman.html\n"
"InnoDB: how to force recovery.\n",
(ulint)ptr, (ulint)frame_zero,
(ulint)(buf_pool->high_end));
(long)ptr, (long)frame_zero,
(long)(buf_pool->high_end));
ut_a(0);
}
......@@ -255,8 +255,8 @@ buf_frame_align(
"InnoDB: corruption. If this happens in an InnoDB database recovery,\n"
"InnoDB: you can look from section 6.1 at http://www.innodb.com/ibman.html\n"
"InnoDB: how to force recovery.\n",
(ulint)ptr, (ulint)(buf_pool->frame_zero),
(ulint)(buf_pool->high_end));
(long)ptr, (long)(buf_pool->frame_zero),
(long)(buf_pool->high_end));
ut_a(0);
}
......
......@@ -77,7 +77,7 @@ open_step(
if (err != DB_SUCCESS) {
/* SQL error detected */
printf("SQL error %lu\n", err);
printf("SQL error %lu\n", (unsigned long) err);
ut_error;
que_thr_handle_error(thr, err, NULL, 0);
......
......@@ -86,8 +86,8 @@ upd_field_set_field_no(
fprintf(stderr,
"InnoDB: Error: trying to access field %lu in table %s\n"
"InnoDB: index %s, but index has only %lu fields\n",
field_no, index->table_name, index->name,
dict_index_get_n_fields(index));
(unsigned long) field_no, index->table_name, index->name,
(unsigned long) dict_index_get_n_fields(index));
}
dtype_copy(dfield_get_type(&(upd_field->new_val)),
......
......@@ -63,7 +63,7 @@ trx_rsegf_get_nth_undo(
{
if (n >= TRX_RSEG_N_SLOTS) {
fprintf(stderr,
"InnoDB: Error: trying to get slot %lu of rseg\n", n);
"InnoDB: Error: trying to get slot %lu of rseg\n", (unsigned long) n);
ut_a(0);
}
......@@ -84,7 +84,7 @@ trx_rsegf_set_nth_undo(
{
if (n >= TRX_RSEG_N_SLOTS) {
fprintf(stderr,
"InnoDB: Error: trying to set slot %lu of rseg\n", n);
"InnoDB: Error: trying to set slot %lu of rseg\n", (unsigned long) n);
ut_a(0);
}
......
......@@ -1235,7 +1235,8 @@ opt_print_query_plan(
printf(
"Table %s index %s; exact m. %lu, match %lu, end conds %lu\n",
plan->table->name, plan->index->name,
plan->n_exact_match, n_fields,
UT_LIST_GET_LEN(plan->end_conds));
(unsigned long) plan->n_exact_match,
(unsigned long) n_fields,
(unsigned long) UT_LIST_GET_LEN(plan->end_conds));
}
}
......@@ -513,7 +513,7 @@ que_graph_free_recursive(
if (thr->magic_n != QUE_THR_MAGIC_N) {
fprintf(stderr,
"que_thr struct appears corrupt; magic n %lu\n",
thr->magic_n);
(unsigned long) thr->magic_n);
mem_analyze_corruption((byte*)thr);
ut_a(0);
}
......@@ -625,7 +625,7 @@ que_graph_free_recursive(
default:
fprintf(stderr,
"que_node struct appears corrupt; type %lu\n",
que_node_get_type(node));
(unsigned long) que_node_get_type(node));
mem_analyze_corruption((byte*)node);
ut_a(0);
}
......@@ -1105,7 +1105,8 @@ que_thr_move_to_run_state_for_mysql(
{
if (thr->magic_n != QUE_THR_MAGIC_N) {
fprintf(stderr,
"que_thr struct appears corrupt; magic n %lu\n", thr->magic_n);
"que_thr struct appears corrupt; magic n %lu\n",
(unsigned long) thr->magic_n);
mem_analyze_corruption((byte*)thr);
......@@ -1141,7 +1142,8 @@ que_thr_stop_for_mysql_no_error(
if (thr->magic_n != QUE_THR_MAGIC_N) {
fprintf(stderr,
"que_thr struct appears corrupt; magic n %lu\n", thr->magic_n);
"que_thr struct appears corrupt; magic n %lu\n",
(unsigned long) thr->magic_n);
mem_analyze_corruption((byte*)thr);
......@@ -1216,7 +1218,8 @@ que_node_print_info(
str = (char *) "UNKNOWN NODE TYPE";
}
printf("Node type %lu: %s, address %lx\n", type, str, addr);
printf("Node type %lu: %s, address %lx\n", (unsigned long) type, str,
(unsigned long) addr);
}
/**************************************************************************
......
......@@ -61,10 +61,11 @@ typedef struct st_ftb_expr FTB_EXPR;
struct st_ftb_expr
{
FTB_EXPR *up;
byte *quot, *qend;
my_off_t docid[2]; /* for index search and for scan */
my_off_t docid[2];
/* ^^^^^^^^^^^^^^^^^^ FTB_{EXPR,WORD} common section */
float weight;
float cur_weight;
byte *quot, *qend;
uint flags;
uint yesses; /* number of "yes" words matched */
uint nos; /* number of "no" words matched */
......@@ -77,6 +78,7 @@ typedef struct st_ftb_word
FTB_EXPR *up;
MI_KEYDEF *keyinfo;
my_off_t docid[2]; /* for index search and for scan */
/* ^^^^^^^^^^^^^^^^^^ FTB_{EXPR,WORD} common section */
my_off_t key_root;
float weight;
uint ndepth;
......@@ -299,13 +301,15 @@ static void _ftb_init_index_search(FT_INFO *ftb)
if (ftbw->flags & FTB_FLAG_TRUNC)
{
/*
special treatment for truncation operator :((
1. +trunc* and there're other (not +trunc*) words
special treatment for truncation operator
1. there are some (besides this) +words
| no need to search in the index, it can never ADD new rows
| to the result, and to remove half-matched rows we do scan anyway
2. -trunc*
| same as 1.
3. trunc*
3. in 1 and 2, +/- need not be on the same expr. level,
but can be on any upper level, as in +word +(trunc1* trunc2*)
4. otherwise
| We have to index-search for this prefix.
| It may cause duplicates, as in the index (sorted by <word,docid>)
| <aaaa,row1>
......@@ -313,23 +317,32 @@ static void _ftb_init_index_search(FT_INFO *ftb)
| <aacc,row1>
| Searching for "aa*" will find row1 twice...
*/
if ( test(ftbw->flags&FTB_FLAG_NO) || /* 2 */
(test(ftbw->flags&FTB_FLAG_YES) && /* 1 */
ftbw->up->ythresh - ftbw->up->yweaks >1)) /* 1 */
FTB_EXPR *ftbe;
for (ftbe=(FTB_EXPR*)ftbw;
ftbe->up && !(ftbe->up->flags & FTB_FLAG_TRUNC);
ftbe->up->flags|= FTB_FLAG_TRUNC, ftbe=ftbe->up)
{
if (ftbe->flags & FTB_FLAG_NO || /* 2 */
ftbe->up->ythresh - ftbe->up->yweaks >1) /* 1 */
{
FTB_EXPR *top_ftbe=ftbe->up->up;
ftbw->docid[0]=HA_POS_ERROR;
ftbw->up->yweaks++;
continue;
for (ftbe=ftbw->up; ftbe != top_ftbe; ftbe=ftbe->up)
if (ftbe->flags & FTB_FLAG_YES)
ftbe->yweaks++;
ftbe=0;
break;
}
else /* 3 */
{
}
if (!ftbe)
continue;
/* 3 */
if (!is_tree_inited(& ftb->no_dupes))
init_tree(&ftb->no_dupes,0,0,sizeof(my_off_t),
_ftb_no_dupes_cmp, 0, NULL, NULL);
init_tree(& ftb->no_dupes,0,0,sizeof(my_off_t),
_ftb_no_dupes_cmp,0,0,0);
else
reset_tree(& ftb->no_dupes);
}
}
if (_ft2_search(ftb, ftbw, 1))
return;
......
......@@ -77,6 +77,7 @@ void myisamchk_init(MI_CHECK *param)
param->tmpfile_createflag=O_RDWR | O_TRUNC | O_EXCL;
param->myf_rw=MYF(MY_NABP | MY_WME | MY_WAIT_IF_FULL);
param->start_check_pos=0;
param->max_record_length= LONGLONG_MAX;
param->key_cache_block_size= KEY_CACHE_BLOCK_SIZE;
}
......@@ -523,7 +524,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
if (!(temp_buff=(uchar*) my_alloca((uint) keyinfo->block_length)))
{
mi_check_print_error(param,"Not Enough memory");
mi_check_print_error(param,"Not enough memory for keyblock");
DBUG_RETURN(-1);
}
......@@ -712,7 +713,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
if (!(record= (byte*) my_malloc(info->s->base.pack_reclength,MYF(0))))
{
mi_check_print_error(param,"Not Enough memory");
mi_check_print_error(param,"Not enough memory for record");
DBUG_RETURN(-1);
}
records=del_blocks=0;
......@@ -823,7 +824,8 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
if (info->state->data_file_length < block_info.filepos+
block_info.block_len)
{
mi_check_print_error(param,"Recordlink that points outside datafile at %s",
mi_check_print_error(param,
"Recordlink that points outside datafile at %s",
llstr(pos,llbuff));
got_error=1;
break;
......@@ -835,8 +837,8 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
pos=block_info.filepos+block_info.block_len;
if (block_info.rec_len > (uint) info->s->base.max_pack_length)
{
mi_check_print_error(param,"Found too long record (%d) at %s",
block_info.rec_len,
mi_check_print_error(param,"Found too long record (%lu) at %s",
(ulong) block_info.rec_len,
llstr(start_recpos,llbuff));
got_error=1;
break;
......@@ -846,7 +848,9 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
if (!(to= mi_alloc_rec_buff(info, block_info.rec_len,
&info->rec_buff)))
{
mi_check_print_error(param,"Not enough memory for blob at %s",
mi_check_print_error(param,
"Not enough memory (%lu) for blob at %s",
(ulong) block_info.rec_len,
llstr(start_recpos,llbuff));
got_error=1;
break;
......@@ -858,9 +862,11 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
}
if (left_length < block_info.data_len)
{
mi_check_print_error(param,"Found too long record at %s",
mi_check_print_error(param,"Found too long record (%lu) at %s",
(ulong) block_info.data_len,
llstr(start_recpos,llbuff));
got_error=1; break;
got_error=1;
break;
}
if (_mi_read_cache(&param->read_cache,(byte*) to,block_info.filepos,
(uint) block_info.data_len,
......@@ -1167,7 +1173,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
MYF(0))) ||
!mi_alloc_rec_buff(info, -1, &sort_param.rec_buff))
{
mi_check_print_error(param,"Not enough memory for extra record");
mi_check_print_error(param, "Not enough memory for extra record");
goto err;
}
......@@ -1630,7 +1636,7 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
if (!(buff=(uchar*) my_alloca((uint) keyinfo->block_length)))
{
mi_check_print_error(param,"Not Enough memory");
mi_check_print_error(param,"Not enough memory for key block");
DBUG_RETURN(-1);
}
if (!_mi_fetch_keypage(info,keyinfo,pagepos,DFLT_INIT_HITS,buff,0))
......@@ -1842,7 +1848,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
MYF(0))) ||
!mi_alloc_rec_buff(info, -1, &sort_param.rec_buff))
{
mi_check_print_error(param,"Not enough memory for extra record");
mi_check_print_error(param, "Not enough memory for extra record");
goto err;
}
if (!rep_quick)
......@@ -2278,8 +2284,8 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
rec_length=share->base.min_block_length;
else
rec_length=share->base.pack_reclength;
sort_info.max_records=
/* +1 below is required hack for parallel repair mode.
/*
+1 below is required hack for parallel repair mode.
The info->state->records value, that is compared later
to sort_info.max_records and cannot exceed it, is
increased in sort_key_write. In mi_repair_by_sort, sort_key_write
......@@ -2288,7 +2294,9 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
before some other repair thread calls sort_key_read.
Furthermore I'm not even sure +1 would be enough.
May be sort_info.max_records shold be always set to max value in
parallel mode. */
parallel mode.
*/
sort_info.max_records=
((param->testflag & T_CREATE_MISSING_KEYS) ? info->state->records + 1:
(ha_rows) (sort_info.filelength/rec_length+1));
......@@ -2302,7 +2310,7 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
(sizeof(MI_SORT_PARAM) + share->base.pack_reclength),
MYF(MY_ZEROFILL))))
{
mi_check_print_error(param,"Not enough memory!");
mi_check_print_error(param,"Not enough memory for key!");
goto err;
}
total_key_length=0;
......@@ -2857,25 +2865,38 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
{
if (!(to=mi_alloc_rec_buff(info,block_info.rec_len,
&(sort_param->rec_buff))))
{
if (param->max_record_length >= block_info.rec_len)
{
mi_check_print_error(param,"Not enough memory for blob at %s (need %lu)",
llstr(sort_param->start_recpos,llbuff), block_info.rec_len);
llstr(sort_param->start_recpos,llbuff),
(ulong) block_info.rec_len);
DBUG_RETURN(1);
}
else
{
mi_check_print_info(param,"Not enough memory for blob at %s (need %lu); Row skipped",
llstr(sort_param->start_recpos,llbuff),
(ulong) block_info.rec_len);
goto try_next;
}
}
}
else
to= sort_param->rec_buff;
}
if (left_length < block_info.data_len || ! block_info.data_len)
{
mi_check_print_info(param,"Found block with too small length at %s; Skipped",
mi_check_print_info(param,
"Found block with too small length at %s; Skipped",
llstr(sort_param->start_recpos,llbuff));
goto try_next;
}
if (block_info.filepos + block_info.data_len >
sort_param->read_cache.end_of_file)
{
mi_check_print_info(param,"Found block that points outside data file at %s",
mi_check_print_info(param,
"Found block that points outside data file at %s",
llstr(sort_param->start_recpos,llbuff));
goto try_next;
}
......@@ -3510,7 +3531,7 @@ static SORT_KEY_BLOCKS *alloc_key_blocks(MI_CHECK *param, uint blocks,
buffer_length+IO_SIZE)*blocks,
MYF(0))))
{
mi_check_print_error(param,"Not Enough memory for sort-key-blocks");
mi_check_print_error(param,"Not enough memory for sort-key-blocks");
return(0);
}
for (i=0 ; i < blocks ; i++)
......
......@@ -110,7 +110,8 @@ int main(int argc, char **argv)
VOID(fflush(stderr));
if ((check_param.error_printed | check_param.warning_printed) &&
(check_param.testflag & T_FORCE_CREATE) &&
(!(check_param.testflag & (T_REP | T_SORT_RECORDS | T_SORT_INDEX))))
(!(check_param.testflag & (T_REP | T_REP_BY_SORT | T_SORT_RECORDS |
T_SORT_INDEX))))
{
uint old_testflag=check_param.testflag;
if (!(check_param.testflag & T_REP))
......@@ -153,7 +154,7 @@ enum options_mc {
OPT_KEY_CACHE_BLOCK_SIZE, OPT_MYISAM_BLOCK_SIZE,
OPT_READ_BUFFER_SIZE, OPT_WRITE_BUFFER_SIZE, OPT_SORT_BUFFER_SIZE,
OPT_SORT_KEY_BLOCKS, OPT_DECODE_BITS, OPT_FT_MIN_WORD_LEN,
OPT_FT_MAX_WORD_LEN, OPT_FT_MAX_WORD_LEN_FOR_SORT
OPT_FT_MAX_WORD_LEN, OPT_FT_MAX_WORD_LEN_FOR_SORT, OPT_MAX_RECORD_LENGTH
};
static struct my_option my_long_options[] =
......@@ -215,6 +216,11 @@ static struct my_option my_long_options[] =
(gptr*) &check_param.keys_in_use,
(gptr*) &check_param.keys_in_use,
0, GET_ULL, REQUIRED_ARG, -1, 0, 0, 0, 0, 0},
{"max-record-length", OPT_MAX_RECORD_LENGTH,
"Skip rows bigger than this if myisamchk can't allocate memory to hold it",
(gptr*) &check_param.max_record_length,
(gptr*) &check_param.max_record_length,
0, GET_ULL, REQUIRED_ARG, LONGLONG_MAX, 0, LONGLONG_MAX, 0, 0, 0},
{"medium-check", 'm',
"Faster than extend-check, but only finds 99.99% of all errors. Should be good enough for most cases.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
......@@ -327,7 +333,7 @@ static struct my_option my_long_options[] =
static void print_version(void)
{
printf("%s Ver 2.6 for %s at %s\n", my_progname, SYSTEM_TYPE,
printf("%s Ver 2.7 for %s at %s\n", my_progname, SYSTEM_TYPE,
MACHINE_TYPE);
}
......@@ -394,6 +400,9 @@ static void usage(void)
-k, --keys-used=# Tell MyISAM to update only some specific keys. # is a\n\
bit mask of which keys to use. This can be used to\n\
get faster inserts.\n\
--max-record-length=#\n\
Skip rows bigger than this if myisamchk can't allocate\n\
memory to hold it.\n\
-r, --recover Can fix almost anything except unique keys that aren't\n\
unique.\n\
-n, --sort-recover Forces recovering with sorting even if the temporary\n\
......
drop table if exists t1,t2,t3;
drop database if exists test_$1;
create table t1 (b char(0));
insert into t1 values (""),(null);
select * from t1;
......@@ -302,9 +303,6 @@ t3 CREATE TABLE `t3` (
select * from t3;
id name
drop table t2, t3;
drop database if exists test_$1;
Warnings:
Note 1008 Can't drop database 'test_$1'; database doesn't exist
create database test_$1;
create table test_$1.t3 like t1;
create temporary table t3 like test_$1.t3;
......@@ -411,7 +409,6 @@ a b c d e f g h dd
1 -7 7 2000-01-01 b 2000-01-01 00:00:00 05:04:03 yet another binary data 02:00:00
2 -2 2 1825-12-14 a 2003-01-01 03:02:01 04:03:02 binary data 02:00:00
drop table t1, t2;
drop database if exists test_$1;
create database test_$1;
use test_$1;
select database();
......
......@@ -161,6 +161,23 @@ Only MyISAM tables support collections
Function MATCH ... AGAINST() is used to do a search
some test foobar implements vector space model
drop table t1;
create table t1 (a varchar(200) not null, fulltext (a));
insert t1 values ("aaa10 bbb20"), ("aaa20 bbb15"), ("aaa30 bbb10");
select * from t1 where match a against ("+aaa* +bbb*" in boolean mode);
a
aaa10 bbb20
aaa20 bbb15
aaa30 bbb10
select * from t1 where match a against ("+aaa* +bbb1*" in boolean mode);
a
aaa20 bbb15
aaa30 bbb10
select * from t1 where match a against ("+aaa* +ccc*" in boolean mode);
a
select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode);
a
aaa10 bbb20
drop table t1;
CREATE TABLE t1 (
id int(11),
ticket int(11),
......
......@@ -41,4 +41,12 @@ venue_id venue_text dt name entity_id
select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen') and dt = '2003-05-23 19:30:00';
venue_id venue_text dt name entity_id
1 a1 2003-05-23 19:30:00 aberdeen town hall 1
select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen' in boolean mode)) where dt = '2003-05-23 19:30:00';
venue_id venue_text dt name entity_id
1 a1 2003-05-23 19:30:00 aberdeen town hall 1
NULL a2 2003-05-23 19:30:00 NULL NULL
select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen')) where dt = '2003-05-23 19:30:00';
venue_id venue_text dt name entity_id
1 a1 2003-05-23 19:30:00 aberdeen town hall 1
NULL a2 2003-05-23 19:30:00 NULL NULL
drop table t1,t2;
......@@ -4,6 +4,7 @@
--disable_warnings
drop table if exists t1,t2,t3;
drop database if exists test_$1;
--enable_warnings
create table t1 (b char(0));
......@@ -57,6 +58,7 @@ select 1ea10.1a20,1e+ 1e+10 from 1ea10;
drop table 1ea10;
create table t1 (t1.index int);
drop table t1;
# Test that we get warning for this
drop database if exists test_$1;
create database test_$1;
create table test_$1.$test1 (a$1 int, $b int, c$ int);
......@@ -245,7 +247,6 @@ drop table t3;
show create table t3;
select * from t3;
drop table t2, t3;
drop database if exists test_$1;
create database test_$1;
create table test_$1.t3 like t1;
create temporary table t3 like test_$1.t3;
......@@ -326,9 +327,6 @@ drop table t1, t2;
# Bug #1209
#
--disable_warnings
drop database if exists test_$1;
--enable_warnings
create database test_$1;
use test_$1;
select database();
......
......@@ -80,6 +80,17 @@ delete from t1 where MATCH(a,b) AGAINST ("indexes");
select * from t1;
drop table t1;
#
# why to scan strings for trunc*
#
create table t1 (a varchar(200) not null, fulltext (a));
insert t1 values ("aaa10 bbb20"), ("aaa20 bbb15"), ("aaa30 bbb10");
select * from t1 where match a against ("+aaa* +bbb*" in boolean mode);
select * from t1 where match a against ("+aaa* +bbb1*" in boolean mode);
select * from t1 where match a against ("+aaa* +ccc*" in boolean mode);
select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode);
drop table t1;
#
# Check bug reported by Matthias Urlichs
#
......
......@@ -41,5 +41,7 @@ create table t2 (name varchar(255) not null default '', entity_id int(11) not nu
insert into t2 (name, entity_id) values ('aberdeen town hall', 1), ('glasgow royal concert hall', 2), ('queen\'s hall, edinburgh', 3);
select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen' in boolean mode) and dt = '2003-05-23 19:30:00';
select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen') and dt = '2003-05-23 19:30:00';
select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen' in boolean mode)) where dt = '2003-05-23 19:30:00';
select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen')) where dt = '2003-05-23 19:30:00';
drop table t1,t2;
......@@ -1536,7 +1536,7 @@ ha_innobase::open(
fprintf(stderr,
"InnoDB: Warning: table %s key_used_on_scan is %lu even though there is no\n"
"InnoDB: primary key inside InnoDB.\n",
name, (ulint)key_used_on_scan);
name, (ulong)key_used_on_scan);
}
}
......@@ -3216,7 +3216,7 @@ ha_innobase::position(
if (len != ref_length) {
fprintf(stderr,
"InnoDB: Error: stored ref len is %lu, but table ref len is %lu\n",
(ulint)len, (ulint)ref_length);
(ulong)len, (ulong)ref_length);
}
}
......@@ -4187,7 +4187,8 @@ ha_innobase::info(
"InnoDB: .frm files from different installations? See section\n"
"InnoDB: 15.1 at http://www.innodb.com/ibman.html\n",
index->name,
ib_table->name, index->n_uniq,
ib_table->name,
(unsigned long) index->n_uniq,
j + 1);
break;
}
......
......@@ -2701,6 +2701,7 @@ void Item_func_match::init_search(bool no_order)
bool Item_func_match::fix_fields(THD *thd, TABLE_LIST *tlist, Item **ref)
{
Item *item;
LINT_INIT(item); // Safe as arg_count is > 1
maybe_null=1;
join_key=0;
......
This diff is collapsed.
......@@ -37,7 +37,7 @@
#define LONG ulonglong
#endif
void bmove512(register gptr to, register const gptr from, register uint length)
void bmove512(gptr to, const gptr from, register uint length)
{
reg1 LONG *f,*t,*end= (LONG*) ((char*) from+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