=== modified file 'Percona-Server/storage/innodb_plugin/handler/i_s.cc'
--- Percona-Server/storage/innodb_plugin/handler/i_s.cc	2012-11-25 09:29:43 +0000
+++ Percona-Server/storage/innodb_plugin/handler/i_s.cc	2013-01-04 15:33:29 +0000
@@ -3932,10 +3932,10 @@
 				       LOG_BITMAP_ITERATOR_PAGE_NUM(i));
 		/* START_LSN */
 		table->field[2]->store(
-				       LOG_BITMAP_ITERATOR_START_LSN(i));
+				       LOG_BITMAP_ITERATOR_START_LSN(i), true);
 		/* END_LSN */
 		table->field[3]->store(
-				       LOG_BITMAP_ITERATOR_END_LSN(i));
+				       LOG_BITMAP_ITERATOR_END_LSN(i), true);
 
 		/*
 		  I_S tables are in-memory tables. If bitmap file is big enough

=== modified file 'Percona-Server/storage/innodb_plugin/include/ut0ut.h'
--- Percona-Server/storage/innodb_plugin/include/ut0ut.h	2009-09-15 10:26:01 +0000
+++ Percona-Server/storage/innodb_plugin/include/ut0ut.h	2013-01-04 15:33:29 +0000
@@ -120,6 +120,15 @@
 /*===*/
 	ulint	 n1,	/*!< in: first number */
 	ulint	 n2);	/*!< in: second number */
+/******************************************************//**
+Calculates the maximum of two ib_uint64_t values.
+@return	the maximum */
+UNIV_INLINE
+ib_uint64_t
+ut_max_uint64(
+/*==========*/
+	ib_uint64_t	n1,	/*!< in: first number */
+	ib_uint64_t	n2);	/*!< in: second number */
 /****************************************************************//**
 Calculates minimum of two ulint-pairs. */
 UNIV_INLINE

=== modified file 'Percona-Server/storage/innodb_plugin/include/ut0ut.ic'
--- Percona-Server/storage/innodb_plugin/include/ut0ut.ic	2009-05-25 09:52:29 +0000
+++ Percona-Server/storage/innodb_plugin/include/ut0ut.ic	2013-01-04 15:33:29 +0000
@@ -49,6 +49,19 @@
 	return((n1 <= n2) ? n2 : n1);
 }
 
+/******************************************************//**
+Calculates the maximum of two ib_uint64_t values.
+@return	the maximum */
+UNIV_INLINE
+ib_uint64_t
+ut_max_uint64(
+/*==========*/
+	ib_uint64_t	n1,	/*!< in: first number */
+	ib_uint64_t	n2)	/*!< in: second number */
+{
+	return((n1 <= n2) ? n2 : n1);
+}
+
 /****************************************************************//**
 Calculates minimum of two ulint-pairs. */
 UNIV_INLINE

=== modified file 'Percona-Server/storage/innodb_plugin/log/log0log.c'
--- Percona-Server/storage/innodb_plugin/log/log0log.c	2012-06-14 09:16:03 +0000
+++ Percona-Server/storage/innodb_plugin/log/log0log.c	2013-01-04 15:33:29 +0000
@@ -233,7 +233,7 @@
 				checked for the already-written log. */
 {
 	ib_uint64_t	tracked_lsn;
-	ulint		tracked_lsn_age;
+	ib_uint64_t	tracked_lsn_age;
 
 	if (!srv_track_changed_pages) {
 		return FALSE;
@@ -445,7 +445,7 @@
 	ib_uint64_t	oldest_lsn;
 	ib_uint64_t	lsn;
 	ib_uint64_t	tracked_lsn;
-	ulint		tracked_lsn_age;
+	ib_uint64_t	tracked_lsn_age;
 	log_t*		log	= log_sys;
 	ib_uint64_t	checkpoint_age;
 

=== modified file 'Percona-Server/storage/innodb_plugin/log/log0online.c'
--- Percona-Server/storage/innodb_plugin/log/log0online.c	2012-11-25 09:29:43 +0000
+++ Percona-Server/storage/innodb_plugin/log/log0online.c	2013-01-04 15:33:29 +0000
@@ -401,7 +401,7 @@
 {
 	/* last_tracked_lsn might be < MIN_TRACKED_LSN in the case of empty
 	bitmap file, handle this too. */
-	last_tracked_lsn = ut_max(last_tracked_lsn, MIN_TRACKED_LSN);
+	last_tracked_lsn = ut_max_uint64(last_tracked_lsn, MIN_TRACKED_LSN);
 
 	if (last_tracked_lsn > tracking_start_lsn) {
 		fprintf(stderr,
@@ -431,10 +431,10 @@
 {
 	ut_ad(last_tracked_lsn != tracking_start_lsn);
 
-	fprintf(stderr, "InnoDB: last tracked LSN is %llu, but the last "
-		"checkpoint LSN is %llu.  This might be due to a server "
-		"crash or a very fast shutdown.  ", last_tracked_lsn,
-		tracking_start_lsn);
+	fprintf(stderr, "InnoDB: last tracked LSN in \'%s\' is %llu, but the "
+		"last checkpoint LSN is %llu.  This might be due to a server "
+		"crash or a very fast shutdown.  ", log_bmp_sys->out.name,
+		last_tracked_lsn, tracking_start_lsn);
 
 	/* See if we can fully recover the missing interval */
 	if (log_online_can_track_missing(last_tracked_lsn,
@@ -443,8 +443,8 @@
 		fprintf(stderr,
 			"Reading the log to advance the last tracked LSN.\n");
 
-		log_bmp_sys->start_lsn = ut_max(last_tracked_lsn,
-						MIN_TRACKED_LSN);
+		log_bmp_sys->start_lsn = ut_max_uint64(last_tracked_lsn,
+						       MIN_TRACKED_LSN);
 		log_set_tracked_lsn(log_bmp_sys->start_lsn);
 		log_online_follow_redo_log();
 		ut_ad(log_bmp_sys->end_lsn >= tracking_start_lsn);
@@ -560,7 +560,7 @@
 {
 	ibool		success;
 	ib_uint64_t	tracking_start_lsn
-		= ut_max(log_sys->last_checkpoint_lsn, MIN_TRACKED_LSN);
+		= ut_max_uint64(log_sys->last_checkpoint_lsn, MIN_TRACKED_LSN);
 	os_file_dir_t	bitmap_dir;
 	os_file_stat_t	bitmap_dir_file_info;
 	ib_uint64_t	last_file_start_lsn	= MIN_TRACKED_LSN;
@@ -931,8 +931,8 @@
 			/* The next parse LSN is inside the current block, skip
 			data preceding it. */
 			skip_already_parsed_len
-				= log_bmp_sys->next_parse_lsn
-				- block_start_lsn;
+				= (ulint)(log_bmp_sys->next_parse_lsn
+					  - block_start_lsn);
 		}
 		else {
 

=== modified file 'Percona-Server/storage/innodb_plugin/os/os0file.c'
--- Percona-Server/storage/innodb_plugin/os/os0file.c	2012-06-14 09:16:03 +0000
+++ Percona-Server/storage/innodb_plugin/os/os0file.c	2013-01-04 15:33:29 +0000
@@ -1949,8 +1949,10 @@
 	ib_uint64_t	new_len)/*!< in: new file length */
 {
 #ifdef __WIN__
-	/* TODO: untested! */
-	return(!_chsize_s(file, new_len));
+	LARGE_INTEGER li, li2;
+	li.QuadPart = new_len;
+	return(SetFilePointerEx(file, li, &li2,FILE_BEGIN)
+	       && SetEndOfFile(file));
 #else
 	/* TODO: works only with -D_FILE_OFFSET_BITS=64 ? */
 	return(!ftruncate(file, new_len));

