Commit 01336db3 authored by unknown's avatar unknown

Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-maria

into  mysqlwin32.:C:/mysql-maria

parents 0a0c6041 d783c011
...@@ -2798,6 +2798,7 @@ restart: ...@@ -2798,6 +2798,7 @@ restart:
cmp_translog_addr(addr, in_buffers) >= 0) cmp_translog_addr(addr, in_buffers) >= 0)
{ {
translog_lock(); translog_lock();
DBUG_ASSERT(cmp_translog_addr(addr, log_descriptor.horizon) < 0);
/* recheck with locked loghandler */ /* recheck with locked loghandler */
in_buffers= translog_only_in_buffers(); in_buffers= translog_only_in_buffers();
if (cmp_translog_addr(addr, in_buffers) >= 0) if (cmp_translog_addr(addr, in_buffers) >= 0)
...@@ -2975,7 +2976,7 @@ static my_bool translog_get_last_page_addr(TRANSLOG_ADDRESS *addr, ...@@ -2975,7 +2976,7 @@ static my_bool translog_get_last_page_addr(TRANSLOG_ADDRESS *addr,
{ {
MY_STAT stat_buff, *local_stat; MY_STAT stat_buff, *local_stat;
char path[FN_REFLEN]; char path[FN_REFLEN];
uint32 rec_offset; uint32 rec_offset, file_size;
uint32 file_no= LSN_FILE_NO(*addr); uint32 file_no= LSN_FILE_NO(*addr);
DBUG_ENTER("translog_get_last_page_addr"); DBUG_ENTER("translog_get_last_page_addr");
...@@ -2984,11 +2985,12 @@ static my_bool translog_get_last_page_addr(TRANSLOG_ADDRESS *addr, ...@@ -2984,11 +2985,12 @@ static my_bool translog_get_last_page_addr(TRANSLOG_ADDRESS *addr,
(no_errors ? MYF(0) : MYF(MY_WME))))) (no_errors ? MYF(0) : MYF(MY_WME)))))
DBUG_RETURN(1); DBUG_RETURN(1);
DBUG_PRINT("info", ("File size: %lu", (ulong) local_stat->st_size)); DBUG_PRINT("info", ("File size: %lu", (ulong) local_stat->st_size));
if (local_stat->st_size > TRANSLOG_PAGE_SIZE) file_size= (uint32)local_stat->st_size; /* st_size can be 'long' on Windows*/
if (file_size > TRANSLOG_PAGE_SIZE)
{ {
rec_offset= (((local_stat->st_size / TRANSLOG_PAGE_SIZE) - 1) * rec_offset= (((file_size / TRANSLOG_PAGE_SIZE) - 1) *
TRANSLOG_PAGE_SIZE); TRANSLOG_PAGE_SIZE);
*last_page_ok= (local_stat->st_size == rec_offset + TRANSLOG_PAGE_SIZE); *last_page_ok= (file_size == rec_offset + TRANSLOG_PAGE_SIZE);
} }
else else
{ {
......
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
#define _ma_loghandler_h #define _ma_loghandler_h
/* transaction log default cache size (TODO: make it global variable) */ /* transaction log default cache size (TODO: make it global variable) */
#define TRANSLOG_PAGECACHE_SIZE (1024*1024*2) #define TRANSLOG_PAGECACHE_SIZE (1024U*1024*2)
/* transaction log default file size */ /* transaction log default file size */
#define TRANSLOG_FILE_SIZE (1024*1024*1024) #define TRANSLOG_FILE_SIZE (1024U*1024*1024)
/* minimum possible transaction log size */ /* minimum possible transaction log size */
#define TRANSLOG_MIN_FILE_SIZE (1024*1024*8) #define TRANSLOG_MIN_FILE_SIZE (1024U*1024*8)
/* transaction log default flags (TODO: make it global variable) */ /* transaction log default flags (TODO: make it global variable) */
#define TRANSLOG_DEFAULT_FLAGS 0 #define TRANSLOG_DEFAULT_FLAGS 0
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
It should be Power of 2 and multiple of DISK_DRIVE_SECTOR_SIZE It should be Power of 2 and multiple of DISK_DRIVE_SECTOR_SIZE
(DISK_DRIVE_SECTOR_SIZE * 2^N) (DISK_DRIVE_SECTOR_SIZE * 2^N)
*/ */
#define TRANSLOG_PAGE_SIZE (8*1024) #define TRANSLOG_PAGE_SIZE (8U*1024)
#include "ma_loghandler_lsn.h" #include "ma_loghandler_lsn.h"
#include "trnman_public.h" #include "trnman_public.h"
...@@ -92,7 +92,7 @@ struct st_maria_handler; ...@@ -92,7 +92,7 @@ struct st_maria_handler;
Length of disk drive sector size (we assume that writing it Length of disk drive sector size (we assume that writing it
to disk is an atomic operation) to disk is an atomic operation)
*/ */
#define DISK_DRIVE_SECTOR_SIZE 512 #define DISK_DRIVE_SECTOR_SIZE 512U
/* position reserved in an array of parts of a log record */ /* position reserved in an array of parts of a log record */
#define TRANSLOG_INTERNAL_PARTS 2 #define TRANSLOG_INTERNAL_PARTS 2
...@@ -166,7 +166,7 @@ enum en_key_op ...@@ -166,7 +166,7 @@ enum en_key_op
/* Size of log file; One log file is restricted to 4G */ /* Size of log file; One log file is restricted to 4G */
typedef uint32 translog_size_t; typedef uint32 translog_size_t;
#define TRANSLOG_RECORD_HEADER_MAX_SIZE 1024 #define TRANSLOG_RECORD_HEADER_MAX_SIZE 1024U
typedef struct st_translog_group_descriptor typedef struct st_translog_group_descriptor
{ {
......
...@@ -20,78 +20,76 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib ...@@ -20,78 +20,76 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib
${CMAKE_SOURCE_DIR}/unittest/mytap) ${CMAKE_SOURCE_DIR}/unittest/mytap)
LINK_LIBRARIES(maria myisam mytap mysys dbug strings wsock32 zlib) LINK_LIBRARIES(maria myisam mytap mysys dbug strings wsock32 zlib)
ADD_EXECUTABLE(ma_test_loghandler_t ADD_EXECUTABLE(ma_control_file-t ma_control_file-t.c)
ADD_EXECUTABLE(trnman-t trnman-t.c)
ADD_EXECUTABLE(lockman2-t lockman2-t.c)
ADD_EXECUTABLE(ma_test_loghandler-t
ma_test_loghandler-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c) ma_test_loghandler-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
ADD_EXECUTABLE(ma_test_loghandler_multigroup_t ADD_EXECUTABLE(ma_test_loghandler_multigroup-t
ma_test_loghandler_multigroup-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c) ma_test_loghandler_multigroup-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
ADD_EXECUTABLE(ma_test_loghandler_multithread_t ADD_EXECUTABLE(ma_test_loghandler_multithread-t
ma_test_loghandler_multithread-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c) ma_test_loghandler_multithread-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
ADD_EXECUTABLE(ma_test_loghandler_pagecache_t ADD_EXECUTABLE(ma_test_loghandler_pagecache-t
ma_test_loghandler_pagecache-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c) ma_test_loghandler_pagecache-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
ADD_EXECUTABLE(ma_test_loghandler_long_t_big ADD_EXECUTABLE(ma_test_loghandler_long-t
ma_test_loghandler-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c) ma_test_loghandler-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
SET_TARGET_PROPERTIES(ma_test_loghandler_long_t_big PROPERTIES COMPILE_FLAGS "-DLONG_LOG_TEST") SET_TARGET_PROPERTIES(ma_test_loghandler_long-t PROPERTIES COMPILE_FLAGS "-DLONG_LOG_TEST")
ADD_EXECUTABLE(ma_test_loghandler_noflush_t ADD_EXECUTABLE(ma_test_loghandler_noflush-t
ma_test_loghandler_noflush-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c) ma_test_loghandler_noflush-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
ADD_EXECUTABLE(ma_test_loghandler_first_lsn_t ADD_EXECUTABLE(ma_test_loghandler_first_lsn-t
ma_test_loghandler_first_lsn-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c) ma_test_loghandler_first_lsn-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
ADD_EXECUTABLE(ma_test_loghandler_max_lsn_t ADD_EXECUTABLE(ma_test_loghandler_max_lsn-t
ma_test_loghandler_max_lsn-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c) ma_test_loghandler_max_lsn-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
ADD_EXECUTABLE(ma_test_loghandler_purge_t ADD_EXECUTABLE(ma_test_loghandler_purge-t
ma_test_loghandler_purge-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c) ma_test_loghandler_purge-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
ADD_EXECUTABLE(ma_test_loghandler_readonly_t ADD_EXECUTABLE(ma_test_loghandler_readonly-t
ma_test_loghandler_multigroup-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c) ma_test_loghandler_multigroup-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
SET_TARGET_PROPERTIES(ma_test_loghandler_readonly_t PROPERTIES COMPILE_FLAGS "-DREADONLY_TEST") SET_TARGET_PROPERTIES(ma_test_loghandler_readonly-t PROPERTIES COMPILE_FLAGS "-DREADONLY_TEST")
ADD_EXECUTABLE(ma_test_loghandler_nologs-t
ma_test_loghandler_nologs-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
SET(ma_pagecache_single_src ma_pagecache_single.c test_file.c test_file.h) SET(ma_pagecache_single_src ma_pagecache_single.c test_file.c test_file.h)
SET(ma_pagecache_consist_src ma_pagecache_consist.c test_file.c test_file.h) SET(ma_pagecache_consist_src ma_pagecache_consist.c test_file.c test_file.h)
SET(ma_pagecache_common_cppflags "-DEXTRA_DEBUG -DPAGECACHE_DEBUG -DMAIN") SET(ma_pagecache_common_cppflags "-DEXTRA_DEBUG -DPAGECACHE_DEBUG -DMAIN")
ADD_EXECUTABLE(ma_pagecache_single_1k_t ${ma_pagecache_single_src}) ADD_EXECUTABLE(ma_pagecache_single_1k-t ${ma_pagecache_single_src})
SET_TARGET_PROPERTIES(ma_pagecache_single_1k_t SET_TARGET_PROPERTIES(ma_pagecache_single_1k-t
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DPAGE_SIZE=1024") PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DPAGE_SIZE=1024")
ADD_EXECUTABLE(ma_pagecache_single_8k_t ${ma_pagecache_single_src}) ADD_EXECUTABLE(ma_pagecache_single_8k-t ${ma_pagecache_single_src})
SET_TARGET_PROPERTIES(ma_pagecache_single_8k_t SET_TARGET_PROPERTIES(ma_pagecache_single_8k-t
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DPAGE_SIZE=8192") PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DPAGE_SIZE=8192")
ADD_EXECUTABLE(ma_pagecache_single_64k_t_big ${ma_pagecache_single_src}) ADD_EXECUTABLE(ma_pagecache_single_64k-t ${ma_pagecache_single_src})
SET_TARGET_PROPERTIES(ma_pagecache_single_64k_t_big SET_TARGET_PROPERTIES(ma_pagecache_single_64k-t
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DPAGE_SIZE=65536") PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DPAGE_SIZE=65536")
ADD_EXECUTABLE(ma_pagecache_consist_1k_t ${ma_pagecache_consist_src}) ADD_EXECUTABLE(ma_pagecache_consist_1k-t ${ma_pagecache_consist_src})
SET_TARGET_PROPERTIES(ma_pagecache_consist_1k_t SET_TARGET_PROPERTIES(ma_pagecache_consist_1k-t
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DPAGE_SIZE=1024") PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DPAGE_SIZE=1024")
ADD_EXECUTABLE(ma_pagecache_consist_64k_t_big ${ma_pagecache_consist_src}) ADD_EXECUTABLE(ma_pagecache_consist_64k-t ${ma_pagecache_consist_src})
SET_TARGET_PROPERTIES(ma_pagecache_consist_64k_t_big SET_TARGET_PROPERTIES(ma_pagecache_consist_64k-t
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DPAGE_SIZE=65536") PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DPAGE_SIZE=65536")
ADD_EXECUTABLE(ma_pagecache_consist_1kHC_t ADD_EXECUTABLE(ma_pagecache_consist_1kHC-t
${ma_pagecache_consist_src}) ${ma_pagecache_consist_src})
SET_TARGET_PROPERTIES(ma_pagecache_consist_1kHC_t SET_TARGET_PROPERTIES(ma_pagecache_consist_1kHC-t
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DPAGE_SIZE=1024 -DTEST_HIGH_CONCURENCY") PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DPAGE_SIZE=1024 -DTEST_HIGH_CONCURENCY")
ADD_EXECUTABLE(ma_pagecache_consist_64kHC_t_big ADD_EXECUTABLE(ma_pagecache_consist_64kHC-t
${ma_pagecache_consist_src}) ${ma_pagecache_consist_src})
SET_TARGET_PROPERTIES(ma_pagecache_consist_64kHC_t_big SET_TARGET_PROPERTIES(ma_pagecache_consist_64kHC-t
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DPAGE_SIZE=65536 -DTEST_HIGH_CONCURENCY") PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DPAGE_SIZE=65536 -DTEST_HIGH_CONCURENCY")
ADD_EXECUTABLE(ma_pagecache_consist_1kRD_t ${ma_pagecache_consist_src}) ADD_EXECUTABLE(ma_pagecache_consist_1kRD-t ${ma_pagecache_consist_src})
SET_TARGET_PROPERTIES(ma_pagecache_consist_1kRD_t SET_TARGET_PROPERTIES(ma_pagecache_consist_1kRD-t
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DPAGE_SIZE=1024 -DTEST_READERS") PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DPAGE_SIZE=1024 -DTEST_READERS")
ADD_EXECUTABLE(ma_pagecache_consist_64kRD_t_big ${ma_pagecache_consist_src}) ADD_EXECUTABLE(ma_pagecache_consist_64kRD-t ${ma_pagecache_consist_src})
SET_TARGET_PROPERTIES(ma_pagecache_consist_64kRD_t_big SET_TARGET_PROPERTIES(ma_pagecache_consist_64kRD-t
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DPAGE_SIZE=65536 -DTEST_READERS") PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DPAGE_SIZE=65536 -DTEST_READERS")
ADD_EXECUTABLE(ma_pagecache_consist_1kWR_t ${ma_pagecache_consist_src}) ADD_EXECUTABLE(ma_pagecache_consist_1kWR-t ${ma_pagecache_consist_src})
SET_TARGET_PROPERTIES(ma_pagecache_consist_1kWR_t SET_TARGET_PROPERTIES(ma_pagecache_consist_1kWR-t
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DPAGE_SIZE=1024 -DTEST_WRITERS") PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DPAGE_SIZE=1024 -DTEST_WRITERS")
ADD_EXECUTABLE(ma_pagecache_consist_64kWR_t_big ${ma_pagecache_consist_src}) ADD_EXECUTABLE(ma_pagecache_consist_64kWR-t ${ma_pagecache_consist_src})
SET_TARGET_PROPERTIES(ma_pagecache_consist_64kWR_t_big SET_TARGET_PROPERTIES(ma_pagecache_consist_64kWR-t
PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DPAGE_SIZE=65536 -DTEST_WRITERS") PROPERTIES COMPILE_FLAGS "${ma_pagecache_common_cppflags} -DPAGE_SIZE=65536 -DTEST_WRITERS")
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