diff --git a/include/config-win.h b/include/config-win.h index 9918f69a978..475141a1989 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -353,6 +353,8 @@ inline double ulonglong2double(ulonglong value) #define DO_NOT_REMOVE_THREAD_WRAPPERS #define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V)) +#define thread_safe_decrement(V,L) InterlockedDecrement((long*) &(V)) +#define thread_safe_dec_and_test(V, L) thread_safe_decrement(V,L) /* The following is only used for statistics, so it should be good enough */ #ifdef __NT__ /* This should also work on Win98 but .. */ #define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C)) @@ -366,6 +368,7 @@ inline double ulonglong2double(ulonglong value) #define statistic_add(V,C,L) (V)+=(C) #endif #define statistic_increment(V,L) thread_safe_increment((V),(L)) +#define statistic_decrement(V,L) thread_safe_decrement((V),(L)) #define shared_memory_buffer_length 16000 #define default_shared_memory_base_name "MYSQL" diff --git a/include/my_sys.h b/include/my_sys.h index 72d4bec74b1..9cce13e53dd 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -811,7 +811,8 @@ my_bool my_gethwaddr(uchar *to); /* not a complete set of mmap() flags, but only those that nesessary */ #define PROT_READ 1 #define PROT_WRITE 2 -#define MAP_NOSYNC 0x800 +#define MAP_SHARED 0x0001 +#define MAP_NOSYNC 0x0800 #define MAP_FAILED ((void *)-1) #define MS_SYNC 0x0000 diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 6c26a9555a6..f8e14844875 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -215,6 +215,7 @@ bool berkeley_end(void) static int berkeley_close_connection(THD *thd) { my_free((gptr)thd->ha_data[berkeley_hton.slot], MYF(0)); + return 0; } bool berkeley_flush_logs() diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 2199d958bb6..fd275b19f77 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -2652,7 +2652,7 @@ ha_innobase::write_row( no need to re-acquire locks on it. */ /* Altering to InnoDB format */ - innobase_commit(user_thd, prebuilt->trx); + innobase_commit(user_thd, 1); /* Note that this transaction is still active. */ prebuilt->trx->active_trans = 1; /* We will need an IX lock on the destination table. */ @@ -2667,7 +2667,7 @@ ha_innobase::write_row( /* Commit the transaction. This will release the table locks, so they have to be acquired again. */ - innobase_commit(user_thd, prebuilt->trx); + innobase_commit(user_thd, 1); /* Note that this transaction is still active. */ prebuilt->trx->active_trans = 1; /* Re-acquire the table lock on the source table. */ @@ -4247,7 +4247,7 @@ ha_innobase::delete_all_rows(void) goto fallback; } - innobase_commit(thd, trx); + innobase_commit(thd, 1); error = convert_error_code_to_mysql(error, NULL); diff --git a/sql/handler.cc b/sql/handler.cc index d1331243361..3ccea502a50 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -757,7 +757,7 @@ int ha_recover(HASH *commit_list) if (!x) // not "mine" - that is generated by external TM continue; if (commit_list ? - hash_search(commit_list, (char *)&x, sizeof(x)) != 0 : + hash_search(commit_list, (byte *)&x, sizeof(x)) != 0 : tc_heuristic_recover == TC_HEURISTIC_RECOVER_COMMIT) (*(*ht)->commit_by_xid)(list+i); else diff --git a/sql/log.cc b/sql/log.cc index 7d6f2abb022..cb776cff0e9 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -2096,7 +2096,7 @@ void MYSQL_LOG::close(uint exiting) if (log_file.type == WRITE_CACHE && log_type == LOG_BIN) { my_off_t offset= BIN_LOG_HEADER_SIZE + FLAGS_OFFSET; - char flags=0; // clearing LOG_EVENT_BINLOG_IN_USE_F + byte flags=0; // clearing LOG_EVENT_BINLOG_IN_USE_F my_pwrite(log_file.file, &flags, 1, offset, MYF(0)); } @@ -2474,10 +2474,10 @@ int TC_LOG_MMAP::open(const char *opt_name) DBUG_ASSERT(opt_name && opt_name[0]); #ifdef HAVE_GETPAGESIZE - tc_log_page_size=getpagesize(); + tc_log_page_size= my_getpagesize(); DBUG_ASSERT(TC_LOG_PAGE_SIZE % tc_log_page_size == 0); #else - tc_log_page_size=TC_LOG_PAGE_SIZE; + tc_log_page_size= TC_LOG_PAGE_SIZE; #endif fn_format(logname,opt_name,mysql_data_home,"",MY_UNPACK_FILENAME); @@ -2781,6 +2781,7 @@ void TC_LOG_MMAP::unlog(ulong cookie, my_xid xid) void TC_LOG_MMAP::close() { + uint i; switch (inited) { case 6: pthread_mutex_destroy(&LOCK_sync); @@ -2790,7 +2791,7 @@ void TC_LOG_MMAP::close() case 5: data[0]='A'; // garble the first (signature) byte, in case my_delete fails case 4: - for (uint i=0; i < npages; i++) + for (i=0; i < npages; i++) { if (pages[i].ptr == 0) break; @@ -3015,7 +3016,8 @@ int TC_LOG_BINLOG::recover(IO_CACHE *log, Format_description_log_event *fdle) if (ev->get_type_code() == XID_EVENT) { Xid_log_event *xev=(Xid_log_event *)ev; - byte *x=memdup_root(&mem_root, (char *)& xev->xid, sizeof(xev->xid)); + byte *x=(byte *)memdup_root(&mem_root, (char *)& xev->xid, + sizeof(xev->xid)); if (! x) goto err2; my_hash_insert(&xids, x);