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.
This commit is contained in:
Marko Mäkelä 2017-01-16 14:03:36 +02:00
parent 70c11485d2
commit 1eabad5dbe
28 changed files with 107 additions and 2376 deletions

View file

@ -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 */

View file

@ -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 "

View file

@ -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 */

View file

@ -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)

View file

@ -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()));

View file

@ -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) {

View file

@ -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;
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;
temp_table_heap = mem_heap_create(256);
dict_table_add_to_cache(
table, FALSE, temp_table_heap);
DBUG_EXECUTE_IF("ib_ddl_crash_during_create2",
DBUG_SUICIDE(););
mem_heap_free(temp_table_heap);
}
#ifdef MYSQL_COMPRESSION
}
#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 */
/* 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;
temp_table_heap = mem_heap_create(256);
dict_table_add_to_cache(
table, FALSE, temp_table_heap);
DBUG_EXECUTE_IF("ib_ddl_crash_during_create2",
DBUG_SUICIDE(););
mem_heap_free(temp_table_heap);
}
} else {
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),

View file

@ -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);

View file

@ -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);

View file

@ -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 */

View file

@ -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:

View file

@ -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

View file

@ -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 */

View file

@ -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))) {
page_type == FIL_PAGE_TYPE_UNKNOWN))) {
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);
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;
}

View file

@ -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

View file

@ -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 */

View file

@ -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

View file

@ -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 */

View file

@ -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 */

View file

@ -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()

File diff suppressed because it is too large Load diff

View file

@ -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);

View file

@ -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;

View file

@ -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));

View file

@ -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. */

View file

@ -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*)

View file

@ -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);

View file

@ -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: