List:Internals« Previous MessageNext Message »
From:Marko Mäkelä Date:June 20 2005 8:06am
Subject:bk commit into 5.0 tree (marko:1.1880)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of marko. When marko does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1880 05/06/20 11:06:20 marko@stripped +8 -0
  InnoDB: Remove warnings detected by GCC 4.0.0

  innobase/row/row0sel.c
    1.92 05/06/20 11:06:12 marko@stripped +3 -4
    Remove warning about possibly uninitialized variable.
    (Always initialize *out_rec.)

  innobase/mtr/mtr0log.c
    1.12 05/06/20 11:06:12 marko@stripped +9 -8
    mlog_write_string(), mlog_catenate_string(): Add const to str
    mlog_write_string(): Add UNIV_UNLIKELY hints to assertion-like tests

  innobase/log/log0recv.c
    1.49 05/06/20 11:06:12 marko@stripped +6 -6
    Remove warnings about uninitialized variables.
    Add UNIV_UNLIKELY() hints.

  innobase/log/log0log.c
    1.44 05/06/20 11:06:12 marko@stripped +6 -15
    Eliminate variables new_oldest and do_preflush in order to avoid
    warnings about possibly uninitialized variables.
    (new_oldest will now be declared in the scope of usage,
    and do_preflush == (advance != 0).)

  innobase/include/mtr0log.h
    1.8 05/06/20 11:06:11 marko@stripped +7 -7
    mlog_write_string(), mlog_catenate_string(): Add const to str

  innobase/include/dyn0dyn.ic
    1.6 05/06/20 11:06:11 marko@stripped +2 -5
    dyn_push_string(): Add const qualifier to str;
    remove intermediate assignment.

  innobase/include/dyn0dyn.h
    1.8 05/06/20 11:06:11 marko@stripped +1 -1
    Add const qualifier to dyn_push_string().

  innobase/fsp/fsp0fsp.c
    1.26 05/06/20 11:06:11 marko@stripped +3 -1
    Declare "first" in the scope where it is used, and add dummy return
    statement after ut_error to silence compiler warning.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	marko
# Host:	hundin.mysql.fi
# Root:	/home/marko/mysql-5.0

--- 1.25/innobase/fsp/fsp0fsp.c	Thu Dec  2 19:42:30 2004
+++ 1.26/innobase/fsp/fsp0fsp.c	Mon Jun 20 11:06:11 2005
@@ -2325,7 +2325,6 @@
 	dulint		seg_id;
 	ulint		used;
 	ulint		reserved;
-	fil_addr_t	first;
 	xdes_t*		descr;		/* extent of the hinted page */
 	ulint		ret_page;	/* the allocated page offset, FIL_NULL
 					if could not be allocated */
@@ -2428,6 +2427,8 @@
 	} else if (reserved - used > 0) {
 		/* 5. We take any unused page from the segment
 		==============================================*/
+		fil_addr_t	first;
+
 		if (flst_get_len(seg_inode + FSEG_NOT_FULL, mtr) > 0) {
 			first = flst_get_first(seg_inode + FSEG_NOT_FULL,
 									mtr);
@@ -2435,6 +2436,7 @@
 			first = flst_get_first(seg_inode + FSEG_FREE, mtr);
 		} else {
 			ut_error;
+			return(FIL_NULL);
 		}
 
 		ret_descr = xdes_lst_get_descriptor(space, first, mtr);

--- 1.7/innobase/include/dyn0dyn.h	Mon Aug  2 13:02:02 2004
+++ 1.8/innobase/include/dyn0dyn.h	Mon Jun 20 11:06:11 2005
@@ -132,7 +132,7 @@
 dyn_push_string(
 /*============*/
 	dyn_array_t*	arr,	/* in: dyn array */
-	byte*		str,	/* in: string to write */
+	const byte*	str,	/* in: string to write */
 	ulint		len);	/* in: string length */
 
 /*#################################################################*/

--- 1.5/innobase/include/dyn0dyn.ic	Tue Oct  7 17:19:30 2003
+++ 1.6/innobase/include/dyn0dyn.ic	Mon Jun 20 11:06:11 2005
@@ -324,10 +324,9 @@
 dyn_push_string(
 /*============*/
 	dyn_array_t*	arr,	/* in: dyn array */
-	byte*		str,	/* in: string to write */
+	const byte*	str,	/* in: string to write */
 	ulint		len)	/* in: string length */
 {
-	byte*	ptr;
 	ulint	n_copied;
 
 	while (len > 0) {
@@ -337,9 +336,7 @@
 			n_copied = len;
 		}			
 
-		ptr = (byte*) dyn_array_push(arr, n_copied);
-
-		ut_memcpy(ptr, str, n_copied);
+		memcpy(dyn_array_push(arr, n_copied), str, n_copied);
 		
 		str += n_copied;
 		len -= n_copied;

--- 1.7/innobase/include/mtr0log.h	Thu Dec  2 19:42:31 2004
+++ 1.8/innobase/include/mtr0log.h	Mon Jun 20 11:06:11 2005
@@ -41,10 +41,10 @@
 void
 mlog_write_string(
 /*==============*/
-	byte*	ptr,	/* in: pointer where to write */
-	byte*	str,	/* in: string to write */
-	ulint	len,	/* in: string length */
-	mtr_t*	mtr);	/* in: mini-transaction handle */
+	byte*		ptr,	/* in: pointer where to write */
+	const byte*	str,	/* in: string to write */
+	ulint		len,	/* in: string length */
+	mtr_t*		mtr);	/* in: mini-transaction handle */
 /************************************************************
 Writes initial part of a log record consisting of one-byte item
 type and four-byte space and page numbers. */
@@ -85,9 +85,9 @@
 void
 mlog_catenate_string(
 /*=================*/
-	mtr_t*	mtr,	/* in: mtr */
-	byte*	str,	/* in: string to write */
-	ulint	len);	/* in: string length */
+	mtr_t*		mtr,	/* in: mtr */
+	const byte*	str,	/* in: string to write */
+	ulint		len);	/* in: string length */
 /************************************************************
 Catenates a compressed ulint to mlog. */
 UNIV_INLINE

--- 1.43/innobase/log/log0log.c	Wed Jun 15 12:50:18 2005
+++ 1.44/innobase/log/log0log.c	Mon Jun 20 11:06:12 2005
@@ -2038,8 +2038,6 @@
 	ulint	checkpoint_age;
 	ulint	advance;
 	dulint	oldest_lsn;
-	dulint	new_oldest;
-	ibool	do_preflush;
 	ibool	sync;
 	ibool	checkpoint_sync;
 	ibool	do_checkpoint;
@@ -2047,7 +2045,6 @@
 loop:
 	sync = FALSE;
 	checkpoint_sync = FALSE;
-	do_preflush = FALSE;
 	do_checkpoint = FALSE;
 
 	mutex_enter(&(log->mutex));
@@ -2067,21 +2064,13 @@
 		/* A flush is urgent: we have to do a synchronous preflush */
 
 		sync = TRUE;
-	
-		advance = 2 * (age - log->max_modified_age_sync);
-
-		new_oldest = ut_dulint_add(oldest_lsn, advance);
-
-		do_preflush = TRUE;
-
+		advance = 2 * (age - log->max_modified_age_async);
 	} else if (age > log->max_modified_age_async) {
 
 		/* A flush is not urgent: we do an asynchronous preflush */
 		advance = age - log->max_modified_age_async;
-
-		new_oldest = ut_dulint_add(oldest_lsn, advance);
-
-		do_preflush = TRUE;
+	} else {
+		advance = 0;
 	}
 
 	checkpoint_age = ut_dulint_minus(log->lsn, log->last_checkpoint_lsn);
@@ -2105,7 +2094,9 @@
 	
 	mutex_exit(&(log->mutex));
 
-	if (do_preflush) {
+	if (advance) {
+		dulint	new_oldest = ut_dulint_add(oldest_lsn, advance);
+
 		success = log_preflush_pool_modified_pages(new_oldest, sync);
 
 		/* If the flush succeeded, this thread has done its part

--- 1.48/innobase/log/log0recv.c	Wed Jun 15 12:50:19 2005
+++ 1.49/innobase/log/log0recv.c	Mon Jun 20 11:06:12 2005
@@ -543,7 +543,7 @@
 "InnoDB: to create the InnoDB data files, but log file creation failed.\n"
 "InnoDB: If that is the case, please refer to\n"
 "InnoDB: http://dev.mysql.com/doc/mysql/en/Error_creating_InnoDB.html\n");
-
+		*max_field = 0;
 		return(DB_ERROR);
 	}
 
@@ -1818,25 +1818,25 @@
 
 	new_ptr = mlog_parse_initial_log_record(ptr, end_ptr, type, space,
 								page_no);
-	if (!new_ptr) {
+	*body = new_ptr;
+
+	if (UNIV_UNLIKELY(!new_ptr)) {
 
 	        return(0);
 	}
 
 	/* Check that page_no is sensible */
 
-	if (*page_no > 0x8FFFFFFFUL) {
+	if (UNIV_UNLIKELY(*page_no > 0x8FFFFFFFUL)) {
 
 		recv_sys->found_corrupt_log = TRUE;
 
 		return(0);
 	}
 
-	*body = new_ptr;
-
 	new_ptr = recv_parse_or_apply_log_rec_body(*type, new_ptr, end_ptr,
 								NULL, NULL);
-	if (new_ptr == NULL) {
+	if (UNIV_UNLIKELY(new_ptr == NULL)) {
 
 		return(0);
 	}

--- 1.11/innobase/mtr/mtr0log.c	Mon Apr 25 10:14:26 2005
+++ 1.12/innobase/mtr/mtr0log.c	Mon Jun 20 11:06:12 2005
@@ -23,9 +23,9 @@
 void
 mlog_catenate_string(
 /*=================*/
-	mtr_t*	mtr,	/* in: mtr */
-	byte*	str,	/* in: string to write */
-	ulint	len)	/* in: string length */
+	mtr_t*		mtr,	/* in: mtr */
+	const byte*	str,	/* in: string to write */
+	ulint		len)	/* in: string length */
 {
 	dyn_array_t*	mlog;
 
@@ -302,14 +302,15 @@
 void
 mlog_write_string(
 /*==============*/
-	byte*	ptr,	/* in: pointer where to write */
-	byte*	str,	/* in: string to write */
-	ulint	len,	/* in: string length */
-	mtr_t*	mtr)	/* in: mini-transaction handle */
+	byte*		ptr,	/* in: pointer where to write */
+	const byte*	str,	/* in: string to write */
+	ulint		len,	/* in: string length */
+	mtr_t*		mtr)	/* in: mini-transaction handle */
 {
 	byte*	log_ptr;
 
-	if (ptr < buf_pool->frame_zero || ptr >= buf_pool->high_end) {
+	if (UNIV_UNLIKELY(ptr < buf_pool->frame_zero)
+	    || UNIV_UNLIKELY(ptr >= buf_pool->high_end)) {
 		fprintf(stderr,
 	"InnoDB: Error: trying to write to a stray memory location %p\n", ptr);
 		ut_error;

--- 1.91/innobase/row/row0sel.c	Wed Apr 27 12:28:35 2005
+++ 1.92/innobase/row/row0sel.c	Mon Jun 20 11:06:12 2005
@@ -630,6 +630,8 @@
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
+	*out_rec = NULL;
+
 	offsets = rec_get_offsets(rec,
 				btr_pcur_get_btr_cur(&plan->pcur)->index,
 				offsets, ULINT_UNDEFINED, &heap);
@@ -663,8 +665,6 @@
 		clustered index record did not exist in the read view of
 		trx. */
 
-		clust_rec = NULL;
-
 		goto func_exit;
 	}
 
@@ -733,7 +733,6 @@
 		if ((old_vers || rec_get_deleted_flag(rec, plan->table->comp))
 		    && !row_sel_sec_rec_is_for_clust_rec(rec, plan->index,
 							clust_rec, index)) {
-			clust_rec = NULL;
 			goto func_exit;
 		}
 	}
@@ -742,8 +741,8 @@
 
 	row_sel_fetch_columns(index, clust_rec, offsets,
 					UT_LIST_GET_FIRST(plan->columns));
-func_exit:
 	*out_rec = clust_rec;
+func_exit:
 	err = DB_SUCCESS;
 err_exit:
 	if (UNIV_LIKELY_NULL(heap)) {
Thread
bk commit into 5.0 tree (marko:1.1880)Marko Mäkelä20 Jun