summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-01-16 14:03:36 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2017-01-18 08:30:42 +0200
commit1eabad5dbe1caa23b27dd954ba0d435c91516776 (patch)
tree98f8bfbd7ca363d635e6dc88edba83a3577f06d9
parent70c11485d2d5982ffbf31740b24798565760a16f (diff)
downloadmariadb-git-1eabad5dbe1caa23b27dd954ba0d435c91516776.tar.gz
Remove MYSQL_COMPRESSION.
The MariaDB 10.1 page_compression is incompatible with the Oracle implementation that was introduced in MySQL 5.7 later. Remove the Oracle implementation. Also remove the remaining traces of MYSQL_ENCRYPTION. This will also remove traces of PUNCH_HOLE until it is implemented better. The only effective call to os_file_punch_hole() was in fil_node_create_low() to test if the operation is supported for the file. In other words, it looks like page_compression is not working in MariaDB 10.2, because no code equivalent to the 10.1 os_file_trim() is enabled.
-rw-r--r--storage/innobase/buf/buf0buf.cc53
-rw-r--r--storage/innobase/buf/buf0dblwr.cc14
-rw-r--r--storage/innobase/fil/fil0fil.cc212
-rw-r--r--storage/innobase/fil/fil0pagecompress.cc26
-rw-r--r--storage/innobase/fsp/fsp0file.cc30
-rw-r--r--storage/innobase/fts/fts0fts.cc4
-rw-r--r--storage/innobase/handler/ha_innodb.cc304
-rw-r--r--storage/innobase/handler/ha_innodb.h3
-rw-r--r--storage/innobase/handler/handler0alter.cc36
-rw-r--r--storage/innobase/include/buf0buf.h1
-rw-r--r--storage/innobase/include/buf0buf.ic3
-rw-r--r--storage/innobase/include/db0err.h12
-rw-r--r--storage/innobase/include/fil0fil.h56
-rw-r--r--storage/innobase/include/fil0fil.ic94
-rw-r--r--storage/innobase/include/ha_prototypes.h1
-rw-r--r--storage/innobase/include/os0file.h305
-rw-r--r--storage/innobase/include/os0file.ic2
-rw-r--r--storage/innobase/include/row0mysql.h3
-rw-r--r--storage/innobase/include/srv0srv.h5
-rw-r--r--storage/innobase/innodb.cmake19
-rw-r--r--storage/innobase/os/os0file.cc1217
-rw-r--r--storage/innobase/row/row0merge.cc5
-rw-r--r--storage/innobase/row/row0mysql.cc38
-rw-r--r--storage/innobase/row/row0trunc.cc6
-rw-r--r--storage/innobase/srv/srv0srv.cc2
-rw-r--r--storage/innobase/srv/srv0start.cc8
-rw-r--r--storage/innobase/trx/trx0purge.cc6
-rw-r--r--storage/innobase/ut/ut0ut.cc8
28 files changed, 102 insertions, 2371 deletions
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index 2f4edfb5014..315c951a9fe 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -5943,7 +5943,6 @@ buf_page_io_complete(
ulint read_page_no;
ulint read_space_id;
byte* frame = NULL;
- bool compressed_page=false;
ut_ad(bpage->zip.data != NULL || ((buf_block_t*)bpage)->frame != NULL);
@@ -5957,8 +5956,6 @@ buf_page_io_complete(
ib::info() << "Page "
<< bpage->id
- << " in tablespace "
- << bpage->space
<< " encryption error key_version "
<< bpage->key_version;
@@ -5974,12 +5971,9 @@ buf_page_io_complete(
FALSE)) {
buf_pool->n_pend_unzip--;
- compressed_page = false;
ib::info() << "Page "
<< bpage->id
- << " in tablespace "
- << bpage->space
<< " zip_decompress failure.";
goto database_corrupted;
@@ -6005,13 +5999,13 @@ buf_page_io_complete(
} else if (read_space_id == 0 && read_page_no == 0) {
/* This is likely an uninitialized page. */
- } else if ((bpage->id.space() != 0
+ } else if ((bpage->id.space() != TRX_SYS_SPACE
&& bpage->id.space() != read_space_id)
|| bpage->id.page_no() != read_page_no) {
/* We did not compare space_id to read_space_id
- if bpage->space == 0, because the field on the
- page may contain garbage in MySQL < 4.1.1,
- which only supported bpage->space == 0. */
+ in the system tablespace, because the field
+ was written as garbage before MySQL 4.1.1,
+ which did not support innodb_file_per_table. */
ib::error() << "Space id and page no stored in "
"the page, read in are "
@@ -6019,37 +6013,16 @@ buf_page_io_complete(
<< ", should be " << bpage->id;
}
-#ifdef MYSQL_COMPRESSION
- compressed_page = Compression::is_compressed_page(frame);
-
- /* If the decompress failed then the most likely case is
- that we are reading in a page for which this instance doesn't
- support the compression algorithm. */
- if (compressed_page) {
-
- Compression::meta_t meta;
-
- Compression::deserialize_header(frame, &meta);
-
- ib::error()
- << "Page " << bpage->id << " "
- << "compressed with "
- << Compression::to_string(meta) << " "
- << "that is not supported by this instance";
- }
-#endif /* MYSQL_COMPRESSION */
-
/* From version 3.23.38 up we store the page checksum
to the 4 first bytes of the page end lsn field */
- if (compressed_page
- || buf_page_is_corrupted(
+ if (buf_page_is_corrupted(
true, frame, bpage->size,
fsp_is_checksum_disabled(bpage->id.space()))) {
/* Not a real corruption if it was triggered by
error injection */
DBUG_EXECUTE_IF("buf_page_is_corrupt_failure",
- if (bpage->space > TRX_SYS_SPACE
+ if (bpage->id.space() != TRX_SYS_SPACE
&& buf_mark_space_corrupt(bpage)) {
ib::info() <<
"Simulated page corruption";
@@ -6076,7 +6049,7 @@ database_corrupted:
/* Compressed and encrypted pages are basically gibberish avoid
printing the contents. */
- if (corrupted && !compressed_page) {
+ if (corrupted) {
ib::error()
<< "Database page corruption on disk"
@@ -6124,11 +6097,11 @@ database_corrupted:
}
ib_push_warning((void *)NULL, DB_DECRYPTION_FAILED,
- "Table in tablespace %lu encrypted."
+ "Table in tablespace %u encrypted."
"However key management plugin or used key_id %u is not found or"
" used encryption algorithm or method does not match."
" Can't continue opening the table.",
- (ulint)bpage->space, key_version);
+ bpage->id.space(), key_version);
buf_page_print(frame, bpage->size, BUF_PAGE_PRINT_NO_CRASH);
@@ -6152,9 +6125,6 @@ database_corrupted:
/* If space is being truncated then avoid ibuf operation.
During re-init we have already freed ibuf entries. */
if (uncompressed
-#ifdef MYSQL_COMPRESSION
- && !Compression::is_compressed_page(frame)
-#endif /* MYSQL_COMPRESSION */
&& !recv_no_ibuf_operations
&& !Tablespace::is_undo_tablespace(bpage->id.space())
&& bpage->id.space() != SRV_TMP_SPACE_ID
@@ -6164,11 +6134,11 @@ database_corrupted:
if (bpage && bpage->encrypted) {
fprintf(stderr,
- "InnoDB: Warning: Table in tablespace %lu encrypted."
+ "InnoDB: Warning: Table in tablespace %u encrypted."
"However key management plugin or used key_id %u is not found or"
" used encryption algorithm or method does not match."
" Can't continue opening the table.\n",
- (ulint)bpage->space, bpage->key_version);
+ bpage->id.space(), bpage->key_version);
} else {
ibuf_merge_or_delete_for_page(
(buf_block_t*) bpage, bpage->id,
@@ -7604,7 +7574,6 @@ buf_page_decrypt_after_read(
bpage->key_version = key_version;
bpage->page_encrypted = page_compressed_encrypted;
bpage->page_compressed = page_compressed;
- bpage->space = bpage->id.space();
if (page_compressed) {
/* the page we read is unencrypted */
diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc
index 5f46576ad7e..f555875559d 100644
--- a/storage/innobase/buf/buf0dblwr.cc
+++ b/storage/innobase/buf/buf0dblwr.cc
@@ -380,8 +380,6 @@ buf_dblwr_init_or_load_pages(
IORequest read_request(IORequest::READ);
- read_request.disable_compression();
-
err = os_file_read(
read_request,
file, read_buf, TRX_SYS_PAGE_NO * UNIV_PAGE_SIZE,
@@ -496,11 +494,6 @@ buf_dblwr_init_or_load_pages(
IORequest write_request(IORequest::WRITE);
- /* Recovered data file pages are written out
- as uncompressed. */
-
- write_request.disable_compression();
-
err = os_file_write(
write_request, path, file, page,
source_page_no * UNIV_PAGE_SIZE,
@@ -704,20 +697,15 @@ buf_dblwr_process(void)
}
}
- /* Recovered data file pages are written out
- as uncompressed. */
-
IORequest write_request(IORequest::WRITE);
- write_request.disable_compression();
-
/* Write the good page from the doublewrite
buffer to the intended position. */
fil_io(write_request, true,
page_id, page_size,
0, page_size.physical(),
- const_cast<byte*>(page), NULL, NULL);
+ const_cast<byte*>(page), NULL, NULL);
ib::info()
<< "Recovered page "
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index a00b287dc3f..f8abe3c5f21 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -481,7 +481,6 @@ fil_space_is_flushed(
@param[in] size file size in entire database blocks
@param[in,out] space tablespace from fil_space_create()
@param[in] is_raw whether this is a raw device or partition
-@param[in] punch_hole true if supported for this node
@param[in] atomic_write true if the file could use atomic write
@param[in] max_pages maximum number of pages in file,
ULINT_MAX means the file size is unlimited.
@@ -494,7 +493,6 @@ fil_node_create_low(
ulint size,
fil_space_t* space,
bool is_raw,
- bool punch_hole,
bool atomic_write,
ulint max_pages = ULINT_MAX)
{
@@ -544,26 +542,6 @@ fil_node_create_low(
node->block_size = stat_info.block_size;
- /* In this debugging mode, we can overcome the limitation of some
- OSes like Windows that support Punch Hole but have a hole size
- effectively too large. By setting the block size to be half the
- page size, we can bypass one of the checks that would normally
- turn Page Compression off. This execution mode allows compression
- to be tested even when full punch hole support is not available. */
- DBUG_EXECUTE_IF("ignore_punch_hole",
- node->block_size = ut_min(stat_info.block_size,
- static_cast<size_t>(UNIV_PAGE_SIZE / 2));
- );
-
- if (!IORequest::is_punch_hole_supported()
- || !punch_hole
- || node->block_size >= srv_page_size) {
-
- fil_no_punch_hole(node);
- } else {
- node->punch_hole = punch_hole;
- }
-
node->atomic_write = atomic_write;
UT_LIST_ADD_LAST(space->chain, node);
@@ -595,8 +573,7 @@ fil_node_create(
fil_node_t* node;
node = fil_node_create_low(
- name, size, space, is_raw, IORequest::is_punch_hole_supported(),
- atomic_write, max_pages);
+ name, size, space, is_raw, atomic_write, max_pages);
return(node == NULL ? NULL : node->name);
}
@@ -3868,23 +3845,6 @@ fil_ibd_create(
return(DB_OUT_OF_FILE_SPACE);
}
- /* Note: We are actually punching a hole, previous contents will
- be lost after this call, if it succeeds. In this case the file
- should be full of NULs. */
-
- bool punch_hole = os_is_sparse_file_supported(path, file);
-
- if (punch_hole) {
-
- dberr_t punch_err;
-
- punch_err = os_file_punch_hole(file, 0, size * UNIV_PAGE_SIZE);
-
- if (punch_err != DB_SUCCESS) {
- punch_hole = false;
- }
- }
-
/* printf("Creating tablespace %s id %lu\n", path, space_id); */
/* We have to write the space id to the file immediately and flush the
@@ -3920,9 +3880,6 @@ fil_ibd_create(
err = os_file_write(
request, path, file, page, 0, page_size.physical());
-
- ut_ad(err != DB_IO_NO_PUNCH_HOLE);
-
} else {
page_zip_des_t page_zip;
page_zip_set_size(&page_zip, page_size.physical());
@@ -3940,10 +3897,6 @@ fil_ibd_create(
err = os_file_write(
request, path, file, page_zip.data, 0,
page_size.physical());
-
- ut_a(err != DB_IO_NO_PUNCH_HOLE);
-
- punch_hole = false;
}
ut_free(buf2);
@@ -3993,8 +3946,7 @@ fil_ibd_create(
? FIL_TYPE_TEMPORARY : FIL_TYPE_TABLESPACE,
crypt_data, true);
- if (!fil_node_create_low(
- path, size, space, false, punch_hole, TRUE)) {
+ if (!fil_node_create_low(path, size, space, false, true)) {
if (crypt_data) {
free(crypt_data);
@@ -4387,7 +4339,7 @@ skip_validate:
df_remote.is_open() ? df_remote.filepath() :
df_dict.is_open() ? df_dict.filepath() :
df_default.filepath(), 0, space, false,
- true, TRUE) == NULL) {
+ true) == NULL) {
err = DB_ERROR;
}
}
@@ -4750,8 +4702,7 @@ fil_ibd_load(
the rounding formula for extents and pages is somewhat complex; we
let fil_node_open() do that task. */
- if (!fil_node_create_low(file.filepath(), 0, space,
- false, true, false)) {
+ if (!fil_node_create_low(file.filepath(), 0, space, false, false)) {
ut_error;
}
@@ -5487,29 +5438,6 @@ fil_io(
const char* name = node->name == NULL ? space->name : node->name;
-#ifdef MYSQL_COMPRESSION
- /* Don't compress the log, page 0 of all tablespaces, tables
- compresssed with the old scheme and all pages from the system
- tablespace. */
-
- if (req_type.is_write()
- && !req_type.is_log()
- && !page_size.is_compressed()
- && page_id.page_no() > 0
- && IORequest::is_punch_hole_supported()
- && node->punch_hole) {
-
- ut_ad(!req_type.is_log());
-
- req_type.set_punch_hole();
-
- req_type.compression_algorithm(space->compression_type);
-
- } else {
- req_type.clear_compressed();
- }
-#endif /* MYSQL_COMPRESSION */
-
req_type.block_size(node->block_size);
/* Queue the aio request */
@@ -5520,20 +5448,6 @@ fil_io(
&& srv_read_only_mode,
node, message, write_size);
- if (err == DB_IO_NO_PUNCH_HOLE) {
-
- err = DB_SUCCESS;
-
- if (node->punch_hole) {
-
- ib::warn()
- << "Punch hole failed for '"
- << name << "'";
- }
-
- fil_no_punch_hole(node);
- }
-
/* We an try to recover the page from the double write buffer if
the decompression fails or the page is corrupt. */
@@ -6160,17 +6074,8 @@ fil_iterate(
iter.filepath, iter.file, writeptr,
offset, (ulint) n_bytes)) != DB_SUCCESS) {
- /* This is not a hard error */
- if (err == DB_IO_NO_PUNCH_HOLE) {
-
- err = DB_SUCCESS;
- write_type &= ~IORequest::PUNCH_HOLE;
-
- } else {
- ib::error() << "os_file_write() failed";
-
- return(err);
- }
+ ib::error() << "os_file_write() failed";
+ return(err);
}
}
@@ -6797,111 +6702,6 @@ truncate_t::truncate(
return(err);
}
-/**
-Note that the file system where the file resides doesn't support PUNCH HOLE.
-Called from AIO handlers when IO returns DB_IO_NO_PUNCH_HOLE
-@param[in,out] node Node to set */
-void
-fil_no_punch_hole(fil_node_t* node)
-{
- node->punch_hole = false;
-}
-
-#ifdef MYSQL_COMPRESSION
-
-/** Set the compression type for the tablespace of a table
-@param[in] table The table that should be compressed
-@param[in] algorithm Text representation of the algorithm
-@return DB_SUCCESS or error code */
-dberr_t
-fil_set_compression(
- dict_table_t* table,
- const char* algorithm)
-{
- ut_ad(table != NULL);
-
- /* We don't support Page Compression for the system tablespace,
- the temporary tablespace, or any general tablespace because
- COMPRESSION is set by TABLE DDL, not TABLESPACE DDL. There is
- no other technical reason. Also, do not use it for missing
- tables or tables with compressed row_format. */
- if (table->ibd_file_missing
- || !DICT_TF2_FLAG_IS_SET(table, DICT_TF2_USE_FILE_PER_TABLE)
- || DICT_TF2_FLAG_IS_SET(table, DICT_TF2_TEMPORARY)
- || page_size_t(table->flags).is_compressed()) {
-
- return(DB_IO_NO_PUNCH_HOLE_TABLESPACE);
- }
-
- dberr_t err;
- Compression compression;
-
- if (algorithm == NULL || strlen(algorithm) == 0) {
-
-#ifndef UNIV_DEBUG
- compression.m_type = Compression::NONE;
-#else
- /* This is a Debug tool for setting compression on all
- compressible tables not otherwise specified. */
- switch (srv_debug_compress) {
- case Compression::LZ4:
- case Compression::ZLIB:
- case Compression::NONE:
-
- compression.m_type =
- static_cast<Compression::Type>(
- srv_debug_compress);
- break;
-
- default:
- compression.m_type = Compression::NONE;
- }
-
-#endif /* UNIV_DEBUG */
-
- err = DB_SUCCESS;
-
- } else {
-
- err = Compression::check(algorithm, &compression);
- }
-
- fil_space_t* space = fil_space_get(table->space);
-
- if (space == NULL) {
- return(DB_NOT_FOUND);
- }
-
- space->compression_type = compression.m_type;
-
- if (space->compression_type != Compression::NONE) {
-
- const fil_node_t* node;
-
- node = UT_LIST_GET_FIRST(space->chain);
-
- if (!node->punch_hole) {
-
- return(DB_IO_NO_PUNCH_HOLE_FS);
- }
- }
-
- return(err);
-}
-
-/** Get the compression algorithm for a tablespace.
-@param[in] space_id Space ID to check
-@return the compression algorithm */
-Compression::Type
-fil_get_compression(
- ulint space_id)
-{
- fil_space_t* space = fil_space_get(space_id);
-
- return(space == NULL ? Compression::NONE : space->compression_type);
-}
-#endif /* MYSQL_COMPRESSION */
-
/** Build the basic folder name from the path and length provided
@param[in] path pathname (may also include the file basename)
@param[in] len length of the path, in bytes */
diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc
index cd2c62e00c1..8ebe4513b3f 100644
--- a/storage/innobase/fil/fil0pagecompress.cc
+++ b/storage/innobase/fil/fil0pagecompress.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (C) 2013, 2016, MariaDB Corporation. All Rights Reserved.
+Copyright (C) 2013, 2017, MariaDB Corporation. 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
@@ -415,21 +415,23 @@ fil_decompress_page(
ulint compression_alg = 0;
byte *in_buf;
ulint ptype;
- ulint header_len = FIL_PAGE_DATA + FIL_PAGE_COMPRESSED_SIZE;
+ ulint header_len;
ut_ad(buf);
ut_ad(len);
ptype = mach_read_from_2(buf+FIL_PAGE_TYPE);
- if (ptype == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
- header_len += FIL_PAGE_COMPRESSION_METHOD_SIZE;
- }
-
- /* Do not try to uncompressed pages that are not compressed */
- if (ptype != FIL_PAGE_PAGE_COMPRESSED &&
- ptype != FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED &&
- ptype != FIL_PAGE_COMPRESSED) {
+ switch (ptype) {
+ case FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED:
+ header_len = FIL_PAGE_DATA + FIL_PAGE_COMPRESSED_SIZE
+ + FIL_PAGE_COMPRESSION_METHOD_SIZE;
+ break;
+ case FIL_PAGE_PAGE_COMPRESSED:
+ header_len = FIL_PAGE_DATA + FIL_PAGE_COMPRESSED_SIZE;
+ break;
+ default:
+ /* The page is not in our format. */
return;
}
@@ -443,9 +445,7 @@ fil_decompress_page(
/* Before actual decompress, make sure that page type is correct */
- if (mach_read_from_4(buf+FIL_PAGE_SPACE_OR_CHKSUM) != BUF_NO_CHECKSUM_MAGIC ||
- (ptype != FIL_PAGE_PAGE_COMPRESSED &&
- ptype != FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED)) {
+ if (mach_read_from_4(buf+FIL_PAGE_SPACE_OR_CHKSUM) != BUF_NO_CHECKSUM_MAGIC) {
ib::error() << "Corruption: We try to uncompress corrupted page:"
<< " CRC "
<< mach_read_from_4(buf+FIL_PAGE_SPACE_OR_CHKSUM)
diff --git a/storage/innobase/fsp/fsp0file.cc b/storage/innobase/fsp/fsp0file.cc
index 3b89da2301b..600de5418bd 100644
--- a/storage/innobase/fsp/fsp0file.cc
+++ b/storage/innobase/fsp/fsp0file.cc
@@ -682,30 +682,7 @@ Datafile::find_space_id()
err = os_file_read(
request, m_handle, page, n_bytes, page_size);
- if (err == DB_IO_DECOMPRESS_FAIL) {
-
- /* If the page was compressed on the fly then
- try and decompress the page */
-
- n_bytes = os_file_compressed_page_size(page);
-
- if (n_bytes != ULINT_UNDEFINED) {
-
- err = os_file_read(
- request,
- m_handle, page, page_size,
- UNIV_PAGE_SIZE_MAX);
-
- if (err != DB_SUCCESS) {
-
- ib::info()
- << "READ FAIL: "
- << "page_no:" << j;
- continue;
- }
- }
-
- } else if (err != DB_SUCCESS) {
+ if (err != DB_SUCCESS) {
ib::info()
<< "READ FAIL: page_no:" << j;
@@ -838,11 +815,6 @@ Datafile::restore_from_doublewrite(
IORequest request(IORequest::WRITE);
- /* Note: The pages are written out as uncompressed because we don't
- have the compression algorithm information at this point. */
-
- request.disable_compression();
-
return(os_file_write(
request,
m_filepath, m_handle, page, 0, page_size.physical()));
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index d74f8cfa5bf..55c34db2b59 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -1838,7 +1838,7 @@ fts_create_one_common_table(
FTS_CONFIG_TABLE_VALUE_COL_LEN);
}
- error = row_create_table_for_mysql(new_table, NULL, trx, false,
+ error = row_create_table_for_mysql(new_table, trx, false,
FIL_SPACE_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
if (error == DB_SUCCESS) {
@@ -2055,7 +2055,7 @@ fts_create_one_index_table(
(DATA_MTYPE_MAX << 16) | DATA_UNSIGNED | DATA_NOT_NULL,
FTS_INDEX_ILIST_LEN);
- error = row_create_table_for_mysql(new_table, NULL, trx, false,
+ error = row_create_table_for_mysql(new_table, trx, false,
FIL_SPACE_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
if (error == DB_SUCCESS) {
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 0fe23301c32..1e47da86f70 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -382,25 +382,6 @@ get_row_format(
static ulong innodb_default_row_format = DEFAULT_ROW_FORMAT_DYNAMIC;
-#ifdef UNIV_DEBUG
-/** Values for --innodb-debug-compress names. */
-static const char* innodb_debug_compress_names[] = {
- "none",
- "zlib",
- "lz4",
- "lz4hc",
- NullS
-};
-
-/** Enumeration of --innodb-debug-compress */
-static TYPELIB innodb_debug_compress_typelib = {
- array_elements(innodb_debug_compress_names) - 1,
- "innodb_debug_compress_typelib",
- innodb_debug_compress_names,
- NULL
-};
-#endif /* UNIV_DEBUG */
-
/** Possible values for system variable "innodb_stats_method". The values
are defined the same as its corresponding MyISAM system variable
"myisam_stats_method"(see "myisam_stats_method_names"), for better usability */
@@ -2828,64 +2809,6 @@ innobase_raw_format(
return(ut_str_sql_format(buf_tmp, buf_tmp_used, buf, buf_size));
}
-#ifdef MYSQL_COMPRESSION
-/** Check if the string is "empty" or "none".
-@param[in] algorithm Compression algorithm to check
-@return true if no algorithm requested */
-bool
-Compression::is_none(const char* algorithm)
-{
- /* NULL is the same as NONE */
- if (algorithm == NULL
- || *algorithm == 0
- || innobase_strcasecmp(algorithm, "none") == 0) {
- return(true);
- }
-
- return(false);
-}
-
-/** Check for supported COMPRESS := (ZLIB | LZ4 | NONE) supported values
-@param[in] name Name of the compression algorithm
-@param[out] compression The compression algorithm
-@return DB_SUCCESS or DB_UNSUPPORTED */
-dberr_t
-Compression::check(
- const char* algorithm,
- Compression* compression)
-{
- if (is_none(algorithm)) {
-
- compression->m_type = NONE;
-
- } else if (innobase_strcasecmp(algorithm, "zlib") == 0) {
-
- compression->m_type = ZLIB;
-
- } else if (innobase_strcasecmp(algorithm, "lz4") == 0) {
-
- compression->m_type = LZ4;
-
- } else {
- return(DB_UNSUPPORTED);
- }
-
- return(DB_SUCCESS);
-}
-
-/** Check for supported COMPRESS := (ZLIB | LZ4 | NONE) supported values
-@param[in] name Name of the compression algorithm
-@param[out] compression The compression algorithm
-@return DB_SUCCESS or DB_UNSUPPORTED */
-dberr_t
-Compression::validate(const char* algorithm)
-{
- Compression compression;
-
- return(check(algorithm, &compression));
-}
-#endif /* MYSQL_COMPRESSION */
-
/*********************************************************************//**
Compute the next autoinc value.
@@ -7042,34 +6965,6 @@ ha_innobase::open(
}
info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
-
-#ifdef MYSQL_COMPRESSION
- dberr_t err = fil_set_compression(m_prebuilt->table,
- table->s->compress.str);
-
- switch (err) {
- case DB_NOT_FOUND:
- case DB_UNSUPPORTED:
- /* We will do another check before the create
- table and push the error to the client there. */
- break;
-
- case DB_IO_NO_PUNCH_HOLE_TABLESPACE:
- /* We did the check in the 'if' above. */
-
- case DB_IO_NO_PUNCH_HOLE_FS:
- /* During open we can't check whether the FS supports
- punch hole or not, at least on Linux. */
- break;
-
- default:
- ut_error;
-
- case DB_SUCCESS:
- break;
- }
-#endif
-
DBUG_RETURN(0);
}
@@ -12099,98 +11994,36 @@ err_col:
on re-start we don't need to restore temp-table and so no entry is
needed in SYSTEM tables. */
if (dict_table_is_temporary(table)) {
-#ifdef MYSQL_COMPRESSION
- if (m_create_info->compress.length > 0) {
- push_warning_printf(
- m_thd,
- Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED,
- "InnoDB: Compression not supported for "
- "temporary tables");
+ /* Get a new table ID */
+ dict_table_assign_new_id(table, m_trx);
- err = DB_UNSUPPORTED;
+ /* Create temp tablespace if configured. */
+ err = dict_build_tablespace_for_table(table, NULL);
- dict_mem_table_free(table);
- } else {
-#endif /* MYSQL_COMPRESSION */
- /* Get a new table ID */
- dict_table_assign_new_id(table, m_trx);
-
- /* Create temp tablespace if configured. */
- err = dict_build_tablespace_for_table(table, NULL);
-
- if (err == DB_SUCCESS) {
- /* Temp-table are maintained in memory and so
- can_be_evicted is FALSE. */
- mem_heap_t* temp_table_heap;
+ if (err == DB_SUCCESS) {
+ /* Temp-table are maintained in memory and so
+ can_be_evicted is FALSE. */
+ mem_heap_t* temp_table_heap;
- temp_table_heap = mem_heap_create(256);
+ temp_table_heap = mem_heap_create(256);
- dict_table_add_to_cache(
- table, FALSE, temp_table_heap);
+ dict_table_add_to_cache(
+ table, FALSE, temp_table_heap);
- DBUG_EXECUTE_IF("ib_ddl_crash_during_create2",
- DBUG_SUICIDE(););
+ DBUG_EXECUTE_IF("ib_ddl_crash_during_create2",
+ DBUG_SUICIDE(););
- mem_heap_free(temp_table_heap);
- }
-#ifdef MYSQL_COMPRESSION
+ mem_heap_free(temp_table_heap);
}
-#endif
-
} else {
- const char* algorithm = NULL;
-
-#if MYSQL_COMPRESSION
- const char* algorithm = m_create_info->compress.str;
-
- if (!(m_flags2 & DICT_TF2_USE_FILE_PER_TABLE)
- && m_create_info->compress.length > 0
- && !Compression::is_none(algorithm)) {
-
- push_warning_printf(
- m_thd,
- Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED,
- "InnoDB: Compression not supported for "
- "shared tablespaces");
-
- algorithm = NULL;
-
- err = DB_UNSUPPORTED;
- dict_mem_table_free(table);
-
- } else if (Compression::validate(algorithm) != DB_SUCCESS
- || m_form->s->row_type == ROW_TYPE_COMPRESSED
- || m_create_info->key_block_size > 0) {
-
- algorithm = NULL;
- }
-#endif /* MYSQL_COMPRESSION */
-
if (err == DB_SUCCESS) {
err = row_create_table_for_mysql(
- table, algorithm, m_trx, false,
+ table, m_trx, false,
(fil_encryption_t)options->encryption,
options->encryption_key_id);
}
- if (err == DB_IO_NO_PUNCH_HOLE_FS) {
-
- ut_ad(!dict_table_in_shared_tablespace(table));
-
- push_warning_printf(
- m_thd,
- Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED,
- "InnoDB: Punch hole not supported by the "
- "file system or the tablespace page size "
- "is not large enough. Compression disabled");
-
- err = DB_SUCCESS;
- }
-
DBUG_EXECUTE_IF("ib_crash_during_create_for_encryption",
DBUG_SUICIDE(););
}
@@ -12665,77 +12498,6 @@ create_table_info_t::create_option_tablespace_is_valid()
}
#endif
-#ifdef MYSQL_COMPRESSION
-/** Validate the COPMRESSION option.
-@return true if valid, false if not. */
-bool
-create_table_info_t::create_option_compression_is_valid()
-{
- dberr_t err;
- Compression compression;
-
- if (m_create_info->compress.length == 0) {
- return(true);
- }
-
- err = Compression::check(m_create_info->compress.str, &compression);
-
- if (err == DB_UNSUPPORTED) {
- push_warning_printf(
- m_thd,
- Sql_condition::WARN_LEVEL_WARN,
- ER_UNSUPPORTED_EXTENSION,
- "InnoDB: Unsupported compression algorithm '%s'",
- m_create_info->compress.str);
- return(false);
- }
-
- /* Allow Compression=NONE on any tablespace or row format. */
- if (compression.m_type == Compression::NONE) {
- return(true);
- }
-
- static char intro[] = "InnoDB: Page Compression is not supported";
-
- if (m_create_info->key_block_size != 0
- || m_create_info->row_type == ROW_TYPE_COMPRESSED) {
- push_warning_printf(
- m_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_UNSUPPORTED_EXTENSION,
- "%s with row_format=compressed or"
- " key_block_size > 0", intro);
- return(false);
- }
-
- if (m_create_info->options & HA_LEX_CREATE_TMP_TABLE) {
- push_warning_printf(
- m_thd, Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED,
- "%s for temporary tables", intro);
- return(false);
- }
-
- if (tablespace_is_general_space(m_create_info)) {
- push_warning_printf(
- m_thd, Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED,
- "%s for shared general tablespaces", intro);
- return(false);
- }
-
- /* The only non-file-per-table tablespace left is the system space. */
- if (!m_use_file_per_table) {
- push_warning_printf(
- m_thd, Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED,
- "%s for the system tablespace", intro);
- return(false);
- }
-
- return(true);
-}
-#endif /* MYSQL_COMPRESSION */
-
/** Validate the create options. Check that the options KEY_BLOCK_SIZE,
ROW_FORMAT, DATA DIRECTORY, TEMPORARY & TABLESPACE are compatible with
each other and other settings. These CREATE OPTIONS are not validated
@@ -12935,25 +12697,6 @@ create_table_info_t::create_options_are_invalid()
}
}
-#ifdef MYSQL_COMPRESSION
- /* Validate the page compression parameter. */
- if (!create_option_compression_is_valid()) {
- return("COMPRESSION");
- }
-
- /* Check the encryption option. */
- if (ret == NULL && m_create_info->encrypt_type.length > 0) {
- dberr_t err;
-
- err = Encryption::validate(m_create_info->encrypt_type.str);
-
- if (err == DB_UNSUPPORTED) {
- my_error(ER_INVALID_ENCRYPTION_OPTION, MYF(0));
- ret = "ENCRYPTION";
- }
- }
-#endif
-
return(ret);
}
@@ -13269,17 +13012,6 @@ create_table_info_t::innobase_table_flags()
m_flags = 0;
m_flags2 = 0;
-#ifdef MYSQL_COMPRESSION
- /* Validate the page compression parameter. */
- if (!create_option_compression_is_valid()) {
- /* No need to do anything. Warnings were issued.
- The compresion setting will be ignored later.
- If inodb_strict_mode=ON, this is called twice unless
- there was a problem before.
- If inodb_strict_mode=OFF, this is the only call. */
- }
-#endif
-
/* Check if there are any FTS indexes defined on this table. */
for (uint i = 0; i < m_form->s->keys; i++) {
const KEY* key = &m_form->key_info[i];
@@ -22573,11 +22305,6 @@ static MYSQL_SYSVAR_BOOL(disable_background_merge,
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_RQCMDARG,
"Disable change buffering merges by the master thread",
NULL, NULL, FALSE);
-
-static MYSQL_SYSVAR_ENUM(compress_debug, srv_debug_compress,
- PLUGIN_VAR_RQCMDARG,
- "Compress all tables, without specifying the COMPRESS table attribute",
- NULL, NULL, Compression::NONE, &innodb_debug_compress_typelib);
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
static MYSQL_SYSVAR_ULONG(buf_dump_status_frequency, srv_buf_dump_status_frequency,
@@ -23114,7 +22841,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(data_file_size_debug),
MYSQL_SYSVAR(fil_make_page_dirty_debug),
MYSQL_SYSVAR(saved_page_number_debug),
- MYSQL_SYSVAR(compress_debug),
MYSQL_SYSVAR(disable_resize_buffer_pool_debug),
MYSQL_SYSVAR(page_cleaner_disabled_debug),
MYSQL_SYSVAR(dict_stats_disabled_debug),
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index cef39e594b9..8d879207fab 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -795,9 +795,6 @@ public:
/** Validate TABLESPACE option. */
bool create_option_tablespace_is_valid();
- /** Validate COMPRESSION option. */
- bool create_option_compression_is_valid();
-
/** Prepare to create a table. */
int prepare_create_table(const char* name);
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 004b6863a9f..6b6667b5e56 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -4358,7 +4358,6 @@ prepare_inplace_alter_table_dict(
dict_index_t* fts_index = NULL;
ulint new_clustered = 0;
dberr_t error;
- const char* punch_hole_warning = NULL;
ulint num_fts_index;
dict_add_v_col_t* add_v = NULL;
ha_innobase_inplace_ctx*ctx;
@@ -4534,7 +4533,6 @@ prepare_inplace_alter_table_dict(
ulint z = 0;
ulint key_id = FIL_DEFAULT_ENCRYPTION_KEY;
fil_encryption_t mode = FIL_SPACE_ENCRYPTION_DEFAULT;
- const char* compression=NULL;
crypt_data = fil_space_get_crypt_data(ctx->prebuilt->table->space);
@@ -4732,39 +4730,11 @@ prepare_inplace_alter_table_dict(
ctx->new_table->fts->doc_col = fts_doc_id_col;
}
-#ifdef MYSQL_COMPRESSION
- compression = ha_alter_info->create_info->compress.str;
-
- if (Compression::validate(compression) != DB_SUCCESS) {
-
- compression = NULL;
- }
-#endif /* MYSQL_COMPRESSION */
-
error = row_create_table_for_mysql(
- ctx->new_table, compression, ctx->trx, false, mode, key_id);
-
- punch_hole_warning =
- (error == DB_IO_NO_PUNCH_HOLE_FS)
- ? "Punch hole is not supported by the file system"
- : "Page Compression is not supported for this"
- " tablespace";
+ ctx->new_table, ctx->trx, false, mode, key_id);
switch (error) {
dict_table_t* temp_table;
- case DB_IO_NO_PUNCH_HOLE_FS:
- case DB_IO_NO_PUNCH_HOLE_TABLESPACE:
- push_warning_printf(
- ctx->prebuilt->trx->mysql_thd,
- Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED,
- "%s. Compression disabled for '%s'",
- punch_hole_warning,
- ctx->new_table->name.m_name);
-
- error = DB_SUCCESS;
-
-
case DB_SUCCESS:
/* We need to bump up the table ref count and
before we can use it we need to open the
@@ -9078,10 +9048,6 @@ foreign_fail:
}
}
- /* We don't support compression for the system tablespace nor
- the temporary tablespace. Only because they are shared tablespaces.
- There is no other technical reason. */
-
innobase_parse_hint_from_comment(
m_user_thd, m_prebuilt->table, altered_table->s);
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index 1d535c58e77..de23e998020 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -1615,7 +1615,6 @@ public:
if written again we check is TRIM
operation needed. */
- ulint space; /*!< space id */
unsigned key_version; /*!< key version for this block */
bool page_encrypted; /*!< page is page encrypted */
bool page_compressed;/*!< page is page compressed */
diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
index f2b1b151598..5e75c446bbd 100644
--- a/storage/innobase/include/buf0buf.ic
+++ b/storage/innobase/include/buf0buf.ic
@@ -734,9 +734,6 @@ buf_block_get_frame(
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
case BUF_BLOCK_NOT_USED:
- if (block->page.encrypted) {
- goto ok;
- }
ut_error;
break;
case BUF_BLOCK_FILE_PAGE:
diff --git a/storage/innobase/include/db0err.h b/storage/innobase/include/db0err.h
index d4757d93509..ab505e04083 100644
--- a/storage/innobase/include/db0err.h
+++ b/storage/innobase/include/db0err.h
@@ -146,18 +146,6 @@ enum dberr_t {
DB_IO_ERROR = 100, /*!< Generic IO error */
- DB_IO_DECOMPRESS_FAIL, /*!< Failure to decompress a page
- after reading it from disk */
-
- DB_IO_NO_PUNCH_HOLE, /*!< Punch hole not supported by
- InnoDB */
-
- DB_IO_NO_PUNCH_HOLE_FS, /*!< The file system doesn't support
- punch hole */
-
- DB_IO_NO_PUNCH_HOLE_TABLESPACE, /*!< The tablespace doesn't support
- punch hole */
-
DB_IO_PARTIAL_FAILED, /*!< Partial IO request failed */
DB_FORCED_ABORT, /*!< Transaction was forced to rollback
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index 6410c86939b..0788f84d11a 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -166,9 +166,6 @@ struct fil_space_t {
UT_LIST_NODE_T(fil_space_t) space_list;
/*!< list of all spaces */
- /** Compression algorithm */
- Compression::Type compression_type;
-
/** MariaDB encryption data */
fil_space_crypt_t* crypt_data;
@@ -234,9 +231,6 @@ struct fil_node_t {
/** link to the fil_system->LRU list (keeping track of open files) */
UT_LIST_NODE_T(fil_node_t) LRU;
- /** whether the file system of this file supports PUNCH HOLE */
- bool punch_hole;
-
/** block size to use for punching holes */
ulint block_size;
@@ -438,23 +432,6 @@ extern fil_addr_t fil_addr_null;
used to encrypt the page + 32-bit checksum
or 64 bits of zero if no encryption
*/
-/** If page type is FIL_PAGE_COMPRESSED then the 8 bytes starting at
-FIL_PAGE_FILE_FLUSH_LSN are broken down as follows: */
-
-/** Control information version format (u8) */
-static const ulint FIL_PAGE_VERSION = FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION;
-
-/** Compression algorithm (u8) */
-static const ulint FIL_PAGE_ALGORITHM_V1 = FIL_PAGE_VERSION + 1;
-
-/** Original page type (u16) */
-static const ulint FIL_PAGE_ORIGINAL_TYPE_V1 = FIL_PAGE_ALGORITHM_V1 + 1;
-
-/** Original data size in bytes (u16)*/
-static const ulint FIL_PAGE_ORIGINAL_SIZE_V1 = FIL_PAGE_ORIGINAL_TYPE_V1 + 2;
-
-/** Size after compression (u16) */
-static const ulint FIL_PAGE_COMPRESS_SIZE_V1 = FIL_PAGE_ORIGINAL_SIZE_V1 + 2;
/** This overloads FIL_PAGE_FILE_FLUSH_LSN for RTREE Split Sequence Number */
#define FIL_RTREE_SPLIT_SEQ_NUM FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
@@ -504,11 +481,12 @@ static const ulint FIL_PAGE_COMPRESS_SIZE_V1 = FIL_PAGE_ORIGINAL_SIZE_V1 + 2;
#define FIL_PAGE_TYPE_UNKNOWN 13 /*!< In old tablespaces, garbage
in FIL_PAGE_TYPE is replaced with this
value when flushing pages. */
-#define FIL_PAGE_COMPRESSED 14 /*!< Compressed page */
-#define FIL_PAGE_ENCRYPTED 15 /*!< Encrypted page */
-#define FIL_PAGE_COMPRESSED_AND_ENCRYPTED 16
- /*!< Compressed and Encrypted page */
-#define FIL_PAGE_ENCRYPTED_RTREE 17 /*!< Encrypted R-tree page */
+
+/* File page types introduced in MySQL 5.7, not supported in MariaDB */
+//#define FIL_PAGE_COMPRESSED 14
+//#define FIL_PAGE_ENCRYPTED 15
+//#define FIL_PAGE_COMPRESSED_AND_ENCRYPTED 16
+//#define FIL_PAGE_ENCRYPTED_RTREE 17
/** Used by i_s.cc to index into the text description. */
#define FIL_PAGE_TYPE_LAST FIL_PAGE_TYPE_UNKNOWN
@@ -1622,24 +1600,6 @@ fil_names_dirty_and_write(
fil_space_t* space,
mtr_t* mtr);
-/** Set the compression type for the tablespace of a table
-@param[in] table Table that should be compressesed
-@param[in] algorithm Text representation of the algorithm
-@return DB_SUCCESS or error code */
-dberr_t
-fil_set_compression(
- dict_table_t* table,
- const char* algorithm)
- MY_ATTRIBUTE((warn_unused_result));
-
-/** Get the compression type for the tablespace
-@param[in] space_id Space ID to check
-@return the compression algorithm */
-Compression::Type
-fil_get_compression(
- ulint space_id)
- MY_ATTRIBUTE((warn_unused_result));
-
/** Write MLOG_FILE_NAME records if a persistent tablespace was modified
for the first time since the latest fil_names_clear().
@param[in,out] space tablespace
@@ -1705,10 +1665,6 @@ fil_names_clear(
lsn_t lsn,
bool do_write);
-/** Note that the file system where the file resides doesn't support PUNCH HOLE
-@param[in,out] node Node to set */
-void fil_no_punch_hole(fil_node_t* node);
-
#ifdef UNIV_ENABLE_UNIT_TEST_MAKE_FILEPATH
void test_make_filepath();
#endif /* UNIV_ENABLE_UNIT_TEST_MAKE_FILEPATH */
diff --git a/storage/innobase/include/fil0fil.ic b/storage/innobase/include/fil0fil.ic
index 8f8a4194c0d..01fa1093e5e 100644
--- a/storage/innobase/include/fil0fil.ic
+++ b/storage/innobase/include/fil0fil.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2015, MariaDB Corporation.
+Copyright (c) 2015, 2017 MariaDB Corporation.
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
@@ -58,49 +58,41 @@ fil_get_page_type_name(
{
switch(page_type) {
case FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED:
- return (const char*)"PAGE_COMPRESSED_ENRYPTED";
+ return "PAGE_COMPRESSED_ENRYPTED";
case FIL_PAGE_PAGE_COMPRESSED:
- return (const char*)"PAGE_COMPRESSED";
+ return "PAGE_COMPRESSED";
case FIL_PAGE_INDEX:
- return (const char*)"INDEX";
+ return "INDEX";
case FIL_PAGE_RTREE:
- return (const char*)"RTREE";
+ return "RTREE";
case FIL_PAGE_UNDO_LOG:
- return (const char*)"UNDO LOG";
+ return "UNDO LOG";
case FIL_PAGE_INODE:
- return (const char*)"INODE";
+ return "INODE";
case FIL_PAGE_IBUF_FREE_LIST:
- return (const char*)"IBUF_FREE_LIST";
+ return "IBUF_FREE_LIST";
case FIL_PAGE_TYPE_ALLOCATED:
- return (const char*)"ALLOCATED";
+ return "ALLOCATED";
case FIL_PAGE_IBUF_BITMAP:
- return (const char*)"IBUF_BITMAP";
+ return "IBUF_BITMAP";
case FIL_PAGE_TYPE_SYS:
- return (const char*)"SYS";
+ return "SYS";
case FIL_PAGE_TYPE_TRX_SYS:
- return (const char*)"TRX_SYS";
+ return "TRX_SYS";
case FIL_PAGE_TYPE_FSP_HDR:
- return (const char*)"FSP_HDR";
+ return "FSP_HDR";
case FIL_PAGE_TYPE_XDES:
- return (const char*)"XDES";
+ return "XDES";
case FIL_PAGE_TYPE_BLOB:
- return (const char*)"BLOB";
+ return "BLOB";
case FIL_PAGE_TYPE_ZBLOB:
- return (const char*)"ZBLOB";
+ return "ZBLOB";
case FIL_PAGE_TYPE_ZBLOB2:
- return (const char*)"ZBLOB2";
- case FIL_PAGE_COMPRESSED:
- return (const char*)"ORACLE PAGE COMPRESSED";
- case FIL_PAGE_ENCRYPTED:
- return (const char*)"ORACLE PAGE ENCRYPTED";
- case FIL_PAGE_COMPRESSED_AND_ENCRYPTED:
- return (const char*)"ORACLE PAGE COMPRESSED AND ENCRYPTED";
- case FIL_PAGE_ENCRYPTED_RTREE:
- return (const char*)"ORACLE RTREE ENCRYPTED";
+ return "ZBLOB2";
case FIL_PAGE_TYPE_UNKNOWN:
- return (const char*)"OLD UNKOWN PAGE TYPE";
+ return "OLD UNKOWN PAGE TYPE";
default:
- return (const char*)"PAGE TYPE CORRUPTED";
+ return "PAGE TYPE CORRUPTED";
}
}
@@ -145,52 +137,22 @@ fil_page_type_validate(
page_type == FIL_PAGE_TYPE_BLOB ||
page_type == FIL_PAGE_TYPE_ZBLOB ||
page_type == FIL_PAGE_TYPE_ZBLOB2 ||
- page_type == FIL_PAGE_COMPRESSED ||
- page_type == FIL_PAGE_TYPE_UNKNOWN ||
- page_type == FIL_PAGE_ENCRYPTED ||
- page_type == FIL_PAGE_COMPRESSED_AND_ENCRYPTED ||
- page_type == FIL_PAGE_ENCRYPTED_RTREE))) {
-
- uint key_version = mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
- bool page_compressed = (page_type == FIL_PAGE_PAGE_COMPRESSED);
- bool page_compressed_encrypted = (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
+ page_type == FIL_PAGE_TYPE_UNKNOWN))) {
+
ulint space = mach_read_from_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
ulint offset = mach_read_from_4(page + FIL_PAGE_OFFSET);
- ib_uint64_t lsn = mach_read_from_8(page + FIL_PAGE_LSN);
- ulint compressed_len = mach_read_from_2(page + FIL_PAGE_DATA);
fil_system_enter();
fil_space_t* rspace = fil_space_get_by_id(space);
fil_system_exit();
/* Dump out the page info */
- fprintf(stderr, "InnoDB: Space %lu offset %lu name %s page_type %lu page_type_name %s\n"
- "InnoDB: key_version %u page_compressed %d page_compressed_encrypted %d lsn %llu compressed_len %lu\n",
- space, offset, rspace->name, page_type, fil_get_page_type_name(page_type),
- key_version, page_compressed, page_compressed_encrypted, (ulonglong)lsn, compressed_len);
- fflush(stderr);
-
- ut_ad(page_type == FIL_PAGE_PAGE_COMPRESSED ||
- page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED ||
- page_type == FIL_PAGE_INDEX ||
- page_type == FIL_PAGE_RTREE ||
- page_type == FIL_PAGE_UNDO_LOG ||
- page_type == FIL_PAGE_INODE ||
- page_type == FIL_PAGE_IBUF_FREE_LIST ||
- page_type == FIL_PAGE_TYPE_ALLOCATED ||
- page_type == FIL_PAGE_IBUF_BITMAP ||
- page_type == FIL_PAGE_TYPE_SYS ||
- page_type == FIL_PAGE_TYPE_TRX_SYS ||
- page_type == FIL_PAGE_TYPE_FSP_HDR ||
- page_type == FIL_PAGE_TYPE_XDES ||
- page_type == FIL_PAGE_TYPE_BLOB ||
- page_type == FIL_PAGE_TYPE_ZBLOB ||
- page_type == FIL_PAGE_TYPE_ZBLOB2 ||
- page_type == FIL_PAGE_COMPRESSED ||
- page_type == FIL_PAGE_TYPE_UNKNOWN ||
- page_type == FIL_PAGE_ENCRYPTED ||
- page_type == FIL_PAGE_COMPRESSED_AND_ENCRYPTED ||
- page_type == FIL_PAGE_ENCRYPTED_RTREE);
-
+ ib::fatal() << "Page " << space << ":" << offset
+ << " name " << (rspace ? rspace->name : "???")
+ << " page_type " << page_type
+ << " key_version "
+ << mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION)
+ << " lsn " << mach_read_from_8(page + FIL_PAGE_LSN)
+ << " compressed_len " << mach_read_from_2(page + FIL_PAGE_DATA);
return false;
}
diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h
index cf4702cb366..541fbe24d82 100644
--- a/storage/innobase/include/ha_prototypes.h
+++ b/storage/innobase/include/ha_prototypes.h
@@ -41,7 +41,6 @@ struct fts_string_t;
// JAN: TODO missing features:
#undef MYSQL_57_SELECT_COUNT_OPTIMIZATION
-#undef MYSQL_COMPRESSION
#undef MYSQL_FT_INIT_EXT
#undef MYSQL_INNODB_API_CB
#undef MYSQL_INNODB_PARTITIONING
diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h
index 474c6848b09..57ee015dfdd 100644
--- a/storage/innobase/include/os0file.h
+++ b/storage/innobase/include/os0file.h
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2016, MariaDB Corporation.
+Copyright (c) 2013, 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
@@ -169,130 +169,6 @@ static const ulint OS_FILE_OPERATION_NOT_SUPPORTED = 125;
static const ulint OS_FILE_ERROR_MAX = 200;
/* @} */
-/** Compression algorithm. */
-struct Compression {
-
- /** Algorithm types supported */
- enum Type {
- /* Note: During recovery we don't have the compression type
- because the .frm file has not been read yet. Therefore
- we write the recovered pages out without compression. */
-
- /** No compression */
- NONE = 0,
-
- /** Use ZLib */
- ZLIB = 1,
-
- /** Use LZ4 faster variant, usually lower compression. */
- LZ4 = 2
- };
-
- /** Compressed page meta-data */
- struct meta_t {
-
- /** Version number */
- uint8_t m_version;
-
- /** Algorithm type */
- Type m_algorithm;
-
- /** Original page type */
- uint16_t m_original_type;
-
- /** Original page size, before compression */
- uint16_t m_original_size;
-
- /** Size after compression */
- uint16_t m_compressed_size;
- };
-
- /** Default constructor */
- Compression() : m_type(NONE) { };
-
- /** Specific constructor
- @param[in] type Algorithm type */
- explicit Compression(Type type)
- :
- m_type(type)
- {
-#ifdef UNIV_DEBUG
- switch (m_type) {
- case NONE:
- case ZLIB:
- case LZ4:
-
- default:
- ut_error;
- }
-#endif /* UNIV_DEBUG */
- }
-
- /** Check the page header type field.
- @param[in] page Page contents
- @return true if it is a compressed page */
- static bool is_compressed_page(const byte* page)
- MY_ATTRIBUTE((warn_unused_result));
-
- /** Check wether the compression algorithm is supported.
- @param[in] algorithm Compression algorithm to check
- @param[out] type The type that algorithm maps to
- @return DB_SUCCESS or error code */
- static dberr_t check(const char* algorithm, Compression* type)
- MY_ATTRIBUTE((warn_unused_result));
-
- /** Validate the algorithm string.
- @param[in] algorithm Compression algorithm to check
- @return DB_SUCCESS or error code */
- static dberr_t validate(const char* algorithm)
- MY_ATTRIBUTE((warn_unused_result));
-
- /** Convert to a "string".
- @param[in] type The compression type
- @return the string representation */
- static const char* to_string(Type type)
- MY_ATTRIBUTE((warn_unused_result));
-
- /** Convert the meta data to a std::string.
- @param[in] meta Page Meta data
- @return the string representation */
- static std::string to_string(const meta_t& meta)
- MY_ATTRIBUTE((warn_unused_result));
-
- /** Deserizlise the page header compression meta-data
- @param[in] header Pointer to the page header
- @param[out] control Deserialised data */
- static void deserialize_header(
- const byte* page,
- meta_t* control);
-
- /** Check if the string is "empty" or "none".
- @param[in] algorithm Compression algorithm to check
- @return true if no algorithm requested */
- static bool is_none(const char* algorithm)
- MY_ATTRIBUTE((warn_unused_result));
-
- /** Decompress the page data contents. Page type must be
- FIL_PAGE_COMPRESSED, if not then the source contents are
- left unchanged and DB_SUCCESS is returned.
- @param[in] dblwr_recover true of double write recovery
- in progress
- @param[in,out] src Data read from disk, decompressed
- data will be copied to this page
- @param[in,out] dst Scratch area to use for decompression
- @param[in] dst_len Size of the scratch area in bytes
- @return DB_SUCCESS or error code */
- static dberr_t deserialize(
- bool dblwr_recover,
- byte* src,
- byte* dst,
- ulint dst_len)
- MY_ATTRIBUTE((warn_unused_result));
-
- /** Compression type */
- Type m_type;
-};
-
/** Types for AIO operations @{ */
/** No transformations during read/write, write as is. */
@@ -335,25 +211,13 @@ public:
/** Ignore failed reads of non-existent pages */
IGNORE_MISSING = 128,
-
- /** Use punch hole if available, only makes sense if
- compression algorithm != NONE. Ignored if not set */
- PUNCH_HOLE = 256,
-
- /** Force raw read, do not try to compress/decompress.
- This can be used to force a read and write without any
- compression e.g., for redo log, merge sort temporary files
- and the truncate redo log. */
- NO_COMPRESSION = 512
-
};
/** Default constructor */
IORequest()
:
m_block_size(UNIV_SECTOR_SIZE),
- m_type(READ),
- m_compression()
+ m_type(READ)
{
/* No op */
}
@@ -364,16 +228,8 @@ public:
explicit IORequest(ulint type)
:
m_block_size(UNIV_SECTOR_SIZE),
- m_type(static_cast<uint16_t>(type)),
- m_compression()
+ m_type(static_cast<uint16_t>(type))
{
- if (is_log()) {
- disable_compression();
- }
-
- if (!is_punch_hole_supported()) {
- clear_punch_hole();
- }
}
/** Destructor */
@@ -435,28 +291,11 @@ public:
return(ignore_missing(m_type));
}
- /** @return true if punch hole should be used */
- bool punch_hole() const
- MY_ATTRIBUTE((warn_unused_result))
- {
- return((m_type & PUNCH_HOLE) == PUNCH_HOLE);
- }
-
/** @return true if the read should be validated */
bool validate() const
MY_ATTRIBUTE((warn_unused_result))
{
- ut_a(is_read() ^ is_write());
-
- return(!is_read() || !punch_hole());
- }
-
- /** Set the punch hole flag */
- void set_punch_hole()
- {
- if (is_punch_hole_supported()) {
- m_type |= PUNCH_HOLE;
- }
+ return(is_read() ^ is_write());
}
/** Clear the do not wake flag */
@@ -465,12 +304,6 @@ public:
m_type &= ~DO_NOT_WAKE;
}
- /** Clear the punch hole flag */
- void clear_punch_hole()
- {
- m_type &= ~PUNCH_HOLE;
- }
-
/** @return the block size to use for IO */
ulint block_size() const
MY_ATTRIBUTE((warn_unused_result))
@@ -485,14 +318,6 @@ public:
m_block_size = static_cast<uint32_t>(block_size);
}
- /** Clear all compression related flags */
- void clear_compressed()
- {
- clear_punch_hole();
-
- m_compression.m_type = Compression::NONE;
- }
-
/** Compare two requests
@reutrn true if the are equal */
bool operator==(const IORequest& rhs) const
@@ -500,47 +325,6 @@ public:
return(m_type == rhs.m_type);
}
- /** Set compression algorithm
- @param[in] compression The compression algorithm to use */
- void compression_algorithm(Compression::Type type)
- {
- if (type == Compression::NONE) {
- return;
- }
-
- set_punch_hole();
-
- m_compression.m_type = type;
- }
-
- /** Get the compression algorithm.
- @return the compression algorithm */
- Compression compression_algorithm() const
- MY_ATTRIBUTE((warn_unused_result))
- {
- return(m_compression);
- }
-
- /** @return true if the page should be compressed */
- bool is_compressed() const
- MY_ATTRIBUTE((warn_unused_result))
- {
- return(compression_algorithm().m_type != Compression::NONE);
- }
-
- /** @return true if the page read should not be transformed. */
- bool is_compression_enabled() const
- MY_ATTRIBUTE((warn_unused_result))
- {
- return((m_type & NO_COMPRESSION) == 0);
- }
-
- /** Disable transformations. */
- void disable_compression()
- {
- m_type |= NO_COMPRESSION;
- }
-
/** Note that the IO is for double write recovery. */
void dblwr_recover()
{
@@ -554,33 +338,12 @@ public:
return((m_type & DBLWR_RECOVER) == DBLWR_RECOVER);
}
- /** @return true if punch hole is supported */
- static bool is_punch_hole_supported()
- {
-
- /* In this debugging mode, we act as if punch hole is supported,
- and then skip any calls to actually punch a hole here.
- In this way, Transparent Page Compression is still being tested. */
- DBUG_EXECUTE_IF("ignore_punch_hole",
- return(true);
- );
-
-#if defined(HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE) || defined(_WIN32)
- return(true);
-#else
- return(false);
-#endif /* HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE || _WIN32 */
- }
-
private:
/* File system best block size */
uint32_t m_block_size;
/** Request type bit flags */
uint16_t m_type;
-
- /** Compression algorithm */
- Compression m_compression;
};
/* @} */
@@ -1659,71 +1422,11 @@ int
innobase_mysql_tmpfile(
const char* path);
-/** If it is a compressed page return the compressed page data + footer size
-@param[in] buf Buffer to check, must include header + 10 bytes
-@return ULINT_UNDEFINED if the page is not a compressed page or length
- of the compressed data (including footer) if it is a compressed page */
-ulint
-os_file_compressed_page_size(const byte* buf);
-
-/** If it is a compressed page return the original page data + footer size
-@param[in] buf Buffer to check, must include header + 10 bytes
-@return ULINT_UNDEFINED if the page is not a compressed page or length
- of the original data + footer if it is a compressed page */
-ulint
-os_file_original_page_size(const byte* buf);
-
/** Set the file create umask
@param[in] umask The umask to use for file creation. */
void
os_file_set_umask(ulint umask);
-/** Free storage space associated with a section of the file.
-@param[in] fh Open file handle
-@param[in] off Starting offset (SEEK_SET)
-@param[in] len Size of the hole
-@return DB_SUCCESS or error code */
-dberr_t
-os_file_punch_hole(
- os_file_t fh,
- os_offset_t off,
- os_offset_t len)
- MY_ATTRIBUTE((warn_unused_result));
-
-/** Check if the file system supports sparse files.
-
-Warning: On POSIX systems we try and punch a hole from offset 0 to
-the system configured page size. This should only be called on an empty
-file.
-
-Note: On Windows we use the name and on Unices we use the file handle.
-
-@param[in] name File name
-@param[in] fh File handle for the file - if opened
-@return true if the file system supports sparse files */
-bool
-os_is_sparse_file_supported(
- const char* path,
- os_file_t fh)
- MY_ATTRIBUTE((warn_unused_result));
-
-/** Decompress the page data contents. Page type must be FIL_PAGE_COMPRESSED, if
-not then the source contents are left unchanged and DB_SUCCESS is returned.
-@param[in] dblwr_recover true of double write recovery in progress
-@param[in,out] src Data read from disk, decompressed data will be
- copied to this page
-@param[in,out] dst Scratch area to use for decompression
-@param[in] dst_len Size of the scratch area in bytes
-@return DB_SUCCESS or error code */
-
-dberr_t
-os_file_decompress_page(
- bool dblwr_recover,
- byte* src,
- byte* dst,
- ulint dst_len)
- MY_ATTRIBUTE((warn_unused_result));
-
/** Normalizes a directory path for the current OS:
On Windows, we convert '/' to '\', else we convert '\' to '/'.
@param[in,out] str A null-terminated directory and file path */
diff --git a/storage/innobase/include/os0file.ic b/storage/innobase/include/os0file.ic
index 74d0b2c83a8..3e78b87a177 100644
--- a/storage/innobase/include/os0file.ic
+++ b/storage/innobase/include/os0file.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2010, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2016, MariaDB Corporation.
+Copyright (c) 2013, 2017, MariaDB Corporation.
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
diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h
index f010e717103..67482db160a 100644
--- a/storage/innobase/include/row0mysql.h
+++ b/storage/innobase/include/row0mysql.h
@@ -373,9 +373,6 @@ row_create_table_for_mysql(
dict_table_t* table, /*!< in, own: table definition
(will be freed, or on DB_SUCCESS
added to the data dictionary cache) */
- const char* compression,
- /*!< in: compression algorithm to use,
- can be NULL */
trx_t* trx, /*!< in/out: transaction */
bool commit, /*!< in: if true, commit the transaction */
fil_encryption_t mode, /*!< in: encryption mode */
diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
index 1e05c2c6e4a..227bcfb7781 100644
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
@@ -731,11 +731,6 @@ enum srv_stats_method_name_enum {
typedef enum srv_stats_method_name_enum srv_stats_method_name_t;
-#ifdef UNIV_DEBUG
-/** Force all user tables to use page compression. */
-extern ulong srv_debug_compress;
-#endif /* UNIV_DEBUG */
-
/** Types of threads existing in the system. */
enum srv_thread_type {
SRV_NONE, /*!< None */
diff --git a/storage/innobase/innodb.cmake b/storage/innobase/innodb.cmake
index 15b0f7c9c9a..9cc6e434f38 100644
--- a/storage/innobase/innodb.cmake
+++ b/storage/innobase/innodb.cmake
@@ -1,4 +1,5 @@
# Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2017, MariaDB Corporation.
#
# 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
@@ -135,24 +136,6 @@ IF(HAVE_NANOSLEEP)
ADD_DEFINITIONS(-DHAVE_NANOSLEEP=1)
ENDIF()
-IF(NOT MSVC)
- CHECK_C_SOURCE_RUNS(
- "
- #define _GNU_SOURCE
- #include <fcntl.h>
- #include <linux/falloc.h>
- int main()
- {
- /* Ignore the return value for now. Check if the flags exist.
- The return value is checked at runtime. */
- fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
-
- return(0);
- }"
- HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE
- )
-ENDIF()
-
IF(HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE)
ADD_DEFINITIONS(-DHAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE=1)
ENDIF()
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index e228a89b946..71a9a856571 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2016, MariaDB Corporation.
+Copyright (c) 2013, 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
@@ -63,11 +63,6 @@ Created 10/21/1995 Heikki Tuuri
#include <libaio.h>
#endif /* LINUX_NATIVE_AIO */
-#ifdef HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE
-# include <fcntl.h>
-# include <linux/falloc.h>
-#endif /* HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE */
-
#ifdef HAVE_LZ4
#include <lz4.h>
#endif
@@ -87,11 +82,6 @@ bool innodb_calling_exit;
#include <linux/falloc.h>
#endif
-#ifdef HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE
-# include <fcntl.h>
-# include <linux/falloc.h>
-#endif /* HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE */
-
#ifdef HAVE_LZO
#include "lzo/lzo1x.h"
#endif
@@ -109,30 +99,6 @@ static const ulint IO_LOG_SEGMENT = 1;
/** Number of retries for partial I/O's */
static const ulint NUM_RETRIES_ON_PARTIAL_IO = 10;
-/** Blocks for doing IO, used in the transparent compression
-and encryption code. */
-struct Block {
- /** Default constructor */
- Block() : m_ptr(), m_in_use() { }
-
- byte* m_ptr;
-
- byte pad[CACHE_LINE_SIZE - sizeof(ulint)];
- int32 m_in_use;
-};
-
-/** For storing the allocated blocks */
-typedef std::vector<Block> Blocks;
-
-/** Block collection */
-static Blocks* block_cache;
-
-/** Number of blocks to allocate for sync read/writes */
-static const size_t MAX_BLOCKS = 128;
-
-/** Block buffer size */
-#define BUFFER_BLOCK_SIZE ((ulint)(UNIV_PAGE_SIZE * 1.3))
-
/* This specifies the file permissions InnoDB uses when it creates files in
Unix; the value of os_innodb_umask is initialized in ha_innodb.cc to
my_umask */
@@ -320,18 +286,6 @@ struct Slot {
/** Length of the block before it was compressed */
uint32 original_len;
- /** Buffer block for compressed pages or encrypted pages */
- Block* buf_block;
-
- /** Unaligned buffer for compressed pages */
- byte* compressed_ptr;
-
- /** Compressed data page, aligned and derived from compressed_ptr */
- byte* compressed_page;
-
- /** true, if we shouldn't punch a hole after writing the page */
- bool skip_punch_hole;
-
ulint* write_size;
};
@@ -839,140 +793,12 @@ os_aio_windows_handler(
IORequest* type);
#endif /* WIN_ASYNC_IO */
-#ifdef MYSQL_COMPRESSION
-/** Allocate a page for sync IO
-@return pointer to page */
-static
-Block*
-os_alloc_block()
-{
- size_t pos;
- Blocks& blocks = *block_cache;
- size_t i = static_cast<size_t>(my_timer_cycles());
- const size_t size = blocks.size();
- ulint retry = 0;
- Block* block;
-
- DBUG_EXECUTE_IF("os_block_cache_busy", retry = MAX_BLOCKS * 3;);
-
- for (;;) {
-
- /* After go through the block cache for 3 times,
- allocate a new temporary block. */
- if (retry == MAX_BLOCKS * 3) {
- byte* ptr;
-
- ptr = static_cast<byte*>(
- ut_malloc_nokey(sizeof(*block)
- + BUFFER_BLOCK_SIZE));
-
- block = new (ptr) Block();
- block->m_ptr = static_cast<byte*>(
- ptr + sizeof(*block));
- block->m_in_use = 1;
-
- break;
- }
-
- pos = i++ % size;
-
- if (my_atomic_fas32_explicit(&blocks[pos].m_in_use, 1,
- MY_MEMORY_ORDER_ACQUIRE) == 0) {
- block = &blocks[pos];
- break;
- }
-
- os_thread_yield();
-
- ++retry;
- }
-
- ut_a(block->m_in_use != 0);
-
- return(block);
-}
-
-/** Free a page after sync IO
-@param[in,own] block The block to free/release */
-static
-void
-os_free_block(Block* block)
-{
- ut_ad(block->m_in_use == 1);
-
- my_atomic_store32_explicit(&block->m_in_use, 0, MY_MEMORY_ORDER_RELEASE);
-
- /* When this block is not in the block cache, and it's
- a temporary block, we need to free it directly. */
- if (std::less<Block*>()(block, &block_cache->front())
- || std::greater<Block*>()(block, &block_cache->back())) {
- ut_free(block);
- }
-}
-#endif /* MYSQL_COMPRESSION */
-
/** Generic AIO Handler methods. Currently handles IO post processing. */
class AIOHandler {
public:
/** Do any post processing after a read/write
@return DB_SUCCESS or error code. */
static dberr_t post_io_processing(Slot* slot);
-
-private:
- /** Check whether the page was compressed.
- @param[in] slot The slot that contains the IO request
- @return true if it was a compressed page */
- static bool is_compressed_page(const Slot* slot)
- {
- const byte* src = slot->buf;
-
- ulint page_type = mach_read_from_2(src + FIL_PAGE_TYPE);
-
- return(page_type == FIL_PAGE_COMPRESSED);
- }
-
- /** Get the compressed page size.
- @param[in] slot The slot that contains the IO request
- @return number of bytes to read for a successful decompress */
- static ulint compressed_page_size(const Slot* slot)
- {
- ut_ad(slot->type.is_read());
- ut_ad(is_compressed_page(slot));
-
- ulint size;
- const byte* src = slot->buf;
-
- size = mach_read_from_2(src + FIL_PAGE_COMPRESS_SIZE_V1);
-
- return(size + FIL_PAGE_DATA);
- }
-
- /** Check if the page contents can be decompressed.
- @param[in] slot The slot that contains the IO request
- @return true if the data read has all the compressed data */
- static bool can_decompress(const Slot* slot)
- {
- ut_ad(slot->type.is_read());
- ut_ad(is_compressed_page(slot));
-
- ulint version;
- const byte* src = slot->buf;
-
- version = mach_read_from_1(src + FIL_PAGE_VERSION);
-
- ut_a(version == 1);
-
- /* Includes the page header size too */
- ulint size = compressed_page_size(slot);
-
- return(size <= (slot->ptr - slot->buf) + (ulint) slot->n_bytes);
- }
-
- /** Check if we need to read some more data.
- @param[in] slot The slot that contains the IO request
- @param[in] n_bytes Total bytes read so far
- @return DB_SUCCESS or error code */
- static dberr_t check_read(Slot* slot, ulint n_bytes);
};
/** Helper class for doing synchronous file IO. Currently, the objective
@@ -1038,152 +864,17 @@ private:
os_offset_t m_offset;
};
-/** If it is a compressed page return the compressed page data + footer size
-@param[in] buf Buffer to check, must include header + 10 bytes
-@return ULINT_UNDEFINED if the page is not a compressed page or length
- of the compressed data (including footer) if it is a compressed page */
-ulint
-os_file_compressed_page_size(const byte* buf)
-{
- ulint type = mach_read_from_2(buf + FIL_PAGE_TYPE);
-
- if (type == FIL_PAGE_COMPRESSED) {
- ulint version = mach_read_from_1(buf + FIL_PAGE_VERSION);
- ut_a(version == 1);
- return(mach_read_from_2(buf + FIL_PAGE_COMPRESS_SIZE_V1));
- }
-
- return(ULINT_UNDEFINED);
-}
-
-/** If it is a compressed page return the original page data + footer size
-@param[in] buf Buffer to check, must include header + 10 bytes
-@return ULINT_UNDEFINED if the page is not a compressed page or length
- of the original data + footer if it is a compressed page */
-ulint
-os_file_original_page_size(const byte* buf)
-{
- ulint type = mach_read_from_2(buf + FIL_PAGE_TYPE);
-
- if (type == FIL_PAGE_COMPRESSED) {
-
- ulint version = mach_read_from_1(buf + FIL_PAGE_VERSION);
- ut_a(version == 1);
-
- return(mach_read_from_2(buf + FIL_PAGE_ORIGINAL_SIZE_V1));
- }
-
- return(ULINT_UNDEFINED);
-}
-
-/** Check if we need to read some more data.
-@param[in] slot The slot that contains the IO request
-@param[in] n_bytes Total bytes read so far
-@return DB_SUCCESS or error code */
-dberr_t
-AIOHandler::check_read(Slot* slot, ulint n_bytes)
-{
- dberr_t err=DB_SUCCESS;
-
- ut_ad(slot->type.is_read());
- ut_ad(slot->original_len > slot->len);
-
- if (is_compressed_page(slot)) {
-
- if (can_decompress(slot)) {
-
- ut_a(slot->offset > 0);
-
- slot->len = slot->original_len;
-#ifdef _WIN32
- slot->n_bytes = static_cast<DWORD>(n_bytes);
-#else
- slot->n_bytes = static_cast<ulint>(n_bytes);
-#endif /* _WIN32 */
- } else {
- /* Read the next block in */
- ut_ad(compressed_page_size(slot) >= n_bytes);
-
- err = DB_FAIL;
- }
- } else {
- err = DB_FAIL;
- }
-
-#ifdef MYSQL_COMPRESSION
- if (slot->buf_block != NULL) {
- os_free_block(slot->buf_block);
- slot->buf_block = NULL;
- }
-#endif
- return(err);
-}
-
/** Do any post processing after a read/write
@return DB_SUCCESS or error code. */
dberr_t
AIOHandler::post_io_processing(Slot* slot)
{
- dberr_t err=DB_SUCCESS;
-
ut_ad(slot->is_reserved);
/* Total bytes read so far */
ulint n_bytes = (slot->ptr - slot->buf) + slot->n_bytes;
- /* Compressed writes can be smaller than the original length.
- Therefore they can be processed without further IO. */
- if (n_bytes == slot->original_len
- || (slot->type.is_write()
- && slot->type.is_compressed()
- && slot->len == static_cast<ulint>(slot->n_bytes))) {
-
-#ifdef MYSQL_COMPRESSION
- if (!slot->type.is_log() && is_compressed_page(slot)) {
-
- ut_a(slot->offset > 0);
-
- if (slot->type.is_read()) {
- slot->len = slot->original_len;
- }
-
- /* The punch hole has been done on collect() */
-
- if (slot->type.is_read()) {
- err = io_complete(slot);
- } else {
- err = DB_SUCCESS;
- }
-
- ut_ad(err == DB_SUCCESS
- || err == DB_UNSUPPORTED
- || err == DB_CORRUPTION
- || err == DB_IO_DECOMPRESS_FAIL);
- } else {
-
- err = DB_SUCCESS;
- }
-
- if (slot->buf_block != NULL) {
- os_free_block(slot->buf_block);
- slot->buf_block = NULL;
- }
-#endif /* MYSQL_COMPRESSION */
- } else if ((ulint) slot->n_bytes == (ulint) slot->len) {
-
- /* It *must* be a partial read. */
- ut_ad(slot->len < slot->original_len);
-
- /* Has to be a read request, if it is less than
- the original length. */
- ut_ad(slot->type.is_read());
- err = check_read(slot, n_bytes);
-
- } else {
- err = DB_FAIL;
- }
-
- return(err);
+ return(n_bytes == slot->original_len ? DB_SUCCESS : DB_FAIL);
}
/** Count the number of free slots
@@ -1219,155 +910,6 @@ AIO::pending_io_count() const
return(reserved);
}
-#ifdef MYSQL_COMPRESSION
-/** Compress a data page
-#param[in] block_size File system block size
-@param[in] src Source contents to compress
-@param[in] src_len Length in bytes of the source
-@param[out] dst Compressed page contents
-@param[out] dst_len Length in bytes of dst contents
-@return buffer data, dst_len will have the length of the data */
-static
-byte*
-os_file_compress_page(
- Compression compression,
- ulint block_size,
- byte* src,
- ulint src_len,
- byte* dst,
- ulint* dst_len)
-{
- ulint len = 0;
- ulint compression_level = page_zip_level;
- ulint page_type = mach_read_from_2(src + FIL_PAGE_TYPE);
-
- /* The page size must be a multiple of the OS punch hole size. */
- ut_ad(!(src_len % block_size));
-
- /* Shouldn't compress an already compressed page. */
- ut_ad(page_type != FIL_PAGE_COMPRESSED);
-
- /* The page must be at least twice as large as the file system
- block size if we are to save any space. Ignore R-Tree pages for now,
- they repurpose the same 8 bytes in the page header. No point in
- compressing if the file system block size >= our page size. */
-
- if (page_type == FIL_PAGE_RTREE
- || block_size == ULINT_UNDEFINED
- || compression.m_type == Compression::NONE
- || src_len < block_size * 2) {
-
- *dst_len = src_len;
-
- return(src);
- }
-
- /* Leave the header alone when compressing. */
- ut_ad(block_size >= FIL_PAGE_DATA * 2);
-
- ut_ad(src_len > FIL_PAGE_DATA + block_size);
-
- /* Must compress to <= N-1 FS blocks. */
- ulint out_len = src_len - (FIL_PAGE_DATA + block_size);
-
- /* This is the original data page size - the page header. */
- ulint content_len = src_len - FIL_PAGE_DATA;
-
- ut_ad(out_len >= block_size - FIL_PAGE_DATA);
- ut_ad(out_len <= src_len - (block_size + FIL_PAGE_DATA));
-
- /* Only compress the data + trailer, leave the header alone */
-
- switch (compression.m_type) {
- case Compression::NONE:
- ut_error;
-
- case Compression::ZLIB: {
-
- uLongf zlen = static_cast<uLongf>(out_len);
-
- if (compress2(
- dst + FIL_PAGE_DATA,
- &zlen,
- src + FIL_PAGE_DATA,
- static_cast<uLong>(content_len),
- static_cast<int>(compression_level)) != Z_OK) {
-
- *dst_len = src_len;
-
- return(src);
- }
-
- len = static_cast<ulint>(zlen);
-
- break;
- }
-
-#ifdef HAVE_LZ4
- case Compression::LZ4:
-
- len = LZ4_compress_limitedOutput(
- reinterpret_cast<char*>(src) + FIL_PAGE_DATA,
- reinterpret_cast<char*>(dst) + FIL_PAGE_DATA,
- static_cast<int>(content_len),
- static_cast<int>(out_len));
-
- ut_a(len <= src_len - FIL_PAGE_DATA);
-
- if (len == 0 || len >= out_len) {
-
- *dst_len = src_len;
-
- return(src);
- }
-
- break;
-#endif
-
- default:
- *dst_len = src_len;
- return(src);
- }
-
- ut_a(len <= out_len);
-
- ut_ad(memcmp(src + FIL_PAGE_LSN + 4,
- src + src_len - FIL_PAGE_END_LSN_OLD_CHKSUM + 4, 4)
- == 0);
-
- /* Copy the header as is. */
- memmove(dst, src, FIL_PAGE_DATA);
-
- /* Add compression control information. Required for decompressing. */
- mach_write_to_2(dst + FIL_PAGE_TYPE, FIL_PAGE_COMPRESSED);
-
- mach_write_to_1(dst + FIL_PAGE_VERSION, 1);
-
- mach_write_to_1(dst + FIL_PAGE_ALGORITHM_V1, compression.m_type);
-
- mach_write_to_2(dst + FIL_PAGE_ORIGINAL_TYPE_V1, page_type);
-
- mach_write_to_2(dst + FIL_PAGE_ORIGINAL_SIZE_V1, content_len);
-
- mach_write_to_2(dst + FIL_PAGE_COMPRESS_SIZE_V1, len);
-
- /* Round to the next full block size */
-
- len += FIL_PAGE_DATA;
-
- *dst_len = ut_calc_align(len, block_size);
-
- ut_ad(*dst_len >= len && *dst_len <= out_len + FIL_PAGE_DATA);
-
- /* Clear out the unused portion of the page. */
- if (len % block_size) {
- memset(dst + len, 0x0, block_size - (len % block_size));
- }
-
- return(dst);
-}
-#endif /* MYSQL_COMPRESSION */
-
#ifdef UNIV_DEBUG
/** Validates the consistency the aio system some of the time.
@return true if ok or the check was skipped */
@@ -1882,87 +1424,6 @@ os_file_create_subdirs_if_needed(
return(success ? DB_SUCCESS : DB_ERROR);
}
-#ifdef MYSQL_COMPRESSION
-/** Allocate the buffer for IO on a transparently compressed table.
-@param[in] type IO flags
-@param[out] buf buffer to read or write
-@param[in,out] n number of bytes to read/write, starting from
- offset
-@return pointer to allocated page, compressed data is written to the offset
- that is aligned on UNIV_SECTOR_SIZE of Block.m_ptr */
-static
-Block*
-os_file_compress_page(
- IORequest& type,
- void*& buf,
- ulint* n)
-{
- ut_ad(!type.is_log());
- ut_ad(type.is_write());
- ut_ad(type.is_compressed());
-
- ulint n_alloc = *n * 2;
-
- ut_a(n_alloc <= UNIV_PAGE_SIZE_MAX * 2);
-#ifdef HAVE_LZ4
- ut_a(type.compression_algorithm().m_type != Compression::LZ4
- || static_cast<ulint>(LZ4_COMPRESSBOUND(*n)) < n_alloc);
-#endif
-
- Block* ptr = reinterpret_cast<Block*>(ut_malloc_nokey(n_alloc));
-
- if (ptr == NULL) {
- return(NULL);
- }
-
- ulint old_compressed_len;
- ulint compressed_len = *n;
-
- old_compressed_len = mach_read_from_2(
- reinterpret_cast<byte*>(buf)
- + FIL_PAGE_COMPRESS_SIZE_V1);
-
- if (old_compressed_len > 0) {
- old_compressed_len = ut_calc_align(
- old_compressed_len + FIL_PAGE_DATA,
- type.block_size());
- }
-
- byte* compressed_page;
-
- compressed_page = static_cast<byte*>(
- ut_align(block->m_ptr, UNIV_SECTOR_SIZE));
-
- byte* buf_ptr;
-
- buf_ptr = os_file_compress_page(
- type.compression_algorithm(),
- type.block_size(),
- reinterpret_cast<byte*>(buf),
- *n,
- compressed_page,
- &compressed_len);
-
- if (buf_ptr != buf) {
- /* Set new compressed size to uncompressed page. */
- memcpy(reinterpret_cast<byte*>(buf) + FIL_PAGE_COMPRESS_SIZE_V1,
- buf_ptr + FIL_PAGE_COMPRESS_SIZE_V1, 2);
-
- buf = buf_ptr;
- *n = compressed_len;
-
- if (compressed_len >= old_compressed_len) {
-
- ut_ad(old_compressed_len <= UNIV_PAGE_SIZE);
-
- type.clear_punch_hole();
- }
- }
-
- return(block);
-}
-#endif /* MYSQL_COMPRESSION */
-
#ifndef _WIN32
/** Do the read/write
@@ -1983,51 +1444,6 @@ SyncFileIO::execute(const IORequest& request)
return(n_bytes);
}
-/** Free storage space associated with a section of the file.
-@param[in] fh Open file handle
-@param[in] off Starting offset (SEEK_SET)
-@param[in] len Size of the hole
-@return DB_SUCCESS or error code */
-static
-dberr_t
-os_file_punch_hole_posix(
- os_file_t fh,
- os_offset_t off,
- os_offset_t len)
-{
-
-#ifdef HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE
- const int mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE;
-
- int ret = fallocate(fh, mode, off, len);
-
- if (ret == 0) {
- return(DB_SUCCESS);
- }
-
- ut_a(ret == -1);
-
- if (errno == ENOTSUP) {
- return(DB_IO_NO_PUNCH_HOLE);
- }
-
- ib::warn()
- << "fallocate(" << fh
- <<", FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, "
- << off << ", " << len << ") returned errno: "
- << errno;
-
- return(DB_IO_ERROR);
-
-#elif defined(UNIV_SOLARIS)
-
- // Use F_FREESP
-
-#endif /* HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE */
-
- return(DB_IO_NO_PUNCH_HOLE);
-}
-
#if defined(LINUX_NATIVE_AIO)
/** Linux native AIO handler */
@@ -2318,20 +1734,7 @@ LinuxAIOHandler::collect()
/* We have not overstepped to next segment. */
ut_a(slot->pos < end_pos);
- /* We never compress/decompress the first page */
-
- if (slot->offset > 0
- && !slot->skip_punch_hole
- && slot->type.is_compression_enabled()
- && !slot->type.is_log()
- && slot->type.is_write()
- && slot->type.is_compressed()
- && slot->type.punch_hole()) {
-
- slot->err = AIOHandler::io_complete(slot);
- } else {
- slot->err = DB_SUCCESS;
- }
+ slot->err = DB_SUCCESS;
/* Mark this request as completed. The error handling
will be done in the calling function. */
@@ -2497,16 +1900,7 @@ os_aio_linux_handler(
void** m2,
IORequest* request)
{
- LinuxAIOHandler handler(global_segment);
-
- dberr_t err = handler.poll(m1, m2, request);
-
- if (err == DB_IO_NO_PUNCH_HOLE) {
- fil_no_punch_hole(*m1);
- err = DB_SUCCESS;
- }
-
- return(err);
+ return LinuxAIOHandler(global_segment).poll(m1, m2, request);
}
/** Dispatch an AIO request to the kernel.
@@ -3959,66 +3353,6 @@ struct WinIoInit
/* Ensures proper initialization and shutdown */
static WinIoInit win_io_init;
-/** Check if the file system supports sparse files.
-@param[in] name File name
-@return true if the file system supports sparse files */
-static
-bool
-os_is_sparse_file_supported_win32(const char* filename)
-{
- char volname[MAX_PATH];
- BOOL result = GetVolumePathName(filename, volname, MAX_PATH);
-
- if (!result) {
-
- ib::error()
- << "os_is_sparse_file_supported: "
- << "Failed to get the volume path name for: "
- << filename
- << "- OS error number " << GetLastError();
-
- return(false);
- }
-
- DWORD flags;
-
- GetVolumeInformation(
- volname, NULL, MAX_PATH, NULL, NULL,
- &flags, NULL, MAX_PATH);
-
- return(flags & FILE_SUPPORTS_SPARSE_FILES) ? true : false;
-}
-
-/** Free storage space associated with a section of the file.
-@param[in] fh Open file handle
-@param[in] page_size Tablespace page size
-@param[in] block_size File system block size
-@param[in] off Starting offset (SEEK_SET)
-@param[in] len Size of the hole
-@return 0 on success or errno */
-static
-dberr_t
-os_file_punch_hole_win32(
- os_file_t fh,
- os_offset_t off,
- os_offset_t len)
-{
- FILE_ZERO_DATA_INFORMATION punch;
-
- punch.FileOffset.QuadPart = off;
- punch.BeyondFinalZero.QuadPart = off + len;
-
- /* If lpOverlapped is NULL, lpBytesReturned cannot be NULL,
- therefore we pass a dummy parameter. */
- DWORD temp;
-
- BOOL result = DeviceIoControl(
- fh, FSCTL_SET_ZERO_DATA, &punch, sizeof(punch),
- NULL, 0, &temp, NULL);
-
- return(!result ? DB_IO_NO_PUNCH_HOLE : DB_SUCCESS);
-}
-
/** Check the existence and type of the given file.
@param[in] path path name of file
@param[out] exists true if the file exists
@@ -5243,30 +4577,6 @@ AIO::simulated_put_read_threads_to_sleep()
#endif /* !_WIN32*/
-#ifdef MYSQL_COMPRESSION
-/** Validate the type, offset and number of bytes to read *
-@param[in] type IO flags
-@param[in] offset Offset from start of the file
-@param[in] n Number of bytes to read from offset */
-static
-void
-os_file_check_args(const IORequest& type, os_offset_t offset, ulint n)
-{
- ut_ad(type.validate());
-
- ut_ad(n > 0);
-
- /* If off_t is > 4 bytes in size, then we assume we can pass a
- 64-bit address */
- off_t offs = static_cast<off_t>(offset);
-
- if (sizeof(off_t) <= 4 && offset != (os_offset_t) offs) {
-
- ib::error() << "file write at offset > 4 GB.";
- }
-}
-#endif /* MYSQL_COMPRESSION */
-
/** Does a syncronous read or write depending upon the type specified
In case of partial reads/writes the function tries
NUM_RETRIES_ON_PARTIAL_IO times to read/write the complete data.
@@ -5289,27 +4599,8 @@ os_file_io(
{
ulint original_n = n;
IORequest type = in_type;
- byte* compressed_page=NULL;
ssize_t bytes_returned = 0;
-#ifdef MYSQL_COMPRESSION
- Block* block=NULL;
- if (type.is_compressed()) {
-
- /* We don't compress the first page of any file. */
- ut_ad(offset > 0);
-
- block = os_file_compress_page(type, buf, &n);
-
- compressed_page = static_cast<byte*>(
- ut_align(block->m_ptr, UNIV_SECTOR_SIZE));
-
- } else {
- block = NULL;
- compressed_page = NULL;
- }
-#endif /* MYSQL_COMPRESSION */
-
SyncFileIO sync_file_io(file, buf, n, offset);
for (ulint i = 0; i < NUM_RETRIES_ON_PARTIAL_IO; ++i) {
@@ -5325,11 +4616,6 @@ os_file_io(
bytes_returned += n_bytes;
*err = DB_SUCCESS;
-#ifdef MYSQL_COMPRESSION
- if (block != NULL) {
- os_free_block(block);
- }
-#endif
return(original_n);
}
@@ -5357,12 +4643,6 @@ os_file_io(
sync_file_io.advance(n_bytes);
}
-#ifdef MYSQL_COMPRESSION
- if (block != NULL) {
- os_free_block(block);
- }
-#endif
-
*err = DB_IO_ERROR;
if (!type.is_partial_io_warning_disabled()) {
@@ -5388,7 +4668,7 @@ ssize_t
os_file_pwrite(
IORequest& type,
os_file_t file,
- const byte* buf,
+ const void* buf,
ulint n,
os_offset_t offset,
dberr_t* err)
@@ -5400,7 +4680,8 @@ os_file_pwrite(
(void) my_atomic_addlint(&os_n_pending_writes, 1);
MONITOR_ATOMIC_INC(MONITOR_OS_PENDING_WRITES);
- ssize_t n_bytes = os_file_io(type, file, (void*) buf, n, offset, err);
+ ssize_t n_bytes = os_file_io(type, file, const_cast<void*>(buf),
+ n, offset, err);
(void) my_atomic_addlint(&os_n_pending_writes, -1);
MONITOR_ATOMIC_DEC(MONITOR_OS_PENDING_WRITES);
@@ -5415,21 +4696,21 @@ os_file_pwrite(
@param[in] offset file offset from the start where to read
@param[in] n number of bytes to read, starting from offset
@return DB_SUCCESS if request was successful, false if fail */
-static MY_ATTRIBUTE((warn_unused_result))
dberr_t
-os_file_write_page(
+os_file_write_func(
IORequest& type,
const char* name,
os_file_t file,
- const byte* buf,
+ const void* buf,
os_offset_t offset,
ulint n)
{
dberr_t err;
+ ut_ad(type.is_write());
ut_ad(type.validate());
ut_ad(n > 0);
-
+
ssize_t n_bytes = os_file_pwrite(type, file, buf, n, offset, &err);
if ((ulint) n_bytes != n && !os_has_said_disk_full) {
@@ -5533,23 +4814,7 @@ os_file_read_page(
return(err);
} else if ((ulint) n_bytes == n) {
-
-#ifdef MYSQL_COMPRESSION
- /** The read will succeed but decompress can fail
- for various reasons. */
-
- if (type.is_compression_enabled()
- && !Compression::is_compressed_page(
- static_cast<byte*>(buf))) {
-
- return(DB_SUCCESS);
-
- } else {
- return(err);
- }
-#else
return(DB_SUCCESS);
-#endif /* MYSQL_COMPRESSION */
}
ib::error() << "Tried to read " << n
@@ -5930,37 +5195,6 @@ os_file_read_no_error_handling_func(
return(os_file_read_page(type, file, buf, offset, n, o, false));
}
-/** NOTE! Use the corresponding macro os_file_write(), not directly
-Requests a synchronous write operation.
-@param[in] type IO flags
-@param[in] file handle to an open file
-@param[out] buf buffer from which to write
-@param[in] offset file offset from the start where to read
-@param[in] n number of bytes to read, starting from offset
-@return DB_SUCCESS if request was successful, false if fail */
-dberr_t
-os_file_write_func(
- IORequest& type,
- const char* name,
- os_file_t file,
- const void* buf,
- os_offset_t offset,
- ulint n)
-{
- ut_ad(type.validate());
- ut_ad(type.is_write());
-
- /* We never compress the first page.
- Note: This assumes we always do block IO. */
- if (offset == 0) {
- type.clear_compressed();
- }
-
- const byte* ptr = reinterpret_cast<const byte*>(buf);
-
- return(os_file_write_page(type, name, file, ptr, offset, n));
-}
-
/** Check the existence and type of the given file.
@param[in] path path name of file
@param[out] exists true if the file exists
@@ -5979,65 +5213,6 @@ os_file_status(
#endif /* _WIN32 */
}
-/** Free storage space associated with a section of the file.
-@param[in] fh Open file handle
-@param[in] off Starting offset (SEEK_SET)
-@param[in] len Size of the hole
-@return DB_SUCCESS or error code */
-dberr_t
-os_file_punch_hole(
- os_file_t fh,
- os_offset_t off,
- os_offset_t len)
-{
- /* In this debugging mode, we act as if punch hole is supported,
- and then skip any calls to actually punch a hole here.
- In this way, Transparent Page Compression is still being tested. */
- DBUG_EXECUTE_IF("ignore_punch_hole",
- return(DB_SUCCESS);
- );
-
-#ifdef _WIN32
- return(os_file_punch_hole_win32(fh, off, len));
-#else
- return(os_file_punch_hole_posix(fh, off, len));
-#endif /* _WIN32 */
-}
-
-/** Check if the file system supports sparse files.
-
-Warning: On POSIX systems we try and punch a hole from offset 0 to
-the system configured page size. This should only be called on an empty
-file.
-
-Note: On Windows we use the name and on Unices we use the file handle.
-
-@param[in] name File name
-@param[in] fh File handle for the file - if opened
-@return true if the file system supports sparse files */
-bool
-os_is_sparse_file_supported(const char* path, os_file_t fh)
-{
- /* In this debugging mode, we act as if punch hole is supported,
- then we skip any calls to actually punch a hole. In this way,
- Transparent Page Compression is still being tested. */
- DBUG_EXECUTE_IF("ignore_punch_hole",
- return(true);
- );
-
-#ifdef _WIN32
- return(os_is_sparse_file_supported_win32(path));
-#else
- dberr_t err;
-
- /* We don't know the FS block size, use the sector size. The FS
- will do the magic. */
- err = os_file_punch_hole(fh, 0, UNIV_PAGE_SIZE);
-
- return(err == DB_SUCCESS);
-#endif /* _WIN32 */
-}
-
/** This function returns information about the specified file
@param[in] path pathname of the file
@param[out] stat_info information of a file in a directory
@@ -6192,16 +5367,6 @@ AIO::init_slots()
memset(&slot.control, 0x0, sizeof(slot.control));
#endif /* WIN_ASYNC_IO */
-
- slot.compressed_ptr = reinterpret_cast<byte*>(
- ut_zalloc_nokey(UNIV_PAGE_SIZE_MAX * 2));
-
- if (slot.compressed_ptr == NULL) {
- return(DB_OUT_OF_MEMORY);
- }
-
- slot.compressed_page = static_cast<byte *>(
- ut_align(slot.compressed_ptr, UNIV_PAGE_SIZE));
}
return(DB_SUCCESS);
@@ -6328,16 +5493,6 @@ AIO::~AIO()
}
#endif /* LINUX_NATIVE_AIO */
- for (ulint i = 0; i < m_slots.size(); ++i) {
- Slot& slot = m_slots[i];
-
- if (slot.compressed_ptr != NULL) {
- ut_free(slot.compressed_ptr);
- slot.compressed_ptr = NULL;
- slot.compressed_page = NULL;
- }
- }
-
m_slots.clear();
}
@@ -6499,27 +5654,6 @@ os_aio_init(
/* Maximum number of pending aio operations allowed per segment */
ulint limit = 8 * OS_AIO_N_PENDING_IOS_PER_THREAD;
-
- ut_a(block_cache == NULL);
-
- block_cache = UT_NEW_NOKEY(Blocks(MAX_BLOCKS));
-
- for (Blocks::iterator it = block_cache->begin();
- it != block_cache->end();
- ++it) {
-
- ut_a(it->m_in_use == 0);
- ut_a(it->m_ptr == NULL);
-
- /* Allocate double of max page size memory, since
- compress could generate more bytes than orgininal
- data. */
- it->m_ptr = static_cast<byte*>(
- ut_malloc_nokey(BUFFER_BLOCK_SIZE));
-
- ut_a(it->m_ptr != NULL);
- }
-
return(AIO::start(limit, n_readers, n_writers, n_slots_sync));
}
@@ -6536,18 +5670,6 @@ os_aio_free()
ut_free(os_aio_segment_wait_events);
os_aio_segment_wait_events = 0;
os_aio_n_segments = 0;
-
- for (Blocks::iterator it = block_cache->begin();
- it != block_cache->end();
- ++it) {
-
- ut_a(it->m_in_use == 0);
- ut_free(it->m_ptr);
- }
-
- UT_DELETE(block_cache);
-
- block_cache = NULL;
}
/** Wakes up all async i/o threads so that they know to exit themselves in
@@ -6753,40 +5875,8 @@ AIO::reserve_slot(
slot->is_log = type.is_log();
slot->original_len = static_cast<uint32>(len);
slot->io_already_done = false;
- slot->buf_block = NULL;
slot->buf = static_cast<byte*>(buf);
-#ifdef MYSQL_COMPRESSION
- if (srv_use_native_aio
- && offset > 0
- && type.is_write()
- && type.is_compressed()) {
- ulint compressed_len = len;
-
- ut_ad(!type.is_log());
-
- release();
-
- void* src_buf = slot->buf;
-
- slot->buf_block = os_file_compress_page(
- type,
- src_buf,
- &compressed_len);
-
- slot->buf = static_cast<byte*>(src_buf);
- slot->ptr = slot->buf;
-#ifdef _WIN32
- slot->len = static_cast<DWORD>(compressed_len);
-#else
- slot->len = static_cast<ulint>(compressed_len);
-#endif /* _WIN32 */
- slot->skip_punch_hole = type.punch_hole();
-
- acquire();
- }
-#endif /* MYSQL_COMPRESSION */
-
#ifdef WIN_ASYNC_IO
{
OVERLAPPED* control;
@@ -7506,7 +6596,7 @@ private:
slot->offset,
slot->len);
- ut_a(err == DB_SUCCESS || err == DB_IO_NO_PUNCH_HOLE);
+ ut_a(err == DB_SUCCESS);
}
/** @return true if the slots are adjacent and can be merged */
@@ -8134,292 +7224,9 @@ os_file_set_umask(ulint umask)
}
#else
-
#include "univ.i"
-#include "db0err.h"
-#include "mach0data.h"
-#include "fil0fil.h"
-#include "os0file.h"
-
-#ifdef HAVE_LZ4
-#include <lz4.h>
-#endif
-
-#include <zlib.h>
-#ifndef UNIV_INNOCHECKSUM
-#include <my_aes.h>
-#include <my_rnd.h>
-#include <mysqld.h>
-#include <mysql/service_mysql_keyring.h>
-#endif
-
-typedef byte Block;
-
-#ifdef MYSQL_COMPRESSION
-/** Allocate a page for sync IO
-@return pointer to page */
-static
-Block*
-os_alloc_block()
-{
- return(reinterpret_cast<byte*>(malloc(UNIV_PAGE_SIZE_MAX * 2)));
-}
-
-/** Free a page after sync IO
-@param[in,own] block The block to free/release */
-static
-void
-os_free_block(Block* block)
-{
- ut_free(block);
-}
-#endif
#endif /* !UNIV_INNOCHECKSUM */
-#ifdef MYSQL_COMPRESSION
-
-/**
-@param[in] type The compression type
-@return the string representation */
-const char*
-Compression::to_string(Type type)
-{
- switch(type) {
- case NONE:
- return("None");
- case ZLIB:
- return("Zlib");
- case LZ4:
- return("LZ4");
- }
-
- ut_ad(0);
-
- return("<UNKNOWN>");
-}
-
-/**
-@param[in] meta Page Meta data
-@return the string representation */
-std::string Compression::to_string(const Compression::meta_t& meta)
-{
- std::ostringstream stream;
-
- stream << "version: " << int(meta.m_version) << " "
- << "algorithm: " << meta.m_algorithm << " "
- << "(" << to_string(meta.m_algorithm) << ") "
- << "orginal_type: " << meta.m_original_type << " "
- << "original_size: " << meta.m_original_size << " "
- << "compressed_size: " << meta.m_compressed_size;
-
- return(stream.str());
-}
-
-/** @return true if it is a compressed page */
-bool
-Compression::is_compressed_page(const byte* page)
-{
- return(mach_read_from_2(page + FIL_PAGE_TYPE) == FIL_PAGE_COMPRESSED);
-}
-
-/** Deserizlise the page header compression meta-data
-@param[in] page Pointer to the page header
-@param[out] control Deserialised data */
-void
-Compression::deserialize_header(
- const byte* page,
- Compression::meta_t* control)
-{
- ut_ad(is_compressed_page(page));
-
- control->m_version = static_cast<uint8_t>(
- mach_read_from_1(page + FIL_PAGE_VERSION));
-
- control->m_original_type = static_cast<uint16_t>(
- mach_read_from_2(page + FIL_PAGE_ORIGINAL_TYPE_V1));
-
- control->m_compressed_size = static_cast<uint16_t>(
- mach_read_from_2(page + FIL_PAGE_COMPRESS_SIZE_V1));
-
- control->m_original_size = static_cast<uint16_t>(
- mach_read_from_2(page + FIL_PAGE_ORIGINAL_SIZE_V1));
-
- control->m_algorithm = static_cast<Type>(
- mach_read_from_1(page + FIL_PAGE_ALGORITHM_V1));
-}
-
-/** Decompress the page data contents. Page type must be FIL_PAGE_COMPRESSED, if
-not then the source contents are left unchanged and DB_SUCCESS is returned.
-@param[in] dblwr_recover true of double write recovery in progress
-@param[in,out] src Data read from disk, decompressed data will be
- copied to this page
-@param[in,out] dst Scratch area to use for decompression
-@param[in] dst_len Size of the scratch area in bytes
-@return DB_SUCCESS or error code */
-dberr_t
-Compression::deserialize(
- bool dblwr_recover,
- byte* src,
- byte* dst,
- ulint dst_len)
-{
- if (!is_compressed_page(src)) {
- /* There is nothing we can do. */
- return(DB_SUCCESS);
- }
-
- meta_t header;
-
- deserialize_header(src, &header);
-
- byte* ptr = src + FIL_PAGE_DATA;
-
- ut_ad(header.m_version == 1);
-
- if (header.m_version != 1
- || header.m_original_size < UNIV_PAGE_SIZE_MIN - (FIL_PAGE_DATA + 8)
- || header.m_original_size > UNIV_PAGE_SIZE_MAX - FIL_PAGE_DATA
- || dst_len < header.m_original_size + FIL_PAGE_DATA) {
-
- /* The last check could potentially return DB_OVERFLOW,
- the caller should be able to retry with a larger buffer. */
-
- return(DB_CORRUPTION);
- }
-
- Block* block;
-
- /* The caller doesn't know what to expect */
- if (dst == NULL) {
-
- block = os_alloc_block();
-
-#ifdef UNIV_INNOCHECKSUM
- dst = block;
-#else
- dst = block->m_ptr;
-#endif /* UNIV_INNOCHECKSUM */
-
- } else {
- block = NULL;
- }
-
- int ret;
- Compression compression;
- ulint len = header.m_original_size;
-
- compression.m_type = static_cast<Compression::Type>(header.m_algorithm);
-
- switch(compression.m_type) {
- case Compression::ZLIB: {
-
- uLongf zlen = header.m_original_size;
-
- if (uncompress(dst, &zlen, ptr, header.m_compressed_size)
- != Z_OK) {
-
- if (block != NULL) {
- os_free_block(block);
- }
-
- return(DB_IO_DECOMPRESS_FAIL);
- }
-
- len = static_cast<ulint>(zlen);
-
- break;
- }
-#ifdef HAVE_LZ4
- case Compression::LZ4: {
- int ret;
-
- if (dblwr_recover) {
-
- ret = LZ4_decompress_safe(
- reinterpret_cast<char*>(ptr),
- reinterpret_cast<char*>(dst),
- header.m_compressed_size,
- header.m_original_size);
-
- } else {
-
- /* This can potentially read beyond the input
- buffer if the data is malformed. According to
- the LZ4 documentation it is a little faster
- than the above function. When recovering from
- the double write buffer we can afford to us the
- slower function above. */
-
- ret = LZ4_decompress_fast(
- reinterpret_cast<char*>(ptr),
- reinterpret_cast<char*>(dst),
- header.m_original_size);
- }
-
- if (ret < 0) {
-
- if (block != NULL) {
- os_free_block(block);
- }
-
- return(DB_IO_DECOMPRESS_FAIL);
- }
-
- break;
- }
-#endif
- default:
-#if !defined(UNIV_INNOCHECKSUM)
- ib::error()
- << "Compression algorithm support missing: "
- << Compression::to_string(compression.m_type);
-#else
- fprintf(stderr, "Compression algorithm support missing: %s\n",
- Compression::to_string(compression.m_type));
-#endif /* !UNIV_INNOCHECKSUM */
-
- if (block != NULL) {
- os_free_block(block);
- }
-
- return(DB_UNSUPPORTED);
- }
- /* Leave the header alone */
- memmove(src + FIL_PAGE_DATA, dst, len);
-
- mach_write_to_2(src + FIL_PAGE_TYPE, header.m_original_type);
-
- ut_ad(dblwr_recover
- || memcmp(src + FIL_PAGE_LSN + 4,
- src + (header.m_original_size + FIL_PAGE_DATA)
- - FIL_PAGE_END_LSN_OLD_CHKSUM + 4, 4) == 0);
-
- if (block != NULL) {
- os_free_block(block);
- }
-
- return(DB_SUCCESS);
-}
-
-/** Decompress the page data contents. Page type must be FIL_PAGE_COMPRESSED, if
-not then the source contents are left unchanged and DB_SUCCESS is returned.
-@param[in] dblwr_recover true of double write recovery in progress
-@param[in,out] src Data read from disk, decompressed data will be
- copied to this page
-@param[in,out] dst Scratch area to use for decompression
-@param[in] dst_len Size of the scratch area in bytes
-@return DB_SUCCESS or error code */
-dberr_t
-os_file_decompress_page(
- bool dblwr_recover,
- byte* src,
- byte* dst,
- ulint dst_len)
-{
- return(Compression::deserialize(dblwr_recover, src, dst, dst_len));
-}
-#endif /* MYSQL_COMPRESSION */
-
/** Normalizes a directory path for the current OS:
On Windows, we convert '/' to '\', else we convert '\' to '/'.
@param[in,out] str A null-terminated directory and file path */
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index a5cd0064ddd..fbcb6149add 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -1182,9 +1182,6 @@ row_merge_read(
IORequest request;
- /* Merge sort pages are never compressed. */
- request.disable_compression();
-
dberr_t err = os_file_read_no_error_handling(
request,
OS_FILE_FROM_FD(fd), buf, ofs, srv_sort_buf_size, NULL);
@@ -1239,8 +1236,6 @@ row_merge_write(
mach_write_to_4((byte *)out_buf, 0);
}
- request.disable_compression();
-
dberr_t err = os_file_write(
request,
"(merge)", OS_FILE_FROM_FD(fd), out_buf, ofs, buf_len);
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 0c3a4e6bdae..21bcd381c87 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -2420,9 +2420,6 @@ row_create_table_for_mysql(
dict_table_t* table, /*!< in, own: table definition
(will be freed, or on DB_SUCCESS
added to the data dictionary cache) */
- const char* compression,
- /*!< in: compression algorithm to use,
- can be NULL */
trx_t* trx, /*!< in/out: transaction */
bool commit, /*!< in: if true, commit the transaction */
fil_encryption_t mode, /*!< in: encryption mode */
@@ -2510,46 +2507,11 @@ err_exit:
/* We must delete the link file. */
RemoteDatafile::delete_link_file(table->name.m_name);
-
- } else if (compression != NULL && compression[0] != '\0') {
-#ifdef MYSQL_COMPRESSION
- ut_ad(!dict_table_in_shared_tablespace(table));
-
- ut_ad(Compression::validate(compression) == DB_SUCCESS);
-
- err = fil_set_compression(table, compression);
-
- switch (err) {
- case DB_SUCCESS:
- break;
- case DB_NOT_FOUND:
- case DB_UNSUPPORTED:
- case DB_IO_NO_PUNCH_HOLE_FS:
- /* Return these errors */
- break;
- case DB_IO_NO_PUNCH_HOLE_TABLESPACE:
- /* Page Compression will not be used. */
- err = DB_SUCCESS;
- break;
- default:
- ut_error;
- }
-
- /* We can check for file system punch hole support
- only after creating the tablespace. On Windows
- we can query that information but not on Linux. */
- ut_ad(err == DB_SUCCESS
- || err == DB_IO_NO_PUNCH_HOLE_FS);
-#endif /* MYSQL_COMPRESSION */
-
- /* In non-strict mode we ignore dodgy compression
- settings. */
}
}
switch (err) {
case DB_SUCCESS:
- case DB_IO_NO_PUNCH_HOLE_FS:
break;
case DB_OUT_OF_FILE_SPACE:
trx->error_state = DB_SUCCESS;
diff --git a/storage/innobase/row/row0trunc.cc b/storage/innobase/row/row0trunc.cc
index 1c118dabc61..2d5ba6781d4 100644
--- a/storage/innobase/row/row0trunc.cc
+++ b/storage/innobase/row/row0trunc.cc
@@ -395,8 +395,6 @@ public:
IORequest request(IORequest::WRITE);
- request.disable_compression();
-
io_err = os_file_write(
request, m_log_file_name, handle, log_buf, 0, sz);
@@ -488,8 +486,6 @@ public:
IORequest request(IORequest::WRITE);
- request.disable_compression();
-
err = os_file_write(
request,
m_log_file_name, handle, buffer, 0, sizeof(buffer));
@@ -671,8 +667,6 @@ TruncateLogParser::parse(
IORequest request(IORequest::READ);
- request.disable_compression();
-
/* Align the memory for file i/o if we might have O_DIRECT set*/
byte* log_buf = static_cast<byte*>(ut_align(buf, UNIV_PAGE_SIZE));
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index 002477bc4e0..2fa7a02e85e 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -195,8 +195,6 @@ UNIV_INTERN long srv_mtflush_threads = MTFLUSH_DEFAULT_WORKER;
UNIV_INTERN my_bool srv_use_mtflush = FALSE;
#ifdef UNIV_DEBUG
-/** Force all user tables to use page compression. */
-ulong srv_debug_compress;
/** Used by SET GLOBAL innodb_master_thread_disabled_debug = X. */
my_bool srv_master_thread_disabled_debug;
/** Event used to inform that master thread is disabled. */
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index fd00e95e494..dfed856b051 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -1454,14 +1454,6 @@ innobase_start_or_create_for_mysql(void)
}
#endif /* HAVE_LZO1X */
-#ifdef UNIV_LINUX
-# ifdef HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE
- ib::info() << "PUNCH HOLE support available";
-# else
- ib::info() << "PUNCH HOLE support not available";
-# endif /* HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE */
-#endif /* UNIV_LINUX */
-
if (sizeof(ulint) != sizeof(void*)) {
ib::error() << "Size of InnoDB's ulint is " << sizeof(ulint)
<< ", but size of void* is " << sizeof(void*)
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc
index acde762a0b7..0763e0fa057 100644
--- a/storage/innobase/trx/trx0purge.cc
+++ b/storage/innobase/trx/trx0purge.cc
@@ -703,8 +703,6 @@ namespace undo {
IORequest request(IORequest::WRITE);
- request.disable_compression();
-
err = os_file_write(
request, log_file_name, handle, log_buf, 0, sz);
@@ -768,8 +766,6 @@ namespace undo {
IORequest request(IORequest::WRITE);
- request.disable_compression();
-
err = os_file_write(
request, log_file_name, handle, log_buf, 0, sz);
@@ -837,8 +833,6 @@ namespace undo {
IORequest request(IORequest::READ);
- request.disable_compression();
-
dberr_t err;
err = os_file_read(request, handle, log_buf, 0, sz);
diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc
index d296fb5afe2..9eb11c913c5 100644
--- a/storage/innobase/ut/ut0ut.cc
+++ b/storage/innobase/ut/ut0ut.cc
@@ -749,16 +749,8 @@ ut_strerr(
return("Table is corrupted");
case DB_FTS_TOO_MANY_WORDS_IN_PHRASE:
return("Too many words in a FTS phrase or proximity search");
- case DB_IO_DECOMPRESS_FAIL:
- return("Page decompress failed after reading from disk");
case DB_DECRYPTION_FAILED:
return("Table is encrypted but decrypt failed.");
- case DB_IO_NO_PUNCH_HOLE:
- return("No punch hole support");
- case DB_IO_NO_PUNCH_HOLE_FS:
- return("Punch hole not supported by the file system");
- case DB_IO_NO_PUNCH_HOLE_TABLESPACE:
- return("Punch hole not supported by the tablespace");
case DB_IO_PARTIAL_FAILED:
return("Partial IO failed");
case DB_FORCED_ABORT: