Commit ce44db9f authored by unknown's avatar unknown

Fixed compiler warnings from Intel compiler in Win64

Added option --max-record-length=# to myisamchk
Don't try repair twice if doing myisamchk --repair --force
Shared memory handler didn't clean up things on errors or shutdown


VC++Files/libmysqltest/mytest.c:
  Fixed compiler warnings from Intel compiler
include/myisam.h:
  Added option --max-record-length=# to myisamchk
include/mysql_com.h:
  Fixed compiler warnings from Intel compiler
innobase/btr/btr0btr.c:
  Fixed compiler warnings from Intel compiler
innobase/btr/btr0cur.c:
  Fixed compiler warnings from Intel compiler
innobase/include/btr0btr.ic:
  Fixed compiler warnings from Intel compiler
innobase/include/buf0buf.ic:
  Fixed compiler warnings from Intel compiler
innobase/include/row0sel.ic:
  Fixed compiler warnings from Intel compiler
innobase/include/row0upd.ic:
  Fixed compiler warnings from Intel compiler
innobase/include/trx0rseg.ic:
  Fixed compiler warnings from Intel compiler
innobase/pars/pars0opt.c:
  Fixed compiler warnings from Intel compiler
innobase/que/que0que.c:
  Fixed compiler warnings from Intel compiler
myisam/mi_check.c:
  Added option --max-record-length=# to myisamchk
  Better error messages
myisam/myisamchk.c:
  Added option --max-record-length=# to myisamchk
  Don't try repair twice if doing myisamchk --repair --force
mysql-test/r/create.result:
  Updated test results
mysql-test/t/create.test:
  Better initialization
sql/ha_innodb.cc:
  Fixed compiler warnings from Intel compiler
sql/item_func.cc:
  Fixed compiler warnings from Intel compiler
sql/mysqld.cc:
  Fixed compiler warnings from Intel compiler
  Cleaned up handle_connections_shared_memory
  Shared memory handler didn't clean up things on errors or shutdown
strings/bmove512.c:
  Fixed compiler warnings from Intel compiler
parent b1a563c3
...@@ -40,7 +40,7 @@ main( int argc, char * argv[] ) ...@@ -40,7 +40,7 @@ main( int argc, char * argv[] )
MYSQL_ROW row ; MYSQL_ROW row ;
//....just curious.... //....just curious....
printf( "sizeof( MYSQL ) == %d\n", sizeof( MYSQL ) ) ; printf( "sizeof( MYSQL ) == %d\n", (int) sizeof( MYSQL ) ) ;
if ( argc == 2 ) if ( argc == 2 )
{ {
strcpy( szDB, argv[ 1 ] ) ; strcpy( szDB, argv[ 1 ] ) ;
...@@ -49,27 +49,31 @@ main( int argc, char * argv[] ) ...@@ -49,27 +49,31 @@ main( int argc, char * argv[] )
{ {
strcpy( szDB, "mysql" ) ; strcpy( szDB, "mysql" ) ;
printf("Some mysql struct information (size and offset):\n"); printf("Some mysql struct information (size and offset):\n");
printf("net:\t%3d %3d\n",sizeof(myData->net),offsetof(MYSQL,net)); printf("net:\t%3d %3d\n",(int) sizeof(myData->net),
printf("host:\t%3d %3d\n",sizeof(myData->host),offsetof(MYSQL,host)); (int) offsetof(MYSQL,net));
printf("port:\t%3d %3d\n",sizeof(myData->port),offsetof(MYSQL,port)); printf("host:\t%3d %3d\n",(int) sizeof(myData->host),
printf("protocol_version:\t%3d %3d\n",sizeof(myData->protocol_version), (int) offsetof(MYSQL,host));
offsetof(MYSQL,protocol_version)); printf("port:\t%3d %3d\n", (int) sizeof(myData->port),
printf("thread_id:\t%3d %3d\n",sizeof(myData->thread_id), (int) offsetof(MYSQL,port));
offsetof(MYSQL,thread_id)); printf("protocol_version:\t%3d %3d\n",
printf("affected_rows:\t%3d %3d\n",sizeof(myData->affected_rows), (int) sizeof(myData->protocol_version),
offsetof(MYSQL,affected_rows)); (int) offsetof(MYSQL,protocol_version));
printf("packet_length:\t%3d %3d\n",sizeof(myData->packet_length), printf("thread_id:\t%3d %3d\n",(int) sizeof(myData->thread_id),
offsetof(MYSQL,packet_length)); (int) offsetof(MYSQL,thread_id));
printf("status:\t%3d %3d\n",sizeof(myData->status), printf("affected_rows:\t%3d %3d\n",(int) sizeof(myData->affected_rows),
offsetof(MYSQL,status)); (int) offsetof(MYSQL,affected_rows));
printf("fields:\t%3d %3d\n",sizeof(myData->fields), printf("packet_length:\t%3d %3d\n",(int) sizeof(myData->packet_length),
offsetof(MYSQL,fields)); (int) offsetof(MYSQL,packet_length));
printf("field_alloc:\t%3d %3d\n",sizeof(myData->field_alloc), printf("status:\t%3d %3d\n",(int) sizeof(myData->status),
offsetof(MYSQL,field_alloc)); (int) offsetof(MYSQL,status));
printf("free_me:\t%3d %3d\n",sizeof(myData->free_me), printf("fields:\t%3d %3d\n",(int) sizeof(myData->fields),
offsetof(MYSQL,free_me)); (int) offsetof(MYSQL,fields));
printf("options:\t%3d %3d\n",sizeof(myData->options), printf("field_alloc:\t%3d %3d\n",(int) sizeof(myData->field_alloc),
offsetof(MYSQL,options)); (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(""); puts("");
} }
} }
......
...@@ -318,6 +318,7 @@ typedef struct st_mi_check_param ...@@ -318,6 +318,7 @@ typedef struct st_mi_check_param
ulonglong auto_increment_value; ulonglong auto_increment_value;
ulonglong max_data_file_length; ulonglong max_data_file_length;
ulonglong keys_in_use; ulonglong keys_in_use;
ulonglong max_record_length;
my_off_t search_after_block; my_off_t search_after_block;
my_off_t new_file_pos,key_file_blocks; my_off_t new_file_pos,key_file_blocks;
my_off_t keydata,totaldata,key_blocks,start_check_pos; my_off_t keydata,totaldata,key_blocks,start_check_pos;
......
...@@ -118,7 +118,7 @@ enum enum_server_command ...@@ -118,7 +118,7 @@ enum enum_server_command
#define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */ #define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */
#define CLIENT_MULTI_STATEMENTS 65536 /* Enable/disable multi-stmt support */ #define CLIENT_MULTI_STATEMENTS 65536 /* Enable/disable multi-stmt support */
#define CLIENT_MULTI_RESULTS 131072 /* Enable/disable multi-results */ #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_IN_TRANS 1 /* Transaction has started */
#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */ #define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */
......
...@@ -600,8 +600,8 @@ btr_page_get_father_for_rec( ...@@ -600,8 +600,8 @@ btr_page_get_father_for_rec(
"InnoDB: father ptr page no %lu, child page no %lu\n", "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))->table_name,
(UT_LIST_GET_FIRST(tree->tree_indexes))->name, (UT_LIST_GET_FIRST(tree->tree_indexes))->name,
btr_node_ptr_get_child_page_no(node_ptr), (unsigned long) btr_node_ptr_get_child_page_no(node_ptr),
buf_frame_get_page_no(page)); (unsigned long) buf_frame_get_page_no(page));
page_rec_print(page_rec_get_next(page_get_infimum_rec(page))); page_rec_print(page_rec_get_next(page_get_infimum_rec(page)));
page_rec_print(node_ptr); page_rec_print(node_ptr);
...@@ -877,7 +877,9 @@ btr_page_reorganize_low( ...@@ -877,7 +877,9 @@ btr_page_reorganize_low(
"InnoDB: Error: page old data size %lu new data size %lu\n" "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: 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", "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); buf_frame_free(new_page);
...@@ -2356,8 +2358,10 @@ btr_index_rec_validate( ...@@ -2356,8 +2358,10 @@ btr_index_rec_validate(
"InnoDB: Record in index %s in table %s, page %lu, at offset %lu\n" "InnoDB: Record in index %s in table %s, page %lu, at offset %lu\n"
"InnoDB: has %lu fields, should have %lu\n", "InnoDB: has %lu fields, should have %lu\n",
index->name, index->table_name, index->name, index->table_name,
buf_frame_get_page_no(page), (ulint)(rec - page), (unsigned long) buf_frame_get_page_no(page),
rec_get_n_fields(rec), n); (unsigned long) (rec - page),
(unsigned long) rec_get_n_fields(rec),
(unsigned long) n);
if (!dump_on_error) { if (!dump_on_error) {
...@@ -2390,9 +2394,11 @@ btr_index_rec_validate( ...@@ -2390,9 +2394,11 @@ btr_index_rec_validate(
"InnoDB: Record in index %s in table %s, page %lu, at offset %lu\n" "InnoDB: Record in index %s in table %s, page %lu, at offset %lu\n"
"InnoDB: field %lu len is %lu, should be %lu\n", "InnoDB: field %lu len is %lu, should be %lu\n",
index->name, index->table_name, index->name, index->table_name,
buf_frame_get_page_no(page), (unsigned long) buf_frame_get_page_no(page),
(ulint)(rec - page), (unsigned long) (rec - page),
i, len, dtype_get_fixed_size(type)); (unsigned long) i,
(unsigned long) len,
(unsigned long) dtype_get_fixed_size(type));
if (!dump_on_error) { if (!dump_on_error) {
...@@ -2541,7 +2547,7 @@ loop: ...@@ -2541,7 +2547,7 @@ loop:
fprintf(stderr, fprintf(stderr,
"InnoDB: Error on pages %lu and %lu in index %s table %s\n", "InnoDB: Error on pages %lu and %lu in index %s table %s\n",
buf_frame_get_page_no(page), buf_frame_get_page_no(page),
right_page_no, (unsigned long) right_page_no,
index->name, index->table_name); index->name, index->table_name);
fprintf(stderr, fprintf(stderr,
...@@ -2581,7 +2587,7 @@ loop: ...@@ -2581,7 +2587,7 @@ loop:
&mtr)) { &mtr)) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error on page %lu in index %s table %s\n", "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); index->name, index->table_name);
fprintf(stderr, fprintf(stderr,
...@@ -2596,7 +2602,7 @@ loop: ...@@ -2596,7 +2602,7 @@ loop:
fprintf(stderr, fprintf(stderr,
"InnoDB: node ptr child page n:o %lu\n", "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, rec_sprintf(err_buf, 900,
btr_page_get_father_for_rec(tree, page, btr_page_get_father_for_rec(tree, page,
...@@ -2679,7 +2685,7 @@ loop: ...@@ -2679,7 +2685,7 @@ loop:
fprintf(stderr, fprintf(stderr,
"InnoDB: Error on page %lu in index %s table %s\n", "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); index->name, index->table_name);
buf_page_print(father_page); buf_page_print(father_page);
...@@ -2699,7 +2705,7 @@ loop: ...@@ -2699,7 +2705,7 @@ loop:
fprintf(stderr, fprintf(stderr,
"InnoDB: Error on page %lu in index %s table %s\n", "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); index->name, index->table_name);
buf_page_print(father_page); buf_page_print(father_page);
...@@ -2717,7 +2723,7 @@ loop: ...@@ -2717,7 +2723,7 @@ loop:
fprintf(stderr, fprintf(stderr,
"InnoDB: Error on page %lu in index %s table %s\n", "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); index->name, index->table_name);
buf_page_print(father_page); buf_page_print(father_page);
......
...@@ -874,8 +874,8 @@ btr_cur_optimistic_insert( ...@@ -874,8 +874,8 @@ btr_cur_optimistic_insert(
if (btr_cur_print_record_ops && thr) { if (btr_cur_print_record_ops && thr) {
printf( printf(
"Trx with id %lu %lu going to insert to table %s index %s\n", "Trx with id %lu %lu going to insert to table %s index %s\n",
ut_dulint_get_high(thr_get_trx(thr)->id), (unsigned long) ut_dulint_get_high(thr_get_trx(thr)->id),
ut_dulint_get_low(thr_get_trx(thr)->id), (unsigned long) ut_dulint_get_low(thr_get_trx(thr)->id),
index->table_name, index->name); index->table_name, index->name);
dtuple_print(entry); dtuple_print(entry);
} }
...@@ -978,7 +978,8 @@ calculate_sizes_again: ...@@ -978,7 +978,8 @@ calculate_sizes_again:
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: cannot insert tuple %s to index %s of table %s\n" "InnoDB: Error: cannot insert tuple %s to index %s of table %s\n"
"InnoDB: max insert size %lu\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); mem_free(err_buf);
} }
...@@ -1343,8 +1344,8 @@ btr_cur_update_sec_rec_in_place( ...@@ -1343,8 +1344,8 @@ btr_cur_update_sec_rec_in_place(
if (btr_cur_print_record_ops && thr) { if (btr_cur_print_record_ops && thr) {
printf( printf(
"Trx with id %lu %lu going to update table %s index %s\n", "Trx with id %lu %lu going to update table %s index %s\n",
ut_dulint_get_high(thr_get_trx(thr)->id), (unsigned long) ut_dulint_get_high(thr_get_trx(thr)->id),
ut_dulint_get_low(thr_get_trx(thr)->id), (unsigned long) ut_dulint_get_low(thr_get_trx(thr)->id),
index->table_name, index->name); index->table_name, index->name);
rec_print(rec); rec_print(rec);
} }
...@@ -1407,8 +1408,8 @@ btr_cur_update_in_place( ...@@ -1407,8 +1408,8 @@ btr_cur_update_in_place(
if (btr_cur_print_record_ops && thr) { if (btr_cur_print_record_ops && thr) {
printf( printf(
"Trx with id %lu %lu going to update table %s index %s\n", "Trx with id %lu %lu going to update table %s index %s\n",
ut_dulint_get_high(thr_get_trx(thr)->id), (unsigned long) ut_dulint_get_high(thr_get_trx(thr)->id),
ut_dulint_get_low(thr_get_trx(thr)->id), (unsigned long) ut_dulint_get_low(thr_get_trx(thr)->id),
index->table_name, index->name); index->table_name, index->name);
rec_print(rec); rec_print(rec);
} }
...@@ -1509,8 +1510,8 @@ btr_cur_optimistic_update( ...@@ -1509,8 +1510,8 @@ btr_cur_optimistic_update(
if (btr_cur_print_record_ops && thr) { if (btr_cur_print_record_ops && thr) {
printf( printf(
"Trx with id %lu %lu going to update table %s index %s\n", "Trx with id %lu %lu going to update table %s index %s\n",
ut_dulint_get_high(thr_get_trx(thr)->id), (unsigned long) ut_dulint_get_high(thr_get_trx(thr)->id),
ut_dulint_get_low(thr_get_trx(thr)->id), (unsigned long) ut_dulint_get_low(thr_get_trx(thr)->id),
index->table_name, index->name); index->table_name, index->name);
rec_print(rec); rec_print(rec);
} }
...@@ -2059,8 +2060,8 @@ btr_cur_del_mark_set_clust_rec( ...@@ -2059,8 +2060,8 @@ btr_cur_del_mark_set_clust_rec(
if (btr_cur_print_record_ops && thr) { if (btr_cur_print_record_ops && thr) {
printf( printf(
"Trx with id %lu %lu going to del mark table %s index %s\n", "Trx with id %lu %lu going to del mark table %s index %s\n",
ut_dulint_get_high(thr_get_trx(thr)->id), (unsigned long) ut_dulint_get_high(thr_get_trx(thr)->id),
ut_dulint_get_low(thr_get_trx(thr)->id), (unsigned long) ut_dulint_get_low(thr_get_trx(thr)->id),
index->table_name, index->name); index->table_name, index->name);
rec_print(rec); rec_print(rec);
} }
...@@ -2199,8 +2200,8 @@ btr_cur_del_mark_set_sec_rec( ...@@ -2199,8 +2200,8 @@ btr_cur_del_mark_set_sec_rec(
if (btr_cur_print_record_ops && thr) { if (btr_cur_print_record_ops && thr) {
printf( printf(
"Trx with id %lu %lu going to del mark table %s index %s\n", "Trx with id %lu %lu going to del mark table %s index %s\n",
ut_dulint_get_high(thr_get_trx(thr)->id), (unsigned long) ut_dulint_get_high(thr_get_trx(thr)->id),
ut_dulint_get_low(thr_get_trx(thr)->id), (unsigned long) ut_dulint_get_low(thr_get_trx(thr)->id),
cursor->index->table_name, cursor->index->name); cursor->index->table_name, cursor->index->name);
rec_print(rec); rec_print(rec);
} }
......
...@@ -203,7 +203,7 @@ btr_node_ptr_get_child_page_no( ...@@ -203,7 +203,7 @@ btr_node_ptr_get_child_page_no(
if (page_no == 0) { if (page_no == 0) {
fprintf(stderr, fprintf(stderr,
"InnoDB: a nonsensical page number 0 in a node ptr record at offset %lu\n", "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)); buf_page_print(buf_frame_align(rec));
} }
......
...@@ -219,8 +219,8 @@ buf_block_align( ...@@ -219,8 +219,8 @@ buf_block_align(
"InnoDB: corruption. If this happens in an InnoDB database recovery,\n" "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: you can look from section 6.1 at http://www.innodb.com/ibman.html\n"
"InnoDB: how to force recovery.\n", "InnoDB: how to force recovery.\n",
(ulint)ptr, (ulint)frame_zero, (long)ptr, (long)frame_zero,
(ulint)(buf_pool->high_end)); (long)(buf_pool->high_end));
ut_a(0); ut_a(0);
} }
...@@ -255,8 +255,8 @@ buf_frame_align( ...@@ -255,8 +255,8 @@ buf_frame_align(
"InnoDB: corruption. If this happens in an InnoDB database recovery,\n" "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: you can look from section 6.1 at http://www.innodb.com/ibman.html\n"
"InnoDB: how to force recovery.\n", "InnoDB: how to force recovery.\n",
(ulint)ptr, (ulint)(buf_pool->frame_zero), (long)ptr, (long)(buf_pool->frame_zero),
(ulint)(buf_pool->high_end)); (long)(buf_pool->high_end));
ut_a(0); ut_a(0);
} }
......
...@@ -77,7 +77,7 @@ open_step( ...@@ -77,7 +77,7 @@ open_step(
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
/* SQL error detected */ /* SQL error detected */
printf("SQL error %lu\n", err); printf("SQL error %lu\n", (unsigned long) err);
ut_error; ut_error;
que_thr_handle_error(thr, err, NULL, 0); que_thr_handle_error(thr, err, NULL, 0);
......
...@@ -86,8 +86,8 @@ upd_field_set_field_no( ...@@ -86,8 +86,8 @@ upd_field_set_field_no(
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: trying to access field %lu in table %s\n" "InnoDB: Error: trying to access field %lu in table %s\n"
"InnoDB: index %s, but index has only %lu fields\n", "InnoDB: index %s, but index has only %lu fields\n",
field_no, index->table_name, index->name, (unsigned long) field_no, index->table_name, index->name,
dict_index_get_n_fields(index)); (unsigned long) dict_index_get_n_fields(index));
} }
dtype_copy(dfield_get_type(&(upd_field->new_val)), dtype_copy(dfield_get_type(&(upd_field->new_val)),
......
...@@ -63,7 +63,7 @@ trx_rsegf_get_nth_undo( ...@@ -63,7 +63,7 @@ trx_rsegf_get_nth_undo(
{ {
if (n >= TRX_RSEG_N_SLOTS) { if (n >= TRX_RSEG_N_SLOTS) {
fprintf(stderr, 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); ut_a(0);
} }
...@@ -84,7 +84,7 @@ trx_rsegf_set_nth_undo( ...@@ -84,7 +84,7 @@ trx_rsegf_set_nth_undo(
{ {
if (n >= TRX_RSEG_N_SLOTS) { if (n >= TRX_RSEG_N_SLOTS) {
fprintf(stderr, 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); ut_a(0);
} }
......
...@@ -1235,7 +1235,8 @@ opt_print_query_plan( ...@@ -1235,7 +1235,8 @@ opt_print_query_plan(
printf( printf(
"Table %s index %s; exact m. %lu, match %lu, end conds %lu\n", "Table %s index %s; exact m. %lu, match %lu, end conds %lu\n",
plan->table->name, plan->index->name, plan->table->name, plan->index->name,
plan->n_exact_match, n_fields, (unsigned long) plan->n_exact_match,
UT_LIST_GET_LEN(plan->end_conds)); (unsigned long) n_fields,
(unsigned long) UT_LIST_GET_LEN(plan->end_conds));
} }
} }
...@@ -513,7 +513,7 @@ que_graph_free_recursive( ...@@ -513,7 +513,7 @@ que_graph_free_recursive(
if (thr->magic_n != QUE_THR_MAGIC_N) { if (thr->magic_n != QUE_THR_MAGIC_N) {
fprintf(stderr, fprintf(stderr,
"que_thr struct appears corrupt; magic n %lu\n", "que_thr struct appears corrupt; magic n %lu\n",
thr->magic_n); (unsigned long) thr->magic_n);
mem_analyze_corruption((byte*)thr); mem_analyze_corruption((byte*)thr);
ut_a(0); ut_a(0);
} }
...@@ -625,7 +625,7 @@ que_graph_free_recursive( ...@@ -625,7 +625,7 @@ que_graph_free_recursive(
default: default:
fprintf(stderr, fprintf(stderr,
"que_node struct appears corrupt; type %lu\n", "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); mem_analyze_corruption((byte*)node);
ut_a(0); ut_a(0);
} }
...@@ -1105,7 +1105,8 @@ que_thr_move_to_run_state_for_mysql( ...@@ -1105,7 +1105,8 @@ que_thr_move_to_run_state_for_mysql(
{ {
if (thr->magic_n != QUE_THR_MAGIC_N) { if (thr->magic_n != QUE_THR_MAGIC_N) {
fprintf(stderr, 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); mem_analyze_corruption((byte*)thr);
...@@ -1141,7 +1142,8 @@ que_thr_stop_for_mysql_no_error( ...@@ -1141,7 +1142,8 @@ que_thr_stop_for_mysql_no_error(
if (thr->magic_n != QUE_THR_MAGIC_N) { if (thr->magic_n != QUE_THR_MAGIC_N) {
fprintf(stderr, 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); mem_analyze_corruption((byte*)thr);
...@@ -1216,7 +1218,8 @@ que_node_print_info( ...@@ -1216,7 +1218,8 @@ que_node_print_info(
str = (char *) "UNKNOWN NODE TYPE"; 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);
} }
/************************************************************************** /**************************************************************************
......
...@@ -77,6 +77,7 @@ void myisamchk_init(MI_CHECK *param) ...@@ -77,6 +77,7 @@ void myisamchk_init(MI_CHECK *param)
param->tmpfile_createflag=O_RDWR | O_TRUNC | O_EXCL; param->tmpfile_createflag=O_RDWR | O_TRUNC | O_EXCL;
param->myf_rw=MYF(MY_NABP | MY_WME | MY_WAIT_IF_FULL); param->myf_rw=MYF(MY_NABP | MY_WME | MY_WAIT_IF_FULL);
param->start_check_pos=0; param->start_check_pos=0;
param->max_record_length= LONGLONG_MAX;
param->key_cache_block_size= KEY_CACHE_BLOCK_SIZE; 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, ...@@ -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))) 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); DBUG_RETURN(-1);
} }
...@@ -712,7 +713,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) ...@@ -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)))) 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); DBUG_RETURN(-1);
} }
records=del_blocks=0; records=del_blocks=0;
...@@ -823,7 +824,8 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) ...@@ -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+ if (info->state->data_file_length < block_info.filepos+
block_info.block_len) 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)); llstr(pos,llbuff));
got_error=1; got_error=1;
break; break;
...@@ -835,8 +837,8 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) ...@@ -835,8 +837,8 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
pos=block_info.filepos+block_info.block_len; pos=block_info.filepos+block_info.block_len;
if (block_info.rec_len > (uint) info->s->base.max_pack_length) if (block_info.rec_len > (uint) info->s->base.max_pack_length)
{ {
mi_check_print_error(param,"Found too long record (%d) at %s", mi_check_print_error(param,"Found too long record (%lu) at %s",
block_info.rec_len, (ulong) block_info.rec_len,
llstr(start_recpos,llbuff)); llstr(start_recpos,llbuff));
got_error=1; got_error=1;
break; break;
...@@ -846,7 +848,9 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) ...@@ -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, if (!(to= mi_alloc_rec_buff(info, block_info.rec_len,
&info->rec_buff))) &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)); llstr(start_recpos,llbuff));
got_error=1; got_error=1;
break; break;
...@@ -858,9 +862,11 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) ...@@ -858,9 +862,11 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
} }
if (left_length < block_info.data_len) 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)); llstr(start_recpos,llbuff));
got_error=1; break; got_error=1;
break;
} }
if (_mi_read_cache(&param->read_cache,(byte*) to,block_info.filepos, if (_mi_read_cache(&param->read_cache,(byte*) to,block_info.filepos,
(uint) block_info.data_len, (uint) block_info.data_len,
...@@ -1167,7 +1173,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info, ...@@ -1167,7 +1173,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
MYF(0))) || MYF(0))) ||
!mi_alloc_rec_buff(info, -1, &sort_param.rec_buff)) !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; goto err;
} }
...@@ -1630,7 +1636,7 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, ...@@ -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))) 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); DBUG_RETURN(-1);
} }
if (!_mi_fetch_keypage(info,keyinfo,pagepos,DFLT_INIT_HITS,buff,0)) 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, ...@@ -1842,7 +1848,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
MYF(0))) || MYF(0))) ||
!mi_alloc_rec_buff(info, -1, &sort_param.rec_buff)) !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; goto err;
} }
if (!rep_quick) if (!rep_quick)
...@@ -2278,8 +2284,8 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info, ...@@ -2278,8 +2284,8 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
rec_length=share->base.min_block_length; rec_length=share->base.min_block_length;
else else
rec_length=share->base.pack_reclength; 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 The info->state->records value, that is compared later
to sort_info.max_records and cannot exceed it, is to sort_info.max_records and cannot exceed it, is
increased in sort_key_write. In mi_repair_by_sort, sort_key_write 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, ...@@ -2288,7 +2294,9 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
before some other repair thread calls sort_key_read. before some other repair thread calls sort_key_read.
Furthermore I'm not even sure +1 would be enough. Furthermore I'm not even sure +1 would be enough.
May be sort_info.max_records shold be always set to max value in 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: ((param->testflag & T_CREATE_MISSING_KEYS) ? info->state->records + 1:
(ha_rows) (sort_info.filelength/rec_length+1)); (ha_rows) (sort_info.filelength/rec_length+1));
...@@ -2302,7 +2310,7 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info, ...@@ -2302,7 +2310,7 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
(sizeof(MI_SORT_PARAM) + share->base.pack_reclength), (sizeof(MI_SORT_PARAM) + share->base.pack_reclength),
MYF(MY_ZEROFILL)))) MYF(MY_ZEROFILL))))
{ {
mi_check_print_error(param,"Not enough memory!"); mi_check_print_error(param,"Not enough memory for key!");
goto err; goto err;
} }
total_key_length=0; total_key_length=0;
...@@ -2857,25 +2865,38 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) ...@@ -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, if (!(to=mi_alloc_rec_buff(info,block_info.rec_len,
&(sort_param->rec_buff)))) &(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)", 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); 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 else
to= sort_param->rec_buff; to= sort_param->rec_buff;
} }
if (left_length < block_info.data_len || ! block_info.data_len) 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)); llstr(sort_param->start_recpos,llbuff));
goto try_next; goto try_next;
} }
if (block_info.filepos + block_info.data_len > if (block_info.filepos + block_info.data_len >
sort_param->read_cache.end_of_file) 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)); llstr(sort_param->start_recpos,llbuff));
goto try_next; goto try_next;
} }
...@@ -3510,7 +3531,7 @@ static SORT_KEY_BLOCKS *alloc_key_blocks(MI_CHECK *param, uint blocks, ...@@ -3510,7 +3531,7 @@ static SORT_KEY_BLOCKS *alloc_key_blocks(MI_CHECK *param, uint blocks,
buffer_length+IO_SIZE)*blocks, buffer_length+IO_SIZE)*blocks,
MYF(0)))) 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); return(0);
} }
for (i=0 ; i < blocks ; i++) for (i=0 ; i < blocks ; i++)
......
...@@ -110,7 +110,8 @@ int main(int argc, char **argv) ...@@ -110,7 +110,8 @@ int main(int argc, char **argv)
VOID(fflush(stderr)); VOID(fflush(stderr));
if ((check_param.error_printed | check_param.warning_printed) && if ((check_param.error_printed | check_param.warning_printed) &&
(check_param.testflag & T_FORCE_CREATE) && (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; uint old_testflag=check_param.testflag;
if (!(check_param.testflag & T_REP)) if (!(check_param.testflag & T_REP))
...@@ -153,7 +154,7 @@ enum options_mc { ...@@ -153,7 +154,7 @@ enum options_mc {
OPT_KEY_CACHE_BLOCK_SIZE, OPT_MYISAM_BLOCK_SIZE, OPT_KEY_CACHE_BLOCK_SIZE, OPT_MYISAM_BLOCK_SIZE,
OPT_READ_BUFFER_SIZE, OPT_WRITE_BUFFER_SIZE, OPT_SORT_BUFFER_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_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[] = static struct my_option my_long_options[] =
...@@ -215,6 +216,11 @@ 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,
(gptr*) &check_param.keys_in_use, (gptr*) &check_param.keys_in_use,
0, GET_ULL, REQUIRED_ARG, -1, 0, 0, 0, 0, 0}, 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', {"medium-check", 'm',
"Faster than extend-check, but only finds 99.99% of all errors. Should be good enough for most cases.", "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}, 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[] = ...@@ -327,7 +333,7 @@ static struct my_option my_long_options[] =
static void print_version(void) 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); MACHINE_TYPE);
} }
...@@ -394,6 +400,9 @@ static void usage(void) ...@@ -394,6 +400,9 @@ static void usage(void)
-k, --keys-used=# Tell MyISAM to update only some specific keys. # is a\n\ -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\ bit mask of which keys to use. This can be used to\n\
get faster inserts.\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\ -r, --recover Can fix almost anything except unique keys that aren't\n\
unique.\n\ unique.\n\
-n, --sort-recover Forces recovering with sorting even if the temporary\n\ -n, --sort-recover Forces recovering with sorting even if the temporary\n\
......
drop table if exists t1,t2,t3; drop table if exists t1,t2,t3;
drop database if exists test_$1;
create table t1 (b char(0)); create table t1 (b char(0));
insert into t1 values (""),(null); insert into t1 values (""),(null);
select * from t1; select * from t1;
...@@ -302,9 +303,6 @@ t3 CREATE TABLE `t3` ( ...@@ -302,9 +303,6 @@ t3 CREATE TABLE `t3` (
select * from t3; select * from t3;
id name id name
drop table t2, t3; 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 database test_$1;
create table test_$1.t3 like t1; create table test_$1.t3 like t1;
create temporary table t3 like test_$1.t3; create temporary table t3 like test_$1.t3;
...@@ -411,7 +409,6 @@ a b c d e f g h dd ...@@ -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 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 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 table t1, t2;
drop database if exists test_$1;
create database test_$1; create database test_$1;
use test_$1; use test_$1;
select database(); select database();
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
--disable_warnings --disable_warnings
drop table if exists t1,t2,t3; drop table if exists t1,t2,t3;
drop database if exists test_$1;
--enable_warnings --enable_warnings
create table t1 (b char(0)); create table t1 (b char(0));
...@@ -57,6 +58,7 @@ select 1ea10.1a20,1e+ 1e+10 from 1ea10; ...@@ -57,6 +58,7 @@ select 1ea10.1a20,1e+ 1e+10 from 1ea10;
drop table 1ea10; drop table 1ea10;
create table t1 (t1.index int); create table t1 (t1.index int);
drop table t1; drop table t1;
# Test that we get warning for this
drop database if exists test_$1; drop database if exists test_$1;
create database test_$1; create database test_$1;
create table test_$1.$test1 (a$1 int, $b int, c$ int); create table test_$1.$test1 (a$1 int, $b int, c$ int);
...@@ -245,7 +247,6 @@ drop table t3; ...@@ -245,7 +247,6 @@ drop table t3;
show create table t3; show create table t3;
select * from t3; select * from t3;
drop table t2, t3; drop table t2, t3;
drop database if exists test_$1;
create database test_$1; create database test_$1;
create table test_$1.t3 like t1; create table test_$1.t3 like t1;
create temporary table t3 like test_$1.t3; create temporary table t3 like test_$1.t3;
...@@ -326,9 +327,6 @@ drop table t1, t2; ...@@ -326,9 +327,6 @@ drop table t1, t2;
# Bug #1209 # Bug #1209
# #
--disable_warnings
drop database if exists test_$1;
--enable_warnings
create database test_$1; create database test_$1;
use test_$1; use test_$1;
select database(); select database();
......
...@@ -1536,7 +1536,7 @@ ha_innobase::open( ...@@ -1536,7 +1536,7 @@ ha_innobase::open(
fprintf(stderr, fprintf(stderr,
"InnoDB: Warning: table %s key_used_on_scan is %lu even though there is no\n" "InnoDB: Warning: table %s key_used_on_scan is %lu even though there is no\n"
"InnoDB: primary key inside InnoDB.\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( ...@@ -3216,7 +3216,7 @@ ha_innobase::position(
if (len != ref_length) { if (len != ref_length) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: stored ref len is %lu, but table ref len is %lu\n", "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( ...@@ -4187,7 +4187,8 @@ ha_innobase::info(
"InnoDB: .frm files from different installations? See section\n" "InnoDB: .frm files from different installations? See section\n"
"InnoDB: 15.1 at http://www.innodb.com/ibman.html\n", "InnoDB: 15.1 at http://www.innodb.com/ibman.html\n",
index->name, index->name,
ib_table->name, index->n_uniq, ib_table->name,
(unsigned long) index->n_uniq,
j + 1); j + 1);
break; break;
} }
......
...@@ -2701,6 +2701,7 @@ void Item_func_match::init_search(bool no_order) ...@@ -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) bool Item_func_match::fix_fields(THD *thd, TABLE_LIST *tlist, Item **ref)
{ {
Item *item; Item *item;
LINT_INIT(item); // Safe as arg_count is > 1
maybe_null=1; maybe_null=1;
join_key=0; join_key=0;
......
...@@ -3320,35 +3320,22 @@ extern "C" pthread_handler_decl(handle_connections_namedpipes,arg) ...@@ -3320,35 +3320,22 @@ extern "C" pthread_handler_decl(handle_connections_namedpipes,arg)
#ifdef HAVE_SMEM #ifdef HAVE_SMEM
pthread_handler_decl(handle_connections_shared_memory,arg) pthread_handler_decl(handle_connections_shared_memory,arg)
{ {
/* /* file-mapping object, use for create shared memory */
event_connect_request is event object for start connection actions HANDLE handle_connect_file_map= 0;
event_connect_answer is event object for confirm, that server put data char *handle_connect_map= 0; // pointer on shared memory
handle_connect_file_map is file-mapping object, use for create shared memory HANDLE event_connect_request= 0; // for start connection actions
handle_connect_map is pointer on shared memory HANDLE event_connect_answer= 0;
handle_map is pointer on shared memory for client ulong smem_buffer_length= shared_memory_buffer_length + 4;
event_server_wrote, ulong connect_number= 1;
event_server_read,
event_client_wrote,
event_client_read are events for transfer data between server and client
handle_file_map is file-mapping object, use for create shared memory
*/
HANDLE handle_connect_file_map = NULL;
char *handle_connect_map = NULL;
HANDLE event_connect_request = NULL;
HANDLE event_connect_answer = NULL;
ulong smem_buffer_length = shared_memory_buffer_length + 4;
ulong connect_number = 1;
my_bool error_allow; my_bool error_allow;
THD *thd;
char tmp[63]; char tmp[63];
char *suffix_pos; char *suffix_pos;
char connect_number_char[22], *p; char connect_number_char[22], *p;
const char *errmsg= 0;
my_thread_init(); my_thread_init();
DBUG_ENTER("handle_connections_shared_memorys"); DBUG_ENTER("handle_connections_shared_memorys");
DBUG_PRINT("general",("Waiting for allocated shared memory.")); DBUG_PRINT("general",("Waiting for allocated shared memory."));
/* /*
The name of event and file-mapping events create agree next rule: The name of event and file-mapping events create agree next rule:
shared_memory_base_name+unique_part shared_memory_base_name+unique_part
...@@ -3356,166 +3343,165 @@ pthread_handler_decl(handle_connections_shared_memory,arg) ...@@ -3356,166 +3343,165 @@ pthread_handler_decl(handle_connections_shared_memory,arg)
shared_memory_base_name is unique value for each server shared_memory_base_name is unique value for each server
unique_part is unique value for each object (events and file-mapping) unique_part is unique value for each object (events and file-mapping)
*/ */
suffix_pos = strxmov(tmp,shared_memory_base_name,"_",NullS); suffix_pos= strxmov(tmp,shared_memory_base_name,"_",NullS);
strmov(suffix_pos, "CONNECT_REQUEST"); strmov(suffix_pos, "CONNECT_REQUEST");
if ((event_connect_request = CreateEvent(NULL,FALSE,FALSE,tmp)) == 0) if ((event_connect_request= CreateEvent(0,FALSE,FALSE,tmp)) == 0)
{ {
sql_perror("Can't create shared memory service ! The request event don't create."); errmsg= "Could not create request event";
goto error; goto error;
} }
strmov(suffix_pos, "CONNECT_ANSWER"); strmov(suffix_pos, "CONNECT_ANSWER");
if ((event_connect_answer = CreateEvent(NULL,FALSE,FALSE,tmp)) == 0) if ((event_connect_answer= CreateEvent(0,FALSE,FALSE,tmp)) == 0)
{ {
sql_perror("Can't create shared memory service ! The answer event don't create."); errmsg="Could not create answer event";
goto error; goto error;
} }
strmov(suffix_pos, "CONNECT_DATA"); strmov(suffix_pos, "CONNECT_DATA");
if ((handle_connect_file_map = CreateFileMapping(INVALID_HANDLE_VALUE,NULL,PAGE_READWRITE, if ((handle_connect_file_map= CreateFileMapping(INVALID_HANDLE_VALUE,0,
0,sizeof(connect_number),tmp)) == 0) PAGE_READWRITE,
0,sizeof(connect_number),
tmp)) == 0)
{ {
sql_perror("Can't create shared memory service ! File mapping don't create."); errmsg= "Could not create file mapping";
goto error; goto error;
} }
if ((handle_connect_map = (char *)MapViewOfFile(handle_connect_file_map,FILE_MAP_WRITE,0,0, if ((handle_connect_map= (char *)MapViewOfFile(handle_connect_file_map,
FILE_MAP_WRITE,0,0,
sizeof(DWORD))) == 0) sizeof(DWORD))) == 0)
{ {
sql_perror("Can't create shared memory service ! Map of memory don't create."); errmsg= "Could not create shared memory service";
goto error; goto error;
} }
while (!abort_loop) while (!abort_loop)
{ {
/* /* Wait a request from client */
Wait a request from client
*/
WaitForSingleObject(event_connect_request,INFINITE); WaitForSingleObject(event_connect_request,INFINITE);
error_allow = FALSE;
HANDLE handle_client_file_map = NULL; HANDLE handle_client_file_map= 0;
char *handle_client_map = NULL; char *handle_client_map= 0;
HANDLE event_client_wrote = NULL; HANDLE event_client_wrote= 0;
HANDLE event_client_read = NULL; HANDLE event_client_read= 0; // for transfer data server <-> client
HANDLE event_server_wrote = NULL; HANDLE event_server_wrote= 0;
HANDLE event_server_read = NULL; HANDLE event_server_read= 0;
THD *thd= 0;
p = int2str(connect_number, connect_number_char, 10); p= int2str(connect_number, connect_number_char, 10);
/* /*
The name of event and file-mapping events create agree next rule: The name of event and file-mapping events create agree next rule:
shared_memory_base_name+unique_part+number_of_connection shared_memory_base_name+unique_part+number_of_connection
Where: Where:
shared_memory_base_name is uniquel value for each server shared_memory_base_name is uniquel value for each server
unique_part is unique value for each object (events and file-mapping) unique_part is unique value for each object (events and file-mapping)
number_of_connection is number of connection between server and client number_of_connection is connection-number between server and client
*/ */
suffix_pos = strxmov(tmp,shared_memory_base_name,"_",connect_number_char,"_",NullS); suffix_pos= strxmov(tmp,shared_memory_base_name,"_",connect_number_char,
"_",NullS);
strmov(suffix_pos, "DATA"); strmov(suffix_pos, "DATA");
if ((handle_client_file_map = CreateFileMapping(INVALID_HANDLE_VALUE,NULL, if ((handle_client_file_map= CreateFileMapping(INVALID_HANDLE_VALUE,0,
PAGE_READWRITE,0,smem_buffer_length,tmp)) == 0) PAGE_READWRITE,0,
smem_buffer_length,
tmp)) == 0)
{ {
sql_perror("Can't create connection with client in shared memory service ! File mapping don't create."); errmsg= "Could not create file mapping";
error_allow = TRUE;
goto errorconn; goto errorconn;
} }
if ((handle_client_map = (char*)MapViewOfFile(handle_client_file_map,FILE_MAP_WRITE,0,0,smem_buffer_length)) == 0) if ((handle_client_map= (char*)MapViewOfFile(handle_client_file_map,
FILE_MAP_WRITE,0,0,
smem_buffer_length)) == 0)
{ {
sql_perror("Can't create connection with client in shared memory service ! Map of memory don't create."); errmsg= "Could not create memory map";
error_allow = TRUE;
goto errorconn; goto errorconn;
} }
strmov(suffix_pos, "CLIENT_WROTE"); strmov(suffix_pos, "CLIENT_WROTE");
if ((event_client_wrote = CreateEvent(NULL,FALSE,FALSE,tmp)) == 0) if ((event_client_wrote= CreateEvent(0,FALSE,FALSE,tmp)) == 0)
{ {
sql_perror("Can't create connection with client in shared memory service ! CW event don't create."); errmsg= "Could not create client write event";
error_allow = TRUE;
goto errorconn; goto errorconn;
} }
strmov(suffix_pos, "CLIENT_READ"); strmov(suffix_pos, "CLIENT_READ");
if ((event_client_read = CreateEvent(NULL,FALSE,FALSE,tmp)) == 0) if ((event_client_read= CreateEvent(0,FALSE,FALSE,tmp)) == 0)
{ {
sql_perror("Can't create connection with client in shared memory service ! CR event don't create."); errmsg= "Could not create client read event";
error_allow = TRUE;
goto errorconn; goto errorconn;
} }
strmov(suffix_pos, "SERVER_READ"); strmov(suffix_pos, "SERVER_READ");
if ((event_server_read = CreateEvent(NULL,FALSE,FALSE,tmp)) == 0) if ((event_server_read= CreateEvent(0,FALSE,FALSE,tmp)) == 0)
{ {
sql_perror("Can't create connection with client in shared memory service ! SR event don't create."); errmsg= "Could not create server read event";
error_allow = TRUE;
goto errorconn; goto errorconn;
} }
strmov(suffix_pos, "SERVER_WROTE"); strmov(suffix_pos, "SERVER_WROTE");
if ((event_server_wrote = CreateEvent(NULL,FALSE,FALSE,tmp)) == 0) if ((event_server_wrote= CreateEvent(0,FALSE,FALSE,tmp)) == 0)
{ {
sql_perror("Can't create connection with client in shared memory service ! SW event don't create."); errmsg= "Could not create server write event";
error_allow = TRUE;
goto errorconn; goto errorconn;
} }
if (abort_loop)
if (abort_loop) break;
if ( !(thd = new THD))
{
error_allow = TRUE;
goto errorconn; goto errorconn;
} if (!(thd= new THD))
goto errorconn;
/* /* Send number of connection to client */
Send number of connection to client
*/
int4store(handle_connect_map, connect_number); int4store(handle_connect_map, connect_number);
/*
Send number of connection to client
*/
if (!SetEvent(event_connect_answer)) if (!SetEvent(event_connect_answer))
{ {
sql_perror("Can't create connection with client in shared memory service ! Can't send answer event."); errmsg= "Could not send answer event";
error_allow = TRUE;
goto errorconn; goto errorconn;
} }
/* Set event that client should receive data */
/*
Set event that client should receive data
*/
if (!SetEvent(event_client_read)) if (!SetEvent(event_client_read))
{ {
sql_perror("Can't create connection with client in shared memory service ! Can't set client to read's mode."); errmsg= "Could not set client to read mode";
error_allow = TRUE;
goto errorconn; goto errorconn;
} }
if (!(thd->net.vio = vio_new_win32shared_memory(&thd->net,handle_client_file_map,handle_client_map,event_client_wrote, if (!(thd->net.vio= vio_new_win32shared_memory(&thd->net,
event_client_read,event_server_wrote,event_server_read)) || handle_client_file_map,
handle_client_map,
event_client_wrote,
event_client_read,
event_server_wrote,
event_server_read)) ||
my_net_init(&thd->net, thd->net.vio)) my_net_init(&thd->net, thd->net.vio))
{ {
close_connection(thd, ER_OUT_OF_RESOURCES, 1); close_connection(thd, ER_OUT_OF_RESOURCES, 1);
delete thd; errmsg= 0;
error_allow = TRUE; goto errorconn;
}
/* host name is unknown */
errorconn:
if (error_allow)
{
if (!handle_client_map) UnmapViewOfFile(handle_client_map);
if (!handle_client_file_map) CloseHandle(handle_client_file_map);
if (!event_server_wrote) CloseHandle(event_server_wrote);
if (!event_server_read) CloseHandle(event_server_read);
if (!event_client_wrote) CloseHandle(event_client_wrote);
if (!event_client_read) CloseHandle(event_client_read);
continue;
} }
thd->host = my_strdup(my_localhost,MYF(0)); /* Host is unknown */ thd->host= my_strdup(my_localhost,MYF(0)); /* Host is unknown */
create_new_thread(thd); create_new_thread(thd);
uint4korr(connect_number++); connect_number++;
continue;
errorconn:
/* Could not form connection; Free used handlers/memort and retry */
if (errmsg)
{
char buff[180];
strxmov(buff, "Can't create shared memory connection: ", errmsg, ".",
NullS);
sql_perror(buff);
}
if (handle_client_file_map) CloseHandle(handle_client_file_map);
if (handle_client_map) UnmapViewOfFile(handle_client_map);
if (event_server_wrote) CloseHandle(event_server_wrote);
if (event_server_read) CloseHandle(event_server_read);
if (event_client_wrote) CloseHandle(event_client_wrote);
if (event_client_read) CloseHandle(event_client_read);
delete thd;
} }
/* End shared memory handling */
error: error:
if (!handle_connect_map) UnmapViewOfFile(handle_connect_map); if (errmsg)
if (!handle_connect_file_map) CloseHandle(handle_connect_file_map); {
if (!event_connect_answer) CloseHandle(event_connect_answer); char buff[180];
if (!event_connect_request) CloseHandle(event_connect_request); strxmov(buff, "Can't create shared memory service: ", errmsg, ".", NullS);
sql_perror(buff);
}
if (handle_connect_map) UnmapViewOfFile(handle_connect_map);
if (handle_connect_file_map) CloseHandle(handle_connect_file_map);
if (event_connect_answer) CloseHandle(event_connect_answer);
if (event_connect_request) CloseHandle(event_connect_request);
decrement_handler_count(); decrement_handler_count();
DBUG_RETURN(0); DBUG_RETURN(0);
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#define LONG ulonglong #define LONG ulonglong
#endif #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); 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