Commit 757573e0 authored by unknown's avatar unknown

Merge mysql.com:/home/mydev/mysql-5.0

into mysql.com:/home/mydev/mysql-5.0-5000


sql/sql_select.cc:
  Auto merged
parents a4d58112 bcf34227
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
#include <locale.h> #include <locale.h>
#endif #endif
const char *VER= "14.7"; const char *VER= "14.8";
/* Don't try to make a nice table if the data is too big */ /* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024 #define MAX_COLUMN_LENGTH 1024
...@@ -144,6 +144,7 @@ static char *current_host,*current_db,*current_user=0,*opt_password=0, ...@@ -144,6 +144,7 @@ static char *current_host,*current_db,*current_user=0,*opt_password=0,
*current_prompt=0, *delimiter_str= 0, *current_prompt=0, *delimiter_str= 0,
*default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME; *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
static char *histfile; static char *histfile;
static char *histfile_tmp;
static String glob_buffer,old_buffer; static String glob_buffer,old_buffer;
static String processed_prompt; static String processed_prompt;
static char *full_username=0,*part_username=0,*default_prompt=0; static char *full_username=0,*part_username=0,*default_prompt=0;
...@@ -442,6 +443,13 @@ int main(int argc,char *argv[]) ...@@ -442,6 +443,13 @@ int main(int argc,char *argv[])
if (verbose) if (verbose)
tee_fprintf(stdout, "Reading history-file %s\n",histfile); tee_fprintf(stdout, "Reading history-file %s\n",histfile);
read_history(histfile); read_history(histfile);
if (!(histfile_tmp= (char*) my_malloc((uint) strlen(histfile) + 5,
MYF(MY_WME))))
{
fprintf(stderr, "Couldn't allocate memory for temp histfile!\n");
exit(1);
}
sprintf(histfile_tmp, "%s.TMP", histfile);
} }
} }
#endif #endif
...@@ -470,7 +478,8 @@ sig_handler mysql_end(int sig) ...@@ -470,7 +478,8 @@ sig_handler mysql_end(int sig)
/* write-history */ /* write-history */
if (verbose) if (verbose)
tee_fprintf(stdout, "Writing history-file %s\n",histfile); tee_fprintf(stdout, "Writing history-file %s\n",histfile);
write_history(histfile); if (!write_history(histfile_tmp))
my_rename(histfile_tmp, histfile, MYF(MY_WME));
} }
batch_readline_end(status.line_buff); batch_readline_end(status.line_buff);
completion_hash_free(&ht); completion_hash_free(&ht);
...@@ -485,6 +494,7 @@ sig_handler mysql_end(int sig) ...@@ -485,6 +494,7 @@ sig_handler mysql_end(int sig)
my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR)); my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
my_free(opt_mysql_unix_port,MYF(MY_ALLOW_ZERO_PTR)); my_free(opt_mysql_unix_port,MYF(MY_ALLOW_ZERO_PTR));
my_free(histfile,MYF(MY_ALLOW_ZERO_PTR)); my_free(histfile,MYF(MY_ALLOW_ZERO_PTR));
my_free(histfile_tmp,MYF(MY_ALLOW_ZERO_PTR));
my_free(current_db,MYF(MY_ALLOW_ZERO_PTR)); my_free(current_db,MYF(MY_ALLOW_ZERO_PTR));
my_free(current_host,MYF(MY_ALLOW_ZERO_PTR)); my_free(current_host,MYF(MY_ALLOW_ZERO_PTR));
my_free(current_user,MYF(MY_ALLOW_ZERO_PTR)); my_free(current_user,MYF(MY_ALLOW_ZERO_PTR));
......
...@@ -780,7 +780,13 @@ static int check_master_version(MYSQL* mysql, ...@@ -780,7 +780,13 @@ static int check_master_version(MYSQL* mysql,
if (mysql_query(mysql, "SELECT VERSION()") || if (mysql_query(mysql, "SELECT VERSION()") ||
!(res = mysql_store_result(mysql))) !(res = mysql_store_result(mysql)))
die("Error checking master version: %s", mysql_error(mysql)); {
char errmsg[FN_REFLEN];
strmake(errmsg, mysql_error(mysql), sizeof(errmsg) - 1);
mysql_close(mysql);
die("Error checking master version: %s", errmsg);
}
if (!(row = mysql_fetch_row(res))) if (!(row = mysql_fetch_row(res)))
{ {
mysql_free_result(res); mysql_free_result(res);
......
...@@ -1022,7 +1022,8 @@ btr_cur_optimistic_insert( ...@@ -1022,7 +1022,8 @@ btr_cur_optimistic_insert(
/* Now, try the insert */ /* Now, try the insert */
*rec = page_cur_insert_rec_low(page_cursor, entry, index, NULL, mtr); *rec = page_cur_insert_rec_low(page_cursor, entry, index,
NULL, NULL, mtr);
if (!(*rec)) { if (!(*rec)) {
/* If the record did not fit, reorganize */ /* If the record did not fit, reorganize */
btr_page_reorganize(page, index, mtr); btr_page_reorganize(page, index, mtr);
......
...@@ -144,6 +144,7 @@ page_cur_rec_insert( ...@@ -144,6 +144,7 @@ page_cur_rec_insert(
page_cur_t* cursor, /* in: a page cursor */ page_cur_t* cursor, /* in: a page cursor */
rec_t* rec, /* in: record to insert */ rec_t* rec, /* in: record to insert */
dict_index_t* index, /* in: record descriptor */ dict_index_t* index, /* in: record descriptor */
ulint* offsets,/* in: rec_get_offsets(rec, index) */
mtr_t* mtr); /* in: mini-transaction handle */ mtr_t* mtr); /* in: mini-transaction handle */
/*************************************************************** /***************************************************************
Inserts a record next to page cursor. Returns pointer to inserted record if Inserts a record next to page cursor. Returns pointer to inserted record if
...@@ -160,6 +161,7 @@ page_cur_insert_rec_low( ...@@ -160,6 +161,7 @@ page_cur_insert_rec_low(
dtuple_t* tuple, /* in: pointer to a data tuple or NULL */ dtuple_t* tuple, /* in: pointer to a data tuple or NULL */
dict_index_t* index, /* in: record descriptor */ dict_index_t* index, /* in: record descriptor */
rec_t* rec, /* in: pointer to a physical record or NULL */ rec_t* rec, /* in: pointer to a physical record or NULL */
ulint* offsets,/* in: rec_get_offsets(rec, index) or NULL */
mtr_t* mtr); /* in: mini-transaction handle */ mtr_t* mtr); /* in: mini-transaction handle */
/***************************************************************** /*****************************************************************
Copies records from page to a newly created page, from a given record onward, Copies records from page to a newly created page, from a given record onward,
......
...@@ -195,7 +195,7 @@ page_cur_tuple_insert( ...@@ -195,7 +195,7 @@ page_cur_tuple_insert(
dict_index_t* index, /* in: record descriptor */ dict_index_t* index, /* in: record descriptor */
mtr_t* mtr) /* in: mini-transaction handle */ mtr_t* mtr) /* in: mini-transaction handle */
{ {
return(page_cur_insert_rec_low(cursor, tuple, index, NULL, mtr)); return(page_cur_insert_rec_low(cursor, tuple, index, NULL, NULL, mtr));
} }
/*************************************************************** /***************************************************************
...@@ -211,8 +211,10 @@ page_cur_rec_insert( ...@@ -211,8 +211,10 @@ page_cur_rec_insert(
page_cur_t* cursor, /* in: a page cursor */ page_cur_t* cursor, /* in: a page cursor */
rec_t* rec, /* in: record to insert */ rec_t* rec, /* in: record to insert */
dict_index_t* index, /* in: record descriptor */ dict_index_t* index, /* in: record descriptor */
ulint* offsets,/* in: rec_get_offsets(rec, index) */
mtr_t* mtr) /* in: mini-transaction handle */ mtr_t* mtr) /* in: mini-transaction handle */
{ {
return(page_cur_insert_rec_low(cursor, NULL, index, rec, mtr)); return(page_cur_insert_rec_low(cursor, NULL, index, rec,
offsets, mtr));
} }
...@@ -133,6 +133,27 @@ rec_set_status( ...@@ -133,6 +133,27 @@ rec_set_status(
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ulint bits); /* in: info bits */ ulint bits); /* in: info bits */
/**********************************************************
The following function is used to retrieve the info and status
bits of a record. (Only compact records have status bits.) */
UNIV_INLINE
ulint
rec_get_info_and_status_bits(
/*==============*/
/* out: info bits */
rec_t* rec, /* in: physical record */
ibool comp); /* in: TRUE=compact page format */
/**********************************************************
The following function is used to set the info and status
bits of a record. (Only compact records have status bits.) */
UNIV_INLINE
void
rec_set_info_and_status_bits(
/*==============*/
rec_t* rec, /* in: physical record */
ibool comp, /* in: TRUE=compact page format */
ulint bits); /* in: info bits */
/********************************************************** /**********************************************************
The following function tells if record is delete marked. */ The following function tells if record is delete marked. */
UNIV_INLINE UNIV_INLINE
......
...@@ -520,6 +520,53 @@ rec_set_status( ...@@ -520,6 +520,53 @@ rec_set_status(
REC_NEW_STATUS_MASK, REC_NEW_STATUS_SHIFT); REC_NEW_STATUS_MASK, REC_NEW_STATUS_SHIFT);
} }
/**********************************************************
The following function is used to retrieve the info and status
bits of a record. (Only compact records have status bits.) */
UNIV_INLINE
ulint
rec_get_info_and_status_bits(
/*==============*/
/* out: info bits */
rec_t* rec, /* in: physical record */
ibool comp) /* in: TRUE=compact page format */
{
ulint bits;
#if (REC_NEW_STATUS_MASK >> REC_NEW_STATUS_SHIFT) \
& (REC_INFO_BITS_MASK >> REC_INFO_BITS_SHIFT)
# error "REC_NEW_STATUS_MASK and REC_INFO_BITS_MASK overlap"
#endif
if (comp) {
bits = rec_get_info_bits(rec, TRUE) | rec_get_status(rec);
} else {
bits = rec_get_info_bits(rec, FALSE);
ut_ad(!(bits & ~(REC_INFO_BITS_MASK >> REC_INFO_BITS_SHIFT)));
}
return(bits);
}
/**********************************************************
The following function is used to set the info and status
bits of a record. (Only compact records have status bits.) */
UNIV_INLINE
void
rec_set_info_and_status_bits(
/*==============*/
rec_t* rec, /* in: physical record */
ibool comp, /* in: TRUE=compact page format */
ulint bits) /* in: info bits */
{
#if (REC_NEW_STATUS_MASK >> REC_NEW_STATUS_SHIFT) \
& (REC_INFO_BITS_MASK >> REC_INFO_BITS_SHIFT)
# error "REC_NEW_STATUS_MASK and REC_INFO_BITS_MASK overlap"
#endif
if (comp) {
rec_set_status(rec, bits & REC_NEW_STATUS_MASK);
} else {
ut_ad(!(bits & ~(REC_INFO_BITS_MASK >> REC_INFO_BITS_SHIFT)));
}
rec_set_info_bits(rec, bits & ~REC_NEW_STATUS_MASK, comp);
}
/********************************************************** /**********************************************************
The following function tells if record is delete marked. */ The following function tells if record is delete marked. */
UNIV_INLINE UNIV_INLINE
......
...@@ -80,8 +80,10 @@ memory is read outside the allocated blocks. */ ...@@ -80,8 +80,10 @@ memory is read outside the allocated blocks. */
/* Make a non-inline debug version */ /* Make a non-inline debug version */
#ifdef DBUG_ON
# define UNIV_DEBUG
#endif /* DBUG_ON */
/* /*
#define UNIV_DEBUG
#define UNIV_MEM_DEBUG #define UNIV_MEM_DEBUG
#define UNIV_IBUF_DEBUG #define UNIV_IBUF_DEBUG
#define UNIV_SYNC_DEBUG #define UNIV_SYNC_DEBUG
......
...@@ -605,8 +605,8 @@ page_cur_insert_rec_write_log( ...@@ -605,8 +605,8 @@ page_cur_insert_rec_write_log(
log_end = &log_ptr[5 + 1 + 5 + 5 + MLOG_BUF_MARGIN]; log_end = &log_ptr[5 + 1 + 5 + 5 + MLOG_BUF_MARGIN];
} }
if ((rec_get_info_bits(insert_rec, index->table->comp) != if ((rec_get_info_and_status_bits(insert_rec, index->table->comp) !=
rec_get_info_bits(cursor_rec, index->table->comp)) rec_get_info_and_status_bits(cursor_rec, index->table->comp))
|| (extra_size != cur_extra_size) || (extra_size != cur_extra_size)
|| (rec_size != cur_rec_size)) { || (rec_size != cur_rec_size)) {
...@@ -622,7 +622,8 @@ page_cur_insert_rec_write_log( ...@@ -622,7 +622,8 @@ page_cur_insert_rec_write_log(
if (extra_info_yes) { if (extra_info_yes) {
/* Write the info bits */ /* Write the info bits */
mach_write_to_1(log_ptr, mach_write_to_1(log_ptr,
rec_get_info_bits(insert_rec, index->table->comp)); rec_get_info_and_status_bits(insert_rec,
index->table->comp));
log_ptr++; log_ptr++;
/* Write the record origin offset */ /* Write the record origin offset */
...@@ -673,7 +674,7 @@ page_cur_parse_insert_rec( ...@@ -673,7 +674,7 @@ page_cur_parse_insert_rec(
byte buf1[1024]; byte buf1[1024];
byte* buf; byte* buf;
byte* ptr2 = ptr; byte* ptr2 = ptr;
ulint info_bits = 0; /* remove warning */ ulint info_and_status_bits = 0; /* remove warning */
page_cur_t cursor; page_cur_t cursor;
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[100] = { 100, }; ulint offsets_[100] = { 100, };
...@@ -723,7 +724,7 @@ page_cur_parse_insert_rec( ...@@ -723,7 +724,7 @@ page_cur_parse_insert_rec(
return(NULL); return(NULL);
} }
info_bits = mach_read_from_1(ptr); info_and_status_bits = mach_read_from_1(ptr);
ptr++; ptr++;
ptr = mach_parse_compressed(ptr, end_ptr, &origin_offset); ptr = mach_parse_compressed(ptr, end_ptr, &origin_offset);
...@@ -768,7 +769,8 @@ page_cur_parse_insert_rec( ...@@ -768,7 +769,8 @@ page_cur_parse_insert_rec(
ULINT_UNDEFINED, &heap); ULINT_UNDEFINED, &heap);
if (extra_info_yes == 0) { if (extra_info_yes == 0) {
info_bits = rec_get_info_bits(cursor_rec, index->table->comp); info_and_status_bits = rec_get_info_and_status_bits(
cursor_rec, index->table->comp);
origin_offset = rec_offs_extra_size(offsets); origin_offset = rec_offs_extra_size(offsets);
mismatch_index = rec_offs_size(offsets) - end_seg_len; mismatch_index = rec_offs_size(offsets) - end_seg_len;
} }
...@@ -783,11 +785,12 @@ page_cur_parse_insert_rec( ...@@ -783,11 +785,12 @@ page_cur_parse_insert_rec(
if (mismatch_index >= UNIV_PAGE_SIZE) { if (mismatch_index >= UNIV_PAGE_SIZE) {
fprintf(stderr, fprintf(stderr,
"Is short %lu, info_bits %lu, offset %lu, " "Is short %lu, info_and_status_bits %lu, offset %lu, "
"o_offset %lu\n" "o_offset %lu\n"
"mismatch index %lu, end_seg_len %lu\n" "mismatch index %lu, end_seg_len %lu\n"
"parsed len %lu\n", "parsed len %lu\n",
(ulong) is_short, (ulong) info_bits, (ulong) offset, (ulong) is_short, (ulong) info_and_status_bits,
(ulong) offset,
(ulong) origin_offset, (ulong) origin_offset,
(ulong) mismatch_index, (ulong) end_seg_len, (ulong) mismatch_index, (ulong) end_seg_len,
(ulong) (ptr - ptr2)); (ulong) (ptr - ptr2));
...@@ -803,21 +806,14 @@ page_cur_parse_insert_rec( ...@@ -803,21 +806,14 @@ page_cur_parse_insert_rec(
ut_memcpy(buf, rec_get_start(cursor_rec, offsets), mismatch_index); ut_memcpy(buf, rec_get_start(cursor_rec, offsets), mismatch_index);
ut_memcpy(buf + mismatch_index, ptr, end_seg_len); ut_memcpy(buf + mismatch_index, ptr, end_seg_len);
rec_set_info_bits(buf + origin_offset, index->table->comp, info_bits); rec_set_info_and_status_bits(buf + origin_offset, index->table->comp,
info_and_status_bits);
/* Set the status bits for new-style records. */
if (index->table->comp) {
/* Leaf pages (level 0) contain ordinary records;
non-leaf pages contain node pointer records. */
ulint level = page_header_get_field(
buf_frame_align(cursor_rec), PAGE_LEVEL);
rec_set_status(buf + origin_offset,
level ? REC_STATUS_NODE_PTR : REC_STATUS_ORDINARY);
}
page_cur_position(cursor_rec, &cursor); page_cur_position(cursor_rec, &cursor);
page_cur_rec_insert(&cursor, buf + origin_offset, index, mtr); offsets = rec_get_offsets(buf + origin_offset, index, offsets,
ULINT_UNDEFINED, &heap);
page_cur_rec_insert(&cursor, buf + origin_offset, index, offsets, mtr);
if (buf != buf1) { if (buf != buf1) {
...@@ -846,6 +842,7 @@ page_cur_insert_rec_low( ...@@ -846,6 +842,7 @@ page_cur_insert_rec_low(
dtuple_t* tuple, /* in: pointer to a data tuple or NULL */ dtuple_t* tuple, /* in: pointer to a data tuple or NULL */
dict_index_t* index, /* in: record descriptor */ dict_index_t* index, /* in: record descriptor */
rec_t* rec, /* in: pointer to a physical record or NULL */ rec_t* rec, /* in: pointer to a physical record or NULL */
ulint* offsets,/* in: rec_get_offsets(rec, index) or NULL */
mtr_t* mtr) /* in: mini-transaction handle */ mtr_t* mtr) /* in: mini-transaction handle */
{ {
byte* insert_buf = NULL; byte* insert_buf = NULL;
...@@ -863,8 +860,6 @@ page_cur_insert_rec_low( ...@@ -863,8 +860,6 @@ page_cur_insert_rec_low(
rec_t* owner_rec; rec_t* owner_rec;
ulint n_owned; ulint n_owned;
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[100] = { 100, };
ulint* offsets = offsets_;
ibool comp = index->table->comp; ibool comp = index->table->comp;
ut_ad(cursor && mtr); ut_ad(cursor && mtr);
...@@ -882,8 +877,11 @@ page_cur_insert_rec_low( ...@@ -882,8 +877,11 @@ page_cur_insert_rec_low(
if (tuple != NULL) { if (tuple != NULL) {
rec_size = rec_get_converted_size(index, tuple); rec_size = rec_get_converted_size(index, tuple);
} else { } else {
offsets = rec_get_offsets(rec, index, offsets, if (!offsets) {
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &heap); ULINT_UNDEFINED, &heap);
}
ut_ad(rec_offs_validate(rec, index, offsets));
rec_size = rec_offs_size(offsets); rec_size = rec_offs_size(offsets);
} }
...@@ -1131,8 +1129,6 @@ page_copy_rec_list_end_to_created_page( ...@@ -1131,8 +1129,6 @@ page_copy_rec_list_end_to_created_page(
slot_index = 0; slot_index = 0;
n_recs = 0; n_recs = 0;
heap = mem_heap_create(100);
/* should be do ... until, comment by Jani */ /* should be do ... until, comment by Jani */
while (rec != page_get_supremum_rec(page)) { while (rec != page_get_supremum_rec(page)) {
offsets = rec_get_offsets(rec, index, offsets, offsets = rec_get_offsets(rec, index, offsets,
......
...@@ -463,6 +463,9 @@ page_copy_rec_list_end_no_locks( ...@@ -463,6 +463,9 @@ page_copy_rec_list_end_no_locks(
page_cur_t cur1; page_cur_t cur1;
page_cur_t cur2; page_cur_t cur2;
rec_t* sup; rec_t* sup;
mem_heap_t* heap = NULL;
ulint offsets_[100] = { 100, };
ulint* offsets = offsets_;
page_cur_position(rec, &cur1); page_cur_position(rec, &cur1);
...@@ -483,8 +486,11 @@ page_copy_rec_list_end_no_locks( ...@@ -483,8 +486,11 @@ page_copy_rec_list_end_no_locks(
sup = page_get_supremum_rec(page); sup = page_get_supremum_rec(page);
while (sup != page_cur_get_rec(&cur1)) { while (sup != page_cur_get_rec(&cur1)) {
if (!page_cur_rec_insert(&cur2, rec_t* cur1_rec = page_cur_get_rec(&cur1);
page_cur_get_rec(&cur1), index, mtr)) { offsets = rec_get_offsets(cur1_rec, index, offsets,
ULINT_UNDEFINED, &heap);
if (!page_cur_rec_insert(&cur2, cur1_rec, index,
offsets, mtr)) {
/* Track an assertion failure reported on the mailing /* Track an assertion failure reported on the mailing
list on June 18th, 2003 */ list on June 18th, 2003 */
...@@ -503,7 +509,11 @@ page_copy_rec_list_end_no_locks( ...@@ -503,7 +509,11 @@ page_copy_rec_list_end_no_locks(
page_cur_move_to_next(&cur1); page_cur_move_to_next(&cur1);
page_cur_move_to_next(&cur2); page_cur_move_to_next(&cur2);
} }
}
if (heap) {
mem_heap_free(heap);
}
}
/***************************************************************** /*****************************************************************
Copies records from page to new_page, from a given record onward, Copies records from page to new_page, from a given record onward,
...@@ -553,6 +563,9 @@ page_copy_rec_list_start( ...@@ -553,6 +563,9 @@ page_copy_rec_list_start(
page_cur_t cur1; page_cur_t cur1;
page_cur_t cur2; page_cur_t cur2;
rec_t* old_end; rec_t* old_end;
mem_heap_t* heap = NULL;
ulint offsets_[100] = { 100, };
ulint* offsets = offsets_;
page_cur_set_before_first(page, &cur1); page_cur_set_before_first(page, &cur1);
...@@ -570,8 +583,13 @@ page_copy_rec_list_start( ...@@ -570,8 +583,13 @@ page_copy_rec_list_start(
/* Copy records from the original page to the new page */ /* Copy records from the original page to the new page */
while (page_cur_get_rec(&cur1) != rec) { while (page_cur_get_rec(&cur1) != rec) {
ut_a(page_cur_rec_insert(&cur2, rec_t* ins_rec;
page_cur_get_rec(&cur1), index, mtr)); rec_t* cur1_rec = page_cur_get_rec(&cur1);
offsets = rec_get_offsets(cur1_rec, index, offsets,
ULINT_UNDEFINED, &heap);
ins_rec = page_cur_rec_insert(&cur2, cur1_rec, index,
offsets, mtr);
ut_a(ins_rec);
page_cur_move_to_next(&cur1); page_cur_move_to_next(&cur1);
page_cur_move_to_next(&cur2); page_cur_move_to_next(&cur2);
...@@ -584,7 +602,11 @@ page_copy_rec_list_start( ...@@ -584,7 +602,11 @@ page_copy_rec_list_start(
page_update_max_trx_id(new_page, page_get_max_trx_id(page)); page_update_max_trx_id(new_page, page_get_max_trx_id(page));
btr_search_move_or_delete_hash_entries(new_page, page, index); btr_search_move_or_delete_hash_entries(new_page, page, index);
}
if (heap) {
mem_heap_free(heap);
}
}
/************************************************************** /**************************************************************
Writes a log record of a record list end or start deletion. */ Writes a log record of a record list end or start deletion. */
......
...@@ -1120,7 +1120,6 @@ row_ins_check_foreign_constraint( ...@@ -1120,7 +1120,6 @@ row_ins_check_foreign_constraint(
dict_table_t* check_table; dict_table_t* check_table;
dict_index_t* check_index; dict_index_t* check_index;
ulint n_fields_cmp; ulint n_fields_cmp;
ibool unique_search;
rec_t* rec; rec_t* rec;
btr_pcur_t pcur; btr_pcur_t pcur;
ibool moved; ibool moved;
...@@ -1240,14 +1239,6 @@ row_ins_check_foreign_constraint( ...@@ -1240,14 +1239,6 @@ row_ins_check_foreign_constraint(
dtuple_set_n_fields_cmp(entry, foreign->n_fields); dtuple_set_n_fields_cmp(entry, foreign->n_fields);
if (dict_index_get_n_unique(check_index) <= foreign->n_fields) {
/* We can just set a LOCK_REC_NOT_GAP type lock */
unique_search = TRUE;
} else {
unique_search = FALSE;
}
btr_pcur_open(check_index, entry, PAGE_CUR_GE, btr_pcur_open(check_index, entry, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr); BTR_SEARCH_LEAF, &pcur, &mtr);
...@@ -1289,18 +1280,14 @@ row_ins_check_foreign_constraint( ...@@ -1289,18 +1280,14 @@ row_ins_check_foreign_constraint(
break; break;
} }
} else { } else {
/* Found a matching record */ /* Found a matching record. Lock only
ulint lock_type; a record because we can allow inserts
into gaps */
if (unique_search) { err = row_ins_set_shared_rec_lock(
lock_type = LOCK_REC_NOT_GAP; LOCK_REC_NOT_GAP, rec,
} else { check_index, offsets, thr);
lock_type = LOCK_ORDINARY;
}
err = row_ins_set_shared_rec_lock(lock_type,
rec, check_index, offsets, thr);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
break; break;
......
...@@ -65,8 +65,9 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \ ...@@ -65,8 +65,9 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \
my_compress.lo array.lo my_once.lo list.lo my_net.lo \ my_compress.lo array.lo my_once.lo list.lo my_net.lo \
charset.lo charset-def.lo hash.lo mf_iocache.lo \ charset.lo charset-def.lo hash.lo mf_iocache.lo \
mf_iocache2.lo my_seek.lo my_sleep.lo \ mf_iocache2.lo my_seek.lo my_sleep.lo \
my_pread.lo mf_cache.lo md5.lo sha1.lo\ my_pread.lo mf_cache.lo md5.lo sha1.lo \
my_getopt.lo my_gethostbyname.lo my_port.lo my_getopt.lo my_gethostbyname.lo my_port.lo \
my_rename.lo
sqlobjects = net.lo sqlobjects = net.lo
sql_cmn_objects = pack.lo client.lo my_time.lo sql_cmn_objects = pack.lo client.lo my_time.lo
......
...@@ -198,6 +198,13 @@ LD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$LD_LIBRARY_PATH" ...@@ -198,6 +198,13 @@ LD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$LD_LIBRARY_PATH"
DYLD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$DYLD_LIBRARY_PATH" DYLD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$DYLD_LIBRARY_PATH"
export LD_LIBRARY_PATH DYLD_LIBRARY_PATH export LD_LIBRARY_PATH DYLD_LIBRARY_PATH
#
# Allow anyone in the group to see the generated database files
#
UMASK=0660
UMASK_DIR=0770
export UMASK UMASK_DIR
MASTER_RUNNING=0 MASTER_RUNNING=0
MASTER1_RUNNING=0 MASTER1_RUNNING=0
MASTER_MYPORT=9306 MASTER_MYPORT=9306
...@@ -765,6 +772,17 @@ skip_test() { ...@@ -765,6 +772,17 @@ skip_test() {
$ECHO "$RES$RES_SPACE [ skipped ]" $ECHO "$RES$RES_SPACE [ skipped ]"
} }
disable_test() {
USERT=" ...."
SYST=" ...."
REALT=" ...."
pname=`$ECHO "$1 "|$CUT -c 1-24`
RES="$pname"
skip_inc
$ECHO "$RES$RES_SPACE [ disabled ] $2"
}
report_stats () { report_stats () {
if [ $TOT_FAIL = 0 ]; then if [ $TOT_FAIL = 0 ]; then
$ECHO "All $TOT_TEST tests were successful." $ECHO "All $TOT_TEST tests were successful."
...@@ -1411,6 +1429,12 @@ run_testcase () ...@@ -1411,6 +1429,12 @@ run_testcase ()
if [ -n "$RESULT_EXT" -a \( x$RECORD = x1 -o -f "$result_file$RESULT_EXT" \) ] ; then if [ -n "$RESULT_EXT" -a \( x$RECORD = x1 -o -f "$result_file$RESULT_EXT" \) ] ; then
result_file="$result_file$RESULT_EXT" result_file="$result_file$RESULT_EXT"
fi fi
if [ -e "$TESTDIR/$tname.disabled" ]
then
comment=`$CAT $TESTDIR/$tname.disabled`;
disable_test $tname "$comment"
return
fi
if [ "$USE_MANAGER" = 1 ] ; then if [ "$USE_MANAGER" = 1 ] ; then
many_slaves=`$EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \)` many_slaves=`$EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \)`
fi fi
......
DROP TABLE IF EXISTS t1,t2,T1,T2,t3,T3; DROP TABLE IF EXISTS t1,t2,T1,T2,t3,T3,tT;
DROP DATABASE IF EXISTS `TEST_$1`; DROP DATABASE IF EXISTS `TEST_$1`;
DROP DATABASE IF EXISTS `test_$1`; DROP DATABASE IF EXISTS `test_$1`;
CREATE TABLE T1 (a int); CREATE TABLE T1 (a int);
...@@ -131,3 +131,13 @@ show tables like 't1%'; ...@@ -131,3 +131,13 @@ show tables like 't1%';
Tables_in_test (t1%) Tables_in_test (t1%)
t1 t1
drop table t1; drop table t1;
create temporary table tT(a int(11), b varchar(8));
insert into tT values (1, 'abc');
select * from tT;
a b
1 abc
alter table tT add index (a);
select * from tT;
a b
1 abc
drop table tT;
drop table if exists t1, t2, t3, t4; drop table if exists t1, t2, t3, t4;
drop table if exists t1, t2, t3, t4; drop table if exists t1, t2, t3, t4;
start slave; start slave;
ERROR HY000: File 'TESTDIR/var/slave-data/master.info' not found (Errcode: 13) Got one of the listed errors
start slave; start slave;
ERROR HY000: Could not initialize master info structure; more error messages can be found in the MySQL error log ERROR HY000: Could not initialize master info structure; more error messages can be found in the MySQL error log
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root'; change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
......
Patrick Galbraith should fix this
...@@ -10,7 +10,7 @@ show variables like "lower_case_table_names"; ...@@ -10,7 +10,7 @@ show variables like "lower_case_table_names";
enable_query_log; enable_query_log;
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1,t2,T1,T2,t3,T3; DROP TABLE IF EXISTS t1,t2,T1,T2,t3,T3,tT;
DROP DATABASE IF EXISTS `TEST_$1`; DROP DATABASE IF EXISTS `TEST_$1`;
DROP DATABASE IF EXISTS `test_$1`; DROP DATABASE IF EXISTS `test_$1`;
--enable_warnings --enable_warnings
...@@ -100,3 +100,14 @@ show tables like 'T1%'; ...@@ -100,3 +100,14 @@ show tables like 'T1%';
alter table t1 add index (A); alter table t1 add index (A);
show tables like 't1%'; show tables like 't1%';
drop table t1; drop table t1;
#
# Bug #7261: Alter table loses temp table
#
create temporary table tT(a int(11), b varchar(8));
insert into tT values (1, 'abc');
select * from tT;
alter table tT add index (a);
select * from tT;
drop table tT;
...@@ -24,7 +24,7 @@ drop table if exists t1, t2, t3, t4; ...@@ -24,7 +24,7 @@ drop table if exists t1, t2, t3, t4;
# START SLAVE will fail because it can't read the file (mode 000) # START SLAVE will fail because it can't read the file (mode 000)
# (system error 13) # (system error 13)
--replace_result $MYSQL_TEST_DIR TESTDIR --replace_result $MYSQL_TEST_DIR TESTDIR
--error 1105 --error 1105,1105
start slave; start slave;
system chmod 600 var/slave-data/master.info; system chmod 600 var/slave-data/master.info;
# It will fail again because the file is empty so the slave cannot get valuable # It will fail again because the file is empty so the slave cannot get valuable
......
...@@ -5,8 +5,8 @@ p=`pwd` ...@@ -5,8 +5,8 @@ p=`pwd`
cd $MYSQL_BASE_DIR/mysql-test cd $MYSQL_BASE_DIR/mysql-test
./mysql-test-run --with-ndbcluster --ndb-connectstring=$NDB_CONNECTSTRING $* | tee $p/output.txt ./mysql-test-run --with-ndbcluster --ndb-connectstring=$NDB_CONNECTSTRING $* | tee $p/output.txt
f=`grep -c '[ fail ]' $p/output.txt` f=`grep -c '\[ fail \]' $p/output.txt`
o=`grep -c '[ pass ]' $p/output.txt` o=`grep -c '\[ pass \]' $p/output.txt`
if [ $o -gt 0 -a $f -eq 0 ] if [ $o -gt 0 -a $f -eq 0 ]
then then
......
max-time: 25000
cmd: atrt-mysql-test-run
args: --force
max-time: 600
cmd: atrt-testBackup
args: -n BackupOne T1 T6 T3 I3
# BASIC FUNCTIONALITY # BASIC FUNCTIONALITY
max-time: 500 max-time: 500
cmd: testBasic cmd: testBasic
......
max-time: 25000
cmd: atrt-mysql-test-run
args: --force
# #
# INDEX # INDEX
# #
...@@ -22,10 +18,6 @@ args: -n CreateLoadDrop T1 T10 ...@@ -22,10 +18,6 @@ args: -n CreateLoadDrop T1 T10
# #
# BACKUP # BACKUP
# #
max-time: 600
cmd: atrt-testBackup
args: -n BackupOne T1 T6 T3 I3
max-time: 1000 max-time: 1000
cmd: atrt-testBackup cmd: atrt-testBackup
args: -n BackupBank T6 args: -n BackupBank T6
......
...@@ -5377,7 +5377,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, ...@@ -5377,7 +5377,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
Initialize a new table list for a nested join Initialize a new table list for a nested join
SYNOPSIS SYNOPSIS
init_table_list() init_nested_join()
thd current thread thd current thread
DESCRIPTION DESCRIPTION
......
...@@ -12963,7 +12963,7 @@ static void print_join(THD *thd, String *str, List<TABLE_LIST> *tables) ...@@ -12963,7 +12963,7 @@ static void print_join(THD *thd, String *str, List<TABLE_LIST> *tables)
{ {
TABLE_LIST *curr= *tbl; TABLE_LIST *curr= *tbl;
if (curr->outer_join) if (curr->outer_join)
str->append(" left join ", 11); // MySQL converg right to left joins str->append(" left join ", 11); // MySQL converts right to left joins
else if (curr->straight) else if (curr->straight)
str->append(" straight_join ", 15); str->append(" straight_join ", 15);
else else
......
...@@ -3375,7 +3375,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -3375,7 +3375,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
} }
/* Remove link to old table and rename the new one */ /* Remove link to old table and rename the new one */
close_temporary_table(thd, table->s->db, table_name); close_temporary_table(thd, table->s->db, table_name);
if (rename_temporary_table(thd, new_table, new_db, new_alias)) /* Should pass the 'new_name' as we store table name in the cache */
if (rename_temporary_table(thd, new_table, new_db, new_name))
{ // Fatal error { // Fatal error
close_temporary_table(thd,new_db,tmp_name); close_temporary_table(thd,new_db,tmp_name);
my_free((gptr) new_table,MYF(0)); my_free((gptr) new_table,MYF(0));
......
...@@ -36,9 +36,9 @@ INCLUDES = -I$(top_srcdir)/include $(openssl_includes) ...@@ -36,9 +36,9 @@ INCLUDES = -I$(top_srcdir)/include $(openssl_includes)
LIBS = @CLIENT_LIBS@ LIBS = @CLIENT_LIBS@
LDADD = @CLIENT_EXTRA_LDFLAGS@ \ LDADD = @CLIENT_EXTRA_LDFLAGS@ \
$(top_builddir)/libmysql/libmysqlclient.la $(top_builddir)/libmysql/libmysqlclient.la
client_test_LDADD= $(LDADD) $(CXXLDFLAGS) \ mysql_client_test_LDADD= $(LDADD) $(CXXLDFLAGS) \
$(top_builddir)/mysys/libmysys.a $(top_builddir)/mysys/libmysys.a
client_test_SOURCES= mysql_client_test.c mysql_client_test_SOURCES= mysql_client_test.c
insert_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) insert_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
select_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) select_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
......
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