From b5cdc5adcfbb0d4380604187192cd089dd3e11b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 22 May 2014 16:31:31 +0300 Subject: [PATCH 01/10] Fix some compiler warnings and small errors on code. --- storage/innobase/fil/fil0pagecompress.cc | 4 ++-- storage/innobase/handler/ha_innodb.cc | 3 +++ storage/innobase/include/fil0fil.h | 3 --- storage/innobase/include/fil0pagecompress.h | 6 ------ storage/innobase/include/fsp0pagecompress.h | 8 +++++++- storage/innobase/include/fsp0pagecompress.ic | 13 +++++++++---- storage/innobase/include/os0file.h | 1 + storage/innobase/include/srv0srv.h | 2 ++ storage/xtradb/handler/ha_innodb.cc | 3 +++ storage/xtradb/include/fil0pagecompress.h | 6 ------ storage/xtradb/include/fsp0pagecompress.h | 8 +++++++- storage/xtradb/include/fsp0pagecompress.ic | 14 +++++++++----- storage/xtradb/include/os0file.h | 1 + 13 files changed, 44 insertions(+), 28 deletions(-) diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc index ce7063bc688..a062f914b80 100644 --- a/storage/innobase/fil/fil0pagecompress.cc +++ b/storage/innobase/fil/fil0pagecompress.cc @@ -325,7 +325,7 @@ fil_decompress_page( if (err != (int)actual_size) { fprintf(stderr, "InnoDB: Corruption: Page is marked as compressed\n" - "InnoDB: but decompression read only %d bytes.\n" + "InnoDB: but decompression read only %ld bytes.\n" "InnoDB: size %lu len %lu\n", err, actual_size, len); fflush(stderr); @@ -342,7 +342,7 @@ fil_decompress_page( if (err != LZO_E_OK || (olen == 0 || olen > UNIV_PAGE_SIZE)) { fprintf(stderr, "InnoDB: Corruption: Page is marked as compressed\n" - "InnoDB: but decompression read only %d bytes.\n" + "InnoDB: but decompression read only %ld bytes.\n" "InnoDB: size %lu len %lu\n", olen, actual_size, len); fflush(stderr); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 84a38473b88..67b81710422 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -17324,6 +17324,9 @@ ib_senderrf( case IB_LOG_LEVEL_FATAL: l = 0; break; + default: + l = 0; + break; } my_printv_error(code, format, MYF(l), args); diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 71b09f21d67..a1422f3d11b 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -133,9 +133,6 @@ extern fil_addr_t fil_addr_null; #define FIL_PAGE_COMPRESSED_SIZE 2 /*!< Number of bytes used to store actual payload data size on compressed pages. */ -#define FIL_PAGE_COMPRESSION_ZLIB 1 /*!< Compressin algorithm ZLIB. */ -#define FIL_PAGE_COMPRESSION_LZ4 2 /*!< Compressin algorithm LZ4. */ - /* @} */ /** File page trailer @{ */ #define FIL_PAGE_END_LSN_OLD_CHKSUM 8 /*!< the low 4 bytes of this are used diff --git a/storage/innobase/include/fil0pagecompress.h b/storage/innobase/include/fil0pagecompress.h index 0cc5aeb4678..74f6e45f4fb 100644 --- a/storage/innobase/include/fil0pagecompress.h +++ b/storage/innobase/include/fil0pagecompress.h @@ -22,12 +22,6 @@ this program; if not, write to the Free Software Foundation, Inc., #include "fsp0fsp.h" #include "fsp0pagecompress.h" -#define PAGE_UNCOMPRESSED 0 -#define PAGE_ZLIB_ALGORITHM 1 -#define PAGE_LZ4_ALGORITHM 2 -#define PAGE_LZO_ALGORITHM 3 -#define PAGE_ALGORITHM_LAST PAGE_LZO_ALGORITHM - /******************************************************************//** @file include/fil0pagecompress.h Helper functions for extracting/storing page compression and diff --git a/storage/innobase/include/fsp0pagecompress.h b/storage/innobase/include/fsp0pagecompress.h index 4913f1d6b29..f2cd38481f6 100644 --- a/storage/innobase/include/fsp0pagecompress.h +++ b/storage/innobase/include/fsp0pagecompress.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (C) 2013 SkySQL Ab. All Rights Reserved. +Copyright (C) 2013, 2014 SkySQL Ab. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -27,6 +27,12 @@ Created 11/12/2013 Jan Lindström jan.lindstrom@skysql.com #ifndef fsp0pagecompress_h #define fsp0pagecompress_h +#define PAGE_UNCOMPRESSED 0 +#define PAGE_ZLIB_ALGORITHM 1 +#define PAGE_LZ4_ALGORITHM 2 +#define PAGE_LZO_ALGORITHM 3 +#define PAGE_ALGORITHM_LAST PAGE_LZO_ALGORITHM + /**********************************************************************//** Reads the page compression level from the first page of a tablespace. @return page compression level, or 0 if uncompressed */ diff --git a/storage/innobase/include/fsp0pagecompress.ic b/storage/innobase/include/fsp0pagecompress.ic index 10f9d30d1f8..65ad90cdfc4 100644 --- a/storage/innobase/include/fsp0pagecompress.ic +++ b/storage/innobase/include/fsp0pagecompress.ic @@ -24,8 +24,6 @@ compression and atomic writes information to file space. Created 11/12/2013 Jan Lindström jan.lindstrom@skysql.com ***********************************************************************/ -#include "fsp0fsp.h" - /********************************************************************//** Determine if the tablespace is page compressed from dict_table_t::flags. @return TRUE if page compressed, FALSE if not page compressed */ @@ -141,14 +139,21 @@ fil_get_compression_alg_name( ulint comp_alg) /*! Date: Thu, 22 May 2014 19:48:34 +0300 Subject: [PATCH 02/10] Fixed compiler errors caused by merge error. --- storage/innobase/handler/ha_innodb.cc | 4 ++-- storage/xtradb/handler/ha_innodb.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 67b81710422..f3d0cd47a23 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -16806,9 +16806,9 @@ static MYSQL_SYSVAR_LONG(compression_algorithm, innodb_compression_algorithm, #if defined(HAVE_LZO) && defined(HAVE_LZ4) PAGE_ALGORITHM_LAST, #elif defined(HAVE_LZ4) && !defined(HAVE_LZO) - PAGE_ALGORITHM_LZ4, + PAGE_LZ4_ALGORITHM, #else - PAGE_ALGORITHM_ZLIB, + PAGE_ZLIB_ALGORITHM, #endif 0); diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index f08a9607d7d..123e72ecdd7 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -17963,9 +17963,9 @@ static MYSQL_SYSVAR_LONG(compression_algorithm, innodb_compression_algorithm, #if defined(HAVE_LZO) && defined(HAVE_LZ4) PAGE_ALGORITHM_LAST, #elif defined(HAVE_LZ4) && !defined(HAVE_LZO) - PAGE_ALGORITHM_LZ4, + PAGE_LZ4_ALGORITHM, #else - PAGE_ALGORITHM_ZLIB, + PAGE_ZLIB_ALGORITHM, #endif 0); From 192790e0e990d32177c61c8c041df25d8cab29ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 22 May 2014 21:03:26 +0300 Subject: [PATCH 03/10] Fix compiler error if LZO is not installed. --- storage/innobase/os/os0file.cc | 2 +- storage/xtradb/os/os0file.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index cd7b4161cb2..6b864392a72 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -228,7 +228,7 @@ struct os_aio_slot_t{ #ifdef HAVE_LZO byte lzo_mem[LZO1X_1_15_MEM_COMPRESS]; #else - byte lzo_mem; /* Temporal memory used by LZO */ + byte lzo_mem[1]; /* Temporal memory used by LZO */ #endif }; diff --git a/storage/xtradb/os/os0file.cc b/storage/xtradb/os/os0file.cc index 657a3a8d050..5820b42027c 100644 --- a/storage/xtradb/os/os0file.cc +++ b/storage/xtradb/os/os0file.cc @@ -237,7 +237,7 @@ struct os_aio_slot_t{ #ifdef HAVE_LZO byte lzo_mem[LZO1X_1_15_MEM_COMPRESS]; #else - byte lzo_mem; /* Temporal memory used by LZO */ + byte lzo_mem[1]; /* Temporal memory used by LZO */ #endif }; From 6d460760ebda2a7b42c039036497c1c5a18a522d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 23 May 2014 08:20:43 +0300 Subject: [PATCH 04/10] Fix compiler warnings. --- storage/innobase/btr/btr0cur.cc | 1 - storage/innobase/buf/buf0flu.cc | 9 +------ storage/innobase/fil/fil0pagecompress.cc | 4 ++-- storage/innobase/include/os0file.h | 2 -- storage/xtradb/buf/buf0flu.cc | 30 +++--------------------- storage/xtradb/fil/fil0pagecompress.cc | 4 ++-- storage/xtradb/include/os0file.h | 2 -- storage/xtradb/log/log0log.cc | 2 +- storage/xtradb/srv/srv0start.cc | 2 +- 9 files changed, 10 insertions(+), 46 deletions(-) diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 1660fbb97f8..d3f5ffa49e0 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -1863,7 +1863,6 @@ btr_cur_update_alloc_zip_func( /* Have a local copy of the variables as these can change dynamically. */ - ulint compression_level = page_zip_level; const page_t* page = page_cur_get_page(cursor); ut_ad(page_zip == page_cur_get_page_zip(cursor)); diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 280f8cc39a9..fda05f5b669 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -2429,7 +2429,6 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)( ulint next_loop_time = ut_time_ms() + 1000; ulint n_flushed = 0; ulint last_activity = srv_get_activity_count(); - ulint n_lru=0; ut_ad(!srv_read_only_mode); @@ -2460,13 +2459,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)( last_activity = srv_get_activity_count(); /* Flush pages from end of LRU if required */ - n_lru = n_flushed = buf_flush_LRU_tail(); -#ifdef UNIV_MTFLUSH_DEBUG - if (n_lru) { - fprintf(stderr,"n_lru:%lu ",n_lru); - } -#endif - + n_flushed = buf_flush_LRU_tail(); /* Flush pages from flush_list if required */ n_flushed += page_cleaner_flush_pages_if_needed(); diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc index a062f914b80..51f584883b5 100644 --- a/storage/innobase/fil/fil0pagecompress.cc +++ b/storage/innobase/fil/fil0pagecompress.cc @@ -195,7 +195,7 @@ fil_compress_page( ut_ad(fil_page_is_compressed(out_buf)); ut_ad(mach_read_from_4(out_buf+FIL_PAGE_SPACE_OR_CHKSUM) == BUF_NO_CHECKSUM_MAGIC); ut_ad(mach_read_from_2(out_buf+FIL_PAGE_DATA) == write_size); - ut_ad(mach_read_from_8(out_buf+FIL_PAGE_FILE_FLUSH_LSN) == innodb_compression_algorithm); + ut_ad(mach_read_from_8(out_buf+FIL_PAGE_FILE_FLUSH_LSN) == (ulint)innodb_compression_algorithm); #endif /* UNIV_DEBUG */ write_size+=header_len; @@ -325,7 +325,7 @@ fil_decompress_page( if (err != (int)actual_size) { fprintf(stderr, "InnoDB: Corruption: Page is marked as compressed\n" - "InnoDB: but decompression read only %ld bytes.\n" + "InnoDB: but decompression read only %d bytes.\n" "InnoDB: size %lu len %lu\n", err, actual_size, len); fflush(stderr); diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index 938e15683e9..cf26c679eb0 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -731,8 +731,6 @@ pfs_os_file_read_no_error_handling_func( void* buf, /*!< in: buffer where to read */ os_offset_t offset, /*!< in: file offset where to read */ ulint n, /*!< in: number of bytes to read */ - ulint atomic_writes,/*!< in: atomic writes table option - value */ const char* src_file,/*!< in: file name where func invoked */ ulint src_line);/*!< in: line where the func invoked */ diff --git a/storage/xtradb/buf/buf0flu.cc b/storage/xtradb/buf/buf0flu.cc index d445c487d9b..c141dd94562 100644 --- a/storage/xtradb/buf/buf0flu.cc +++ b/storage/xtradb/buf/buf0flu.cc @@ -2694,7 +2694,6 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)( ulint n_flushed = 0; ulint last_activity = srv_get_activity_count(); ulint lru_sleep_time = srv_cleaner_max_lru_time; - ulint n_lru=0, n_pgc_flush=0, n_pgc_batch=0; ut_ad(!srv_read_only_mode); @@ -2739,25 +2738,15 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)( next_loop_time = ut_time_ms() + page_cleaner_sleep_time; /* Flush pages from end of LRU if required */ - n_lru = n_flushed = buf_flush_LRU_tail(); -#ifdef UNIV_MTFLUSH_DEBUG - if (n_lru) { - fprintf(stderr,"n_lru:%lu ",n_lru); - } -#endif + n_flushed = buf_flush_LRU_tail(); if (srv_check_activity(last_activity)) { last_activity = srv_get_activity_count(); /* Flush pages from flush_list if required */ - n_flushed += n_pgc_flush = page_cleaner_flush_pages_if_needed(); -#ifdef UNIV_MTFLUSH_DEBUG - if (n_pgc_flush) { - fprintf(stderr,"n_pgc_flush:%lu ",n_pgc_flush); - } -#endif + n_flushed += page_cleaner_flush_pages_if_needed(); } else { - n_pgc_batch = n_flushed = page_cleaner_do_flush_batch( + n_flushed = page_cleaner_do_flush_batch( PCT_IO(100), LSN_MAX); @@ -2768,20 +2757,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)( MONITOR_FLUSH_BACKGROUND_PAGES, n_flushed); } -#ifdef UNIV_MTFLUSH_DEBUG - if (n_pgc_batch) { - fprintf(stderr,"n_pgc_batch:%lu ",n_pgc_batch); - } -#endif } - -#ifdef UNIV_MTFLUSH_DEBUG - if (n_lru || n_pgc_flush || n_pgc_batch) { - fprintf1(stderr,"\n"); - n_lru = n_pgc_flush = n_pgc_batch = 0; - } -#endif - } ut_ad(srv_shutdown_state > 0); diff --git a/storage/xtradb/fil/fil0pagecompress.cc b/storage/xtradb/fil/fil0pagecompress.cc index ce7063bc688..51f584883b5 100644 --- a/storage/xtradb/fil/fil0pagecompress.cc +++ b/storage/xtradb/fil/fil0pagecompress.cc @@ -195,7 +195,7 @@ fil_compress_page( ut_ad(fil_page_is_compressed(out_buf)); ut_ad(mach_read_from_4(out_buf+FIL_PAGE_SPACE_OR_CHKSUM) == BUF_NO_CHECKSUM_MAGIC); ut_ad(mach_read_from_2(out_buf+FIL_PAGE_DATA) == write_size); - ut_ad(mach_read_from_8(out_buf+FIL_PAGE_FILE_FLUSH_LSN) == innodb_compression_algorithm); + ut_ad(mach_read_from_8(out_buf+FIL_PAGE_FILE_FLUSH_LSN) == (ulint)innodb_compression_algorithm); #endif /* UNIV_DEBUG */ write_size+=header_len; @@ -342,7 +342,7 @@ fil_decompress_page( if (err != LZO_E_OK || (olen == 0 || olen > UNIV_PAGE_SIZE)) { fprintf(stderr, "InnoDB: Corruption: Page is marked as compressed\n" - "InnoDB: but decompression read only %d bytes.\n" + "InnoDB: but decompression read only %ld bytes.\n" "InnoDB: size %lu len %lu\n", olen, actual_size, len); fflush(stderr); diff --git a/storage/xtradb/include/os0file.h b/storage/xtradb/include/os0file.h index 836d12d878e..2ed5e19dffd 100644 --- a/storage/xtradb/include/os0file.h +++ b/storage/xtradb/include/os0file.h @@ -740,8 +740,6 @@ pfs_os_file_read_func( os_offset_t offset, /*!< in: file offset where to read */ ulint n, /*!< in: number of bytes to read */ trx_t* trx, - ulint atomic_writes,/*!< in: atomic writes table option - value */ const char* src_file,/*!< in: file name where func invoked */ ulint src_line);/*!< in: line where the func invoked */ diff --git a/storage/xtradb/log/log0log.cc b/storage/xtradb/log/log0log.cc index 994471976cf..ee39f5846ca 100644 --- a/storage/xtradb/log/log0log.cc +++ b/storage/xtradb/log/log0log.cc @@ -3043,7 +3043,7 @@ log_archive_do( { ibool calc_new_limit; ib_uint64_t start_lsn; - ib_uint64_t limit_lsn; + ib_uint64_t limit_lsn=0; calc_new_limit = TRUE; loop: diff --git a/storage/xtradb/srv/srv0start.cc b/storage/xtradb/srv/srv0start.cc index 96d9606f564..cb1d2c13baf 100644 --- a/storage/xtradb/srv/srv0start.cc +++ b/storage/xtradb/srv/srv0start.cc @@ -1527,7 +1527,7 @@ innobase_start_or_create_for_mysql(void) lsn_t min_flushed_lsn; lsn_t max_flushed_lsn; #ifdef UNIV_LOG_ARCHIVE - lsn_t min_arch_log_no; + lsn_t min_arch_log_no=0; lsn_t max_arch_log_no; #endif /* UNIV_LOG_ARCHIVE */ ulint sum_of_new_sizes; From 45d389fb8416f5a5962eaff9bd6c09c28ee21e7b Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 26 May 2014 20:26:04 +0200 Subject: [PATCH 05/10] lzo.cmake: don't use the same symbol for two different tests --- cmake/lzo.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/lzo.cmake b/cmake/lzo.cmake index 596dfdcde8b..0940565c75e 100644 --- a/cmake/lzo.cmake +++ b/cmake/lzo.cmake @@ -26,9 +26,9 @@ ENDMACRO() MACRO (MYSQL_CHECK_LZO) CHECK_INCLUDE_FILES(lzo/lzo1x.h HAVE_LZO_H) -CHECK_LIBRARY_EXISTS(lzo2 lzo1x_1_compress "" HAVE_LZO_LIB) +CHECK_LIBRARY_EXISTS(lzo2 lzo1x_1_compress "" HAVE_LZO_SHARED_LIB) -IF(HAVE_LZO_LIB AND HAVE_LZO_H) +IF(HAVE_LZO_SHARED_LIB AND HAVE_LZO_H) ADD_DEFINITIONS(-DHAVE_LZO=1) LINK_LIBRARIES(lzo2) ENDIF() From 9ad97c4b1ef6a2d496d52f7708fcdccc53a6bc90 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 26 May 2014 20:26:51 +0200 Subject: [PATCH 06/10] temporarily disable lzo compression --- cmake/lzo.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/lzo.cmake b/cmake/lzo.cmake index 0940565c75e..5a073a6a8eb 100644 --- a/cmake/lzo.cmake +++ b/cmake/lzo.cmake @@ -14,8 +14,8 @@ MACRO (MYSQL_CHECK_LZO_STATIC) -CHECK_INCLUDE_FILES(lzo/lzo1x.h HAVE_LZO_H) -CHECK_LIBRARY_EXISTS(liblzo2.a lzo1x_1_compress "" HAVE_LZO_LIB) +#CHECK_INCLUDE_FILES(lzo/lzo1x.h HAVE_LZO_H) +#CHECK_LIBRARY_EXISTS(liblzo2.a lzo1x_1_compress "" HAVE_LZO_LIB) IF(HAVE_LZO_LIB AND HAVE_LZO_H) ADD_DEFINITIONS(-DHAVE_LZO=1) @@ -25,8 +25,8 @@ ENDMACRO() MACRO (MYSQL_CHECK_LZO) -CHECK_INCLUDE_FILES(lzo/lzo1x.h HAVE_LZO_H) -CHECK_LIBRARY_EXISTS(lzo2 lzo1x_1_compress "" HAVE_LZO_SHARED_LIB) +#CHECK_INCLUDE_FILES(lzo/lzo1x.h HAVE_LZO_H) +#CHECK_LIBRARY_EXISTS(lzo2 lzo1x_1_compress "" HAVE_LZO_SHARED_LIB) IF(HAVE_LZO_SHARED_LIB AND HAVE_LZO_H) ADD_DEFINITIONS(-DHAVE_LZO=1) From 7e7e1bf8aa1a14cc5f12263ae1db2ab488239f63 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 26 May 2014 20:27:14 +0200 Subject: [PATCH 07/10] don't include the file that 1) not present everywhere 2) not used anyway --- storage/innobase/fil/fil0fil.cc | 1 - storage/xtradb/fil/fil0fil.cc | 1 - 2 files changed, 2 deletions(-) diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 9658b9ddcb0..f2cd6ddd7a0 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -63,7 +63,6 @@ static ulint srv_data_read, srv_data_written; #include #include #include -#include #endif #include "row0mysql.h" diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc index abb4245398b..f3d200484e0 100644 --- a/storage/xtradb/fil/fil0fil.cc +++ b/storage/xtradb/fil/fil0fil.cc @@ -61,7 +61,6 @@ static ulint srv_data_read, srv_data_written; #include #include #include -#include #endif #include "row0mysql.h" From 50354951084c3bc95dffcfff59fee58d00237da4 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 26 May 2014 20:31:03 +0200 Subject: [PATCH 08/10] compilation failure on Windows VS doesn't like #ifdefs inside a macro expansion. move them outside --- storage/innobase/handler/ha_innodb.cc | 15 ++++++++------- storage/xtradb/handler/ha_innodb.cc | 15 ++++++++------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index f3d0cd47a23..635c127e55b 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -16797,19 +16797,20 @@ static MYSQL_SYSVAR_BOOL(use_trim, srv_use_trim, "Use trim. Default FALSE.", NULL, NULL, FALSE); +#if defined(HAVE_LZO) +#define default_compression_algorithm PAGE_LZO_ALGORITHM +#elif defined(HAVE_LZ4) +#define default_compression_algorithm PAGE_LZ4_ALGORITHM +#else +#define default_compression_algorithm PAGE_ZLIB_ALGORITHM +#endif static MYSQL_SYSVAR_LONG(compression_algorithm, innodb_compression_algorithm, PLUGIN_VAR_OPCMDARG, "Compression algorithm used on page compression. 1 for zlib, 2 for lz3, 3 for lzo", NULL, NULL, PAGE_ZLIB_ALGORITHM, 0, -#if defined(HAVE_LZO) && defined(HAVE_LZ4) - PAGE_ALGORITHM_LAST, -#elif defined(HAVE_LZ4) && !defined(HAVE_LZO) - PAGE_LZ4_ALGORITHM, -#else - PAGE_ZLIB_ALGORITHM, -#endif + default_compression_algorithm, 0); static MYSQL_SYSVAR_LONG(mtflush_threads, srv_mtflush_threads, diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 123e72ecdd7..ef0f71a6f7d 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -17954,19 +17954,20 @@ static MYSQL_SYSVAR_BOOL(use_trim, srv_use_trim, "Use trim. Default FALSE.", NULL, NULL, FALSE); +#if defined(HAVE_LZO) +#define default_compression_algorithm PAGE_LZO_ALGORITHM +#elif defined(HAVE_LZ4) +#define default_compression_algorithm PAGE_LZ4_ALGORITHM +#else +#define default_compression_algorithm PAGE_ZLIB_ALGORITHM +#endif static MYSQL_SYSVAR_LONG(compression_algorithm, innodb_compression_algorithm, PLUGIN_VAR_OPCMDARG, "Compression algorithm used on page compression. 1 for zlib, 2 for lz3, 3 for lzo", NULL, NULL, PAGE_ZLIB_ALGORITHM, 0, -#if defined(HAVE_LZO) && defined(HAVE_LZ4) - PAGE_ALGORITHM_LAST, -#elif defined(HAVE_LZ4) && !defined(HAVE_LZO) - PAGE_LZ4_ALGORITHM, -#else - PAGE_ZLIB_ALGORITHM, -#endif + default_compression_algorithm, 0); static MYSQL_SYSVAR_LONG(mtflush_threads, srv_mtflush_threads, From 8eaa1d90a47df52f5abefdd73b4fa64cdb26c59c Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 26 May 2014 20:41:10 +0200 Subject: [PATCH 09/10] use ENUM not ULONG for innodb-compression-algorithm command-line option --- storage/innobase/handler/ha_innodb.cc | 17 ++++++++++------- storage/innobase/include/srv0srv.h | 2 +- storage/innobase/srv/srv0srv.cc | 2 +- storage/xtradb/handler/ha_innodb.cc | 17 ++++++++++------- storage/xtradb/include/srv0srv.h | 2 +- storage/xtradb/srv/srv0srv.cc | 2 +- 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 635c127e55b..c46c44d3cf8 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -16804,14 +16804,17 @@ static MYSQL_SYSVAR_BOOL(use_trim, srv_use_trim, #else #define default_compression_algorithm PAGE_ZLIB_ALGORITHM #endif -static MYSQL_SYSVAR_LONG(compression_algorithm, innodb_compression_algorithm, +static const char *page_compression_algorithms[]= { "none", "zlib", "lz4", "lzo", 0 }; +static TYPELIB page_compression_algorithms_typelib= +{ + array_elements(page_compression_algorithms) - 1, 0, + page_compression_algorithms, 0 +}; +static MYSQL_SYSVAR_ENUM(compression_algorithm, innodb_compression_algorithm, PLUGIN_VAR_OPCMDARG, - "Compression algorithm used on page compression. 1 for zlib, 2 for lz3, 3 for lzo", - NULL, NULL, - PAGE_ZLIB_ALGORITHM, - 0, - default_compression_algorithm, - 0); + "Compression algorithm used on page compression. One of: none, zlib, lz4, or lzo", + NULL, NULL, default_compression_algorithm, + &page_compression_algorithms_typelib); static MYSQL_SYSVAR_LONG(mtflush_threads, srv_mtflush_threads, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 26fcf40eb97..df3bb31f9a9 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -252,7 +252,7 @@ extern my_bool srv_use_posix_fallocate; extern my_bool srv_use_atomic_writes; /* Compression algorithm*/ -extern long innodb_compression_algorithm; +extern ulong innodb_compression_algorithm; /* Number of flush threads */ #define MTFLUSH_MAX_WORKER 64 diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index a9cc7beb6b0..16e2aeb6e1b 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -155,7 +155,7 @@ UNIV_INTERN my_bool srv_use_posix_fallocate = FALSE; /* If this flag is TRUE, then we disable doublewrite buffer */ UNIV_INTERN my_bool srv_use_atomic_writes = FALSE; /* If this flag IS TRUE, then we use lz4 to compress/decompress pages */ -UNIV_INTERN long innodb_compression_algorithm = PAGE_ZLIB_ALGORITHM; +UNIV_INTERN ulong innodb_compression_algorithm = PAGE_ZLIB_ALGORITHM; /* Number of threads used for multi-threaded flush */ UNIV_INTERN long srv_mtflush_threads = MTFLUSH_DEFAULT_WORKER; /* If this flag is TRUE, then we will use multi threaded flush. */ diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index ef0f71a6f7d..bce378f8630 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -17961,14 +17961,17 @@ static MYSQL_SYSVAR_BOOL(use_trim, srv_use_trim, #else #define default_compression_algorithm PAGE_ZLIB_ALGORITHM #endif -static MYSQL_SYSVAR_LONG(compression_algorithm, innodb_compression_algorithm, +static const char *page_compression_algorithms[]= { "none", "zlib", "lz4", "lzo", 0 }; +static TYPELIB page_compression_algorithms_typelib= +{ + array_elements(page_compression_algorithms) - 1, 0, + page_compression_algorithms, 0 +}; +static MYSQL_SYSVAR_ENUM(compression_algorithm, innodb_compression_algorithm, PLUGIN_VAR_OPCMDARG, - "Compression algorithm used on page compression. 1 for zlib, 2 for lz3, 3 for lzo", - NULL, NULL, - PAGE_ZLIB_ALGORITHM, - 0, - default_compression_algorithm, - 0); + "Compression algorithm used on page compression. One of: none, zlib, lz4, or lzo", + NULL, NULL, default_compression_algorithm, + &page_compression_algorithms_typelib); static MYSQL_SYSVAR_LONG(mtflush_threads, srv_mtflush_threads, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h index ea8afd450dd..18b76fe83cb 100644 --- a/storage/xtradb/include/srv0srv.h +++ b/storage/xtradb/include/srv0srv.h @@ -270,7 +270,7 @@ extern my_bool srv_use_posix_fallocate; extern my_bool srv_use_atomic_writes; /* Compression algorithm*/ -extern long innodb_compression_algorithm; +extern ulong innodb_compression_algorithm; /* Number of flush threads */ #define MTFLUSH_MAX_WORKER 64 diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc index e70a2bd0dab..62c0b05eed7 100644 --- a/storage/xtradb/srv/srv0srv.cc +++ b/storage/xtradb/srv/srv0srv.cc @@ -173,7 +173,7 @@ UNIV_INTERN my_bool srv_use_posix_fallocate = FALSE; /* If this flag is TRUE, then we disable doublewrite buffer */ UNIV_INTERN my_bool srv_use_atomic_writes = FALSE; /* If this flag IS TRUE, then we use lz4 to compress/decompress pages */ -UNIV_INTERN long innodb_compression_algorithm = PAGE_ZLIB_ALGORITHM; +UNIV_INTERN ulong innodb_compression_algorithm = PAGE_ZLIB_ALGORITHM; /* Number of threads used for multi-threaded flush */ UNIV_INTERN long srv_mtflush_threads = MTFLUSH_DEFAULT_WORKER; /* If this flag is TRUE, then we will use multi threaded flush. */ From 4e68fafad44fbb5ea57a3cf9a750690d88f6fe1c Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 26 May 2014 20:42:06 +0200 Subject: [PATCH 10/10] compilation failure on Win64 cannot use &ulint_var (where ulint == unsigned __int64) where (ulong *) is expected (in uncompress() and in "%lu") --- storage/innobase/fil/fil0pagecompress.cc | 2 +- storage/innobase/include/fil0pagecompress.h | 2 +- storage/xtradb/fil/fil0pagecompress.cc | 2 +- storage/xtradb/include/fil0pagecompress.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc index 51f584883b5..bf6dd35e2f6 100644 --- a/storage/innobase/fil/fil0pagecompress.cc +++ b/storage/innobase/fil/fil0pagecompress.cc @@ -232,7 +232,7 @@ fil_decompress_page( byte* page_buf, /*!< in: preallocated buffer or NULL */ byte* buf, /*!< out: buffer from which to read; in aio this must be appropriately aligned */ - ulint len, /*!< in: length of output buffer.*/ + ulong len, /*!< in: length of output buffer.*/ ulint* write_size) /*!< in/out: Actual payload size of the compressed data. */ { diff --git a/storage/innobase/include/fil0pagecompress.h b/storage/innobase/include/fil0pagecompress.h index 74f6e45f4fb..e3a7ffbcb49 100644 --- a/storage/innobase/include/fil0pagecompress.h +++ b/storage/innobase/include/fil0pagecompress.h @@ -99,7 +99,7 @@ fil_decompress_page( byte* page_buf, /*!< in: preallocated buffer or NULL */ byte* buf, /*!< out: buffer from which to read; in aio this must be appropriately aligned */ - ulint len, /*!< in: length of output buffer.*/ + ulong len, /*!< in: length of output buffer.*/ ulint* write_size); /*!< in/out: Actual payload size of the compressed data. */ diff --git a/storage/xtradb/fil/fil0pagecompress.cc b/storage/xtradb/fil/fil0pagecompress.cc index 51f584883b5..bf6dd35e2f6 100644 --- a/storage/xtradb/fil/fil0pagecompress.cc +++ b/storage/xtradb/fil/fil0pagecompress.cc @@ -232,7 +232,7 @@ fil_decompress_page( byte* page_buf, /*!< in: preallocated buffer or NULL */ byte* buf, /*!< out: buffer from which to read; in aio this must be appropriately aligned */ - ulint len, /*!< in: length of output buffer.*/ + ulong len, /*!< in: length of output buffer.*/ ulint* write_size) /*!< in/out: Actual payload size of the compressed data. */ { diff --git a/storage/xtradb/include/fil0pagecompress.h b/storage/xtradb/include/fil0pagecompress.h index 74f6e45f4fb..e3a7ffbcb49 100644 --- a/storage/xtradb/include/fil0pagecompress.h +++ b/storage/xtradb/include/fil0pagecompress.h @@ -99,7 +99,7 @@ fil_decompress_page( byte* page_buf, /*!< in: preallocated buffer or NULL */ byte* buf, /*!< out: buffer from which to read; in aio this must be appropriately aligned */ - ulint len, /*!< in: length of output buffer.*/ + ulong len, /*!< in: length of output buffer.*/ ulint* write_size); /*!< in/out: Actual payload size of the compressed data. */