Commit 219bbd52 authored by unknown's avatar unknown

merge with 4.0


innobase/btr/btr0cur.c:
  Auto merged
innobase/btr/btr0sea.c:
  Auto merged
innobase/include/log0log.h:
  Auto merged
innobase/include/log0log.ic:
  Auto merged
innobase/log/log0recv.c:
  Auto merged
innobase/page/page0cur.c:
  Auto merged
innobase/que/que0que.c:
  Auto merged
myisam/myisam_ftdump.c:
  Auto merged
mysql-test/r/func_if.result:
  Auto merged
mysql-test/t/func_if.test:
  Auto merged
parents b5238021 b5469837
...@@ -22,7 +22,9 @@ extern "C" { ...@@ -22,7 +22,9 @@ extern "C" {
#include "my_base.h" /* get 'enum ha_rkey_function' */ #include "my_base.h" /* get 'enum ha_rkey_function' */
#define MAX_TREE_HEIGHT 40 /* = max 1048576 leafs in tree */ /* Worst case tree is half full. This gives use 2^(MAX_TREE_HIGHT/2) leafs */
#define MAX_TREE_HIGHT 64
#define ELEMENT_KEY(tree,element)\ #define ELEMENT_KEY(tree,element)\
(tree->offset_to_key ? (void*)((byte*) element+tree->offset_to_key) :\ (tree->offset_to_key ? (void*)((byte*) element+tree->offset_to_key) :\
*((void**) (element+1))) *((void**) (element+1)))
......
...@@ -65,6 +65,16 @@ this many index pages */ ...@@ -65,6 +65,16 @@ this many index pages */
/*--------------------------------------*/ /*--------------------------------------*/
#define BTR_BLOB_HDR_SIZE 8 #define BTR_BLOB_HDR_SIZE 8
/***********************************************************************
Marks all extern fields in a record as owned by the record. This function
should be called if the delete mark of a record is removed: a not delete
marked record always owns all its extern fields. */
static
void
btr_cur_unmark_extern_fields(
/*=========================*/
rec_t* rec, /* in: record in a clustered index */
mtr_t* mtr); /* in: mtr */
/*********************************************************************** /***********************************************************************
Adds path information to the cursor for the current page, for which Adds path information to the cursor for the current page, for which
the binary search has been performed. */ the binary search has been performed. */
...@@ -2933,7 +2943,7 @@ btr_cur_mark_dtuple_inherited_extern( ...@@ -2933,7 +2943,7 @@ btr_cur_mark_dtuple_inherited_extern(
Marks all extern fields in a record as owned by the record. This function Marks all extern fields in a record as owned by the record. This function
should be called if the delete mark of a record is removed: a not delete should be called if the delete mark of a record is removed: a not delete
marked record always owns all its extern fields. */ marked record always owns all its extern fields. */
static
void void
btr_cur_unmark_extern_fields( btr_cur_unmark_extern_fields(
/*=========================*/ /*=========================*/
......
...@@ -22,7 +22,9 @@ Created 2/17/1996 Heikki Tuuri ...@@ -22,7 +22,9 @@ Created 2/17/1996 Heikki Tuuri
ulint btr_search_this_is_zero = 0; /* A dummy variable to fool the ulint btr_search_this_is_zero = 0; /* A dummy variable to fool the
compiler */ compiler */
#ifdef UNIV_SEARCH_PERF_STAT
ulint btr_search_n_succ = 0; ulint btr_search_n_succ = 0;
#endif /* UNIV_SEARCH_PERF_STAT */
ulint btr_search_n_hash_fail = 0; ulint btr_search_n_hash_fail = 0;
byte btr_sea_pad1[64]; /* padding to prevent other memory update byte btr_sea_pad1[64]; /* padding to prevent other memory update
......
include ..\include\makefile.i
doall: cr.exe dcr.exe wro.exe
cr.exe: cry0cry.c
$(CCOM) $(CFLW) -o cr.exe -I.. cry0cry.c ..\ut.lib ..\os.lib
dcr.exe: cry0dcr.c
$(CCOM) $(CFLW) -o dcr.exe -I.. cry0dcr.c ..\ut.lib ..\os.lib
wro.exe: cry0wro.c
$(CCOM) $(CFLW) -o wro.exe -I.. cry0wro.c ..\ut.lib ..\os.lib
...@@ -435,16 +435,6 @@ btr_cur_mark_dtuple_inherited_extern( ...@@ -435,16 +435,6 @@ btr_cur_mark_dtuple_inherited_extern(
ulint n_ext_vec, /* in: number of elements in ext_vec */ ulint n_ext_vec, /* in: number of elements in ext_vec */
upd_t* update); /* in: update vector */ upd_t* update); /* in: update vector */
/*********************************************************************** /***********************************************************************
Marks all extern fields in a record as owned by the record. This function
should be called if the delete mark of a record is removed: a not delete
marked record always owns all its extern fields. */
void
btr_cur_unmark_extern_fields(
/*=========================*/
rec_t* rec, /* in: record in a clustered index */
mtr_t* mtr); /* in: mtr */
/***********************************************************************
Marks all extern fields in a dtuple as owned by the record. */ Marks all extern fields in a dtuple as owned by the record. */
void void
......
...@@ -214,7 +214,9 @@ extern rw_lock_t* btr_search_latch_temp; ...@@ -214,7 +214,9 @@ extern rw_lock_t* btr_search_latch_temp;
#define btr_search_latch (*btr_search_latch_temp) #define btr_search_latch (*btr_search_latch_temp)
#ifdef UNIV_SEARCH_PERF_STAT
extern ulint btr_search_n_succ; extern ulint btr_search_n_succ;
#endif /* UNIV_SEARCH_PERF_STAT */
extern ulint btr_search_n_hash_fail; extern ulint btr_search_n_hash_fail;
/* After change in n_fields or n_bytes in info, this many rounds are waited /* After change in n_fields or n_bytes in info, this many rounds are waited
......
...@@ -18,7 +18,9 @@ typedef struct log_struct log_t; ...@@ -18,7 +18,9 @@ typedef struct log_struct log_t;
typedef struct log_group_struct log_group_t; typedef struct log_group_struct log_group_t;
extern ibool log_do_write; extern ibool log_do_write;
#ifdef UNIV_LOG_DEBUG
extern ibool log_debug_writes; extern ibool log_debug_writes;
#endif /* UNIV_LOG_DEBUG */
/* Wait modes for log_write_up_to */ /* Wait modes for log_write_up_to */
#define LOG_NO_WAIT 91 #define LOG_NO_WAIT 91
...@@ -719,11 +721,13 @@ struct log_struct{ ...@@ -719,11 +721,13 @@ struct log_struct{
ulint max_buf_free; /* recommended maximum value of ulint max_buf_free; /* recommended maximum value of
buf_free, after which the buffer is buf_free, after which the buffer is
flushed */ flushed */
#ifdef UNIV_LOG_DEBUG
ulint old_buf_free; /* value of buf free when log was ulint old_buf_free; /* value of buf free when log was
last time opened; only in the debug last time opened; only in the debug
version */ version */
dulint old_lsn; /* value of lsn when log was last time dulint old_lsn; /* value of lsn when log was last time
opened; only in the debug version */ opened; only in the debug version */
#endif /* UNIV_LOG_DEBUG */
ibool check_flush_or_checkpoint; ibool check_flush_or_checkpoint;
/* this is set to TRUE when there may /* this is set to TRUE when there may
be need to flush the log buffer, or be need to flush the log buffer, or
......
...@@ -10,6 +10,7 @@ Created 12/9/1995 Heikki Tuuri ...@@ -10,6 +10,7 @@ Created 12/9/1995 Heikki Tuuri
#include "mach0data.h" #include "mach0data.h"
#include "mtr0mtr.h" #include "mtr0mtr.h"
#ifdef UNIV_LOG_DEBUG
/********************************************************** /**********************************************************
Checks by parsing that the catenated log segment for a single mtr is Checks by parsing that the catenated log segment for a single mtr is
consistent. */ consistent. */
...@@ -21,6 +22,7 @@ log_check_log_recs( ...@@ -21,6 +22,7 @@ log_check_log_recs(
in the log_sys->buf log buffer */ in the log_sys->buf log buffer */
ulint len, /* in: segment length in bytes */ ulint len, /* in: segment length in bytes */
dulint buf_start_lsn); /* in: buffer start lsn */ dulint buf_start_lsn); /* in: buffer start lsn */
#endif /* UNIV_LOG_DEBUG */
/**************************************************************** /****************************************************************
Gets a log block flush bit. */ Gets a log block flush bit. */
......
...@@ -32,8 +32,11 @@ Created 10/4/1994 Heikki Tuuri ...@@ -32,8 +32,11 @@ Created 10/4/1994 Heikki Tuuri
which extend it */ which extend it */
#define PAGE_CUR_DBG 6 #define PAGE_CUR_DBG 6
#ifdef PAGE_CUR_ADAPT
# ifdef UNIV_SEARCH_PERF_STAT
extern ulint page_cur_short_succ; extern ulint page_cur_short_succ;
# endif /* UNIV_SEARCH_PERF_STAT */
#endif /* PAGE_CUR_ADAPT */
/************************************************************* /*************************************************************
Gets pointer to the page frame where the cursor is positioned. */ Gets pointer to the page frame where the cursor is positioned. */
......
...@@ -307,22 +307,6 @@ que_thr_peek_stop( ...@@ -307,22 +307,6 @@ que_thr_peek_stop(
mutex reserved is necessary before deciding mutex reserved is necessary before deciding
the actual stopping */ the actual stopping */
que_thr_t* thr); /* in: query thread */ que_thr_t* thr); /* in: query thread */
/***************************************************************************
Returns TRUE if the query graph is for a SELECT statement. */
UNIV_INLINE
ibool
que_graph_is_select(
/*================*/
/* out: TRUE if a select */
que_t* graph); /* in: graph */
/**************************************************************************
Prints info of an SQL query graph node. */
void
que_node_print_info(
/*================*/
que_node_t* node); /* in: query graph node */
/* Query graph query thread node: the fields are protected by the kernel /* Query graph query thread node: the fields are protected by the kernel
mutex with the exceptions named below */ mutex with the exceptions named below */
......
...@@ -238,21 +238,3 @@ que_thr_peek_stop( ...@@ -238,21 +238,3 @@ que_thr_peek_stop(
return(FALSE); return(FALSE);
} }
/***************************************************************************
Returns TRUE if the query graph is for a SELECT statement. */
UNIV_INLINE
ibool
que_graph_is_select(
/*================*/
/* out: TRUE if a select */
que_t* graph) /* in: graph */
{
if (graph->fork_type == QUE_FORK_SELECT_SCROLL
|| graph->fork_type == QUE_FORK_SELECT_NON_SCROLL) {
return(TRUE);
}
return(FALSE);
}
...@@ -32,7 +32,9 @@ ulint log_fsp_current_free_limit = 0; ...@@ -32,7 +32,9 @@ ulint log_fsp_current_free_limit = 0;
log_t* log_sys = NULL; log_t* log_sys = NULL;
ibool log_do_write = TRUE; ibool log_do_write = TRUE;
#ifdef UNIV_LOG_DEBUG
ibool log_debug_writes = FALSE; ibool log_debug_writes = FALSE;
#endif /* UNIV_LOG_DEBUG */
/* These control how often we print warnings if the last checkpoint is too /* These control how often we print warnings if the last checkpoint is too
old */ old */
...@@ -86,9 +88,8 @@ the previous */ ...@@ -86,9 +88,8 @@ the previous */
Completes a checkpoint write i/o to a log file. */ Completes a checkpoint write i/o to a log file. */
static static
void void
log_io_complete_checkpoint( log_io_complete_checkpoint(void);
/*=======================*/ /*============================*/
log_group_t* group); /* in: log group */
/********************************************************** /**********************************************************
Completes an archiving i/o. */ Completes an archiving i/o. */
static static
...@@ -928,11 +929,12 @@ log_group_check_flush_completion( ...@@ -928,11 +929,12 @@ log_group_check_flush_completion(
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
if (!log_sys->one_flushed && group->n_pending_writes == 0) { if (!log_sys->one_flushed && group->n_pending_writes == 0) {
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
printf("Log flushed first to group %lu\n", printf("Log flushed first to group %lu\n",
(ulong) group->id); (ulong) group->id);
} }
#endif /* UNIV_LOG_DEBUG */
log_sys->written_to_some_lsn = log_sys->write_lsn; log_sys->written_to_some_lsn = log_sys->write_lsn;
log_sys->one_flushed = TRUE; log_sys->one_flushed = TRUE;
...@@ -940,10 +942,12 @@ log_group_check_flush_completion( ...@@ -940,10 +942,12 @@ log_group_check_flush_completion(
return(LOG_UNLOCK_NONE_FLUSHED_LOCK); return(LOG_UNLOCK_NONE_FLUSHED_LOCK);
} }
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes && (group->n_pending_writes == 0)) { if (log_debug_writes && (group->n_pending_writes == 0)) {
printf("Log flushed to group %lu\n", (ulong) group->id); printf("Log flushed to group %lu\n", (ulong) group->id);
} }
#endif /* UNIV_LOG_DEBUG */
return(0); return(0);
} }
...@@ -1019,7 +1023,15 @@ log_io_complete( ...@@ -1019,7 +1023,15 @@ log_io_complete(
fil_flush(group->space_id); fil_flush(group->space_id);
} }
log_io_complete_checkpoint(group); #ifdef UNIV_LOG_DEBUG
if (log_debug_writes) {
fprintf(stderr,
"Checkpoint info written to group %lu\n",
group->id);
}
#endif /* UNIV_LOG_DEBUG */
log_io_complete_checkpoint();
return; return;
} }
...@@ -1084,11 +1096,13 @@ log_group_file_header_flush( ...@@ -1084,11 +1096,13 @@ log_group_file_header_flush(
dest_offset = nth_file * group->file_size; dest_offset = nth_file * group->file_size;
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
printf( printf(
"Writing log file header to group %lu file %lu\n", "Writing log file header to group %lu file %lu\n",
(ulong) group->id, (ulong) nth_file); (ulong) group->id, (ulong) nth_file);
} }
#endif /* UNIV_LOG_DEBUG */
if (log_do_write) { if (log_do_write) {
log_sys->n_log_ios++; log_sys->n_log_ios++;
...@@ -1173,6 +1187,7 @@ loop: ...@@ -1173,6 +1187,7 @@ loop:
write_len = len; write_len = len;
} }
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
printf( printf(
...@@ -1197,6 +1212,7 @@ loop: ...@@ -1197,6 +1212,7 @@ loop:
+ i * OS_FILE_LOG_BLOCK_SIZE)); + i * OS_FILE_LOG_BLOCK_SIZE));
} }
} }
#endif /* UNIV_LOG_DEBUG */
/* Calculate the checksums for each log block and write them to /* Calculate the checksums for each log block and write them to
the trailer fields of the log blocks */ the trailer fields of the log blocks */
...@@ -1324,6 +1340,7 @@ loop: ...@@ -1324,6 +1340,7 @@ loop:
return; return;
} }
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
printf("Writing log from %lu %lu up to lsn %lu %lu\n", printf("Writing log from %lu %lu up to lsn %lu %lu\n",
(ulong) ut_dulint_get_high(log_sys->written_to_all_lsn), (ulong) ut_dulint_get_high(log_sys->written_to_all_lsn),
...@@ -1331,6 +1348,7 @@ loop: ...@@ -1331,6 +1348,7 @@ loop:
(ulong) ut_dulint_get_high(log_sys->lsn), (ulong) ut_dulint_get_high(log_sys->lsn),
(ulong) ut_dulint_get_low(log_sys->lsn)); (ulong) ut_dulint_get_low(log_sys->lsn));
} }
#endif /* UNIV_LOG_DEBUG */
log_sys->n_pending_writes++; log_sys->n_pending_writes++;
...@@ -1556,9 +1574,8 @@ log_complete_checkpoint(void) ...@@ -1556,9 +1574,8 @@ log_complete_checkpoint(void)
Completes an asynchronous checkpoint info write i/o to a log file. */ Completes an asynchronous checkpoint info write i/o to a log file. */
static static
void void
log_io_complete_checkpoint( log_io_complete_checkpoint(void)
/*=======================*/ /*============================*/
log_group_t* group) /* in: log group */
{ {
mutex_enter(&(log_sys->mutex)); mutex_enter(&(log_sys->mutex));
...@@ -1566,11 +1583,6 @@ log_io_complete_checkpoint( ...@@ -1566,11 +1583,6 @@ log_io_complete_checkpoint(
log_sys->n_pending_checkpoint_writes--; log_sys->n_pending_checkpoint_writes--;
if (log_debug_writes) {
printf("Checkpoint info written to group %lu\n",
(ulong) group->id);
}
if (log_sys->n_pending_checkpoint_writes == 0) { if (log_sys->n_pending_checkpoint_writes == 0) {
log_complete_checkpoint(); log_complete_checkpoint();
} }
...@@ -1895,12 +1907,14 @@ log_checkpoint( ...@@ -1895,12 +1907,14 @@ log_checkpoint(
log_sys->next_checkpoint_lsn = oldest_lsn; log_sys->next_checkpoint_lsn = oldest_lsn;
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
printf("Making checkpoint no %lu at lsn %lu %lu\n", printf("Making checkpoint no %lu at lsn %lu %lu\n",
(ulong) ut_dulint_get_low(log_sys->next_checkpoint_no), (ulong) ut_dulint_get_low(log_sys->next_checkpoint_no),
(ulong) ut_dulint_get_high(oldest_lsn), (ulong) ut_dulint_get_high(oldest_lsn),
(ulong) ut_dulint_get_low(oldest_lsn)); (ulong) ut_dulint_get_low(oldest_lsn));
} }
#endif /* UNIV_LOG_DEBUG */
log_groups_write_checkpoint_info(); log_groups_write_checkpoint_info();
...@@ -2287,9 +2301,11 @@ loop: ...@@ -2287,9 +2301,11 @@ loop:
exit(1); exit(1);
} }
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
printf("Created archive file %s\n", name); printf("Created archive file %s\n", name);
} }
#endif /* UNIV_LOG_DEBUG */
ret = os_file_close(file_handle); ret = os_file_close(file_handle);
...@@ -2316,6 +2332,7 @@ loop: ...@@ -2316,6 +2332,7 @@ loop:
len = group->file_size - (next_offset % group->file_size); len = group->file_size - (next_offset % group->file_size);
} }
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
printf( printf(
"Archiving starting at lsn %lu %lu, len %lu to group %lu\n", "Archiving starting at lsn %lu %lu, len %lu to group %lu\n",
...@@ -2323,6 +2340,7 @@ loop: ...@@ -2323,6 +2340,7 @@ loop:
(ulong) ut_dulint_get_low(start_lsn), (ulong) ut_dulint_get_low(start_lsn),
(ulong) len, (ulong) group->id); (ulong) len, (ulong) group->id);
} }
#endif /* UNIV_LOG_DEBUG */
log_sys->n_pending_archive_ios++; log_sys->n_pending_archive_ios++;
...@@ -2417,10 +2435,12 @@ log_archive_write_complete_groups(void) ...@@ -2417,10 +2435,12 @@ log_archive_write_complete_groups(void)
trunc_files = n_files - 1; trunc_files = n_files - 1;
} }
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes && trunc_files) { if (log_debug_writes && trunc_files) {
printf("Complete file(s) archived to group %lu\n", printf("Complete file(s) archived to group %lu\n",
(ulong) group->id); (ulong) group->id);
} }
#endif /* UNIV_LOG_DEBUG */
/* Calculate the archive file space start lsn */ /* Calculate the archive file space start lsn */
start_lsn = ut_dulint_subtract(log_sys->next_archived_lsn, start_lsn = ut_dulint_subtract(log_sys->next_archived_lsn,
...@@ -2443,9 +2463,11 @@ log_archive_write_complete_groups(void) ...@@ -2443,9 +2463,11 @@ log_archive_write_complete_groups(void)
fil_space_truncate_start(group->archive_space_id, fil_space_truncate_start(group->archive_space_id,
trunc_files * group->file_size); trunc_files * group->file_size);
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
printf("Archiving writes completed\n"); printf("Archiving writes completed\n");
} }
#endif /* UNIV_LOG_DEBUG */
} }
/********************************************************** /**********************************************************
...@@ -2464,9 +2486,11 @@ log_archive_check_completion_low(void) ...@@ -2464,9 +2486,11 @@ log_archive_check_completion_low(void)
if (log_sys->n_pending_archive_ios == 0 if (log_sys->n_pending_archive_ios == 0
&& log_sys->archiving_phase == LOG_ARCHIVE_READ) { && log_sys->archiving_phase == LOG_ARCHIVE_READ) {
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
printf("Archiving read completed\n"); printf("Archiving read completed\n");
} }
#endif /* UNIV_LOG_DEBUG */
/* Archive buffer has now been read in: start archive writes */ /* Archive buffer has now been read in: start archive writes */
...@@ -2729,12 +2753,14 @@ log_archive_close_groups( ...@@ -2729,12 +2753,14 @@ log_archive_close_groups(
group->archived_file_no += 2; group->archived_file_no += 2;
} }
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
printf( printf(
"Incrementing arch file no to %lu in log group %lu\n", "Incrementing arch file no to %lu in log group %lu\n",
(ulong) group->archived_file_no + 2, (ulong) group->archived_file_no + 2,
(ulong) group->id); (ulong) group->id);
} }
#endif /* UNIV_LOG_DEBUG */
} }
} }
...@@ -3204,6 +3230,7 @@ loop: ...@@ -3204,6 +3230,7 @@ loop:
ut_a(0 == ut_dulint_cmp(lsn, log_sys->lsn)); ut_a(0 == ut_dulint_cmp(lsn, log_sys->lsn));
} }
#ifdef UNIV_LOG_DEBUG
/********************************************************** /**********************************************************
Checks by parsing that the catenated log segment for a single mtr is Checks by parsing that the catenated log segment for a single mtr is
consistent. */ consistent. */
...@@ -3256,6 +3283,7 @@ log_check_log_recs( ...@@ -3256,6 +3283,7 @@ log_check_log_recs(
return(TRUE); return(TRUE);
} }
#endif /* UNIV_LOG_DEBUG */
/********************************************************** /**********************************************************
Peeks the current lsn. */ Peeks the current lsn. */
......
...@@ -487,6 +487,7 @@ recv_find_max_checkpoint( ...@@ -487,6 +487,7 @@ recv_find_max_checkpoint(
log_group_read_checkpoint_info(group, field); log_group_read_checkpoint_info(group, field);
if (!recv_check_cp_is_consistent(buf)) { if (!recv_check_cp_is_consistent(buf)) {
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Checkpoint in group %lu at %lu invalid, %lu\n", "InnoDB: Checkpoint in group %lu at %lu invalid, %lu\n",
...@@ -496,6 +497,7 @@ recv_find_max_checkpoint( ...@@ -496,6 +497,7 @@ recv_find_max_checkpoint(
+ LOG_CHECKPOINT_CHECKSUM_1)); + LOG_CHECKPOINT_CHECKSUM_1));
} }
#endif /* UNIV_LOG_DEBUG */
goto not_consistent; goto not_consistent;
} }
...@@ -509,12 +511,14 @@ recv_find_max_checkpoint( ...@@ -509,12 +511,14 @@ recv_find_max_checkpoint(
checkpoint_no = checkpoint_no =
mach_read_from_8(buf + LOG_CHECKPOINT_NO); mach_read_from_8(buf + LOG_CHECKPOINT_NO);
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Checkpoint number %lu found in group %lu\n", "InnoDB: Checkpoint number %lu found in group %lu\n",
(ulong) ut_dulint_get_low(checkpoint_no), (ulong) ut_dulint_get_low(checkpoint_no),
(ulong) group->id); (ulong) group->id);
} }
#endif /* UNIV_LOG_DEBUG */
if (ut_dulint_cmp(checkpoint_no, max_no) >= 0) { if (ut_dulint_cmp(checkpoint_no, max_no) >= 0) {
*max_group = group; *max_group = group;
...@@ -1147,6 +1151,7 @@ recv_recover_page( ...@@ -1147,6 +1151,7 @@ recv_recover_page(
start_lsn = recv->start_lsn; start_lsn = recv->start_lsn;
} }
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Applying log rec type %lu len %lu to space %lu page no %lu\n", "InnoDB: Applying log rec type %lu len %lu to space %lu page no %lu\n",
...@@ -1154,6 +1159,7 @@ recv_recover_page( ...@@ -1154,6 +1159,7 @@ recv_recover_page(
(ulong) recv_addr->space, (ulong) recv_addr->space,
(ulong) recv_addr->page_no); (ulong) recv_addr->page_no);
} }
#endif /* UNIV_LOG_DEBUG */
recv_parse_or_apply_log_rec_body(recv->type, buf, recv_parse_or_apply_log_rec_body(recv->type, buf,
buf + recv->len, page, &mtr); buf + recv->len, page, &mtr);
...@@ -1984,12 +1990,14 @@ loop: ...@@ -1984,12 +1990,14 @@ loop:
recv_sys->recovered_offset += len; recv_sys->recovered_offset += len;
recv_sys->recovered_lsn = new_recovered_lsn; recv_sys->recovered_lsn = new_recovered_lsn;
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Parsed a single log rec type %lu len %lu space %lu page no %lu\n", "InnoDB: Parsed a single log rec type %lu len %lu space %lu page no %lu\n",
(ulong) type, (ulong) len, (ulong) space, (ulong) type, (ulong) len, (ulong) space,
(ulong) page_no); (ulong) page_no);
} }
#endif /* UNIV_LOG_DEBUG */
if (type == MLOG_DUMMY_RECORD) { if (type == MLOG_DUMMY_RECORD) {
/* Do nothing */ /* Do nothing */
...@@ -2071,12 +2079,14 @@ loop: ...@@ -2071,12 +2079,14 @@ loop:
*/ */
} }
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Parsed a multi log rec type %lu len %lu space %lu page no %lu\n", "InnoDB: Parsed a multi log rec type %lu len %lu space %lu page no %lu\n",
(ulong) type, (ulong) len, (ulong) space, (ulong) type, (ulong) len, (ulong) space,
(ulong) page_no); (ulong) page_no);
} }
#endif /* UNIV_LOG_DEBUG */
total_len += len; total_len += len;
n_recs++; n_recs++;
...@@ -2482,6 +2492,7 @@ recv_group_scan_log_recs( ...@@ -2482,6 +2492,7 @@ recv_group_scan_log_recs(
start_lsn = end_lsn; start_lsn = end_lsn;
} }
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Scanned group %lu up to log sequence number %lu %lu\n", "InnoDB: Scanned group %lu up to log sequence number %lu %lu\n",
...@@ -2489,6 +2500,7 @@ recv_group_scan_log_recs( ...@@ -2489,6 +2500,7 @@ recv_group_scan_log_recs(
(ulong) ut_dulint_get_high(*group_scanned_lsn), (ulong) ut_dulint_get_high(*group_scanned_lsn),
(ulong) ut_dulint_get_low(*group_scanned_lsn)); (ulong) ut_dulint_get_low(*group_scanned_lsn));
} }
#endif /* UNIV_LOG_DEBUG */
} }
/************************************************************ /************************************************************
...@@ -2869,10 +2881,12 @@ recv_recovery_from_checkpoint_finish(void) ...@@ -2869,10 +2881,12 @@ recv_recovery_from_checkpoint_finish(void)
recv_apply_hashed_log_recs(TRUE); recv_apply_hashed_log_recs(TRUE);
} }
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Log records applied to the database\n"); "InnoDB: Log records applied to the database\n");
} }
#endif /* UNIV_LOG_DEBUG */
if (recv_needed_recovery) { if (recv_needed_recovery) {
trx_sys_print_mysql_master_log_pos(); trx_sys_print_mysql_master_log_pos();
...@@ -3184,6 +3198,7 @@ ask_again: ...@@ -3184,6 +3198,7 @@ ask_again:
break; break;
} }
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Archive read starting at lsn %lu %lu, len %lu from file %s\n", "InnoDB: Archive read starting at lsn %lu %lu, len %lu from file %s\n",
...@@ -3191,6 +3206,7 @@ ask_again: ...@@ -3191,6 +3206,7 @@ ask_again:
(ulong) ut_dulint_get_low(start_lsn), (ulong) ut_dulint_get_low(start_lsn),
(ulong) len, name); (ulong) len, name);
} }
#endif /* UNIV_LOG_DEBUG */
fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE, fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE,
group->archive_space_id, read_offset / UNIV_PAGE_SIZE, group->archive_space_id, read_offset / UNIV_PAGE_SIZE,
......
...@@ -16,11 +16,12 @@ Created 10/4/1994 Heikki Tuuri ...@@ -16,11 +16,12 @@ Created 10/4/1994 Heikki Tuuri
#include "log0recv.h" #include "log0recv.h"
#include "rem0cmp.h" #include "rem0cmp.h"
ulint page_cur_short_succ = 0; static ulint page_rnd = 976722341;
ulint page_rnd = 976722341;
#ifdef PAGE_CUR_ADAPT #ifdef PAGE_CUR_ADAPT
# ifdef UNIV_SEARCH_PERF_STAT
ulint page_cur_short_succ = 0;
# endif /* UNIV_SEARCH_PERF_STAT */
/******************************************************************** /********************************************************************
Tries a search shortcut based on the last insert. */ Tries a search shortcut based on the last insert. */
......
...@@ -1036,9 +1036,10 @@ que_thr_stop_for_mysql_no_error( ...@@ -1036,9 +1036,10 @@ que_thr_stop_for_mysql_no_error(
trx->n_active_thrs--; trx->n_active_thrs--;
} }
#ifdef UNIV_DEBUG
/************************************************************************** /**************************************************************************
Prints info of an SQL query graph node. */ Prints info of an SQL query graph node. */
static
void void
que_node_print_info( que_node_print_info(
/*================*/ /*================*/
...@@ -1095,6 +1096,7 @@ que_node_print_info( ...@@ -1095,6 +1096,7 @@ que_node_print_info(
fprintf(stderr, "Node type %lu: %s, address %p\n", (ulong) type, str, node); fprintf(stderr, "Node type %lu: %s, address %p\n", (ulong) type, str, node);
} }
#endif /* UNIV_DEBUG */
/************************************************************************** /**************************************************************************
Performs an execution step on a query thread. */ Performs an execution step on a query thread. */
......
...@@ -267,7 +267,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -267,7 +267,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
static void usage() static void usage()
{ {
printf("Use: ft_dump <table_name> <index_no>\n"); printf("Use: myisam_ftdump <table_name> <index_num>\n");
my_print_help(my_long_options); my_print_help(my_long_options);
my_print_variables(my_long_options); my_print_variables(my_long_options);
exit(1); exit(1);
......
...@@ -59,6 +59,12 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -59,6 +59,12 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings: Warnings:
Note 1003 select high_priority nullif((test.t1.u = 0),_latin1'test') AS `nullif(u=0, 'test')` from test.t1 Note 1003 select high_priority nullif((test.t1.u = 0),_latin1'test') AS `nullif(u=0, 'test')` from test.t1
drop table t1; drop table t1;
select NULLIF(NULL,NULL), NULLIF(NULL,1), NULLIF(NULL,1.0), NULLIF(NULL,"test");
NULLIF(NULL,NULL) NULLIF(NULL,1) NULLIF(NULL,1.0) NULLIF(NULL,"test")
NULL NULL NULL NULL
select NULLIF(1,NULL), NULLIF(1.0, NULL), NULLIF("test", NULL);
NULLIF(1,NULL) NULLIF(1.0, NULL) NULLIF("test", NULL)
1 1.0 test
create table t1 (num double(12,2)); create table t1 (num double(12,2));
insert into t1 values (144.54); insert into t1 values (144.54);
select sum(if(num is null,0.00,num)) from t1; select sum(if(num is null,0.00,num)) from t1;
......
...@@ -29,6 +29,12 @@ select nullif(u=0, 'test') from t1; ...@@ -29,6 +29,12 @@ select nullif(u=0, 'test') from t1;
explain extended select nullif(u=0, 'test') from t1; explain extended select nullif(u=0, 'test') from t1;
drop table t1; drop table t1;
#
# Bug 2629
#
select NULLIF(NULL,NULL), NULLIF(NULL,1), NULLIF(NULL,1.0), NULLIF(NULL,"test");
select NULLIF(1,NULL), NULLIF(1.0, NULL), NULLIF("test", NULL);
# #
# Problem with IF() # Problem with IF()
# #
......
...@@ -977,7 +977,7 @@ double ...@@ -977,7 +977,7 @@ double
Item_func_nullif::val() Item_func_nullif::val()
{ {
double value; double value;
if (!cmp.compare() || null_value) if (!cmp.compare())
{ {
null_value=1; null_value=1;
return 0.0; return 0.0;
...@@ -991,7 +991,7 @@ longlong ...@@ -991,7 +991,7 @@ longlong
Item_func_nullif::val_int() Item_func_nullif::val_int()
{ {
longlong value; longlong value;
if (!cmp.compare() || null_value) if (!cmp.compare())
{ {
null_value=1; null_value=1;
return 0; return 0;
...@@ -1005,7 +1005,7 @@ String * ...@@ -1005,7 +1005,7 @@ String *
Item_func_nullif::val_str(String *str) Item_func_nullif::val_str(String *str)
{ {
String *res; String *res;
if (!cmp.compare() || null_value) if (!cmp.compare())
{ {
null_value=1; null_value=1;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment