Commit fa9f5f63 authored by Jan Lindström's avatar Jan Lindström

Removed unnecessary files and set lz4 under HAVE_LZ4 compiler

option using cmake find_library. Fixed bunch of compiler
warnings.
parent a5cf3a80
# Copyright (C) 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
# Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
MACRO (MYSQL_CHECK_LZ4)
CHECK_INCLUDE_FILES(lz4.h HAVE_LZ4_H)
CHECK_LIBRARY_EXISTS(liblz4.a LZ4_compress_limitedOutput "" HAVE_LZ4_LIB)
IF(HAVE_LZ4_LIB AND HAVE_LZ4_H)
ADD_DEFINITIONS(-DHAVE_LZ4=1)
LINK_LIBRARIES(liblz4.a)
ENDIF()
ENDMACRO()
MACRO (MYSQL_CHECK_SHARED_LZ4)
CHECK_INCLUDE_FILES(lz4.h HAVE_LZ4_H)
CHECK_LIBRARY_EXISTS(lz4 LZ4_compress_limitedOutput "" HAVE_LZ4_SHARED_LIB)
IF (HAVE_LZ4_SHARED_LIB AND HAVE_LZ4_H)
ADD_DEFINITIONS(-DHAVE_LZ4=1)
LINK_LIBRARIES(lz4)
ENDIF()
ENDMACRO()
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
INCLUDE(CheckFunctionExists) INCLUDE(CheckFunctionExists)
INCLUDE(CheckCSourceCompiles) INCLUDE(CheckCSourceCompiles)
INCLUDE(CheckCSourceRuns) INCLUDE(CheckCSourceRuns)
INCLUDE(lz4)
MYSQL_CHECK_LZ4()
# OS tests # OS tests
IF(UNIX) IF(UNIX)
...@@ -293,7 +296,6 @@ SET(INNOBASE_SOURCES ...@@ -293,7 +296,6 @@ SET(INNOBASE_SOURCES
eval/eval0proc.cc eval/eval0proc.cc
fil/fil0fil.cc fil/fil0fil.cc
fil/fil0pagecompress.cc fil/fil0pagecompress.cc
fil/lz4.c
fsp/fsp0fsp.cc fsp/fsp0fsp.cc
fut/fut0fut.cc fut/fut0fut.cc
fut/fut0lst.cc fut/fut0lst.cc
......
...@@ -2390,7 +2390,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)( ...@@ -2390,7 +2390,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)(
ulint next_loop_time = ut_time_ms() + 1000; ulint next_loop_time = ut_time_ms() + 1000;
ulint n_flushed = 0; ulint n_flushed = 0;
ulint last_activity = srv_get_activity_count(); ulint last_activity = srv_get_activity_count();
ulint n_lru=0, n_pgc_flush=0, n_pgc_batch=0; ulint n_lru=0;
ut_ad(!srv_read_only_mode); ut_ad(!srv_read_only_mode);
...@@ -2429,15 +2429,10 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)( ...@@ -2429,15 +2429,10 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)(
#endif #endif
/* Flush pages from flush_list if required */ /* Flush pages from flush_list if required */
n_flushed += n_pgc_flush = page_cleaner_flush_pages_if_needed(); n_flushed += page_cleaner_flush_pages_if_needed();
#ifdef UNIV_DEBUG
if (n_pgc_flush) {
fprintf(stderr,"n_pgc_flush:%lu ",n_pgc_flush);
}
#endif
} else { } else {
n_pgc_batch = n_flushed = page_cleaner_do_flush_batch( n_flushed = page_cleaner_do_flush_batch(
PCT_IO(100), PCT_IO(100),
LSN_MAX); LSN_MAX);
...@@ -2448,21 +2443,11 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)( ...@@ -2448,21 +2443,11 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)(
MONITOR_FLUSH_BACKGROUND_PAGES, MONITOR_FLUSH_BACKGROUND_PAGES,
n_flushed); n_flushed);
} }
#ifdef UNIV_DEBUG
if (n_pgc_batch) {
fprintf(stderr,"n_pgc_batch:%lu ",n_pgc_batch);
}
#endif
} }
#ifdef UNIV_DEBUG
if (n_lru || n_pgc_flush || n_pgc_batch) {
fprintf(stderr,"\n");
n_lru = n_pgc_flush = n_pgc_batch = 0;
}
#endif
} }
ut_ad(srv_shutdown_state > 0); ut_ad(srv_shutdown_state > 0);
if (srv_fast_shutdown == 2) { if (srv_fast_shutdown == 2) {
/* In very fast shutdown we simulate a crash of /* In very fast shutdown we simulate a crash of
buffer pool. We are not required to do any flushing */ buffer pool. We are not required to do any flushing */
......
...@@ -548,7 +548,7 @@ buf_mtflu_flush_work_items( ...@@ -548,7 +548,7 @@ buf_mtflu_flush_work_items(
if((int)done_wi->id_usr == -1 && if((int)done_wi->id_usr == -1 &&
done_wi->wi_status == WRK_ITEM_SET ) { done_wi->wi_status == WRK_ITEM_SET ) {
fprintf(stderr, fprintf(stderr,
"**Set/Unused work_item[%lu] flush_type=%lu\n", "**Set/Unused work_item[%lu] flush_type=%d\n",
i, i,
done_wi->wr.flush_type); done_wi->wr.flush_type);
ut_a(0); ut_a(0);
......
...@@ -63,7 +63,9 @@ static ulint srv_data_read, srv_data_written; ...@@ -63,7 +63,9 @@ static ulint srv_data_read, srv_data_written;
#include <linux/falloc.h> #include <linux/falloc.h>
#endif #endif
#include "row0mysql.h" #include "row0mysql.h"
#ifdef HAVE_LZ4
#include "lz4.h" #include "lz4.h"
#endif
/****************************************************************//** /****************************************************************//**
For page compressed pages compress the page before actual write For page compressed pages compress the page before actual write
...@@ -108,10 +110,11 @@ fil_compress_page( ...@@ -108,10 +110,11 @@ fil_compress_page(
fprintf(stderr, fprintf(stderr,
"InnoDB: Note: Preparing for compress for space %lu name %s len %lu\n", "InnoDB: Note: Preparing for compress for space %lu name %s len %lu\n",
space_id, fil_space_name(space), len); space_id, fil_space_name(space), len);
#endif #endif /* UNIV_DEBUG */
write_size = UNIV_PAGE_SIZE - header_len; write_size = UNIV_PAGE_SIZE - header_len;
#ifdef HAVE_LZ4
if (srv_use_lz4) { if (srv_use_lz4) {
err = LZ4_compress_limitedOutput((const char *)buf, (char *)out_buf+header_len, len, write_size); err = LZ4_compress_limitedOutput((const char *)buf, (char *)out_buf+header_len, len, write_size);
write_size = err; write_size = err;
...@@ -127,6 +130,7 @@ fil_compress_page( ...@@ -127,6 +130,7 @@ fil_compress_page(
return (buf); return (buf);
} }
} else { } else {
#endif /* HAVE_LZ4 */
err = compress2(out_buf+header_len, &write_size, buf, len, level); err = compress2(out_buf+header_len, &write_size, buf, len, level);
if (err != Z_OK) { if (err != Z_OK) {
...@@ -139,7 +143,9 @@ fil_compress_page( ...@@ -139,7 +143,9 @@ fil_compress_page(
*out_len = len; *out_len = len;
return (buf); return (buf);
} }
#ifdef HAVE_LZ4
} }
#endif /* HAVE_LZ4 */
/* Set up the page header */ /* Set up the page header */
memcpy(out_buf, buf, FIL_PAGE_DATA); memcpy(out_buf, buf, FIL_PAGE_DATA);
...@@ -148,11 +154,18 @@ fil_compress_page( ...@@ -148,11 +154,18 @@ fil_compress_page(
/* Set up the correct page type */ /* Set up the correct page type */
mach_write_to_2(out_buf+FIL_PAGE_TYPE, FIL_PAGE_PAGE_COMPRESSED); mach_write_to_2(out_buf+FIL_PAGE_TYPE, FIL_PAGE_PAGE_COMPRESSED);
/* Set up the flush lsn to be compression algorithm */ /* Set up the flush lsn to be compression algorithm */
#ifdef HAVE_LZ4
if (srv_use_lz4) { if (srv_use_lz4) {
mach_write_to_8(out_buf+FIL_PAGE_FILE_FLUSH_LSN, FIL_PAGE_COMPRESSION_LZ4); mach_write_to_8(out_buf+FIL_PAGE_FILE_FLUSH_LSN, FIL_PAGE_COMPRESSION_LZ4);
} else { } else {
#endif /* HAVE_LZ4 */
mach_write_to_8(out_buf+FIL_PAGE_FILE_FLUSH_LSN, FIL_PAGE_COMPRESSION_ZLIB); mach_write_to_8(out_buf+FIL_PAGE_FILE_FLUSH_LSN, FIL_PAGE_COMPRESSION_ZLIB);
#ifdef HAVE_LZ4
} }
#endif /* HAVE_LZ4 */
/* Set up the actual payload lenght */ /* Set up the actual payload lenght */
mach_write_to_2(out_buf+FIL_PAGE_DATA, write_size); mach_write_to_2(out_buf+FIL_PAGE_DATA, write_size);
...@@ -161,12 +174,18 @@ fil_compress_page( ...@@ -161,12 +174,18 @@ fil_compress_page(
ut_ad(fil_page_is_compressed(out_buf)); 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_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_2(out_buf+FIL_PAGE_DATA) == write_size);
#ifdef HAVE_LZ4
if (srv_use_lz4) { if (srv_use_lz4) {
ut_ad(mach_read_from_8(out_buf+FIL_PAGE_FILE_FLUSH_LSN) == FIL_PAGE_COMPRESSION_LZ4); ut_ad(mach_read_from_8(out_buf+FIL_PAGE_FILE_FLUSH_LSN) == FIL_PAGE_COMPRESSION_LZ4);
} else { } else {
#endif /* HAVE_LZ4 */
ut_ad(mach_read_from_8(out_buf+FIL_PAGE_FILE_FLUSH_LSN) == FIL_PAGE_COMPRESSION_ZLIB); ut_ad(mach_read_from_8(out_buf+FIL_PAGE_FILE_FLUSH_LSN) == FIL_PAGE_COMPRESSION_ZLIB);
#ifdef HAVE_LZ4
} }
#endif #endif /* HAVE_LZ4 */
#endif /* UNIV_DEBUG */
write_size+=header_len; write_size+=header_len;
/* Actual write needs to be alligned on block size */ /* Actual write needs to be alligned on block size */
...@@ -236,8 +255,8 @@ fil_decompress_page( ...@@ -236,8 +255,8 @@ fil_decompress_page(
if (page_buf == NULL) { if (page_buf == NULL) {
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
fprintf(stderr, fprintf(stderr,
"InnoDB: Note: Compression buffer not given, allocating...\n"); "InnoDB: Note: FIL: Compression buffer not given, allocating...\n");
#endif #endif /* UNIV_DEBUG */
in_buf = static_cast<byte *>(ut_malloc(UNIV_PAGE_SIZE)); in_buf = static_cast<byte *>(ut_malloc(UNIV_PAGE_SIZE));
} else { } else {
in_buf = page_buf; in_buf = page_buf;
...@@ -261,7 +280,7 @@ fil_decompress_page( ...@@ -261,7 +280,7 @@ fil_decompress_page(
fprintf(stderr, fprintf(stderr,
"InnoDB: Note: Preparing for decompress for len %lu\n", "InnoDB: Note: Preparing for decompress for len %lu\n",
actual_size); actual_size);
#endif #endif /* UNIV_DEBUG */
err= uncompress(in_buf, &len, buf+FIL_PAGE_DATA+FIL_PAGE_COMPRESSED_SIZE, (unsigned long)actual_size); err= uncompress(in_buf, &len, buf+FIL_PAGE_DATA+FIL_PAGE_COMPRESSED_SIZE, (unsigned long)actual_size);
...@@ -284,11 +303,12 @@ fil_decompress_page( ...@@ -284,11 +303,12 @@ fil_decompress_page(
fprintf(stderr, fprintf(stderr,
"InnoDB: Note: Decompression succeeded for len %lu \n", "InnoDB: Note: Decompression succeeded for len %lu \n",
len); len);
#endif #endif /* UNIV_DEBUG */
#ifdef HAVE_LZ4
} else if (compression_alg == FIL_PAGE_COMPRESSION_LZ4) { } else if (compression_alg == FIL_PAGE_COMPRESSION_LZ4) {
err = LZ4_decompress_fast((const char *)buf+FIL_PAGE_DATA+FIL_PAGE_COMPRESSED_SIZE, (char *)in_buf, UNIV_PAGE_SIZE); err = LZ4_decompress_fast((const char *)buf+FIL_PAGE_DATA+FIL_PAGE_COMPRESSED_SIZE, (char *)in_buf, UNIV_PAGE_SIZE);
if (err != actual_size) { if (err != (int)actual_size) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Corruption: Page is marked as compressed\n" "InnoDB: Corruption: Page is marked as compressed\n"
"InnoDB: but decompression read only %d bytes.\n" "InnoDB: but decompression read only %d bytes.\n"
...@@ -298,6 +318,7 @@ fil_decompress_page( ...@@ -298,6 +318,7 @@ fil_decompress_page(
ut_error; ut_error;
} }
#endif /* HAVE_LZ4 */
} else { } else {
fprintf(stderr, fprintf(stderr,
"InnoDB: Corruption: Page is marked as compressed\n" "InnoDB: Corruption: Page is marked as compressed\n"
......
This diff is collapsed.
This diff is collapsed.
...@@ -16607,11 +16607,12 @@ static MYSQL_SYSVAR_BOOL(use_trim, srv_use_trim, ...@@ -16607,11 +16607,12 @@ static MYSQL_SYSVAR_BOOL(use_trim, srv_use_trim,
"Use trim.", "Use trim.",
NULL, NULL, TRUE); NULL, NULL, TRUE);
#ifdef HAVE_LZ4
static MYSQL_SYSVAR_BOOL(use_lz4, srv_use_lz4, static MYSQL_SYSVAR_BOOL(use_lz4, srv_use_lz4,
PLUGIN_VAR_OPCMDARG , PLUGIN_VAR_OPCMDARG ,
"Use LZ4 for page compression", "Use LZ4 for page compression",
NULL, NULL, FALSE); NULL, NULL, FALSE);
#endif /* HAVE_LZ4 */
static struct st_mysql_sys_var* innobase_system_variables[]= { static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(additional_mem_pool_size), MYSQL_SYSVAR(additional_mem_pool_size),
......
...@@ -54,12 +54,12 @@ dict_tf_verify_flags( ...@@ -54,12 +54,12 @@ dict_tf_verify_flags(
DBUG_EXECUTE_IF("dict_tf_verify_flags_failure", DBUG_EXECUTE_IF("dict_tf_verify_flags_failure",
return(ULINT_UNDEFINED);); return(ULINT_UNDEFINED););
ut_ad(!table_unused); ut_a(!table_unused);
ut_ad(!fsp_unused); ut_a(!fsp_unused);
ut_ad(page_ssize == 0 || page_ssize != 0); /* silence compiler */ ut_a(page_ssize == 0 || page_ssize != 0); /* silence compiler */
ut_ad(compact == 0 || compact == 1); /* silence compiler */ ut_a(compact == 0 || compact == 1); /* silence compiler */
ut_ad(data_dir == 0 || data_dir == 1); /* silence compiler */ ut_a(data_dir == 0 || data_dir == 1); /* silence compiler */
ut_ad(post_antelope == 0 || post_antelope == 1); /* silence compiler */ ut_a(post_antelope == 0 || post_antelope == 1); /* silence compiler */
if (ssize != zip_ssize) { if (ssize != zip_ssize) {
fprintf(stderr, fprintf(stderr,
......
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
INCLUDE(CheckFunctionExists) INCLUDE(CheckFunctionExists)
INCLUDE(CheckCSourceCompiles) INCLUDE(CheckCSourceCompiles)
INCLUDE(CheckCSourceRuns) INCLUDE(CheckCSourceRuns)
INCLUDE(lz4)
MYSQL_CHECK_SHARED_LZ4()
# OS tests # OS tests
IF(UNIX) IF(UNIX)
...@@ -299,7 +302,6 @@ SET(INNOBASE_SOURCES ...@@ -299,7 +302,6 @@ SET(INNOBASE_SOURCES
eval/eval0proc.cc eval/eval0proc.cc
fil/fil0fil.cc fil/fil0fil.cc
fil/fil0pagecompress.cc fil/fil0pagecompress.cc
fil/lz4.c
fsp/fsp0fsp.cc fsp/fsp0fsp.cc
fut/fut0fut.cc fut/fut0fut.cc
fut/fut0lst.cc fut/fut0lst.cc
......
...@@ -1863,8 +1863,10 @@ buf_flush_start( ...@@ -1863,8 +1863,10 @@ buf_flush_start(
/* There is already a flush batch of the same type running */ /* There is already a flush batch of the same type running */
fprintf(stderr, "Error: flush_type %d n_flush %lu init_flush\n", #ifdef UNIV_DEBUG
fprintf(stderr, "Error: flush_type %d n_flush %lu init_flush %lu\n",
flush_type, buf_pool->n_flush[flush_type], buf_pool->init_flush[flush_type]); flush_type, buf_pool->n_flush[flush_type], buf_pool->init_flush[flush_type]);
#endif
mutex_exit(&buf_pool->flush_state_mutex); mutex_exit(&buf_pool->flush_state_mutex);
......
...@@ -554,7 +554,7 @@ buf_mtflu_flush_work_items( ...@@ -554,7 +554,7 @@ buf_mtflu_flush_work_items(
if((int)done_wi->id_usr == -1 && if((int)done_wi->id_usr == -1 &&
done_wi->wi_status == WRK_ITEM_SET ) { done_wi->wi_status == WRK_ITEM_SET ) {
fprintf(stderr, fprintf(stderr,
"**Set/Unused work_item[%lu] flush_type=%lu\n", "**Set/Unused work_item[%lu] flush_type=%d\n",
i, i,
done_wi->wr.flush_type); done_wi->wr.flush_type);
ut_a(0); ut_a(0);
......
...@@ -63,7 +63,9 @@ static ulint srv_data_read, srv_data_written; ...@@ -63,7 +63,9 @@ static ulint srv_data_read, srv_data_written;
#include <linux/falloc.h> #include <linux/falloc.h>
#endif #endif
#include "row0mysql.h" #include "row0mysql.h"
#ifdef HAVE_LZ4
#include "lz4.h" #include "lz4.h"
#endif
/****************************************************************//** /****************************************************************//**
For page compressed pages compress the page before actual write For page compressed pages compress the page before actual write
...@@ -108,10 +110,11 @@ fil_compress_page( ...@@ -108,10 +110,11 @@ fil_compress_page(
fprintf(stderr, fprintf(stderr,
"InnoDB: Note: Preparing for compress for space %lu name %s len %lu\n", "InnoDB: Note: Preparing for compress for space %lu name %s len %lu\n",
space_id, fil_space_name(space), len); space_id, fil_space_name(space), len);
#endif #endif /* UNIV_DEBUG */
write_size = UNIV_PAGE_SIZE - header_len; write_size = UNIV_PAGE_SIZE - header_len;
#ifdef HAVE_LZ4
if (srv_use_lz4) { if (srv_use_lz4) {
err = LZ4_compress_limitedOutput((const char *)buf, (char *)out_buf+header_len, len, write_size); err = LZ4_compress_limitedOutput((const char *)buf, (char *)out_buf+header_len, len, write_size);
write_size = err; write_size = err;
...@@ -127,6 +130,7 @@ fil_compress_page( ...@@ -127,6 +130,7 @@ fil_compress_page(
return (buf); return (buf);
} }
} else { } else {
#endif /* HAVE_LZ4 */
err = compress2(out_buf+header_len, &write_size, buf, len, level); err = compress2(out_buf+header_len, &write_size, buf, len, level);
if (err != Z_OK) { if (err != Z_OK) {
...@@ -139,7 +143,9 @@ fil_compress_page( ...@@ -139,7 +143,9 @@ fil_compress_page(
*out_len = len; *out_len = len;
return (buf); return (buf);
} }
#ifdef HAVE_LZ4
} }
#endif /* HAVE_LZ4 */
/* Set up the page header */ /* Set up the page header */
memcpy(out_buf, buf, FIL_PAGE_DATA); memcpy(out_buf, buf, FIL_PAGE_DATA);
...@@ -148,11 +154,15 @@ fil_compress_page( ...@@ -148,11 +154,15 @@ fil_compress_page(
/* Set up the correct page type */ /* Set up the correct page type */
mach_write_to_2(out_buf+FIL_PAGE_TYPE, FIL_PAGE_PAGE_COMPRESSED); mach_write_to_2(out_buf+FIL_PAGE_TYPE, FIL_PAGE_PAGE_COMPRESSED);
/* Set up the flush lsn to be compression algorithm */ /* Set up the flush lsn to be compression algorithm */
#ifdef HAVE_LZ4
if (srv_use_lz4) { if (srv_use_lz4) {
mach_write_to_8(out_buf+FIL_PAGE_FILE_FLUSH_LSN, FIL_PAGE_COMPRESSION_LZ4); mach_write_to_8(out_buf+FIL_PAGE_FILE_FLUSH_LSN, FIL_PAGE_COMPRESSION_LZ4);
} else { } else {
#endif /* HAVE_LZ4 */
mach_write_to_8(out_buf+FIL_PAGE_FILE_FLUSH_LSN, FIL_PAGE_COMPRESSION_ZLIB); mach_write_to_8(out_buf+FIL_PAGE_FILE_FLUSH_LSN, FIL_PAGE_COMPRESSION_ZLIB);
#ifdef HAVE_LZ4
} }
#endif /* HAVE_LZ4 */
/* Set up the actual payload lenght */ /* Set up the actual payload lenght */
mach_write_to_2(out_buf+FIL_PAGE_DATA, write_size); mach_write_to_2(out_buf+FIL_PAGE_DATA, write_size);
...@@ -161,12 +171,17 @@ fil_compress_page( ...@@ -161,12 +171,17 @@ fil_compress_page(
ut_ad(fil_page_is_compressed(out_buf)); 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_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_2(out_buf+FIL_PAGE_DATA) == write_size);
#ifdef HAVE_LZ4
if (srv_use_lz4) { if (srv_use_lz4) {
ut_ad(mach_read_from_8(out_buf+FIL_PAGE_FILE_FLUSH_LSN) == FIL_PAGE_COMPRESSION_LZ4); ut_ad(mach_read_from_8(out_buf+FIL_PAGE_FILE_FLUSH_LSN) == FIL_PAGE_COMPRESSION_LZ4);
} else { } else {
#endif /* HAVE_LZ4 */
ut_ad(mach_read_from_8(out_buf+FIL_PAGE_FILE_FLUSH_LSN) == FIL_PAGE_COMPRESSION_ZLIB); ut_ad(mach_read_from_8(out_buf+FIL_PAGE_FILE_FLUSH_LSN) == FIL_PAGE_COMPRESSION_ZLIB);
#ifdef HAVE_LZ4
} }
#endif #endif /* HAVE_LZ4 */
#endif /* UNIV_DEBUG */
write_size+=header_len; write_size+=header_len;
/* Actual write needs to be alligned on block size */ /* Actual write needs to be alligned on block size */
...@@ -178,7 +193,7 @@ fil_compress_page( ...@@ -178,7 +193,7 @@ fil_compress_page(
fprintf(stderr, fprintf(stderr,
"InnoDB: Note: Compression succeeded for space %lu name %s len %lu out_len %lu\n", "InnoDB: Note: Compression succeeded for space %lu name %s len %lu out_len %lu\n",
space_id, fil_space_name(space), len, write_size); space_id, fil_space_name(space), len, write_size);
#endif #endif /* UNIV_DEBUG */
#define SECT_SIZE 512 #define SECT_SIZE 512
...@@ -236,8 +251,8 @@ fil_decompress_page( ...@@ -236,8 +251,8 @@ fil_decompress_page(
if (page_buf == NULL) { if (page_buf == NULL) {
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
fprintf(stderr, fprintf(stderr,
"InnoDB: Note: Compression buffer not given, allocating...\n"); "InnoDB: FIL: Note: Compression buffer not given, allocating...\n");
#endif #endif /* UNIV_DEBUG */
in_buf = static_cast<byte *>(ut_malloc(UNIV_PAGE_SIZE)); in_buf = static_cast<byte *>(ut_malloc(UNIV_PAGE_SIZE));
} else { } else {
in_buf = page_buf; in_buf = page_buf;
...@@ -261,11 +276,10 @@ fil_decompress_page( ...@@ -261,11 +276,10 @@ fil_decompress_page(
fprintf(stderr, fprintf(stderr,
"InnoDB: Note: Preparing for decompress for len %lu\n", "InnoDB: Note: Preparing for decompress for len %lu\n",
actual_size); actual_size);
#endif #endif /* UNIV_DEBUG */
err= uncompress(in_buf, &len, buf+FIL_PAGE_DATA+FIL_PAGE_COMPRESSED_SIZE, (unsigned long)actual_size); err= uncompress(in_buf, &len, buf+FIL_PAGE_DATA+FIL_PAGE_COMPRESSED_SIZE, (unsigned long)actual_size);
/* If uncompress fails it means that page is corrupted */ /* If uncompress fails it means that page is corrupted */
if (err != Z_OK) { if (err != Z_OK) {
...@@ -284,11 +298,12 @@ fil_decompress_page( ...@@ -284,11 +298,12 @@ fil_decompress_page(
fprintf(stderr, fprintf(stderr,
"InnoDB: Note: Decompression succeeded for len %lu \n", "InnoDB: Note: Decompression succeeded for len %lu \n",
len); len);
#endif #endif /* UNIV_DEBUG */
#ifdef HAVE_LZ4
} else if (compression_alg == FIL_PAGE_COMPRESSION_LZ4) { } else if (compression_alg == FIL_PAGE_COMPRESSION_LZ4) {
err = LZ4_decompress_fast((const char *)buf+FIL_PAGE_DATA+FIL_PAGE_COMPRESSED_SIZE, (char *)in_buf, UNIV_PAGE_SIZE); err = LZ4_decompress_fast((const char *)buf+FIL_PAGE_DATA+FIL_PAGE_COMPRESSED_SIZE, (char *)in_buf, UNIV_PAGE_SIZE);
if (err != actual_size) { if (err != (int)actual_size) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Corruption: Page is marked as compressed\n" "InnoDB: Corruption: Page is marked as compressed\n"
"InnoDB: but decompression read only %d bytes.\n" "InnoDB: but decompression read only %d bytes.\n"
...@@ -298,6 +313,7 @@ fil_decompress_page( ...@@ -298,6 +313,7 @@ fil_decompress_page(
ut_error; ut_error;
} }
#endif /* HAVE_LZ4 */
} else { } else {
fprintf(stderr, fprintf(stderr,
"InnoDB: Corruption: Page is marked as compressed\n" "InnoDB: Corruption: Page is marked as compressed\n"
......
This diff is collapsed.
This diff is collapsed.
...@@ -17968,10 +17968,12 @@ static MYSQL_SYSVAR_BOOL(use_trim, srv_use_trim, ...@@ -17968,10 +17968,12 @@ static MYSQL_SYSVAR_BOOL(use_trim, srv_use_trim,
"Use trim.", "Use trim.",
NULL, NULL, TRUE); NULL, NULL, TRUE);
#ifdef HAVE_LZ4
static MYSQL_SYSVAR_BOOL(use_lz4, srv_use_lz4, static MYSQL_SYSVAR_BOOL(use_lz4, srv_use_lz4,
PLUGIN_VAR_OPCMDARG , PLUGIN_VAR_OPCMDARG ,
"Use LZ4 for page compression", "Use LZ4 for page compression",
NULL, NULL, FALSE); NULL, NULL, FALSE);
#endif /* HAVE_LZ4 */
static struct st_mysql_sys_var* innobase_system_variables[]= { static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(log_block_size), MYSQL_SYSVAR(log_block_size),
......
...@@ -54,12 +54,12 @@ dict_tf_verify_flags( ...@@ -54,12 +54,12 @@ dict_tf_verify_flags(
DBUG_EXECUTE_IF("dict_tf_verify_flags_failure", DBUG_EXECUTE_IF("dict_tf_verify_flags_failure",
return(ULINT_UNDEFINED);); return(ULINT_UNDEFINED););
ut_ad(!table_unused); ut_a(!table_unused);
ut_ad(!fsp_unused); ut_a(!fsp_unused);
ut_ad(page_ssize == 0 || page_ssize != 0); /* silence compiler */ ut_a(page_ssize == 0 || page_ssize != 0); /* silence compiler */
ut_ad(compact == 0 || compact == 1); /* silence compiler */ ut_a(compact == 0 || compact == 1); /* silence compiler */
ut_ad(data_dir == 0 || data_dir == 1); /* silence compiler */ ut_a(data_dir == 0 || data_dir == 1); /* silence compiler */
ut_ad(post_antelope == 0 || post_antelope == 1); /* silence compiler */ ut_a(post_antelope == 0 || post_antelope == 1); /* silence compiler */
if (ssize != zip_ssize) { if (ssize != zip_ssize) {
fprintf(stderr, fprintf(stderr,
......
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