1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00
sql/mysql_priv.h:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
mysql-test/r/subselect.result:
  SCCS merged
mysql-test/t/subselect.test:
  SCCS merged
This commit is contained in:
unknown
2003-10-23 21:26:06 +03:00
192 changed files with 3671 additions and 1106 deletions

View File

@ -515,6 +515,7 @@ scripts/fill_func_tables.sql
scripts/fill_help_tables scripts/fill_help_tables
scripts/fill_help_tables.sql scripts/fill_help_tables.sql
scripts/make_binary_distribution scripts/make_binary_distribution
scripts/make_sharedlib_distribution
scripts/make_win_src_distribution scripts/make_win_src_distribution
scripts/msql2mysql scripts/msql2mysql
scripts/mysql_config scripts/mysql_config

View File

@ -30,6 +30,7 @@ greg@mysql.com
guilhem@mysql.com guilhem@mysql.com
gweir@build.mysql.com gweir@build.mysql.com
gweir@work.mysql.com gweir@work.mysql.com
harrison@mysql.com
heikki@donna.mysql.fi heikki@donna.mysql.fi
heikki@hundin.mysql.fi heikki@hundin.mysql.fi
heikki@rescue. heikki@rescue.

View File

@ -26,7 +26,7 @@
/* We have to define 'enum options' identical in all files to keep OS2 happy */ /* We have to define 'enum options' identical in all files to keep OS2 happy */
enum options { OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET, enum options_client { OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET,
OPT_PAGER, OPT_NOPAGER, OPT_TEE, OPT_NOTEE, OPT_PAGER, OPT_NOPAGER, OPT_TEE, OPT_NOTEE,
OPT_LOW_PRIORITY, OPT_AUTO_REPAIR, OPT_COMPRESS, OPT_LOW_PRIORITY, OPT_AUTO_REPAIR, OPT_COMPRESS,
OPT_DROP, OPT_LOCKS, OPT_KEYWORDS, OPT_DELAYED, OPT_OPTIMIZE, OPT_DROP, OPT_LOCKS, OPT_KEYWORDS, OPT_DELAYED, OPT_OPTIMIZE,

View File

@ -426,7 +426,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'V': print_version(); exit(0); case 'V': print_version(); exit(0);
case 'X': case 'X':
opt_xml = 1; opt_xml = 1;
opt_disable_keys=0; extended_insert= opt_drop= opt_lock=
opt_disable_keys= opt_autocommit= opt_create_db= 0;
break; break;
case 'I': case 'I':
case '?': case '?':
@ -1153,7 +1154,7 @@ static void dumpTable(uint numFields, char *table)
safe_exit(EX_CONSCHECK); safe_exit(EX_CONSCHECK);
return; return;
} }
if (extended_insert && !opt_xml) if (extended_insert)
{ {
ulong length = lengths[i]; ulong length = lengths[i];
if (i == 0) if (i == 0)
@ -1238,7 +1239,7 @@ static void dumpTable(uint numFields, char *table)
if (opt_xml) if (opt_xml)
fprintf(md_result_file, "\t</row>\n"); fprintf(md_result_file, "\t</row>\n");
if (extended_insert && !opt_xml) if (extended_insert)
{ {
ulong row_length; ulong row_length;
dynstr_append(&extended_row,")"); dynstr_append(&extended_row,")");
@ -1251,15 +1252,12 @@ static void dumpTable(uint numFields, char *table)
} }
else else
{ {
if (row_break && !opt_xml) if (row_break)
fputs(";\n", md_result_file); fputs(";\n", md_result_file);
row_break=1; /* This is first row */ row_break=1; /* This is first row */
if (!opt_xml) fputs(insert_pat,md_result_file);
{ fputs(extended_row.str,md_result_file);
fputs(insert_pat,md_result_file);
fputs(extended_row.str,md_result_file);
}
total_length = row_length+init_length; total_length = row_length+init_length;
} }
} }
@ -1394,9 +1392,9 @@ static int init_dumping(char *database)
char qbuf[128]; char qbuf[128];
MYSQL_ROW row; MYSQL_ROW row;
MYSQL_RES *dbinfo; MYSQL_RES *dbinfo;
sprintf(qbuf,"SHOW CREATE DATABASE WITH IF NOT EXISTS %s",database); sprintf(qbuf,"SHOW CREATE DATABASE WITH IF NOT EXISTS %s",database);
if (mysql_query(sock, qbuf) || !(dbinfo = mysql_store_result(sock))) if (mysql_query(sock, qbuf) || !(dbinfo = mysql_store_result(sock)))
{ {
/* Old server version, dump generic CREATE DATABASE */ /* Old server version, dump generic CREATE DATABASE */
@ -1420,7 +1418,7 @@ static int init_dumping(char *database)
(opt_quoted ? "`" : "")); (opt_quoted ? "`" : ""));
} }
} }
if (extended_insert && !opt_xml) if (extended_insert)
if (init_dynamic_string(&extended_row, "", 1024, 1024)) if (init_dynamic_string(&extended_row, "", 1024, 1024))
exit(EX_EOM); exit(EX_EOM);
return 0; return 0;
@ -1683,15 +1681,15 @@ MASTER_LOG_POS=%s ;\n",row[0],row[1]);
if (mysql_query(sock, "COMMIT")) if (mysql_query(sock, "COMMIT"))
{ {
my_printf_error(0, "Error: Couldn't execute 'COMMIT': %s", my_printf_error(0, "Error: Couldn't execute 'COMMIT': %s",
MYF(0), mysql_error(sock)); MYF(0), mysql_error(sock));
} }
} }
dbDisconnect(current_host); dbDisconnect(current_host);
write_footer(md_result_file); write_footer(md_result_file);
if (md_result_file != stdout) if (md_result_file != stdout)
my_fclose(md_result_file, MYF(0)); my_fclose(md_result_file, MYF(0));
my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR)); my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
if (extended_insert & !opt_xml) if (extended_insert)
dynstr_free(&extended_row); dynstr_free(&extended_row);
my_end(0); my_end(0);
return(first_error); return(first_error);

View File

@ -1821,7 +1821,7 @@ AC_CHECK_FUNCS(alarm bmove \
cuserid fcntl fconvert poll \ cuserid fcntl fconvert poll \
getrusage getpwuid getcwd getrlimit getwd index stpcpy locking longjmp \ getrusage getpwuid getcwd getrlimit getwd index stpcpy locking longjmp \
perror pread realpath readlink rename \ perror pread realpath readlink rename \
socket strnlen madvise mkstemp \ socket strnlen madvise mallinfo mkstemp \
strtol strtoul strtoll strtoull snprintf tempnam thr_setconcurrency \ strtol strtoul strtoll strtoull snprintf tempnam thr_setconcurrency \
gethostbyaddr_r gethostbyname_r getpwnam \ gethostbyaddr_r gethostbyname_r getpwnam \
bfill bzero bcmp strstr strpbrk strerror \ bfill bzero bcmp strstr strpbrk strerror \

View File

@ -123,8 +123,8 @@ typedef struct my_collation_handler_st
int (*strcasecmp)(struct charset_info_st *, const char *, const char *); int (*strcasecmp)(struct charset_info_st *, const char *, const char *);
uint (*instr)(struct charset_info_st *, uint (*instr)(struct charset_info_st *,
const char *big, uint b_length, const char *b, uint b_length,
const char *small, uint s_length, const char *s, uint s_length,
my_match_t *match, uint nmatch); my_match_t *match, uint nmatch);
/* Hash calculation */ /* Hash calculation */
@ -257,8 +257,8 @@ extern void my_hash_sort_simple(CHARSET_INFO *cs,
extern uint my_lengthsp_8bit(CHARSET_INFO *cs, const char *ptr, uint length); extern uint my_lengthsp_8bit(CHARSET_INFO *cs, const char *ptr, uint length);
extern uint my_instr_simple(struct charset_info_st *, extern uint my_instr_simple(struct charset_info_st *,
const char *big, uint b_length, const char *b, uint b_length,
const char *small, uint s_length, const char *s, uint s_length,
my_match_t *match, uint nmatch); my_match_t *match, uint nmatch);
@ -326,8 +326,8 @@ int my_wildcmp_mb(CHARSET_INFO *,
uint my_numchars_mb(CHARSET_INFO *, const char *b, const char *e); uint my_numchars_mb(CHARSET_INFO *, const char *b, const char *e);
uint my_charpos_mb(CHARSET_INFO *, const char *b, const char *e, uint pos); uint my_charpos_mb(CHARSET_INFO *, const char *b, const char *e, uint pos);
uint my_instr_mb(struct charset_info_st *, uint my_instr_mb(struct charset_info_st *,
const char *big, uint b_length, const char *b, uint b_length,
const char *small, uint s_length, const char *s, uint s_length,
my_match_t *match, uint nmatch); my_match_t *match, uint nmatch);

View File

@ -49,20 +49,24 @@
/* The following is parameter to ha_rkey() how to use key */ /* The following is parameter to ha_rkey() how to use key */
/* We define a complete-field prefix of a key value as a prefix where the /*
last included field in the prefix contains the full field, not just some bytes We define a complete-field prefix of a key value as a prefix where
from the start of the field. A partial-field prefix is allowed to the last included field in the prefix contains the full field, not
contain only a few first bytes from the last included field. just some bytes from the start of the field. A partial-field prefix
is allowed to contain only a few first bytes from the last included
field.
Below HA_READ_KEY_EXACT, ..., HA_READ_BEFORE_KEY can take a Below HA_READ_KEY_EXACT, ..., HA_READ_BEFORE_KEY can take a
complete-field prefix of a key value as the search key. HA_READ_PREFIX complete-field prefix of a key value as the search
and HA_READ_PREFIX_LAST could also take a partial-field prefix, but key. HA_READ_PREFIX and HA_READ_PREFIX_LAST could also take a
currently (4.0.10) they are only used with complete-field prefixes. MySQL uses partial-field prefix, but currently (4.0.10) they are only used with
a padding trick to implement LIKE 'abc%' queries. complete-field prefixes. MySQL uses a padding trick to implement
LIKE 'abc%' queries.
NOTE that in InnoDB HA_READ_PREFIX_LAST will NOT work with a partial-field NOTE that in InnoDB HA_READ_PREFIX_LAST will NOT work with a
prefix because InnoDB currently strips spaces from the end of varchar partial-field prefix because InnoDB currently strips spaces from the
fields! */ end of varchar fields!
*/
enum ha_rkey_function { enum ha_rkey_function {
HA_READ_KEY_EXACT, /* Find first record else error */ HA_READ_KEY_EXACT, /* Find first record else error */

View File

@ -66,6 +66,9 @@ typedef int my_socket;
extern unsigned int mysql_port; extern unsigned int mysql_port;
extern char *mysql_unix_port; extern char *mysql_unix_port;
#define CLIENT_NET_READ_TIMEOUT 365*24*3600 /* Timeout on read */
#define CLIENT_NET_WRITE_TIMEOUT 365*24*3600 /* Timeout on write */
#ifdef __NETWARE__ #ifdef __NETWARE__
#pragma pack(push, 8) /* 8 byte alignment */ #pragma pack(push, 8) /* 8 byte alignment */
#endif #endif

View File

@ -295,4 +295,5 @@
#define ER_BAD_SLAVE_UNTIL_COND 1276 #define ER_BAD_SLAVE_UNTIL_COND 1276
#define ER_MISSING_SKIP_SLAVE 1277 #define ER_MISSING_SKIP_SLAVE 1277
#define ER_UNTIL_COND_IGNORED 1278 #define ER_UNTIL_COND_IGNORED 1278
#define ER_ERROR_MESSAGES 279 #define ER_WRONG_INDEX_NAME 1279
#define ER_ERROR_MESSAGES 280

View File

@ -49,6 +49,7 @@ int init_queue(QUEUE *queue,uint max_elements,uint offset_to_key,
int reinit_queue(QUEUE *queue,uint max_elements,uint offset_to_key, int reinit_queue(QUEUE *queue,uint max_elements,uint offset_to_key,
pbool max_at_top, queue_compare compare, pbool max_at_top, queue_compare compare,
void *first_cmp_arg); void *first_cmp_arg);
int resize_queue(QUEUE *queue, uint max_elements);
void delete_queue(QUEUE *queue); void delete_queue(QUEUE *queue);
void queue_insert(QUEUE *queue,byte *element); void queue_insert(QUEUE *queue,byte *element);
byte *queue_remove(QUEUE *queue,uint idx); byte *queue_remove(QUEUE *queue,uint idx);

View File

@ -159,3 +159,4 @@ ER_WARN_TOO_MANY_RECORDS, "01000", "",
ER_WARN_NULL_TO_NOTNULL, "01000", "", ER_WARN_NULL_TO_NOTNULL, "01000", "",
ER_WARN_DATA_OUT_OF_RANGE, "01000", "", ER_WARN_DATA_OUT_OF_RANGE, "01000", "",
ER_WARN_DATA_TRUNCATED, "01000", "", ER_WARN_DATA_TRUNCATED, "01000", "",
ER_WRONG_INDEX_NAME, "42000", "",

View File

@ -60,9 +60,10 @@ typedef my_bool ALARM;
#define thr_end_alarm(A) #define thr_end_alarm(A)
#define thr_alarm(A,B,C) ((*(A)=1)-1) #define thr_alarm(A,B,C) ((*(A)=1)-1)
/* The following should maybe be (*(A)) */ /* The following should maybe be (*(A)) */
#define thr_got_alarm(A) 0 #define thr_got_alarm(A) 0
#define init_thr_alarm(A) #define init_thr_alarm(A)
#define thr_alarm_kill(A) #define thr_alarm_kill(A)
#define resize_thr_alarm(N)
#define end_thr_alarm() #define end_thr_alarm()
#else #else
@ -100,6 +101,7 @@ typedef struct st_alarm {
#define thr_alarm_init(A) (*(A))=0 #define thr_alarm_init(A) (*(A))=0
#define thr_alarm_in_use(A) (*(A)!= 0) #define thr_alarm_in_use(A) (*(A)!= 0)
void init_thr_alarm(uint max_alarm); void init_thr_alarm(uint max_alarm);
void resize_thr_alarm(uint max_alarms);
my_bool thr_alarm(thr_alarm_t *alarmed, uint sec, ALARM *buff); my_bool thr_alarm(thr_alarm_t *alarmed, uint sec, ALARM *buff);
void thr_alarm_kill(pthread_t thread_id); void thr_alarm_kill(pthread_t thread_id);
void thr_end_alarm(thr_alarm_t *alarmed); void thr_end_alarm(thr_alarm_t *alarmed);

View File

@ -426,7 +426,8 @@ btr_page_free_for_ibuf(
flst_add_first(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, flst_add_first(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, mtr); page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, mtr);
ut_ad(flst_validate(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, mtr)); ut_ad(flst_validate(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
mtr));
} }
/****************************************************************** /******************************************************************

View File

@ -776,8 +776,8 @@ btr_search_guess_on_hash(
goto failure; goto failure;
} }
ut_ad(block->state == BUF_BLOCK_FILE_PAGE); ut_a(block->state == BUF_BLOCK_FILE_PAGE);
ut_ad(page_rec_is_user_rec(rec)); ut_a(page_rec_is_user_rec(rec));
btr_cur_position(index, rec, cursor); btr_cur_position(index, rec, cursor);

View File

@ -468,6 +468,11 @@ buf_block_init(
block->check_index_page_at_flush = FALSE; block->check_index_page_at_flush = FALSE;
block->in_free_list = FALSE;
block->in_LRU_list = FALSE;
block->n_pointers = 0;
rw_lock_create(&(block->lock)); rw_lock_create(&(block->lock));
ut_ad(rw_lock_validate(&(block->lock))); ut_ad(rw_lock_validate(&(block->lock)));
@ -687,6 +692,7 @@ buf_pool_init(
} }
UT_LIST_ADD_LAST(free, buf_pool->free, block); UT_LIST_ADD_LAST(free, buf_pool->free, block);
block->in_free_list = TRUE;
} }
mutex_exit(&(buf_pool->mutex)); mutex_exit(&(buf_pool->mutex));
@ -830,7 +836,7 @@ buf_page_make_young(
block = buf_block_align(frame); block = buf_block_align(frame);
ut_ad(block->state == BUF_BLOCK_FILE_PAGE); ut_a(block->state == BUF_BLOCK_FILE_PAGE);
buf_LRU_make_block_young(block); buf_LRU_make_block_young(block);
@ -845,7 +851,7 @@ buf_block_free(
/*===========*/ /*===========*/
buf_block_t* block) /* in, own: block to be freed */ buf_block_t* block) /* in, own: block to be freed */
{ {
ut_ad(block->state != BUF_BLOCK_FILE_PAGE); ut_a(block->state != BUF_BLOCK_FILE_PAGE);
mutex_enter(&(buf_pool->mutex)); mutex_enter(&(buf_pool->mutex));
@ -1109,6 +1115,8 @@ loop:
goto loop; goto loop;
} }
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
must_read = FALSE; must_read = FALSE;
if (block->io_fix == BUF_IO_READ) { if (block->io_fix == BUF_IO_READ) {
@ -1407,6 +1415,8 @@ buf_page_get_known_nowait(
return(FALSE); return(FALSE);
} }
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_block_buf_fix_inc_debug(block, file, line); buf_block_buf_fix_inc_debug(block, file, line);
#else #else
@ -1517,7 +1527,7 @@ buf_page_init(
buf_block_t* block) /* in: block to init */ buf_block_t* block) /* in: block to init */
{ {
ut_ad(mutex_own(&(buf_pool->mutex))); ut_ad(mutex_own(&(buf_pool->mutex)));
ut_ad(block->state == BUF_BLOCK_READY_FOR_USE); ut_a(block->state != BUF_BLOCK_FILE_PAGE);
/* Set the state of the block */ /* Set the state of the block */
block->magic_n = BUF_BLOCK_MAGIC_N; block->magic_n = BUF_BLOCK_MAGIC_N;
@ -1533,6 +1543,18 @@ buf_page_init(
/* Insert into the hash table of file pages */ /* Insert into the hash table of file pages */
if (buf_page_hash_get(space, offset)) {
fprintf(stderr,
"InnoDB: Error: page %lu %lu already found from the hash table\n", space,
offset);
buf_print();
buf_LRU_print();
buf_validate();
buf_LRU_validate();
ut_a(0);
}
HASH_INSERT(buf_block_t, hash, buf_pool->page_hash, HASH_INSERT(buf_block_t, hash, buf_pool->page_hash,
buf_page_address_fold(space, offset), block); buf_page_address_fold(space, offset), block);
@ -1605,7 +1627,7 @@ buf_page_init_for_read(
block = buf_block_alloc(); block = buf_block_alloc();
ut_ad(block); ut_a(block);
mutex_enter(&(buf_pool->mutex)); mutex_enter(&(buf_pool->mutex));
@ -1769,6 +1791,8 @@ buf_page_io_complete(
ut_ad(block); ut_ad(block);
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
io_type = block->io_fix; io_type = block->io_fix;
if (io_type == BUF_IO_READ) { if (io_type == BUF_IO_READ) {

View File

@ -50,6 +50,8 @@ buf_flush_insert_into_flush_list(
{ {
ut_ad(mutex_own(&(buf_pool->mutex))); ut_ad(mutex_own(&(buf_pool->mutex)));
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
ut_ad((UT_LIST_GET_FIRST(buf_pool->flush_list) == NULL) ut_ad((UT_LIST_GET_FIRST(buf_pool->flush_list) == NULL)
|| (ut_dulint_cmp( || (ut_dulint_cmp(
(UT_LIST_GET_FIRST(buf_pool->flush_list)) (UT_LIST_GET_FIRST(buf_pool->flush_list))
@ -131,7 +133,7 @@ buf_flush_ready_for_flush(
ulint flush_type)/* in: BUF_FLUSH_LRU or BUF_FLUSH_LIST */ ulint flush_type)/* in: BUF_FLUSH_LRU or BUF_FLUSH_LIST */
{ {
ut_ad(mutex_own(&(buf_pool->mutex))); ut_ad(mutex_own(&(buf_pool->mutex)));
ut_ad(block->state == BUF_BLOCK_FILE_PAGE); ut_a(block->state == BUF_BLOCK_FILE_PAGE);
if ((ut_dulint_cmp(block->oldest_modification, ut_dulint_zero) > 0) if ((ut_dulint_cmp(block->oldest_modification, ut_dulint_zero) > 0)
&& (block->io_fix == 0)) { && (block->io_fix == 0)) {
@ -163,6 +165,8 @@ buf_flush_write_complete(
ut_ad(block); ut_ad(block);
ut_ad(mutex_own(&(buf_pool->mutex))); ut_ad(mutex_own(&(buf_pool->mutex)));
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
block->oldest_modification = ut_dulint_zero; block->oldest_modification = ut_dulint_zero;
UT_LIST_REMOVE(flush_list, buf_pool->flush_list, block); UT_LIST_REMOVE(flush_list, buf_pool->flush_list, block);
@ -282,6 +286,8 @@ buf_flush_buffered_writes(void)
for (i = 0; i < trx_doublewrite->first_free; i++) { for (i = 0; i < trx_doublewrite->first_free; i++) {
block = trx_doublewrite->buf_block_arr[i]; block = trx_doublewrite->buf_block_arr[i];
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER, fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER,
FALSE, block->space, block->offset, 0, UNIV_PAGE_SIZE, FALSE, block->space, block->offset, 0, UNIV_PAGE_SIZE,
(void*)block->frame, (void*)block); (void*)block->frame, (void*)block);
@ -321,6 +327,8 @@ buf_flush_post_to_doublewrite_buf(
try_again: try_again:
mutex_enter(&(trx_doublewrite->mutex)); mutex_enter(&(trx_doublewrite->mutex));
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
if (trx_doublewrite->first_free if (trx_doublewrite->first_free
>= 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) { >= 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
mutex_exit(&(trx_doublewrite->mutex)); mutex_exit(&(trx_doublewrite->mutex));
@ -395,6 +403,8 @@ buf_flush_write_block_low(
/*======================*/ /*======================*/
buf_block_t* block) /* in: buffer block to write */ buf_block_t* block) /* in: buffer block to write */
{ {
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
#ifdef UNIV_IBUF_DEBUG #ifdef UNIV_IBUF_DEBUG
ut_a(ibuf_count_get(block->space, block->offset) == 0); ut_a(ibuf_count_get(block->space, block->offset) == 0);
#endif #endif
@ -443,7 +453,7 @@ buf_flush_try_page(
block = buf_page_hash_get(space, offset); block = buf_page_hash_get(space, offset);
ut_a(block->state == BUF_BLOCK_FILE_PAGE); ut_a(!block || block->state == BUF_BLOCK_FILE_PAGE);
if (flush_type == BUF_FLUSH_LIST if (flush_type == BUF_FLUSH_LIST
&& block && buf_flush_ready_for_flush(block, flush_type)) { && block && buf_flush_ready_for_flush(block, flush_type)) {
@ -635,6 +645,7 @@ buf_flush_try_neighbors(
for (i = low; i < high; i++) { for (i = low; i < high; i++) {
block = buf_page_hash_get(space, i); block = buf_page_hash_get(space, i);
ut_a(!block || block->state == BUF_BLOCK_FILE_PAGE);
if (block && flush_type == BUF_FLUSH_LRU && i != offset if (block && flush_type == BUF_FLUSH_LRU && i != offset
&& !block->old) { && !block->old) {
@ -703,10 +714,10 @@ buf_flush_batch(
ulint offset; ulint offset;
ibool found; ibool found;
ut_ad((flush_type == BUF_FLUSH_LRU) || (flush_type == BUF_FLUSH_LIST)); ut_ad((flush_type == BUF_FLUSH_LRU)
ut_ad((flush_type != BUF_FLUSH_LIST) || || (flush_type == BUF_FLUSH_LIST));
sync_thread_levels_empty_gen(TRUE)); ut_ad((flush_type != BUF_FLUSH_LIST)
|| sync_thread_levels_empty_gen(TRUE));
mutex_enter(&(buf_pool->mutex)); mutex_enter(&(buf_pool->mutex));
if ((buf_pool->n_flush[flush_type] > 0) if ((buf_pool->n_flush[flush_type] > 0)
@ -737,7 +748,6 @@ buf_flush_batch(
ut_ad(flush_type == BUF_FLUSH_LIST); ut_ad(flush_type == BUF_FLUSH_LIST);
block = UT_LIST_GET_LAST(buf_pool->flush_list); block = UT_LIST_GET_LAST(buf_pool->flush_list);
if (!block if (!block
|| (ut_dulint_cmp(block->oldest_modification, || (ut_dulint_cmp(block->oldest_modification,
lsn_limit) >= 0)) { lsn_limit) >= 0)) {
@ -756,6 +766,7 @@ buf_flush_batch(
function a pointer to a block in the list! */ function a pointer to a block in the list! */
while ((block != NULL) && !found) { while ((block != NULL) && !found) {
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
if (buf_flush_ready_for_flush(block, flush_type)) { if (buf_flush_ready_for_flush(block, flush_type)) {
@ -781,7 +792,6 @@ buf_flush_batch(
} else if (flush_type == BUF_FLUSH_LRU) { } else if (flush_type == BUF_FLUSH_LRU) {
block = UT_LIST_GET_PREV(LRU, block); block = UT_LIST_GET_PREV(LRU, block);
} else { } else {
ut_ad(flush_type == BUF_FLUSH_LIST); ut_ad(flush_type == BUF_FLUSH_LIST);

View File

@ -82,6 +82,8 @@ scan_again:
block = UT_LIST_GET_LAST(buf_pool->LRU); block = UT_LIST_GET_LAST(buf_pool->LRU);
while (block != NULL) { while (block != NULL) {
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
if (block->space == id if (block->space == id
&& (block->buf_fix_count > 0 || block->io_fix != 0)) { && (block->buf_fix_count > 0 || block->io_fix != 0)) {
@ -199,19 +201,16 @@ buf_LRU_search_and_free_block(
mutex_enter(&(buf_pool->mutex)); mutex_enter(&(buf_pool->mutex));
freed = FALSE; freed = FALSE;
block = UT_LIST_GET_LAST(buf_pool->LRU); block = UT_LIST_GET_LAST(buf_pool->LRU);
while (block != NULL) { while (block != NULL) {
ut_a(block->in_LRU_list);
if (buf_flush_ready_for_replace(block)) { if (buf_flush_ready_for_replace(block)) {
if (buf_debug_prints) { if (buf_debug_prints) {
printf( printf(
"Putting space %lu page %lu to free list\n", "Putting space %lu page %lu to free list\n",
block->space, block->offset); block->space, block->offset);
} }
buf_LRU_block_remove_hashed_page(block); buf_LRU_block_remove_hashed_page(block);
mutex_exit(&(buf_pool->mutex)); mutex_exit(&(buf_pool->mutex));
@ -223,25 +222,21 @@ buf_LRU_search_and_free_block(
if (block->frame) { if (block->frame) {
btr_search_drop_page_hash_index(block->frame); btr_search_drop_page_hash_index(block->frame);
} }
mutex_enter(&(buf_pool->mutex)); mutex_enter(&(buf_pool->mutex));
ut_a(block->buf_fix_count == 0); ut_a(block->buf_fix_count == 0);
buf_LRU_block_free_hashed_page(block); buf_LRU_block_free_hashed_page(block);
freed = TRUE; freed = TRUE;
break; break;
} }
block = UT_LIST_GET_PREV(LRU, block); block = UT_LIST_GET_PREV(LRU, block);
distance++; distance++;
if (!freed && n_iterations <= 10 if (!freed && n_iterations <= 10
&& distance > 100 + (n_iterations * buf_pool->curr_size) && distance > 100 + (n_iterations * buf_pool->curr_size)
/ 10) { / 10) {
buf_pool->LRU_flush_ended = 0; buf_pool->LRU_flush_ended = 0;
mutex_exit(&(buf_pool->mutex)); mutex_exit(&(buf_pool->mutex));
@ -249,15 +244,12 @@ buf_LRU_search_and_free_block(
return(FALSE); return(FALSE);
} }
} }
if (buf_pool->LRU_flush_ended > 0) { if (buf_pool->LRU_flush_ended > 0) {
buf_pool->LRU_flush_ended--; buf_pool->LRU_flush_ended--;
} }
if (!freed) {
if (!freed) {
buf_pool->LRU_flush_ended = 0; buf_pool->LRU_flush_ended = 0;
} }
mutex_exit(&(buf_pool->mutex)); mutex_exit(&(buf_pool->mutex));
return(freed); return(freed);
@ -355,7 +347,11 @@ loop:
if (UT_LIST_GET_LEN(buf_pool->free) > 0) { if (UT_LIST_GET_LEN(buf_pool->free) > 0) {
block = UT_LIST_GET_FIRST(buf_pool->free); block = UT_LIST_GET_FIRST(buf_pool->free);
ut_a(block->in_free_list);
UT_LIST_REMOVE(free, buf_pool->free, block); UT_LIST_REMOVE(free, buf_pool->free, block);
block->in_free_list = FALSE;
ut_a(block->state != BUF_BLOCK_FILE_PAGE);
ut_a(!block->in_LRU_list);
if (srv_use_awe) { if (srv_use_awe) {
if (block->frame) { if (block->frame) {
@ -466,7 +462,7 @@ buf_LRU_old_adjust_len(void)
ulint old_len; ulint old_len;
ulint new_len; ulint new_len;
ut_ad(buf_pool->LRU_old); ut_a(buf_pool->LRU_old);
ut_ad(mutex_own(&(buf_pool->mutex))); ut_ad(mutex_own(&(buf_pool->mutex)));
ut_ad(3 * (BUF_LRU_OLD_MIN_LEN / 8) > BUF_LRU_OLD_TOLERANCE + 5); ut_ad(3 * (BUF_LRU_OLD_MIN_LEN / 8) > BUF_LRU_OLD_TOLERANCE + 5);
@ -474,6 +470,8 @@ buf_LRU_old_adjust_len(void)
old_len = buf_pool->LRU_old_len; old_len = buf_pool->LRU_old_len;
new_len = 3 * (UT_LIST_GET_LEN(buf_pool->LRU) / 8); new_len = 3 * (UT_LIST_GET_LEN(buf_pool->LRU) / 8);
ut_a(buf_pool->LRU_old->in_LRU_list);
/* Update the LRU_old pointer if necessary */ /* Update the LRU_old pointer if necessary */
if (old_len < new_len - BUF_LRU_OLD_TOLERANCE) { if (old_len < new_len - BUF_LRU_OLD_TOLERANCE) {
@ -490,7 +488,7 @@ buf_LRU_old_adjust_len(void)
buf_pool->LRU_old); buf_pool->LRU_old);
buf_pool->LRU_old_len--; buf_pool->LRU_old_len--;
} else { } else {
ut_ad(buf_pool->LRU_old); /* Check that we did not ut_a(buf_pool->LRU_old); /* Check that we did not
fall out of the LRU list */ fall out of the LRU list */
return; return;
} }
@ -498,9 +496,8 @@ buf_LRU_old_adjust_len(void)
} }
/*********************************************************************** /***********************************************************************
Initializes the old blocks pointer in the LRU list. Initializes the old blocks pointer in the LRU list. This function should be
This function should be called when the LRU list grows to called when the LRU list grows to BUF_LRU_OLD_MIN_LEN length. */
BUF_LRU_OLD_MIN_LEN length. */
static static
void void
buf_LRU_old_init(void) buf_LRU_old_init(void)
@ -508,7 +505,7 @@ buf_LRU_old_init(void)
{ {
buf_block_t* block; buf_block_t* block;
ut_ad(UT_LIST_GET_LEN(buf_pool->LRU) == BUF_LRU_OLD_MIN_LEN); ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == BUF_LRU_OLD_MIN_LEN);
/* We first initialize all blocks in the LRU list as old and then use /* We first initialize all blocks in the LRU list as old and then use
the adjust function to move the LRU_old pointer to the right the adjust function to move the LRU_old pointer to the right
@ -517,6 +514,8 @@ buf_LRU_old_init(void)
block = UT_LIST_GET_FIRST(buf_pool->LRU); block = UT_LIST_GET_FIRST(buf_pool->LRU);
while (block != NULL) { while (block != NULL) {
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
ut_a(block->in_LRU_list);
block->old = TRUE; block->old = TRUE;
block = UT_LIST_GET_NEXT(LRU, block); block = UT_LIST_GET_NEXT(LRU, block);
} }
@ -539,6 +538,9 @@ buf_LRU_remove_block(
ut_ad(block); ut_ad(block);
ut_ad(mutex_own(&(buf_pool->mutex))); ut_ad(mutex_own(&(buf_pool->mutex)));
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
ut_a(block->in_LRU_list);
/* If the LRU_old pointer is defined and points to just this block, /* If the LRU_old pointer is defined and points to just this block,
move it backward one step */ move it backward one step */
@ -552,11 +554,12 @@ buf_LRU_remove_block(
(buf_pool->LRU_old)->old = TRUE; (buf_pool->LRU_old)->old = TRUE;
buf_pool->LRU_old_len++; buf_pool->LRU_old_len++;
ut_ad(buf_pool->LRU_old); ut_a(buf_pool->LRU_old);
} }
/* Remove the block from the LRU list */ /* Remove the block from the LRU list */
UT_LIST_REMOVE(LRU, buf_pool->LRU, block); UT_LIST_REMOVE(LRU, buf_pool->LRU, block);
block->in_LRU_list = FALSE;
if (srv_use_awe && block->frame) { if (srv_use_awe && block->frame) {
/* Remove from the list of mapped pages */ /* Remove from the list of mapped pages */
@ -599,6 +602,8 @@ buf_LRU_add_block_to_end_low(
ut_ad(block); ut_ad(block);
ut_ad(mutex_own(&(buf_pool->mutex))); ut_ad(mutex_own(&(buf_pool->mutex)));
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
block->old = TRUE; block->old = TRUE;
last_block = UT_LIST_GET_LAST(buf_pool->LRU); last_block = UT_LIST_GET_LAST(buf_pool->LRU);
@ -609,7 +614,9 @@ buf_LRU_add_block_to_end_low(
block->LRU_position = buf_pool_clock_tic(); block->LRU_position = buf_pool_clock_tic();
} }
ut_a(!block->in_LRU_list);
UT_LIST_ADD_LAST(LRU, buf_pool->LRU, block); UT_LIST_ADD_LAST(LRU, buf_pool->LRU, block);
block->in_LRU_list = TRUE;
if (srv_use_awe && block->frame) { if (srv_use_awe && block->frame) {
/* Add to the list of mapped pages */ /* Add to the list of mapped pages */
@ -658,6 +665,9 @@ buf_LRU_add_block_low(
ut_ad(block); ut_ad(block);
ut_ad(mutex_own(&(buf_pool->mutex))); ut_ad(mutex_own(&(buf_pool->mutex)));
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
ut_a(!block->in_LRU_list);
block->old = old; block->old = old;
cl = buf_pool_clock_tic(); cl = buf_pool_clock_tic();
@ -687,6 +697,8 @@ buf_LRU_add_block_low(
block->LRU_position = (buf_pool->LRU_old)->LRU_position; block->LRU_position = (buf_pool->LRU_old)->LRU_position;
} }
block->in_LRU_list = TRUE;
if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) { if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) {
ut_ad(buf_pool->LRU_old); ut_ad(buf_pool->LRU_old);
@ -755,9 +767,12 @@ buf_LRU_block_free_non_file_page(
ut_ad(mutex_own(&(buf_pool->mutex))); ut_ad(mutex_own(&(buf_pool->mutex)));
ut_ad(block); ut_ad(block);
ut_ad((block->state == BUF_BLOCK_MEMORY) ut_a((block->state == BUF_BLOCK_MEMORY)
|| (block->state == BUF_BLOCK_READY_FOR_USE)); || (block->state == BUF_BLOCK_READY_FOR_USE));
ut_a(block->n_pointers == 0);
ut_a(!block->in_free_list);
block->state = BUF_BLOCK_NOT_USED; block->state = BUF_BLOCK_NOT_USED;
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
@ -765,6 +780,7 @@ buf_LRU_block_free_non_file_page(
memset(block->frame, '\0', UNIV_PAGE_SIZE); memset(block->frame, '\0', UNIV_PAGE_SIZE);
#endif #endif
UT_LIST_ADD_FIRST(free, buf_pool->free, block); UT_LIST_ADD_FIRST(free, buf_pool->free, block);
block->in_free_list = TRUE;
if (srv_use_awe && block->frame) { if (srv_use_awe && block->frame) {
/* Add to the list of mapped pages */ /* Add to the list of mapped pages */
@ -788,8 +804,7 @@ buf_LRU_block_remove_hashed_page(
ut_ad(mutex_own(&(buf_pool->mutex))); ut_ad(mutex_own(&(buf_pool->mutex)));
ut_ad(block); ut_ad(block);
ut_ad(block->state == BUF_BLOCK_FILE_PAGE); ut_a(block->state == BUF_BLOCK_FILE_PAGE);
ut_a(block->io_fix == 0); ut_a(block->io_fix == 0);
ut_a(block->buf_fix_count == 0); ut_a(block->buf_fix_count == 0);
ut_a(ut_dulint_cmp(block->oldest_modification, ut_dulint_zero) == 0); ut_a(ut_dulint_cmp(block->oldest_modification, ut_dulint_zero) == 0);
@ -802,6 +817,28 @@ buf_LRU_block_remove_hashed_page(
buf_block_modify_clock_inc(block); buf_block_modify_clock_inc(block);
if (block != buf_page_hash_get(block->space, block->offset)) {
fprintf(stderr,
"InnoDB: Error: page %lu %lu not found from the hash table\n",
block->space,
block->offset);
if (buf_page_hash_get(block->space, block->offset)) {
fprintf(stderr,
"InnoDB: From hash table we find block %lx of %lu %lu which is not %lx\n",
(ulint)buf_page_hash_get(block->space, block->offset),
buf_page_hash_get(block->space, block->offset)->space,
buf_page_hash_get(block->space, block->offset)->offset,
(ulint)block);
}
buf_print();
buf_LRU_print();
buf_validate();
buf_LRU_validate();
ut_a(0);
}
HASH_DELETE(buf_block_t, hash, buf_pool->page_hash, HASH_DELETE(buf_block_t, hash, buf_pool->page_hash,
buf_page_address_fold(block->space, block->offset), buf_page_address_fold(block->space, block->offset),
block); block);
@ -819,7 +856,7 @@ buf_LRU_block_free_hashed_page(
be in a state where it can be freed */ be in a state where it can be freed */
{ {
ut_ad(mutex_own(&(buf_pool->mutex))); ut_ad(mutex_own(&(buf_pool->mutex)));
ut_ad(block->state == BUF_BLOCK_REMOVE_HASH); ut_a(block->state == BUF_BLOCK_REMOVE_HASH);
block->state = BUF_BLOCK_MEMORY; block->state = BUF_BLOCK_MEMORY;

View File

@ -129,6 +129,8 @@ buf_read_page_low(
offset, sync); offset, sync);
} }
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
*err = fil_io(OS_FILE_READ | wake_later, *err = fil_io(OS_FILE_READ | wake_later,
sync, space, sync, space,
offset, 0, UNIV_PAGE_SIZE, offset, 0, UNIV_PAGE_SIZE,
@ -604,7 +606,6 @@ buf_read_ibuf_merge_pages(
} }
for (i = 0; i < n_stored; i++) { for (i = 0; i < n_stored; i++) {
if ((i + 1 == n_stored) && sync) { if ((i + 1 == n_stored) && sync) {
buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE,
space_ids[i], space_versions[i], page_nos[i]); space_ids[i], space_versions[i], page_nos[i]);

View File

@ -1302,11 +1302,13 @@ fil_write_flushed_lsn_to_data_files(
space = UT_LIST_GET_FIRST(fil_system->space_list); space = UT_LIST_GET_FIRST(fil_system->space_list);
while (space) { while (space) {
/* We only write the lsn to the system tablespace /* We only write the lsn to all existing data files which have
(space id == 0) files */ been open during the lifetime of the mysqld process; they are
represented by the space objects in the tablespace memory
cache. Note that all data files in the system tablespace 0 are
always open. */
if (space->id == 0) { if (space->purpose == FIL_TABLESPACE) {
ut_a(space->purpose == FIL_TABLESPACE);
sum_of_sizes = 0; sum_of_sizes = 0;
node = UT_LIST_GET_FIRST(space->chain); node = UT_LIST_GET_FIRST(space->chain);
@ -1326,8 +1328,6 @@ fil_write_flushed_lsn_to_data_files(
sum_of_sizes += node->size; sum_of_sizes += node->size;
node = UT_LIST_GET_NEXT(chain, node); node = UT_LIST_GET_NEXT(chain, node);
} }
break; /* there is only one space with id == 0 */
} }
space = UT_LIST_GET_NEXT(space_list, space); space = UT_LIST_GET_NEXT(space_list, space);
} }
@ -1517,8 +1517,8 @@ try_again:
if (space == NULL) { if (space == NULL) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Error: cannot delete tablespace %lu because it is not found\n" " InnoDB: Error: cannot delete tablespace %lu\n"
"InnoDB: in the tablespace memory cache.\n", id); "InnoDB: because it is not found in the tablespace memory cache.\n", id);
mutex_exit(&(system->mutex)); mutex_exit(&(system->mutex));
@ -1937,6 +1937,147 @@ fil_create_new_single_table_tablespace(
return(DB_SUCCESS); return(DB_SUCCESS);
} }
/************************************************************************
It is possible, though very improbable, that the lsn's in the tablespace to be
imported have risen above the current system lsn, if a lengthy purge, ibuf
merge, or rollback was performed on a backup taken with ibbackup. If that is
the case, reset page lsn's in the file. We assume that mysqld was shut down
after it performed these cleanup operations on the .ibd file, so that it at
the shutdown stamped the latest lsn to the FIL_PAGE_FILE_FLUSH_LSN in the
first page of the .ibd file, and we can determine whether we need to reset the
lsn's just by looking at that flush lsn. */
ibool
fil_reset_too_high_lsns(
/*====================*/
/* out: TRUE if success */
char* name, /* in: table name in the databasename/tablename
format */
dulint current_lsn) /* in: reset lsn's if the lsn stamped to
FIL_PAGE_FILE_FLUSH_LSN in the first page is
too high */
{
os_file_t file;
char* filepath;
byte* page;
dulint flush_lsn;
ulint space_id;
ib_longlong file_size;
ib_longlong offset;
ulint page_no;
ibool success;
filepath = ut_malloc(OS_FILE_MAX_PATH);
ut_a(strlen(name) < OS_FILE_MAX_PATH - 10);
sprintf(filepath, "./%s.ibd", name);
srv_normalize_path_for_win(filepath);
file = os_file_create_simple_no_error_handling(filepath, OS_FILE_OPEN,
OS_FILE_READ_WRITE, &success);
if (!success) {
ut_free(filepath);
return(FALSE);
}
/* Read the first page of the tablespace */
page = ut_malloc(UNIV_PAGE_SIZE);
success = os_file_read(file, page, 0, 0, UNIV_PAGE_SIZE);
if (!success) {
goto func_exit;
}
/* We have to read the file flush lsn from the header of the file */
flush_lsn = mach_read_from_8(page + FIL_PAGE_FILE_FLUSH_LSN);
if (ut_dulint_cmp(current_lsn, flush_lsn) >= 0) {
/* Ok */
success = TRUE;
goto func_exit;
}
space_id = fsp_header_get_space_id(page);
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Flush lsn in the tablespace file %lu to be imported\n"
"InnoDB: is %lu %lu, which exceeds current system lsn %lu %lu.\n"
"InnoDB: We reset the lsn's in the file %s.\n",
space_id,
ut_dulint_get_high(flush_lsn),
ut_dulint_get_low(flush_lsn),
ut_dulint_get_high(current_lsn),
ut_dulint_get_low(current_lsn), filepath);
/* Loop through all the pages in the tablespace and reset the lsn and
the page checksum if necessary */
file_size = os_file_get_size_as_iblonglong(file);
for (offset = 0; offset < file_size; offset += UNIV_PAGE_SIZE) {
success = os_file_read(file, page,
(ulint)(offset & 0xFFFFFFFFUL),
(ulint)(offset >> 32), UNIV_PAGE_SIZE);
if (!success) {
goto func_exit;
}
if (ut_dulint_cmp(mach_read_from_8(page + FIL_PAGE_LSN),
current_lsn) > 0) {
/* We have to reset the lsn */
space_id = mach_read_from_4(page
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
page_no = mach_read_from_4(page + FIL_PAGE_OFFSET);
buf_flush_init_for_writing(page, current_lsn, space_id,
page_no);
success = os_file_write(filepath, file, page,
(ulint)(offset & 0xFFFFFFFFUL),
(ulint)(offset >> 32), UNIV_PAGE_SIZE);
if (!success) {
goto func_exit;
}
}
}
success = os_file_flush(file);
if (!success) {
goto func_exit;
}
/* We now update the flush_lsn stamp at the start of the file */
success = os_file_read(file, page, 0, 0, UNIV_PAGE_SIZE);
if (!success) {
goto func_exit;
}
mach_write_to_8(page + FIL_PAGE_FILE_FLUSH_LSN, current_lsn);
success = os_file_write(filepath, file, page, 0, 0, UNIV_PAGE_SIZE);
if (!success) {
goto func_exit;
}
success = os_file_flush(file);
func_exit:
os_file_close(file);
ut_free(page);
ut_free(filepath);
return(success);
}
/************************************************************************ /************************************************************************
Tries to open a single-table tablespace and checks the space id is right in Tries to open a single-table tablespace and checks the space id is right in
it. If does not succeed, prints an error message to the .err log. This it. If does not succeed, prints an error message to the .err log. This
@ -1982,7 +2123,9 @@ fil_open_single_table_tablespace(
"InnoDB: open the tablespace file %s!\n", filepath); "InnoDB: open the tablespace file %s!\n", filepath);
fprintf(stderr, fprintf(stderr,
"InnoDB: have you moved InnoDB .ibd files around without using the\n" "InnoDB: have you moved InnoDB .ibd files around without using the\n"
"InnoDB: commands DISCARD TABLESPACE and IMPORT TABLESPACE?\n"); "InnoDB: commands DISCARD TABLESPACE and IMPORT TABLESPACE?\n"
"InnoDB: You can look from section 15.1 of http://www.innodb.com/ibman.html\n"
"InnoDB: how to resolve the issue.\n");
ut_free(filepath); ut_free(filepath);
@ -2007,7 +2150,9 @@ fil_open_single_table_tablespace(
"InnoDB: data dictionary it is %lu.\n", filepath, space_id, id); "InnoDB: data dictionary it is %lu.\n", filepath, space_id, id);
fprintf(stderr, fprintf(stderr,
"InnoDB: Have you moved InnoDB .ibd files around without using the\n" "InnoDB: Have you moved InnoDB .ibd files around without using the\n"
"InnoDB: commands DISCARD TABLESPACE and IMPORT TABLESPACE?\n"); "InnoDB: commands DISCARD TABLESPACE and IMPORT TABLESPACE?\n"
"InnoDB: You can look from section 15.1 of http://www.innodb.com/ibman.html\n"
"InnoDB: how to resolve the issue.\n");
ret = FALSE; ret = FALSE;
@ -2321,7 +2466,8 @@ fil_tablespace_deleted_or_being_deleted_in_mem(
return(TRUE); return(TRUE);
} }
if (version != -1LL && space->tablespace_version != version) { if (version != ((ib_longlong)-1)
&& space->tablespace_version != version) {
mutex_exit(&(system->mutex)); mutex_exit(&(system->mutex));
return(TRUE); return(TRUE);
@ -2426,19 +2572,24 @@ fil_space_for_table_exists_in_mem(
if (namespace == NULL) { if (namespace == NULL) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Error: table %s in InnoDB data dictionary has tablespace\n" " InnoDB: Error: table %s\n"
"InnoDB: id %lu, but tablespace with that id or name does not exist. Have\n" "InnoDB: in InnoDB data dictionary has tablespace id %lu,\n"
"InnoDB: you deleted or moved .ibd files? We cannot open table %s now.\n", "InnoDB: but tablespace with that id or name does not exist. Have\n"
name, id, name); "InnoDB: you deleted or moved .ibd files?\n",
name, id);
} else { } else {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Error: table %s in InnoDB data dictionary has tablespace\n" " InnoDB: Error: table %s\n"
"InnoDB: id %lu, but tablespace with that id does not exist. There is\n" "InnoDB: in InnoDB data dictionary has tablespace id %lu,\n"
"InnoDB: but tablespace with that id does not exist. There is\n"
"InnoDB: a tablespace of name %s and id %lu, though. Have\n" "InnoDB: a tablespace of name %s and id %lu, though. Have\n"
"InnoDB: you deleted or moved .ibd files? We cannot open table %s now.\n", "InnoDB: you deleted or moved .ibd files?\n",
name, id, namespace->name, namespace->id, name); name, id, namespace->name, namespace->id);
} }
fprintf(stderr,
"InnoDB: You can look from section 15.1 of http://www.innodb.com/ibman.html\n"
"InnoDB: how to resolve the issue.\n");
mutex_exit(&(system->mutex)); mutex_exit(&(system->mutex));
@ -2448,16 +2599,20 @@ fil_space_for_table_exists_in_mem(
if (0 != strcmp(space->name, path)) { if (0 != strcmp(space->name, path)) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Error: table %s in InnoDB data dictionary has tablespace\n" " InnoDB: Error: table %s\n"
"InnoDB: id %lu, but tablespace with that id has name %s. Have you\n" "InnoDB: in InnoDB data dictionary has tablespace id %lu,\n"
"InnoDB: deleted or moved .ibd files? We cannot open table %s now.\n", "InnoDB: but tablespace with that id has name %s.\n"
name, id, space->name, name); "InnoDB: Have you deleted or moved .ibd files?", name, id, space->name);
if (namespace != NULL) { if (namespace != NULL) {
fprintf(stderr, fprintf(stderr,
"InnoDB: There is a tablespace with the right name %s, but its id is %lu.\n", "InnoDB: There is a tablespace with the right name\n"
namespace->name, namespace->id); "InnoDB: %s, but its id is %lu.\n", namespace->name, namespace->id);
} }
fprintf(stderr,
"InnoDB: You can look from section 15.1 of http://www.innodb.com/ibman.html\n"
"InnoDB: how to resolve the issue.\n");
mutex_exit(&(system->mutex)); mutex_exit(&(system->mutex));
return(FALSE); return(FALSE);

View File

@ -34,6 +34,12 @@ ha_create(
table = hash_create(n); table = hash_create(n);
if (in_btr_search) {
table->adaptive = TRUE;
} else {
table->adaptive = FALSE;
}
if (n_mutexes == 0) { if (n_mutexes == 0) {
if (in_btr_search) { if (in_btr_search) {
table->heap = mem_heap_create_in_btr_search(4096); table->heap = mem_heap_create_in_btr_search(4096);
@ -106,6 +112,7 @@ ha_insert_for_fold(
hash_cell_t* cell; hash_cell_t* cell;
ha_node_t* node; ha_node_t* node;
ha_node_t* prev_node; ha_node_t* prev_node;
buf_block_t* prev_block;
ulint hash; ulint hash;
ut_ad(table && data); ut_ad(table && data);
@ -119,6 +126,12 @@ ha_insert_for_fold(
while (prev_node != NULL) { while (prev_node != NULL) {
if (prev_node->fold == fold) { if (prev_node->fold == fold) {
if (table->adaptive) {
prev_block = buf_block_align(prev_node->data);
ut_a(prev_block->n_pointers > 0);
prev_block->n_pointers--;
buf_block_align(data)->n_pointers++;
}
prev_node->data = data; prev_node->data = data;
@ -142,6 +155,11 @@ ha_insert_for_fold(
} }
ha_node_set_data(node, data); ha_node_set_data(node, data);
if (table->adaptive) {
buf_block_align(data)->n_pointers++;
}
node->fold = fold; node->fold = fold;
node->next = NULL; node->next = NULL;
@ -174,6 +192,11 @@ ha_delete_hash_node(
hash_table_t* table, /* in: hash table */ hash_table_t* table, /* in: hash table */
ha_node_t* del_node) /* in: node to be deleted */ ha_node_t* del_node) /* in: node to be deleted */
{ {
if (table->adaptive) {
ut_a(buf_block_align(del_node->data)->n_pointers > 0);
buf_block_align(del_node->data)->n_pointers--;
}
HASH_DELETE_AND_COMPACT(ha_node_t, next, table, del_node); HASH_DELETE_AND_COMPACT(ha_node_t, next, table, del_node);
} }
@ -199,6 +222,35 @@ ha_delete(
ha_delete_hash_node(table, node); ha_delete_hash_node(table, node);
} }
/*************************************************************
Looks for an element when we know the pointer to the data, and updates
the pointer to data, if found. */
void
ha_search_and_update_if_found(
/*==========================*/
hash_table_t* table, /* in: hash table */
ulint fold, /* in: folded value of the searched data */
void* data, /* in: pointer to the data */
void* new_data)/* in: new pointer to the data */
{
ha_node_t* node;
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
node = ha_search_with_data(table, fold, data);
if (node) {
if (table->adaptive) {
ut_a(buf_block_align(node->data)->n_pointers > 0);
buf_block_align(node->data)->n_pointers--;
buf_block_align(new_data)->n_pointers++;
}
node->data = new_data;
}
}
/********************************************************************* /*********************************************************************
Removes from the chain determined by fold all nodes whose data pointer Removes from the chain determined by fold all nodes whose data pointer
points to the page given. */ points to the page given. */
@ -229,10 +281,10 @@ ha_remove_all_nodes_to_page(
node = ha_chain_get_first(table, fold); node = ha_chain_get_first(table, fold);
} else { } else {
node = ha_chain_get_next(table, node); node = ha_chain_get_next(node);
} }
} }
#ifdef UNIV_DEBUG
/* Check that all nodes really got deleted */ /* Check that all nodes really got deleted */
node = ha_chain_get_first(table, fold); node = ha_chain_get_first(table, fold);
@ -240,8 +292,9 @@ ha_remove_all_nodes_to_page(
while (node) { while (node) {
ut_a(buf_frame_align(ha_node_get_data(node)) != page); ut_a(buf_frame_align(ha_node_get_data(node)) != page);
node = ha_chain_get_next(table, node); node = ha_chain_get_next(node);
} }
#endif
} }
/***************************************************************** /*****************************************************************
@ -293,12 +346,10 @@ ha_print_info(
hash_table_t* table) /* in: hash table */ hash_table_t* table) /* in: hash table */
{ {
hash_cell_t* cell; hash_cell_t* cell;
/* /* ha_node_t* node;
ha_node_t* node; ulint nodes = 0;
ulint len = 0; ulint len = 0;
ulint max_len = 0; ulint max_len = 0; */
ulint nodes = 0;
*/
ulint cells = 0; ulint cells = 0;
ulint n_bufs; ulint n_bufs;
ulint i; ulint i;

View File

@ -91,6 +91,7 @@ hash_create(
array = ut_malloc(sizeof(hash_cell_t) * prime); array = ut_malloc(sizeof(hash_cell_t) * prime);
table->adaptive = FALSE;
table->array = array; table->array = array;
table->n_cells = prime; table->n_cells = prime;
table->n_mutexes = 0; table->n_mutexes = 0;

View File

@ -755,12 +755,16 @@ struct buf_block_struct{
UT_LIST_NODE_T(buf_block_t) free; UT_LIST_NODE_T(buf_block_t) free;
/* node of the free block list */ /* node of the free block list */
ibool in_free_list; /* TRUE if in the free list; used in
debugging */
UT_LIST_NODE_T(buf_block_t) LRU; UT_LIST_NODE_T(buf_block_t) LRU;
/* node of the LRU list */ /* node of the LRU list */
UT_LIST_NODE_T(buf_block_t) awe_LRU_free_mapped; UT_LIST_NODE_T(buf_block_t) awe_LRU_free_mapped;
/* in the AWE version node in the /* in the AWE version node in the
list of free and LRU blocks which are list of free and LRU blocks which are
mapped to a frame */ mapped to a frame */
ibool in_LRU_list; /* TRUE of the page is in the LRU list;
used in debugging */
ulint LRU_position; /* value which monotonically ulint LRU_position; /* value which monotonically
decreases (or may stay constant if decreases (or may stay constant if
the block is in the old blocks) toward the block is in the old blocks) toward
@ -821,6 +825,9 @@ struct buf_block_struct{
complete, though: there may have been complete, though: there may have been
hash collisions, record deletions, hash collisions, record deletions,
etc. */ etc. */
ulint n_pointers; /* used in debugging: the number of
pointers in the adaptive hash index
pointing to this frame */
ulint curr_n_fields; /* prefix length for hash indexing: ulint curr_n_fields; /* prefix length for hash indexing:
number of full fields */ number of full fields */
ulint curr_n_bytes; /* number of bytes in hash indexing */ ulint curr_n_bytes; /* number of bytes in hash indexing */

View File

@ -28,7 +28,6 @@ buf_block_peek_if_too_old(
{ {
if (buf_pool->freed_page_clock >= block->freed_page_clock if (buf_pool->freed_page_clock >= block->freed_page_clock
+ 1 + (buf_pool->curr_size / 1024)) { + 1 + (buf_pool->curr_size / 1024)) {
return(TRUE); return(TRUE);
} }
@ -169,7 +168,7 @@ buf_block_get_space(
ut_ad(block); ut_ad(block);
ut_ad(block >= buf_pool->blocks); ut_ad(block >= buf_pool->blocks);
ut_ad(block < buf_pool->blocks + buf_pool->max_size); ut_ad(block < buf_pool->blocks + buf_pool->max_size);
ut_ad(block->state == BUF_BLOCK_FILE_PAGE); ut_a(block->state == BUF_BLOCK_FILE_PAGE);
ut_ad(block->buf_fix_count > 0); ut_ad(block->buf_fix_count > 0);
return(block->space); return(block->space);
@ -187,7 +186,7 @@ buf_block_get_page_no(
ut_ad(block); ut_ad(block);
ut_ad(block >= buf_pool->blocks); ut_ad(block >= buf_pool->blocks);
ut_ad(block < buf_pool->blocks + buf_pool->max_size); ut_ad(block < buf_pool->blocks + buf_pool->max_size);
ut_ad(block->state == BUF_BLOCK_FILE_PAGE); ut_a(block->state == BUF_BLOCK_FILE_PAGE);
ut_ad(block->buf_fix_count > 0); ut_ad(block->buf_fix_count > 0);
return(block->offset); return(block->offset);
@ -550,6 +549,8 @@ buf_page_hash_get(
HASH_SEARCH(hash, buf_pool->page_hash, fold, block, HASH_SEARCH(hash, buf_pool->page_hash, fold, block,
(block->space == space) && (block->offset == offset)); (block->space == space) && (block->offset == offset));
ut_a(block == NULL || block->state == BUF_BLOCK_FILE_PAGE);
return(block); return(block);
} }
@ -617,8 +618,8 @@ buf_page_release(
mutex_enter_fast(&(buf_pool->mutex)); mutex_enter_fast(&(buf_pool->mutex));
ut_ad(block->state == BUF_BLOCK_FILE_PAGE); ut_a(block->state == BUF_BLOCK_FILE_PAGE);
ut_ad(block->buf_fix_count > 0); ut_a(block->buf_fix_count > 0);
if (rw_latch == RW_X_LATCH && mtr->modifications) { if (rw_latch == RW_X_LATCH && mtr->modifications) {

View File

@ -326,6 +326,25 @@ fil_open_single_table_tablespace(
char* name); /* in: table name in the databasename/tablename char* name); /* in: table name in the databasename/tablename
format */ format */
/************************************************************************ /************************************************************************
It is possible, though very improbable, that the lsn's in the tablespace to be
imported have risen above the current system lsn, if a lengthy purge, ibuf
merge, or rollback was performed on a backup taken with ibbackup. If that is
the case, reset page lsn's in the file. We assume that mysqld was shut down
after it performed these cleanup operations on the .ibd file, so that it at
the shutdown stamped the latest lsn to the FIL_PAGE_FILE_FLUSH_LSN in the
first page of the .ibd file, and we can determine whether we need to reset the
lsn's just by looking at that flush lsn. */
ibool
fil_reset_too_high_lsns(
/*====================*/
/* out: TRUE if success */
char* name, /* in: table name in the databasename/tablename
format */
dulint current_lsn); /* in: reset lsn's if the lsn stamped to
FIL_PAGE_FILE_FLUSH_LSN in the first page is
too high */
/************************************************************************
At the server startup, if we need crash recovery, scans the database At the server startup, if we need crash recovery, scans the database
directories under the MySQL datadir, looking for .ibd files. Those files are directories under the MySQL datadir, looking for .ibd files. Those files are
single-table tablespaces. We need to know the space id in each of them so that single-table tablespaces. We need to know the space id in each of them so that

View File

@ -28,7 +28,7 @@ ha_search_and_get_data(
/************************************************************* /*************************************************************
Looks for an element when we know the pointer to the data and updates Looks for an element when we know the pointer to the data and updates
the pointer to data if found. */ the pointer to data if found. */
UNIV_INLINE
void void
ha_search_and_update_if_found( ha_search_and_update_if_found(
/*==========================*/ /*==========================*/

View File

@ -49,7 +49,6 @@ ha_node_t*
ha_chain_get_next( ha_chain_get_next(
/*==============*/ /*==============*/
/* out: next node, NULL if none */ /* out: next node, NULL if none */
hash_table_t* table __attribute__((unused)), /* in: hash table */
ha_node_t* node) /* in: hash chain node */ ha_node_t* node) /* in: hash chain node */
{ {
ut_ad(table); ut_ad(table);
@ -94,7 +93,7 @@ ha_search(
return(node); return(node);
} }
node = ha_chain_get_next(table, node); node = ha_chain_get_next(node);
} }
return(NULL); return(NULL);
@ -124,7 +123,7 @@ ha_search_and_get_data(
return(node->data); return(node->data);
} }
node = ha_chain_get_next(table, node); node = ha_chain_get_next(node);
} }
return(NULL); return(NULL);
@ -139,7 +138,6 @@ ha_next(
/* out: pointer to the next hash table node /* out: pointer to the next hash table node
in chain with the fold value, NULL if not in chain with the fold value, NULL if not
found */ found */
hash_table_t* table, /* in: hash table */
ha_node_t* node) /* in: hash table node */ ha_node_t* node) /* in: hash table node */
{ {
ulint fold; ulint fold;
@ -148,7 +146,7 @@ ha_next(
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold))); ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
node = ha_chain_get_next(table, node); node = ha_chain_get_next(node);
while (node) { while (node) {
if (node->fold == fold) { if (node->fold == fold) {
@ -156,7 +154,7 @@ ha_next(
return(node); return(node);
} }
node = ha_chain_get_next(table, node); node = ha_chain_get_next(node);
} }
return(NULL); return(NULL);
@ -186,35 +184,12 @@ ha_search_with_data(
return(node); return(node);
} }
node = ha_chain_get_next(table, node); node = ha_chain_get_next(node);
} }
return(NULL); return(NULL);
} }
/*************************************************************
Looks for an element when we know the pointer to the data, and updates
the pointer to data, if found. */
UNIV_INLINE
void
ha_search_and_update_if_found(
/*==========================*/
hash_table_t* table, /* in: hash table */
ulint fold, /* in: folded value of the searched data */
void* data, /* in: pointer to the data */
void* new_data)/* in: new pointer to the data */
{
ha_node_t* node;
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
node = ha_search_with_data(table, fold, data);
if (node) {
node->data = new_data;
}
}
/************************************************************* /*************************************************************
Looks for an element when we know the pointer to the data, and deletes Looks for an element when we know the pointer to the data, and deletes
it from the hash table, if found. */ it from the hash table, if found. */

View File

@ -100,7 +100,7 @@ Deletes a struct from a hash table. */
\ \
while (struct3333->NAME != DATA) {\ while (struct3333->NAME != DATA) {\
\ \
ut_ad(struct3333)\ ut_a(struct3333)\
struct3333 = struct3333->NAME;\ struct3333 = struct3333->NAME;\
}\ }\
\ \
@ -322,6 +322,8 @@ struct hash_cell_struct{
/* The hash table structure */ /* The hash table structure */
struct hash_table_struct { struct hash_table_struct {
ibool adaptive;/* TRUE if this is the hash table of the
adaptive hash index */
ulint n_cells;/* number of cells in the hash table */ ulint n_cells;/* number of cells in the hash table */
hash_cell_t* array; /* pointer to cell array */ hash_cell_t* array; /* pointer to cell array */
ulint n_mutexes;/* if mutexes != NULL, then the number of ulint n_mutexes;/* if mutexes != NULL, then the number of

View File

@ -218,7 +218,7 @@ ibuf_update_free_bits_if_full(
} }
if (after == 0) { if (after == 0) {
/* We move the page to front of the buffer pool LRU list: /* We move the page to the front of the buffer pool LRU list:
the purpose of this is to prevent those pages to which we the purpose of this is to prevent those pages to which we
cannot make inserts using the insert buffer from slipping cannot make inserts using the insert buffer from slipping
out of the buffer pool */ out of the buffer pool */

View File

@ -301,6 +301,14 @@ os_file_get_size(
size */ size */
ulint* size_high);/* out: most significant 32 bits of size */ ulint* size_high);/* out: most significant 32 bits of size */
/*************************************************************************** /***************************************************************************
Gets file size as a 64-bit integer ib_longlong. */
ib_longlong
os_file_get_size_as_iblonglong(
/*===========================*/
/* out: size in bytes, -1 if error */
os_file_t file); /* in: handle to a file */
/***************************************************************************
Sets a file size. This function can be used to extend or truncate a file. */ Sets a file size. This function can be used to extend or truncate a file. */
ibool ibool

View File

@ -15,14 +15,9 @@ Created 9/8/1995 Heikki Tuuri
/* Maximum number of threads which can be created in the program; /* Maximum number of threads which can be created in the program;
this is also the size of the wait slot array for MySQL threads which this is also the size of the wait slot array for MySQL threads which
can wait inside InnoDB */ can wait inside InnoDB */
#if defined(__WIN__) || defined(__NETWARE__)
/* Create less event semaphores because Win 98/ME had difficult creating #define OS_THREAD_MAX_N srv_max_n_threads
40000 event semaphores */
/* TODO: these just take a lot of memory on NetWare. should netware move up? */
#define OS_THREAD_MAX_N 1000
#else
#define OS_THREAD_MAX_N 10000
#endif
/* Possible fixed priorities for threads */ /* Possible fixed priorities for threads */
#define OS_THREAD_PRIORITY_NONE 100 #define OS_THREAD_PRIORITY_NONE 100

View File

@ -339,6 +339,45 @@ row_drop_table_for_mysql(
char* name, /* in: table name */ char* name, /* in: table name */
trx_t* trx); /* in: transaction handle */ trx_t* trx); /* in: transaction handle */
/************************************************************************* /*************************************************************************
Discards the tablespace of a table which stored in an .ibd file. Discarding
means that this function deletes the .ibd file and assigns a new table id for
the table. Also the flag table->ibd_file_missing is set TRUE.
How do we prevent crashes caused by ongoing operations on the table? Old
operations could try to access non-existent pages.
1) SQL queries, INSERT, SELECT, ...: we must get an exclusive MySQL table lock
on the table before we can do DISCARD TABLESPACE. Then there are no running
queries on the table.
2) Purge and rollback: we assign a new table id for the table. Since purge and
rollback look for the table based on the table id, they see the table as
'dropped' and discard their operations.
3) Insert buffer: we remove all entries for the tablespace in the insert
buffer tree; as long as the tablespace mem object does not exist, ongoing
insert buffer page merges are discarded in buf0rea.c. If we recreate the
tablespace mem object with IMPORT TABLESPACE later, then the tablespace will
have the same id, but the tablespace_version field in the mem object is
different, and ongoing old insert buffer page merges get discarded.
4) Linear readahead and random readahead: we use the same method as in 3) to
discard ongoing operations. */
int
row_discard_tablespace_for_mysql(
/*=============================*/
/* out: error code or DB_SUCCESS */
char* name, /* in: table name */
trx_t* trx); /* in: transaction handle */
/*********************************************************************
Imports a tablespace. The space id in the .ibd file must match the space id
of the table in the data dictionary. */
int
row_import_tablespace_for_mysql(
/*============================*/
/* out: error code or DB_SUCCESS */
char* name, /* in: table name */
trx_t* trx); /* in: transaction handle */
/*************************************************************************
Drops a database for MySQL. */ Drops a database for MySQL. */
int int

View File

@ -87,6 +87,8 @@ extern ulint srv_max_dirty_pages_pct;
extern ulint srv_force_recovery; extern ulint srv_force_recovery;
extern ulint srv_thread_concurrency; extern ulint srv_thread_concurrency;
extern ulint srv_max_n_threads;
extern lint srv_conc_n_threads; extern lint srv_conc_n_threads;
extern ibool srv_fast_shutdown; extern ibool srv_fast_shutdown;

View File

@ -213,24 +213,27 @@ os_file_get_last_error(
if (report_all_errors if (report_all_errors
|| (err != ERROR_DISK_FULL && err != ERROR_FILE_EXISTS)) { || (err != ERROR_DISK_FULL && err != ERROR_FILE_EXISTS)) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Operating system error number %lu in a file operation.\n" " InnoDB: Operating system error number %lu in a file operation.\n", err);
"InnoDB: See http://www.innodb.com/ibman.html for installation help.\n",
err);
if (err == ERROR_PATH_NOT_FOUND) { if (err == ERROR_PATH_NOT_FOUND) {
fprintf(stderr, fprintf(stderr,
"InnoDB: The error means the system cannot find the path specified.\n" "InnoDB: The error means the system cannot find the path specified.\n");
"InnoDB: In installation you must create directories yourself, InnoDB\n"
"InnoDB: does not create them.\n"); if (srv_is_being_started) {
fprintf(stderr,
"InnoDB: If you are installing InnoDB, remember that you must create\n"
"InnoDB: directories yourself, InnoDB does not create them.\n");
}
} else if (err == ERROR_ACCESS_DENIED) { } else if (err == ERROR_ACCESS_DENIED) {
fprintf(stderr, fprintf(stderr,
"InnoDB: The error means mysqld does not have the access rights to\n" "InnoDB: The error means mysqld does not have the access rights to\n"
"InnoDB: the directory. It may also be you have created a subdirectory\n" "InnoDB: the directory. It may also be you have created a subdirectory\n"
"InnoDB: of the same name as a data file.\n"); "InnoDB: of the same name as a data file.\n");
} else { } else {
fprintf(stderr, fprintf(stderr,
"InnoDB: See section 13.2 at http://www.innodb.com/ibman.html\n" "InnoDB: See section 13.2 at http://www.innodb.com/ibman.html\n"
"InnoDB: about operating system error numbers.\n"); "InnoDB: about operating system error numbers.\n");
} }
@ -252,29 +255,31 @@ os_file_get_last_error(
if (report_all_errors if (report_all_errors
|| (err != ENOSPC && err != EEXIST)) { || (err != ENOSPC && err != EEXIST)) {
ut_print_timestamp(stderr);
ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Operating system error number %lu in a file operation.\n" " InnoDB: Operating system error number %lu in a file operation.\n", err);
"InnoDB: See http://www.innodb.com/ibman.html for installation help.\n",
err);
if (err == ENOENT) { if (err == ENOENT) {
fprintf(stderr, fprintf(stderr,
"InnoDB: The error means the system cannot find the path specified.\n" "InnoDB: The error means the system cannot find the path specified.\n");
"InnoDB: In installation you must create directories yourself, InnoDB\n"
"InnoDB: does not create them.\n"); if (srv_is_being_started) {
fprintf(stderr,
"InnoDB: If you are installing InnoDB, remember that you must create\n"
"InnoDB: directories yourself, InnoDB does not create them.\n");
}
} else if (err == EACCES) { } else if (err == EACCES) {
fprintf(stderr, fprintf(stderr,
"InnoDB: The error means mysqld does not have the access rights to\n" "InnoDB: The error means mysqld does not have the access rights to\n"
"InnoDB: the directory.\n"); "InnoDB: the directory.\n");
} else { } else {
if (strerror((int)err) != NULL) { if (strerror((int)err) != NULL) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error number %lu means '%s'.\n", err, strerror((int)err)); "InnoDB: Error number %lu means '%s'.\n", err, strerror((int)err));
} }
fprintf(stderr, fprintf(stderr,
"InnoDB: See also section 13.2 at http://www.innodb.com/ibman.html\n" "InnoDB: See also section 13.2 at http://www.innodb.com/ibman.html\n"
"InnoDB: about operating system error numbers.\n"); "InnoDB: about operating system error numbers.\n");
} }
@ -404,7 +409,7 @@ os_file_opendir(
ut_a(strlen(dirname) < OS_FILE_MAX_PATH); ut_a(strlen(dirname) < OS_FILE_MAX_PATH);
strcpy(path, dirname); strcpy(path, dirname);
strcpy(path + strlen(path), "\*"); strcpy(path + strlen(path), "\\");
/* Note that in Windows opening the 'directory stream' also retrieves /* Note that in Windows opening the 'directory stream' also retrieves
the first entry in the directory. Since it is '.', that is no problem, the first entry in the directory. Since it is '.', that is no problem,
@ -493,18 +498,18 @@ next_file:
ret = FindNextFile(dir, lpFindFileData); ret = FindNextFile(dir, lpFindFileData);
if (ret) { if (ret) {
ut_a(strlen(lpFindFileData->cFilename) < OS_FILE_MAX_PATH); ut_a(strlen(lpFindFileData->cFileName) < OS_FILE_MAX_PATH);
if (strcmp(lpFindFileData->cFilename, ".") == 0 if (strcmp(lpFindFileData->cFileName, ".") == 0
|| strcmp(lpFindFileData->cFilename, "..") == 0) { || strcmp(lpFindFileData->cFileName, "..") == 0) {
goto next_file; goto next_file;
} }
strcpy(info->name, lpFindFileData->cFilename); strcpy(info->name, lpFindFileData->cFileName);
info->size = (ib_longlong)(buf->nFileSizeLow) info->size = (ib_longlong)(lpFindFileData->nFileSizeLow)
+ (((ib_longlong)(buf->nFileSizeHigh)) << 32); + (((ib_longlong)(lpFindFileData->nFileSizeHigh)) << 32);
if (lpFindFileData->dwFileAttributes if (lpFindFileData->dwFileAttributes
& FILE_ATTRIBUTE_REPARSE_POINT) { & FILE_ATTRIBUTE_REPARSE_POINT) {
@ -827,14 +832,13 @@ os_file_create(
DWORD create_flag; DWORD create_flag;
DWORD attributes; DWORD attributes;
ibool retry; ibool retry;
try_again: try_again:
ut_a(name); ut_a(name);
if (create_mode == OS_FILE_OPEN_RAW) { if (create_mode == OS_FILE_OPEN_RAW) {
create_flag = OPEN_EXISTING; create_flag = OPEN_EXISTING;
share_mode = FILE_SHARE_WRITE; share_mode = FILE_SHARE_WRITE;
if (create_mode == OS_FILE_OPEN) { } else if (create_mode == OS_FILE_OPEN) {
create_flag = OPEN_EXISTING; create_flag = OPEN_EXISTING;
} else if (create_mode == OS_FILE_CREATE) { } else if (create_mode == OS_FILE_CREATE) {
create_flag = CREATE_NEW; create_flag = CREATE_NEW;
@ -927,15 +931,12 @@ try_again:
if (create_mode == OS_FILE_OPEN || create_mode == OS_FILE_OPEN_RAW) { if (create_mode == OS_FILE_OPEN || create_mode == OS_FILE_OPEN_RAW) {
mode_str = "OPEN"; mode_str = "OPEN";
create_flag = O_RDWR; create_flag = O_RDWR;
} else if (create_mode == OS_FILE_CREATE) { } else if (create_mode == OS_FILE_CREATE) {
mode_str = "CREATE"; mode_str = "CREATE";
create_flag = O_RDWR | O_CREAT | O_EXCL; create_flag = O_RDWR | O_CREAT | O_EXCL;
} else if (create_mode == OS_FILE_OVERWRITE) { } else if (create_mode == OS_FILE_OVERWRITE) {
mode_str = "OVERWRITE"; mode_str = "OVERWRITE";
create_flag = O_RDWR | O_CREAT | O_TRUNC; create_flag = O_RDWR | O_CREAT | O_TRUNC;
} else { } else {
create_flag = 0; create_flag = 0;
@ -1015,8 +1016,7 @@ os_file_delete(
char* name) /* in: file path as a null-terminated string */ char* name) /* in: file path as a null-terminated string */
{ {
#ifdef __WIN__ #ifdef __WIN__
os_file_t dummy = NULL; BOOL ret;
BOOL ret;
ret = DeleteFile((LPCTSTR)name); ret = DeleteFile((LPCTSTR)name);
@ -1024,17 +1024,16 @@ os_file_delete(
return(TRUE); return(TRUE);
} }
os_file_handle_error(dummy, name, "delete"); os_file_handle_error(NULL, name, "delete");
return(FALSE); return(FALSE);
#else #else
os_file_t dummy = 0; int ret;
int ret;
ret = unlink((const char*)name); ret = unlink((const char*)name);
if (ret != 0) { if (ret != 0) {
os_file_handle_error(dummy, name, "delete"); os_file_handle_error(0, name, "delete");
return(FALSE); return(FALSE);
} }
@ -1056,8 +1055,7 @@ os_file_rename(
char* newpath) /* in: new file path */ char* newpath) /* in: new file path */
{ {
#ifdef __WIN__ #ifdef __WIN__
os_file_t dummy = NULL; BOOL ret;
BOOL ret;
ret = MoveFile((LPCTSTR)oldpath, (LPCTSTR)newpath); ret = MoveFile((LPCTSTR)oldpath, (LPCTSTR)newpath);
@ -1065,17 +1063,16 @@ os_file_rename(
return(TRUE); return(TRUE);
} }
os_file_handle_error(dummy, oldpath, "delete"); os_file_handle_error(NULL, oldpath, "delete");
return(FALSE); return(FALSE);
#else #else
os_file_t dummy = 0; int ret;
int ret;
ret = rename((const char*)oldpath, (const char*)newpath); ret = rename((const char*)oldpath, (const char*)newpath);
if (ret != 0) { if (ret != 0) {
os_file_handle_error(dummy, oldpath, "rename"); os_file_handle_error(0, oldpath, "rename");
return(FALSE); return(FALSE);
} }
@ -1204,6 +1201,29 @@ os_file_get_size(
#endif #endif
} }
/***************************************************************************
Gets file size as a 64-bit integer ib_longlong. */
ib_longlong
os_file_get_size_as_iblonglong(
/*===========================*/
/* out: size in bytes, -1 if error */
os_file_t file) /* in: handle to a file */
{
ulint size;
ulint size_high;
ibool success;
success = os_file_get_size(file, &size, &size_high);
if (!success) {
return(-1);
}
return((((ib_longlong)size_high) << 32) + (ib_longlong)size);
}
/*************************************************************************** /***************************************************************************
Sets a file size. This function can be used to extend or truncate a file. */ Sets a file size. This function can be used to extend or truncate a file. */

View File

@ -582,7 +582,8 @@ byte*
page_parse_delete_rec_list( page_parse_delete_rec_list(
/*=======================*/ /*=======================*/
/* out: end of log record or NULL */ /* out: end of log record or NULL */
byte type, /* in: MLOG_LIST_END_DELETE or MLOG_LIST_START_DELETE */ byte type, /* in: MLOG_LIST_END_DELETE or
MLOG_LIST_START_DELETE */
byte* ptr, /* in: buffer */ byte* ptr, /* in: buffer */
byte* end_ptr,/* in: buffer end */ byte* end_ptr,/* in: buffer end */
page_t* page, /* in: page or NULL */ page_t* page, /* in: page or NULL */

View File

@ -1871,6 +1871,16 @@ row_discard_tablespace_for_mysql(
goto funct_exit; goto funct_exit;
} }
if (table->space == 0) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: table %s\n"
"InnoDB: is in the system tablespace 0 which cannot be discarded\n", name);
err = DB_ERROR;
goto funct_exit;
}
new_id = dict_hdr_get_new_id(DICT_HDR_TABLE_ID); new_id = dict_hdr_get_new_id(DICT_HDR_TABLE_ID);
sprintf(buf, sprintf(buf,
@ -1967,6 +1977,7 @@ row_import_tablespace_for_mysql(
{ {
dict_table_t* table; dict_table_t* table;
ibool success; ibool success;
dulint current_lsn;
ulint err = DB_SUCCESS; ulint err = DB_SUCCESS;
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id()); ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
@ -1975,6 +1986,30 @@ row_import_tablespace_for_mysql(
trx->op_info = (char*) "importing tablespace"; trx->op_info = (char*) "importing tablespace";
current_lsn = log_get_lsn();
/* It is possible, though very improbable, that the lsn's in the
tablespace to be imported have risen above the current system lsn, if
a lengthy purge, ibuf merge, or rollback was performed on a backup
taken with ibbackup. If that is the case, reset page lsn's in the
file. We assume that mysqld was shut down after it performed these
cleanup operations on the .ibd file, so that it stamped the latest lsn
to the FIL_PAGE_FILE_FLUSH_LSN in the first page of the .ibd file.
TODO: reset also the trx id's in clustered index records and write
a new space id to each data page. That would allow us to import clean
.ibd files from another MySQL installation. */
success = fil_reset_too_high_lsns(name, current_lsn);
if (!success) {
err = DB_ERROR;
row_mysql_lock_data_dictionary(trx);
goto funct_exit;
}
/* Serialize data dictionary operations with dictionary mutex: /* Serialize data dictionary operations with dictionary mutex:
no deadlocks can occur then in these operations */ no deadlocks can occur then in these operations */
@ -1988,6 +2023,16 @@ row_import_tablespace_for_mysql(
goto funct_exit; goto funct_exit;
} }
if (table->space == 0) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: table %s\n"
"InnoDB: is in the system tablespace 0 which cannot be imported\n", name);
err = DB_ERROR;
goto funct_exit;
}
if (!table->tablespace_discarded) { if (!table->tablespace_discarded) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
@ -2007,9 +2052,6 @@ row_import_tablespace_for_mysql(
success = fil_open_single_table_tablespace(table->space, table->name); success = fil_open_single_table_tablespace(table->space, table->name);
printf(
"Remember to stop purge + undo if table->ibd_file_is_missing!!!\n");
if (success) { if (success) {
table->ibd_file_missing = FALSE; table->ibd_file_missing = FALSE;
table->tablespace_discarded = FALSE; table->tablespace_discarded = FALSE;

View File

@ -529,6 +529,14 @@ row_purge_parse_undo_rec(
return(FALSE); return(FALSE);
} }
if (node->table->ibd_file_missing) {
/* We skip purge of missing .ibd files */
node->table = NULL;
return(FALSE);
}
clust_index = dict_table_get_first_index(node->table); clust_index = dict_table_get_first_index(node->table);
if (clust_index == NULL) { if (clust_index == NULL) {

View File

@ -258,6 +258,13 @@ row_undo_ins_parse_undo_rec(
return; return;
} }
if (node->table->ibd_file_missing) {
/* We skip undo operations to missing .ibd files */
node->table = NULL;
return;
}
clust_index = dict_table_get_first_index(node->table); clust_index = dict_table_get_first_index(node->table);
ptr = trx_undo_rec_get_row_ref(ptr, clust_index, &(node->ref), ptr = trx_undo_rec_get_row_ref(ptr, clust_index, &(node->ref),

View File

@ -620,6 +620,13 @@ row_undo_mod_parse_undo_rec(
return; return;
} }
if (node->table->ibd_file_missing) {
/* We skip undo operations to missing .ibd files */
node->table = NULL;
return;
}
clust_index = dict_table_get_first_index(node->table); clust_index = dict_table_get_first_index(node->table);
ptr = trx_undo_update_rec_get_sys_cols(ptr, &trx_id, &roll_ptr, ptr = trx_undo_update_rec_get_sys_cols(ptr, &trx_id, &roll_ptr,

View File

@ -180,6 +180,12 @@ the user from forgetting the innodb_force_recovery keyword to my.cnf */
ulint srv_force_recovery = 0; ulint srv_force_recovery = 0;
/*-----------------------*/ /*-----------------------*/
/* We are prepared for a situation that we have this many threads waiting for
a semaphore inside InnoDB. innobase_start_or_create_for_mysql() sets the
value. */
ulint srv_max_n_threads = 0;
/* The following controls how many threads we let inside InnoDB concurrently: /* The following controls how many threads we let inside InnoDB concurrently:
threads waiting for locks are not counted into the number because otherwise threads waiting for locks are not counted into the number because otherwise
we could get a deadlock. MySQL creates a thread for each user session, and we could get a deadlock. MySQL creates a thread for each user session, and
@ -219,7 +225,7 @@ struct srv_conc_slot_struct{
UT_LIST_BASE_NODE_T(srv_conc_slot_t) srv_conc_queue; /* queue of threads UT_LIST_BASE_NODE_T(srv_conc_slot_t) srv_conc_queue; /* queue of threads
waiting to get in */ waiting to get in */
srv_conc_slot_t srv_conc_slots[OS_THREAD_MAX_N]; /* array of wait srv_conc_slot_t* srv_conc_slots; /* array of wait
slots */ slots */
/* Number of times a thread is allowed to enter InnoDB within the same /* Number of times a thread is allowed to enter InnoDB within the same
@ -1712,6 +1718,8 @@ srv_init(void)
UT_LIST_INIT(srv_conc_queue); UT_LIST_INIT(srv_conc_queue);
srv_conc_slots = mem_alloc(OS_THREAD_MAX_N * sizeof(srv_conc_slot_t));
for (i = 0; i < OS_THREAD_MAX_N; i++) { for (i = 0; i < OS_THREAD_MAX_N; i++) {
conc_slot = srv_conc_slots + i; conc_slot = srv_conc_slots + i;
conc_slot->reserved = FALSE; conc_slot->reserved = FALSE;
@ -1758,7 +1766,7 @@ srv_conc_enter_innodb(
thread */ thread */
{ {
ibool has_slept = FALSE; ibool has_slept = FALSE;
srv_conc_slot_t* slot; srv_conc_slot_t* slot = NULL;
ulint i; ulint i;
char err_buf[1000]; char err_buf[1000];
@ -1835,6 +1843,7 @@ retry:
slot = srv_conc_slots + i; slot = srv_conc_slots + i;
if (!slot->reserved) { if (!slot->reserved) {
break; break;
} }
} }

View File

@ -1138,10 +1138,32 @@ innobase_start_or_create_for_mysql(void)
srv_file_flush_method_str); srv_file_flush_method_str);
return(DB_ERROR); return(DB_ERROR);
} }
/* Set the maximum number of threads which can wait for a semaphore
inside InnoDB */
#if defined(__WIN__) || defined(__NETWARE__)
/* Create less event semaphores because Win 98/ME had difficulty creating
40000 event semaphores.
Comment from Novell, Inc.: also, these just take a lot of memory on
NetWare. */
srv_max_n_threads = 1000;
#else
if (srv_pool_size >= 8 * 1024) {
/* Here we still have srv_pool_size counted
in kilobytes, srv_boot converts the value to
pages; if buffer pool is less than 8 MB,
assume fewer threads. */
srv_max_n_threads = 10000;
} else {
srv_max_n_threads = 1000; /* saves several MB of memory,
especially in 64-bit
computers */
}
#endif
/* Note that the call srv_boot() also changes the values of /* Note that the call srv_boot() also changes the values of
srv_pool_size etc. to the units used by InnoDB internally */ srv_pool_size etc. to the units used by InnoDB internally */
err = srv_boot(); err = srv_boot();
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {

View File

@ -14,6 +14,7 @@ Created 10/5/1995 Heikki Tuuri
#include "sync0sync.h" #include "sync0sync.h"
#include "hash0hash.h" #include "hash0hash.h"
#include "mem0mem.h" #include "mem0mem.h"
#include "srv0srv.h"
/* /*
IMPLEMENTATION OF THREAD LOCAL STORAGE IMPLEMENTATION OF THREAD LOCAL STORAGE

View File

@ -52,9 +52,9 @@ void STDCALL cli_mysql_close(MYSQL *mysql);
MYSQL_FIELD * STDCALL cli_list_fields(MYSQL *mysql); MYSQL_FIELD * STDCALL cli_list_fields(MYSQL *mysql);
my_bool STDCALL cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt); my_bool STDCALL cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt);
MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields, MYSQL_DATA * STDCALL cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
uint fields); uint fields);
int STDCALL cli_stmt_execute(MYSQL_STMT *stmt); int STDCALL cli_stmt_execute(MYSQL_STMT *stmt);
MYSQL_DATA *cli_read_binary_rows(MYSQL_STMT *stmt); MYSQL_DATA * STDCALL cli_read_binary_rows(MYSQL_STMT *stmt);
int STDCALL cli_unbuffered_fetch(MYSQL *mysql, char **row); int STDCALL cli_unbuffered_fetch(MYSQL *mysql, char **row);
const char * STDCALL cli_read_statistic(MYSQL *mysql); const char * STDCALL cli_read_statistic(MYSQL *mysql);

View File

@ -65,8 +65,8 @@
ulong net_buffer_length=8192; ulong net_buffer_length=8192;
ulong max_allowed_packet= 1024L*1024L*1024L; ulong max_allowed_packet= 1024L*1024L*1024L;
ulong net_read_timeout= NET_READ_TIMEOUT; ulong net_read_timeout= CLIENT_NET_READ_TIMEOUT;
ulong net_write_timeout= NET_WRITE_TIMEOUT; ulong net_write_timeout= CLIENT_NET_WRITE_TIMEOUT;
#ifdef EMBEDDED_LIBRARY #ifdef EMBEDDED_LIBRARY
@ -3098,7 +3098,7 @@ no_data:
Read all rows of data from server (binary format) Read all rows of data from server (binary format)
*/ */
MYSQL_DATA *cli_read_binary_rows(MYSQL_STMT *stmt) MYSQL_DATA * STDCALL cli_read_binary_rows(MYSQL_STMT *stmt)
{ {
ulong pkt_len; ulong pkt_len;
uchar *cp; uchar *cp;

View File

@ -81,7 +81,7 @@ EXPORTS
mysql_param_result mysql_param_result
mysql_ping mysql_ping
mysql_prepare mysql_prepare
mysql_prepare_result mysql_get_metadata
mysql_query mysql_query
mysql_read_query_result mysql_read_query_result
mysql_real_connect mysql_real_connect

View File

@ -435,11 +435,6 @@ void STDCALL mysql_server_end()
my_free((char*) copy_arguments_ptr, MYF(MY_ALLOW_ZERO_PTR)); my_free((char*) copy_arguments_ptr, MYF(MY_ALLOW_ZERO_PTR));
copy_arguments_ptr=0; copy_arguments_ptr=0;
clean_up(0); clean_up(0);
#ifdef THREAD
/* Don't call my_thread_end() if the application is using MY_INIT() */
if (!org_my_init_done)
my_thread_end();
#endif
/* If library called my_init(), free memory allocated by it */ /* If library called my_init(), free memory allocated by it */
if (!org_my_init_done) if (!org_my_init_done)
my_end(0); my_end(0);

View File

@ -146,7 +146,7 @@ int main(int argc, char **argv)
#endif #endif
} /* main */ } /* main */
enum options { enum options_mc {
OPT_CHARSETS_DIR=256, OPT_SET_CHARSET,OPT_START_CHECK_POS, OPT_CHARSETS_DIR=256, OPT_SET_CHARSET,OPT_START_CHECK_POS,
OPT_CORRECT_CHECKSUM, OPT_KEY_BUFFER_SIZE, OPT_MYISAM_BLOCK_SIZE, OPT_CORRECT_CHECKSUM, OPT_KEY_BUFFER_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,

View File

@ -15,6 +15,8 @@ select * from t1;
b b
drop table t1;
create table t1 (a int not null auto_increment,primary key (a)) type=heap;
drop table t1; drop table t1;
create table t2 type=heap select * from t1; create table t2 type=heap select * from t1;
ERROR 42S02: Table 'test.t1' doesn't exist ERROR 42S02: Table 'test.t1' doesn't exist
@ -26,10 +28,11 @@ Note 1051 Unknown table 't1'
Note 1051 Unknown table 't2' Note 1051 Unknown table 't2'
create table t1 (b char(0) not null, index(b)); create table t1 (b char(0) not null, index(b));
ERROR 42000: The used storage engine can't index column 'b' ERROR 42000: The used storage engine can't index column 'b'
create table t1 (a int not null auto_increment,primary key (a)) type=heap;
create table t1 (a int not null,b text) type=heap; create table t1 (a int not null,b text) type=heap;
ERROR 42000: The used table type doesn't support BLOB/TEXT columns ERROR 42000: The used table type doesn't support BLOB/TEXT columns
drop table if exists t1; drop table if exists t1;
Warnings:
Note 1051 Unknown table 't1'
create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=heap; create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=heap;
ERROR 42000: Incorrect table definition; There can only be one auto column and it must be defined as a key ERROR 42000: Incorrect table definition; There can only be one auto column and it must be defined as a key
create table not_existing_database.test (a int); create table not_existing_database.test (a int);
@ -66,9 +69,8 @@ drop table if exists ``;
ERROR 42000: Incorrect table name '' ERROR 42000: Incorrect table name ''
create table t1 (`` int); create table t1 (`` int);
ERROR 42000: Incorrect column name '' ERROR 42000: Incorrect column name ''
drop table if exists t1; create table t1 (i int, index `` (i));
Warnings: ERROR 42000: Incorrect index name ''
Note 1051 Unknown table 't1'
create table t1 (a int auto_increment not null primary key, B CHAR(20)); create table t1 (a int auto_increment not null primary key, B CHAR(20));
insert into t1 (b) values ("hello"),("my"),("world"); insert into t1 (b) values ("hello"),("my"),("world");
create table t2 (key (b)) select * from t1; create table t2 (key (b)) select * from t1;
@ -220,6 +222,46 @@ ERROR 23000: Column 'k1' cannot be null
insert into t1 values (NULL, NULL); insert into t1 values (NULL, NULL);
ERROR 23000: Column 'k1' cannot be null ERROR 23000: Column 'k1' cannot be null
drop table t1; drop table t1;
create table t1 select x'4132';
drop table t1;
create table t1 select 1,2,3;
create table if not exists t1 select 1,2;
create table if not exists t1 select 1,2,3,4;
ERROR 21S01: Column count doesn't match value count at row 1
create table if not exists t1 select 1;
select * from t1;
1 2 3
1 2 3
0 1 2
0 0 1
drop table t1;
create table t1 select 1,2,3;
create table if not exists t1 select 1,2;
create table if not exists t1 select 1,2,3,4;
ERROR 21S01: Column count doesn't match value count at row 1
create table if not exists t1 select 1;
select * from t1;
1 2 3
1 2 3
0 1 2
0 0 1
drop table t1;
create table t1 (a int not null, b int, primary key (a));
insert into t1 values (1,1);
create table if not exists t1 select 2;
select * from t1;
a b
1 1
0 2
create table if not exists t1 select 3 as 'a',4 as 'b';
create table if not exists t1 select 3 as 'a',3 as 'b';
ERROR 23000: Duplicate entry '3' for key 1
select * from t1;
a b
1 1
0 2
3 4
drop table t1;
create table t1 (a int, key(a)); create table t1 (a int, key(a));
create table t2 (b int, foreign key(b) references t1(a), key(b)); create table t2 (b int, foreign key(b) references t1(a), key(b));
drop table if exists t1,t2; drop table if exists t1,t2;
@ -320,8 +362,6 @@ t1 CREATE TABLE `t1` (
) TYPE=MyISAM CHARSET=latin1 ) TYPE=MyISAM CHARSET=latin1
SET SESSION table_type=default; SET SESSION table_type=default;
drop table t1; drop table t1;
create table t1 select x'4132';
drop table t1;
create table t1(a int,b int,c int unsigned,d date,e char,f datetime,g time,h blob); create table t1(a int,b int,c int unsigned,d date,e char,f datetime,g time,h blob);
insert into t1(a)values(1); insert into t1(a)values(1);
insert into t1(a,b,c,d,e,f,g,h) insert into t1(a,b,c,d,e,f,g,h)

View File

@ -1,3 +1,4 @@
drop table if exists t1;
CREATE TABLE t1 SELECT _utf8'test' as c1, _utf8'тест' as c2; CREATE TABLE t1 SELECT _utf8'test' as c1, _utf8'тест' as c2;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
@ -15,6 +16,10 @@ t1 CREATE TABLE `t1` (
`c3` char(4) character set utf8 default NULL `c3` char(4) character set utf8 default NULL
) TYPE=MyISAM CHARSET=latin1 ) TYPE=MyISAM CHARSET=latin1
INSERT INTO t1 VALUES ('aaaabbbbccccdddd','aaaabbbbccccdddd','aaaabbbbccccdddd'); INSERT INTO t1 VALUES ('aaaabbbbccccdddd','aaaabbbbccccdddd','aaaabbbbccccdddd');
Warnings:
Warning 1264 Data truncated for column 'c1' at row 1
Warning 1264 Data truncated for column 'c2' at row 1
Warning 1264 Data truncated for column 'c3' at row 1
SELECT * FROM t1; SELECT * FROM t1;
c1 c2 c3 c1 c2 c3
aaaabbbbcccc aaaabbbbcccc aaaabbbbcccc aaaabbbbcccc aaaabbbbcccc aaaabbbbcccc

View File

@ -0,0 +1,157 @@
SHOW GLOBAL VARIABLES LIKE "%_format%";
Variable_name Value
date_format %d.%m.%Y
datetime_format %Y/%d/%m-%H:%i:%s
default_week_format 0
time_format %H.%i.%s
SHOW SESSION VARIABLES LIKE "%_format%";
Variable_name Value
date_format %d.%m.%Y
datetime_format %Y/%d/%m-%H:%i:%s
default_week_format 0
time_format %H.%i.%s
SET date_format="%d.%m.%Y";
select CAST("01.01.2001" as DATE) as a;
a
01.01.2001
SET datetime_format="%d.%m.%Y %H.%i.%s";
select CAST("01.01.2001 05.12.06" as DATETIME) as a;
a
01.01.2001 05.12.06
SET time_format="%H.%i.%s";
select CAST("05.12.06" as TIME) as a;
a
05.12.06
SET datetime_format="%d.%m.%Y %h:%i:%s %p";
select CAST("01.01.2001 05:12:06AM" as DATETIME) as a;
a
01.01.2001 05:12:06 AM
select CAST("01.01.2001 05:12:06 PM" as DATETIME) as a;
a
01.01.2001 05:12:06 PM
SET time_format="%h:%i:%s %p";
select CAST("05:12:06 AM" as TIME) as a;
a
05:12:06 AM
select CAST("05:12:06.1234PM" as TIME) as a;
a
05:12:06.001234 PM
SET time_format="%h.%i.%s %p";
SET date_format='%d.%m.%y';
SET datetime_format="%d.%m.%y %h.%i.%s %p";
select CAST("12-12-06" as DATE) as a;
a
12.12.06
select adddate("01.01.97 11.59.59.000001 PM", 10);
adddate("01.01.97 11.59.59.000001 PM", 10)
11.01.97 11.59.59.000001 PM
select datediff("31.12.97 11.59:59.000001 PM","01.01.98");
datediff("31.12.97 11.59:59.000001 PM","01.01.98")
-1
select weekofyear("31.11.97 11:59:59.000001 PM");
weekofyear("31.11.97 11:59:59.000001 PM")
49
select makedate(1997,1);
makedate(1997,1)
01.01.97
select addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002");
addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")
02.01.98 01.01.01.000001 AM
select maketime(23,11,12);
maketime(23,11,12)
11.11.12 PM
select timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM");
timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM")
8795.59.59.999999 PM
SET time_format="%H%i%s";
SET time_format="%h%i%s";
ERROR HY000: Unknown error
SET date_format='%d.%m.%d';
ERROR HY000: Unknown error
SET datetime_format="%d.%m.%y %h.%i.%s";
ERROR HY000: Unknown error
SET GLOBAL date_format=default;
SHOW GLOBAL VARIABLES LIKE "date_format%";
Variable_name Value
date_format %d.%m.%Y
SET GLOBAL time_format=default;
SHOW GLOBAL VARIABLES LIKE "time_format%";
Variable_name Value
time_format %H.%i.%s
SET GLOBAL datetime_format=default;
SHOW GLOBAL VARIABLES LIKE "datetime_format%";
Variable_name Value
datetime_format %Y/%d/%m-%H:%i:%s
SET date_format=default;
SHOW SESSION VARIABLES LIKE "date_format%";
Variable_name Value
date_format %d.%m.%Y
SET time_format=default;
SHOW SESSION VARIABLES LIKE "time_format%";
Variable_name Value
time_format %H.%i.%s
SET datetime_format=default;
SHOW SESSION VARIABLES LIKE "datetime_format%";
Variable_name Value
datetime_format %Y/%d/%m-%H:%i:%s
SET time_format='%i:%s:%H';
select cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME);
cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME)
59:59:12
SET GLOBAL date_format='%Y-%m-%d';
SET GLOBAL time_format='%H:%i:%s';
SET GLOBAL datetime_format='%Y-%m-%d %H:%i:%s';
SET date_format='%Y-%m-%d';
SET time_format='%H:%i:%s';
SET datetime_format='%Y-%m-%d %H:%i:%s';
select str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S");
str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S")
2001-01-15 12:59:59
select str_to_date("15 September 2001", "%d %M %Y");
str_to_date("15 September 2001", "%d %M %Y")
2001-09-15 00:00:00
select str_to_date("15 Septembeb 2001", "%d %M %Y");
str_to_date("15 Septembeb 2001", "%d %M %Y")
NULL
select str_to_date("15 MAY 2001", "%d %b %Y");
str_to_date("15 MAY 2001", "%d %b %Y")
2001-05-15 00:00:00
select str_to_date("Sunday 15 MAY 2001", "%W %d %b %Y");
str_to_date("Sunday 15 MAY 2001", "%W %d %b %Y")
2001-05-15 00:00:00
select str_to_date("Sundai 15 MAY 2001", "%W %d %b %Y");
str_to_date("Sundai 15 MAY 2001", "%W %d %b %Y")
NULL
select str_to_date("Sundai 15 MA", "%W %d %b %Y");
str_to_date("Sundai 15 MA", "%W %d %b %Y")
NULL
select str_to_date("Tuesday 52 2001", "%W %V %X");
str_to_date("Tuesday 52 2001", "%W %V %X")
NULL
select str_to_date("Sunday 01 2001", "%W %V %X");
str_to_date("Sunday 01 2001", "%W %V %X")
NULL
select str_to_date("Tuesday 00 2002", "%W %U %Y");
str_to_date("Tuesday 00 2002", "%W %U %Y")
2002-01-01 00:00:00
select str_to_date("Thursday 53 1998", "%W %u %Y");
str_to_date("Thursday 53 1998", "%W %u %Y")
1998-12-31 00:00:00
select str_to_date("15-01-2001", "%d-%m-%Y %H:%i:%S");
str_to_date("15-01-2001", "%d-%m-%Y %H:%i:%S")
2001-01-15 00:00:00
select str_to_date("15-01-20", "%d-%m-%Y");
str_to_date("15-01-20", "%d-%m-%Y")
NULL
select str_to_date("15-2001-1", "%d-%Y-%c");
str_to_date("15-2001-1", "%d-%Y-%c")
2001-01-15 00:00:00
select get_format(DATE, 'USA') as a;
a
%m.%d.%Y
select get_format(TIME, 'internal') as a;
a
%H%i%s
select get_format(DATETIME, 'eur') as a;
a
%Y-%m-%d-%H.%i.%s

View File

@ -215,3 +215,18 @@ ERROR 42000: You have an error in your SQL syntax. Check the manual that corres
insert into (select * from t1) values (5); insert into (select * from t1) values (5);
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(select * from t1) values (5)' at line 1 ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(select * from t1) values (5)' at line 1
drop table t1; drop table t1;
create table t1 (E1 INTEGER UNSIGNED NOT NULL, E2 INTEGER UNSIGNED NOT NULL, E3 INTEGER UNSIGNED NOT NULL, PRIMARY KEY(E1)
);
insert into t1 VALUES(1,1,1), (2,2,1);
select count(*) from t1 INNER JOIN (SELECT A.E1, A.E2, A.E3 FROM t1 AS A WHERE A.E3 = (SELECT MAX(B.E3) FROM t1 AS B WHERE A.E2 = B.E2)) AS THEMAX ON t1.E1 = THEMAX.E2 AND t1.E1 = t1.E2;
count(*)
2
explain select count(*) from t1 INNER JOIN (SELECT A.E1, A.E2, A.E3 FROM t1 AS A WHERE A.E3 = (SELECT MAX(B.E3) FROM t1 AS B WHERE A.E2 = B.E2)) AS THEMAX ON t1.E1 = THEMAX.E2 AND t1.E1 = t1.E2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 THEMAX.E2 1 Using where
2 DERIVED t1 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 2 Using where
Warnings:
Note 1275 Field or reference 'A.E2' of SELECT #3 was resolved in SELECT #2
drop table t1;

View File

@ -40,9 +40,21 @@ uncompress(compress(""))
select uncompressed_length(""); select uncompressed_length("");
uncompressed_length("") uncompressed_length("")
0 0
select compress(NULL); create table t1 (a text);
compress(NULL) insert t1 values (compress(null)), ('A\0\0\0BBBBBBBB'), (compress(space(50000))), (space(50000));
select length(a) from t1;
length(a)
NULL NULL
select uncompress(NULL); 12
uncompress(NULL) 76
50000
select length(uncompress(a)) from t1;
length(uncompress(a))
NULL NULL
NULL
50000
NULL
Warnings:
Error 1258 Z_DATA_ERROR: Input data was corrupted for zlib
Error 1255 Too big size of uncompressed data. The maximum size is 1048576. (probably, length of uncompressed data was corrupted)
drop table t1;

View File

@ -196,3 +196,14 @@ insert into t1 values('test'),('test2');
select * from t1 having group_concat(bar)=''; select * from t1 having group_concat(bar)='';
bar bar
drop table t1; drop table t1;
create table t1 (a int, a1 varchar(10));
create table t2 (a0 int);
insert into t1 values (0,"a"),(0,"b"),(1,"c");
insert into t2 values (1),(2),(3);
select group_concat(a1 order by (t1.a IN (select a0 from t2))) from t1;
group_concat(a1 order by (t1.a IN (select a0 from t2)))
b,a,c
select group_concat(a1 order by (t1.a)) from t1;
group_concat(a1 order by (t1.a))
b,a,c
drop table t1, t2;

View File

@ -4,8 +4,6 @@ INSERT INTO t1 VALUES (1), (2);
<?xml version="1.0"?> <?xml version="1.0"?>
<mysqldump> <mysqldump>
<database name="test"> <database name="test">
DROP TABLE IF EXISTS t1;
LOCK TABLES t1 WRITE;
<table name="t1"> <table name="t1">
<row> <row>
<field name="a">1</field> <field name="a">1</field>
@ -14,7 +12,6 @@ LOCK TABLES t1 WRITE;
<field name="a">2</field> <field name="a">2</field>
</row> </row>
</table> </table>
UNLOCK TABLES;
</database> </database>
</mysqldump> </mysqldump>
DROP TABLE t1; DROP TABLE t1;

View File

@ -75,6 +75,8 @@ NULL this is null
drop table t1; drop table t1;
CREATE TABLE t1 (a varchar(16) NOT NULL, b smallint(6) NOT NULL, c datetime NOT NULL, d smallint(6) NOT NULL); CREATE TABLE t1 (a varchar(16) NOT NULL, b smallint(6) NOT NULL, c datetime NOT NULL, d smallint(6) NOT NULL);
INSERT INTO t1 SET a = "", d= "2003-01-14 03:54:55"; INSERT INTO t1 SET a = "", d= "2003-01-14 03:54:55";
Warnings:
Warning 1264 Data truncated for column 'd' at row 1
UPDATE t1 SET d=1/NULL; UPDATE t1 SET d=1/NULL;
Warnings: Warnings:
Warning 1264 Data truncated for column 'd' at row 1 Warning 1264 Data truncated for column 'd' at row 1

View File

@ -8,16 +8,16 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File
change master to master_host='127.0.0.1'; change master to master_host='127.0.0.1';
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
127.0.0.1 test MASTER_PORT 7 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No # # 127.0.0.1 test MASTER_PORT 7 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No #
change master to master_host='127.0.0.1',master_user='root', change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=MASTER_PORT; master_password='',master_port=MASTER_PORT;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
127.0.0.1 root MASTER_PORT 7 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No # # 127.0.0.1 root MASTER_PORT 7 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No #
start slave; start slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
Waiting for master to send event 127.0.0.1 root MASTER_PORT 7 master-bin.000001 79 slave-relay-bin.000001 123 master-bin.000001 Yes Yes 0 0 79 123 None 0 No # # 127.0.0.1 root MASTER_PORT 7 master-bin.000001 79 slave-relay-bin.000001 123 master-bin.000001 Yes Yes 0 0 79 123 None 0 No #
drop table if exists t1; drop table if exists t1;
create table t1 (n int); create table t1 (n int);
insert into t1 values (10),(45),(90); insert into t1 values (10),(45),(90);

View File

@ -9,7 +9,7 @@ insert into t1 values (1),(1);
ERROR 23000: Duplicate entry '1' for key 1 ERROR 23000: Duplicate entry '1' for key 1
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
Waiting for master to send event 127.0.0.1 root MASTER_PORT 1 master-bin.000001 213 slave-relay-bin.000002 257 master-bin.000001 Yes Yes test.t1 0 0 213 257 None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 213 slave-relay-bin.000002 257 master-bin.000001 Yes Yes test.t1 0 0 213 257 None 0 No #
show tables like 't1'; show tables like 't1';
Tables_in_test (t1) Tables_in_test (t1)
drop table t1; drop table t1;

View File

@ -14,4 +14,4 @@ start slave;
flush logs; flush logs;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
Waiting for master to send event 127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 79 relay-log.000002 4 slave-bin.000001 Yes Yes 0 0 79 4 None 0 No # # 127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 79 relay-log.000002 4 slave-bin.000001 Yes Yes 0 0 79 4 None 0 No #

View File

@ -33,7 +33,7 @@ set global sql_slave_skip_counter=1;
start slave; start slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
Waiting for master to send event 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1311 slave-relay-bin.000002 1355 master-bin.000001 Yes Yes 0 0 1311 1355 None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1311 slave-relay-bin.000002 1355 master-bin.000001 Yes Yes 0 0 1311 1355 None 0 No #
set sql_log_bin=0; set sql_log_bin=0;
delete from t1; delete from t1;
set sql_log_bin=1; set sql_log_bin=1;
@ -43,7 +43,7 @@ change master to master_user='test';
change master to master_user='root'; change master to master_user='root';
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
127.0.0.1 root MASTER_PORT 1 master-bin.000001 1442 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 1442 4 None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1442 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 1442 4 None 0 No #
set global sql_slave_skip_counter=1; set global sql_slave_skip_counter=1;
start slave; start slave;
set sql_log_bin=0; set sql_log_bin=0;
@ -54,7 +54,7 @@ stop slave;
reset slave; reset slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No # # 127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No #
reset master; reset master;
create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60), create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
unique(day)); unique(day));

View File

@ -96,6 +96,6 @@ slave-bin.000002 62 Query 1 62 use `test`; insert into t1 values (1)
slave-bin.000002 122 Query 1 122 use `test`; drop table t1 slave-bin.000002 122 Query 1 122 use `test`; drop table t1
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
Waiting for master to send event 127.0.0.1 root MASTER_PORT 1 master-bin.000002 276 slave-relay-bin.000003 214 master-bin.000002 Yes Yes 0 0 276 214 None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000002 276 slave-relay-bin.000003 214 master-bin.000002 Yes Yes 0 0 276 214 None 0 No #
show binlog events in 'slave-bin.000005' from 4; show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log

View File

@ -9,7 +9,7 @@ File Position Binlog_do_db Binlog_ignore_db
master-bin.000001 79 master-bin.000001 79
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
Waiting for master to send event 127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 123 None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 123 None 0 No #
stop slave; stop slave;
change master to master_log_pos=73; change master to master_log_pos=73;
start slave; start slave;
@ -17,17 +17,17 @@ stop slave;
change master to master_log_pos=73; change master to master_log_pos=73;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 73 4 None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 73 4 None 0 No #
start slave; start slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 slave-relay-bin.000001 48 master-bin.000001 No Yes 0 0 73 48 None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 slave-relay-bin.000001 48 master-bin.000001 No Yes 0 0 73 48 None 0 No #
stop slave; stop slave;
change master to master_log_pos=173; change master to master_log_pos=173;
start slave; start slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
127.0.0.1 root MASTER_PORT 1 master-bin.000001 173 slave-relay-bin.000001 4 master-bin.000001 No Yes 0 0 173 4 None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 173 slave-relay-bin.000001 4 master-bin.000001 No Yes 0 0 173 4 None 0 No #
show master status; show master status;
File Position Binlog_do_db Binlog_ignore_db File Position Binlog_do_db Binlog_ignore_db
master-bin.000001 79 master-bin.000001 79

View File

@ -16,7 +16,7 @@ select @@global.max_relay_log_size;
start slave; start slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
Waiting for master to send event 127.0.0.1 root MASTER_PORT 1 master-bin.000001 50477 slave-relay-bin.000014 1221 master-bin.000001 Yes Yes 0 0 50477 1221 None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 50477 slave-relay-bin.000014 1221 master-bin.000001 Yes Yes 0 0 50477 1221 None 0 No #
stop slave; stop slave;
reset slave; reset slave;
set global max_relay_log_size=(5*4096); set global max_relay_log_size=(5*4096);
@ -26,7 +26,7 @@ select @@global.max_relay_log_size;
start slave; start slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
Waiting for master to send event 127.0.0.1 root MASTER_PORT 1 master-bin.000001 50477 slave-relay-bin.000004 9457 master-bin.000001 Yes Yes 0 0 50477 9457 None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 50477 slave-relay-bin.000004 9457 master-bin.000001 Yes Yes 0 0 50477 9457 None 0 No #
stop slave; stop slave;
reset slave; reset slave;
set global max_relay_log_size=0; set global max_relay_log_size=0;
@ -36,25 +36,25 @@ select @@global.max_relay_log_size;
start slave; start slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
Waiting for master to send event 127.0.0.1 root MASTER_PORT 1 master-bin.000001 50477 slave-relay-bin.000008 1283 master-bin.000001 Yes Yes 0 0 50477 1283 None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 50477 slave-relay-bin.000008 1283 master-bin.000001 Yes Yes 0 0 50477 1283 None 0 No #
stop slave; stop slave;
reset slave; reset slave;
flush logs; flush logs;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No # # 127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No #
reset slave; reset slave;
start slave; start slave;
flush logs; flush logs;
create table t1 (a int); create table t1 (a int);
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
Waiting for master to send event 127.0.0.1 root MASTER_PORT 1 master-bin.000001 50535 slave-relay-bin.000009 62 master-bin.000001 Yes Yes 0 0 50535 62 None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 50535 slave-relay-bin.000009 62 master-bin.000001 Yes Yes 0 0 50535 62 None 0 No #
flush logs; flush logs;
drop table t1; drop table t1;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
Waiting for master to send event 127.0.0.1 root MASTER_PORT 1 master-bin.000001 50583 slave-relay-bin.000010 52 master-bin.000001 Yes Yes 0 0 50583 52 None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 50583 slave-relay-bin.000010 52 master-bin.000001 Yes Yes 0 0 50583 52 None 0 No #
flush logs; flush logs;
show master status; show master status;
File Position Binlog_do_db Binlog_ignore_db File Position Binlog_do_db Binlog_ignore_db

View File

@ -19,12 +19,12 @@ select * from t1;
t t
1 1
show slave status; show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
127.0.0.1 replssl MASTER_MYPORT 1 master-bin.000001 289 slave-relay-bin.000001 108 master-bin.000001 Yes Yes 0 0 289 108 None 0 Yes MYSQL_TEST_DIR/std_data/cacert.pem MYSQL_TEST_DIR/std_data/client-cert.pem MYSQL_TEST_DIR/std_data/client-key.pem # 127.0.0.1 replssl MASTER_MYPORT 1 master-bin.000001 289 slave-relay-bin.000001 108 master-bin.000001 Yes Yes 0 0 289 108 None 0 Yes MYSQL_TEST_DIR/std_data/cacert.pem MYSQL_TEST_DIR/std_data/client-cert.pem MYSQL_TEST_DIR/std_data/client-key.pem #
stop slave; stop slave;
change master to master_user='root',master_password='', master_ssl=0; change master to master_user='root',master_password='', master_ssl=0;
start slave; start slave;
drop table t1; drop table t1;
show slave status; show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 337 slave-relay-bin.000001 96 master-bin.000001 Yes Yes 0 0 337 96 None 0 No MYSQL_TEST_DIR/std_data/cacert.pem MYSQL_TEST_DIR/std_data/client-cert.pem MYSQL_TEST_DIR/std_data/client-key.pem # 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 337 slave-relay-bin.000001 96 master-bin.000001 Yes Yes 0 0 337 96 None 0 No MYSQL_TEST_DIR/std_data/cacert.pem MYSQL_TEST_DIR/std_data/client-cert.pem MYSQL_TEST_DIR/std_data/client-key.pem #

View File

@ -28,4 +28,4 @@ ERROR 42S02: Table 'test.t11' doesn't exist
drop table if exists t1,t2,t11; drop table if exists t1,t2,t11;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
Waiting for master to send event 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1281 slave-relay-bin.000002 1325 master-bin.000001 Yes Yes test.t1 0 0 1281 1325 None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1281 slave-relay-bin.000002 1325 master-bin.000001 Yes Yes test.t1 0 0 1281 1325 None 0 No #

View File

@ -6,17 +6,17 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
Waiting for master to send event 127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 123 None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 123 None 0 No #
stop slave; stop slave;
change master to master_user='test'; change master to master_user='test';
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
127.0.0.1 test MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 79 4 None 0 No # # 127.0.0.1 test MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 79 4 None 0 No #
reset slave; reset slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No # # 127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No #
start slave; start slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
Waiting for master to send event 127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 123 None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 123 None 0 No #

View File

@ -16,7 +16,7 @@ create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard'); insert into t1 values('Could not break slave'),('Tried hard');
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
Waiting for master to send event 127.0.0.1 root MASTER_PORT 60 master-bin.000001 417 slave-relay-bin.000001 461 master-bin.000001 Yes Yes 0 0 417 461 None 0 No # # 127.0.0.1 root MASTER_PORT 60 master-bin.000001 417 slave-relay-bin.000001 461 master-bin.000001 Yes Yes 0 0 417 461 None 0 No #
select * from t1; select * from t1;
s s
Could not break slave Could not break slave
@ -57,7 +57,7 @@ master-bin.000003
insert into t2 values (65); insert into t2 values (65);
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
Waiting for master to send event 127.0.0.1 root MASTER_PORT 60 master-bin.000003 290 slave-relay-bin.000001 1088 master-bin.000003 Yes Yes 0 0 290 1088 None 0 No # # 127.0.0.1 root MASTER_PORT 60 master-bin.000003 290 slave-relay-bin.000001 1088 master-bin.000003 Yes Yes 0 0 290 1088 None 0 No #
select * from t2; select * from t2;
m m
34 34
@ -81,7 +81,7 @@ a
testing temporary tables part 2 testing temporary tables part 2
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
Waiting for master to send event 127.0.0.1 root MASTER_PORT 60 master-bin.000004 2886 slave-relay-bin.000001 7891 master-bin.000004 Yes Yes 0 0 2886 7891 None 0 No # # 127.0.0.1 root MASTER_PORT 60 master-bin.000004 2886 slave-relay-bin.000001 7891 master-bin.000004 Yes Yes 0 0 2886 7891 None 0 No #
lock tables t3 read; lock tables t3 read;
select count(*) from t3 where n >= 4; select count(*) from t3 where n >= 4;
count(*) count(*)

View File

@ -10,5 +10,5 @@ reset slave;
start slave; start slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
Waiting for master to send event 127.0.0.1 root MASTER_PORT 1 master-bin.000002 4 slave-relay-bin.000002 123 master-bin.000001 Yes No 0 Rolling back unfinished transaction (no COMMIT or ROLLBACK) from relay log. Probably cause is that the master died while writing the transaction to it's binary log. 0 79 326 None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000002 4 slave-relay-bin.000002 123 master-bin.000001 Yes No 0 Rolling back unfinished transaction (no COMMIT or ROLLBACK) from relay log. Probably cause is that the master died while writing the transaction to it's binary log. 0 79 326 None 0 No #
reset master; reset master;

View File

@ -31,7 +31,7 @@ n
4 4
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
Waiting for master to send event 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 332 master-bin.000001 Yes No 0 0 244 649 Master master-bin.000001 244 No # # 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 332 master-bin.000001 Yes No 0 0 244 649 Master master-bin.000001 244 No #
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291; start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
select * from t1; select * from t1;
n n
@ -41,7 +41,7 @@ n
4 4
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
Waiting for master to send event 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 332 master-bin.000001 Yes No 0 0 244 649 Master master-no-such-bin.000001 291 No # # 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 332 master-bin.000001 Yes No 0 0 244 649 Master master-no-such-bin.000001 291 No #
start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=537; start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=537;
select * from t2; select * from t2;
n n
@ -49,13 +49,13 @@ n
2 2
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
Waiting for master to send event 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 537 master-bin.000001 Yes No 0 0 449 649 Relay slave-relay-bin.000002 537 No # # 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 537 master-bin.000001 Yes No 0 0 449 649 Relay slave-relay-bin.000002 537 No #
start slave; start slave;
stop slave; stop slave;
start slave until master_log_file='master-bin.000001', master_log_pos=561; start slave until master_log_file='master-bin.000001', master_log_pos=561;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master Slave_IO_State Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_behind_master
Waiting for master to send event 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 649 master-bin.000001 Yes No 0 0 561 693 Master master-bin.000001 561 No # # 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 649 master-bin.000001 Yes No 0 0 561 693 Master master-bin.000001 561 No #
start slave until master_log_file='master-bin', master_log_pos=561; start slave until master_log_file='master-bin', master_log_pos=561;
ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12; start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;

View File

@ -136,7 +136,7 @@ email104
email105 email105
email106 email106
email107 email107
INSERT INTO `t1` (`id`, `kid`) VALUES ('', '150'); INSERT INTO `t1` (`id`, `kid`) VALUES ('0', '150');
SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10; SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
email email
email1 email1

View File

@ -71,10 +71,10 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`a`), PRIMARY KEY (`a`),
UNIQUE KEY `email` (`email`) UNIQUE KEY `email` (`email`)
) TYPE=HEAP ROW_FORMAT=DYNAMIC ) TYPE=HEAP ROW_FORMAT=DYNAMIC
set sql_mode="postgresql,oracle,mssql,db2,sapdb"; set sql_mode="postgresql,oracle,mssql,db2,maxdb";
select @@sql_mode; select @@sql_mode;
@@sql_mode @@sql_mode
PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,POSTGRESQL,ORACLE,MSSQL,DB2,SAPDB,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,POSTGRESQL,ORACLE,MSSQL,DB2,MAXDB,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE "t1" ( t1 CREATE TABLE "t1" (

View File

@ -1456,7 +1456,7 @@ explain select * from t3 where a > all (select max(b) from t2 group by a);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort 2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort
drop table if exists t2, t3; drop table t2, t3;
create table t1 (s1 int); create table t1 (s1 int);
insert into t1 values (1); insert into t1 values (1);
insert into t1 values (2); insert into t1 values (2);

View File

@ -70,6 +70,12 @@ select min(a) from t1;
min(a) min(a)
-0.010 -0.010
drop table t1; drop table t1;
create table t1 (a float);
insert into t1 values (1);
select max(a),min(a),avg(a) from t1;
max(a) min(a) avg(a)
1 1 1
drop table t1;
create table t1 (f float, f2 float(24), f3 float(6,2), d double, d2 float(53), d3 double(10,3), de decimal, de2 decimal(6), de3 decimal(5,2), n numeric, n2 numeric(8), n3 numeric(5,6)); create table t1 (f float, f2 float(24), f3 float(6,2), d double, d2 float(53), d3 double(10,3), de decimal, de2 decimal(6), de3 decimal(5,2), n numeric, n2 numeric(8), n3 numeric(5,6));
show full columns from t1; show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment

View File

@ -163,6 +163,38 @@ set @@rand_seed1=10000000,@@rand_seed2=1000000;
select ROUND(RAND(),5); select ROUND(RAND(),5);
ROUND(RAND(),5) ROUND(RAND(),5)
0.02887 0.02887
show variables like '%alloc%';
Variable_name Value
query_alloc_block_size 8192
query_prealloc_size 8192
range_alloc_block_size 2048
transaction_alloc_block_size 8192
transaction_prealloc_size 4096
set @@range_alloc_block_size=1024*16;
set @@query_alloc_block_size=1024*17+2;
set @@query_prealloc_size=1024*18;
set @@transaction_alloc_block_size=1024*20-1;
set @@transaction_prealloc_size=1024*21-1;
select @@query_alloc_block_size;
@@query_alloc_block_size
17408
show variables like '%alloc%';
Variable_name Value
query_alloc_block_size 17408
query_prealloc_size 18432
range_alloc_block_size 16384
transaction_alloc_block_size 19456
transaction_prealloc_size 20480
set @@range_alloc_block_size=default;
set @@query_alloc_block_size=default, @@query_prealloc_size=default;
set transaction_alloc_block_size=default, @@transaction_prealloc_size=default;
show variables like '%alloc%';
Variable_name Value
query_alloc_block_size 8192
query_prealloc_size 8192
range_alloc_block_size 2048
transaction_alloc_block_size 8192
transaction_prealloc_size 4096
set big_tables=OFFF; set big_tables=OFFF;
ERROR 42000: Variable 'big_tables' can't be set to the value of 'OFFF' ERROR 42000: Variable 'big_tables' can't be set to the value of 'OFFF'
set big_tables="OFFF"; set big_tables="OFFF";
@ -202,6 +234,8 @@ set myisam_max_sort_file_size=100;
ERROR HY000: Variable 'myisam_max_sort_file_size' is a GLOBAL variable and should be set with SET GLOBAL ERROR HY000: Variable 'myisam_max_sort_file_size' is a GLOBAL variable and should be set with SET GLOBAL
set myisam_max_extra_sort_file_size=100; set myisam_max_extra_sort_file_size=100;
ERROR HY000: Variable 'myisam_max_extra_sort_file_size' is a GLOBAL variable and should be set with SET GLOBAL ERROR HY000: Variable 'myisam_max_extra_sort_file_size' is a GLOBAL variable and should be set with SET GLOBAL
set @@SQL_WARNINGS=NULL;
ERROR 42000: Variable 'sql_warnings' can't be set to the value of 'NULL'
set autocommit=1; set autocommit=1;
set big_tables=1; set big_tables=1;
select @@autocommit, @@big_tables; select @@autocommit, @@big_tables;

View File

@ -92,6 +92,8 @@ Warning 1264 Data truncated for column 'b' at row 3
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'a' at row 4 Warning 1262 Data truncated, NULL supplied to NOT NULL column 'a' at row 4
Warning 1264 Data truncated for column 'b' at row 4 Warning 1264 Data truncated for column 'b' at row 4
insert into t2(b) values('mysqlab'); insert into t2(b) values('mysqlab');
Warnings:
Warning 1264 Data truncated for column 'b' at row 1
set sql_warnings=1; set sql_warnings=1;
insert into t2(b) values('mysqlab'); insert into t2(b) values('mysqlab');
Warnings: Warnings:

View File

@ -17,25 +17,35 @@ insert into t1 values (""),(null);
select * from t1; select * from t1;
drop table t1; drop table t1;
create table t1 (a int not null auto_increment,primary key (a)) type=heap;
drop table t1;
# #
# Test of some CREATE TABLE'S that should fail # Test of some CREATE TABLE'S that should fail
# #
!$1146 create table t2 type=heap select * from t1; --error 1146
!$1146 create table t2 select auto+1 from t1; create table t2 type=heap select * from t1;
--error 1146
create table t2 select auto+1 from t1;
drop table if exists t1,t2; drop table if exists t1,t2;
!$1167 create table t1 (b char(0) not null, index(b)); --error 1167
create table t1 (a int not null auto_increment,primary key (a)) type=heap; create table t1 (b char(0) not null, index(b));
!$1163 create table t1 (a int not null,b text) type=heap; --error 1163
create table t1 (a int not null,b text) type=heap;
drop table if exists t1; drop table if exists t1;
!$1075 create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=heap; --error 1075
create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=heap;
-- error 1044,1 -- error 1044,1
create table not_existing_database.test (a int); create table not_existing_database.test (a int);
!$1103 create table `a/a` (a int); --error 1103
!$1103 create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int); create table `a/a` (a int);
!$1059 create table a (`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` int); --error 1103
create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int);
--error 1059
create table a (`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` int);
# #
# test of dummy table names # test of dummy table names
@ -62,7 +72,8 @@ create table `` (a int);
drop table if exists ``; drop table if exists ``;
--error 1166 --error 1166
create table t1 (`` int); create table t1 (`` int);
drop table if exists t1; --error 1279
create table t1 (i int, index `` (i));
# #
# Test of CREATE ... SELECT with indexes # Test of CREATE ... SELECT with indexes
@ -166,6 +177,46 @@ insert into t1 values (NULL, 3);
insert into t1 values (NULL, NULL); insert into t1 values (NULL, NULL);
drop table t1; drop table t1;
#
# Bug # 801
#
create table t1 select x'4132';
drop table t1;
#
# bug #1434
#
create table t1 select 1,2,3;
create table if not exists t1 select 1,2;
--error 1136
create table if not exists t1 select 1,2,3,4;
create table if not exists t1 select 1;
select * from t1;
drop table t1;
create table t1 select 1,2,3;
create table if not exists t1 select 1,2;
--error 1136
create table if not exists t1 select 1,2,3,4;
create table if not exists t1 select 1;
select * from t1;
drop table t1;
#
# Test create table if not exists with duplicate key error
#
create table t1 (a int not null, b int, primary key (a));
insert into t1 values (1,1);
create table if not exists t1 select 2;
select * from t1;
create table if not exists t1 select 3 as 'a',4 as 'b';
--error 1062
create table if not exists t1 select 3 as 'a',3 as 'b';
select * from t1;
drop table t1;
# #
# Test create with foreign keys # Test create with foreign keys
# #
@ -229,12 +280,6 @@ show create table t1;
SET SESSION table_type=default; SET SESSION table_type=default;
drop table t1; drop table t1;
#
# Bug # 801
#
create table t1 select x'4132';
drop table t1;
# #
# Test types of data for create select with functions # Test types of data for create select with functions
# #

View File

@ -1,3 +1,10 @@
#
# Test of alter table
#
--disable_warnings
drop table if exists t1;
--enable_warnings
CREATE TABLE t1 SELECT _utf8'test' as c1, _utf8'тест' as c2; CREATE TABLE t1 SELECT _utf8'test' as c1, _utf8'тест' as c2;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
DELETE FROM t1; DELETE FROM t1;

View File

@ -0,0 +1 @@
--date_format=%d.%m.%Y --time_format=%H.%i.%s --datetime_format=%Y/%d/%m-%H:%i:%s

View File

@ -0,0 +1,82 @@
SHOW GLOBAL VARIABLES LIKE "%_format%";
SHOW SESSION VARIABLES LIKE "%_format%";
SET date_format="%d.%m.%Y";
select CAST("01.01.2001" as DATE) as a;
SET datetime_format="%d.%m.%Y %H.%i.%s";
select CAST("01.01.2001 05.12.06" as DATETIME) as a;
SET time_format="%H.%i.%s";
select CAST("05.12.06" as TIME) as a;
SET datetime_format="%d.%m.%Y %h:%i:%s %p";
select CAST("01.01.2001 05:12:06AM" as DATETIME) as a;
select CAST("01.01.2001 05:12:06 PM" as DATETIME) as a;
SET time_format="%h:%i:%s %p";
select CAST("05:12:06 AM" as TIME) as a;
select CAST("05:12:06.1234PM" as TIME) as a;
SET time_format="%h.%i.%s %p";
SET date_format='%d.%m.%y';
SET datetime_format="%d.%m.%y %h.%i.%s %p";
select CAST("12-12-06" as DATE) as a;
select adddate("01.01.97 11.59.59.000001 PM", 10);
select datediff("31.12.97 11.59:59.000001 PM","01.01.98");
select weekofyear("31.11.97 11:59:59.000001 PM");
select makedate(1997,1);
select addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002");
select maketime(23,11,12);
select timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM");
SET time_format="%H%i%s";
--error 1105
SET time_format="%h%i%s";
--error 1105
SET date_format='%d.%m.%d';
--error 1105
SET datetime_format="%d.%m.%y %h.%i.%s";
SET GLOBAL date_format=default;
SHOW GLOBAL VARIABLES LIKE "date_format%";
SET GLOBAL time_format=default;
SHOW GLOBAL VARIABLES LIKE "time_format%";
SET GLOBAL datetime_format=default;
SHOW GLOBAL VARIABLES LIKE "datetime_format%";
SET date_format=default;
SHOW SESSION VARIABLES LIKE "date_format%";
SET time_format=default;
SHOW SESSION VARIABLES LIKE "time_format%";
SET datetime_format=default;
SHOW SESSION VARIABLES LIKE "datetime_format%";
SET time_format='%i:%s:%H';
select cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME);
SET GLOBAL date_format='%Y-%m-%d';
SET GLOBAL time_format='%H:%i:%s';
SET GLOBAL datetime_format='%Y-%m-%d %H:%i:%s';
SET date_format='%Y-%m-%d';
SET time_format='%H:%i:%s';
SET datetime_format='%Y-%m-%d %H:%i:%s';
select str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S");
select str_to_date("15 September 2001", "%d %M %Y");
select str_to_date("15 Septembeb 2001", "%d %M %Y");
select str_to_date("15 MAY 2001", "%d %b %Y");
select str_to_date("Sunday 15 MAY 2001", "%W %d %b %Y");
select str_to_date("Sundai 15 MAY 2001", "%W %d %b %Y");
select str_to_date("Sundai 15 MA", "%W %d %b %Y");
select str_to_date("Tuesday 52 2001", "%W %V %X");
select str_to_date("Sunday 01 2001", "%W %V %X");
select str_to_date("Tuesday 00 2002", "%W %U %Y");
select str_to_date("Thursday 53 1998", "%W %u %Y");
select str_to_date("15-01-2001", "%d-%m-%Y %H:%i:%S");
select str_to_date("15-01-20", "%d-%m-%Y");
select str_to_date("15-2001-1", "%d-%Y-%c");
select get_format(DATE, 'USA') as a;
select get_format(TIME, 'internal') as a;
select get_format(DATETIME, 'eur') as a;

View File

@ -122,3 +122,13 @@ delete from (select * from t1);
-- error 1064 -- error 1064
insert into (select * from t1) values (5); insert into (select * from t1) values (5);
drop table t1; drop table t1;
#
# deived tables with subquery inside all by one table
#
create table t1 (E1 INTEGER UNSIGNED NOT NULL, E2 INTEGER UNSIGNED NOT NULL, E3 INTEGER UNSIGNED NOT NULL, PRIMARY KEY(E1)
);
insert into t1 VALUES(1,1,1), (2,2,1);
select count(*) from t1 INNER JOIN (SELECT A.E1, A.E2, A.E3 FROM t1 AS A WHERE A.E3 = (SELECT MAX(B.E3) FROM t1 AS B WHERE A.E2 = B.E2)) AS THEMAX ON t1.E1 = THEMAX.E2 AND t1.E1 = t1.E2;
explain select count(*) from t1 INNER JOIN (SELECT A.E1, A.E2, A.E3 FROM t1 AS A WHERE A.E3 = (SELECT MAX(B.E3) FROM t1 AS B WHERE A.E2 = B.E2)) AS THEMAX ON t1.E1 = THEMAX.E2 AND t1.E1 = t1.E2;
drop table t1;

View File

@ -24,8 +24,12 @@ select uncompress(compress(""));
select uncompressed_length(""); select uncompressed_length("");
# #
# NULL (Bug #1333) # errors
# #
select compress(NULL); create table t1 (a text);
select uncompress(NULL); insert t1 values (compress(null)), ('A\0\0\0BBBBBBBB'), (compress(space(50000))), (space(50000));
select length(a) from t1;
select length(uncompress(a)) from t1;
drop table t1;

View File

@ -119,4 +119,11 @@ insert into t1 values('test'),('test2');
select * from t1 having group_concat(bar)=''; select * from t1 having group_concat(bar)='';
drop table t1; drop table t1;
# ORDER BY fix_fields()
create table t1 (a int, a1 varchar(10));
create table t2 (a0 int);
insert into t1 values (0,"a"),(0,"b"),(1,"c");
insert into t2 values (1),(2),(3);
select group_concat(a1 order by (t1.a IN (select a0 from t2))) from t1;
select group_concat(a1 order by (t1.a)) from t1;
drop table t1, t2;

View File

@ -34,6 +34,7 @@ create table t1 (a tinyint not null auto_increment, b blob not null, primary key
let $1=100; let $1=100;
disable_query_log; disable_query_log;
--disable_warnings
SET SQL_WARNINGS=0; SET SQL_WARNINGS=0;
while ($1) while ($1)
{ {
@ -41,6 +42,7 @@ while ($1)
dec $1; dec $1;
} }
SET SQL_WARNINGS=1; SET SQL_WARNINGS=1;
--enable_warnings
enable_query_log; enable_query_log;
check table t1; check table t1;
repair table t1; repair table t1;

View File

@ -39,28 +39,28 @@ select "--- Local --" as "";
# #
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ $MYSQL_TEST_DIR/var/log/master-bin.000001
# this should not fail but shouldn't produce any working statements # this should not fail but shouldn't produce any working statements
--disable_query_log --disable_query_log
select "--- Broken LOAD DATA --" as ""; select "--- Broken LOAD DATA --" as "";
--enable_query_log --enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000002 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ $MYSQL_TEST_DIR/var/log/master-bin.000002
# this should show almost nothing # this should show almost nothing
--disable_query_log --disable_query_log
select "--- --database --" as ""; select "--- --database --" as "";
--enable_query_log --enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form --database=nottest $MYSQL_TEST_DIR/var/log/master-bin.000001 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --database=nottest $MYSQL_TEST_DIR/var/log/master-bin.000001
# this test for position option # this test for position option
--disable_query_log --disable_query_log
select "--- --position --" as ""; select "--- --position --" as "";
--enable_query_log --enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form --position=27 $MYSQL_TEST_DIR/var/log/master-bin.000002 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --position=27 $MYSQL_TEST_DIR/var/log/master-bin.000002
# These are tests for remote binlog. # These are tests for remote binlog.
# They should return the same as previous test. # They should return the same as previous test.
@ -76,28 +76,28 @@ select "--- Remote --" as "";
# This is broken now # This is broken now
# By the way it seems that remote version fetches all events with name >= master-bin.000001 # By the way it seems that remote version fetches all events with name >= master-bin.000001
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
# This is broken too # This is broken too
--disable_query_log --disable_query_log
select "--- Broken LOAD DATA --" as ""; select "--- Broken LOAD DATA --" as "";
--enable_query_log --enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
# And this too ! (altough it is documented) # And this too ! (altough it is documented)
--disable_query_log --disable_query_log
select "--- --database --" as ""; select "--- --database --" as "";
--enable_query_log --enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --database=nottest master-bin.000001 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --database=nottest master-bin.000001
# Strangely but this works # Strangely but this works
--disable_query_log --disable_query_log
select "--- --position --" as ""; select "--- --position --" as "";
--enable_query_log --enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form --read-from-remote-server --position=27 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --position=27 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
# clean up # clean up
drop table t1; drop table t1;

View File

@ -7,24 +7,24 @@ save_master_pos;
connection slave; connection slave;
reset slave; reset slave;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
change master to master_host='127.0.0.1'; change master to master_host='127.0.0.1';
# The following needs to be cleaned up when change master is fixed # The following needs to be cleaned up when change master is fixed
--replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
eval change master to master_host='127.0.0.1',master_user='root', eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$MASTER_MYPORT; master_password='',master_port=$MASTER_MYPORT;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
start slave; start slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
connection master; connection master;
--disable_warnings --disable_warnings

View File

@ -1,6 +1,6 @@
source include/master-slave.inc; source include/master-slave.inc;
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
# #

View File

@ -15,7 +15,7 @@ sync_with_master;
# The port number is different when doing the release build with # The port number is different when doing the release build with
# Do-compile, hence we have to replace the port number here accordingly # Do-compile, hence we have to replace the port number here accordingly
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
# check that the table has been ignored, because otherwise the test is nonsense # check that the table has been ignored, because otherwise the test is nonsense
show tables like 't1'; show tables like 't1';

View File

@ -18,5 +18,5 @@ sleep 5;
flush logs; flush logs;
sleep 5; sleep 5;
--replace_result $SLAVE_MYPORT SLAVE_PORT --replace_result $SLAVE_MYPORT SLAVE_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;

View File

@ -72,7 +72,7 @@ set global sql_slave_skip_counter=1;
start slave; start slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
# Trigger error again to test CHANGE MASTER # Trigger error again to test CHANGE MASTER
@ -92,7 +92,7 @@ stop slave;
change master to master_user='test'; change master to master_user='test';
change master to master_user='root'; change master to master_user='root';
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
# Trigger error again to test RESET SLAVE # Trigger error again to test RESET SLAVE
@ -114,7 +114,7 @@ wait_for_slave_to_stop;
stop slave; stop slave;
reset slave; reset slave;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
# Finally, see if logging is done ok on master for a failing LOAD DATA INFILE # Finally, see if logging is done ok on master for a failing LOAD DATA INFILE

View File

@ -94,7 +94,7 @@ show binlog events in 'slave-bin.000001' from 4;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT $VERSION VERSION --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT $VERSION VERSION
show binlog events in 'slave-bin.000002' from 4; show binlog events in 'slave-bin.000002' from 4;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
# Need to recode the following # Need to recode the following

View File

@ -5,7 +5,7 @@ source include/master-slave.inc;
show master status; show master status;
sync_slave_with_master; sync_slave_with_master;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
stop slave; stop slave;
change master to master_log_pos=73; change master to master_log_pos=73;
@ -15,12 +15,12 @@ stop slave;
change master to master_log_pos=73; change master to master_log_pos=73;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
start slave; start slave;
sleep 5; sleep 5;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
stop slave; stop slave;
change master to master_log_pos=173; change master to master_log_pos=173;
@ -28,7 +28,7 @@ change master to master_log_pos=173;
start slave; start slave;
sleep 2; sleep 2;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
connection master; connection master;
show master status; show master status;

View File

@ -29,7 +29,7 @@ select @@global.max_relay_log_size;
start slave; start slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
stop slave; stop slave;
reset slave; reset slave;
@ -38,7 +38,7 @@ select @@global.max_relay_log_size;
start slave; start slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
stop slave; stop slave;
reset slave; reset slave;
@ -47,7 +47,7 @@ select @@global.max_relay_log_size;
start slave; start slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
# Tests below are mainly to ensure that we have not coded with wrong assumptions # Tests below are mainly to ensure that we have not coded with wrong assumptions
@ -58,7 +58,7 @@ reset slave;
# (to make sure it does not crash). # (to make sure it does not crash).
flush logs; flush logs;
--replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
reset slave; reset slave;
@ -74,7 +74,7 @@ save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
# one more rotation, to be sure Relay_log_space is correctly updated # one more rotation, to be sure Relay_log_space is correctly updated
flush logs; flush logs;
@ -84,7 +84,7 @@ save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
connection master; connection master;

View File

@ -45,7 +45,7 @@ select * from t1;
#checking show slave status #checking show slave status
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
#checking if replication works without ssl also performing clean up #checking if replication works without ssl also performing clean up
@ -58,5 +58,5 @@ save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;

View File

@ -12,7 +12,7 @@ sync_with_master;
#discover slaves #discover slaves
connection master; connection master;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
SHOW SLAVE STATUS; SHOW SLAVE STATUS;
--replace_result $SLAVE_MYPORT SLAVE_PORT --replace_result $SLAVE_MYPORT SLAVE_PORT
SHOW SLAVE HOSTS; SHOW SLAVE HOSTS;

View File

@ -33,6 +33,6 @@ connection slave;
sync_with_master; sync_with_master;
# show slave status, just to see of it prints replicate-do-table # show slave status, just to see of it prints replicate-do-table
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;

View File

@ -9,22 +9,22 @@ save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
stop slave; stop slave;
change master to master_user='test'; change master to master_user='test';
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
reset slave; reset slave;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
start slave; start slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;

View File

@ -55,7 +55,7 @@ create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard'); insert into t1 values('Could not break slave'),('Tried hard');
sync_slave_with_master; sync_slave_with_master;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
select * from t1; select * from t1;
connection master; connection master;
@ -107,7 +107,7 @@ show binary logs;
insert into t2 values (65); insert into t2 values (65);
sync_slave_with_master; sync_slave_with_master;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
select * from t2; select * from t2;
@ -138,7 +138,7 @@ sync_with_master;
select * from t4; select * from t4;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
# because of concurrent insert, the table may not be up to date # because of concurrent insert, the table may not be up to date
# if we do not lock # if we do not lock

View File

@ -21,7 +21,7 @@ start slave;
# can't sync_with_master so we must sleep # can't sync_with_master so we must sleep
sleep 3; sleep 3;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
connection master; connection master;
reset master; reset master;

View File

@ -29,7 +29,7 @@ sleep 2;
# here table should be still not deleted # here table should be still not deleted
select * from t1; select * from t1;
--replace_result $MASTER_MYPORT MASTER_MYPORT --replace_result $MASTER_MYPORT MASTER_MYPORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
# this should fail right after start # this should fail right after start
@ -38,7 +38,7 @@ start slave until master_log_file='master-no-such-bin.000001', master_log_pos=29
select * from t1; select * from t1;
sleep 2; sleep 2;
--replace_result $MASTER_MYPORT MASTER_MYPORT --replace_result $MASTER_MYPORT MASTER_MYPORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
# try replicate all until second insert to t2; # try replicate all until second insert to t2;
@ -46,7 +46,7 @@ start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=537;
sleep 2; sleep 2;
select * from t2; select * from t2;
--replace_result $MASTER_MYPORT MASTER_MYPORT --replace_result $MASTER_MYPORT MASTER_MYPORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
# clean up # clean up
@ -62,7 +62,7 @@ start slave until master_log_file='master-bin.000001', master_log_pos=561;
sleep 2; sleep 2;
# here the sql slave thread should be stopped # here the sql slave thread should be stopped
--replace_result $MASTER_MYPORT MASTER_MYPORT --replace_result $MASTER_MYPORT MASTER_MYPORT
--replace_column 33 # --replace_column 1 # 33 #
show slave status; show slave status;
#testing various error conditions #testing various error conditions

View File

@ -64,7 +64,7 @@ SELECT FOUND_ROWS();
SELECT DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10; SELECT DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
SELECT DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL ORDER BY email LIMIT 10; SELECT DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL ORDER BY email LIMIT 10;
INSERT INTO `t1` (`id`, `kid`) VALUES ('', '150'); INSERT INTO `t1` (`id`, `kid`) VALUES ('0', '150');
SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10; SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
SELECT FOUND_ROWS(); SELECT FOUND_ROWS();

View File

@ -24,7 +24,7 @@ show create table t1;
set @@sql_mode="no_field_options,mysql323,mysql40"; set @@sql_mode="no_field_options,mysql323,mysql40";
show variables like 'sql_mode'; show variables like 'sql_mode';
show create table t1; show create table t1;
set sql_mode="postgresql,oracle,mssql,db2,sapdb"; set sql_mode="postgresql,oracle,mssql,db2,maxdb";
select @@sql_mode; select @@sql_mode;
show create table t1; show create table t1;
drop table t1; drop table t1;

View File

@ -971,7 +971,7 @@ explain select * from t3 where a >= all (select b from t2);
insert into t2 values (2,2), (2,1), (3,3), (3,1); insert into t2 values (2,2), (2,1), (3,3), (3,1);
select * from t3 where a > all (select max(b) from t2 group by a); select * from t3 where a > all (select max(b) from t2 group by a);
explain select * from t3 where a > all (select max(b) from t2 group by a); explain select * from t3 where a > all (select max(b) from t2 group by a);
drop table if exists t2, t3; drop table t2, t3;
# #
# DO and SET with errors # DO and SET with errors

Some files were not shown because too many files have changed in this diff Show More