Commit 1bc6ae89 authored by serg@serg.mylan's avatar serg@serg.mylan

portability fixes

parent 69043988
...@@ -310,9 +310,6 @@ inline double ulonglong2double(ulonglong value) ...@@ -310,9 +310,6 @@ inline double ulonglong2double(ulonglong value)
#define HAVE_SETFILEPOINTER #define HAVE_SETFILEPOINTER
#define HAVE_VIO #define HAVE_VIO
#define HAME_MMAP /* in mysys/my_mmap.c */
#define HAVE_GETPAGESIZE /* in mysys/my_mmap.c */
#ifdef NOT_USED #ifdef NOT_USED
#define HAVE_SNPRINTF /* Gave link error */ #define HAVE_SNPRINTF /* Gave link error */
#define _snprintf snprintf #define _snprintf snprintf
......
...@@ -796,7 +796,7 @@ void my_free_open_file_info(void); ...@@ -796,7 +796,7 @@ void my_free_open_file_info(void);
ulonglong my_getsystime(void); ulonglong my_getsystime(void);
my_bool my_gethwaddr(uchar *to); my_bool my_gethwaddr(uchar *to);
#ifdef HAVE_MMAP #ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h> #include <sys/mman.h>
#ifndef MAP_NOSYNC #ifndef MAP_NOSYNC
...@@ -815,6 +815,7 @@ my_bool my_gethwaddr(uchar *to); ...@@ -815,6 +815,7 @@ my_bool my_gethwaddr(uchar *to);
#define MAP_NOSYNC 0x0800 #define MAP_NOSYNC 0x0800
#define MAP_FAILED ((void *)-1) #define MAP_FAILED ((void *)-1)
#define MS_SYNC 0x0000 #define MS_SYNC 0x0000
#define HAVE_MMAP
int my_getpagesize(void); int my_getpagesize(void);
void *my_mmap(void *, size_t, int, int, int, my_off_t); void *my_mmap(void *, size_t, int, int, int, my_off_t);
......
...@@ -111,10 +111,14 @@ insert into t1 values ("Alas"); ...@@ -111,10 +111,14 @@ insert into t1 values ("Alas");
/*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/;
ROLLBACK; ROLLBACK;
use test; use test;
SET TIMESTAMP=1065204671; SET TIMESTAMP=1108844556;
BEGIN; BEGIN;
SET TIMESTAMP=1108844555;
insert t1 values (1);
/*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test; use test;
SET TIMESTAMP=1065204671; SET TIMESTAMP=1108844556;
BEGIN; BEGIN;
SET TIMESTAMP=1108844555;
insert t1 values (1);
drop table t1, t2; drop table t1, t2;
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "mysys_priv.h" #include "mysys_priv.h"
#ifdef HAVE_MMAP #ifdef HAVE_SYS_MMAN_H
/* /*
system msync() only syncs mmap'ed area to fs cache. system msync() only syncs mmap'ed area to fs cache.
...@@ -84,6 +84,6 @@ int my_msync(int fd, void *addr, size_t len, int flags) ...@@ -84,6 +84,6 @@ int my_msync(int fd, void *addr, size_t len, int flags)
} }
#endif #endif
#error "no mmap!" #warning "no mmap!"
#endif #endif
...@@ -2415,6 +2415,7 @@ void sql_print_information(const char *format, ...) ...@@ -2415,6 +2415,7 @@ void sql_print_information(const char *format, ...)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
#ifdef HAVE_MMAP
/********* transaction coordinator log for 2pc - mmap() based solution *******/ /********* transaction coordinator log for 2pc - mmap() based solution *******/
/* /*
...@@ -2460,10 +2461,6 @@ uint opt_tc_log_size=TC_LOG_MIN_SIZE; ...@@ -2460,10 +2461,6 @@ uint opt_tc_log_size=TC_LOG_MIN_SIZE;
uint tc_log_max_pages_used=0, tc_log_page_size=0, uint tc_log_max_pages_used=0, tc_log_page_size=0,
tc_log_page_waits=0, tc_log_cur_pages_used=0; tc_log_page_waits=0, tc_log_cur_pages_used=0;
TC_LOG *tc_log;
TC_LOG_MMAP tc_log_mmap;
TC_LOG_DUMMY tc_log_dummy;
int TC_LOG_MMAP::open(const char *opt_name) int TC_LOG_MMAP::open(const char *opt_name)
{ {
uint i; uint i;
...@@ -2473,12 +2470,8 @@ int TC_LOG_MMAP::open(const char *opt_name) ...@@ -2473,12 +2470,8 @@ int TC_LOG_MMAP::open(const char *opt_name)
DBUG_ASSERT(total_ha_2pc > 1); DBUG_ASSERT(total_ha_2pc > 1);
DBUG_ASSERT(opt_name && opt_name[0]); DBUG_ASSERT(opt_name && opt_name[0]);
#ifdef HAVE_GETPAGESIZE
tc_log_page_size= my_getpagesize(); tc_log_page_size= my_getpagesize();
DBUG_ASSERT(TC_LOG_PAGE_SIZE % tc_log_page_size == 0); DBUG_ASSERT(TC_LOG_PAGE_SIZE % tc_log_page_size == 0);
#else
tc_log_page_size= TC_LOG_PAGE_SIZE;
#endif
fn_format(logname,opt_name,mysql_data_home,"",MY_UNPACK_FILENAME); fn_format(logname,opt_name,mysql_data_home,"",MY_UNPACK_FILENAME);
fd= my_open(logname, O_RDWR, MYF(0)); fd= my_open(logname, O_RDWR, MYF(0));
...@@ -2861,6 +2854,11 @@ err1: ...@@ -2861,6 +2854,11 @@ err1:
"--tc-heuristic-recover={commit|rollback}"); "--tc-heuristic-recover={commit|rollback}");
return 1; return 1;
} }
#endif
TC_LOG *tc_log;
TC_LOG_DUMMY tc_log_dummy;
TC_LOG_MMAP tc_log_mmap;
/* /*
Perform heuristic recovery, if --tc-heuristic-recover was used Perform heuristic recovery, if --tc-heuristic-recover was used
......
...@@ -80,6 +80,7 @@ class TC_LOG_DUMMY: public TC_LOG // use it to disable the logging ...@@ -80,6 +80,7 @@ class TC_LOG_DUMMY: public TC_LOG // use it to disable the logging
void unlog(ulong cookie, my_xid xid) { } void unlog(ulong cookie, my_xid xid) { }
}; };
#ifdef HAVE_MMAP
class TC_LOG_MMAP: public TC_LOG class TC_LOG_MMAP: public TC_LOG
{ {
private: private:
...@@ -103,7 +104,8 @@ class TC_LOG_MMAP: public TC_LOG ...@@ -103,7 +104,8 @@ class TC_LOG_MMAP: public TC_LOG
char logname[FN_REFLEN]; char logname[FN_REFLEN];
File fd; File fd;
uint file_length, npages, inited; my_off_t file_length;
uint npages, inited;
uchar *data; uchar *data;
struct st_page *pages, *syncing, *active, *pool, *pool_last; struct st_page *pages, *syncing, *active, *pool, *pool_last;
/* /*
...@@ -128,6 +130,9 @@ class TC_LOG_MMAP: public TC_LOG ...@@ -128,6 +130,9 @@ class TC_LOG_MMAP: public TC_LOG
int sync(); int sync();
int overflow(); int overflow();
}; };
#else
#define TC_LOG_MMAP TC_LOG_DUMMY
#endif
extern TC_LOG *tc_log; extern TC_LOG *tc_log;
extern TC_LOG_MMAP tc_log_mmap; extern TC_LOG_MMAP tc_log_mmap;
......
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