Commit 0c1de94d authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.0 into 10.1

parents ba8198a3 80d5d145
......@@ -5800,6 +5800,7 @@ void do_connect(struct st_command *command)
my_bool con_shm __attribute__ ((unused))= 0;
int read_timeout= 0;
int write_timeout= 0;
int connect_timeout= 0;
struct st_connection* con_slot;
static DYNAMIC_STRING ds_connection_name;
......@@ -5906,6 +5907,11 @@ void do_connect(struct st_command *command)
{
write_timeout= atoi(con_options + sizeof("write_timeout=")-1);
}
else if (strncasecmp(con_options, "connect_timeout=",
sizeof("connect_timeout=")-1) == 0)
{
connect_timeout= atoi(con_options + sizeof("connect_timeout=")-1);
}
else
die("Illegal option to connect: %.*s",
(int) (end - con_options), con_options);
......@@ -5990,6 +5996,12 @@ void do_connect(struct st_command *command)
(char*)&write_timeout);
}
if (connect_timeout)
{
mysql_options(con_slot->mysql, MYSQL_OPT_CONNECT_TIMEOUT,
(char*)&connect_timeout);
}
#ifdef HAVE_SMEM
if (con_shm)
{
......
......@@ -2157,23 +2157,22 @@ Warnings:
Warning 1052 Column 'kundentyp' in group statement is ambiguous
drop table t1;
SET optimizer_switch=@save_optimizer_switch;
SELECT sleep(5.5);
SELECT sleep(5);
SELECT sleep(50);
SELECT sleep(50);
# -- Success: more than --thread_pool_max_threads normal connections not possible
sleep(5.5)
0
sleep(5)
0
SELECT sleep(5);
SELECT sleep(5);
SELECT 'Connection on extra port ok';
Connection on extra port ok
Connection on extra port ok
SELECT sleep(5.5);
SELECT 'Connection on extra port 2 ok';
Connection on extra port 2 ok
Connection on extra port 2 ok
# -- Success: more than --extra-max-connections + 1 normal connections not possible
sleep(5)
0
sleep(5)
KILL QUERY <default_connection_ID>;
KILL QUERY <con2_connection_ID>;
sleep(50)
1
sleep(50)
1
sleep(5.5)
0
--source include/not_valgrind.inc
--disable_ps_protocol
SET GLOBAL net_write_timeout = 900;
......
......@@ -7,8 +7,5 @@ loose-thread_pool_max_threads= 2
extra-port= @ENV.MASTER_EXTRA_PORT
extra-max-connections=1
[client]
connect-timeout= 2
[ENV]
MASTER_EXTRA_PORT= @OPT.port
......@@ -15,23 +15,26 @@ SET optimizer_switch=@save_optimizer_switch;
# connections on the extra port.
# First set two connections running, and check that extra connection
# on normal port fails due to--thread-pool-max_threads=2
# on normal port fails due to --thread-pool-max-threads=2.
# We can afford using a really long sleep, because we won't wait
# till it ends, we'll interrupt it as soon as we don't need it anymore
connection default;
--let $con1_id= `SELECT CONNECTION_ID()`
# Sleep for slightly longer than 5 sec to trigger MDEV-4566
# (abort in interruptible wait connection check)
send SELECT sleep(5.5);
send SELECT sleep(50);
--sleep 1
connect(con2,localhost,root,,);
connection con2;
send SELECT sleep(5);
--let $con2_id= `SELECT CONNECTION_ID()`
send SELECT sleep(50);
--sleep 0.5
--disable_abort_on_error
--disable_result_log
--disable_query_log
connect(con3,localhost,root,,);
connect(con3,localhost,root,,,,,connect_timeout=2);
--enable_query_log
--enable_result_log
--enable_abort_on_error
......@@ -45,24 +48,15 @@ if ($error)
--echo # -- Success: more than --thread_pool_max_threads normal connections not possible
}
connection default;
--reap
connection con2;
--reap
# Now try again, but this time use the extra port to successfully connect.
connection default;
send SELECT sleep(5);
connection con2;
send SELECT sleep(5);
--sleep 1
connect(extracon,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,);
connection extracon;
SELECT 'Connection on extra port ok';
# Here, sleep just for slightly longer than 5 sec to trigger MDEV-4566
# (abort in interruptible wait connection check).
send SELECT sleep(5.5);
connect(extracon2,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,);
connection extracon2;
SELECT 'Connection on extra port 2 ok';
......@@ -70,7 +64,7 @@ SELECT 'Connection on extra port 2 ok';
--disable_abort_on_error
--disable_result_log
--disable_query_log
connect(extracon3,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,);
connect(extracon3,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,,connect_timeout=2);
--enable_query_log
--enable_result_log
--enable_abort_on_error
......@@ -84,7 +78,16 @@ if ($error)
--echo # -- Success: more than --extra-max-connections + 1 normal connections not possible
}
connection extracon2;
--replace_result $con1_id <default_connection_ID>
eval KILL QUERY $con1_id;
--replace_result $con2_id <con2_connection_ID>
eval KILL QUERY $con2_id;
connection default;
--reap
connection con2;
--reap
connection extracon;
--reap
......@@ -419,8 +419,7 @@ unpack_row(rpl_group_info *rgi,
/*
Add Extra slave persistent columns
*/
int error= 0;
if ((error= fill_extra_persistent_columns(table, cols->n_bits)))
if (int error= fill_extra_persistent_columns(table, cols->n_bits))
DBUG_RETURN(error);
/*
......
/*****************************************************************************
Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, MariaDB Corporation.
Copyright (c) 2016, 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
......@@ -273,10 +273,6 @@ dict_boot(void)
ut_ad(DICT_NUM_FIELDS__SYS_FOREIGN_FOR_NAME == 2);
ut_ad(DICT_NUM_COLS__SYS_FOREIGN_COLS == 4);
ut_ad(DICT_NUM_FIELDS__SYS_FOREIGN_COLS == 6);
ut_ad(DICT_NUM_COLS__SYS_ZIP_DICT == 3);
ut_ad(DICT_NUM_FIELDS__SYS_ZIP_DICT == 5);
ut_ad(DICT_NUM_COLS__SYS_ZIP_DICT_COLS == 3);
ut_ad(DICT_NUM_FIELDS__SYS_ZIP_DICT_COLS == 5);
mtr_start(&mtr);
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 2015, 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
......@@ -7341,161 +7341,3 @@ dict_tf_to_row_format_string(
return(0);
}
#endif /* !UNIV_HOTBACKUP */
/** Insert a records into SYS_ZIP_DICT.
@retval DB_SUCCESS if OK
@retval dberr_t if the insert failed */
UNIV_INTERN
dberr_t
dict_create_zip_dict(
const char* name, /*!< in: zip_dict name */
ulint name_len, /*!< in: zip_dict name length*/
const char* data, /*!< in: zip_dict data */
ulint data_len) /*!< in: zip_dict data length */
{
dberr_t err = DB_SUCCESS;
trx_t* trx;
ut_ad(name);
ut_ad(data);
rw_lock_x_lock(&dict_operation_lock);
dict_mutex_enter_for_mysql();
trx = trx_allocate_for_background();
trx->op_info = "insert zip_dict";
trx->dict_operation_lock_mode = RW_X_LATCH;
trx_start_if_not_started(trx);
err = dict_create_add_zip_dict(name, name_len, data, data_len, trx);
if (err == DB_SUCCESS) {
trx_commit_for_mysql(trx);
}
else {
trx->op_info = "rollback of internal trx on zip_dict table";
trx_rollback_to_savepoint(trx, NULL);
ut_a(trx->error_state == DB_SUCCESS);
}
trx->op_info = "";
trx->dict_operation_lock_mode = 0;
trx_free_for_background(trx);
dict_mutex_exit_for_mysql();
rw_lock_x_unlock(&dict_operation_lock);
return err;
}
/** Get single compression dictionary id for the given
(table id, column pos) pair.
@retval DB_SUCCESS if OK
@retval DB_RECORD_NOT_FOUND if not found */
UNIV_INTERN
dberr_t
dict_get_dictionary_id_by_key(
ulint table_id, /*!< in: table id */
ulint column_pos, /*!< in: column position */
ulint* dict_id) /*!< out: zip_dict id */
{
dberr_t err = DB_SUCCESS;
trx_t* trx;
rw_lock_s_lock(&dict_operation_lock);
dict_mutex_enter_for_mysql();
trx = trx_allocate_for_background();
trx->op_info = "get zip dict id by composite key";
trx->dict_operation_lock_mode = RW_S_LATCH;
trx_start_if_not_started(trx);
err = dict_create_get_zip_dict_id_by_reference(table_id, column_pos,
dict_id, trx);
trx_commit_for_mysql(trx);
trx->dict_operation_lock_mode = 0;
trx_free_for_background(trx);
dict_mutex_exit_for_mysql();
rw_lock_s_unlock(&dict_operation_lock);
return err;
}
/** Get compression dictionary info (name and data) for the given id.
Allocates memory in name->str and data->str on success.
Must be freed with mem_free().
@retval DB_SUCCESS if OK
@retval DB_RECORD_NOT_FOUND if not found */
UNIV_INTERN
dberr_t
dict_get_dictionary_info_by_id(
ulint dict_id, /*!< in: table name */
char** name, /*!< out: dictionary name */
ulint* name_len, /*!< out: dictionary name length*/
char** data, /*!< out: dictionary data */
ulint* data_len) /*!< out: dictionary data length*/
{
dberr_t err = DB_SUCCESS;
trx_t* trx;
rw_lock_s_lock(&dict_operation_lock);
dict_mutex_enter_for_mysql();
trx = trx_allocate_for_background();
trx->op_info = "get zip dict name and data by id";
trx->dict_operation_lock_mode = RW_S_LATCH;
trx_start_if_not_started(trx);
err = dict_create_get_zip_dict_info_by_id(dict_id, name, name_len,
data, data_len, trx);
trx_commit_for_mysql(trx);
trx->dict_operation_lock_mode = 0;
trx_free_for_background(trx);
dict_mutex_exit_for_mysql();
rw_lock_s_unlock(&dict_operation_lock);
return err;
}
/** Delete a record in SYS_ZIP_DICT with the given name.
@retval DB_SUCCESS if OK
@retval DB_RECORD_NOT_FOUND if not found
@retval DB_ROW_IS_REFERENCED if in use */
UNIV_INTERN
dberr_t
dict_drop_zip_dict(
const char* name, /*!< in: zip_dict name */
ulint name_len) /*!< in: zip_dict name length*/
{
dberr_t err = DB_SUCCESS;
trx_t* trx;
ut_ad(name);
rw_lock_x_lock(&dict_operation_lock);
dict_mutex_enter_for_mysql();
trx = trx_allocate_for_background();
trx->op_info = "delete zip_dict";
trx->dict_operation_lock_mode = RW_X_LATCH;
trx_start_if_not_started(trx);
err = dict_create_remove_zip_dict(name, name_len, trx);
if (err == DB_SUCCESS) {
trx_commit_for_mysql(trx);
}
else {
trx->op_info = "rollback of internal trx on zip_dict table";
trx_rollback_to_savepoint(trx, NULL);
ut_a(trx->error_state == DB_SUCCESS);
}
trx->op_info = "";
trx->dict_operation_lock_mode = 0;
trx_free_for_background(trx);
dict_mutex_exit_for_mysql();
rw_lock_x_unlock(&dict_operation_lock);
return err;
}
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, MariaDB Corporation.
Copyright (c) 2016, 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
......@@ -57,9 +57,7 @@ static const char* SYSTEM_TABLE_NAME[] = {
"SYS_FOREIGN",
"SYS_FOREIGN_COLS",
"SYS_TABLESPACES",
"SYS_DATAFILES",
"SYS_ZIP_DICT",
"SYS_ZIP_DICT_COLS"
"SYS_DATAFILES"
};
/* If this flag is TRUE, then we will load the cluster index's (and tables')
......@@ -731,161 +729,6 @@ dict_process_sys_datafiles(
return(NULL);
}
/** This function parses a SYS_ZIP_DICT record, extracts necessary
information from the record and returns to caller.
@return error message, or NULL on success */
UNIV_INTERN
const char*
dict_process_sys_zip_dict(
mem_heap_t* heap, /*!< in/out: heap memory */
ulint zip_size, /*!< in: nonzero=compressed BLOB page size */
const rec_t* rec, /*!< in: current SYS_ZIP_DICT rec */
ulint* id, /*!< out: dict id */
const char** name, /*!< out: dict name */
const char** data, /*!< out: dict data */
ulint* data_len) /*!< out: dict data length */
{
ulint len;
const byte* field;
/* Initialize the output values */
*id = ULINT_UNDEFINED;
*name = NULL;
*data = NULL;
*data_len = 0;
if (UNIV_UNLIKELY(rec_get_deleted_flag(rec, 0))) {
return("delete-marked record in SYS_ZIP_DICT");
}
if (UNIV_UNLIKELY(
rec_get_n_fields_old(rec)!= DICT_NUM_FIELDS__SYS_ZIP_DICT)) {
return("wrong number of columns in SYS_ZIP_DICT record");
}
field = rec_get_nth_field_old(
rec, DICT_FLD__SYS_ZIP_DICT__ID, &len);
if (UNIV_UNLIKELY(len != DICT_FLD_LEN_SPACE)) {
goto err_len;
}
*id = mach_read_from_4(field);
rec_get_nth_field_offs_old(
rec, DICT_FLD__SYS_ZIP_DICT__DB_TRX_ID, &len);
if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) {
goto err_len;
}
rec_get_nth_field_offs_old(
rec, DICT_FLD__SYS_ZIP_DICT__DB_ROLL_PTR, &len);
if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) {
goto err_len;
}
field = rec_get_nth_field_old(
rec, DICT_FLD__SYS_ZIP_DICT__NAME, &len);
if (UNIV_UNLIKELY(len == 0 || len == UNIV_SQL_NULL)) {
goto err_len;
}
*name = mem_heap_strdupl(heap, (char*) field, len);
field = rec_get_nth_field_old(
rec, DICT_FLD__SYS_ZIP_DICT__DATA, &len);
if (UNIV_UNLIKELY(len == UNIV_SQL_NULL)) {
goto err_len;
}
if (rec_get_1byte_offs_flag(rec) == 0 &&
rec_2_is_field_extern(rec, DICT_FLD__SYS_ZIP_DICT__DATA)) {
ut_a(len >= BTR_EXTERN_FIELD_REF_SIZE);
if (UNIV_UNLIKELY
(!memcmp(field + len - BTR_EXTERN_FIELD_REF_SIZE,
field_ref_zero,
BTR_EXTERN_FIELD_REF_SIZE))) {
goto err_len;
}
*data = reinterpret_cast<char*>(
btr_copy_externally_stored_field(data_len, field,
zip_size, len, heap, 0));
}
else {
*data_len = len;
*data = static_cast<char*>(mem_heap_dup(heap, field, len));
}
return(NULL);
err_len:
return("incorrect column length in SYS_ZIP_DICT");
}
/** This function parses a SYS_ZIP_DICT_COLS record, extracts necessary
information from the record and returns to caller.
@return error message, or NULL on success */
UNIV_INTERN
const char*
dict_process_sys_zip_dict_cols(
mem_heap_t* heap, /*!< in/out: heap memory */
const rec_t* rec, /*!< in: current SYS_ZIP_DICT rec */
ulint* table_id, /*!< out: table id */
ulint* column_pos, /*!< out: column position */
ulint* dict_id) /*!< out: dict id */
{
ulint len;
const byte* field;
/* Initialize the output values */
*table_id = ULINT_UNDEFINED;
*column_pos = ULINT_UNDEFINED;
*dict_id = ULINT_UNDEFINED;
if (UNIV_UNLIKELY(rec_get_deleted_flag(rec, 0))) {
return("delete-marked record in SYS_ZIP_DICT_COLS");
}
if (UNIV_UNLIKELY(rec_get_n_fields_old(rec) !=
DICT_NUM_FIELDS__SYS_ZIP_DICT_COLS)) {
return("wrong number of columns in SYS_ZIP_DICT_COLS"
" record");
}
field = rec_get_nth_field_old(
rec, DICT_FLD__SYS_ZIP_DICT_COLS__TABLE_ID, &len);
if (UNIV_UNLIKELY(len != DICT_FLD_LEN_SPACE)) {
err_len:
return("incorrect column length in SYS_ZIP_DICT_COLS");
}
*table_id = mach_read_from_4(field);
field = rec_get_nth_field_old(
rec, DICT_FLD__SYS_ZIP_DICT_COLS__COLUMN_POS, &len);
if (UNIV_UNLIKELY(len != DICT_FLD_LEN_SPACE)) {
goto err_len;
}
*column_pos = mach_read_from_4(field);
rec_get_nth_field_offs_old(
rec, DICT_FLD__SYS_ZIP_DICT_COLS__DB_TRX_ID, &len);
if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) {
goto err_len;
}
rec_get_nth_field_offs_old(
rec, DICT_FLD__SYS_ZIP_DICT_COLS__DB_ROLL_PTR, &len);
if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) {
goto err_len;
}
field = rec_get_nth_field_old(
rec, DICT_FLD__SYS_ZIP_DICT_COLS__DICT_ID, &len);
if (UNIV_UNLIKELY(len != DICT_FLD_LEN_SPACE)) {
goto err_len;
}
*dict_id = mach_read_from_4(field);
return(NULL);
}
/********************************************************************//**
Determine the flags of a table as stored in SYS_TABLES.TYPE and N_COLS.
@return ULINT_UNDEFINED if error, else a valid dict_table_t::flags. */
......
This diff is collapsed.
/*****************************************************************************
Copyright (c) 2000, 2016, 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
......@@ -318,14 +318,6 @@ class ha_innobase: public handler
bool check_if_supported_virtual_columns(void) { return TRUE; }
/** This function reads zip dict-related info from SYS_ZIP_DICT
and SYS_ZIP_DICT_COLS for all columns marked with
COLUMN_FORMAT_TYPE_COMPRESSED flag and updates
zip_dict_name / zip_dict_data for those which have associated
compression dictionaries.
*/
virtual void update_field_defs_with_zip_dict_info();
private:
/** Builds a 'template' to the prebuilt struct.
......@@ -741,31 +733,3 @@ ib_push_frm_error(
TABLE* table, /*!< in: MySQL table */
ulint n_keys, /*!< in: InnoDB #keys */
bool push_warning); /*!< in: print warning ? */
/** This function checks if all the compression dictionaries referenced
in table->fields exist in SYS_ZIP_DICT InnoDB system table.
@return true if all referenced dictionaries exist */
UNIV_INTERN
bool
innobase_check_zip_dicts(
const TABLE* table, /*!< in: table in MySQL data
dictionary */
ulint* dict_ids, /*!< out: identified zip dict ids
(at least n_fields long) */
trx_t* trx, /*!< in: transaction */
const char** err_dict_name); /*!< out: the name of the
zip_dict which does not exist. */
/** This function creates compression dictionary references in
SYS_ZIP_DICT_COLS InnoDB system table for table_id based on info
in table->fields and provided zip dict ids. */
UNIV_INTERN
void
innobase_create_zip_dict_references(
const TABLE* table, /*!< in: table in MySQL data
dictionary */
table_id_t ib_table_id, /*!< in: table ID in Innodb data
dictionary */
ulint* zip_dict_ids, /*!< in: zip dict ids
(at least n_fields long) */
trx_t* trx); /*!< in: transaction */
/*****************************************************************************
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
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
......@@ -22,11 +22,6 @@ this program; if not, write to the Free Software Foundation, Inc.,
Smart ALTER TABLE
*******************************************************/
#ifndef HAVE_PERCONA_COMPRESSED_COLUMNS
#define COLUMN_FORMAT_TYPE_COMPRESSED 0xBADF00D
#define ER_COMPRESSION_DICTIONARY_DOES_NOT_EXIST 0xDEADFACE
#endif
#include <my_global.h>
#include <unireg.h>
#include <mysqld_error.h>
......@@ -1213,15 +1208,6 @@ innobase_col_to_mysql(
field->reset();
if (field->type() == MYSQL_TYPE_VARCHAR) {
if (field->column_format() ==
COLUMN_FORMAT_TYPE_COMPRESSED) {
/* Skip compressed varchar column when
reporting an erroneous row
during index creation or table rebuild. */
field->set_null();
break;
}
/* This is a >= 5.0.3 type true VARCHAR. Store the
length of the data to the first byte or the first
two bytes of dest. */
......@@ -2522,14 +2508,7 @@ innobase_build_col_map_add(
byte* buf = static_cast<byte*>(mem_heap_alloc(heap, size));
row_mysql_store_col_in_innobase_format(
dfield, buf, TRUE, field->ptr, size, comp,
#ifdef HAVE_PERCONA_COMPRESSED_COLUMNS
field->column_format() == COLUMN_FORMAT_TYPE_COMPRESSED,
reinterpret_cast<const byte*>(field->zip_dict_data.str),
field->zip_dict_data.length, prebuilt);
#else
0,0,0, prebuilt);
#endif
dfield, buf, TRUE, field->ptr, size, comp);
}
/** Construct the translation table for reordering, dropping or
......@@ -2783,7 +2762,6 @@ prepare_inplace_alter_table_dict(
ulint num_fts_index;
ha_innobase_inplace_ctx*ctx;
uint sql_idx;
ulint* zip_dict_ids = 0;
DBUG_ENTER("prepare_inplace_alter_table_dict");
......@@ -2930,26 +2908,6 @@ prepare_inplace_alter_table_dict(
mode = crypt_data->encryption;
}
zip_dict_ids = static_cast<ulint*>(
mem_heap_alloc(ctx->heap,
altered_table->s->fields * sizeof(ulint)));
/* This is currently required for valgrind because MariaDB does
not currently support compressed columns. */
for (size_t field_idx = 0;
field_idx < altered_table->s->fields;
++field_idx) {
zip_dict_ids[field_idx] = ULINT_UNDEFINED;
}
const char* err_zip_dict_name = 0;
if (!innobase_check_zip_dicts(altered_table, zip_dict_ids,
ctx->trx, &err_zip_dict_name)) {
my_error(ER_COMPRESSION_DICTIONARY_DOES_NOT_EXIST,
MYF(0), err_zip_dict_name);
goto new_clustered_failed;
}
if (innobase_check_foreigns(
ha_alter_info, altered_table, old_table,
user_table, ctx->drop_fk, ctx->num_to_drop_fk)) {
......@@ -3056,12 +3014,6 @@ prepare_inplace_alter_table_dict(
}
}
if (field->column_format() ==
COLUMN_FORMAT_TYPE_COMPRESSED) {
field_type |= DATA_COMPRESSED;
}
if (dict_col_name_is_reserved(field->field_name)) {
dict_mem_table_free(ctx->new_table);
my_error(ER_WRONG_COLUMN_NAME, MYF(0),
......@@ -3319,17 +3271,6 @@ prepare_inplace_alter_table_dict(
DBUG_ASSERT(error == DB_SUCCESS);
#ifdef HAVE_PERCONA_COMPRESSED_COLUMNS
/*
Adding compression dictionary <-> compressed table column links
to the SYS_ZIP_DICT_COLS table.
*/
if (zip_dict_ids != 0) {
innobase_create_zip_dict_references(altered_table,
ctx->trx->table_id, zip_dict_ids, ctx->trx);
}
#endif
/* Commit the data dictionary transaction in order to release
the table locks on the system tables. This means that if
MySQL crashes while creating a new primary key inside
......
......@@ -2,6 +2,7 @@
Copyright (c) 2007, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2010-2012, Percona Inc. 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 the Free Software
......@@ -37,7 +38,6 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include <btr0sea.h> /* btr_search_sys */
#include <log0recv.h> /* recv_sys */
#include <fil0fil.h>
#include <dict0crea.h> /* for ZIP_DICT_MAX_* constants */
/* for XTRADB_RSEG table */
#include "trx0trx.h" /* for TRX_QUE_STATE_STR_MAX_LEN */
......@@ -542,331 +542,3 @@ UNIV_INTERN struct st_mysql_plugin i_s_xtradb_rseg =
STRUCT_FLD(version_info, INNODB_VERSION_STR),
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
#ifdef HAVE_PERCONA_COMPRESSED_COLUMNS
/************************************************************************/
enum zip_dict_field_type
{
zip_dict_field_id,
zip_dict_field_name,
zip_dict_field_zip_dict
};
static ST_FIELD_INFO xtradb_sys_zip_dict_fields_info[] =
{
{ STRUCT_FLD(field_name, "id"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE) },
{ STRUCT_FLD(field_name, "name"),
STRUCT_FLD(field_length, ZIP_DICT_MAX_NAME_LENGTH),
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, 0),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE) },
{ STRUCT_FLD(field_name, "zip_dict"),
STRUCT_FLD(field_length, ZIP_DICT_MAX_DATA_LENGTH),
STRUCT_FLD(field_type, MYSQL_TYPE_BLOB),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, 0),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE) },
END_OF_ST_FIELD_INFO
};
/** Function to fill INFORMATION_SCHEMA.XTRADB_ZIP_DICT with information
collected by scanning SYS_ZIP_DICT table.
@return 0 on success */
static
int
xtradb_i_s_dict_fill_sys_zip_dict(
THD* thd, /*!< in: thread */
ulint id, /*!< in: dict ID */
const char* name, /*!< in: dict name */
const char* data, /*!< in: dict data */
ulint data_len, /*!< in: dict data length */
TABLE* table_to_fill) /*!< in/out: fill this table */
{
DBUG_ENTER("xtradb_i_s_dict_fill_sys_zip_dict");
Field** fields = table_to_fill->field;
OK(field_store_ulint(fields[zip_dict_field_id], id));
OK(field_store_string(fields[zip_dict_field_name], name));
OK(field_store_blob(fields[zip_dict_field_zip_dict], data,
data_len));
OK(schema_table_store_record(thd, table_to_fill));
DBUG_RETURN(0);
}
/** Function to populate INFORMATION_SCHEMA.XTRADB_ZIP_DICT table.
Loop through each record in SYS_ZIP_DICT, and extract the column
information and fill the INFORMATION_SCHEMA.XTRADB_ZIP_DICT table.
@return 0 on success */
static
int
xtradb_i_s_sys_zip_dict_fill_table(
THD* thd, /*!< in: thread */
TABLE_LIST* tables, /*!< in/out: tables to fill */
Item* ) /*!< in: condition (not used) */
{
btr_pcur_t pcur;
const rec_t* rec;
mem_heap_t* heap;
mtr_t mtr;
DBUG_ENTER("xtradb_i_s_sys_zip_dict_fill_table");
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to user without SUPER_ACL privilege */
if (check_global_access(thd, SUPER_ACL)) {
DBUG_RETURN(0);
}
heap = mem_heap_create(1000);
mutex_enter(&dict_sys->mutex);
mtr_start(&mtr);
rec = dict_startscan_system(&pcur, &mtr, SYS_ZIP_DICT);
ulint zip_size = dict_table_zip_size(pcur.btr_cur.index->table);
while (rec) {
const char* err_msg;
ulint id;
const char* name;
const char* data;
ulint data_len;
/* Extract necessary information from a SYS_ZIP_DICT row */
err_msg = dict_process_sys_zip_dict(
heap, zip_size, rec, &id, &name, &data, &data_len);
mtr_commit(&mtr);
mutex_exit(&dict_sys->mutex);
if (!err_msg) {
xtradb_i_s_dict_fill_sys_zip_dict(
thd, id, name, data, data_len,
tables->table);
} else {
push_warning_printf(thd,
Sql_condition::WARN_LEVEL_WARN,
ER_CANT_FIND_SYSTEM_REC, "%s", err_msg);
}
mem_heap_empty(heap);
/* Get the next record */
mutex_enter(&dict_sys->mutex);
mtr_start(&mtr);
rec = dict_getnext_system(&pcur, &mtr);
}
mtr_commit(&mtr);
mutex_exit(&dict_sys->mutex);
mem_heap_free(heap);
DBUG_RETURN(0);
}
static int i_s_xtradb_zip_dict_init(void* p)
{
DBUG_ENTER("i_s_xtradb_zip_dict_init");
ST_SCHEMA_TABLE* schema = static_cast<ST_SCHEMA_TABLE*>(p);
schema->fields_info = xtradb_sys_zip_dict_fields_info;
schema->fill_table = xtradb_i_s_sys_zip_dict_fill_table;
DBUG_RETURN(0);
}
UNIV_INTERN struct st_mysql_plugin i_s_xtradb_zip_dict =
{
STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
STRUCT_FLD(info, &i_s_info),
STRUCT_FLD(name, "XTRADB_ZIP_DICT"),
STRUCT_FLD(author, PLUGIN_AUTHOR),
STRUCT_FLD(descr, "InnoDB compression dictionaries information"),
STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
STRUCT_FLD(init, i_s_xtradb_zip_dict_init),
STRUCT_FLD(deinit, i_s_common_deinit),
STRUCT_FLD(version, INNODB_VERSION_SHORT),
STRUCT_FLD(status_vars, NULL),
STRUCT_FLD(system_vars, NULL),
STRUCT_FLD(__reserved1, NULL),
STRUCT_FLD(flags, 0UL),
};
enum zip_dict_cols_field_type
{
zip_dict_cols_field_table_id,
zip_dict_cols_field_column_pos,
zip_dict_cols_field_dict_id
};
static ST_FIELD_INFO xtradb_sys_zip_dict_cols_fields_info[] =
{
{ STRUCT_FLD(field_name, "table_id"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE) },
{ STRUCT_FLD(field_name, "column_pos"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE) },
{ STRUCT_FLD(field_name, "dict_id"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE) },
END_OF_ST_FIELD_INFO
};
/** Function to fill INFORMATION_SCHEMA.XTRADB_ZIP_DICT_COLS with information
collected by scanning SYS_ZIP_DICT_COLS table.
@return 0 on success */
static
int
xtradb_i_s_dict_fill_sys_zip_dict_cols(
THD* thd, /*!< in: thread */
ulint table_id, /*!< in: table ID */
ulint column_pos, /*!< in: column position */
ulint dict_id, /*!< in: dict ID */
TABLE* table_to_fill) /*!< in/out: fill this table */
{
DBUG_ENTER("xtradb_i_s_dict_fill_sys_zip_dict_cols");
Field** fields = table_to_fill->field;
OK(field_store_ulint(fields[zip_dict_cols_field_table_id],
table_id));
OK(field_store_ulint(fields[zip_dict_cols_field_column_pos],
column_pos));
OK(field_store_ulint(fields[zip_dict_cols_field_dict_id],
dict_id));
OK(schema_table_store_record(thd, table_to_fill));
DBUG_RETURN(0);
}
/** Function to populate INFORMATION_SCHEMA.XTRADB_ZIP_DICT_COLS table.
Loop through each record in SYS_ZIP_DICT_COLS, and extract the column
information and fill the INFORMATION_SCHEMA.XTRADB_ZIP_DICT_COLS table.
@return 0 on success */
static
int
xtradb_i_s_sys_zip_dict_cols_fill_table(
THD* thd, /*!< in: thread */
TABLE_LIST* tables, /*!< in/out: tables to fill */
Item* ) /*!< in: condition (not used) */
{
btr_pcur_t pcur;
const rec_t* rec;
mem_heap_t* heap;
mtr_t mtr;
DBUG_ENTER("xtradb_i_s_sys_zip_dict_cols_fill_table");
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to user without SUPER_ACL privilege */
if (check_global_access(thd, SUPER_ACL)) {
DBUG_RETURN(0);
}
heap = mem_heap_create(1000);
mutex_enter(&dict_sys->mutex);
mtr_start(&mtr);
rec = dict_startscan_system(&pcur, &mtr, SYS_ZIP_DICT_COLS);
while (rec) {
const char* err_msg;
ulint table_id;
ulint column_pos;
ulint dict_id;
/* Extract necessary information from a SYS_ZIP_DICT_COLS
row */
err_msg = dict_process_sys_zip_dict_cols(
heap, rec, &table_id, &column_pos, &dict_id);
mtr_commit(&mtr);
mutex_exit(&dict_sys->mutex);
if (!err_msg) {
xtradb_i_s_dict_fill_sys_zip_dict_cols(
thd, table_id, column_pos, dict_id,
tables->table);
} else {
push_warning_printf(thd,
Sql_condition::WARN_LEVEL_WARN,
ER_CANT_FIND_SYSTEM_REC, "%s", err_msg);
}
mem_heap_empty(heap);
/* Get the next record */
mutex_enter(&dict_sys->mutex);
mtr_start(&mtr);
rec = dict_getnext_system(&pcur, &mtr);
}
mtr_commit(&mtr);
mutex_exit(&dict_sys->mutex);
mem_heap_free(heap);
DBUG_RETURN(0);
}
static int i_s_xtradb_zip_dict_cols_init(void* p)
{
DBUG_ENTER("i_s_xtradb_zip_dict_cols_init");
ST_SCHEMA_TABLE* schema = static_cast<ST_SCHEMA_TABLE*>(p);
schema->fields_info = xtradb_sys_zip_dict_cols_fields_info;
schema->fill_table = xtradb_i_s_sys_zip_dict_cols_fill_table;
DBUG_RETURN(0);
}
UNIV_INTERN struct st_mysql_plugin i_s_xtradb_zip_dict_cols =
{
STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
STRUCT_FLD(info, &i_s_info),
STRUCT_FLD(name, "XTRADB_ZIP_DICT_COLS"),
STRUCT_FLD(author, PLUGIN_AUTHOR),
STRUCT_FLD(descr, "InnoDB compressed columns information"),
STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
STRUCT_FLD(init, i_s_xtradb_zip_dict_cols_init),
STRUCT_FLD(deinit, i_s_common_deinit),
STRUCT_FLD(version, INNODB_VERSION_SHORT),
STRUCT_FLD(status_vars, NULL),
STRUCT_FLD(system_vars, NULL),
STRUCT_FLD(__reserved1, NULL),
STRUCT_FLD(flags, 0UL),
};
#endif
/*****************************************************************************
Copyright (c) 2010-2012, Percona Inc. 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 the Free Software
......@@ -22,7 +23,5 @@ this program; if not, write to the Free Software Foundation, Inc.,
extern struct st_mysql_plugin i_s_xtradb_read_view;
extern struct st_mysql_plugin i_s_xtradb_internal_hash_tables;
extern struct st_mysql_plugin i_s_xtradb_rseg;
extern struct st_mysql_plugin i_s_xtradb_zip_dict;
extern struct st_mysql_plugin i_s_xtradb_zip_dict_cols;
#endif /* XTRADB_I_S_H */
/*****************************************************************************
Copyright (c) 1996, 2012, 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 the Free Software
......@@ -170,9 +171,6 @@ be less than 256 */
type when the column is true VARCHAR where
MySQL uses 2 bytes to store the data len;
for shorter VARCHARs MySQL uses only 1 byte */
#define DATA_COMPRESSED 16384 /* this is ORed to the precise data
type when the column has COLUMN_FORMAT =
COMPRESSED attribute*/
/*-------------------------------------------*/
/* This many bytes we need to store the type information affecting the
......@@ -503,17 +501,6 @@ dtype_print(
/*========*/
const dtype_t* type); /*!< in: type */
/**
Calculates the number of extra bytes needed for compression header
depending on precise column type.
@reval 0 if prtype does not include DATA_COMPRESSED flag
@reval ZIP_COLUMN_HEADER_LENGTH if prtype includes DATA_COMPRESSED flag
*/
UNIV_INLINE
ulint
prtype_get_compression_extra(
ulint prtype); /*!< in: precise type */
/* Structure for an SQL data type.
If you add fields to this structure, be sure to initialize them everywhere.
This structure is initialized in the following functions:
......
/*****************************************************************************
Copyright (c) 1996, 2012, 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 the Free Software
......@@ -710,18 +711,3 @@ dtype_get_sql_null_size(
0, 0));
#endif /* !UNIV_HOTBACKUP */
}
/**
Calculates the number of extra bytes needed for compression header
depending on precise column type.
@reval 0 if prtype does not include DATA_COMPRESSED flag
@reval ZIP_COLUMN_HEADER_LENGTH if prtype includes DATA_COMPRESSED flag
*/
UNIV_INLINE
ulint
prtype_get_compression_extra(
ulint prtype) /*!< in: precise type */
{
return (prtype & DATA_COMPRESSED) != 0 ?
ZIP_COLUMN_HEADER_LENGTH : 0;
}
/*****************************************************************************
Copyright (c) 1996, 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 the Free Software
......@@ -324,38 +325,6 @@ enum dict_fld_sys_datafiles_enum {
DICT_FLD__SYS_DATAFILES__PATH = 3,
DICT_NUM_FIELDS__SYS_DATAFILES = 4
};
/* The columns in SYS_DICT */
enum dict_col_sys_zip_dict_enum {
DICT_COL__SYS_ZIP_DICT__ID = 0,
DICT_COL__SYS_ZIP_DICT__NAME = 1,
DICT_COL__SYS_ZIP_DICT__DATA = 2,
DICT_NUM_COLS__SYS_ZIP_DICT = 3
};
/* The field numbers in the SYS_DICT clustered index */
enum dict_fld_sys_zip_dict_enum {
DICT_FLD__SYS_ZIP_DICT__ID = 0,
DICT_FLD__SYS_ZIP_DICT__DB_TRX_ID = 1,
DICT_FLD__SYS_ZIP_DICT__DB_ROLL_PTR = 2,
DICT_FLD__SYS_ZIP_DICT__NAME = 3,
DICT_FLD__SYS_ZIP_DICT__DATA = 4,
DICT_NUM_FIELDS__SYS_ZIP_DICT = 5
};
/* The columns in SYS_DICT_COLS */
enum dict_col_sys_zip_dict_cols_enum {
DICT_COL__SYS_ZIP_DICT_COLS__TABLE_ID = 0,
DICT_COL__SYS_ZIP_DICT_COLS__COLUMN_POS = 1,
DICT_COL__SYS_ZIP_DICT_COLS__DICT_ID = 2,
DICT_NUM_COLS__SYS_ZIP_DICT_COLS = 3
};
/* The field numbers in the SYS_DICT_COLS clustered index */
enum dict_fld_sys_zip_dict_cols_enum {
DICT_FLD__SYS_ZIP_DICT_COLS__TABLE_ID = 0,
DICT_FLD__SYS_ZIP_DICT_COLS__COLUMN_POS = 1,
DICT_FLD__SYS_ZIP_DICT_COLS__DB_TRX_ID = 2,
DICT_FLD__SYS_ZIP_DICT_COLS__DB_ROLL_PTR = 3,
DICT_FLD__SYS_ZIP_DICT_COLS__DICT_ID = 4,
DICT_NUM_FIELDS__SYS_ZIP_DICT_COLS = 5
};
/* A number of the columns above occur in multiple tables. These are the
length of thos fields. */
......
/*****************************************************************************
Copyright (c) 1996, 2012, 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 the Free Software
......@@ -92,5 +93,3 @@ dict_is_sys_table(
{
return(id < DICT_HDR_FIRST_ID);
}
/*****************************************************************************
Copyright (c) 1996, 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 the Free Software
......@@ -167,18 +168,6 @@ dberr_t
dict_create_or_check_sys_tablespace(void);
/*=====================================*/
#define ZIP_DICT_MAX_NAME_LENGTH 64
/* Max window size (2^15) minus 262 */
#define ZIP_DICT_MAX_DATA_LENGTH 32506
/** Creates the zip_dict system table inside InnoDB
at server bootstrap or server start if it is not found or is
not of the right form.
@return DB_SUCCESS or error code */
UNIV_INTERN
dberr_t
dict_create_or_check_sys_zip_dict(void);
/********************************************************************//**
Add a single tablespace definition to the data dictionary tables in the
database.
......@@ -195,83 +184,6 @@ dict_create_add_tablespace_to_dictionary(
bool commit); /*!< in: if true then commit the
transaction */
/** Add a single compression dictionary definition to the SYS_ZIP_DICT
InnoDB system table.
@return error code or DB_SUCCESS */
UNIV_INTERN
dberr_t
dict_create_add_zip_dict(
const char* name, /*!< in: dict name */
ulint name_len, /*!< in: dict name length */
const char* data, /*!< in: dict data */
ulint data_len, /*!< in: dict data length */
trx_t* trx); /*!< in/out: transaction */
/** Add a single compression dictionary reference to the SYS_ZIP_DICT_COLS
InnoDB system table.
@return error code or DB_SUCCESS */
UNIV_INTERN
dberr_t
dict_create_add_zip_dict_reference(
ulint table_id, /*!< in: table id */
ulint column_pos, /*!< in: column position */
ulint dict_id, /*!< in: dict id */
trx_t* trx); /*!< in/out: transaction */
/** Get a single compression dictionary id for the given
(table id, column pos) pair.
@return error code or DB_SUCCESS */
UNIV_INTERN
dberr_t
dict_create_get_zip_dict_id_by_reference(
ulint table_id, /*!< in: table id */
ulint column_pos, /*!< in: column position */
ulint* dict_id, /*!< out: dict id */
trx_t* trx); /*!< in/out: transaction */
/** Get compression dictionary id for the given name.
@return error code or DB_SUCCESS */
UNIV_INTERN
dberr_t
dict_create_get_zip_dict_id_by_name(
const char* dict_name, /*!< in: dict name */
ulint dict_name_len, /*!< in: dict name length */
ulint* dict_id, /*!< out: dict id */
trx_t* trx); /*!< in/out: transaction */
/** Get compression dictionary info (name and data) for the given id.
Allocates memory for name and data on success.
Must be freed with mem_free().
@return error code or DB_SUCCESS */
UNIV_INTERN
dberr_t
dict_create_get_zip_dict_info_by_id(
ulint dict_id, /*!< in: dict id */
char** name, /*!< out: dict name */
ulint* name_len, /*!< out: dict name length */
char** data, /*!< out: dict data */
ulint* data_len, /*!< out: dict data length */
trx_t* trx); /*!< in/out: transaction */
/** Remove a single compression dictionary from the data dictionary
tables in the database.
@return error code or DB_SUCCESS */
UNIV_INTERN
dberr_t
dict_create_remove_zip_dict(
const char* name, /*!< in: dict name */
ulint name_len, /*!< in: dict name length */
trx_t* trx); /*!< in/out: transaction */
/** Remove all compression dictionary references for the given table ID from
the data dictionary tables in the database.
@return error code or DB_SUCCESS */
UNIV_INTERN
dberr_t
dict_create_remove_zip_dict_references_for_table(
ulint table_id, /*!< in: table id */
trx_t* trx); /*!< in/out: transaction */
/********************************************************************//**
Add a foreign key definition to the data dictionary tables.
@return error code or DB_SUCCESS */
......
......@@ -2,7 +2,7 @@
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 2015, 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
......@@ -1910,52 +1910,6 @@ dict_table_set_corrupt_by_space(
ulint space_id,
ibool need_mutex);
/** Insert a records into SYS_ZIP_DICT.
@retval DB_SUCCESS if OK
@retval dberr_t if the insert failed */
UNIV_INTERN
dberr_t
dict_create_zip_dict(
const char* name, /*!< in: zip_dict name */
ulint name_len, /*!< in: zip_dict name length*/
const char* data, /*!< in: zip_dict data */
ulint data_len); /*!< in: zip_dict data length */
/** Get single compression dictionary id for the given
(table id, column pos) pair.
@retval DB_SUCCESS if OK
@retval DB_RECORD_NOT_FOUND if not found */
UNIV_INTERN
dberr_t
dict_get_dictionary_id_by_key(
ulint table_id, /*!< in: table id */
ulint column_pos, /*!< in: column position */
ulint* dict_id); /*!< out: zip_dict id */
/** Get compression dictionary info (name and data) for the given id.
Allocates memory in name->str and data->str on success.
Must be freed with mem_free().
@retval DB_SUCCESS if OK
@retval DB_RECORD_NOT_FOUND if not found */
UNIV_INTERN
dberr_t
dict_get_dictionary_info_by_id(
ulint dict_id, /*!< in: table name */
char** name, /*!< out: dictionary name */
ulint* name_len, /*!< out: dictionary name length*/
char** data, /*!< out: dictionary data */
ulint* data_len); /*!< out: dictionary data length*/
/** Delete a record in SYS_ZIP_DICT with the given name.
@retval DB_SUCCESS if OK
@retval DB_RECORD_NOT_FOUND if not found
@retval DB_ROW_IS_REFERENCED if in use */
UNIV_INTERN
dberr_t
dict_drop_zip_dict(
const char* name, /*!< in: zip_dict name */
ulint name_len); /*!< in: zip_dict name length*/
#ifndef UNIV_NONINL
#include "dict0dict.ic"
#endif
......
/*****************************************************************************
Copyright (c) 1996, 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 the Free Software
......@@ -44,8 +45,6 @@ enum dict_system_id_t {
SYS_FOREIGN_COLS,
SYS_TABLESPACES,
SYS_DATAFILES,
SYS_ZIP_DICT,
SYS_ZIP_DICT_COLS,
/* This must be last item. Defines the number of system tables. */
SYS_NUM_SYSTEM_TABLES
......@@ -389,32 +388,6 @@ dict_process_sys_datafiles(
ulint* space, /*!< out: pace id */
const char** path); /*!< out: datafile path */
/** This function parses a SYS_ZIP_DICT record, extracts necessary
information from the record and returns to caller.
@return error message, or NULL on success */
UNIV_INTERN
const char*
dict_process_sys_zip_dict(
mem_heap_t* heap, /*!< in/out: heap memory */
ulint zip_size, /*!< in: nonzero=compressed BLOB page size */
const rec_t* rec, /*!< in: current SYS_ZIP_DICT rec */
ulint* id, /*!< out: dict id */
const char** name, /*!< out: dict name */
const char** data, /*!< out: dict data */
ulint* data_len); /*!< out: dict data length */
/** This function parses a SYS_ZIP_DICT_COLS record, extracts necessary
information from the record and returns to caller.
@return error message, or NULL on success */
UNIV_INTERN
const char*
dict_process_sys_zip_dict_cols(
mem_heap_t* heap, /*!< in/out: heap memory */
const rec_t* rec, /*!< in: current SYS_ZIP_DICT rec */
ulint* table_id, /*!< out: table id */
ulint* column_pos, /*!< out: column position */
ulint* dict_id); /*!< out: dict id */
/********************************************************************//**
Get the filepath for a spaceid from SYS_DATAFILES. This function provides
a temporary heap which is used for the table lookup, but not for the path.
......
/*****************************************************************************
Copyright (c) 2000, 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 the Free Software
......@@ -42,9 +43,6 @@ struct SysIndexCallback;
extern ibool row_rollback_on_timeout;
extern uint srv_compressed_columns_zip_level;
extern ulong srv_compressed_columns_threshold;
struct row_prebuilt_t;
/*******************************************************************//**
......@@ -56,48 +54,6 @@ row_mysql_prebuilt_free_blob_heap(
row_prebuilt_t* prebuilt); /*!< in: prebuilt struct of a
ha_innobase:: table handle */
/** Frees the compress heap in prebuilt when no longer needed. */
UNIV_INTERN
void
row_mysql_prebuilt_free_compress_heap(
row_prebuilt_t* prebuilt); /*!< in: prebuilt struct of a
ha_innobase:: table handle */
/** Uncompress blob/text/varchar column using zlib
@return pointer to the uncompressed data */
const byte*
row_decompress_column(
const byte* data, /*!< in: data in innodb(compressed) format */
ulint *len, /*!< in: data length; out: length of
decompressed data*/
const byte* dict_data,
/*!< in: optional dictionary data used for
decompression */
ulint dict_data_len,
/*!< in: optional dictionary data length */
row_prebuilt_t* prebuilt);
/*!< in: use prebuilt->compress_heap only
here*/
/** Compress blob/text/varchar column using zlib
@return pointer to the compressed data */
byte*
row_compress_column(
const byte* data, /*!< in: data in mysql(uncompressed)
format */
ulint *len, /*!< in: data length; out: length of
compressed data*/
ulint lenlen, /*!< in: bytes used to store the length of
data */
const byte* dict_data,
/*!< in: optional dictionary data used for
compression */
ulint dict_data_len,
/*!< in: optional dictionary data length */
row_prebuilt_t* prebuilt);
/*!< in: use prebuilt->compress_heap only
here*/
/*******************************************************************//**
Stores a >= 5.0.3 format true VARCHAR length to dest, in the MySQL row
format.
......@@ -136,21 +92,10 @@ row_mysql_store_blob_ref(
to 4 bytes */
const void* data, /*!< in: BLOB data; if the value to store
is SQL NULL this should be NULL pointer */
ulint len, /*!< in: BLOB length; if the value to store
ulint len); /*!< in: BLOB length; if the value to store
is SQL NULL this should be 0; remember
also to set the NULL bit in the MySQL record
header! */
bool need_decompression,
/*!< in: if the data need to be compressed*/
const byte* dict_data,
/*!< in: optional compression dictionary
data */
ulint dict_data_len,
/*!< in: optional compression dictionary data
length */
row_prebuilt_t* prebuilt);
/*<! in: use prebuilt->compress_heap only
here */
/*******************************************************************//**
Reads a reference to a BLOB in the MySQL format.
@return pointer to BLOB data */
......@@ -161,17 +106,8 @@ row_mysql_read_blob_ref(
ulint* len, /*!< out: BLOB length */
const byte* ref, /*!< in: BLOB reference in the
MySQL format */
ulint col_len, /*!< in: BLOB reference length
ulint col_len); /*!< in: BLOB reference length
(not BLOB length) */
bool need_compression,
/*!< in: if the data need to be
compressed*/
const byte* dict_data, /*!< in: optional compression
dictionary data */
ulint dict_data_len, /*!< in: optional compression
dictionary data length */
row_prebuilt_t* prebuilt); /*!< in: use prebuilt->compress_heap
only here */
/**************************************************************//**
Pad a column with spaces. */
UNIV_INTERN
......@@ -219,16 +155,7 @@ row_mysql_store_col_in_innobase_format(
necessarily the length of the actual
payload data; if the column is a true
VARCHAR then this is irrelevant */
ulint comp, /*!< in: nonzero=compact format */
bool need_compression,
/*!< in: if the data need to be
compressed */
const byte* dict_data, /*!< in: optional compression
dictionary data */
ulint dict_data_len, /*!< in: optional compression
dictionary data length */
row_prebuilt_t* prebuilt); /*!< in: use prebuilt->compress_heap
only here */
ulint comp); /*!< in: nonzero=compact format */
/****************************************************************//**
Handles user errors and lock waits detected by the database engine.
@return true if it was a lock wait and we should continue running the
......@@ -730,8 +657,6 @@ struct mysql_row_templ_t {
ulint is_unsigned; /*!< if a column type is an integer
type and this field is != 0, then
it is an unsigned integer type */
bool compressed; /*!< if column format is compressed */
LEX_CSTRING zip_dict_data; /*!< associated compression dictionary */
};
#define MYSQL_FETCH_CACHE_SIZE 8
......@@ -931,8 +856,6 @@ struct row_prebuilt_t {
in fetch_cache */
mem_heap_t* blob_heap; /*!< in SELECTS BLOB fields are copied
to this heap */
mem_heap_t* compress_heap; /*!< memory heap used to compress
/decompress blob column*/
mem_heap_t* old_vers_heap; /*!< memory heap where a previous
version is built in consistent read */
bool in_fts_query; /*!< Whether we are in a FTS query */
......
/*****************************************************************************
Copyright (c) 1994, 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 the Free Software
......@@ -323,8 +324,7 @@ rec_init_offsets_comp_ordinary(
stored in one byte for 0..127. The length
will be encoded in two bytes when it is 128 or
more, or when the field is stored externally. */
if (UNIV_UNLIKELY(col->len > 255 -
prtype_get_compression_extra(col->prtype))
if (UNIV_UNLIKELY(col->len > 255)
|| UNIV_UNLIKELY(col->mtype
== DATA_BLOB)) {
if (len & 0x80) {
......@@ -849,8 +849,7 @@ rec_get_converted_size_comp_prefix_low(
((col->mtype == DATA_VARCHAR || col->mtype == DATA_BINARY
|| col->mtype == DATA_VARMYSQL)
&& (col->len == 0
|| len <= col->len +
prtype_get_compression_extra(col->prtype))));
|| len <= col->len)));
fixed_len = field->fixed_len;
if (temp && fixed_len
......@@ -882,8 +881,7 @@ rec_get_converted_size_comp_prefix_low(
ut_ad(col->len >= 256 || col->mtype == DATA_BLOB);
extra_size += 2;
} else if (len < 128
|| (col->len < 256 -
prtype_get_compression_extra(col->prtype)
|| (col->len < 256
&& col->mtype != DATA_BLOB)) {
extra_size++;
} else {
......@@ -1279,16 +1277,12 @@ rec_convert_dtuple_to_rec_comp(
*lens-- = (byte) (len >> 8) | 0xc0;
*lens-- = (byte) len;
} else {
ut_ad(len <= dtype_get_len(type) +
prtype_get_compression_extra(
dtype_get_prtype(type))
ut_ad(len <= dtype_get_len(type)
|| dtype_get_mtype(type) == DATA_BLOB
|| !strcmp(index->name,
FTS_INDEX_TABLE_IND_NAME));
if (len < 128
|| (dtype_get_len(type) < 256 -
prtype_get_compression_extra(
dtype_get_prtype(type))
|| (dtype_get_len(type) < 256
&& dtype_get_mtype(type) != DATA_BLOB)) {
*lens-- = (byte) len;
......
/*****************************************************************************
Copyright (c) 2005, 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 the Free Software
......@@ -623,8 +624,7 @@ row_merge_buf_add(
((col->mtype == DATA_VARCHAR || col->mtype == DATA_BINARY
|| col->mtype == DATA_VARMYSQL)
&& (col->len == 0
|| len <= col->len +
prtype_get_compression_extra(col->prtype))));
|| len <= col->len)));
fixed_len = ifield->fixed_len;
if (fixed_len && !dict_table_is_comp(index->table)
......@@ -653,8 +653,7 @@ row_merge_buf_add(
} else if (dfield_is_ext(field)) {
extra_size += 2;
} else if (len < 128
|| (col->len < 256 -
prtype_get_compression_extra(col->prtype)
|| (col->len < 256
&& col->mtype != DATA_BLOB)) {
extra_size++;
} else {
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2015, MariaDB Corporation.
Copyright (c) 2015, 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
......@@ -2461,8 +2461,7 @@ row_sel_convert_mysql_key_to_innobase(
/* MySQL key value format col */
FALSE,
key_ptr + data_offset, data_len,
dict_table_is_comp(index->table),
false, 0, 0 ,0);
dict_table_is_comp(index->table));
ut_a(buf <= original_buf + buf_len);
}
......@@ -2556,15 +2555,15 @@ row_sel_store_row_id_to_prebuilt(
#ifdef UNIV_DEBUG
/** Convert a non-SQL-NULL field from Innobase format to MySQL format. */
# define row_sel_field_store_in_mysql_format( \
dest,templ,idx,field,src,len,prebuilt) \
dest,templ,idx,field,src,len) \
row_sel_field_store_in_mysql_format_func \
(dest,templ,idx,field,src,len, prebuilt)
(dest,templ,idx,field,src,len)
#else /* UNIV_DEBUG */
/** Convert a non-SQL-NULL field from Innobase format to MySQL format. */
# define row_sel_field_store_in_mysql_format( \
dest,templ,idx,field,src,len,prebuilt) \
dest,templ,idx,field,src,len) \
row_sel_field_store_in_mysql_format_func \
(dest,templ,src,len, prebuilt)
(dest,templ,src,len)
#endif /* UNIV_DEBUG */
/**************************************************************//**
......@@ -2594,10 +2593,7 @@ row_sel_field_store_in_mysql_format_func(
templ->icp_rec_field_no */
#endif /* UNIV_DEBUG */
const byte* data, /*!< in: data to store */
ulint len, /*!< in: length of the data */
row_prebuilt_t* prebuilt)
/*!< in: use prebuilt->compress_heap
only here */
ulint len) /*!< in: length of the data */
{
byte* ptr;
#ifdef UNIV_DEBUG
......@@ -2641,15 +2637,6 @@ row_sel_field_store_in_mysql_format_func(
field_end = dest + templ->mysql_col_len;
if (templ->mysql_type == DATA_MYSQL_TRUE_VARCHAR) {
/* If this is a compressed column,
decompress it first */
if (templ->compressed)
data = row_decompress_column(data, &len,
reinterpret_cast<const byte*>(
templ->zip_dict_data.str),
templ->zip_dict_data.length,
prebuilt);
/* This is a >= 5.0.3 type true VARCHAR. Store the
length of the data to the first byte or the first
two bytes of dest. */
......@@ -2700,11 +2687,7 @@ row_sel_field_store_in_mysql_format_func(
already copied to the buffer in row_sel_store_mysql_rec */
row_mysql_store_blob_ref(dest, templ->mysql_col_len, data,
len, templ->compressed,
reinterpret_cast<const byte*>(
templ->zip_dict_data.str),
templ->zip_dict_data.length,
prebuilt);
len);
break;
case DATA_MYSQL:
......@@ -2857,7 +2840,7 @@ row_sel_store_mysql_field_func(
row_sel_field_store_in_mysql_format(
mysql_rec + templ->mysql_col_offset,
templ, index, field_no, data, len, prebuilt);
templ, index, field_no, data, len);
if (heap != prebuilt->blob_heap) {
mem_heap_free(heap);
......@@ -2907,7 +2890,7 @@ row_sel_store_mysql_field_func(
row_sel_field_store_in_mysql_format(
mysql_rec + templ->mysql_col_offset,
templ, index, field_no, data, len, prebuilt);
templ, index, field_no, data, len);
}
ut_ad(len != UNIV_SQL_NULL);
......@@ -2955,9 +2938,6 @@ row_sel_store_mysql_rec(
prebuilt->blob_heap = NULL;
}
if (UNIV_LIKELY_NULL(prebuilt->compress_heap))
mem_heap_empty(prebuilt->compress_heap);
for (i = 0; i < prebuilt->n_template; i++) {
const mysql_row_templ_t*templ = &prebuilt->mysql_template[i];
const ulint field_no
......
......@@ -3,7 +3,7 @@
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, Google Inc.
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
Google, Inc. Those modifications are gratefully acknowledged and are described
......@@ -2811,12 +2811,6 @@ innobase_start_or_create_for_mysql(void)
}
}
/* Create the SYS_ZIP_DICT system table */
err = dict_create_or_check_sys_zip_dict();
if (err != DB_SUCCESS) {
return(err);
}
srv_is_being_started = FALSE;
ut_a(trx_purge_state() == PURGE_STATE_INIT);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment