Merge 10.2 into 10.3

This commit is contained in:
Marko Mäkelä 2019-07-02 17:46:22 +03:00
commit e82fe21e3a
320 changed files with 23190 additions and 7611 deletions

View file

@ -1,18 +1,117 @@
SpaceBeforeAssignmentOperators: false
SpaceAfterCStyleCast: true
BreakBeforeBraces: Custom
---
Language: Cpp
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: true
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakStringLiterals: true
ColumnLimit: 79
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
Language: Cpp
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseTab: Never
...

View file

@ -4644,8 +4644,16 @@ void do_perl(struct st_command *command)
str_to_file(temp_file_path, ds_script.str, ds_script.length);
/* Use the same perl executable as the one that runs mysql-test-run.pl */
const char *mtr_perl=getenv("MTR_PERL");
if (!mtr_perl)
mtr_perl="perl";
/* Format the "perl <filename>" command */
my_snprintf(buf, sizeof(buf), "perl %s", temp_file_path);
if (strchr(mtr_perl, ' '))
my_snprintf(buf, sizeof(buf), "\"%s\" %s", mtr_perl, temp_file_path);
else
my_snprintf(buf, sizeof(buf), "%s %s", mtr_perl, temp_file_path);
if (!(res_file= my_popen(buf, "r")))
{

View file

@ -101,6 +101,8 @@ ulong srv_page_size_shift;
page_size_t univ_page_size(0, 0, false);
/* Current page number (0 based). */
unsigned long long cur_page_num;
/* Current space. */
unsigned long long cur_space;
/* Skip the checksum verification. */
static bool no_check;
/* Enabled for strict checksum verification. */
@ -452,6 +454,27 @@ ulint read_file(
return bytes;
}
/** Check whether the page contains all zeroes.
@param[in] buf page
@param[in] size physical size of the page
@return true if the page is all zeroes; else false */
static bool is_page_all_zeroes(
byte* buf,
ulint size)
{
/* On pages that are not all zero, the page number
must match. */
const ulint* p = reinterpret_cast<const ulint*>(buf);
const ulint* const end = reinterpret_cast<const ulint*>(buf + size);
do {
if (*p++) {
return false;
}
} while (p != end);
return true;
}
/** Check if page is corrupted or not.
@param[in] buf page frame
@param[in] page_size page size
@ -463,10 +486,10 @@ ulint read_file(
static
bool
is_page_corrupted(
byte* buf,
byte* buf,
const page_size_t& page_size,
bool is_encrypted,
bool is_compressed)
bool is_encrypted,
bool is_compressed)
{
/* enable if page is corrupted. */
@ -479,6 +502,24 @@ is_page_corrupted(
ulint space_id = mach_read_from_4(
buf + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
if (mach_read_from_4(buf + FIL_PAGE_OFFSET) != cur_page_num
|| space_id != cur_space) {
/* On pages that are not all zero, the page number
must match. */
if (is_page_all_zeroes(buf, page_size.physical())) {
return false;
}
if (is_log_enabled) {
fprintf(log_file,
"page id mismatch space::" ULINTPF
" page::%llu \n",
space_id, cur_page_num);
}
return true;
}
/* We can't trust only a page type, thus we take account
also fsp_flags or crypt_data on page 0 */
if ((page_type == FIL_PAGE_PAGE_COMPRESSED && is_compressed) ||
@ -1577,9 +1618,6 @@ int main(
FILE* fil_page_type = NULL;
fpos_t pos;
/* Use to check the space id of given file. If space_id is zero,
then check whether page is doublewrite buffer.*/
ulint space_id = 0UL;
/* enable when space_id of given file is zero. */
bool is_system_tablespace = false;
@ -1701,9 +1739,8 @@ int main(
/* enable variable is_system_tablespace when space_id of given
file is zero. Use to skip the checksum verification and rewrite
for doublewrite pages. */
is_system_tablespace = (!memcmp(&space_id, buf +
FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, 4))
? true : false;
cur_space = mach_read_from_4(buf + FIL_PAGE_SPACE_ID);
cur_page_num = mach_read_from_4(buf + FIL_PAGE_OFFSET);
/* Determine page size, zip_size and page compression
from fsp_flags and encryption metadata from page 0 */
@ -1715,7 +1752,9 @@ int main(
physical_page_size = page_size.physical();
bool is_compressed = FSP_FLAGS_HAS_PAGE_COMPRESSION(flags);
if (page_size.physical() > UNIV_ZIP_SIZE_MIN) {
if (physical_page_size == UNIV_ZIP_SIZE_MIN) {
partial_page_read = false;
} else {
/* Read rest of the page 0 to determine crypt_data */
bytes = read_file(buf, partial_page_read, page_size.physical(), fil_in);
if (bytes != page_size.physical()) {
@ -1730,6 +1769,7 @@ int main(
partial_page_read = false;
}
/* Now that we have full page 0 in buffer, check encryption */
bool is_encrypted = check_encryption(filename, page_size, buf);
@ -1740,7 +1780,9 @@ int main(
unsigned long long tmp_allow_mismatches = allow_mismatches;
allow_mismatches = 0;
exit_status = verify_checksum(buf, page_size, is_encrypted, is_compressed, &mismatch_count);
exit_status = verify_checksum(
buf, page_size, is_encrypted,
is_compressed, &mismatch_count);
if (exit_status) {
fprintf(stderr, "Error: Page 0 checksum mismatch, can't continue. \n");
@ -1804,6 +1846,36 @@ int main(
}
}
off_t cur_offset = 0;
/* Find the first non all-zero page and fetch the
space id from there. */
while (is_page_all_zeroes(buf, physical_page_size)) {
bytes = ulong(read_file(
buf, false, physical_page_size,
fil_in));
if (feof(fil_in)) {
fprintf(stderr, "All are "
"zero-filled pages.");
goto my_exit;
}
cur_offset++;
}
cur_space = mach_read_from_4(buf + FIL_PAGE_SPACE_ID);
is_system_tablespace = (cur_space == 0);
if (cur_offset > 0) {
/* Re-read the non-zero page to check the
checksum. So move the file pointer to
previous position and reset the page number too. */
cur_page_num = mach_read_from_4(buf + FIL_PAGE_OFFSET);
if (!start_page) {
goto first_non_zero;
}
}
/* seek to the necessary position */
if (start_page) {
if (!read_from_stdin) {
@ -1901,6 +1973,7 @@ int main(
goto my_exit;
}
first_non_zero:
if (is_system_tablespace) {
/* enable when page is double write buffer.*/
skip_page = is_page_doublewritebuffer(buf);
@ -1921,8 +1994,10 @@ int main(
checksum verification.*/
if (!no_check
&& !skip_page
&& (exit_status = verify_checksum(buf, page_size,
is_encrypted, is_compressed, &mismatch_count))) {
&& (exit_status = verify_checksum(
buf, page_size,
is_encrypted, is_compressed,
&mismatch_count))) {
goto my_exit;
}

View file

@ -3794,7 +3794,7 @@ open_or_create_log_file(
fil_space_t* space,
ulint i) /*!< in: log file number in group */
{
char name[10000];
char name[FN_REFLEN];
ulint dirnamelen;
os_normalize_path(srv_log_group_home_dir);

View file

@ -1,5 +1,5 @@
/* Copyright (C) 2006-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
Copyright (c) 2009, 2013, Monty Program Ab.
Copyright (c) 2009, 2019, 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
@ -286,7 +286,6 @@ extern int maria_close(MARIA_HA *file);
extern int maria_delete(MARIA_HA *file, const uchar *buff);
extern MARIA_HA *maria_open(const char *name, int mode,
uint wait_if_locked);
extern MARIA_HA *maria_clone(struct st_maria_share *share, int mode);
extern int maria_panic(enum ha_panic_function function);
extern int maria_rfirst(MARIA_HA *file, uchar *buf, int inx);
extern int maria_rkey(MARIA_HA *file, uchar *buf, int inx,

View file

@ -36,6 +36,21 @@ use POSIX qw[ _exit ];
use IO::Handle qw[ flush ];
use mtr_results;
use Term::ANSIColor;
my %color_map = qw/pass green
retry-pass green
fail red
retry-fail red
disabled bright_black
skipped yellow
reset reset/;
sub xterm_color {
if (-t STDOUT and defined $ENV{TERM} and $ENV{TERM} =~ /xterm/) {
syswrite STDOUT, color($color_map{$_[0]});
}
}
my $tot_real_time= 0;
our $timestamp= 0;
@ -498,7 +513,16 @@ sub mtr_print (@) {
sub mtr_report (@) {
if (defined $verbose)
{
print _name(). join(" ", @_). "\n";
my @s = split /\[ (\S+) \]/, _name() . "@_\n";
if (@s > 1) {
print $s[0];
xterm_color($s[1]);
print "[ $s[1] ]";
xterm_color('reset');
print $s[2];
} else {
print $s[0];
}
}
}

View file

@ -2511,6 +2511,40 @@ WHERE tb1.pk = 40
ORDER BY tb1.i1;
v2
DROP TABLE t1,t2;
#
# MDEV-19790 : IS NOT TRUE / IS NOT FALSE predicates over
# inner tables of outer joins
#
create table t1 (a int);
create table t2 (b int);
insert into t1 values (3), (7), (1);
insert into t2 values (7), (4), (3);
select * from t1 left join t2 on a=b;
a b
3 3
7 7
1 NULL
select * from t1 left join t2 on a=b where (b > 3) is not true;
a b
3 3
1 NULL
explain extended select * from t1 left join t2 on a=b where (b > 3) is not true;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`b` = `test`.`t1`.`a`) where `test`.`t2`.`b` > 3 is not true
select * from t1 left join t2 on a=b where (b > 3) is not false;
a b
7 7
1 NULL
explain extended select * from t1 left join t2 on a=b where (b > 3) is not false;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`b` = `test`.`t1`.`a`) where `test`.`t2`.`b` > 3 is not false
drop table t1,t2;
# end of 5.5 tests
#
# MDEV-19258: chained right joins all converted to inner joins

View file

@ -2041,6 +2041,29 @@ ORDER BY tb1.i1;
DROP TABLE t1,t2;
--echo #
--echo # MDEV-19790 : IS NOT TRUE / IS NOT FALSE predicates over
--echo # inner tables of outer joins
--echo #
create table t1 (a int);
create table t2 (b int);
insert into t1 values (3), (7), (1);
insert into t2 values (7), (4), (3);
select * from t1 left join t2 on a=b;
let $q=
select * from t1 left join t2 on a=b where (b > 3) is not true;
eval $q;
eval explain extended $q;
let $q=
select * from t1 left join t2 on a=b where (b > 3) is not false;
eval $q;
eval explain extended $q;
drop table t1,t2;
--echo # end of 5.5 tests
--echo #

View file

@ -2522,6 +2522,40 @@ WHERE tb1.pk = 40
ORDER BY tb1.i1;
v2
DROP TABLE t1,t2;
#
# MDEV-19790 : IS NOT TRUE / IS NOT FALSE predicates over
# inner tables of outer joins
#
create table t1 (a int);
create table t2 (b int);
insert into t1 values (3), (7), (1);
insert into t2 values (7), (4), (3);
select * from t1 left join t2 on a=b;
a b
7 7
3 3
1 NULL
select * from t1 left join t2 on a=b where (b > 3) is not true;
a b
3 3
1 NULL
explain extended select * from t1 left join t2 on a=b where (b > 3) is not true;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.a 3 100.00 Using where; Using join buffer (flat, BNLH join)
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` is not null) where `test`.`t2`.`b` > 3 is not true
select * from t1 left join t2 on a=b where (b > 3) is not false;
a b
7 7
1 NULL
explain extended select * from t1 left join t2 on a=b where (b > 3) is not false;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.a 3 100.00 Using where; Using join buffer (flat, BNLH join)
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` is not null) where `test`.`t2`.`b` > 3 is not false
drop table t1,t2;
# end of 5.5 tests
#
# MDEV-19258: chained right joins all converted to inner joins

View file

@ -371,6 +371,8 @@ main();
sub main {
$ENV{MTR_PERL}=$^X;
# Default, verbosity on
report_option('verbose', 0);

View file

@ -3,6 +3,7 @@ show variables like 'innodb_encrypt%';
Variable_name Value
innodb_encrypt_log ON
innodb_encrypt_tables ON
innodb_encrypt_temporary_tables OFF
innodb_encryption_rotate_key_age 2
innodb_encryption_rotation_iops 100
innodb_encryption_threads 4

View file

@ -26,7 +26,7 @@ CREATE TABLE t6 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB;
# Run innochecksum on t2
# Run innochecksum on t3
# Run innochecksum on t6
# no encryption corrupting the field should not have effect
# Space ID mismatch
# Restore the original tables
# Corrupt FIL_DATA+10 (data)
# Run innochecksum on t2

View file

@ -22,6 +22,8 @@ key (col_int_key),
key (col_char_key)
) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=1;
CREATE TEMPORARY TABLE t LIKE t0;
Warnings:
Warning 1478 Ignoring encryption parameter during temporary table creation.
INSERT INTO t VALUES
(NULL,1,1,'private','secret'),(NULL,2,2,'sacred','success'),
(NULL,3,3,'story','secure'),(NULL,4,4,'security','sacrament');

View file

@ -0,0 +1,19 @@
SELECT variable_value into @old_encrypted FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted';
SELECT variable_value into @old_decrypted FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_decrypted';
CREATE TEMPORARY TABLE t1(f1 CHAR(200), f2 CHAR(200)) ENGINE=InnoDB;
INSERT INTO t1 (f1,f2) SELECT '', '' FROM seq_1_to_8192;
CREATE TEMPORARY TABLE t2(f1 CHAR(100), f2 CHAR(200), f3 CHAR(200))ENGINE=InnoDB;
INSERT INTO t2 (f1,f2,f3) SELECT '', '', '' FROM seq_1_to_8192;
SELECT COUNT(*) FROM t1;
COUNT(*)
8192
SELECT variable_value > @old_encrypted FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted';
variable_value > @old_encrypted
1
SELECT variable_value > @old_decrypted FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_decrypted';
variable_value > @old_decrypted
1

View file

@ -3,6 +3,7 @@ SHOW VARIABLES LIKE 'innodb_encrypt%';
Variable_name Value
innodb_encrypt_log ON
innodb_encrypt_tables ON
innodb_encrypt_temporary_tables OFF
innodb_encryption_rotate_key_age 15
innodb_encryption_rotation_iops 100
innodb_encryption_threads 4
@ -57,6 +58,7 @@ SHOW VARIABLES LIKE 'innodb_encrypt%';
Variable_name Value
innodb_encrypt_log ON
innodb_encrypt_tables OFF
innodb_encrypt_temporary_tables OFF
innodb_encryption_rotate_key_age 15
innodb_encryption_rotation_iops 100
innodb_encryption_threads 0

View file

@ -193,7 +193,8 @@ EOF
--exec $INNOCHECKSUM $t3_IBD
--echo # Run innochecksum on t6
--echo # no encryption corrupting the field should not have effect
--echo # Space ID mismatch
--error 1
--exec $INNOCHECKSUM $t6_IBD
--enable_result_log

View file

@ -123,6 +123,7 @@ SET DEBUG_SYNC = 'now WAIT_FOR done';
SET GLOBAL innodb_flush_log_at_trx_commit=1;
COMMIT;
let $restart_parameters = --innodb_encryption_threads=2;
--let $shutdown_timeout= 0
--source include/restart_mysqld.inc
disconnect con1;

View file

@ -0,0 +1,2 @@
--innodb_buffer_pool_size=5M
--innodb_encrypt_temporary_tables=1

View file

@ -0,0 +1,23 @@
--source include/have_sequence.inc
--source include/have_innodb.inc
--source include/have_file_key_management_plugin.inc
SELECT variable_value into @old_encrypted FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted';
SELECT variable_value into @old_decrypted FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_decrypted';
CREATE TEMPORARY TABLE t1(f1 CHAR(200), f2 CHAR(200)) ENGINE=InnoDB;
INSERT INTO t1 (f1,f2) SELECT '', '' FROM seq_1_to_8192;
CREATE TEMPORARY TABLE t2(f1 CHAR(100), f2 CHAR(200), f3 CHAR(200))ENGINE=InnoDB;
INSERT INTO t2 (f1,f2,f3) SELECT '', '', '' FROM seq_1_to_8192;
SELECT COUNT(*) FROM t1;
SELECT variable_value > @old_encrypted FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted';
SELECT variable_value > @old_decrypted FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_decrypted';
--source include/restart_mysqld.inc

View file

@ -16,6 +16,7 @@ MW-328B : MDEV-17847 Galera test failure on MW-328[A|B|C]
MW-328C : MDEV-17847 Galera test failure on MW-328[A|B|C]
MW-329 : wsrep_local_replays not stable
MW-336 : MDEV-19746 Galera test failures because of wsrep_slave_threads identification
MW-388: MDEV-19803 Long semaphore wait error on galera.MW-388
MW-416 : MDEV-13549 Galera test failures
MW-44 : MDEV-15809 Test failure on galera.MW-44
galera_account_management : MariaDB 10.0 does not support ALTER USER

View file

@ -8,23 +8,23 @@ CREATE TABLE `x..d` (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
CREATE TABLE t1(a SERIAL)ENGINE=InnoDB;
INSERT INTO t1 VALUES(1),(2),(3);
SELECT * FROM t;
ERROR 42S02: Table 'test.t' doesn't exist in engine
ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
ALTER TABLE t ADD INDEX (a), ALGORITHM=INPLACE;
ERROR 42S02: Table 'test.t' doesn't exist in engine
ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
SHOW WARNINGS;
Level Code Message
Warning 1812 Tablespace is missing for table 'test/t'
Error 1932 Table 'test.t' doesn't exist in engine
Error 1030 Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
ALTER TABLE t ADD INDEX (a), ALGORITHM=COPY;
ERROR 42S02: Table 'test.t' doesn't exist in engine
ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
SHOW WARNINGS;
Level Code Message
Warning 1812 Tablespace is missing for table 'test/t'
Error 1932 Table 'test.t' doesn't exist in engine
Error 1030 Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
ALTER TABLE t AUTO_INCREMENT=1, ALGORITHM=INPLACE;
ERROR 42S02: Table 'test.t' doesn't exist in engine
ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
ALTER TABLE t AUTO_INCREMENT=1, ALGORITHM=COPY;
ERROR 42S02: Table 'test.t' doesn't exist in engine
ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
ALTER TABLE t ALGORITHM=INPLACE, DISCARD TABLESPACE;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DISCARD TABLESPACE' at line 1
ALTER TABLE t ALGORITHM=COPY, DISCARD TABLESPACE;
@ -37,7 +37,7 @@ Warning 1812 Tablespace is missing for table 'test/t'
Warning 1812 Tablespace is missing for table 'test/t'
DROP TABLE t;
SELECT * FROM `x..d`;
ERROR 42S02: Table 'test.x..d' doesn't exist in engine
ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
DROP TABLE `x..d`;
ALTER TABLE t1 DISCARD TABLESPACE;
ALTER TABLE t1 AUTO_INCREMENT=1, ALGORITHM=INPLACE;

View file

@ -0,0 +1,149 @@
#
# Bug #16963396 INNODB: USE OF LARGE EXTERNALLY-STORED FIELDS MAKES
# CRASH RECOVERY LOSE DATA
#
#
# Uncompressed Table - Insert Operation - Crash Test
# Fresh insert with blobs
#
CREATE TABLE t1 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB;
INSERT INTO t1 (a, b) VALUES (1, repeat('^', 40000));
INSERT INTO t1 (a, b) VALUES (2, '2');
INSERT INTO t1 (a, b) VALUES (3, '3');
INSERT INTO t1 (a, b) VALUES (4, '4');
INSERT INTO t1 (a, b) VALUES (5, '5');
begin;
INSERT INTO t1 (a, b) VALUES (6, REPEAT('a', 4*1024*1024));
SELECT a, right(b, 50) FROM t1;
a right(b, 50)
1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 2
3 3
4 4
5 5
#
# Uncompressed Table - UPDATE Operation - Crash Test
# Update of non-blob column so that blob is needed.
#
begin;
UPDATE t1 set b = REPEAT('a', 4*1024*1024) where a = 5 ;
SELECT a, right(b, 50) FROM t1;
a right(b, 50)
1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 2
3 3
4 4
5 5
#
# Uncompressed Table - UPDATE Operation - Crash Test
# Update of blob column to blob.
#
connect con1,localhost,root,,;
begin;
UPDATE t1 set b = REPEAT('$', 50000) where a = 1;
connection default;
SET GLOBAL innodb_flush_log_at_trx_commit=1;
UPDATE t1 SET b='five' WHERE a=5;
disconnect con1;
SELECT a, right(b, 50) FROM t1;
a right(b, 50)
1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 2
3 3
4 4
5 five
#
# Uncompressed Table - Rollback of UPDATE operation
# Update moves offpage data to inline data.
#
create table t2 (f1 bigint primary key, f2 longblob, f3 longblob,
index(f2(10), f3(10))) engine=innodb;
insert into t2 values (10, repeat('.', 40000), repeat('?', 40000));
connect con1,localhost,root,,;
begin;
update t2 set f2 = '=';
select f1, right(f2, 20), right(f3, 20) from t2;
f1 right(f2, 20) right(f3, 20)
10 = ????????????????????
update t2 set f3 = '&';
select f1, right(f2, 20), right(f3, 20) from t2;
f1 right(f2, 20) right(f3, 20)
10 = &
connection default;
SET GLOBAL innodb_flush_log_at_trx_commit=1;
DELETE FROM t1 WHERE a=1;
disconnect con1;
select f1, right(f2, 20), right(f3, 20) from t2;
f1 right(f2, 20) right(f3, 20)
10 .................... ????????????????????
check table t2;
Table Op Msg_type Msg_text
test.t2 check status OK
drop table t2;
#
# Compressed Table - Insert Operation - Crash Test
# fresh insert with BLOBs
#
set global innodb_compression_level = 0;
create table t3 (f1 bigint primary key, f2 longblob, f3 longblob,
index(f2(10), f3(10))) engine=innodb row_format=compressed;
connect con1,localhost,root,,;
begin;
INSERT INTO t3 (f1, f2, f3) VALUES (6, repeat('/', 40000), repeat('<', 40000));
connection default;
SET GLOBAL innodb_flush_log_at_trx_commit=1;
DELETE FROM t1 WHERE a=2;
disconnect con1;
select f1, length(f2), length(f3) from t3;
f1 length(f2) length(f3)
select f1, right(f2, 30), right(f3, 20) from t3;
f1 right(f2, 30) right(f3, 20)
check table t3;
Table Op Msg_type Msg_text
test.t3 check status OK
#
# Compressed Table - Update Operation - Crash Test
# update of a non-BLOB column so that BLOB is needed
#
set global innodb_compression_level = 0;
insert into t3 values (2, repeat('!', 30), repeat('+', 30));
connect con1,localhost,root,,;
begin;
UPDATE t3 set f2 = repeat('>', 40000) where f1 = 2;
connection default;
SET GLOBAL innodb_flush_log_at_trx_commit=1;
DELETE FROM t1 WHERE a=3;
disconnect con1;
select f1, length(f2), length(f3) from t3;
f1 length(f2) length(f3)
2 30 30
select f1, right(f2, 30), right(f3, 20) from t3;
f1 right(f2, 30) right(f3, 20)
2 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ++++++++++++++++++++
check table t3;
Table Op Msg_type Msg_text
test.t3 check status OK
#
# Compressed Table - Update Operation - Crash Test
# update blob to blob
#
set global innodb_compression_level = 0;
insert into t3 values (3, repeat('%', 40000), repeat('~', 40000));
connect con1,localhost,root,,;
begin;
UPDATE t3 set f2 = concat(f2, repeat(',', 10)) where f1 = 3;
connection default;
SET GLOBAL innodb_flush_log_at_trx_commit=1;
DELETE FROM t1 WHERE a=4;
select f1, length(f2), length(f3) from t3;
f1 length(f2) length(f3)
2 30 30
3 40000 40000
select f1, right(f2, 30), right(f3, 20) from t3;
f1 right(f2, 30) right(f3, 20)
2 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ++++++++++++++++++++
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ~~~~~~~~~~~~~~~~~~~~
check table t3;
Table Op Msg_type Msg_text
test.t3 check status OK
DROP TABLE t1,t3;

View file

@ -0,0 +1,22 @@
CREATE TABLE tab5 (col1 int auto_increment primary key,
col2 VARCHAR(25), col3 varchar(25)) ENGINE=InnoDB;
CREATE INDEX idx1 ON tab5(col2(10));
CREATE INDEX idx2 ON tab5(col3(10));
SET GLOBAL innodb_buffer_pool_filename=ib_buffer_pool100;
SET GLOBAL innodb_buffer_pool_dump_pct=100;
SELECT variable_value INTO @IBPDS
FROM information_schema.global_status
WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS';
SET GLOBAL innodb_buffer_pool_dump_now=ON;
SET GLOBAL innodb_buffer_pool_filename=ib_buffer_pool1;
SET GLOBAL innodb_buffer_pool_dump_pct=1;
SELECT @@global.innodb_buffer_pool_dump_pct;
@@global.innodb_buffer_pool_dump_pct
1
SELECT variable_value INTO @IBPDS
FROM information_schema.global_status
WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS';
SET GLOBAL innodb_buffer_pool_dump_now=ON;
SET GLOBAL innodb_buffer_pool_dump_pct=DEFAULT;
SET GLOBAL innodb_buffer_pool_filename=DEFAULT;
DROP TABLE tab5;

View file

@ -3130,8 +3130,49 @@ ERROR 22007: Incorrect datetime value: ''
DROP TABLE t1;
SET SQL_MODE=DEFAULT;
#
# Bug#56862 Moved to innodb_16k.test
# Bug#56862 Execution of a query that uses index merge returns a wrong result
#
CREATE TABLE t1 (
pk int NOT NULL AUTO_INCREMENT PRIMARY KEY,
a int,
b int,
INDEX idx(a))
ENGINE=INNODB;
INSERT INTO t1(a,b) VALUES
(11, 1100), (2, 200), (1, 100), (14, 1400), (5, 500),
(3, 300), (17, 1700), (4, 400), (12, 1200), (8, 800),
(6, 600), (18, 1800), (9, 900), (10, 1000), (7, 700),
(13, 1300), (15, 1500), (19, 1900), (16, 1600), (20, 2000);
INSERT INTO t1(a,b) SELECT a+20, b+2000 FROM t1;
INSERT INTO t1(a,b) SELECT a+40, b+4000 FROM t1;
INSERT INTO t1(a,b) SELECT a+80, b+8000 FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1 VALUES (1000000, 0, 0);
set @optimizer_switch_saved=@@optimizer_switch;
SET SESSION optimizer_switch='derived_merge=off';
SET SESSION sort_buffer_size = 1024*36;
EXPLAIN
SELECT COUNT(*) FROM
(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 1537
2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 1537 Using sort_union(idx,PRIMARY); Using where
SELECT COUNT(*) FROM
(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
COUNT(*)
1537
set @@optimizer_switch=@optimizer_switch_saved;
SET SESSION sort_buffer_size = DEFAULT;
DROP TABLE t1;
#
# Test for bug #39932 "create table fails if column for FK is in different
# case than in corr index".

View file

@ -0,0 +1,11 @@
#
# Bug#19419026 WHEN A TABLESPACE IS NOT FOUND, DO NOT REPORT "TABLE NOT FOUND"
#
CREATE DATABASE `..................................................`;
USE `..................................................`;
CREATE TABLE `..................................................` (ID INT)
ENGINE=INNODB;
select * from `..................................................`;
ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
DROP TABLE `..................................................`;
DROP DATABASE `..................................................`;

View file

@ -0,0 +1,6 @@
# Set the environmental variables
create table t1(f1 int not null)engine=innodb;
insert into t1 values(1), (2), (3);
# Change the page offset
FOUND 1 /page id mismatch/ in result.log
drop table t1;

View file

@ -0,0 +1,121 @@
SET @save_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
# Bug #12429576 - Test an assertion failure on purge.
CREATE TABLE t1_purge (
A int,
B blob, C blob, D blob, E blob,
F blob, G blob, H blob,
PRIMARY KEY (B(767), C(767), D(767), E(767), A),
INDEX (A)
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t1_purge VALUES (1,
REPEAT('b', 766), REPEAT('c', 766), REPEAT('d', 766), REPEAT('e', 766),
REPEAT('f', 766), REPEAT('g', 766), REPEAT('h', 766));
CREATE TABLE t2_purge (
A int PRIMARY KEY,
B blob, C blob, D blob, E blob,
F blob, G blob, H blob, I blob,
J blob, K blob, L blob,
INDEX (B(767))) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t2_purge VALUES (1,
REPEAT('b', 766), REPEAT('c', 766), REPEAT('d', 766), REPEAT('e', 766),
REPEAT('f', 766), REPEAT('g', 766), REPEAT('h', 766), REPEAT('i', 766),
REPEAT('j', 766), REPEAT('k', 766), REPEAT('l', 766));
CREATE TABLE t3_purge (
A int,
B varchar(800), C varchar(800), D varchar(800), E varchar(800),
F varchar(800), G varchar(800), H varchar(800),
PRIMARY KEY (B(767), C(767), D(767), E(767), A),
INDEX (A)
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t3_purge SELECT * FROM t1_purge;
CREATE TABLE t4_purge (
A int PRIMARY KEY,
B varchar(800), C varchar(800), D varchar(800), E varchar(800),
F varchar(800), G varchar(800), H varchar(800), I varchar(800),
J varchar(800), K varchar(800), L varchar(800),
INDEX (B(767))) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t4_purge SELECT * FROM t2_purge;
DELETE FROM t1_purge;
DELETE FROM t2_purge;
DELETE FROM t3_purge;
DELETE FROM t4_purge;
SET @r=REPEAT('a',500);
CREATE TABLE t12637786(a int,
v1 varchar(500), v2 varchar(500), v3 varchar(500),
v4 varchar(500), v5 varchar(500), v6 varchar(500),
v7 varchar(500), v8 varchar(500), v9 varchar(500),
v10 varchar(500), v11 varchar(500), v12 varchar(500),
v13 varchar(500), v14 varchar(500), v15 varchar(500),
v16 varchar(500), v17 varchar(500), v18 varchar(500)
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
CREATE INDEX idx1 ON t12637786(a,v1);
INSERT INTO t12637786 VALUES(9,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
UPDATE t12637786 SET a=1000;
DELETE FROM t12637786;
# Bug#12963823 - Test that the purge thread does not crash when
CREATE TABLE t12963823(a blob,b blob,c blob,d blob,e blob,f blob,g blob,h blob,
i blob,j blob,k blob,l blob,m blob,n blob,o blob,p blob)
ENGINE=innodb ROW_FORMAT=dynamic;
SET @r = REPEAT('a', 767);
INSERT INTO t12963823 VALUES (@r,@r,@r,@r, @r,@r,@r,@r, @r,@r,@r,@r, @r,@r,@r,@r);
CREATE INDEX ndx_a ON t12963823 (a(500));
CREATE INDEX ndx_b ON t12963823 (b(500));
CREATE INDEX ndx_c ON t12963823 (c(500));
CREATE INDEX ndx_d ON t12963823 (d(500));
CREATE INDEX ndx_e ON t12963823 (e(500));
CREATE INDEX ndx_f ON t12963823 (f(500));
CREATE INDEX ndx_k ON t12963823 (k(500));
CREATE INDEX ndx_l ON t12963823 (l(500));
SET @r = REPEAT('b', 500);
UPDATE t12963823 set a=@r,b=@r,c=@r,d=@r;
UPDATE t12963823 set e=@r,f=@r,g=@r,h=@r;
UPDATE t12963823 set i=@r,j=@r,k=@r,l=@r;
UPDATE t12963823 set m=@r,n=@r,o=@r,p=@r;
ALTER TABLE t12963823 DROP INDEX ndx_a;
ALTER TABLE t12963823 DROP INDEX ndx_b;
CREATE INDEX ndx_g ON t12963823 (g(500));
CREATE INDEX ndx_h ON t12963823 (h(500));
CREATE INDEX ndx_i ON t12963823 (i(500));
CREATE INDEX ndx_j ON t12963823 (j(500));
CREATE INDEX ndx_m ON t12963823 (m(500));
CREATE INDEX ndx_n ON t12963823 (n(500));
CREATE INDEX ndx_o ON t12963823 (o(500));
CREATE INDEX ndx_p ON t12963823 (p(500));
SHOW CREATE TABLE t12963823;
Table Create Table
t12963823 CREATE TABLE `t12963823` (
`a` blob DEFAULT NULL,
`b` blob DEFAULT NULL,
`c` blob DEFAULT NULL,
`d` blob DEFAULT NULL,
`e` blob DEFAULT NULL,
`f` blob DEFAULT NULL,
`g` blob DEFAULT NULL,
`h` blob DEFAULT NULL,
`i` blob DEFAULT NULL,
`j` blob DEFAULT NULL,
`k` blob DEFAULT NULL,
`l` blob DEFAULT NULL,
`m` blob DEFAULT NULL,
`n` blob DEFAULT NULL,
`o` blob DEFAULT NULL,
`p` blob DEFAULT NULL,
KEY `ndx_c` (`c`(500)),
KEY `ndx_d` (`d`(500)),
KEY `ndx_e` (`e`(500)),
KEY `ndx_f` (`f`(500)),
KEY `ndx_k` (`k`(500)),
KEY `ndx_l` (`l`(500)),
KEY `ndx_g` (`g`(500)),
KEY `ndx_h` (`h`(500)),
KEY `ndx_i` (`i`(500)),
KEY `ndx_j` (`j`(500)),
KEY `ndx_m` (`m`(500)),
KEY `ndx_n` (`n`(500)),
KEY `ndx_o` (`o`(500)),
KEY `ndx_p` (`p`(500))
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
InnoDB 0 transactions not purged
DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge, t12637786, t12963823;
SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency;

View file

@ -11,7 +11,7 @@ t CREATE TABLE `t` (
UNIQUE KEY `a` (`a`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
SELECT * FROM t;
ERROR 42S02: Table 'test.t' doesn't exist in engine
ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
TRUNCATE TABLE t;
ERROR 42S02: Table 'test.t' doesn't exist in engine
ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
DROP TABLE t;

View file

@ -35,22 +35,21 @@ INSERT INTO t1 VALUES(1),(2),(3);
--source include/start_mysqld.inc
# The ER_NO_SUCH_TABLE is being thrown by ha_innobase::open().
# The table does exist, only the tablespace does not exist.
--error ER_NO_SUCH_TABLE_IN_ENGINE
--error ER_GET_ERRNO
SELECT * FROM t;
--error ER_NO_SUCH_TABLE_IN_ENGINE
--error ER_GET_ERRNO
ALTER TABLE t ADD INDEX (a), ALGORITHM=INPLACE;
SHOW WARNINGS;
--error ER_NO_SUCH_TABLE_IN_ENGINE
--error ER_GET_ERRNO
ALTER TABLE t ADD INDEX (a), ALGORITHM=COPY;
SHOW WARNINGS;
--error ER_NO_SUCH_TABLE_IN_ENGINE
--error ER_GET_ERRNO
ALTER TABLE t AUTO_INCREMENT=1, ALGORITHM=INPLACE;
--error ER_NO_SUCH_TABLE_IN_ENGINE
--error ER_GET_ERRNO
ALTER TABLE t AUTO_INCREMENT=1, ALGORITHM=COPY;
--error ER_PARSE_ERROR
@ -61,7 +60,7 @@ ALTER TABLE t ALGORITHM=COPY, DISCARD TABLESPACE;
ALTER TABLE t ALGORITHM=DEFAULT, DISCARD TABLESPACE;
ALTER TABLE t DISCARD TABLESPACE;
DROP TABLE t;
--error ER_NO_SUCH_TABLE_IN_ENGINE
--error ER_GET_ERRNO
SELECT * FROM `x..d`;
DROP TABLE `x..d`;

View file

@ -0,0 +1,208 @@
--source include/maybe_debug.inc
--source include/innodb_page_size_small.inc
--echo #
--echo # Bug #16963396 INNODB: USE OF LARGE EXTERNALLY-STORED FIELDS MAKES
--echo # CRASH RECOVERY LOSE DATA
--echo #
# ..........................................................................
--echo #
--echo # Uncompressed Table - Insert Operation - Crash Test
--echo # Fresh insert with blobs
--echo #
CREATE TABLE t1 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB;
# Insert a few rows (it doesn't really matter how many). These transactions
# are committed once they are acked, so they should not be lost.
INSERT INTO t1 (a, b) VALUES (1, repeat('^', 40000));
INSERT INTO t1 (a, b) VALUES (2, '2');
INSERT INTO t1 (a, b) VALUES (3, '3');
INSERT INTO t1 (a, b) VALUES (4, '4');
INSERT INTO t1 (a, b) VALUES (5, '5');
# The BLOB insert will fail, and should disappear. However no data committed
# up to this point should be lost.
begin;
INSERT INTO t1 (a, b) VALUES (6, REPEAT('a', 4*1024*1024));
let $shutdown_timeout=0;
--source include/restart_mysqld.inc
SELECT a, right(b, 50) FROM t1;
# ..........................................................................
--echo #
--echo # Uncompressed Table - UPDATE Operation - Crash Test
--echo # Update of non-blob column so that blob is needed.
--echo #
# The BLOB update will fail, and should disappear. However no data committed
# up to this point should be lost.
begin;
UPDATE t1 set b = REPEAT('a', 4*1024*1024) where a = 5 ;
let $shutdown_timeout=0;
--source include/restart_mysqld.inc
SELECT a, right(b, 50) FROM t1;
# ..........................................................................
--echo #
--echo # Uncompressed Table - UPDATE Operation - Crash Test
--echo # Update of blob column to blob.
--echo #
# The BLOB update will fail, and should disappear. However no data committed
# up to this point should be lost.
connect (con1,localhost,root,,);
begin;
UPDATE t1 set b = REPEAT('$', 50000) where a = 1;
connection default;
SET GLOBAL innodb_flush_log_at_trx_commit=1;
UPDATE t1 SET b='five' WHERE a=5;
let $shutdown_timeout=0;
--source include/restart_mysqld.inc
disconnect con1;
SELECT a, right(b, 50) FROM t1;
# ..........................................................................
--echo #
--echo # Uncompressed Table - Rollback of UPDATE operation
--echo # Update moves offpage data to inline data.
--echo #
create table t2 (f1 bigint primary key, f2 longblob, f3 longblob,
index(f2(10), f3(10))) engine=innodb;
insert into t2 values (10, repeat('.', 40000), repeat('?', 40000));
connect (con1,localhost,root,,);
begin;
update t2 set f2 = '=';
select f1, right(f2, 20), right(f3, 20) from t2;
update t2 set f3 = '&';
select f1, right(f2, 20), right(f3, 20) from t2;
if ($have_debug) {
--disable_query_log
set DEBUG_SYNC='blob_rollback_middle SIGNAL stuck WAIT_FOR ever';
send ROLLBACK;
--enable_query_log
}
connection default;
if ($have_debug) {
--disable_query_log
SET DEBUG_SYNC = 'now WAIT_FOR stuck';
--enable_query_log
}
SET GLOBAL innodb_flush_log_at_trx_commit=1;
DELETE FROM t1 WHERE a=1;
let $shutdown_timeout=0;
--source include/restart_mysqld.inc
disconnect con1;
select f1, right(f2, 20), right(f3, 20) from t2;
check table t2;
drop table t2;
# ..........................................................................
--echo #
--echo # Compressed Table - Insert Operation - Crash Test
--echo # fresh insert with BLOBs
--echo #
set global innodb_compression_level = 0;
create table t3 (f1 bigint primary key, f2 longblob, f3 longblob,
index(f2(10), f3(10))) engine=innodb row_format=compressed;
# The BLOB insert will fail, and should disappear. However no data committed
# up to this point should be lost.
connect (con1,localhost,root,,);
begin;
INSERT INTO t3 (f1, f2, f3) VALUES (6, repeat('/', 40000), repeat('<', 40000));
connection default;
SET GLOBAL innodb_flush_log_at_trx_commit=1;
DELETE FROM t1 WHERE a=2;
let $shutdown_timeout=0;
--source include/restart_mysqld.inc
disconnect con1;
select f1, length(f2), length(f3) from t3;
select f1, right(f2, 30), right(f3, 20) from t3;
check table t3;
# ..........................................................................
--echo #
--echo # Compressed Table - Update Operation - Crash Test
--echo # update of a non-BLOB column so that BLOB is needed
--echo #
set global innodb_compression_level = 0;
insert into t3 values (2, repeat('!', 30), repeat('+', 30));
# The BLOB update will fail, and should disappear. However no data committed
# up to this point should be lost.
connect (con1,localhost,root,,);
begin;
UPDATE t3 set f2 = repeat('>', 40000) where f1 = 2;
connection default;
SET GLOBAL innodb_flush_log_at_trx_commit=1;
DELETE FROM t1 WHERE a=3;
let $shutdown_timeout=0;
--source include/restart_mysqld.inc
disconnect con1;
select f1, length(f2), length(f3) from t3;
select f1, right(f2, 30), right(f3, 20) from t3;
check table t3;
# ..........................................................................
--echo #
--echo # Compressed Table - Update Operation - Crash Test
--echo # update blob to blob
--echo #
set global innodb_compression_level = 0;
insert into t3 values (3, repeat('%', 40000), repeat('~', 40000));
# The BLOB update will fail, and should disappear. However no data committed
# up to this point should be lost.
connect (con1,localhost,root,,);
begin;
UPDATE t3 set f2 = concat(f2, repeat(',', 10)) where f1 = 3;
connection default;
SET GLOBAL innodb_flush_log_at_trx_commit=1;
DELETE FROM t1 WHERE a=4;
let $shutdown_timeout=0;
--source include/restart_mysqld.inc
select f1, length(f2), length(f3) from t3;
select f1, right(f2, 30), right(f3, 20) from t3;
check table t3;
DROP TABLE t1,t3;

View file

@ -0,0 +1,99 @@
# ************************************************************
# wl6504: This testcase is to check the functionality of the
# innodb_buffer_pool_dump_pct flag
# step 1.Set innodb_buffer_pool_dump_pct=100 and take the dump
# step 2.Set innodb_buffer_pool_dump_pct=1 and take the dump
# step 3.Compare the size of both the dump files
#*************************************************************
--source include/have_innodb.inc
--source include/have_innodb_16k.inc
let MYSQLD_DATADIR = `SELECT @@datadir`;
CREATE TABLE tab5 (col1 int auto_increment primary key,
col2 VARCHAR(25), col3 varchar(25)) ENGINE=InnoDB;
CREATE INDEX idx1 ON tab5(col2(10));
CREATE INDEX idx2 ON tab5(col3(10));
SET GLOBAL innodb_buffer_pool_filename=ib_buffer_pool100;
SET GLOBAL innodb_buffer_pool_dump_pct=100;
#***********************************************************
# SELECT *
# FROM information_schema.global_status
# WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS'
# gives
# a) VARIABLE_NAME VARIABLE_VALUE
# INNODB_BUFFER_POOL_DUMP_STATUS not started
# in case there was no innodb_buffer_pool_dump since server start.
# b) Something like
# VARIABLE_NAME VARIABLE_VALUE
# INNODB_BUFFER_POOL_DUMP_STATUS Buffer pool(s) dump completed at 130711 13:43:24
# in case there was a innodb_buffer_pool_dump since server start.
# Attention:
# - There is no guarantee that the current test is the first test which
# made an innodb_buffer_pool_dump since server startup.
# - The granularity of the timestamp is one second.
# - There could have been some dump caused by some previous test
# just a few milliseconds before.
# In order to avoid conflict with previous tests, read the current value
# of INNODB_BUFFER_POOL_DUMP_STATUS
# and confirm that the timestamp is different after the dump
#***********************************************************
# Read the current value to compare with the new value.
SELECT variable_value INTO @IBPDS
FROM information_schema.global_status
WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS';
SET GLOBAL innodb_buffer_pool_dump_now=ON;
# Sleep one second in order to ensure that the time stamp is
# different at next dump
--sleep 1
let $wait_condition = SELECT count(*) = 1
FROM information_schema.global_status
WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS'
AND variable_value != @IBPDS
AND variable_value like 'Buffer pool(s) dump completed at%';
--source include/wait_condition.inc
--file_exists $MYSQLD_DATADIR/ib_buffer_pool100
SET GLOBAL innodb_buffer_pool_filename=ib_buffer_pool1;
SET GLOBAL innodb_buffer_pool_dump_pct=1;
SELECT @@global.innodb_buffer_pool_dump_pct;
# Read the current value to compare with the new value.
--disable_warnings
SELECT variable_value INTO @IBPDS
FROM information_schema.global_status
WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS';
--enable_warnings
SET GLOBAL innodb_buffer_pool_dump_now=ON;
# Sleep one second in order to ensure that the time stamp is
# different at next dump
--sleep 1
let $wait_condition = SELECT count(*) = 1
FROM information_schema.global_status
WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS'
AND variable_value != @IBPDS
AND variable_value like 'Buffer pool(s) dump completed at%';
--source include/wait_condition.inc
--file_exists $MYSQLD_DATADIR/ib_buffer_pool1
perl;
my $size1 = -s "$ENV{MYSQLD_DATADIR}/ib_buffer_pool1";
my $size100 = -s "$ENV{MYSQLD_DATADIR}/ib_buffer_pool100";
die "$size100<=$size1\n" unless $size100 > $size1;
EOF
SET GLOBAL innodb_buffer_pool_dump_pct=DEFAULT;
SET GLOBAL innodb_buffer_pool_filename=DEFAULT;
--remove_file $MYSQLD_DATADIR/ib_buffer_pool100
--remove_file $MYSQLD_DATADIR/ib_buffer_pool1
DROP TABLE tab5;

View file

@ -818,8 +818,52 @@ DROP TABLE t1;
SET SQL_MODE=DEFAULT;
--echo #
--echo # Bug#56862 Moved to innodb_16k.test
--echo # Bug#56862 Execution of a query that uses index merge returns a wrong result
--echo #
CREATE TABLE t1 (
pk int NOT NULL AUTO_INCREMENT PRIMARY KEY,
a int,
b int,
INDEX idx(a))
ENGINE=INNODB;
INSERT INTO t1(a,b) VALUES
(11, 1100), (2, 200), (1, 100), (14, 1400), (5, 500),
(3, 300), (17, 1700), (4, 400), (12, 1200), (8, 800),
(6, 600), (18, 1800), (9, 900), (10, 1000), (7, 700),
(13, 1300), (15, 1500), (19, 1900), (16, 1600), (20, 2000);
INSERT INTO t1(a,b) SELECT a+20, b+2000 FROM t1;
INSERT INTO t1(a,b) SELECT a+40, b+4000 FROM t1;
INSERT INTO t1(a,b) SELECT a+80, b+8000 FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1 VALUES (1000000, 0, 0);
set @optimizer_switch_saved=@@optimizer_switch;
SET SESSION optimizer_switch='derived_merge=off';
SET SESSION sort_buffer_size = 1024*36;
EXPLAIN
SELECT COUNT(*) FROM
(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
SELECT COUNT(*) FROM
(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
set @@optimizer_switch=@optimizer_switch_saved;
SET SESSION sort_buffer_size = DEFAULT;
DROP TABLE t1;
--echo #
--echo # Test for bug #39932 "create table fails if column for FK is in different
--echo # case than in corr index".

View file

@ -0,0 +1,36 @@
--source include/have_innodb.inc
#Restarting not supported in embedded
--source include/not_embedded.inc
#Windows has trouble creating files/directories with long names
--source include/not_windows.inc
--echo #
--echo # Bug#19419026 WHEN A TABLESPACE IS NOT FOUND, DO NOT REPORT "TABLE NOT FOUND"
--echo #
#Create database and tablename with all special characters
CREATE DATABASE `..................................................`;
USE `..................................................`;
CREATE TABLE `..................................................` (ID INT)
ENGINE=INNODB;
--source include/shutdown_mysqld.inc
--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e/@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.ibd
--source include/start_mysqld.inc
--disable_query_log
call mtr.add_suppression("\\[ERROR\\] InnoDB: Operating system error number 2 in a file operation.");
call mtr.add_suppression("\\[ERROR\\] InnoDB: The error means the system cannot find the path specified.");
call mtr.add_suppression("\\[ERROR\\] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.");
call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot open datafile for read-only");
call mtr.add_suppression("\\[Warning\\] InnoDB: Ignoring tablespace .* because it could not be opened");
--enable_query_log
--error ER_GET_ERRNO
select * from `..................................................`;
DROP TABLE `..................................................`;
DROP DATABASE `..................................................`;

View file

@ -0,0 +1,52 @@
--source include/have_innodb.inc
--echo # Set the environmental variables
let MYSQLD_BASEDIR= `SELECT @@basedir`;
let MYSQLD_DATADIR= `SELECT @@datadir`;
let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
create table t1(f1 int not null)engine=innodb;
insert into t1 values(1), (2), (3);
let $resultlog=$MYSQLTEST_VARDIR/tmp/result.log;
--source include/shutdown_mysqld.inc
--echo # Change the page offset
perl;
use strict;
use warnings;
use Fcntl qw(:DEFAULT :seek);
do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl";
my $page_size = $ENV{INNODB_PAGE_SIZE};
sysopen IBD_FILE, "$ENV{MYSQLD_DATADIR}/test/t1.ibd", O_RDWR
|| die "Cannot open t1.ibd\n";
sysread(IBD_FILE, $_, 38) || die "Cannot read t1.ibd\n";
my $space = unpack("x[34]N", $_);
sysseek(IBD_FILE, $page_size * 3, SEEK_SET) || die "Cannot seek t1.ibd\n";
my $head = pack("Nx[18]", 4); # better to have a valid page number
my $body = chr(0) x ($page_size - 38 - 8);
# Calculate innodb_checksum_algorithm=crc32 for the unencrypted page.
# The following bytes are excluded:
# bytes 0..3 (the checksum is stored there)
# bytes 26..37 (encryption key version, post-encryption checksum, tablespace id)
# bytes $page_size-8..$page_size-1 (checksum, LSB of FIL_PAGE_LSN)
my $polynomial = 0x82f63b78; # CRC-32C
my $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial);
my $page= pack("N",$ck).$head.pack("NNN",1,$ck,$space).$body.pack("Nx[4]",$ck);
die unless syswrite(IBD_FILE, $page, $page_size) == $page_size;
close IBD_FILE;
EOF
--error 1
exec $INNOCHECKSUM -C crc32 -l $resultlog $MYSQLD_DATADIR/test/t1.ibd;
let SEARCH_FILE = $MYSQLTEST_VARDIR/tmp/result.log;
let SEARCH_PATTERN=page id mismatch;
--source include/search_pattern_in_file.inc
--remove_file $resultlog
--source include/start_mysqld.inc
drop table t1;

View file

@ -0,0 +1,117 @@
--source include/have_innodb.inc
--source include/have_innodb_16k.inc
SET @save_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
--echo # Bug #12429576 - Test an assertion failure on purge.
CREATE TABLE t1_purge (
A int,
B blob, C blob, D blob, E blob,
F blob, G blob, H blob,
PRIMARY KEY (B(767), C(767), D(767), E(767), A),
INDEX (A)
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t1_purge VALUES (1,
REPEAT('b', 766), REPEAT('c', 766), REPEAT('d', 766), REPEAT('e', 766),
REPEAT('f', 766), REPEAT('g', 766), REPEAT('h', 766));
CREATE TABLE t2_purge (
A int PRIMARY KEY,
B blob, C blob, D blob, E blob,
F blob, G blob, H blob, I blob,
J blob, K blob, L blob,
INDEX (B(767))) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t2_purge VALUES (1,
REPEAT('b', 766), REPEAT('c', 766), REPEAT('d', 766), REPEAT('e', 766),
REPEAT('f', 766), REPEAT('g', 766), REPEAT('h', 766), REPEAT('i', 766),
REPEAT('j', 766), REPEAT('k', 766), REPEAT('l', 766));
CREATE TABLE t3_purge (
A int,
B varchar(800), C varchar(800), D varchar(800), E varchar(800),
F varchar(800), G varchar(800), H varchar(800),
PRIMARY KEY (B(767), C(767), D(767), E(767), A),
INDEX (A)
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t3_purge SELECT * FROM t1_purge;
CREATE TABLE t4_purge (
A int PRIMARY KEY,
B varchar(800), C varchar(800), D varchar(800), E varchar(800),
F varchar(800), G varchar(800), H varchar(800), I varchar(800),
J varchar(800), K varchar(800), L varchar(800),
INDEX (B(767))) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t4_purge SELECT * FROM t2_purge;
# This would trigger the failure (Bug #12429576)
# if purge gets a chance to run before DROP TABLE t1_purge, ....
DELETE FROM t1_purge;
DELETE FROM t2_purge;
DELETE FROM t3_purge;
DELETE FROM t4_purge;
# We need to activate the purge thread before DROP TABLE.
# Bug#12637786 - Assertion hit; ut_ad(dict_index_is_clust(index));
# A secondary index tuple is found to be too long to fit into a page.
# This test is not in innodb_8k or innodb_4k since the bug is not about
# page size. It just tests the condition that caused the assertion.
SET @r=REPEAT('a',500);
CREATE TABLE t12637786(a int,
v1 varchar(500), v2 varchar(500), v3 varchar(500),
v4 varchar(500), v5 varchar(500), v6 varchar(500),
v7 varchar(500), v8 varchar(500), v9 varchar(500),
v10 varchar(500), v11 varchar(500), v12 varchar(500),
v13 varchar(500), v14 varchar(500), v15 varchar(500),
v16 varchar(500), v17 varchar(500), v18 varchar(500)
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
CREATE INDEX idx1 ON t12637786(a,v1);
INSERT INTO t12637786 VALUES(9,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
UPDATE t12637786 SET a=1000;
DELETE FROM t12637786;
# We need to activate the purge thread before DROP TABLE
# to make sure it is able to clean up the old versions.
--echo # Bug#12963823 - Test that the purge thread does not crash when
# the number of indexes has changed since the UNDO record was logged.
# This test is not in innodb_8k or innodb_4k since the bug is not about
# page size. It just tests the condition that caused the crash.
CREATE TABLE t12963823(a blob,b blob,c blob,d blob,e blob,f blob,g blob,h blob,
i blob,j blob,k blob,l blob,m blob,n blob,o blob,p blob)
ENGINE=innodb ROW_FORMAT=dynamic;
SET @r = REPEAT('a', 767);
INSERT INTO t12963823 VALUES (@r,@r,@r,@r, @r,@r,@r,@r, @r,@r,@r,@r, @r,@r,@r,@r);
CREATE INDEX ndx_a ON t12963823 (a(500));
CREATE INDEX ndx_b ON t12963823 (b(500));
CREATE INDEX ndx_c ON t12963823 (c(500));
CREATE INDEX ndx_d ON t12963823 (d(500));
CREATE INDEX ndx_e ON t12963823 (e(500));
CREATE INDEX ndx_f ON t12963823 (f(500));
CREATE INDEX ndx_k ON t12963823 (k(500));
CREATE INDEX ndx_l ON t12963823 (l(500));
SET @r = REPEAT('b', 500);
UPDATE t12963823 set a=@r,b=@r,c=@r,d=@r;
UPDATE t12963823 set e=@r,f=@r,g=@r,h=@r;
UPDATE t12963823 set i=@r,j=@r,k=@r,l=@r;
UPDATE t12963823 set m=@r,n=@r,o=@r,p=@r;
ALTER TABLE t12963823 DROP INDEX ndx_a;
ALTER TABLE t12963823 DROP INDEX ndx_b;
CREATE INDEX ndx_g ON t12963823 (g(500));
CREATE INDEX ndx_h ON t12963823 (h(500));
CREATE INDEX ndx_i ON t12963823 (i(500));
CREATE INDEX ndx_j ON t12963823 (j(500));
CREATE INDEX ndx_m ON t12963823 (m(500));
CREATE INDEX ndx_n ON t12963823 (n(500));
CREATE INDEX ndx_o ON t12963823 (o(500));
CREATE INDEX ndx_p ON t12963823 (p(500));
SHOW CREATE TABLE t12963823;
# We need to activate the purge thread before DROP TABLE.
-- source include/wait_all_purged.inc
DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge, t12637786, t12963823;
SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency;

View file

@ -15,8 +15,8 @@ let $datadir=`select @@datadir`;
--remove_file $datadir/test/t.ibd
--source include/start_mysqld.inc
--error ER_NO_SUCH_TABLE_IN_ENGINE
--error ER_GET_ERRNO
SELECT * FROM t;
--error ER_NO_SUCH_TABLE_IN_ENGINE
--error ER_GET_ERRNO
TRUNCATE TABLE t;
DROP TABLE t;

View file

@ -241,3 +241,33 @@ a
„MySQL“
DROP TABLE t1;
SET NAMES latin1;
CREATE TABLE t1 (
FTS_DOC_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
id int(10) not null ,
first_name varchar(50) NOT NULL,
last_name varchar(50) NOT NULL,
PRIMARY KEY (FTS_DOC_ID),
UNIQUE KEY idx_1 (first_name, last_name),
FULLTEXT KEY `idx_2` (first_name)
) ENGINE=InnoDB;
INSERT INTO t1 (id, first_name, last_name) VALUES
(10, 'Bart', 'Simpson'),
(11, 'Homer', 'Simpson'),
(12, 'Marge', 'Simpson'),
(13, 'Lisa', 'Simpson'),
(14, 'Maggie', 'Simpson'),
(15, 'Ned', 'Flanders'),
(16, 'Nelson', 'Muntz');
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
SELECT fts_doc_id, first_name, last_name, MATCH(first_name) AGAINST('Homer' IN BOOLEAN MODE) AS score FROM t1;
fts_doc_id first_name last_name score
1 Bart Simpson 0
2 Homer Simpson 0.7141907215118408
4 Lisa Simpson 0
5 Maggie Simpson 0
3 Marge Simpson 0
6 Ned Flanders 0
7 Nelson Muntz 0
DROP TABLE t1;

View file

@ -231,3 +231,29 @@ INSERT INTO t1 VALUES('„MySQL“');
SELECT a FROM t1 WHERE MATCH a AGAINST('“MySQL„' IN BOOLEAN MODE);
DROP TABLE t1;
SET NAMES latin1;
#
# Bug #20597981 - WRONG RELEVANCE RANKING FOR FULL TEXT SEARCHES
# WHEN FTS_DOC_ID IS PRIMARY KEY
CREATE TABLE t1 (
FTS_DOC_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
id int(10) not null ,
first_name varchar(50) NOT NULL,
last_name varchar(50) NOT NULL,
PRIMARY KEY (FTS_DOC_ID),
UNIQUE KEY idx_1 (first_name, last_name),
FULLTEXT KEY `idx_2` (first_name)
) ENGINE=InnoDB;
INSERT INTO t1 (id, first_name, last_name) VALUES
(10, 'Bart', 'Simpson'),
(11, 'Homer', 'Simpson'),
(12, 'Marge', 'Simpson'),
(13, 'Lisa', 'Simpson'),
(14, 'Maggie', 'Simpson'),
(15, 'Ned', 'Flanders'),
(16, 'Nelson', 'Muntz');
analyze table t1;
SELECT fts_doc_id, first_name, last_name, MATCH(first_name) AGAINST('Homer' IN BOOLEAN MODE) AS score FROM t1;
DROP TABLE t1;

View file

@ -1,406 +0,0 @@
SET default_storage_engine=InnoDB;
# Test 1) Show the page size from Information Schema
SELECT variable_value FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_page_size';
variable_value
4096
# Test 2) The number of buffer pool pages is dependent upon the page size.
SELECT variable_value FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
variable_value
{checked_valid}
# Test 3) Query some information_shema tables that are dependent upon
# the page size.
SELECT t.name table_name, t.n_cols, t.flag table_flags,
i.name index_name, i.page_no root_page, i.type,
i.n_fields, i.merge_threshold
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t,
INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
WHERE t.table_id = i.table_id
AND t.name LIKE 'mysql%'
ORDER BY t.name, i.index_id;
table_name n_cols table_flags index_name root_page type n_fields merge_threshold
mysql/innodb_index_stats 11 33 PRIMARY 3 3 4 50
mysql/innodb_table_stats 9 33 PRIMARY 3 3 2 50
mysql/transaction_registry 8 33 PRIMARY 3 3 1 50
mysql/transaction_registry 8 33 commit_id 4 2 1 50
mysql/transaction_registry 8 33 begin_timestamp 5 0 1 50
mysql/transaction_registry 8 33 commit_timestamp 6 0 2 50
CREATE TABLE t1 (a INT KEY, b TEXT) ROW_FORMAT=REDUNDANT ENGINE=innodb;
CREATE TABLE t2 (a INT KEY, b TEXT) ROW_FORMAT=COMPACT ENGINE=innodb;
CREATE TABLE t3 (a INT KEY, b TEXT) ROW_FORMAT=COMPRESSED ENGINE=innodb;
CREATE TABLE t4 (a INT KEY, b TEXT) ROW_FORMAT=DYNAMIC ENGINE=innodb;
SELECT t.name table_name, t.n_cols, t.flag table_flags,
i.name index_name, i.page_no root_page, i.type,
i.n_fields, i.merge_threshold
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t,
INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
WHERE t.table_id = i.table_id
AND t.name LIKE 'test%'
ORDER BY t.name, i.name;
table_name n_cols table_flags index_name root_page type n_fields merge_threshold
test/t1 5 0 PRIMARY 3 3 1 50
test/t2 5 1 PRIMARY 3 3 1 50
test/t3 5 37 PRIMARY 3 3 1 50
test/t4 5 33 PRIMARY 3 3 1 50
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path
test/t1 Single DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t1.ibd
test/t2 Single DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t2.ibd
test/t3 Single DEFAULT 2048 Compressed MYSQLD_DATADIR/test/t3.ibd
test/t4 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4.ibd
DROP TABLE t1, t2, t3, t4;
# Test 4) The maximum row size is dependent upon the page size.
# Redundant: 1979, Compact: 1982.
# Compressed: 1982, Dynamic: 1982.
# Each row format has its own amount of overhead that
# varies depending on number of fields and other overhead.
SET SESSION innodb_strict_mode = ON;
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(127)
) ROW_FORMAT=redundant;
DROP TABLE t1;
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(128)
) ROW_FORMAT=redundant;
ERROR 42000: Row size too large (> max_row_size). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(155)
) ROW_FORMAT=compact;
DROP TABLE t1;
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(156)
) ROW_FORMAT=compact;
ERROR 42000: Row size too large (> max_row_size). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(76)
) ROW_FORMAT=compressed;
DROP TABLE t1;
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(79)
) ROW_FORMAT=compressed;
ERROR 42000: Row size too large (> max_row_size). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(155)
) ROW_FORMAT=dynamic;
DROP TABLE t1;
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(156)
) ROW_FORMAT=dynamic;
ERROR 42000: Row size too large (> max_row_size). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
CREATE TABLE t1 (a varchar(64) character set utf8,
b varchar(64) character set utf8,
c varchar(64) character set utf8,
d varchar(64) character set utf8,
PRIMARY KEY (a,b,c,d))
ENGINE=innodb;
DROP TABLE t1;
CREATE TABLE t1 (a varchar(64) character set utf8,
b varchar(64) character set utf8,
c varchar(64) character set utf8,
d varchar(65) character set utf8,
PRIMARY KEY (a,b,c,d))
ENGINE=innodb;
ERROR 42000: Specified key was too long; max key length is 768 bytes
CREATE TABLE t1 (a varchar(64) character set utf8,
b varchar(64) character set utf8,
c varchar(64) character set utf8,
d varchar(64) character set utf8,
e varchar(64) character set utf8,
PRIMARY KEY (a), KEY (b,c,d,e))
ENGINE=innodb;
DROP TABLE t1;
CREATE TABLE t1 (a varchar(64) character set utf8,
b varchar(64) character set utf8,
c varchar(64) character set utf8,
d varchar(64) character set utf8,
e varchar(65) character set utf8,
PRIMARY KEY (a), KEY (b,c,d,e))
ENGINE=innodb;
ERROR 42000: Specified key was too long; max key length is 768 bytes
# Test 5) Make sure that KEY_BLOCK_SIZE=4, 2 & 1 are all
# accepted and that KEY_BLOCK_SIZE=16 & 8 are rejected
# in strict mode and converted to 4 in non-strict mode.
SET SESSION innodb_strict_mode = ON;
CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 1478 InnoDB: KEY_BLOCK_SIZE=16 cannot be larger than 4.
Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 1478 InnoDB: KEY_BLOCK_SIZE=8 cannot be larger than 4.
Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
SHOW WARNINGS;
Level Code Message
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
t1 Compressed row_format=COMPRESSED key_block_size=4
ALTER TABLE t1 KEY_BLOCK_SIZE=2;
SHOW WARNINGS;
Level Code Message
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
t1 Compressed row_format=COMPRESSED key_block_size=2
ALTER TABLE t1 KEY_BLOCK_SIZE=1;
SHOW WARNINGS;
Level Code Message
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
t1 Compressed row_format=COMPRESSED key_block_size=1
ALTER TABLE t1 KEY_BLOCK_SIZE=0;
SHOW WARNINGS;
Level Code Message
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
t1 Compressed row_format=COMPRESSED
DROP TABLE t1;
SET SESSION innodb_strict_mode = OFF;
CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
Warnings:
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16.
SHOW WARNINGS;
Level Code Message
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16.
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
t1 Compressed row_format=COMPRESSED key_block_size=16
DROP TABLE t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
Warnings:
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8.
SHOW WARNINGS;
Level Code Message
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8.
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
t1 Compressed row_format=COMPRESSED key_block_size=8
DROP TABLE t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
SHOW WARNINGS;
Level Code Message
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
t1 Compressed row_format=COMPRESSED key_block_size=4
ALTER TABLE t1 KEY_BLOCK_SIZE=2;
SHOW WARNINGS;
Level Code Message
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
t1 Compressed row_format=COMPRESSED key_block_size=2
ALTER TABLE t1 KEY_BLOCK_SIZE=1;
SHOW WARNINGS;
Level Code Message
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
t1 Compressed row_format=COMPRESSED key_block_size=1
ALTER TABLE t1 KEY_BLOCK_SIZE=0;
SHOW WARNINGS;
Level Code Message
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
t1 Compressed row_format=COMPRESSED
DROP TABLE t1;
# Test 6) Make sure that KEY_BLOCK_SIZE = 8 and 16
# are both rejected when innodb_file_per_table=OFF
SET SESSION innodb_strict_mode = ON;
SET GLOBAL innodb_file_per_table = OFF;
SHOW VARIABLES LIKE 'innodb_file_per_table';
Variable_name Value
innodb_file_per_table OFF
CREATE TABLE t4 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=8;
ERROR HY000: Can't create table `test`.`t4` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 1478 InnoDB: KEY_BLOCK_SIZE=8 cannot be larger than 4.
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
Error 1005 Can't create table `test`.`t4` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
CREATE TABLE t5 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=16;
ERROR HY000: Can't create table `test`.`t5` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 1478 InnoDB: KEY_BLOCK_SIZE=16 cannot be larger than 4.
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
Error 1005 Can't create table `test`.`t5` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
SET GLOBAL innodb_file_per_table = ON;
# Test 7) Not included here; 16k only
# Test 8) Test creating a table that could lead to undo log overflow.
CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,
h blob,i blob,j blob,k blob,l blob,m blob,n blob,
o blob,p blob,q blob,r blob,s blob,t blob,u blob)
ENGINE=InnoDB ROW_FORMAT=dynamic;
SET @a = repeat('a', 767);
SET @b = repeat('b', 767);
SET @c = repeat('c', 767);
SET @d = repeat('d', 767);
SET @e = repeat('e', 767);
INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a);
UPDATE t1 SET a=@b,b=@b,c=@b,d=@b,e=@b,f=@b,g=@b,h=@b,i=@b,j=@b,
k=@b,l=@b,m=@b,n=@b,o=@b,p=@b,q=@b,r=@b,s=@b,t=@b,u=@b;
CREATE INDEX t1a ON t1 (a(767));
UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c,
k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c;
CREATE INDEX t1b ON t1 (b(767));
BEGIN;
UPDATE t1 SET a=@d,b=@d,c=@d,d=@d,e=@d,f=@d,g=@d,h=@d,i=@d,j=@d,
k=@d,l=@d,m=@d,n=@d,o=@d,p=@d,q=@d,r=@d,s=@d,t=@d,u=@d;
ROLLBACK;
BEGIN;
UPDATE t1 SET a=@d,b=@d,c=@d,d=@d,e=@d;
UPDATE t1 SET f=@d,g=@d,h=@d,i=@d,j=@d,k=@d,l=@d,m=@d,
n=@d,o=@d,p=@d,q=@d,r=@d,s=@d,t=@d,u=@d;
COMMIT;
CREATE INDEX t1c ON t1 (c(767));
UPDATE t1 SET c=@e;
CREATE INDEX t1d ON t1 (d(767));
BEGIN;
UPDATE t1 SET d=@e;
ROLLBACK;
CREATE INDEX t1e ON t1 (e(767));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` blob DEFAULT NULL,
`b` blob DEFAULT NULL,
`c` blob DEFAULT NULL,
`d` blob DEFAULT NULL,
`e` blob DEFAULT NULL,
`f` blob DEFAULT NULL,
`g` blob DEFAULT NULL,
`h` blob DEFAULT NULL,
`i` blob DEFAULT NULL,
`j` blob DEFAULT NULL,
`k` blob DEFAULT NULL,
`l` blob DEFAULT NULL,
`m` blob DEFAULT NULL,
`n` blob DEFAULT NULL,
`o` blob DEFAULT NULL,
`p` blob DEFAULT NULL,
`q` blob DEFAULT NULL,
`r` blob DEFAULT NULL,
`s` blob DEFAULT NULL,
`t` blob DEFAULT NULL,
`u` blob DEFAULT NULL,
KEY `t1a` (`a`(767)),
KEY `t1b` (`b`(767)),
KEY `t1c` (`c`(767)),
KEY `t1d` (`d`(767)),
KEY `t1e` (`e`(767))
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
DROP TABLE t1;
SET SESSION innodb_strict_mode = OFF;
CREATE TABLE t1(
pk01 varchar(48), pk02 varchar(48), pk03 varchar(48), pk04 varchar(48),
pk05 varchar(48), pk06 varchar(48), pk07 varchar(48), pk08 varchar(48),
pk09 varchar(48), pk10 varchar(48), pk11 varchar(48), pk12 varchar(48),
pk13 varchar(48), pk14 varchar(48), pk15 varchar(48), pk16 varchar(48),
sk01 varchar(48), sk02 varchar(48), sk03 varchar(48), sk04 varchar(48),
sk05 varchar(48), sk06 varchar(48), sk07 varchar(48), sk08 varchar(48),
sk09 varchar(48), sk10 varchar(48), sk11 varchar(48), sk12 varchar(48),
sk13 varchar(48), sk14 varchar(48), sk15 varchar(48), sk16 varchar(48),
PRIMARY KEY pk(pk01,pk02,pk03,pk04,pk05,pk06,pk07,pk08,
pk09,pk10,pk11,pk12,pk13,pk14,pk15,pk16),
KEY pk(sk01,sk02,sk03,sk04,sk05,sk06,sk07,sk08,
sk09,sk10,sk11,sk12,sk13,sk14,sk15,sk16))
ROW_FORMAT=Redundant ENGINE=InnoDB;
SET @r = repeat('a', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('b', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('c', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('d', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('e', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
DELETE from t1;
DROP TABLE t1;
CREATE TABLE t1(
pk01 varchar(48), pk02 varchar(48), pk03 varchar(48), pk04 varchar(48),
pk05 varchar(48), pk06 varchar(48), pk07 varchar(48), pk08 varchar(48),
pk09 varchar(48), pk10 varchar(48), pk11 varchar(48), pk12 varchar(48),
pk13 varchar(48), pk14 varchar(48), pk15 varchar(48), pk16 varchar(48),
sk01 varchar(48), sk02 varchar(48), sk03 varchar(48), sk04 varchar(48),
sk05 varchar(48), sk06 varchar(48), sk07 varchar(48), sk08 varchar(48),
sk09 varchar(48), sk10 varchar(48), sk11 varchar(48), sk12 varchar(48),
sk13 varchar(48), sk14 varchar(48), sk15 varchar(48), sk16 varchar(48),
PRIMARY KEY pk(pk01,pk02,pk03,pk04,pk05,pk06,pk07,pk08,
pk09,pk10,pk11,pk12,pk13,pk14,pk15,pk16),
KEY pk(sk01,sk02,sk03,sk04,sk05,sk06,sk07,sk08,
sk09,sk10,sk11,sk12,sk13,sk14,sk15,sk16))
ROW_FORMAT=Compressed KEY_BLOCK_SIZE=4 ENGINE=InnoDB;
SET @r = repeat('a', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('b', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('c', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('d', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('e', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
DELETE from t1;
DROP TABLE t1;
SET SESSION innodb_strict_mode = off;
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
Warnings:
Warning 139 Row size too large (> max_row_size). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
DROP TABLE t1;
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII;
drop table t1;
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII;
drop table t1;
CREATE TABLE t1(c text, PRIMARY KEY (c(440)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
Warnings:
Warning 139 Row size too large (> max_row_size). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
DROP TABLE t1;
CREATE TABLE t1(c text, PRIMARY KEY (c(438)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
DROP TABLE t1;

View file

@ -1,437 +0,0 @@
SET default_storage_engine=InnoDB;
# Test 1) Show the page size from Information Schema
SELECT variable_value FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_page_size';
variable_value
8192
# Test 2) The number of buffer pool pages is dependent upon the page size.
SELECT variable_value FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
variable_value
{checked_valid}
# Test 3) Query some information_shema tables that are dependent upon
# the page size.
SELECT t.name table_name, t.n_cols, t.flag table_flags,
i.name index_name, i.page_no root_page, i.type,
i.n_fields, i.merge_threshold
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t,
INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
WHERE t.table_id = i.table_id
AND t.name LIKE 'mysql%'
ORDER BY t.name, i.index_id;
table_name n_cols table_flags index_name root_page type n_fields merge_threshold
mysql/innodb_index_stats 11 33 PRIMARY 3 3 4 50
mysql/innodb_table_stats 9 33 PRIMARY 3 3 2 50
mysql/transaction_registry 8 33 PRIMARY 3 3 1 50
mysql/transaction_registry 8 33 commit_id 4 2 1 50
mysql/transaction_registry 8 33 begin_timestamp 5 0 1 50
mysql/transaction_registry 8 33 commit_timestamp 6 0 2 50
CREATE TABLE t1 (a INT KEY, b TEXT) ROW_FORMAT=REDUNDANT ENGINE=innodb;
CREATE TABLE t2 (a INT KEY, b TEXT) ROW_FORMAT=COMPACT ENGINE=innodb;
CREATE TABLE t3 (a INT KEY, b TEXT) ROW_FORMAT=COMPRESSED ENGINE=innodb;
CREATE TABLE t4 (a INT KEY, b TEXT) ROW_FORMAT=DYNAMIC ENGINE=innodb;
SELECT t.name table_name, t.n_cols, t.flag table_flags,
i.name index_name, i.page_no root_page, i.type,
i.n_fields, i.merge_threshold
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t,
INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
WHERE t.table_id = i.table_id
AND t.name LIKE 'test%'
ORDER BY t.name, i.name;
table_name n_cols table_flags index_name root_page type n_fields merge_threshold
test/t1 5 0 PRIMARY 3 3 1 50
test/t2 5 1 PRIMARY 3 3 1 50
test/t3 5 39 PRIMARY 3 3 1 50
test/t4 5 33 PRIMARY 3 3 1 50
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path
test/t1 Single DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t1.ibd
test/t2 Single DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t2.ibd
test/t3 Single DEFAULT 4096 Compressed MYSQLD_DATADIR/test/t3.ibd
test/t4 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4.ibd
DROP TABLE t1, t2, t3, t4;
# Test 4) The maximum row size is dependent upon the page size.
# Redundant: 4027, Compact: 4030.
# Compressed: 4030, Dynamic: 4030.
# Each row format has its own amount of overhead that
# varies depending on number of fields and other overhead.
SET SESSION innodb_strict_mode = ON;
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(155)
) ROW_FORMAT=redundant;
DROP TABLE t1;
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(156)
) ROW_FORMAT=redundant;
ERROR 42000: Row size too large (> max_row_size). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(202)
) ROW_FORMAT=compact;
DROP TABLE t1;
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(203)
) ROW_FORMAT=compact;
ERROR 42000: Row size too large (> max_row_size). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(103)
) ROW_FORMAT=compressed;
DROP TABLE t1;
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(106)
) ROW_FORMAT=compressed;
ERROR 42000: Row size too large (> max_row_size). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(202)
) ROW_FORMAT=dynamic;
DROP TABLE t1;
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(203)
) ROW_FORMAT=dynamic;
ERROR 42000: Row size too large (> max_row_size). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
CREATE TABLE t1 (a varchar(128) character set utf8,
b varchar(128) character set utf8,
c varchar(128) character set utf8,
d varchar(128) character set utf8,
PRIMARY KEY (a,b,c,d))
ENGINE=innodb;
DROP TABLE t1;
CREATE TABLE t1 (a varchar(128) character set utf8,
b varchar(128) character set utf8,
c varchar(128) character set utf8,
d varchar(129) character set utf8,
PRIMARY KEY (a,b,c,d))
ENGINE=innodb;
ERROR 42000: Specified key was too long; max key length is 1536 bytes
CREATE TABLE t1 (a varchar(128) character set utf8,
b varchar(128) character set utf8,
c varchar(128) character set utf8,
d varchar(128) character set utf8,
e varchar(128) character set utf8,
PRIMARY KEY (a), KEY (b,c,d,e))
ENGINE=innodb;
DROP TABLE t1;
CREATE TABLE t1 (a varchar(128) character set utf8,
b varchar(128) character set utf8,
c varchar(128) character set utf8,
d varchar(128) character set utf8,
e varchar(129) character set utf8,
PRIMARY KEY (a), KEY (b,c,d,e))
ENGINE=innodb;
ERROR 42000: Specified key was too long; max key length is 1536 bytes
# Test 5) Make sure that KEY_BLOCK_SIZE=8, 4, 2 & 1 are all
# accepted and that KEY_BLOCK_SIZE=16 is rejected in
# strict mode and converted to 8 in non-strict mode.
SET SESSION innodb_strict_mode = ON;
CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 1478 InnoDB: KEY_BLOCK_SIZE=16 cannot be larger than 8.
Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
SHOW WARNINGS;
Level Code Message
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
t1 Compressed row_format=COMPRESSED key_block_size=8
ALTER TABLE t1 KEY_BLOCK_SIZE=4;
SHOW WARNINGS;
Level Code Message
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
t1 Compressed row_format=COMPRESSED key_block_size=4
ALTER TABLE t1 KEY_BLOCK_SIZE=2;
SHOW WARNINGS;
Level Code Message
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
t1 Compressed row_format=COMPRESSED key_block_size=2
ALTER TABLE t1 KEY_BLOCK_SIZE=1;
SHOW WARNINGS;
Level Code Message
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
t1 Compressed row_format=COMPRESSED key_block_size=1
ALTER TABLE t1 KEY_BLOCK_SIZE=0;
SHOW WARNINGS;
Level Code Message
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
t1 Compressed row_format=COMPRESSED
DROP TABLE t1;
SET SESSION innodb_strict_mode = OFF;
CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
Warnings:
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16.
SHOW WARNINGS;
Level Code Message
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16.
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
t1 Compressed row_format=COMPRESSED key_block_size=16
DROP TABLE t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
SHOW WARNINGS;
Level Code Message
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
t1 Compressed row_format=COMPRESSED key_block_size=8
DROP TABLE t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
SHOW WARNINGS;
Level Code Message
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
t1 Compressed row_format=COMPRESSED key_block_size=4
ALTER TABLE t1 KEY_BLOCK_SIZE=2;
SHOW WARNINGS;
Level Code Message
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
t1 Compressed row_format=COMPRESSED key_block_size=2
ALTER TABLE t1 KEY_BLOCK_SIZE=1;
SHOW WARNINGS;
Level Code Message
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
t1 Compressed row_format=COMPRESSED key_block_size=1
ALTER TABLE t1 KEY_BLOCK_SIZE=0;
SHOW WARNINGS;
Level Code Message
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
t1 Compressed row_format=COMPRESSED
DROP TABLE t1;
# Test 6) Make sure that KEY_BLOCK_SIZE = 8 and 16
# are rejected when innodb_file_per_table=OFF
SET SESSION innodb_strict_mode = ON;
SET GLOBAL innodb_file_per_table = OFF;
SHOW VARIABLES LIKE 'innodb_file_per_table';
Variable_name Value
innodb_file_per_table OFF
CREATE TABLE t4 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=8;
ERROR HY000: Can't create table `test`.`t4` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
Error 1005 Can't create table `test`.`t4` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
CREATE TABLE t5 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=16;
ERROR HY000: Can't create table `test`.`t5` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 1478 InnoDB: KEY_BLOCK_SIZE=16 cannot be larger than 8.
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
Error 1005 Can't create table `test`.`t5` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
SET GLOBAL innodb_file_per_table = ON;
# Test 7) Not included here; 16k only
# Test 8) Test creating a table that could lead to undo log overflow.
CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,
h blob,i blob,j blob,k blob,l blob,m blob,n blob,
o blob,p blob,q blob,r blob,s blob,t blob,u blob)
ENGINE=InnoDB ROW_FORMAT=dynamic;
SET @a = repeat('a', 767);
SET @b = repeat('b', 767);
SET @c = repeat('c', 767);
SET @d = repeat('d', 767);
SET @e = repeat('e', 767);
INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a);
UPDATE t1 SET a=@b,b=@b,c=@b,d=@b,e=@b,f=@b,g=@b,h=@b,i=@b,j=@b,
k=@b,l=@b,m=@b,n=@b,o=@b,p=@b,q=@b,r=@b,s=@b,t=@b,u=@b;
CREATE INDEX t1a ON t1 (a(767));
CREATE INDEX t1b ON t1 (b(767));
UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c,
k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c;
CREATE INDEX t1c ON t1 (c(767));
BEGIN;
UPDATE t1 SET a=@d,b=@d,c=@d,d=@d,e=@d,f=@d,g=@d,h=@d,i=@d,j=@d,
k=@d,l=@d,m=@d,n=@d,o=@d,p=@d,q=@d,r=@d,s=@d,t=@d,u=@d;
ROLLBACK;
BEGIN;
UPDATE t1 SET a=@d,b=@d,c=@d,d=@d,e=@d;
UPDATE t1 SET f=@d,g=@d,h=@d,i=@d,j=@d,k=@d,l=@d,m=@d,
n=@d,o=@d,p=@d,q=@d,r=@d,s=@d,t=@d,u=@d;
COMMIT;
CREATE INDEX t1d ON t1 (d(767));
UPDATE t1 SET d=@e;
CREATE INDEX t1e ON t1 (e(767));
UPDATE t1 SET e=@e;
CREATE INDEX t1f ON t1 (f(767));
UPDATE t1 SET f=@e;
CREATE INDEX t1g ON t1 (g(767));
UPDATE t1 SET g=@e;
CREATE INDEX t1h ON t1 (h(767));
UPDATE t1 SET h=@e;
CREATE INDEX t1i ON t1 (i(767));
UPDATE t1 SET i=@e;
CREATE INDEX t1k ON t1 (j(767));
CREATE INDEX t1j ON t1 (j(500));
BEGIN;
UPDATE t1 SET j=@e;
ROLLBACK;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` blob DEFAULT NULL,
`b` blob DEFAULT NULL,
`c` blob DEFAULT NULL,
`d` blob DEFAULT NULL,
`e` blob DEFAULT NULL,
`f` blob DEFAULT NULL,
`g` blob DEFAULT NULL,
`h` blob DEFAULT NULL,
`i` blob DEFAULT NULL,
`j` blob DEFAULT NULL,
`k` blob DEFAULT NULL,
`l` blob DEFAULT NULL,
`m` blob DEFAULT NULL,
`n` blob DEFAULT NULL,
`o` blob DEFAULT NULL,
`p` blob DEFAULT NULL,
`q` blob DEFAULT NULL,
`r` blob DEFAULT NULL,
`s` blob DEFAULT NULL,
`t` blob DEFAULT NULL,
`u` blob DEFAULT NULL,
KEY `t1a` (`a`(767)),
KEY `t1b` (`b`(767)),
KEY `t1c` (`c`(767)),
KEY `t1d` (`d`(767)),
KEY `t1e` (`e`(767)),
KEY `t1f` (`f`(767)),
KEY `t1g` (`g`(767)),
KEY `t1h` (`h`(767)),
KEY `t1i` (`i`(767)),
KEY `t1k` (`j`(767)),
KEY `t1j` (`j`(500))
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
DROP TABLE t1;
SET SESSION innodb_strict_mode = OFF;
CREATE TABLE t1(
pk01 varchar(96), pk02 varchar(96), pk03 varchar(96), pk04 varchar(96),
pk05 varchar(96), pk06 varchar(96), pk07 varchar(96), pk08 varchar(96),
pk09 varchar(96), pk10 varchar(96), pk11 varchar(96), pk12 varchar(96),
pk13 varchar(96), pk14 varchar(96), pk15 varchar(96), pk16 varchar(96),
sk01 varchar(96), sk02 varchar(96), sk03 varchar(96), sk04 varchar(96),
sk05 varchar(96), sk06 varchar(96), sk07 varchar(96), sk08 varchar(96),
sk09 varchar(96), sk10 varchar(96), sk11 varchar(96), sk12 varchar(96),
sk13 varchar(96), sk14 varchar(96), sk15 varchar(96), sk16 varchar(96),
PRIMARY KEY pk(pk01,pk02,pk03,pk04,pk05,pk06,pk07,pk08,
pk09,pk10,pk11,pk12,pk13,pk14,pk15,pk16),
KEY pk(sk01,sk02,sk03,sk04,sk05,sk06,sk07,sk08,
sk09,sk10,sk11,sk12,sk13,sk14,sk15,sk16))
ROW_FORMAT=Redundant ENGINE=InnoDB;
SET @r = repeat('a', 96);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('b', 96);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('c', 96);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('d', 96);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('e', 96);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
DELETE from t1;
DROP TABLE t1;
CREATE TABLE t1(
pk01 varchar(96), pk02 varchar(96), pk03 varchar(96), pk04 varchar(96),
pk05 varchar(96), pk06 varchar(96), pk07 varchar(96), pk08 varchar(96),
pk09 varchar(96), pk10 varchar(96), pk11 varchar(96), pk12 varchar(96),
pk13 varchar(96), pk14 varchar(96), pk15 varchar(96), pk16 varchar(96),
sk01 varchar(96), sk02 varchar(96), sk03 varchar(96), sk04 varchar(96),
sk05 varchar(96), sk06 varchar(96), sk07 varchar(96), sk08 varchar(96),
sk09 varchar(96), sk10 varchar(96), sk11 varchar(96), sk12 varchar(96),
sk13 varchar(96), sk14 varchar(96), sk15 varchar(96), sk16 varchar(96),
PRIMARY KEY pk(pk01,pk02,pk03,pk04,pk05,pk06,pk07,pk08,
pk09,pk10,pk11,pk12,pk13,pk14,pk15,pk16),
KEY pk(sk01,sk02,sk03,sk04,sk05,sk06,sk07,sk08,
sk09,sk10,sk11,sk12,sk13,sk14,sk15,sk16))
ROW_FORMAT=Compressed KEY_BLOCK_SIZE=8 ENGINE=InnoDB;
SET @r = repeat('a', 96);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('b', 96);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('c', 96);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('d', 96);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('e', 96);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
DELETE from t1;
DROP TABLE t1;
SET SESSION innodb_strict_mode = off;
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
Warnings:
Warning 139 Row size too large (> max_row_size). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
DROP TABLE t1;
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII;
Warnings:
Warning 139 Row size too large (> max_row_size). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
DROP TABLE t1;
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII;
drop table t1;
CREATE TABLE t1(c text, PRIMARY KEY (c(440)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
Warnings:
Warning 139 Row size too large (> max_row_size). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
DROP TABLE t1;
CREATE TABLE t1(c text, PRIMARY KEY (c(438)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
DROP TABLE t1;

View file

@ -0,0 +1,469 @@
--- page_size.result
+++ page_size,4k.result
@@ -3,7 +3,7 @@
SELECT variable_value FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_page_size';
variable_value
-16384
+4096
# Test 3) Query some information_shema tables that are dependent upon
# the page size.
SELECT t.name table_name, t.n_cols, t.flag table_flags,
@@ -36,13 +36,13 @@
table_name n_cols table_flags index_name root_page type n_fields merge_threshold
test/t1 5 0 PRIMARY 3 3 1 50
test/t2 5 1 PRIMARY 3 3 1 50
-test/t3 5 41 PRIMARY 3 3 1 50
+test/t3 5 37 PRIMARY 3 3 1 50
test/t4 5 33 PRIMARY 3 3 1 50
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path
test/t1 Single DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t1.ibd
test/t2 Single DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t2.ibd
-test/t3 Single DEFAULT 8192 Compressed MYSQLD_DATADIR/test/t3.ibd
+test/t3 Single DEFAULT 2048 Compressed MYSQLD_DATADIR/test/t3.ibd
test/t4 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4.ibd
DROP TABLE t1, t2, t3, t4;
# Test 4) The maximum row size is dependent upon the page size.
@@ -51,141 +51,90 @@
SET SESSION innodb_strict_mode = ON;
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
-c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
-c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
-c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200),
-c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200),
-c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200),
-c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200),
-c36 char(200), c37 char(200), c38 char(200), c39 char(200), c40 char(211)
+c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(127)
) ROW_FORMAT=redundant;
DROP TABLE t1;
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
-c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
-c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
-c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200),
-c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200),
-c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200),
-c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200),
-c36 char(200), c37 char(200), c38 char(200), c39 char(200), c40 char(212)
+c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(128)
) ROW_FORMAT=redundant;
-ERROR 42000: Row size too large (> 8123). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
+ERROR 42000: Row size too large (> max_row_size). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
-c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
-c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
-c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200),
-c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200),
-c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200),
-c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200),
-c36 char(200), c37 char(200), c38 char(200), c39 char(250), c40 char(246)
+c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(155)
) ROW_FORMAT=compact;
DROP TABLE t1;
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
-c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
-c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
-c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200),
-c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200),
-c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200),
-c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200),
-c36 char(200), c37 char(200), c38 char(200), c39 char(250), c40 char(247)
+c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(156)
) ROW_FORMAT=compact;
-ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
+ERROR 42000: Row size too large (> max_row_size). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
-c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
-c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
-c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200),
-c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200),
-c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200),
-c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200),
-c36 char(200), c37 char(200), c38 char(200), c39 char(200), c40 char(157)
+c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(76)
) ROW_FORMAT=compressed;
DROP TABLE t1;
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
-c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
-c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
-c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200),
-c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200),
-c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200),
-c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200),
-c36 char(200), c37 char(200), c38 char(200), c39 char(200), c40 char(160)
+c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(79)
) ROW_FORMAT=compressed;
-ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
+ERROR 42000: Row size too large (> max_row_size). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
-c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
-c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
-c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200),
-c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200),
-c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200),
-c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200),
-c36 char(200), c37 char(200), c38 char(200), c39 char(250), c40 char(246)
+c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(155)
) ROW_FORMAT=dynamic;
DROP TABLE t1;
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
-c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
-c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
-c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200),
-c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200),
-c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200),
-c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200),
-c36 char(200), c37 char(200), c38 char(200), c39 char(250), c40 char(247)
+c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(156)
) ROW_FORMAT=dynamic;
-ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
-CREATE TABLE t1 (a varchar(255) character set utf8,
-b varchar(255) character set utf8,
-c varchar(255) character set utf8,
-d varchar(255) character set utf8,
-e varchar(4) character set utf8,
-PRIMARY KEY (a,b,c,d,e))
+ERROR 42000: Row size too large (> max_row_size). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
+CREATE TABLE t1 (a varchar(98) character set utf8,
+b varchar(98) character set utf8,
+c varchar(98) character set utf8,
+d varchar(97) character set utf8,
+PRIMARY KEY (a,b,c,d))
ENGINE=innodb;
DROP TABLE t1;
-CREATE TABLE t1 (a varchar(255) character set utf8,
-b varchar(255) character set utf8,
-c varchar(255) character set utf8,
-d varchar(255) character set utf8,
-e varchar(5) character set utf8,
-PRIMARY KEY (a,b,c,d,e))
+CREATE TABLE t1 (a varchar(98) character set utf8,
+b varchar(98) character set utf8,
+c varchar(98) character set utf8,
+d varchar(98) character set utf8,
+PRIMARY KEY (a,b,c,d))
ENGINE=innodb;
-ERROR 42000: Specified key was too long; max key length is 3072 bytes
-CREATE TABLE t1 (a varchar(255) character set utf8,
-b varchar(255) character set utf8,
-c varchar(255) character set utf8,
-d varchar(255) character set utf8,
-e varchar(255) character set utf8,
-f varchar(4) character set utf8,
-PRIMARY KEY (a), KEY (b,c,d,e,f))
+ERROR 42000: Specified key was too long; max key length is 1173 bytes
+CREATE TABLE t1 (a varchar(98) character set utf8,
+b varchar(98) character set utf8,
+c varchar(98) character set utf8,
+d varchar(98) character set utf8,
+e varchar(97) character set utf8,
+PRIMARY KEY (a), KEY (b,c,d,e))
ENGINE=innodb;
DROP TABLE t1;
-CREATE TABLE t1 (a varchar(255) character set utf8,
-b varchar(255) character set utf8,
-c varchar(255) character set utf8,
-d varchar(255) character set utf8,
-e varchar(255) character set utf8,
-f varchar(5) character set utf8,
-PRIMARY KEY (a), KEY (b,c,d,e,f))
+CREATE TABLE t1 (a varchar(98) character set utf8,
+b varchar(98) character set utf8,
+c varchar(98) character set utf8,
+d varchar(98) character set utf8,
+e varchar(98) character set utf8,
+PRIMARY KEY (a), KEY (b,c,d,e))
ENGINE=innodb;
-ERROR 42000: Specified key was too long; max key length is 3072 bytes
+ERROR 42000: Specified key was too long; max key length is 1173 bytes
# Test 5) KEY_BLOCK_SIZE validation
CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
+ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
-SELECT table_name, row_format, create_options
-FROM information_schema.tables WHERE table_name = 't1';
-table_name row_format create_options
-t1 Compressed row_format=COMPRESSED key_block_size=16
-ALTER TABLE t1 KEY_BLOCK_SIZE=8;
+Warning 1478 InnoDB: KEY_BLOCK_SIZE=16 cannot be larger than 4.
+Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
+Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
+ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
-SELECT table_name, row_format, create_options
-FROM information_schema.tables WHERE table_name = 't1';
-table_name row_format create_options
-t1 Compressed row_format=COMPRESSED key_block_size=8
+Warning 1478 InnoDB: KEY_BLOCK_SIZE=8 cannot be larger than 4.
+Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
+Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 KEY_BLOCK_SIZE=4;
SHOW WARNINGS;
Level Code Message
@@ -217,15 +166,21 @@
DROP TABLE t1;
SET SESSION innodb_strict_mode = OFF;
CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
+Warnings:
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16.
SHOW WARNINGS;
Level Code Message
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16.
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
t1 Compressed row_format=COMPRESSED key_block_size=16
ALTER TABLE t1 KEY_BLOCK_SIZE=8;
+Warnings:
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8.
SHOW WARNINGS;
Level Code Message
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8.
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
@@ -269,6 +224,7 @@
ERROR HY000: Can't create table `test`.`t4` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE=8 cannot be larger than 4.
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
Error 1005 Can't create table `test`.`t4` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
@@ -276,105 +232,11 @@
ERROR HY000: Can't create table `test`.`t5` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE=16 cannot be larger than 4.
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
Error 1005 Can't create table `test`.`t5` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
SET GLOBAL innodb_file_per_table = ON;
-# Test 7) This series of tests were moved from innodb-index to here
-# because the second alter table t1 assumes a 16k page size.
-# Moving the test allows the rest of innodb-index to be run on all
-# page sizes. The previously disabled portions of this test were
-# moved as well.
-CREATE TABLE t2(d varchar(17) PRIMARY KEY) ENGINE=innodb DEFAULT CHARSET=utf8;
-CREATE TABLE t3(a int PRIMARY KEY) ENGINE=innodb;
-INSERT INTO t3 VALUES (22),(44),(33),(55),(66);
-INSERT INTO t2 VALUES ('jejdkrun87'),('adfd72nh9k'),
-('adfdpplkeock'),('adfdijnmnb78k'),('adfdijn0loKNHJik');
-CREATE TABLE t1(a int, b blob, c text, d text NOT NULL)
-ENGINE=innodb DEFAULT CHARSET=utf8 STATS_PERSISTENT=0;
-INSERT INTO t1
-SELECT a,LEFT(REPEAT(d,100*a),65535),REPEAT(d,20*a),d FROM t2,t3 order by a, d;
-DROP TABLE t2, t3;
-SELECT COUNT(*) FROM t1 WHERE a=44;
-COUNT(*)
-5
-SELECT a,
-LENGTH(b),b=LEFT(REPEAT(d,100*a),65535),LENGTH(c),c=REPEAT(d,20*a),d FROM t1
-ORDER BY 1, 2, 3, 4, 5, 6;
-a LENGTH(b) b=LEFT(REPEAT(d,100*a),65535) LENGTH(c) c=REPEAT(d,20*a) d
-22 22000 1 4400 1 adfd72nh9k
-22 22000 1 4400 1 jejdkrun87
-22 26400 1 5280 1 adfdpplkeock
-22 28600 1 5720 1 adfdijnmnb78k
-22 35200 1 7040 1 adfdijn0loKNHJik
-33 33000 1 6600 1 adfd72nh9k
-33 33000 1 6600 1 jejdkrun87
-33 39600 1 7920 1 adfdpplkeock
-33 42900 1 8580 1 adfdijnmnb78k
-33 52800 1 10560 1 adfdijn0loKNHJik
-44 44000 1 8800 1 adfd72nh9k
-44 44000 1 8800 1 jejdkrun87
-44 52800 1 10560 1 adfdpplkeock
-44 57200 1 11440 1 adfdijnmnb78k
-44 65535 1 14080 1 adfdijn0loKNHJik
-55 55000 1 11000 1 adfd72nh9k
-55 55000 1 11000 1 jejdkrun87
-55 65535 1 13200 1 adfdpplkeock
-55 65535 1 14300 1 adfdijnmnb78k
-55 65535 1 17600 1 adfdijn0loKNHJik
-66 65535 1 13200 1 adfd72nh9k
-66 65535 1 13200 1 jejdkrun87
-66 65535 1 15840 1 adfdpplkeock
-66 65535 1 17160 1 adfdijnmnb78k
-66 65535 1 21120 1 adfdijn0loKNHJik
-ALTER TABLE t1 ADD PRIMARY KEY (a), ADD KEY (b(20));
-ERROR 23000: Duplicate entry '22' for key 'PRIMARY'
-DELETE FROM t1 WHERE d='null';
-ALTER TABLE t1 ADD PRIMARY KEY (a), ADD KEY (b(20));
-ERROR 23000: Duplicate entry '22' for key 'PRIMARY'
-DELETE FROM t1 WHERE a%2;
-CHECK TABLE t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-ALTER TABLE t1 ADD PRIMARY KEY (a,b(255),c(255)), ADD KEY (b(767));
-SELECT COUNT(*) FROM t1 WHERE a=44;
-COUNT(*)
-5
-SELECT a,
-LENGTH(b), b=LEFT(REPEAT(d,100*a), 65535),LENGTH(c), c=REPEAT(d,20*a), d FROM t1;
-a LENGTH(b) b=LEFT(REPEAT(d,100*a), 65535) LENGTH(c) c=REPEAT(d,20*a) d
-22 22000 1 4400 1 adfd72nh9k
-22 35200 1 7040 1 adfdijn0loKNHJik
-22 28600 1 5720 1 adfdijnmnb78k
-22 26400 1 5280 1 adfdpplkeock
-22 22000 1 4400 1 jejdkrun87
-44 44000 1 8800 1 adfd72nh9k
-44 65535 1 14080 1 adfdijn0loKNHJik
-44 57200 1 11440 1 adfdijnmnb78k
-44 52800 1 10560 1 adfdpplkeock
-44 44000 1 8800 1 jejdkrun87
-66 65535 1 13200 1 adfd72nh9k
-66 65535 1 21120 1 adfdijn0loKNHJik
-66 65535 1 17160 1 adfdijnmnb78k
-66 65535 1 15840 1 adfdpplkeock
-66 65535 1 13200 1 jejdkrun87
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` blob NOT NULL,
- `c` text NOT NULL,
- `d` text NOT NULL,
- PRIMARY KEY (`a`,`b`(255),`c`(255)),
- KEY `b` (`b`(767))
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0
-CHECK TABLE t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-EXPLAIN SELECT * FROM t1 WHERE b LIKE 'adfd%';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range b b 769 NULL 12 Using where
-DROP TABLE t1;
# Test 8) Test creating a table that could lead to undo log overflow.
CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,
h blob,i blob,j blob,k blob,l blob,m blob,n blob,
@@ -389,10 +251,6 @@
UPDATE t1 SET a=@b,b=@b,c=@b,d=@b,e=@b,f=@b,g=@b,h=@b,i=@b,j=@b,
k=@b,l=@b,m=@b,n=@b,o=@b,p=@b,q=@b,r=@b,s=@b,t=@b,u=@b;
CREATE INDEX t1a ON t1 (a(767));
-CREATE INDEX t1b ON t1 (b(767));
-CREATE INDEX t1c ON t1 (c(767));
-CREATE INDEX t1d ON t1 (d(767));
-CREATE INDEX t1e ON t1 (e(767));
UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c,
k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c;
CREATE INDEX t1f ON t1 (f(767));
@@ -407,37 +265,15 @@
COMMIT;
CREATE INDEX t1g ON t1 (g(767));
UPDATE t1 SET g=@e;
-CREATE INDEX t1h ON t1 (h(767));
-UPDATE t1 SET h=@e;
-CREATE INDEX t1i ON t1 (i(767));
-UPDATE t1 SET i=@e;
-CREATE INDEX t1j ON t1 (j(767));
-UPDATE t1 SET j=@e;
-CREATE INDEX t1k ON t1 (k(767));
-UPDATE t1 SET k=@e;
-CREATE INDEX t1l ON t1 (l(767));
-UPDATE t1 SET l=@e;
-CREATE INDEX t1m ON t1 (m(767));
-UPDATE t1 SET m=@e;
-CREATE INDEX t1n ON t1 (n(767));
-UPDATE t1 SET n=@e;
-CREATE INDEX t1o ON t1 (o(767));
-UPDATE t1 SET o=@e;
-CREATE INDEX t1p ON t1 (p(767));
-UPDATE t1 SET p=@e;
-CREATE INDEX t1q ON t1 (q(767));
-UPDATE t1 SET q=@e;
-CREATE INDEX t1r ON t1 (r(767));
-UPDATE t1 SET r=@e;
-CREATE INDEX t1s ON t1 (s(767));
-UPDATE t1 SET s=@e;
CREATE INDEX t1t ON t1 (t(767));
BEGIN;
UPDATE t1 SET t=@e;
ROLLBACK;
CREATE INDEX t1u ON t1 (u(767));
-CREATE INDEX t1ut ON t1 (u(767), t(767));
-CREATE INDEX t1st ON t1 (s(767), t(767));
+CREATE INDEX t1ut ON t1 (u(767));
+Warnings:
+Note 1831 Duplicate index `t1ut`. This is deprecated and will be disallowed in a future release
+CREATE INDEX t1st ON t1 (s(767));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -463,28 +299,12 @@
`t` blob DEFAULT NULL,
`u` blob DEFAULT NULL,
KEY `t1a` (`a`(767)),
- KEY `t1b` (`b`(767)),
- KEY `t1c` (`c`(767)),
- KEY `t1d` (`d`(767)),
- KEY `t1e` (`e`(767)),
KEY `t1f` (`f`(767)),
KEY `t1g` (`g`(767)),
- KEY `t1h` (`h`(767)),
- KEY `t1i` (`i`(767)),
- KEY `t1j` (`j`(767)),
- KEY `t1k` (`k`(767)),
- KEY `t1l` (`l`(767)),
- KEY `t1m` (`m`(767)),
- KEY `t1n` (`n`(767)),
- KEY `t1o` (`o`(767)),
- KEY `t1p` (`p`(767)),
- KEY `t1q` (`q`(767)),
- KEY `t1r` (`r`(767)),
- KEY `t1s` (`s`(767)),
KEY `t1t` (`t`(767)),
KEY `t1u` (`u`(767)),
- KEY `t1ut` (`u`(767),`t`(767)),
- KEY `t1st` (`s`(767),`t`(767))
+ KEY `t1ut` (`u`(767)),
+ KEY `t1st` (`s`(767))
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
DROP TABLE t1;
# Bug#12547647 UPDATE LOGGING COULD EXCEED LOG PAGE SIZE
@@ -565,27 +385,25 @@
DROP TABLE t1;
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
-PRIMARY KEY (c(767),d(767)))
+PRIMARY KEY (c(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
Warnings:
-Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
+Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
DROP TABLE t1;
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
-PRIMARY KEY (c(767),d(767)))
+PRIMARY KEY (c(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII;
-Warnings:
-Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
DROP TABLE t1;
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
-PRIMARY KEY (c(767),d(767)))
+PRIMARY KEY (c(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII;
DROP TABLE t1;
CREATE TABLE t1(c text, PRIMARY KEY (c(440)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
Warnings:
-Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
+Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
DROP TABLE t1;
CREATE TABLE t1(c text, PRIMARY KEY (c(438)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;

View file

@ -0,0 +1,415 @@
--- page_size.result
+++ page_size,8k.result
@@ -3,7 +3,7 @@
SELECT variable_value FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_page_size';
variable_value
-16384
+8192
# Test 3) Query some information_shema tables that are dependent upon
# the page size.
SELECT t.name table_name, t.n_cols, t.flag table_flags,
@@ -36,13 +36,13 @@
table_name n_cols table_flags index_name root_page type n_fields merge_threshold
test/t1 5 0 PRIMARY 3 3 1 50
test/t2 5 1 PRIMARY 3 3 1 50
-test/t3 5 41 PRIMARY 3 3 1 50
+test/t3 5 39 PRIMARY 3 3 1 50
test/t4 5 33 PRIMARY 3 3 1 50
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path
test/t1 Single DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t1.ibd
test/t2 Single DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t2.ibd
-test/t3 Single DEFAULT 8192 Compressed MYSQLD_DATADIR/test/t3.ibd
+test/t3 Single DEFAULT 4096 Compressed MYSQLD_DATADIR/test/t3.ibd
test/t4 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4.ibd
DROP TABLE t1, t2, t3, t4;
# Test 4) The maximum row size is dependent upon the page size.
@@ -53,133 +53,97 @@
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
-c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200),
-c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200),
-c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200),
-c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200),
-c36 char(200), c37 char(200), c38 char(200), c39 char(200), c40 char(211)
+c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(155)
) ROW_FORMAT=redundant;
DROP TABLE t1;
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
-c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200),
-c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200),
-c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200),
-c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200),
-c36 char(200), c37 char(200), c38 char(200), c39 char(200), c40 char(212)
+c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(156)
) ROW_FORMAT=redundant;
-ERROR 42000: Row size too large (> 8123). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
+ERROR 42000: Row size too large (> max_row_size). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
-c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200),
-c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200),
-c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200),
-c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200),
-c36 char(200), c37 char(200), c38 char(200), c39 char(250), c40 char(246)
+c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(202)
) ROW_FORMAT=compact;
DROP TABLE t1;
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
-c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200),
-c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200),
-c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200),
-c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200),
-c36 char(200), c37 char(200), c38 char(200), c39 char(250), c40 char(247)
+c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(203)
) ROW_FORMAT=compact;
-ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
+ERROR 42000: Row size too large (> max_row_size). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
-c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200),
-c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200),
-c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200),
-c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200),
-c36 char(200), c37 char(200), c38 char(200), c39 char(200), c40 char(157)
+c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(103)
) ROW_FORMAT=compressed;
DROP TABLE t1;
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
-c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200),
-c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200),
-c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200),
-c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200),
-c36 char(200), c37 char(200), c38 char(200), c39 char(200), c40 char(160)
+c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(106)
) ROW_FORMAT=compressed;
-ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
+ERROR 42000: Row size too large (> max_row_size). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
-c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200),
-c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200),
-c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200),
-c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200),
-c36 char(200), c37 char(200), c38 char(200), c39 char(250), c40 char(246)
+c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(202)
) ROW_FORMAT=dynamic;
DROP TABLE t1;
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
-c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200),
-c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200),
-c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200),
-c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200),
-c36 char(200), c37 char(200), c38 char(200), c39 char(250), c40 char(247)
+c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(203)
) ROW_FORMAT=dynamic;
-ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
-CREATE TABLE t1 (a varchar(255) character set utf8,
-b varchar(255) character set utf8,
-c varchar(255) character set utf8,
-d varchar(255) character set utf8,
-e varchar(4) character set utf8,
-PRIMARY KEY (a,b,c,d,e))
+ERROR 42000: Row size too large (> max_row_size). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
+CREATE TABLE t1 (a varchar(128) character set utf8,
+b varchar(128) character set utf8,
+c varchar(128) character set utf8,
+d varchar(128) character set utf8,
+PRIMARY KEY (a,b,c,d))
ENGINE=innodb;
DROP TABLE t1;
-CREATE TABLE t1 (a varchar(255) character set utf8,
-b varchar(255) character set utf8,
-c varchar(255) character set utf8,
-d varchar(255) character set utf8,
-e varchar(5) character set utf8,
-PRIMARY KEY (a,b,c,d,e))
+CREATE TABLE t1 (a varchar(128) character set utf8,
+b varchar(128) character set utf8,
+c varchar(128) character set utf8,
+d varchar(129) character set utf8,
+PRIMARY KEY (a,b,c,d))
ENGINE=innodb;
-ERROR 42000: Specified key was too long; max key length is 3072 bytes
-CREATE TABLE t1 (a varchar(255) character set utf8,
-b varchar(255) character set utf8,
-c varchar(255) character set utf8,
-d varchar(255) character set utf8,
-e varchar(255) character set utf8,
-f varchar(4) character set utf8,
-PRIMARY KEY (a), KEY (b,c,d,e,f))
+ERROR 42000: Specified key was too long; max key length is 1536 bytes
+CREATE TABLE t1 (a varchar(128) character set utf8,
+b varchar(128) character set utf8,
+c varchar(128) character set utf8,
+d varchar(128) character set utf8,
+e varchar(128) character set utf8,
+PRIMARY KEY (a), KEY (b,c,d,e))
ENGINE=innodb;
DROP TABLE t1;
-CREATE TABLE t1 (a varchar(255) character set utf8,
-b varchar(255) character set utf8,
-c varchar(255) character set utf8,
-d varchar(255) character set utf8,
-e varchar(255) character set utf8,
-f varchar(5) character set utf8,
-PRIMARY KEY (a), KEY (b,c,d,e,f))
+CREATE TABLE t1 (a varchar(128) character set utf8,
+b varchar(128) character set utf8,
+c varchar(128) character set utf8,
+d varchar(128) character set utf8,
+e varchar(129) character set utf8,
+PRIMARY KEY (a), KEY (b,c,d,e))
ENGINE=innodb;
-ERROR 42000: Specified key was too long; max key length is 3072 bytes
+ERROR 42000: Specified key was too long; max key length is 1536 bytes
# Test 5) KEY_BLOCK_SIZE validation
-CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
+ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
-SELECT table_name, row_format, create_options
-FROM information_schema.tables WHERE table_name = 't1';
-table_name row_format create_options
-t1 Compressed row_format=COMPRESSED key_block_size=16
-ALTER TABLE t1 KEY_BLOCK_SIZE=8;
+Warning 1478 InnoDB: KEY_BLOCK_SIZE=16 cannot be larger than 8.
+Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
+Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
+CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
SHOW WARNINGS;
Level Code Message
SELECT table_name, row_format, create_options
@@ -217,8 +181,11 @@
DROP TABLE t1;
SET SESSION innodb_strict_mode = OFF;
CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
+Warnings:
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16.
SHOW WARNINGS;
Level Code Message
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16.
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
@@ -276,105 +243,11 @@
ERROR HY000: Can't create table `test`.`t5` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE=16 cannot be larger than 8.
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
Error 1005 Can't create table `test`.`t5` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
SET GLOBAL innodb_file_per_table = ON;
-# Test 7) This series of tests were moved from innodb-index to here
-# because the second alter table t1 assumes a 16k page size.
-# Moving the test allows the rest of innodb-index to be run on all
-# page sizes. The previously disabled portions of this test were
-# moved as well.
-CREATE TABLE t2(d varchar(17) PRIMARY KEY) ENGINE=innodb DEFAULT CHARSET=utf8;
-CREATE TABLE t3(a int PRIMARY KEY) ENGINE=innodb;
-INSERT INTO t3 VALUES (22),(44),(33),(55),(66);
-INSERT INTO t2 VALUES ('jejdkrun87'),('adfd72nh9k'),
-('adfdpplkeock'),('adfdijnmnb78k'),('adfdijn0loKNHJik');
-CREATE TABLE t1(a int, b blob, c text, d text NOT NULL)
-ENGINE=innodb DEFAULT CHARSET=utf8 STATS_PERSISTENT=0;
-INSERT INTO t1
-SELECT a,LEFT(REPEAT(d,100*a),65535),REPEAT(d,20*a),d FROM t2,t3 order by a, d;
-DROP TABLE t2, t3;
-SELECT COUNT(*) FROM t1 WHERE a=44;
-COUNT(*)
-5
-SELECT a,
-LENGTH(b),b=LEFT(REPEAT(d,100*a),65535),LENGTH(c),c=REPEAT(d,20*a),d FROM t1
-ORDER BY 1, 2, 3, 4, 5, 6;
-a LENGTH(b) b=LEFT(REPEAT(d,100*a),65535) LENGTH(c) c=REPEAT(d,20*a) d
-22 22000 1 4400 1 adfd72nh9k
-22 22000 1 4400 1 jejdkrun87
-22 26400 1 5280 1 adfdpplkeock
-22 28600 1 5720 1 adfdijnmnb78k
-22 35200 1 7040 1 adfdijn0loKNHJik
-33 33000 1 6600 1 adfd72nh9k
-33 33000 1 6600 1 jejdkrun87
-33 39600 1 7920 1 adfdpplkeock
-33 42900 1 8580 1 adfdijnmnb78k
-33 52800 1 10560 1 adfdijn0loKNHJik
-44 44000 1 8800 1 adfd72nh9k
-44 44000 1 8800 1 jejdkrun87
-44 52800 1 10560 1 adfdpplkeock
-44 57200 1 11440 1 adfdijnmnb78k
-44 65535 1 14080 1 adfdijn0loKNHJik
-55 55000 1 11000 1 adfd72nh9k
-55 55000 1 11000 1 jejdkrun87
-55 65535 1 13200 1 adfdpplkeock
-55 65535 1 14300 1 adfdijnmnb78k
-55 65535 1 17600 1 adfdijn0loKNHJik
-66 65535 1 13200 1 adfd72nh9k
-66 65535 1 13200 1 jejdkrun87
-66 65535 1 15840 1 adfdpplkeock
-66 65535 1 17160 1 adfdijnmnb78k
-66 65535 1 21120 1 adfdijn0loKNHJik
-ALTER TABLE t1 ADD PRIMARY KEY (a), ADD KEY (b(20));
-ERROR 23000: Duplicate entry '22' for key 'PRIMARY'
-DELETE FROM t1 WHERE d='null';
-ALTER TABLE t1 ADD PRIMARY KEY (a), ADD KEY (b(20));
-ERROR 23000: Duplicate entry '22' for key 'PRIMARY'
-DELETE FROM t1 WHERE a%2;
-CHECK TABLE t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-ALTER TABLE t1 ADD PRIMARY KEY (a,b(255),c(255)), ADD KEY (b(767));
-SELECT COUNT(*) FROM t1 WHERE a=44;
-COUNT(*)
-5
-SELECT a,
-LENGTH(b), b=LEFT(REPEAT(d,100*a), 65535),LENGTH(c), c=REPEAT(d,20*a), d FROM t1;
-a LENGTH(b) b=LEFT(REPEAT(d,100*a), 65535) LENGTH(c) c=REPEAT(d,20*a) d
-22 22000 1 4400 1 adfd72nh9k
-22 35200 1 7040 1 adfdijn0loKNHJik
-22 28600 1 5720 1 adfdijnmnb78k
-22 26400 1 5280 1 adfdpplkeock
-22 22000 1 4400 1 jejdkrun87
-44 44000 1 8800 1 adfd72nh9k
-44 65535 1 14080 1 adfdijn0loKNHJik
-44 57200 1 11440 1 adfdijnmnb78k
-44 52800 1 10560 1 adfdpplkeock
-44 44000 1 8800 1 jejdkrun87
-66 65535 1 13200 1 adfd72nh9k
-66 65535 1 21120 1 adfdijn0loKNHJik
-66 65535 1 17160 1 adfdijnmnb78k
-66 65535 1 15840 1 adfdpplkeock
-66 65535 1 13200 1 jejdkrun87
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` blob NOT NULL,
- `c` text NOT NULL,
- `d` text NOT NULL,
- PRIMARY KEY (`a`,`b`(255),`c`(255)),
- KEY `b` (`b`(767))
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0
-CHECK TABLE t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-EXPLAIN SELECT * FROM t1 WHERE b LIKE 'adfd%';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range b b 769 NULL 12 Using where
-DROP TABLE t1;
# Test 8) Test creating a table that could lead to undo log overflow.
CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,
h blob,i blob,j blob,k blob,l blob,m blob,n blob,
@@ -389,10 +262,6 @@
UPDATE t1 SET a=@b,b=@b,c=@b,d=@b,e=@b,f=@b,g=@b,h=@b,i=@b,j=@b,
k=@b,l=@b,m=@b,n=@b,o=@b,p=@b,q=@b,r=@b,s=@b,t=@b,u=@b;
CREATE INDEX t1a ON t1 (a(767));
-CREATE INDEX t1b ON t1 (b(767));
-CREATE INDEX t1c ON t1 (c(767));
-CREATE INDEX t1d ON t1 (d(767));
-CREATE INDEX t1e ON t1 (e(767));
UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c,
k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c;
CREATE INDEX t1f ON t1 (f(767));
@@ -407,30 +276,6 @@
COMMIT;
CREATE INDEX t1g ON t1 (g(767));
UPDATE t1 SET g=@e;
-CREATE INDEX t1h ON t1 (h(767));
-UPDATE t1 SET h=@e;
-CREATE INDEX t1i ON t1 (i(767));
-UPDATE t1 SET i=@e;
-CREATE INDEX t1j ON t1 (j(767));
-UPDATE t1 SET j=@e;
-CREATE INDEX t1k ON t1 (k(767));
-UPDATE t1 SET k=@e;
-CREATE INDEX t1l ON t1 (l(767));
-UPDATE t1 SET l=@e;
-CREATE INDEX t1m ON t1 (m(767));
-UPDATE t1 SET m=@e;
-CREATE INDEX t1n ON t1 (n(767));
-UPDATE t1 SET n=@e;
-CREATE INDEX t1o ON t1 (o(767));
-UPDATE t1 SET o=@e;
-CREATE INDEX t1p ON t1 (p(767));
-UPDATE t1 SET p=@e;
-CREATE INDEX t1q ON t1 (q(767));
-UPDATE t1 SET q=@e;
-CREATE INDEX t1r ON t1 (r(767));
-UPDATE t1 SET r=@e;
-CREATE INDEX t1s ON t1 (s(767));
-UPDATE t1 SET s=@e;
CREATE INDEX t1t ON t1 (t(767));
BEGIN;
UPDATE t1 SET t=@e;
@@ -463,24 +308,8 @@
`t` blob DEFAULT NULL,
`u` blob DEFAULT NULL,
KEY `t1a` (`a`(767)),
- KEY `t1b` (`b`(767)),
- KEY `t1c` (`c`(767)),
- KEY `t1d` (`d`(767)),
- KEY `t1e` (`e`(767)),
KEY `t1f` (`f`(767)),
KEY `t1g` (`g`(767)),
- KEY `t1h` (`h`(767)),
- KEY `t1i` (`i`(767)),
- KEY `t1j` (`j`(767)),
- KEY `t1k` (`k`(767)),
- KEY `t1l` (`l`(767)),
- KEY `t1m` (`m`(767)),
- KEY `t1n` (`n`(767)),
- KEY `t1o` (`o`(767)),
- KEY `t1p` (`p`(767)),
- KEY `t1q` (`q`(767)),
- KEY `t1r` (`r`(767)),
- KEY `t1s` (`s`(767)),
KEY `t1t` (`t`(767)),
KEY `t1u` (`u`(767)),
KEY `t1ut` (`u`(767),`t`(767)),
@@ -568,14 +397,14 @@
PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
Warnings:
-Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
+Warning 139 Row size too large (> 4030). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
DROP TABLE t1;
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII;
Warnings:
-Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
+Warning 139 Row size too large (> 4030). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
DROP TABLE t1;
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
@@ -585,7 +414,7 @@
CREATE TABLE t1(c text, PRIMARY KEY (c(440)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
Warnings:
-Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
+Warning 139 Row size too large (> 4030). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
DROP TABLE t1;
CREATE TABLE t1(c text, PRIMARY KEY (c(438)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;

View file

@ -4,7 +4,6 @@ SELECT variable_value FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_page_size';
variable_value
16384
# Test 2) The number of buffer pool pages is dependent upon the page size.
# Test 3) Query some information_shema tables that are dependent upon
# the page size.
SELECT t.name table_name, t.n_cols, t.flag table_flags,
@ -47,8 +46,6 @@ test/t3 Single DEFAULT 8192 Compressed MYSQLD_DATADIR/test/t3.ibd
test/t4 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4.ibd
DROP TABLE t1, t2, t3, t4;
# Test 4) The maximum row size is dependent upon the page size.
# Redundant: 8123, Compact: 8126.
# Compressed: 8126, Dynamic: 8126.
# Each row format has its own amount of overhead that
# varies depending on number of fields and other overhead.
SET SESSION innodb_strict_mode = ON;
@ -174,9 +171,7 @@ f varchar(5) character set utf8,
PRIMARY KEY (a), KEY (b,c,d,e,f))
ENGINE=innodb;
ERROR 42000: Specified key was too long; max key length is 3072 bytes
# Test 5) Make sure that KEY_BLOCK_SIZE=16, 8, 4, 2 & 1
# are all accepted.
SET SESSION innodb_strict_mode = ON;
# Test 5) KEY_BLOCK_SIZE validation
CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
SHOW WARNINGS;
Level Code Message
@ -264,22 +259,21 @@ FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
t1 Compressed row_format=COMPRESSED
DROP TABLE t1;
# Test 6) Make sure that KEY_BLOCK_SIZE = 8 and 16
# are rejected when innodb_file_per_table=OFF
# Test 6) KEY_BLOCK_SIZE with innodb_file_per_table=OFF
SET SESSION innodb_strict_mode = ON;
SET GLOBAL innodb_file_per_table = OFF;
SHOW VARIABLES LIKE 'innodb_file_per_table';
Variable_name Value
innodb_file_per_table OFF
CREATE TABLE t4 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=8;
Got one of the listed errors
ERROR HY000: Can't create table `test`.`t4` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
Error 1005 Can't create table `test`.`t4` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
CREATE TABLE t5 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=16;
Got one of the listed errors
ERROR HY000: Can't create table `test`.`t5` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
@ -493,124 +487,7 @@ t1 CREATE TABLE `t1` (
KEY `t1st` (`s`(767),`t`(767))
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
DROP TABLE t1;
# Bug #12429576 - Test an assertion failure on purge.
CREATE TABLE t1_purge (
A int,
B blob, C blob, D blob, E blob,
F blob, G blob, H blob,
PRIMARY KEY (B(767), C(767), D(767), E(767), A),
INDEX (A)
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t1_purge VALUES (1,
REPEAT('b', 766), REPEAT('c', 766), REPEAT('d', 766), REPEAT('e', 766),
REPEAT('f', 766), REPEAT('g', 766), REPEAT('h', 766));
CREATE TABLE t2_purge (
A int PRIMARY KEY,
B blob, C blob, D blob, E blob,
F blob, G blob, H blob, I blob,
J blob, K blob, L blob,
INDEX (B(767))) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t2_purge VALUES (1,
REPEAT('b', 766), REPEAT('c', 766), REPEAT('d', 766), REPEAT('e', 766),
REPEAT('f', 766), REPEAT('g', 766), REPEAT('h', 766), REPEAT('i', 766),
REPEAT('j', 766), REPEAT('k', 766), REPEAT('l', 766));
CREATE TABLE t3_purge (
A int,
B varchar(800), C varchar(800), D varchar(800), E varchar(800),
F varchar(800), G varchar(800), H varchar(800),
PRIMARY KEY (B(767), C(767), D(767), E(767), A),
INDEX (A)
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t3_purge SELECT * FROM t1_purge;
CREATE TABLE t4_purge (
A int PRIMARY KEY,
B varchar(800), C varchar(800), D varchar(800), E varchar(800),
F varchar(800), G varchar(800), H varchar(800), I varchar(800),
J varchar(800), K varchar(800), L varchar(800),
INDEX (B(767))) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t4_purge SELECT * FROM t2_purge;
DELETE FROM t1_purge;
DELETE FROM t2_purge;
DELETE FROM t3_purge;
DELETE FROM t4_purge;
SET @r=REPEAT('a',500);
CREATE TABLE t12637786(a int,
v1 varchar(500), v2 varchar(500), v3 varchar(500),
v4 varchar(500), v5 varchar(500), v6 varchar(500),
v7 varchar(500), v8 varchar(500), v9 varchar(500),
v10 varchar(500), v11 varchar(500), v12 varchar(500),
v13 varchar(500), v14 varchar(500), v15 varchar(500),
v16 varchar(500), v17 varchar(500), v18 varchar(500)
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
CREATE INDEX idx1 ON t12637786(a,v1);
INSERT INTO t12637786 VALUES(9,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
UPDATE t12637786 SET a=1000;
DELETE FROM t12637786;
# Bug#12963823 - Test that the purge thread does not crash when
CREATE TABLE t12963823(a blob,b blob,c blob,d blob,e blob,f blob,g blob,h blob,
i blob,j blob,k blob,l blob,m blob,n blob,o blob,p blob)
ENGINE=innodb ROW_FORMAT=dynamic;
SET @r = REPEAT('a', 767);
INSERT INTO t12963823 VALUES (@r,@r,@r,@r, @r,@r,@r,@r, @r,@r,@r,@r, @r,@r,@r,@r);
CREATE INDEX ndx_a ON t12963823 (a(500));
CREATE INDEX ndx_b ON t12963823 (b(500));
CREATE INDEX ndx_c ON t12963823 (c(500));
CREATE INDEX ndx_d ON t12963823 (d(500));
CREATE INDEX ndx_e ON t12963823 (e(500));
CREATE INDEX ndx_f ON t12963823 (f(500));
CREATE INDEX ndx_k ON t12963823 (k(500));
CREATE INDEX ndx_l ON t12963823 (l(500));
SET @r = REPEAT('b', 500);
UPDATE t12963823 set a=@r,b=@r,c=@r,d=@r;
UPDATE t12963823 set e=@r,f=@r,g=@r,h=@r;
UPDATE t12963823 set i=@r,j=@r,k=@r,l=@r;
UPDATE t12963823 set m=@r,n=@r,o=@r,p=@r;
ALTER TABLE t12963823 DROP INDEX ndx_a;
ALTER TABLE t12963823 DROP INDEX ndx_b;
CREATE INDEX ndx_g ON t12963823 (g(500));
CREATE INDEX ndx_h ON t12963823 (h(500));
CREATE INDEX ndx_i ON t12963823 (i(500));
CREATE INDEX ndx_j ON t12963823 (j(500));
CREATE INDEX ndx_m ON t12963823 (m(500));
CREATE INDEX ndx_n ON t12963823 (n(500));
CREATE INDEX ndx_o ON t12963823 (o(500));
CREATE INDEX ndx_p ON t12963823 (p(500));
SHOW CREATE TABLE t12963823;
Table Create Table
t12963823 CREATE TABLE `t12963823` (
`a` blob DEFAULT NULL,
`b` blob DEFAULT NULL,
`c` blob DEFAULT NULL,
`d` blob DEFAULT NULL,
`e` blob DEFAULT NULL,
`f` blob DEFAULT NULL,
`g` blob DEFAULT NULL,
`h` blob DEFAULT NULL,
`i` blob DEFAULT NULL,
`j` blob DEFAULT NULL,
`k` blob DEFAULT NULL,
`l` blob DEFAULT NULL,
`m` blob DEFAULT NULL,
`n` blob DEFAULT NULL,
`o` blob DEFAULT NULL,
`p` blob DEFAULT NULL,
KEY `ndx_c` (`c`(500)),
KEY `ndx_d` (`d`(500)),
KEY `ndx_e` (`e`(500)),
KEY `ndx_f` (`f`(500)),
KEY `ndx_k` (`k`(500)),
KEY `ndx_l` (`l`(500)),
KEY `ndx_g` (`g`(500)),
KEY `ndx_h` (`h`(500)),
KEY `ndx_i` (`i`(500)),
KEY `ndx_j` (`j`(500)),
KEY `ndx_m` (`m`(500)),
KEY `ndx_n` (`n`(500)),
KEY `ndx_o` (`o`(500)),
KEY `ndx_p` (`p`(500))
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
# Bug#12547647 UPDATE LOGGING COULD EXCEED LOG PAGE SIZE
SET SESSION innodb_strict_mode = ON;
CREATE TABLE bug12547647(
a int NOT NULL, b blob NOT NULL, c text,
PRIMARY KEY (b(10), a), INDEX (c(767)), INDEX(b(767))
@ -623,7 +500,69 @@ SHOW WARNINGS;
Level Code Message
ROLLBACK;
DROP TABLE bug12547647;
SET SESSION innodb_strict_mode = off;
SET SESSION innodb_strict_mode = OFF;
CREATE TABLE t1(
pk01 varchar(48), pk02 varchar(48), pk03 varchar(48), pk04 varchar(48),
pk05 varchar(48), pk06 varchar(48), pk07 varchar(48), pk08 varchar(48),
pk09 varchar(48), pk10 varchar(48), pk11 varchar(48), pk12 varchar(48),
pk13 varchar(48), pk14 varchar(48), pk15 varchar(48), pk16 varchar(48),
sk01 varchar(48), sk02 varchar(48), sk03 varchar(48), sk04 varchar(48),
sk05 varchar(48), sk06 varchar(48), sk07 varchar(48), sk08 varchar(48),
sk09 varchar(48), sk10 varchar(48), sk11 varchar(48), sk12 varchar(48),
sk13 varchar(48), sk14 varchar(48), sk15 varchar(48), sk16 varchar(48),
PRIMARY KEY pk(pk01,pk02,pk03,pk04,pk05,pk06,pk07,pk08,
pk09,pk10,pk11,pk12,pk13,pk14,pk15,pk16),
KEY pk(sk01,sk02,sk03,sk04,sk05,sk06,sk07,sk08,
sk09,sk10,sk11,sk12,sk13,sk14,sk15,sk16))
ROW_FORMAT=Redundant ENGINE=InnoDB;
SET @r = repeat('a', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('b', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('c', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('d', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('e', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
DELETE from t1;
DROP TABLE t1;
CREATE TABLE t1(
pk01 varchar(48), pk02 varchar(48), pk03 varchar(48), pk04 varchar(48),
pk05 varchar(48), pk06 varchar(48), pk07 varchar(48), pk08 varchar(48),
pk09 varchar(48), pk10 varchar(48), pk11 varchar(48), pk12 varchar(48),
pk13 varchar(48), pk14 varchar(48), pk15 varchar(48), pk16 varchar(48),
sk01 varchar(48), sk02 varchar(48), sk03 varchar(48), sk04 varchar(48),
sk05 varchar(48), sk06 varchar(48), sk07 varchar(48), sk08 varchar(48),
sk09 varchar(48), sk10 varchar(48), sk11 varchar(48), sk12 varchar(48),
sk13 varchar(48), sk14 varchar(48), sk15 varchar(48), sk16 varchar(48),
PRIMARY KEY pk(pk01,pk02,pk03,pk04,pk05,pk06,pk07,pk08,
pk09,pk10,pk11,pk12,pk13,pk14,pk15,pk16),
KEY pk(sk01,sk02,sk03,sk04,sk05,sk06,sk07,sk08,
sk09,sk10,sk11,sk12,sk13,sk14,sk15,sk16))
ROW_FORMAT=Compressed KEY_BLOCK_SIZE=4 ENGINE=InnoDB;
SET @r = repeat('a', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('b', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('c', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('d', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('e', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
DELETE from t1;
DROP TABLE t1;
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767),d(767)))
@ -642,7 +581,7 @@ CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII;
drop table t1;
DROP TABLE t1;
CREATE TABLE t1(c text, PRIMARY KEY (c(440)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
Warnings:
@ -652,50 +591,3 @@ CREATE TABLE t1(c text, PRIMARY KEY (c(438)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
DROP TABLE t1;
#
# Bug#56862 Execution of a query that uses index merge returns a wrong result
#
CREATE TABLE t1 (
pk int NOT NULL AUTO_INCREMENT PRIMARY KEY,
a int,
b int,
INDEX idx(a))
ENGINE=INNODB;
INSERT INTO t1(a,b) VALUES
(11, 1100), (2, 200), (1, 100), (14, 1400), (5, 500),
(3, 300), (17, 1700), (4, 400), (12, 1200), (8, 800),
(6, 600), (18, 1800), (9, 900), (10, 1000), (7, 700),
(13, 1300), (15, 1500), (19, 1900), (16, 1600), (20, 2000);
INSERT INTO t1(a,b) SELECT a+20, b+2000 FROM t1;
INSERT INTO t1(a,b) SELECT a+40, b+4000 FROM t1;
INSERT INTO t1(a,b) SELECT a+80, b+8000 FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1 VALUES (1000000, 0, 0);
set @optimizer_switch_saved=@@optimizer_switch;
SET SESSION optimizer_switch='derived_merge=off';
SET SESSION sort_buffer_size = 1024*36;
EXPLAIN
SELECT COUNT(*) FROM
(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 1537
2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 1537 Using sort_union(idx,PRIMARY); Using where
SELECT COUNT(*) FROM
(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
COUNT(*)
1537
set @@optimizer_switch=@optimizer_switch_saved;
SET SESSION sort_buffer_size = DEFAULT;
DROP TABLE t1;
DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge;
DROP TABLE t12637786;
DROP TABLE t12963823;

View file

@ -1,3 +0,0 @@
--loose-innodb-sys-indexes
--loose-innodb-sys-tablespaces
--loose-innodb-sys-datafiles

View file

@ -1,433 +0,0 @@
# Tests for setting innodb-page-size=4k
--source include/have_innodb.inc
--source include/have_innodb_4k.inc
SET default_storage_engine=InnoDB;
--disable_query_log
let $MYSQLD_DATADIR = `select @@datadir`;
let $INNODB_PAGE_SIZE = `select @@innodb_page_size`;
call mtr.add_suppression("Cannot add field .* in table .* because after adding it, the row size is");
--enable_query_log
--echo # Test 1) Show the page size from Information Schema
--disable_warnings
SELECT variable_value FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_page_size';
--enable_warnings
--echo # Test 2) The number of buffer pool pages is dependent upon the page size.
--disable_warnings
--replace_result 2048 {checked_valid}
SELECT variable_value FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
--enable_warnings
--echo # Test 3) Query some information_shema tables that are dependent upon
--echo # the page size.
# Show the metadata for tables in schema 'mysql'.
# Pulled from innodb-system-table-view.test
# The IDs of mysql.innodb_table_stats and mysql.innodb_index_stats are
# unpredictable. They depend on whether mtr has created the database for
# this test from scratch or is using a previously created database where
# those tables have been dropped and recreated. Since we cannot force mtr
# to use a freshly created database for this test we do not return the
# table or index IDs. We can return the space IS of mysql schema tables
# since they are created consistently during bootstrap.
SELECT t.name table_name, t.n_cols, t.flag table_flags,
i.name index_name, i.page_no root_page, i.type,
i.n_fields, i.merge_threshold
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t,
INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
WHERE t.table_id = i.table_id
AND t.name LIKE 'mysql%'
ORDER BY t.name, i.index_id;
CREATE TABLE t1 (a INT KEY, b TEXT) ROW_FORMAT=REDUNDANT ENGINE=innodb;
CREATE TABLE t2 (a INT KEY, b TEXT) ROW_FORMAT=COMPACT ENGINE=innodb;
CREATE TABLE t3 (a INT KEY, b TEXT) ROW_FORMAT=COMPRESSED ENGINE=innodb;
CREATE TABLE t4 (a INT KEY, b TEXT) ROW_FORMAT=DYNAMIC ENGINE=innodb;
# Show the metadata for tables in schema 'test'.
# Do not return the space ID since this tablespace may have existed before
# this test runs. The root page number of each index should be consistent
# within a file-per-table tablespace.
SELECT t.name table_name, t.n_cols, t.flag table_flags,
i.name index_name, i.page_no root_page, i.type,
i.n_fields, i.merge_threshold
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t,
INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
WHERE t.table_id = i.table_id
AND t.name LIKE 'test%'
ORDER BY t.name, i.name;
--source suite/innodb/include/show_i_s_tablespaces.inc
DROP TABLE t1, t2, t3, t4;
--echo # Test 4) The maximum row size is dependent upon the page size.
--echo # Redundant: 1979, Compact: 1982.
--echo # Compressed: 1982, Dynamic: 1982.
--echo # Each row format has its own amount of overhead that
--echo # varies depending on number of fields and other overhead.
SET SESSION innodb_strict_mode = ON;
# Redundant table; 1927 bytes with 10 CHAR fields
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(127)
) ROW_FORMAT=redundant;
DROP TABLE t1;
--replace_regex /> [0-9]*/> max_row_size/
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(128)
) ROW_FORMAT=redundant;
# Compact table; 1955 bytes with 10 CHAR fields
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(155)
) ROW_FORMAT=compact;
DROP TABLE t1;
--replace_regex /> [0-9]*/> max_row_size/
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(156)
) ROW_FORMAT=compact;
# Compressed table; 1878 bytes with 10 CHAR fields
# Bug#13391353 Limit is 1876 on 32-Linux only
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(76)
) ROW_FORMAT=compressed;
DROP TABLE t1;
--replace_regex /> [0-9]*/> max_row_size/
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(79)
) ROW_FORMAT=compressed;
# Dynamic table; 1955 bytes with 10 CHAR fields
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(155)
) ROW_FORMAT=dynamic;
DROP TABLE t1;
--replace_regex /> [0-9]*/> max_row_size/
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(156)
) ROW_FORMAT=dynamic;
#
# Test the maximum key length
# Moved from innodb-index.test since each page size has its own max key length.
# Max Key Length is 768 for 4k pages.
#
# InnoDB assumes 3 bytes for each UTF8 character.
#
CREATE TABLE t1 (a varchar(64) character set utf8,
b varchar(64) character set utf8,
c varchar(64) character set utf8,
d varchar(64) character set utf8,
PRIMARY KEY (a,b,c,d))
ENGINE=innodb;
DROP TABLE t1;
--error ER_TOO_LONG_KEY
CREATE TABLE t1 (a varchar(64) character set utf8,
b varchar(64) character set utf8,
c varchar(64) character set utf8,
d varchar(65) character set utf8,
PRIMARY KEY (a,b,c,d))
ENGINE=innodb;
CREATE TABLE t1 (a varchar(64) character set utf8,
b varchar(64) character set utf8,
c varchar(64) character set utf8,
d varchar(64) character set utf8,
e varchar(64) character set utf8,
PRIMARY KEY (a), KEY (b,c,d,e))
ENGINE=innodb;
DROP TABLE t1;
--error ER_TOO_LONG_KEY
CREATE TABLE t1 (a varchar(64) character set utf8,
b varchar(64) character set utf8,
c varchar(64) character set utf8,
d varchar(64) character set utf8,
e varchar(65) character set utf8,
PRIMARY KEY (a), KEY (b,c,d,e))
ENGINE=innodb;
--echo # Test 5) Make sure that KEY_BLOCK_SIZE=4, 2 & 1 are all
--echo # accepted and that KEY_BLOCK_SIZE=16 & 8 are rejected
--echo # in strict mode and converted to 4 in non-strict mode.
SET SESSION innodb_strict_mode = ON;
--error ER_CANT_CREATE_TABLE
CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
SHOW WARNINGS;
--error ER_CANT_CREATE_TABLE
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
SHOW WARNINGS;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
ALTER TABLE t1 KEY_BLOCK_SIZE=2;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
ALTER TABLE t1 KEY_BLOCK_SIZE=1;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
ALTER TABLE t1 KEY_BLOCK_SIZE=0;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
DROP TABLE t1;
SET SESSION innodb_strict_mode = OFF;
CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
DROP TABLE t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
DROP TABLE t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
ALTER TABLE t1 KEY_BLOCK_SIZE=2;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
ALTER TABLE t1 KEY_BLOCK_SIZE=1;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
ALTER TABLE t1 KEY_BLOCK_SIZE=0;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
DROP TABLE t1;
--echo # Test 6) Make sure that KEY_BLOCK_SIZE = 8 and 16
--echo # are both rejected when innodb_file_per_table=OFF
# Moved from innodb-zip.test
SET SESSION innodb_strict_mode = ON;
SET GLOBAL innodb_file_per_table = OFF;
SHOW VARIABLES LIKE 'innodb_file_per_table';
--error ER_CANT_CREATE_TABLE
CREATE TABLE t4 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=8;
SHOW WARNINGS;
--error ER_CANT_CREATE_TABLE
CREATE TABLE t5 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=16;
SHOW WARNINGS;
SET GLOBAL innodb_file_per_table = ON;
--echo # Test 7) Not included here; 16k only
--echo # Test 8) Test creating a table that could lead to undo log overflow.
CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,
h blob,i blob,j blob,k blob,l blob,m blob,n blob,
o blob,p blob,q blob,r blob,s blob,t blob,u blob)
ENGINE=InnoDB ROW_FORMAT=dynamic;
SET @a = repeat('a', 767);
SET @b = repeat('b', 767);
SET @c = repeat('c', 767);
SET @d = repeat('d', 767);
SET @e = repeat('e', 767);
# With no indexes defined, we can update all columns to max key part length.
INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a);
UPDATE t1 SET a=@b,b=@b,c=@b,d=@b,e=@b,f=@b,g=@b,h=@b,i=@b,j=@b,
k=@b,l=@b,m=@b,n=@b,o=@b,p=@b,q=@b,r=@b,s=@b,t=@b,u=@b;
# With one index defined, we can still update all fields.
CREATE INDEX t1a ON t1 (a(767));
UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c,
k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c;
# Add one more index and the UNDO record becomes too big to update all columns.
# But a single transaction can update the columns in separate statements.
# because the UNDO records will be smaller.
CREATE INDEX t1b ON t1 (b(767));
BEGIN;
UPDATE t1 SET a=@d,b=@d,c=@d,d=@d,e=@d,f=@d,g=@d,h=@d,i=@d,j=@d,
k=@d,l=@d,m=@d,n=@d,o=@d,p=@d,q=@d,r=@d,s=@d,t=@d,u=@d;
ROLLBACK;
BEGIN;
UPDATE t1 SET a=@d,b=@d,c=@d,d=@d,e=@d;
UPDATE t1 SET f=@d,g=@d,h=@d,i=@d,j=@d,k=@d,l=@d,m=@d,
n=@d,o=@d,p=@d,q=@d,r=@d,s=@d,t=@d,u=@d;
COMMIT;
# Another index can still be added and a single field can still be updated
CREATE INDEX t1c ON t1 (c(767));
UPDATE t1 SET c=@e;
# Add one more index and we cannot update a column to its defined index length.
# This is a problem. It means that the DDL is allowed to create a table
# that CANNOT be updated. See bug#12953735.
CREATE INDEX t1d ON t1 (d(767));
BEGIN;
UPDATE t1 SET d=@e;
ROLLBACK;
--replace_regex /> [0-9]*/> max_row_size/
CREATE INDEX t1e ON t1 (e(767));
SHOW CREATE TABLE t1;
DROP TABLE t1;
#
# Bug #13336585 - INNODB: CHANGE BUFFERING WITH 4K PAGES CAN ASSERT
# IF SECONDARY KEY IS NEAR MAX
# If the secondary index tuple is close to half the page size,
# ibuf_insert_low() could return DB_TOO_BIG_RECORD, which is not expected
# in ibuf_insert(). In order to insure this does not happen, WL5756
# imposes a maximum key length of 768 for 4k pages and 1536 for 8k pages.
# The existing max key Size for 16k pages is 3072.
#
#-- disable_query_log
# The flag innodb_change_buffering_debug is only available in debug builds.
# It instructs InnoDB to try to evict pages from the buffer pool when
# change buffering is possible, so that the change buffer will be used
# whenever possible.
# This flag is not used currently since it exposes valgrind error in ibuf
# code with the following SQL
#-- error 0,ER_UNKNOWN_SYSTEM_VARIABLE
#SET @innodb_change_buffering_debug_orig = @@innodb_change_buffering_debug;
#-- error 0,ER_UNKNOWN_SYSTEM_VARIABLE
#SET GLOBAL innodb_change_buffering_debug = 1;
#-- enable_query_log
# make sure the largest possible key entry can be added to the insert buffer.
# Make enough records so that the root page is not a leaf page.
SET SESSION innodb_strict_mode = OFF;
CREATE TABLE t1(
pk01 varchar(48), pk02 varchar(48), pk03 varchar(48), pk04 varchar(48),
pk05 varchar(48), pk06 varchar(48), pk07 varchar(48), pk08 varchar(48),
pk09 varchar(48), pk10 varchar(48), pk11 varchar(48), pk12 varchar(48),
pk13 varchar(48), pk14 varchar(48), pk15 varchar(48), pk16 varchar(48),
sk01 varchar(48), sk02 varchar(48), sk03 varchar(48), sk04 varchar(48),
sk05 varchar(48), sk06 varchar(48), sk07 varchar(48), sk08 varchar(48),
sk09 varchar(48), sk10 varchar(48), sk11 varchar(48), sk12 varchar(48),
sk13 varchar(48), sk14 varchar(48), sk15 varchar(48), sk16 varchar(48),
PRIMARY KEY pk(pk01,pk02,pk03,pk04,pk05,pk06,pk07,pk08,
pk09,pk10,pk11,pk12,pk13,pk14,pk15,pk16),
KEY pk(sk01,sk02,sk03,sk04,sk05,sk06,sk07,sk08,
sk09,sk10,sk11,sk12,sk13,sk14,sk15,sk16))
ROW_FORMAT=Redundant ENGINE=InnoDB;
SET @r = repeat('a', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('b', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('c', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('d', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('e', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
DELETE from t1;
DROP TABLE t1;
# Compressed tables do not compress parent pages. So the whole uncompressed
# secondary tuple including the primary key must be able to fit in half the
# compressed page size. This record length is enforced at index creation.
# So the only way to get an ibuf tuple too big is to make the KEY_BLOCK_SIZE
# the same as the page size.
CREATE TABLE t1(
pk01 varchar(48), pk02 varchar(48), pk03 varchar(48), pk04 varchar(48),
pk05 varchar(48), pk06 varchar(48), pk07 varchar(48), pk08 varchar(48),
pk09 varchar(48), pk10 varchar(48), pk11 varchar(48), pk12 varchar(48),
pk13 varchar(48), pk14 varchar(48), pk15 varchar(48), pk16 varchar(48),
sk01 varchar(48), sk02 varchar(48), sk03 varchar(48), sk04 varchar(48),
sk05 varchar(48), sk06 varchar(48), sk07 varchar(48), sk08 varchar(48),
sk09 varchar(48), sk10 varchar(48), sk11 varchar(48), sk12 varchar(48),
sk13 varchar(48), sk14 varchar(48), sk15 varchar(48), sk16 varchar(48),
PRIMARY KEY pk(pk01,pk02,pk03,pk04,pk05,pk06,pk07,pk08,
pk09,pk10,pk11,pk12,pk13,pk14,pk15,pk16),
KEY pk(sk01,sk02,sk03,sk04,sk05,sk06,sk07,sk08,
sk09,sk10,sk11,sk12,sk13,sk14,sk15,sk16))
ROW_FORMAT=Compressed KEY_BLOCK_SIZE=4 ENGINE=InnoDB;
SET @r = repeat('a', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('b', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('c', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('d', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('e', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
DELETE from t1;
DROP TABLE t1;
#-- disable_query_log
#-- error 0,ER_UNKNOWN_SYSTEM_VARIABLE
#SET GLOBAL innodb_change_buffering_debug = 0;
#-- enable_query_log
# The following should fail in non-strict mode too.
# (The fix of Bug #50945 only affects REDUNDANT and COMPACT tables.)
SET SESSION innodb_strict_mode = off;
--replace_regex /> [0-9]*/> max_row_size/
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
DROP TABLE t1;
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII;
drop table t1;
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII;
drop table t1;
--replace_regex /> [0-9]*/> max_row_size/
CREATE TABLE t1(c text, PRIMARY KEY (c(440)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
DROP TABLE t1;
CREATE TABLE t1(c text, PRIMARY KEY (c(438)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
DROP TABLE t1;

View file

@ -1,3 +0,0 @@
--loose-innodb-sys-indexes
--loose-innodb-sys-tablespaces
--loose-innodb-sys-datafiles

View file

@ -1,461 +0,0 @@
# Tests for setting innodb-page-size=8k
--source include/have_innodb.inc
--source include/have_innodb_8k.inc
SET default_storage_engine=InnoDB;
--disable_query_log
let $MYSQLD_DATADIR = `select @@datadir`;
let $INNODB_PAGE_SIZE = `select @@innodb_page_size`;
call mtr.add_suppression("Cannot add field .* in table .* because after adding it, the row size is");
--enable_query_log
--echo # Test 1) Show the page size from Information Schema
--disable_warnings
SELECT variable_value FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_page_size';
--enable_warnings
--echo # Test 2) The number of buffer pool pages is dependent upon the page size.
--disable_warnings
--replace_result 1023 {checked_valid} 1024 {checked_valid}
SELECT variable_value FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
--enable_warnings
--echo # Test 3) Query some information_shema tables that are dependent upon
--echo # the page size.
# Show the metadata for tables in schema 'mysql'.
# Pulled from innodb-system-table-view.test
# The IDs of mysql.innodb_table_stats and mysql.innodb_index_stats are
# unpredictable. They depend on whether mtr has created the database for
# this test from scratch or is using a previously created database where
# those tables have been dropped and recreated. Since we cannot force mtr
# to use a freshly created database for this test we do not return the
# table or index IDs. We can return the space IS of mysql schema tables
# since they are created consistently during bootstrap.
SELECT t.name table_name, t.n_cols, t.flag table_flags,
i.name index_name, i.page_no root_page, i.type,
i.n_fields, i.merge_threshold
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t,
INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
WHERE t.table_id = i.table_id
AND t.name LIKE 'mysql%'
ORDER BY t.name, i.index_id;
CREATE TABLE t1 (a INT KEY, b TEXT) ROW_FORMAT=REDUNDANT ENGINE=innodb;
CREATE TABLE t2 (a INT KEY, b TEXT) ROW_FORMAT=COMPACT ENGINE=innodb;
CREATE TABLE t3 (a INT KEY, b TEXT) ROW_FORMAT=COMPRESSED ENGINE=innodb;
CREATE TABLE t4 (a INT KEY, b TEXT) ROW_FORMAT=DYNAMIC ENGINE=innodb;
# Show the metadata for tables in schema 'test'.
# Do not return the space ID since this tablespace may have existed before
# this test runs. The root page number of each index should be consistent
# within a file-per-table tablespace.
SELECT t.name table_name, t.n_cols, t.flag table_flags,
i.name index_name, i.page_no root_page, i.type,
i.n_fields, i.merge_threshold
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t,
INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
WHERE t.table_id = i.table_id
AND t.name LIKE 'test%'
ORDER BY t.name, i.name;
--source suite/innodb/include/show_i_s_tablespaces.inc
DROP TABLE t1, t2, t3, t4;
--echo # Test 4) The maximum row size is dependent upon the page size.
--echo # Redundant: 4027, Compact: 4030.
--echo # Compressed: 4030, Dynamic: 4030.
--echo # Each row format has its own amount of overhead that
--echo # varies depending on number of fields and other overhead.
SET SESSION innodb_strict_mode = ON;
# Redundant table; 3955 bytes with 20 CHAR fields
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(155)
) ROW_FORMAT=redundant;
DROP TABLE t1;
--replace_regex /> [0-9]*/> max_row_size/
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(156)
) ROW_FORMAT=redundant;
# Compact table; 4002 bytes with 20 CHAR fields
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(202)
) ROW_FORMAT=compact;
DROP TABLE t1;
--replace_regex /> [0-9]*/> max_row_size/
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(203)
) ROW_FORMAT=compact;
# Compressed table; 3905 bytes with 20 CHAR fields
# Bug#13391353 Limit is 3903 on 32-Linux only
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(103)
) ROW_FORMAT=compressed;
DROP TABLE t1;
--replace_regex /> [0-9]*/> max_row_size/
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(106)
) ROW_FORMAT=compressed;
# Dynamic table; 4002 bytes with 20 CHAR fields
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(202)
) ROW_FORMAT=dynamic;
DROP TABLE t1;
--replace_regex /> [0-9]*/> max_row_size/
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(203)
) ROW_FORMAT=dynamic;
#
# Test the maximum key length
# Moved from innodb-index.test since each page size has its own max key length.
# Max Key Length is 1536 for 8k pages.
#
# InnoDB assumes 3 bytes for each UTF8 character.
#
CREATE TABLE t1 (a varchar(128) character set utf8,
b varchar(128) character set utf8,
c varchar(128) character set utf8,
d varchar(128) character set utf8,
PRIMARY KEY (a,b,c,d))
ENGINE=innodb;
DROP TABLE t1;
--error ER_TOO_LONG_KEY
CREATE TABLE t1 (a varchar(128) character set utf8,
b varchar(128) character set utf8,
c varchar(128) character set utf8,
d varchar(129) character set utf8,
PRIMARY KEY (a,b,c,d))
ENGINE=innodb;
CREATE TABLE t1 (a varchar(128) character set utf8,
b varchar(128) character set utf8,
c varchar(128) character set utf8,
d varchar(128) character set utf8,
e varchar(128) character set utf8,
PRIMARY KEY (a), KEY (b,c,d,e))
ENGINE=innodb;
DROP TABLE t1;
--error ER_TOO_LONG_KEY
CREATE TABLE t1 (a varchar(128) character set utf8,
b varchar(128) character set utf8,
c varchar(128) character set utf8,
d varchar(128) character set utf8,
e varchar(129) character set utf8,
PRIMARY KEY (a), KEY (b,c,d,e))
ENGINE=innodb;
--echo # Test 5) Make sure that KEY_BLOCK_SIZE=8, 4, 2 & 1 are all
--echo # accepted and that KEY_BLOCK_SIZE=16 is rejected in
--echo # strict mode and converted to 8 in non-strict mode.
SET SESSION innodb_strict_mode = ON;
--error ER_CANT_CREATE_TABLE
CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
SHOW WARNINGS;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
ALTER TABLE t1 KEY_BLOCK_SIZE=4;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
ALTER TABLE t1 KEY_BLOCK_SIZE=2;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
ALTER TABLE t1 KEY_BLOCK_SIZE=1;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
ALTER TABLE t1 KEY_BLOCK_SIZE=0;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
DROP TABLE t1;
SET SESSION innodb_strict_mode = OFF;
CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
DROP TABLE t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
DROP TABLE t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
ALTER TABLE t1 KEY_BLOCK_SIZE=2;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
ALTER TABLE t1 KEY_BLOCK_SIZE=1;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
ALTER TABLE t1 KEY_BLOCK_SIZE=0;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
DROP TABLE t1;
--echo # Test 6) Make sure that KEY_BLOCK_SIZE = 8 and 16
--echo # are rejected when innodb_file_per_table=OFF
# Moved from innodb-zip.test
SET SESSION innodb_strict_mode = ON;
SET GLOBAL innodb_file_per_table = OFF;
SHOW VARIABLES LIKE 'innodb_file_per_table';
--error ER_CANT_CREATE_TABLE
CREATE TABLE t4 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=8;
SHOW WARNINGS;
--error ER_CANT_CREATE_TABLE
CREATE TABLE t5 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=16;
SHOW WARNINGS;
SET GLOBAL innodb_file_per_table = ON;
--echo # Test 7) Not included here; 16k only
--echo # Test 8) Test creating a table that could lead to undo log overflow.
CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,
h blob,i blob,j blob,k blob,l blob,m blob,n blob,
o blob,p blob,q blob,r blob,s blob,t blob,u blob)
ENGINE=InnoDB ROW_FORMAT=dynamic;
SET @a = repeat('a', 767);
SET @b = repeat('b', 767);
SET @c = repeat('c', 767);
SET @d = repeat('d', 767);
SET @e = repeat('e', 767);
# With no indexes defined, we can update all columns to max key part length.
INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a);
UPDATE t1 SET a=@b,b=@b,c=@b,d=@b,e=@b,f=@b,g=@b,h=@b,i=@b,j=@b,
k=@b,l=@b,m=@b,n=@b,o=@b,p=@b,q=@b,r=@b,s=@b,t=@b,u=@b;
# With this many indexes defined, we can still update all fields.
CREATE INDEX t1a ON t1 (a(767));
CREATE INDEX t1b ON t1 (b(767));
UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c,
k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c;
# Add one more index and the UNDO record becomes too big to update all columns.
# But a single transaction can update the columns in separate statements.
# because the UNDO records will be smaller.
CREATE INDEX t1c ON t1 (c(767));
BEGIN;
UPDATE t1 SET a=@d,b=@d,c=@d,d=@d,e=@d,f=@d,g=@d,h=@d,i=@d,j=@d,
k=@d,l=@d,m=@d,n=@d,o=@d,p=@d,q=@d,r=@d,s=@d,t=@d,u=@d;
ROLLBACK;
BEGIN;
UPDATE t1 SET a=@d,b=@d,c=@d,d=@d,e=@d;
UPDATE t1 SET f=@d,g=@d,h=@d,i=@d,j=@d,k=@d,l=@d,m=@d,
n=@d,o=@d,p=@d,q=@d,r=@d,s=@d,t=@d,u=@d;
COMMIT;
# More indexes can still be added and a single field can still be updated
CREATE INDEX t1d ON t1 (d(767));
UPDATE t1 SET d=@e;
CREATE INDEX t1e ON t1 (e(767));
UPDATE t1 SET e=@e;
CREATE INDEX t1f ON t1 (f(767));
UPDATE t1 SET f=@e;
CREATE INDEX t1g ON t1 (g(767));
UPDATE t1 SET g=@e;
CREATE INDEX t1h ON t1 (h(767));
UPDATE t1 SET h=@e;
CREATE INDEX t1i ON t1 (i(767));
UPDATE t1 SET i=@e;
--replace_regex /> [0-9]*/> max_row_size/
CREATE INDEX t1k ON t1 (j(767));
# But it does allow a 500 byte index. And with this, we cannot
# update the record. This is a problem. It means that the DDL is
# allowed to create a table and a record that CANNOT be updated.
# See bug#12953735
--replace_regex /> [0-9]*/> max_row_size/
CREATE INDEX t1j ON t1 (j(500));
BEGIN;
UPDATE t1 SET j=@e;
ROLLBACK;
SHOW CREATE TABLE t1;
DROP TABLE t1;
#
# Bug #13336585 - INNODB: CHANGE BUFFERING WITH 4K PAGES CAN ASSERT
# IF SECONDARY KEY IS NEAR MAX
# If the secondary index tuple is close to half the page size,
# ibuf_insert_low() could return DB_TOO_BIG_RECORD, which is not expected
# in ibuf_insert(). In order to insure this does not happen, WL5756
# imposes a maximum key length of 768 for 4k pages and 1536 for 8k pages.
# The existing max key Size for 16k pages is 3072.
#
#-- disable_query_log
# The flag innodb_change_buffering_debug is only available in debug builds.
# It instructs InnoDB to try to evict pages from the buffer pool when
# change buffering is possible, so that the change buffer will be used
# whenever possible.
#-- error 0,ER_UNKNOWN_SYSTEM_VARIABLE
#SET @innodb_change_buffering_debug_orig = @@innodb_change_buffering_debug;
#-- error 0,ER_UNKNOWN_SYSTEM_VARIABLE
#SET GLOBAL innodb_change_buffering_debug = 1;
#-- enable_query_log
# make sure the largest possible key entry can be added to the insert buffer.
# Make enough records so that the root page is not a leaf page.
SET SESSION innodb_strict_mode = OFF;
CREATE TABLE t1(
pk01 varchar(96), pk02 varchar(96), pk03 varchar(96), pk04 varchar(96),
pk05 varchar(96), pk06 varchar(96), pk07 varchar(96), pk08 varchar(96),
pk09 varchar(96), pk10 varchar(96), pk11 varchar(96), pk12 varchar(96),
pk13 varchar(96), pk14 varchar(96), pk15 varchar(96), pk16 varchar(96),
sk01 varchar(96), sk02 varchar(96), sk03 varchar(96), sk04 varchar(96),
sk05 varchar(96), sk06 varchar(96), sk07 varchar(96), sk08 varchar(96),
sk09 varchar(96), sk10 varchar(96), sk11 varchar(96), sk12 varchar(96),
sk13 varchar(96), sk14 varchar(96), sk15 varchar(96), sk16 varchar(96),
PRIMARY KEY pk(pk01,pk02,pk03,pk04,pk05,pk06,pk07,pk08,
pk09,pk10,pk11,pk12,pk13,pk14,pk15,pk16),
KEY pk(sk01,sk02,sk03,sk04,sk05,sk06,sk07,sk08,
sk09,sk10,sk11,sk12,sk13,sk14,sk15,sk16))
ROW_FORMAT=Redundant ENGINE=InnoDB;
SET @r = repeat('a', 96);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('b', 96);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('c', 96);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('d', 96);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('e', 96);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
DELETE from t1;
DROP TABLE t1;
# Compressed tables do not compress parent pages. So the whole uncompressed
# secondary tuple including the primary key must be able to fit in half the
# compressed page size. This record length is enforced at index creation.
# So the only way to get an ibuf tuple too big is to make the KEY_BLOCK_SIZE
# the same as the page size.
CREATE TABLE t1(
pk01 varchar(96), pk02 varchar(96), pk03 varchar(96), pk04 varchar(96),
pk05 varchar(96), pk06 varchar(96), pk07 varchar(96), pk08 varchar(96),
pk09 varchar(96), pk10 varchar(96), pk11 varchar(96), pk12 varchar(96),
pk13 varchar(96), pk14 varchar(96), pk15 varchar(96), pk16 varchar(96),
sk01 varchar(96), sk02 varchar(96), sk03 varchar(96), sk04 varchar(96),
sk05 varchar(96), sk06 varchar(96), sk07 varchar(96), sk08 varchar(96),
sk09 varchar(96), sk10 varchar(96), sk11 varchar(96), sk12 varchar(96),
sk13 varchar(96), sk14 varchar(96), sk15 varchar(96), sk16 varchar(96),
PRIMARY KEY pk(pk01,pk02,pk03,pk04,pk05,pk06,pk07,pk08,
pk09,pk10,pk11,pk12,pk13,pk14,pk15,pk16),
KEY pk(sk01,sk02,sk03,sk04,sk05,sk06,sk07,sk08,
sk09,sk10,sk11,sk12,sk13,sk14,sk15,sk16))
ROW_FORMAT=Compressed KEY_BLOCK_SIZE=8 ENGINE=InnoDB;
SET @r = repeat('a', 96);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('b', 96);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('c', 96);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('d', 96);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('e', 96);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
DELETE from t1;
DROP TABLE t1;
#-- disable_query_log
#-- error 0,ER_UNKNOWN_SYSTEM_VARIABLE
#SET GLOBAL innodb_change_buffering_debug = 0;
#-- enable_query_log
# The following should fail in non-strict mode too.
# (The fix of Bug #50945 only affects REDUNDANT and COMPACT tables.)
SET SESSION innodb_strict_mode = off;
--replace_regex /> [0-9]*/> max_row_size/
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
DROP TABLE t1;
--replace_regex /> [0-9]*/> max_row_size/
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII;
DROP TABLE t1;
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII;
drop table t1;
--replace_regex /> [0-9]*/> max_row_size/
CREATE TABLE t1(c text, PRIMARY KEY (c(440)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
DROP TABLE t1;
CREATE TABLE t1(c text, PRIMARY KEY (c(438)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
DROP TABLE t1;

View file

@ -1,7 +1,4 @@
# Tests for setting innodb-page-size=16k; default value
--source include/big_test.inc
--source include/have_innodb.inc
--source include/have_innodb_16k.inc
--source include/innodb_page_size_small.inc
SET default_storage_engine=InnoDB;
--disable_query_log
@ -9,24 +6,11 @@ let $MYSQLD_DATADIR = `select @@datadir`;
let $INNODB_PAGE_SIZE = `select @@innodb_page_size`;
call mtr.add_suppression("Cannot add field .* in table .* because after adding it, the row size is");
# These values can change during the test
--enable_query_log
--echo # Test 1) Show the page size from Information Schema
--disable_warnings
SELECT variable_value FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_page_size';
--enable_warnings
--echo # Test 2) The number of buffer pool pages is dependent upon the page size.
#
# buffer pool pages is dependent upon buffer pool size and what other
# tests are run concurrently
#--disable_warnings
#--replace_result 1535 {checked_valid} 1536 {checked_valid}
#SELECT variable_value FROM information_schema.global_status
# WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
#--enable_warnings
--echo # Test 3) Query some information_shema tables that are dependent upon
--echo # the page size.
@ -69,13 +53,212 @@ SELECT t.name table_name, t.n_cols, t.flag table_flags,
DROP TABLE t1, t2, t3, t4;
--echo # Test 4) The maximum row size is dependent upon the page size.
--echo # Redundant: 8123, Compact: 8126.
--echo # Compressed: 8126, Dynamic: 8126.
--echo # Each row format has its own amount of overhead that
--echo # varies depending on number of fields and other overhead.
SET SESSION innodb_strict_mode = ON;
if ($INNODB_PAGE_SIZE == 4096) {
# Redundant table; 1927 bytes with 10 CHAR fields
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(127)
) ROW_FORMAT=redundant;
DROP TABLE t1;
--replace_regex /> [0-9]*/> max_row_size/
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(128)
) ROW_FORMAT=redundant;
# Compact table; 1955 bytes with 10 CHAR fields
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(155)
) ROW_FORMAT=compact;
DROP TABLE t1;
--replace_regex /> [0-9]*/> max_row_size/
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(156)
) ROW_FORMAT=compact;
# Compressed table; 1878 bytes with 10 CHAR fields
# Bug#13391353 Limit is 1876 on 32-Linux only
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(76)
) ROW_FORMAT=compressed;
DROP TABLE t1;
--replace_regex /> [0-9]*/> max_row_size/
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(79)
) ROW_FORMAT=compressed;
# Dynamic table; 1955 bytes with 10 CHAR fields
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(155)
) ROW_FORMAT=dynamic;
DROP TABLE t1;
--replace_regex /> [0-9]*/> max_row_size/
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(156)
) ROW_FORMAT=dynamic;
#
# Test the maximum key length
# Moved from innodb-index.test since each page size has its own max key length.
# Max Key Length is 1173 for 4k pages.
#
# InnoDB assumes 3 bytes for each UTF8 character.
#
CREATE TABLE t1 (a varchar(98) character set utf8,
b varchar(98) character set utf8,
c varchar(98) character set utf8,
d varchar(97) character set utf8,
PRIMARY KEY (a,b,c,d))
ENGINE=innodb;
DROP TABLE t1;
--error ER_TOO_LONG_KEY
CREATE TABLE t1 (a varchar(98) character set utf8,
b varchar(98) character set utf8,
c varchar(98) character set utf8,
d varchar(98) character set utf8,
PRIMARY KEY (a,b,c,d))
ENGINE=innodb;
CREATE TABLE t1 (a varchar(98) character set utf8,
b varchar(98) character set utf8,
c varchar(98) character set utf8,
d varchar(98) character set utf8,
e varchar(97) character set utf8,
PRIMARY KEY (a), KEY (b,c,d,e))
ENGINE=innodb;
DROP TABLE t1;
--error ER_TOO_LONG_KEY
CREATE TABLE t1 (a varchar(98) character set utf8,
b varchar(98) character set utf8,
c varchar(98) character set utf8,
d varchar(98) character set utf8,
e varchar(98) character set utf8,
PRIMARY KEY (a), KEY (b,c,d,e))
ENGINE=innodb;
}
if ($INNODB_PAGE_SIZE == 8192) {
# Redundant table; 3955 bytes with 20 CHAR fields
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(155)
) ROW_FORMAT=redundant;
DROP TABLE t1;
--replace_regex /> [0-9]*/> max_row_size/
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(156)
) ROW_FORMAT=redundant;
# Compact table; 4002 bytes with 20 CHAR fields
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(202)
) ROW_FORMAT=compact;
DROP TABLE t1;
--replace_regex /> [0-9]*/> max_row_size/
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(203)
) ROW_FORMAT=compact;
# Compressed table; 3905 bytes with 20 CHAR fields
# Bug#13391353 Limit is 3903 on 32-Linux only
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(103)
) ROW_FORMAT=compressed;
DROP TABLE t1;
--replace_regex /> [0-9]*/> max_row_size/
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(106)
) ROW_FORMAT=compressed;
# Dynamic table; 4002 bytes with 20 CHAR fields
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(202)
) ROW_FORMAT=dynamic;
DROP TABLE t1;
--replace_regex /> [0-9]*/> max_row_size/
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(203)
) ROW_FORMAT=dynamic;
#
# Test the maximum key length
# Moved from innodb-index.test since each page size has its own max key length.
# Max Key Length is 1536 for 8k pages.
#
# InnoDB assumes 3 bytes for each UTF8 character.
#
CREATE TABLE t1 (a varchar(128) character set utf8,
b varchar(128) character set utf8,
c varchar(128) character set utf8,
d varchar(128) character set utf8,
PRIMARY KEY (a,b,c,d))
ENGINE=innodb;
DROP TABLE t1;
--error ER_TOO_LONG_KEY
CREATE TABLE t1 (a varchar(128) character set utf8,
b varchar(128) character set utf8,
c varchar(128) character set utf8,
d varchar(129) character set utf8,
PRIMARY KEY (a,b,c,d))
ENGINE=innodb;
CREATE TABLE t1 (a varchar(128) character set utf8,
b varchar(128) character set utf8,
c varchar(128) character set utf8,
d varchar(128) character set utf8,
e varchar(128) character set utf8,
PRIMARY KEY (a), KEY (b,c,d,e))
ENGINE=innodb;
DROP TABLE t1;
--error ER_TOO_LONG_KEY
CREATE TABLE t1 (a varchar(128) character set utf8,
b varchar(128) character set utf8,
c varchar(128) character set utf8,
d varchar(128) character set utf8,
e varchar(129) character set utf8,
PRIMARY KEY (a), KEY (b,c,d,e))
ENGINE=innodb;
}
if ($INNODB_PAGE_SIZE == 16384) {
# Redundant table; 8011 bytes with 40 char fields
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
@ -214,12 +397,32 @@ CREATE TABLE t1 (a varchar(255) character set utf8,
f varchar(5) character set utf8,
PRIMARY KEY (a), KEY (b,c,d,e,f))
ENGINE=innodb;
}
--echo # Test 5) Make sure that KEY_BLOCK_SIZE=16, 8, 4, 2 & 1
--echo # are all accepted.
--echo # Test 5) KEY_BLOCK_SIZE validation
SET SESSION innodb_strict_mode = ON;
if ($INNODB_PAGE_SIZE == 4096) {
--error ER_CANT_CREATE_TABLE
CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
SHOW WARNINGS;
--error ER_CANT_CREATE_TABLE
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
SHOW WARNINGS;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED;
}
if ($INNODB_PAGE_SIZE == 8192) {
--error ER_CANT_CREATE_TABLE
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
SHOW WARNINGS;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
}
if ($INNODB_PAGE_SIZE == 16384) {
CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
@ -229,7 +432,7 @@ ALTER TABLE t1 KEY_BLOCK_SIZE=8;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
}
ALTER TABLE t1 KEY_BLOCK_SIZE=4;
SHOW WARNINGS;
SELECT table_name, row_format, create_options
@ -285,20 +488,20 @@ SELECT table_name, row_format, create_options
DROP TABLE t1;
--echo # Test 6) Make sure that KEY_BLOCK_SIZE = 8 and 16
--echo # are rejected when innodb_file_per_table=OFF
--echo # Test 6) KEY_BLOCK_SIZE with innodb_file_per_table=OFF
# Moved from innodb-zip.test
SET SESSION innodb_strict_mode = ON;
SET GLOBAL innodb_file_per_table = OFF;
SHOW VARIABLES LIKE 'innodb_file_per_table';
--error ER_ILLEGAL_HA,1005
--error ER_CANT_CREATE_TABLE
CREATE TABLE t4 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=8;
SHOW WARNINGS;
--error ER_ILLEGAL_HA,1005
--error ER_CANT_CREATE_TABLE
CREATE TABLE t5 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=16;
SHOW WARNINGS;
SET GLOBAL innodb_file_per_table = ON;
if ($INNODB_PAGE_SIZE == 16384) {
--echo # Test 7) This series of tests were moved from innodb-index to here
--echo # because the second alter table t1 assumes a 16k page size.
--echo # Moving the test allows the rest of innodb-index to be run on all
@ -409,6 +612,7 @@ EXPLAIN SELECT * FROM t1 WHERE b LIKE 'adfd%';
#
# end disabled45225_1
DROP TABLE t1;
}
--echo # Test 8) Test creating a table that could lead to undo log overflow.
CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,
@ -428,10 +632,12 @@ UPDATE t1 SET a=@b,b=@b,c=@b,d=@b,e=@b,f=@b,g=@b,h=@b,i=@b,j=@b,
# With this many indexes defined, we can still update all fields.
CREATE INDEX t1a ON t1 (a(767));
if ($INNODB_PAGE_SIZE == 16384) {
CREATE INDEX t1b ON t1 (b(767));
CREATE INDEX t1c ON t1 (c(767));
CREATE INDEX t1d ON t1 (d(767));
CREATE INDEX t1e ON t1 (e(767));
}
UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c,
k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c;
@ -452,6 +658,7 @@ COMMIT;
# More indexes can still be added and a single field can still be updated
CREATE INDEX t1g ON t1 (g(767));
UPDATE t1 SET g=@e;
if ($INNODB_PAGE_SIZE == 16384) {
CREATE INDEX t1h ON t1 (h(767));
UPDATE t1 SET h=@e;
CREATE INDEX t1i ON t1 (i(767));
@ -476,6 +683,7 @@ CREATE INDEX t1r ON t1 (r(767));
UPDATE t1 SET r=@e;
CREATE INDEX t1s ON t1 (s(767));
UPDATE t1 SET s=@e;
}
# Add one more index and we cannot update a column to its defined index length.
# This is a problem. It means that the DDL is allowed to create a table
@ -486,133 +694,25 @@ UPDATE t1 SET t=@e;
ROLLBACK;
CREATE INDEX t1u ON t1 (u(767));
if ($INNODB_PAGE_SIZE == 4096)
{
CREATE INDEX t1ut ON t1 (u(767));
CREATE INDEX t1st ON t1 (s(767));
}
if ($INNODB_PAGE_SIZE != 4096)
{
CREATE INDEX t1ut ON t1 (u(767), t(767));
CREATE INDEX t1st ON t1 (s(767), t(767));
}
SHOW CREATE TABLE t1;
DROP TABLE t1;
--echo # Bug #12429576 - Test an assertion failure on purge.
# This test is not in innodb_8k or innodb_4k since the bug is not about
# page size. It just tests the condition that caused the assertion.
CREATE TABLE t1_purge (
A int,
B blob, C blob, D blob, E blob,
F blob, G blob, H blob,
PRIMARY KEY (B(767), C(767), D(767), E(767), A),
INDEX (A)
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t1_purge VALUES (1,
REPEAT('b', 766), REPEAT('c', 766), REPEAT('d', 766), REPEAT('e', 766),
REPEAT('f', 766), REPEAT('g', 766), REPEAT('h', 766));
CREATE TABLE t2_purge (
A int PRIMARY KEY,
B blob, C blob, D blob, E blob,
F blob, G blob, H blob, I blob,
J blob, K blob, L blob,
INDEX (B(767))) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t2_purge VALUES (1,
REPEAT('b', 766), REPEAT('c', 766), REPEAT('d', 766), REPEAT('e', 766),
REPEAT('f', 766), REPEAT('g', 766), REPEAT('h', 766), REPEAT('i', 766),
REPEAT('j', 766), REPEAT('k', 766), REPEAT('l', 766));
CREATE TABLE t3_purge (
A int,
B varchar(800), C varchar(800), D varchar(800), E varchar(800),
F varchar(800), G varchar(800), H varchar(800),
PRIMARY KEY (B(767), C(767), D(767), E(767), A),
INDEX (A)
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t3_purge SELECT * FROM t1_purge;
CREATE TABLE t4_purge (
A int PRIMARY KEY,
B varchar(800), C varchar(800), D varchar(800), E varchar(800),
F varchar(800), G varchar(800), H varchar(800), I varchar(800),
J varchar(800), K varchar(800), L varchar(800),
INDEX (B(767))) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t4_purge SELECT * FROM t2_purge;
# This would trigger the failure (Bug #12429576)
# if purge gets a chance to run before DROP TABLE t1_purge, ....
DELETE FROM t1_purge;
DELETE FROM t2_purge;
DELETE FROM t3_purge;
DELETE FROM t4_purge;
# We need to activate the purge thread.
# Instead of doing a --sleep 10 now, do it once at the end.
# Bug#12637786 - Assertion hit; ut_ad(dict_index_is_clust(index));
# A secondary index tuple is found to be too long to fit into a page.
# This test is not in innodb_8k or innodb_4k since the bug is not about
# page size. It just tests the condition that caused the assertion.
SET @r=REPEAT('a',500);
CREATE TABLE t12637786(a int,
v1 varchar(500), v2 varchar(500), v3 varchar(500),
v4 varchar(500), v5 varchar(500), v6 varchar(500),
v7 varchar(500), v8 varchar(500), v9 varchar(500),
v10 varchar(500), v11 varchar(500), v12 varchar(500),
v13 varchar(500), v14 varchar(500), v15 varchar(500),
v16 varchar(500), v17 varchar(500), v18 varchar(500)
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
CREATE INDEX idx1 ON t12637786(a,v1);
INSERT INTO t12637786 VALUES(9,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
UPDATE t12637786 SET a=1000;
DELETE FROM t12637786;
# We need to activate the purge thread to make sure it does not assert and
# is able to clean up the old versions of secondary index entries.
# Instead of doing a --sleep 10 now for each test, do it once at the end.
--echo # Bug#12963823 - Test that the purge thread does not crash when
# the number of indexes has changed since the UNDO record was logged.
# This test is not in innodb_8k or innodb_4k since the bug is not about
# page size. It just tests the condition that caused the crash.
CREATE TABLE t12963823(a blob,b blob,c blob,d blob,e blob,f blob,g blob,h blob,
i blob,j blob,k blob,l blob,m blob,n blob,o blob,p blob)
ENGINE=innodb ROW_FORMAT=dynamic;
SET @r = REPEAT('a', 767);
INSERT INTO t12963823 VALUES (@r,@r,@r,@r, @r,@r,@r,@r, @r,@r,@r,@r, @r,@r,@r,@r);
CREATE INDEX ndx_a ON t12963823 (a(500));
CREATE INDEX ndx_b ON t12963823 (b(500));
CREATE INDEX ndx_c ON t12963823 (c(500));
CREATE INDEX ndx_d ON t12963823 (d(500));
CREATE INDEX ndx_e ON t12963823 (e(500));
CREATE INDEX ndx_f ON t12963823 (f(500));
CREATE INDEX ndx_k ON t12963823 (k(500));
CREATE INDEX ndx_l ON t12963823 (l(500));
SET @r = REPEAT('b', 500);
UPDATE t12963823 set a=@r,b=@r,c=@r,d=@r;
UPDATE t12963823 set e=@r,f=@r,g=@r,h=@r;
UPDATE t12963823 set i=@r,j=@r,k=@r,l=@r;
UPDATE t12963823 set m=@r,n=@r,o=@r,p=@r;
ALTER TABLE t12963823 DROP INDEX ndx_a;
ALTER TABLE t12963823 DROP INDEX ndx_b;
CREATE INDEX ndx_g ON t12963823 (g(500));
CREATE INDEX ndx_h ON t12963823 (h(500));
CREATE INDEX ndx_i ON t12963823 (i(500));
CREATE INDEX ndx_j ON t12963823 (j(500));
CREATE INDEX ndx_m ON t12963823 (m(500));
CREATE INDEX ndx_n ON t12963823 (n(500));
CREATE INDEX ndx_o ON t12963823 (o(500));
CREATE INDEX ndx_p ON t12963823 (p(500));
SHOW CREATE TABLE t12963823;
# We need to activate the purge thread at this point to see if it crashes.
# Instead of doing a --sleep 10 now for each test, do it once at the end.
--echo # Bug#12547647 UPDATE LOGGING COULD EXCEED LOG PAGE SIZE
# InnoDB cannot know that this undo record would be too big for the undo
# page. Too much of text field is stored in the clustered record in this
# DYNAMIC row formatted record.
# This test is not in innodb_8k or innodb_4k since the bug is not about
# page size. It just tests the condition that caused the hang.
SET SESSION innodb_strict_mode = ON;
CREATE TABLE bug12547647(
a int NOT NULL, b blob NOT NULL, c text,
PRIMARY KEY (b(10), a), INDEX (c(767)), INDEX(b(767))
@ -626,9 +726,127 @@ SHOW WARNINGS;
ROLLBACK;
DROP TABLE bug12547647;
#
# Bug #13336585 - INNODB: CHANGE BUFFERING WITH 4K PAGES CAN ASSERT
# IF SECONDARY KEY IS NEAR MAX
# If the secondary index tuple is close to half the page size,
# ibuf_insert_low() could return DB_TOO_BIG_RECORD, which is not expected
# in ibuf_insert(). In order to insure this does not happen, WL5756
# imposes a maximum key length of 768 for 4k pages and 1536 for 8k pages.
# The existing max key Size for 16k pages is 3072.
#
#-- disable_query_log
# The flag innodb_change_buffering_debug is only available in debug builds.
# It instructs InnoDB to try to evict pages from the buffer pool when
# change buffering is possible, so that the change buffer will be used
# whenever possible.
# This flag is not used currently since it exposes valgrind error in ibuf
# code with the following SQL
#-- error 0,ER_UNKNOWN_SYSTEM_VARIABLE
#SET @innodb_change_buffering_debug_orig = @@innodb_change_buffering_debug;
#-- error 0,ER_UNKNOWN_SYSTEM_VARIABLE
#SET GLOBAL innodb_change_buffering_debug = 1;
#-- enable_query_log
# make sure the largest possible key entry can be added to the insert buffer.
# Make enough records so that the root page is not a leaf page.
SET SESSION innodb_strict_mode = OFF;
CREATE TABLE t1(
pk01 varchar(48), pk02 varchar(48), pk03 varchar(48), pk04 varchar(48),
pk05 varchar(48), pk06 varchar(48), pk07 varchar(48), pk08 varchar(48),
pk09 varchar(48), pk10 varchar(48), pk11 varchar(48), pk12 varchar(48),
pk13 varchar(48), pk14 varchar(48), pk15 varchar(48), pk16 varchar(48),
sk01 varchar(48), sk02 varchar(48), sk03 varchar(48), sk04 varchar(48),
sk05 varchar(48), sk06 varchar(48), sk07 varchar(48), sk08 varchar(48),
sk09 varchar(48), sk10 varchar(48), sk11 varchar(48), sk12 varchar(48),
sk13 varchar(48), sk14 varchar(48), sk15 varchar(48), sk16 varchar(48),
PRIMARY KEY pk(pk01,pk02,pk03,pk04,pk05,pk06,pk07,pk08,
pk09,pk10,pk11,pk12,pk13,pk14,pk15,pk16),
KEY pk(sk01,sk02,sk03,sk04,sk05,sk06,sk07,sk08,
sk09,sk10,sk11,sk12,sk13,sk14,sk15,sk16))
ROW_FORMAT=Redundant ENGINE=InnoDB;
SET @r = repeat('a', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('b', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('c', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('d', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('e', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
DELETE from t1;
DROP TABLE t1;
# Compressed tables do not compress parent pages. So the whole uncompressed
# secondary tuple including the primary key must be able to fit in half the
# compressed page size. This record length is enforced at index creation.
# So the only way to get an ibuf tuple too big is to make the KEY_BLOCK_SIZE
# the same as the page size.
CREATE TABLE t1(
pk01 varchar(48), pk02 varchar(48), pk03 varchar(48), pk04 varchar(48),
pk05 varchar(48), pk06 varchar(48), pk07 varchar(48), pk08 varchar(48),
pk09 varchar(48), pk10 varchar(48), pk11 varchar(48), pk12 varchar(48),
pk13 varchar(48), pk14 varchar(48), pk15 varchar(48), pk16 varchar(48),
sk01 varchar(48), sk02 varchar(48), sk03 varchar(48), sk04 varchar(48),
sk05 varchar(48), sk06 varchar(48), sk07 varchar(48), sk08 varchar(48),
sk09 varchar(48), sk10 varchar(48), sk11 varchar(48), sk12 varchar(48),
sk13 varchar(48), sk14 varchar(48), sk15 varchar(48), sk16 varchar(48),
PRIMARY KEY pk(pk01,pk02,pk03,pk04,pk05,pk06,pk07,pk08,
pk09,pk10,pk11,pk12,pk13,pk14,pk15,pk16),
KEY pk(sk01,sk02,sk03,sk04,sk05,sk06,sk07,sk08,
sk09,sk10,sk11,sk12,sk13,sk14,sk15,sk16))
ROW_FORMAT=Compressed KEY_BLOCK_SIZE=4 ENGINE=InnoDB;
SET @r = repeat('a', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('b', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('c', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('d', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
SET @r = repeat('e', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
DELETE from t1;
DROP TABLE t1;
#-- disable_query_log
#-- error 0,ER_UNKNOWN_SYSTEM_VARIABLE
#SET GLOBAL innodb_change_buffering_debug = 0;
#-- enable_query_log
# The following should fail in non-strict mode too.
# (The fix of Bug #50945 only affects REDUNDANT and COMPACT tables.)
SET SESSION innodb_strict_mode = off;
if ($INNODB_PAGE_SIZE == 4096)
{
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
DROP TABLE t1;
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII;
DROP TABLE t1;
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII;
}
if ($INNODB_PAGE_SIZE != 4096)
{
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767),d(767)))
@ -643,7 +861,8 @@ CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII;
drop table t1;
}
DROP TABLE t1;
CREATE TABLE t1(c text, PRIMARY KEY (c(440)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
DROP TABLE t1;
@ -651,62 +870,3 @@ CREATE TABLE t1(c text, PRIMARY KEY (c(438)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
DROP TABLE t1;
--echo #
--echo # Bug#56862 Execution of a query that uses index merge returns a wrong result
--echo #
# Moved to here from innodb_mysql.test. Some PB3 systems sporadically
# had timeouts doing this with smaller page sizes.
CREATE TABLE t1 (
pk int NOT NULL AUTO_INCREMENT PRIMARY KEY,
a int,
b int,
INDEX idx(a))
ENGINE=INNODB;
INSERT INTO t1(a,b) VALUES
(11, 1100), (2, 200), (1, 100), (14, 1400), (5, 500),
(3, 300), (17, 1700), (4, 400), (12, 1200), (8, 800),
(6, 600), (18, 1800), (9, 900), (10, 1000), (7, 700),
(13, 1300), (15, 1500), (19, 1900), (16, 1600), (20, 2000);
INSERT INTO t1(a,b) SELECT a+20, b+2000 FROM t1;
INSERT INTO t1(a,b) SELECT a+40, b+4000 FROM t1;
INSERT INTO t1(a,b) SELECT a+80, b+8000 FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1 VALUES (1000000, 0, 0);
set @optimizer_switch_saved=@@optimizer_switch;
SET SESSION optimizer_switch='derived_merge=off';
SET SESSION sort_buffer_size = 1024*36;
EXPLAIN
SELECT COUNT(*) FROM
(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
SELECT COUNT(*) FROM
(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
set @@optimizer_switch=@optimizer_switch_saved;
SET SESSION sort_buffer_size = DEFAULT;
DROP TABLE t1;
# The tests that uses these tables required the purge thread to run.
# Just in case it has not by now, provide a 10 second wait.
--sleep 10
DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge;
DROP TABLE t12637786;
DROP TABLE t12963823;

View file

@ -90,3 +90,17 @@ check table t2;
Table Op Msg_type Msg_text
test.t2 check status OK
DROP TABLE t1,t2;
#
# MDEV-17576
# Assertion `share->reopen == 1' failed in maria_extra upon ALTER on
# Aria table with triggers and locks
#
CREATE TABLE t1 (a INT) ENGINE=Aria;
CREATE TRIGGER tr BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t1 SELECT * FROM t1;
LOCK TABLE t1 WRITE;
ALTER TABLE t1 FORCE, LOCK=EXCLUSIVE;
DROP TRIGGER tr;
DROP TABLE t1;
#
# End of 10.2 test
#

View file

@ -11,7 +11,7 @@ drop table if exists t1;
CREATE TABLE t1 (pk INT, d DATETIME, PRIMARY KEY(pk), KEY(d)) ENGINE=Aria;
ALTER TABLE t1 DISABLE KEYS;
INSERT INTO t1 VALUES (1,'2000-01-01 22:22:22'),(2,'2012-12-21 12:12:12');
INSERT INTO t1 VALUES (3, '2008-07-24');
INSERT INTO t1 VALUES (3, '2008-07-24');
ALTER TABLE t1 ENABLE KEYS;
SELECT t1a.pk FROM t1 AS t1a LEFT JOIN t1 AS t1b ON t1a.pk = t1b.pk;
@ -74,6 +74,19 @@ check table t1;
check table t2;
DROP TABLE t1,t2;
#
# End of 10.2 tests
#
--echo #
--echo # MDEV-17576
--echo # Assertion `share->reopen == 1' failed in maria_extra upon ALTER on
--echo # Aria table with triggers and locks
--echo #
CREATE TABLE t1 (a INT) ENGINE=Aria;
CREATE TRIGGER tr BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t1 SELECT * FROM t1;
LOCK TABLE t1 WRITE;
ALTER TABLE t1 FORCE, LOCK=EXCLUSIVE;
DROP TRIGGER tr;
DROP TABLE t1;
--echo #
--echo # End of 10.2 test
--echo #

View file

@ -0,0 +1,13 @@
#
# MDEV-14996
# Assertion `!thd->get_stmt_da()->is_sent() ||
# thd->killed == KILL_CONNECTION' failed in ha_maria::external_lock
#
CREATE TABLE t1 (a INT) ENGINE=Aria;
connect con1,localhost,root,,;
FLUSH TABLE t1 FOR EXPORT;
KILL CONNECTION_ID();
ERROR 70100: Connection was killed
disconnect con1;
connection default;
DROP TABLE t1;

View file

@ -0,0 +1,14 @@
--echo #
--echo # MDEV-14996
--echo # Assertion `!thd->get_stmt_da()->is_sent() ||
--echo # thd->killed == KILL_CONNECTION' failed in ha_maria::external_lock
--echo #
CREATE TABLE t1 (a INT) ENGINE=Aria;
--connect (con1,localhost,root,,)
FLUSH TABLE t1 FOR EXPORT;
--error ER_CONNECTION_KILLED
KILL CONNECTION_ID();
--disconnect con1
--connection default
DROP TABLE t1;

View file

@ -2,5 +2,5 @@ create table t1(c1 int) engine=InnoDB;
INSERT INTO t1 VALUES(1);
# xtrabackup backup
select * from t1;
ERROR 42S02: Table 'test.t1' doesn't exist in engine
ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
drop table t1;

View file

@ -30,7 +30,6 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir
rmdir $targetdir;
--error ER_NO_SUCH_TABLE_IN_ENGINE
--error ER_GET_ERRNO
select * from t1;
drop table t1;

View file

@ -876,6 +876,20 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON,FORCE
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_ENCRYPT_TEMPORARY_TABLES
SESSION_VALUE NULL
GLOBAL_VALUE OFF
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE OFF
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Enrypt the temporary table data.
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_FAST_SHUTDOWN
SESSION_VALUE NULL
GLOBAL_VALUE 1

View file

@ -20,6 +20,7 @@
#include <mntent.h>
#include <sql_class.h>
#include <table.h>
#include <sql_acl.h> /* check_global_access() */
bool schema_table_store_record(THD *thd, TABLE *table);
@ -84,6 +85,9 @@ int disks_fill_table(THD* pThd, TABLE_LIST* pTables, Item* pCond)
int rv = 1;
TABLE* pTable = pTables->table;
if (check_global_access(pThd, FILE_ACL, true))
return 0;
FILE* pFile = setmntent("/etc/mtab", "r");
if (pFile)
@ -145,11 +149,11 @@ maria_declare_plugin(disks)
PLUGIN_LICENSE_GPL, /* license type */
disks_table_init, /* init function */
NULL, /* deinit function */
0x0100, /* version = 1.0 */
0x0101, /* version = 1.1 */
NULL, /* no status variables */
NULL, /* no system variables */
"1.0", /* String version representation */
MariaDB_PLUGIN_MATURITY_BETA /* Maturity (see include/mysql/plugin.h)*/
"1.1", /* String version representation */
MariaDB_PLUGIN_MATURITY_STABLE /* Maturity (see include/mysql/plugin.h)*/
}
mysql_declare_plugin_end;

View file

@ -0,0 +1,22 @@
#
# MDEV-18328: Make DISKS plugin check some privilege to access
# information_schema.DISKS table
#
CREATE USER user1@localhost;
GRANT SELECT ON *.* TO user1@localhost;
connect con1,localhost,user1,,;
connection con1;
select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
sum(Total) > sum(Available) sum(Total)>sum(Used)
NULL NULL
disconnect con1;
connection default;
GRANT FILE ON *.* TO user1@localhost;
connect con1,localhost,user1,,;
connection con1;
select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
sum(Total) > sum(Available) sum(Total)>sum(Used)
1 1
connection default;
DROP USER user1@localhost;
# End of 10.1 tests

View file

@ -0,0 +1,25 @@
source include/not_embedded.inc;
--echo #
--echo # MDEV-18328: Make DISKS plugin check some privilege to access
--echo # information_schema.DISKS table
--echo #
CREATE USER user1@localhost;
GRANT SELECT ON *.* TO user1@localhost;
connect (con1,localhost,user1,,);
connection con1;
select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
disconnect con1;
connection default;
GRANT FILE ON *.* TO user1@localhost;
connect (con1,localhost,user1,,);
connection con1;
select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
connection default;
DROP USER user1@localhost;
--echo # End of 10.1 tests

View file

@ -15,7 +15,7 @@
#define PLUGIN_VERSION 0x104
#define PLUGIN_STR_VERSION "1.4.6"
#define PLUGIN_STR_VERSION "1.4.7"
#define _my_thread_var loc_thread_var
@ -290,7 +290,7 @@ static unsigned long long file_rotate_size;
static unsigned int rotations;
static my_bool rotate= TRUE;
static char logging;
static int internal_stop_logging= 0;
static volatile int internal_stop_logging= 0;
static char incl_user_buffer[1024];
static char excl_user_buffer[1024];
static char *big_buffer= NULL;
@ -536,16 +536,20 @@ static struct st_mysql_show_var audit_status[]=
#if defined(HAVE_PSI_INTERFACE) && !defined(FLOGGER_NO_PSI)
/* These belong to the service initialization */
static PSI_mutex_key key_LOCK_operations;
static PSI_mutex_key key_LOCK_atomic;
static PSI_mutex_key key_LOCK_bigbuffer;
static PSI_mutex_info mutex_key_list[]=
{
{ &key_LOCK_operations, "SERVER_AUDIT_plugin::lock_operations",
PSI_FLAG_GLOBAL},
{ &key_LOCK_atomic, "SERVER_AUDIT_plugin::lock_atomic",
PSI_FLAG_GLOBAL},
{ &key_LOCK_bigbuffer, "SERVER_AUDIT_plugin::lock_bigbuffer",
PSI_FLAG_GLOBAL}
};
#endif
static mysql_mutex_t lock_operations;
static mysql_mutex_t lock_atomic;
static mysql_mutex_t lock_bigbuffer;
/* The Percona server and partly MySQL don't support */
@ -556,6 +560,14 @@ static mysql_mutex_t lock_bigbuffer;
/* worths doing. */
#define CLIENT_ERROR if (!started_mysql) my_printf_error
#define ADD_ATOMIC(x, a) \
do { \
flogger_mutex_lock(&lock_atomic); \
x+= a; \
flogger_mutex_unlock(&lock_atomic); \
} while (0)
static uchar *getkey_user(const char *entry, size_t *length,
my_bool nu __attribute__((unused)) )
{
@ -734,20 +746,20 @@ static int user_coll_fill(struct user_coll *c, char *users,
if (cmp_user && take_over_cmp)
{
internal_stop_logging= 1;
ADD_ATOMIC(internal_stop_logging, 1);
CLIENT_ERROR(1, "User '%.*s' was removed from the"
" server_audit_excl_users.",
MYF(ME_JUST_WARNING), (int) cmp_length, users);
internal_stop_logging= 0;
ADD_ATOMIC(internal_stop_logging, -1);
blank_user(cmp_user);
refill_cmp_coll= 1;
}
else if (cmp_user)
{
internal_stop_logging= 1;
ADD_ATOMIC(internal_stop_logging, 1);
CLIENT_ERROR(1, "User '%.*s' is in the server_audit_incl_users, "
"so wasn't added.", MYF(ME_JUST_WARNING), (int) cmp_length, users);
internal_stop_logging= 0;
ADD_ATOMIC(internal_stop_logging, -1);
remove_user(users);
continue;
}
@ -1255,23 +1267,30 @@ static void change_connection(struct connection_info *cn,
event->ip, event->ip_length);
}
static int write_log(const char *message, size_t len)
static int write_log(const char *message, size_t len, int take_lock)
{
int result= 0;
if (take_lock)
flogger_mutex_lock(&lock_operations);
if (output_type == OUTPUT_FILE)
{
if (logfile &&
(is_active= (logger_write(logfile, message, len) == (int)len)))
return 0;
(is_active= (logger_write(logfile, message, len) == (int) len)))
goto exit;
++log_write_failures;
return 1;
result= 1;
}
else if (output_type == OUTPUT_SYSLOG)
{
syslog(syslog_facility_codes[syslog_facility] |
syslog_priority_codes[syslog_priority],
"%s %.*s", syslog_info, (int)len, message);
"%s %.*s", syslog_info, (int) len, message);
}
return 0;
exit:
if (take_lock)
flogger_mutex_unlock(&lock_operations);
return result;
}
@ -1330,7 +1349,7 @@ static int log_connection(const struct connection_info *cn,
csize+= my_snprintf(message+csize, sizeof(message) - 1 - csize,
",%.*s,,%d", cn->db_length, cn->db, event->status);
message[csize]= '\n';
return write_log(message, csize + 1);
return write_log(message, csize + 1, 1);
}
@ -1351,7 +1370,7 @@ static int log_connection_event(const struct mysql_event_connection *event,
csize+= my_snprintf(message+csize, sizeof(message) - 1 - csize,
",%.*s,,%d", event->database.length, event->database.str, event->status);
message[csize]= '\n';
return write_log(message, csize + 1);
return write_log(message, csize + 1, 1);
}
@ -1480,21 +1499,28 @@ no_password:
static int do_log_user(const char *name)
static int do_log_user(const char *name, int take_lock)
{
size_t len;
int result;
if (!name)
return 0;
len= strlen(name);
if (take_lock)
flogger_mutex_lock(&lock_operations);
if (incl_user_coll.n_users)
return coll_search(&incl_user_coll, name, len) != 0;
result= coll_search(&incl_user_coll, name, len) != 0;
else if (excl_user_coll.n_users)
result= coll_search(&excl_user_coll, name, len) == 0;
else
result= 1;
if (excl_user_coll.n_users)
return coll_search(&excl_user_coll, name, len) == 0;
return 1;
if (take_lock)
flogger_mutex_unlock(&lock_operations);
return result;
}
@ -1591,7 +1617,7 @@ not_in_list:
static int log_statement_ex(const struct connection_info *cn,
time_t ev_time, unsigned long thd_id,
const char *query, unsigned int query_len,
int error_code, const char *type)
int error_code, const char *type, int take_lock)
{
size_t csize;
char message_loc[1024];
@ -1739,7 +1765,7 @@ do_log_query:
csize+= my_snprintf(message+csize, message_size - 1 - csize,
"\',%d", error_code);
message[csize]= '\n';
result= write_log(message, csize + 1);
result= write_log(message, csize + 1, take_lock);
if (message == big_buffer)
flogger_mutex_unlock(&lock_bigbuffer);
@ -1753,7 +1779,7 @@ static int log_statement(const struct connection_info *cn,
{
return log_statement_ex(cn, event->general_time, event->general_thread_id,
event->general_query, event->general_query_length,
event->general_error_code, type);
event->general_error_code, type, 1);
}
@ -1775,7 +1801,7 @@ static int log_table(const struct connection_info *cn,
",%.*s,%.*s,",event->database.length, event->database.str,
event->table.length, event->table.str);
message[csize]= '\n';
return write_log(message, csize + 1);
return write_log(message, csize + 1, 1);
}
@ -1799,7 +1825,7 @@ static int log_rename(const struct connection_info *cn,
event->new_database.length, event->new_database.str,
event->new_table.length, event->new_table.str);
message[csize]= '\n';
return write_log(message, csize + 1);
return write_log(message, csize + 1, 1);
}
@ -1991,8 +2017,6 @@ void auditing(MYSQL_THD thd, unsigned int event_class, const void *ev)
if (!thd || internal_stop_logging)
return;
flogger_mutex_lock(&lock_operations);
if (maria_55_started && debug_server_started &&
event_class == MYSQL_AUDIT_GENERAL_CLASS)
{
@ -2031,7 +2055,7 @@ void auditing(MYSQL_THD thd, unsigned int event_class, const void *ev)
}
if (event_class == MYSQL_AUDIT_GENERAL_CLASS && FILTER(EVENT_QUERY) &&
cn && (cn->log_always || do_log_user(cn->user)))
cn && (cn->log_always || do_log_user(cn->user, 1)))
{
const struct mysql_event_general *event =
(const struct mysql_event_general *) ev;
@ -2051,7 +2075,7 @@ void auditing(MYSQL_THD thd, unsigned int event_class, const void *ev)
{
const struct mysql_event_table *event =
(const struct mysql_event_table *) ev;
if (do_log_user(event->user))
if (do_log_user(event->user, 1))
{
switch (event->event_subclass)
{
@ -2115,7 +2139,6 @@ exit_func:
break;
}
}
flogger_mutex_unlock(&lock_operations);
}
@ -2384,6 +2407,7 @@ static int server_audit_init(void *p __attribute__((unused)))
PSI_server->register_mutex("server_audit", mutex_key_list, 1);
#endif
flogger_mutex_init(key_LOCK_operations, &lock_operations, MY_MUTEX_INIT_FAST);
flogger_mutex_init(key_LOCK_operations, &lock_atomic, MY_MUTEX_INIT_FAST);
flogger_mutex_init(key_LOCK_operations, &lock_bigbuffer, MY_MUTEX_INIT_FAST);
coll_init(&incl_user_coll);
@ -2471,6 +2495,7 @@ static int server_audit_deinit(void *p __attribute__((unused)))
(void) free(big_buffer);
flogger_mutex_destroy(&lock_operations);
flogger_mutex_destroy(&lock_atomic);
flogger_mutex_destroy(&lock_bigbuffer);
error_header();
@ -2563,7 +2588,7 @@ static void log_current_query(MYSQL_THD thd)
{
cn->log_always= 1;
log_statement_ex(cn, cn->query_time, thd_get_thread_id(thd),
cn->query, cn->query_length, 0, "QUERY");
cn->query, cn->query_length, 0, "QUERY", 0);
cn->log_always= 0;
}
}
@ -2575,12 +2600,13 @@ static void update_file_path(MYSQL_THD thd,
{
char *new_name= (*(char **) save) ? *(char **) save : empty_str;
if (!maria_55_started || !debug_server_started)
flogger_mutex_lock(&lock_operations);
internal_stop_logging= 1;
ADD_ATOMIC(internal_stop_logging, 1);
error_header();
fprintf(stderr, "Log file name was changed to '%s'.\n", new_name);
if (!maria_55_started || !debug_server_started)
flogger_mutex_lock(&lock_operations);
if (logging)
log_current_query(thd);
@ -2589,7 +2615,6 @@ static void update_file_path(MYSQL_THD thd,
char *sav_path= file_path;
file_path= new_name;
internal_stop_logging= 1;
stop_logging();
if (start_logging())
{
@ -2605,16 +2630,15 @@ static void update_file_path(MYSQL_THD thd,
}
goto exit_func;
}
internal_stop_logging= 0;
}
strncpy(path_buffer, new_name, sizeof(path_buffer)-1);
path_buffer[sizeof(path_buffer)-1]= 0;
file_path= path_buffer;
exit_func:
internal_stop_logging= 0;
if (!maria_55_started || !debug_server_started)
flogger_mutex_unlock(&lock_operations);
ADD_ATOMIC(internal_stop_logging, -1);
}
@ -2745,8 +2769,8 @@ static void update_output_type(MYSQL_THD thd,
if (output_type == new_output_type)
return;
ADD_ATOMIC(internal_stop_logging, 1);
flogger_mutex_lock(&lock_operations);
internal_stop_logging= 1;
if (logging)
{
log_current_query(thd);
@ -2760,8 +2784,8 @@ static void update_output_type(MYSQL_THD thd,
if (logging)
start_logging();
internal_stop_logging= 0;
flogger_mutex_unlock(&lock_operations);
ADD_ATOMIC(internal_stop_logging, -1);
}
@ -2809,9 +2833,9 @@ static void update_logging(MYSQL_THD thd,
if (new_logging == logging)
return;
ADD_ATOMIC(internal_stop_logging, 1);
if (!maria_55_started || !debug_server_started)
flogger_mutex_lock(&lock_operations);
internal_stop_logging= 1;
if ((logging= new_logging))
{
start_logging();
@ -2827,9 +2851,9 @@ static void update_logging(MYSQL_THD thd,
stop_logging();
}
internal_stop_logging= 0;
if (!maria_55_started || !debug_server_started)
flogger_mutex_unlock(&lock_operations);
ADD_ATOMIC(internal_stop_logging, -1);
}
@ -2841,16 +2865,16 @@ static void update_mode(MYSQL_THD thd __attribute__((unused)),
if (mode_readonly || new_mode == mode)
return;
ADD_ATOMIC(internal_stop_logging, 1);
if (!maria_55_started || !debug_server_started)
flogger_mutex_lock(&lock_operations);
internal_stop_logging= 1;
mark_always_logged(thd);
error_header();
fprintf(stderr, "Logging mode was changed from %d to %d.\n", mode, new_mode);
mode= new_mode;
internal_stop_logging= 0;
if (!maria_55_started || !debug_server_started)
flogger_mutex_unlock(&lock_operations);
ADD_ATOMIC(internal_stop_logging, -1);
}

View file

@ -286,6 +286,7 @@ public:
virtual const char* func_name() const { return "isnottrue"; }
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_isnottrue>(thd, this); }
bool eval_not_null_tables(void *) { not_null_tables_cache= 0; return false; }
};
@ -317,6 +318,7 @@ public:
virtual const char* func_name() const { return "isnotfalse"; }
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_isnotfalse>(thd, this); }
bool eval_not_null_tables(void *) { not_null_tables_cache= 0; return false; }
};

View file

@ -461,6 +461,17 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
*/
if ((save_compress= net->compress))
net->compress= 2;
/*
Sometimes, we send errors "out-of-band", e.g ER_CONNECTION_KILLED
on an idle connection. The current protocol "sequence number" is 0,
however some client drivers would however always expect packets
coming from server to have seq_no > 0, due to missing awareness
of "out-of-band" operations. Make these clients happy.
*/
if (!net->pkt_nr)
net->pkt_nr= 1;
ret= net_write_command(net,(uchar) 255, (uchar*) "", 0, (uchar*) buff,
length);
net->compress= save_compress;

View file

@ -119,11 +119,26 @@ void mysql_audit_acquire_plugins(THD *thd, ulong *event_class_mask)
{
plugin_foreach(thd, acquire_plugins, MYSQL_AUDIT_PLUGIN, event_class_mask);
add_audit_mask(thd->audit_class_mask, event_class_mask);
thd->audit_plugin_version= global_plugin_version;
}
DBUG_VOID_RETURN;
}
/**
Check if there were changes in the state of plugins
so we need to do the mysql_audit_release asap.
@param[in] thd
*/
my_bool mysql_audit_release_required(THD *thd)
{
return thd && (thd->audit_plugin_version != global_plugin_version);
}
/**
Release any resources associated with the current thd.
@ -159,6 +174,7 @@ void mysql_audit_release(THD *thd)
/* Reset the state of thread values */
reset_dynamic(&thd->audit_class_plugins);
bzero(thd->audit_class_mask, sizeof(thd->audit_class_mask));
thd->audit_plugin_version= -1;
}

View file

@ -58,6 +58,7 @@ static inline void mysql_audit_notify(THD *thd, uint event_class,
#define mysql_audit_connection_enabled() 0
#define mysql_audit_table_enabled() 0
#endif
extern my_bool mysql_audit_release_required(THD *thd);
extern void mysql_audit_release(THD *thd);
static inline unsigned int strlen_uint(const char *s)

View file

@ -629,6 +629,9 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
waiting_on_group_commit(FALSE), has_waiter(FALSE),
spcont(NULL),
m_parser_state(NULL),
#ifndef EMBEDDED_LIBRARY
audit_plugin_version(-1),
#endif
#if defined(ENABLED_DEBUG_SYNC)
debug_sync_control(0),
#endif /* defined(ENABLED_DEBUG_SYNC) */

View file

@ -3255,6 +3255,7 @@ public:
added to the list of audit plugins which are currently in use.
*/
unsigned long audit_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE];
int audit_plugin_version;
#endif
#if defined(ENABLED_DEBUG_SYNC)

View file

@ -1398,7 +1398,8 @@ void do_handle_one_connection(CONNECT *connect)
while (thd_is_connection_alive(thd))
{
mysql_audit_release(thd);
if (mysql_audit_release_required(thd))
mysql_audit_release(thd);
if (do_command(thd))
break;
}

View file

@ -227,6 +227,7 @@ static DYNAMIC_ARRAY plugin_array;
static HASH plugin_hash[MYSQL_MAX_PLUGIN_TYPE_NUM];
static MEM_ROOT plugin_mem_root;
static bool reap_needed= false;
volatile int global_plugin_version= 1;
static bool initialized= 0;
ulong dlopen_count;
@ -2217,6 +2218,7 @@ bool mysql_install_plugin(THD *thd, const LEX_CSTRING *name,
reap_plugins();
}
err:
global_plugin_version++;
mysql_mutex_unlock(&LOCK_plugin);
if (argv)
free_defaults(argv);
@ -2364,6 +2366,7 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_CSTRING *name,
}
reap_plugins();
global_plugin_version++;
mysql_mutex_unlock(&LOCK_plugin);
DBUG_RETURN(error);

View file

@ -38,6 +38,7 @@ enum enum_plugin_load_option { PLUGIN_OFF, PLUGIN_ON, PLUGIN_FORCE,
PLUGIN_FORCE_PLUS_PERMANENT };
extern const char *global_plugin_typelib_names[];
extern volatile int global_plugin_version;
extern ulong dlopen_count;
#include <my_sys.h>

View file

@ -353,7 +353,8 @@ static int threadpool_process_request(THD *thd)
{
Vio *vio;
thd->net.reading_or_writing= 0;
mysql_audit_release(thd);
if (mysql_audit_release_required(thd))
mysql_audit_release(thd);
if ((retval= do_command(thd)) != 0)
goto end;

View file

@ -1,10 +0,0 @@
UseTab: Always
TabWidth: 8
IndentWidth: 8
BreakBeforeBinaryOperators: All
PointerAlignment: Left
AlwaysBreakAfterReturnType: TopLevel
BreakBeforeBraces: Custom
BraceWrapping:
AfterFunction: true
AccessModifierOffset: -8

View file

@ -4693,7 +4693,7 @@ btr_cur_pessimistic_update(
ut_ad(dict_index_is_clust(index));
ut_ad(thr_get_trx(thr)->in_rollback);
DBUG_EXECUTE_IF("ib_blob_update_rollback", DBUG_SUICIDE(););
DEBUG_SYNC_C("blob_rollback_middle");
btr_rec_free_updated_extern_fields(
index, rec, page_zip, *offsets, update, true, mtr);

View file

@ -60,6 +60,7 @@ Created 11/5/1995 Heikki Tuuri
#include "dict0dict.h"
#include "log0recv.h"
#include "srv0mon.h"
#include "log0crypt.h"
#endif /* !UNIV_INNOCHECKSUM */
#include "page0zip.h"
#include "sync0sync.h"
@ -476,6 +477,45 @@ buf_pool_register_chunk(
chunk->blocks->frame, chunk));
}
/** Decrypt a page for temporary tablespace.
@param[in,out] tmp_frame Temporary buffer
@param[in] src_frame Page to decrypt
@return true if temporary tablespace decrypted, false if not */
static bool buf_tmp_page_decrypt(byte* tmp_frame, byte* src_frame)
{
if (buf_page_is_zeroes(src_frame, srv_page_size)) {
return true;
}
/* read space & lsn */
uint header_len = FIL_PAGE_DATA;
/* Copy FIL page header, it is not encrypted */
memcpy(tmp_frame, src_frame, header_len);
/* Calculate the offset where decryption starts */
const byte* src = src_frame + header_len;
byte* dst = tmp_frame + header_len;
uint srclen = uint(srv_page_size)
- header_len - FIL_PAGE_DATA_END;
ulint offset = mach_read_from_4(src_frame + FIL_PAGE_OFFSET);
if (!log_tmp_block_decrypt(src, srclen, dst,
(offset * srv_page_size))) {
return false;
}
memcpy(tmp_frame + srv_page_size - FIL_PAGE_DATA_END,
src_frame + srv_page_size - FIL_PAGE_DATA_END,
FIL_PAGE_DATA_END);
memcpy(src_frame, tmp_frame, srv_page_size);
srv_stats.pages_decrypted.inc();
srv_stats.n_temp_blocks_decrypted.inc();
return true; /* page was decrypted */
}
/** Decrypt a page.
@param[in,out] bpage Page control block
@param[in,out] space tablespace
@ -495,6 +535,22 @@ static bool buf_page_decrypt_after_read(buf_page_t* bpage, fil_space_t* space)
return (true);
}
if (space->purpose == FIL_TYPE_TEMPORARY
&& innodb_encrypt_temporary_tables) {
buf_tmp_buffer_t* slot = buf_pool_reserve_tmp_slot(buf_pool);
buf_tmp_reserve_crypt_buf(slot);
if (!buf_tmp_page_decrypt(slot->crypt_buf, dst_frame)) {
slot->release();
ib::error() << "Encrypted page " << bpage->id
<< " in file " << space->chain.start->name;
return false;
}
slot->release();
return true;
}
/* Page is encrypted if encryption information is found from
tablespace and page contains used key_version. This is true
also for pages first compressed and then encrypted. */
@ -921,6 +977,22 @@ static uint32_t buf_page_check_crc32(const byte* page, uint32_t checksum)
# define buf_page_check_crc32(page, checksum) buf_calc_page_crc32(page)
#endif /* INNODB_BUG_ENDIAN_CRC32 */
/** Check if a page is all zeroes.
@param[in] read_buf database page
@param[in] page_size page frame size
@return whether the page is all zeroes */
bool buf_page_is_zeroes(const void* read_buf, size_t page_size)
{
const ulint* b = reinterpret_cast<const ulint*>(read_buf);
const ulint* const e = b + page_size / sizeof *b;
do {
if (*b++) {
return false;
}
} while (b != e);
return true;
}
/** Check if a page is corrupt.
@param[in] check_lsn whether the LSN should be checked
@param[in] read_buf database page
@ -1247,11 +1319,13 @@ buf_page_print(const byte* read_buf, const page_size_t& page_size)
{
dict_index_t* index;
#ifndef UNIV_DEBUG
ib::info() << "Page dump in ascii and hex ("
<< page_size.physical() << " bytes):";
ut_print_buf(stderr, read_buf, page_size.physical());
fputs("\nInnoDB: End of page dump\n", stderr);
#endif
if (page_size.is_compressed()) {
/* Print compressed page. */
@ -7326,6 +7400,44 @@ operator<<(
return(out);
}
/** Encrypt a buffer of temporary tablespace
@param[in] offset Page offset
@param[in] src_frame Page to encrypt
@param[in,out] dst_frame Output buffer
@return encrypted buffer or NULL */
static byte* buf_tmp_page_encrypt(
ulint offset,
byte* src_frame,
byte* dst_frame)
{
uint header_len = FIL_PAGE_DATA;
/* FIL page header is not encrypted */
memcpy(dst_frame, src_frame, header_len);
/* Calculate the start offset in a page */
uint unencrypted_bytes = header_len + FIL_PAGE_DATA_END;
uint srclen = srv_page_size - unencrypted_bytes;
const byte* src = src_frame + header_len;
byte* dst = dst_frame + header_len;
if (!log_tmp_block_encrypt(src, srclen, dst, (offset * srv_page_size),
true)) {
return NULL;
}
memcpy(dst_frame + srv_page_size - FIL_PAGE_DATA_END,
src_frame + srv_page_size - FIL_PAGE_DATA_END,
FIL_PAGE_DATA_END);
/* Handle post encryption checksum */
mach_write_to_4(dst_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4,
buf_calc_page_crc32(dst_frame));
srv_stats.pages_encrypted.inc();
srv_stats.n_temp_blocks_encrypted.inc();
return dst_frame;
}
/** Encryption and page_compression hook that is called just before
a page is written to disk.
@param[in,out] space tablespace
@ -7359,13 +7471,21 @@ buf_page_encrypt_before_write(
fil_space_crypt_t* crypt_data = space->crypt_data;
const bool encrypted = crypt_data
&& !crypt_data->not_encrypted()
&& crypt_data->type != CRYPT_SCHEME_UNENCRYPTED
&& (!crypt_data->is_default_encryption()
|| srv_encrypt_tables);
bool encrypted, page_compressed;
bool page_compressed = FSP_FLAGS_HAS_PAGE_COMPRESSION(space->flags);
if (space->purpose == FIL_TYPE_TEMPORARY) {
ut_ad(!crypt_data);
encrypted = innodb_encrypt_temporary_tables;
page_compressed = false;
} else {
encrypted = crypt_data
&& !crypt_data->not_encrypted()
&& crypt_data->type != CRYPT_SCHEME_UNENCRYPTED
&& (!crypt_data->is_default_encryption()
|| srv_encrypt_tables);
page_compressed = FSP_FLAGS_HAS_PAGE_COMPRESSION(space->flags);
}
if (!encrypted && !page_compressed) {
/* No need to encrypt or page compress the page.
@ -7386,18 +7506,25 @@ buf_page_encrypt_before_write(
if (!page_compressed) {
not_compressed:
/* Encrypt page content */
byte* tmp = fil_space_encrypt(space,
bpage->id.page_no(),
bpage->newest_modification,
src_frame,
dst_frame);
byte* tmp;
if (space->purpose == FIL_TYPE_TEMPORARY) {
/* Encrypt temporary tablespace page content */
tmp = buf_tmp_page_encrypt(bpage->id.page_no(),
src_frame, dst_frame);
} else {
/* Encrypt page content */
tmp = fil_space_encrypt(
space, bpage->id.page_no(),
bpage->newest_modification,
src_frame, dst_frame);
}
bpage->real_size = srv_page_size;
slot->out_buf = dst_frame = tmp;
ut_d(fil_page_type_validate(tmp));
} else {
ut_ad(space->purpose != FIL_TYPE_TEMPORARY);
/* First we compress the page content */
buf_tmp_reserve_compression_buf(slot);
byte* tmp = slot->comp_buf;

View file

@ -335,20 +335,6 @@ too_small:
goto start_again;
}
/** Check if a page is all zeroes.
@param[in] read_buf database page
@param[in] page_size page frame size
@return whether the page is all zeroes */
static bool buf_page_is_zeroes(const byte* read_buf, size_t page_size)
{
for (ulint i = 0; i < page_size; i++) {
if (read_buf[i] != 0) {
return false;
}
}
return true;
}
/**
At database startup initializes the doublewrite buffer memory structure if
we already have a doublewrite buffer created in the data files. If we are

View file

@ -2401,7 +2401,8 @@ fil_space_crypt_close_tablespace(
{
fil_space_crypt_t* crypt_data = space->crypt_data;
if (!crypt_data || srv_n_fil_crypt_threads == 0) {
if (!crypt_data || srv_n_fil_crypt_threads == 0
|| !fil_crypt_threads_inited) {
return;
}

View file

@ -4372,6 +4372,11 @@ fil_io(
req_type.set_fil_node(node);
ut_ad(!req_type.is_write()
|| page_id.space() == SRV_LOG_SPACE_FIRST_ID
|| !fil_is_user_tablespace_id(page_id.space())
|| offset == page_id.page_no() * page_size.physical());
/* Queue the aio request */
dberr_t err = os_aio(
req_type,

View file

@ -1170,6 +1170,12 @@ static SHOW_VAR innodb_status_variables[]= {
{"encryption_n_rowlog_blocks_decrypted",
(char*)&export_vars.innodb_n_rowlog_blocks_decrypted,
SHOW_LONGLONG},
{"encryption_n_temp_blocks_encrypted",
(char*)&export_vars.innodb_n_temp_blocks_encrypted,
SHOW_LONGLONG},
{"encryption_n_temp_blocks_decrypted",
(char*)&export_vars.innodb_n_temp_blocks_decrypted,
SHOW_LONGLONG},
/* scrubing */
{"scrub_background_page_reorganizations",
@ -3802,7 +3808,8 @@ static int innodb_init_params()
}
#endif
if ((srv_encrypt_tables || srv_encrypt_log)
if ((srv_encrypt_tables || srv_encrypt_log
|| innodb_encrypt_temporary_tables)
&& !encryption_key_id_exists(FIL_DEFAULT_ENCRYPTION_KEY)) {
sql_print_error("InnoDB: cannot enable encryption, "
"encryption plugin is not available");
@ -6178,7 +6185,7 @@ no_such_table:
if (!thd_tablespace_op(thd)) {
set_my_errno(ENOENT);
int ret_err = HA_ERR_NO_SUCH_TABLE;
int ret_err = HA_ERR_TABLESPACE_MISSING;
if (space && space->crypt_data
&& space->crypt_data->is_encrypted()) {
@ -9371,7 +9378,7 @@ ha_innobase::index_read(
table->s->table_name.str);
table->status = STATUS_NOT_FOUND;
error = HA_ERR_NO_SUCH_TABLE;
error = HA_ERR_TABLESPACE_MISSING;
break;
case DB_TABLESPACE_NOT_FOUND:
@ -9382,8 +9389,7 @@ ha_innobase::index_read(
table->s->table_name.str);
table->status = STATUS_NOT_FOUND;
//error = HA_ERR_TABLESPACE_MISSING;
error = HA_ERR_NO_SUCH_TABLE;
error = HA_ERR_TABLESPACE_MISSING;
break;
default:
@ -9524,15 +9530,16 @@ ha_innobase::change_active_index(
/* Initialization of search_tuple is not needed for FT index
since FT search returns rank only. In addition engine should
be able to retrieve FTS_DOC_ID column value if necessary. */
if ((m_prebuilt->index->type & DICT_FTS)) {
#ifdef MYSQL_STORE_FTS_DOC_ID
if (table->fts_doc_id_field
&& bitmap_is_set(table->read_set,
table->fts_doc_id_field->field_index
&& m_prebuilt->read_just_key)) {
m_prebuilt->fts_doc_id_in_read_set = 1;
if (m_prebuilt->index->type & DICT_FTS) {
for (ulint i = 0; i < table->s->fields; i++) {
if (m_prebuilt->read_just_key
&& bitmap_get_next_set(table->read_set, i)
&& !strcmp(table->s->field[i]->field_name.str,
FTS_DOC_ID_COL_NAME)) {
m_prebuilt->fts_doc_id_in_read_set = true;
break;
}
}
#endif
} else {
dtuple_set_n_fields(m_prebuilt->search_tuple,
m_prebuilt->index->n_fields);
@ -9543,13 +9550,12 @@ ha_innobase::change_active_index(
/* If it's FTS query and FTS_DOC_ID exists FTS_DOC_ID field is
always added to read_set. */
#ifdef MYSQL_STORE_FTS_DOC_ID
m_prebuilt->fts_doc_id_in_read_set =
(m_prebuilt->read_just_key && table->fts_doc_id_field
&& m_prebuilt->in_fts_query);
#endif
m_prebuilt->fts_doc_id_in_read_set = m_prebuilt->in_fts_query
&& m_prebuilt->read_just_key
&& dict_index_contains_col_or_prefix(
m_prebuilt->index,
m_prebuilt->table->fts->doc_col,
false);
}
/* MySQL changes the active index for a handle also during some
@ -9628,7 +9634,7 @@ ha_innobase::general_fetch(
table->s->table_name.str);
table->status = STATUS_NOT_FOUND;
error = HA_ERR_NO_SUCH_TABLE;
error = HA_ERR_TABLESPACE_MISSING;
break;
case DB_TABLESPACE_NOT_FOUND:
@ -9937,7 +9943,7 @@ ha_innobase::ft_init_ext(
/* If tablespace is discarded, we should return here */
if (!ft_table->space) {
my_error(ER_NO_SUCH_TABLE, MYF(0), table->s->db.str,
my_error(ER_TABLESPACE_MISSING, MYF(0), table->s->db.str,
table->s->table_name.str);
return(NULL);
}
@ -10154,7 +10160,7 @@ next_record:
table->s->table_name.str);
table->status = STATUS_NOT_FOUND;
error = HA_ERR_NO_SUCH_TABLE;
error = HA_ERR_TABLESPACE_MISSING;
break;
case DB_TABLESPACE_NOT_FOUND:
@ -11112,6 +11118,17 @@ err_col:
dict_table_add_system_columns(table, heap);
if (table->is_temporary()) {
if ((options->encryption == 1
&& !innodb_encrypt_temporary_tables)
|| (options->encryption == 2
&& innodb_encrypt_temporary_tables)) {
push_warning_printf(m_thd,
Sql_condition::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
"Ignoring encryption parameter during "
"temporary table creation.");
}
/* Get a new table ID. FIXME: Make this a private
sequence, not shared with persistent tables! */
dict_table_assign_new_id(table, m_trx);
@ -15581,7 +15598,7 @@ ha_innobase::external_lock(
ER_TABLESPACE_DISCARDED,
table->s->table_name.str);
DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
DBUG_RETURN(HA_ERR_TABLESPACE_MISSING);
}
row_quiesce_table_start(m_prebuilt->table, trx);
@ -20092,6 +20109,11 @@ static MYSQL_SYSVAR_BOOL(debug_force_scrubbing,
NULL, NULL, FALSE);
#endif /* UNIV_DEBUG */
static MYSQL_SYSVAR_BOOL(encrypt_temporary_tables, innodb_encrypt_temporary_tables,
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
"Enrypt the temporary table data.",
NULL, NULL, false);
static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(autoextend_increment),
MYSQL_SYSVAR(buffer_pool_size),
@ -20298,6 +20320,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
#endif
MYSQL_SYSVAR(buf_dump_status_frequency),
MYSQL_SYSVAR(background_thread),
MYSQL_SYSVAR(encrypt_temporary_tables),
NULL
};

View file

@ -4816,20 +4816,6 @@ ibuf_print(
mutex_exit(&ibuf_mutex);
}
/** Check if a page is all zeroes.
@param[in] read_buf database page
@param[in] size page size
@return whether the page is all zeroes */
static bool buf_page_is_zeroes(const byte* read_buf, const page_size_t& size)
{
for (ulint i = 0; i < size.physical(); i++) {
if (read_buf[i] != 0) {
return false;
}
}
return true;
}
/** Check the insert buffer bitmaps on IMPORT TABLESPACE.
@param[in] trx transaction
@param[in,out] space tablespace being imported
@ -4890,7 +4876,7 @@ dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space)
bitmap_page = ibuf_bitmap_get_map_page(
page_id_t(space->id, page_no), page_size, &mtr);
if (buf_page_is_zeroes(bitmap_page, page_size)) {
if (buf_page_is_zeroes(bitmap_page, page_size.physical())) {
/* This means we got all-zero page instead of
ibuf bitmap page. The subsequent page should be
all-zero pages. */
@ -4902,7 +4888,8 @@ dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space)
page_id_t(space->id, curr_page),
page_size, RW_S_LATCH, &mtr);
page_t* page = buf_block_get_frame(block);
ut_ad(buf_page_is_zeroes(page, page_size));
ut_ad(buf_page_is_zeroes(
page, page_size.physical()));
}
#endif /* UNIV_DEBUG */
ibuf_exit(&mtr);

View file

@ -646,6 +646,12 @@ buf_block_unfix(buf_block_t* block);
# endif /* UNIV_DEBUG */
#endif /* !UNIV_INNOCHECKSUM */
/** Check if a page is all zeroes.
@param[in] read_buf database page
@param[in] page_size page frame size
@return whether the page is all zeroes */
bool buf_page_is_zeroes(const void* read_buf, size_t page_size);
/** Checks if the page is in crc32 checksum format.
@param[in] read_buf database page
@param[in] checksum_field1 new checksum field

View file

@ -87,7 +87,6 @@ log_crypt(byte* buf, lsn_t lsn, ulint size, bool decrypt = false);
@param[in] size size of the block
@param[out] dst destination block
@param[in] offs offset to block
@param[in] space_id tablespace id
@param[in] encrypt true=encrypt; false=decrypt
@return whether the operation succeeded */
UNIV_INTERN
@ -97,7 +96,6 @@ log_tmp_block_encrypt(
ulint size,
byte* dst,
uint64_t offs,
ulint space_id,
bool encrypt = true)
MY_ATTRIBUTE((warn_unused_result, nonnull));
@ -106,7 +104,6 @@ log_tmp_block_encrypt(
@param[in] size size of the block
@param[out] dst destination block
@param[in] offs offset to block
@param[in] space_id tablespace id
@return whether the operation succeeded */
inline
bool
@ -114,10 +111,9 @@ log_tmp_block_decrypt(
const byte* src,
ulint size,
byte* dst,
uint64_t offs,
ulint space_id)
uint64_t offs)
{
return(log_tmp_block_encrypt(src, size, dst, offs, space_id, false));
return(log_tmp_block_encrypt(src, size, dst, offs, false));
}
/** @return whether temporary files are encrypted */

View file

@ -187,6 +187,12 @@ struct srv_stats_t
/** Number of spaces in keyrotation list */
ulint_ctr_64_t key_rotation_list_length;
/** Number of temporary tablespace blocks encrypted */
ulint_ctr_64_t n_temp_blocks_encrypted;
/** Number of temporary tablespace blocks decrypted */
ulint_ctr_64_t n_temp_blocks_decrypted;
};
extern const char* srv_main_thread_op_info;
@ -475,6 +481,9 @@ extern ulong srv_max_purge_lag;
extern ulong srv_max_purge_lag_delay;
extern ulong srv_replication_delay;
extern my_bool innodb_encrypt_temporary_tables;
/*-------------------------------------------*/
/** Modes of operation */
@ -1042,6 +1051,12 @@ struct export_var_t{
/*!< Number of row log blocks decrypted */
ib_int64_t innodb_n_rowlog_blocks_decrypted;
/* Number of temporary tablespace pages encrypted */
ib_int64_t innodb_n_temp_blocks_encrypted;
/* Number of temporary tablespace pages decrypted */
ib_int64_t innodb_n_temp_blocks_decrypted;
ulint innodb_sec_rec_cluster_reads; /*!< srv_sec_rec_cluster_reads */
ulint innodb_sec_rec_cluster_reads_avoided;/*!< srv_sec_rec_cluster_reads_avoided */

View file

@ -61,6 +61,9 @@ struct crypt_info_t {
/** The crypt info */
static crypt_info_t info;
/** Initialization vector used for temporary files/tablespace */
static byte tmp_iv[MY_AES_BLOCK_SIZE];
/** Crypt info when upgrading from 10.1 */
static crypt_info_t infos[5 * 2];
/** First unused slot in infos[] */
@ -196,9 +199,6 @@ UNIV_INTERN
bool
log_crypt_init()
{
ut_ad(log_mutex_own());
ut_ad(log_sys.is_encrypted());
info.key_version = encryption_key_get_latest_version(
LOG_DEFAULT_ENCRYPTION_KEY);
@ -208,7 +208,8 @@ log_crypt_init()
return false;
}
if (my_random_bytes(info.crypt_msg.bytes, sizeof info.crypt_msg)
if (my_random_bytes(tmp_iv, MY_AES_BLOCK_SIZE) != MY_AES_OK
|| my_random_bytes(info.crypt_msg.bytes, sizeof info.crypt_msg)
!= MY_AES_OK
|| my_random_bytes(info.crypt_nonce.bytes, sizeof info.crypt_nonce)
!= MY_AES_OK) {
@ -373,7 +374,6 @@ log_crypt_read_checkpoint_buf(const byte* buf)
@param[in] size size of the block
@param[out] dst destination block
@param[in] offs offset to block
@param[in] space_id tablespace id
@param[in] encrypt true=encrypt; false=decrypt
@return whether the operation succeeded */
UNIV_INTERN
@ -383,19 +383,18 @@ log_tmp_block_encrypt(
ulint size,
byte* dst,
uint64_t offs,
ulint space_id,
bool encrypt)
{
uint dst_len;
uint64_t aes_ctr_iv[MY_AES_BLOCK_SIZE / sizeof(uint64_t)];
bzero(aes_ctr_iv, sizeof aes_ctr_iv);
aes_ctr_iv[0] = space_id;
aes_ctr_iv[1] = offs;
uint64_t iv[MY_AES_BLOCK_SIZE / sizeof(uint64_t)];
iv[0] = offs;
memcpy(iv + 1, tmp_iv, sizeof iv - sizeof *iv);
int rc = encryption_crypt(
src, (uint)size, dst, &dst_len,
const_cast<byte*>(info.crypt_key.bytes), (uint)(sizeof info.crypt_key),
reinterpret_cast<byte*>(aes_ctr_iv), (uint)(sizeof aes_ctr_iv),
src, uint(size), dst, &dst_len,
const_cast<byte*>(info.crypt_key.bytes),
uint(sizeof info.crypt_key),
reinterpret_cast<byte*>(iv), uint(sizeof iv),
encrypt
? ENCRYPTION_FLAG_ENCRYPT|ENCRYPTION_FLAG_NOPAD
: ENCRYPTION_FLAG_DECRYPT|ENCRYPTION_FLAG_NOPAD,

View file

@ -434,8 +434,7 @@ row_log_online_op(
if (log_tmp_is_encrypted()) {
if (!log_tmp_block_encrypt(
buf, srv_sort_buf_size,
log->crypt_tail, byte_offset,
index->table->space_id)) {
log->crypt_tail, byte_offset)) {
log->error = DB_DECRYPTION_FAILED;
goto write_failed;
}
@ -2876,8 +2875,7 @@ all_done:
if (log_tmp_is_encrypted()) {
if (!log_tmp_block_decrypt(
buf, srv_sort_buf_size,
index->online_log->crypt_head,
ofs, index->table->space_id)) {
index->online_log->crypt_head, ofs)) {
error = DB_DECRYPTION_FAILED;
goto func_exit;
}
@ -3779,8 +3777,7 @@ all_done:
if (log_tmp_is_encrypted()) {
if (!log_tmp_block_decrypt(
buf, srv_sort_buf_size,
index->online_log->crypt_head,
ofs, index->table->space_id)) {
index->online_log->crypt_head, ofs)) {
error = DB_DECRYPTION_FAILED;
goto func_exit;
}

View file

@ -1093,7 +1093,7 @@ row_merge_read(
/* If encryption is enabled decrypt buffer */
if (success && log_tmp_is_encrypted()) {
if (!log_tmp_block_decrypt(buf, srv_sort_buf_size,
crypt_buf, ofs, space)) {
crypt_buf, ofs)) {
return (FALSE);
}
@ -1142,7 +1142,7 @@ row_merge_write(
if (!log_tmp_block_encrypt(static_cast<const byte*>(buf),
buf_len,
static_cast<byte*>(crypt_buf),
ofs, space)) {
ofs)) {
return false;
}

View file

@ -430,6 +430,9 @@ my_bool srv_print_innodb_lock_monitor;
PRIMARY KEY */
my_bool srv_force_primary_key;
/** Key version to encrypt the temporary tablespace */
my_bool innodb_encrypt_temporary_tables;
/* Array of English strings describing the current state of an
i/o handler thread */
@ -1598,6 +1601,12 @@ srv_export_innodb_status(void)
export_vars.innodb_n_rowlog_blocks_encrypted = srv_stats.n_rowlog_blocks_encrypted;
export_vars.innodb_n_rowlog_blocks_decrypted = srv_stats.n_rowlog_blocks_decrypted;
export_vars.innodb_n_temp_blocks_encrypted =
srv_stats.n_temp_blocks_encrypted;
export_vars.innodb_n_temp_blocks_decrypted =
srv_stats.n_temp_blocks_decrypted;
export_vars.innodb_defragment_compression_failures =
btr_defragment_compression_failures;
export_vars.innodb_defragment_failures = btr_defragment_failures;

View file

@ -486,7 +486,7 @@ create_log_files(
/* Create a log checkpoint. */
log_mutex_enter();
if (log_sys.is_encrypted() && !log_crypt_init()) {
return(DB_ERROR);
return DB_ERROR;
}
ut_d(recv_no_log_write = false);
log_sys.lsn = ut_uint64_align_up(lsn, OS_FILE_LOG_BLOCK_SIZE);
@ -1708,6 +1708,10 @@ dberr_t srv_start(bool create_new_db)
srv_log_file_size_requested = srv_log_file_size;
if (innodb_encrypt_temporary_tables && !log_crypt_init()) {
return srv_init_abort(DB_ERROR);
}
if (create_new_db) {
buf_flush_sync_all_buf_pools();

View file

@ -2708,7 +2708,7 @@ int ha_maria::external_lock(THD *thd, int lock_type)
changes to commit (rollback shouldn't be tested).
*/
DBUG_ASSERT(!thd->get_stmt_da()->is_sent() ||
thd->killed == KILL_CONNECTION);
thd->killed);
/* autocommit ? rollback a transaction */
#ifdef MARIA_CANNOT_ROLLBACK
if (ma_commit(trn))

View file

@ -286,7 +286,6 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function,
We however do a flush here for additional safety.
*/
/** @todo consider porting these flush-es to MyISAM */
DBUG_ASSERT(share->reopen == 1);
error= _ma_flush_table_files(info, MARIA_FLUSH_DATA | MARIA_FLUSH_INDEX,
FLUSH_FORCE_WRITE, FLUSH_FORCE_WRITE);
if (!error && share->changed)

View file

@ -1,4 +1,5 @@
/* Copyright (C) 2006 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
Copyright (c) 2009, 2019, 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
@ -249,20 +250,6 @@ err:
} /* maria_clone_internal */
/* Make a clone of a maria table */
MARIA_HA *maria_clone(MARIA_SHARE *share, int mode)
{
MARIA_HA *new_info;
mysql_mutex_lock(&THR_LOCK_maria);
new_info= maria_clone_internal(share, mode,
share->data_file_type == BLOCK_RECORD ?
share->bitmap.file.file : -1, 0);
mysql_mutex_unlock(&THR_LOCK_maria);
return new_info;
}
/******************************************************************************
open a MARIA table

View file

@ -1,23 +1,49 @@
---
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. 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, version 2.0,
# as published by the Free Software Foundation.
#
# This program is also distributed with certain software (including
# but not limited to OpenSSL) that is licensed under separate terms,
# as designated in a particular file or component or in included license
# documentation. The authors of MySQL hereby grant you an additional
# permission to link the program and your derivative works with the
# separately licensed software that they have included with MySQL.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License, version 2.0, for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# This is the output of clang-format-5.0 --style=google --dump-config,
# except for changes mentioned below. We lock the style so that any newer
# version of clang-format will give the same result; as time goes, we may
# update this list, requiring newer versions of clang-format.
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
@ -32,62 +58,80 @@ BraceWrapping:
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|isl|json)/)'
Priority: 3
- Regex: '.*'
- Regex: '^<.*\.h>'
Priority: 1
IncludeIsMainRegex: '$'
IndentCaseLabels: false
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
ObjCSpaceBeforeProtocolList: false
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
PenaltyReturnTypeOnItsOwnLine: 200
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
JavaScriptQuotes: Leave
...
# We declare one specific pointer style since right alignment is dominant in
# the MySQL code base (default --style=google has DerivePointerAlignment true).
DerivePointerAlignment: false
PointerAlignment: Right
# MySQL source code is allowed to use C++11 features.
Standard: Cpp11

View file

@ -104,6 +104,8 @@ SET(ROCKSDB_SE_SOURCES
rdb_psi.cc
rdb_sst_info.cc
rdb_sst_info.h
rdb_converter.cc
rdb_converter.h
)
# MariaDB: the following is added in build_rocksdb.cmake, when appropriate:
@ -153,6 +155,7 @@ ADD_CONVENIENCE_LIBRARY(rocksdb_aux_lib
rdb_perf_context.h
rdb_buff.h
rdb_mariadb_port.h
nosql_access.cc nosql_access.h
)
ADD_DEPENDENCIES(rocksdb_aux_lib GenError)
@ -163,6 +166,27 @@ if (UNIX AND NOT APPLE)
TARGET_LINK_LIBRARIES(rocksdb_aux_lib -lrt)
endif()
# IF (WITH_JEMALLOC)
# FIND_LIBRARY(JEMALLOC_LIBRARY
# NAMES libjemalloc${PIC_EXT}.a jemalloc
# HINTS ${WITH_JEMALLOC}/lib)
# SET(rocksdb_static_libs ${rocksdb_static_libs}
# ${JEMALLOC_LIBRARY})
# ADD_DEFINITIONS(-DROCKSDB_JEMALLOC)
# ADD_DEFINITIONS(-DROCKSDB_MALLOC_USABLE_SIZE)
# ENDIF()
# MariaDB: Q: why does the upstream add libunwind for a particular
# storage engine?
#IF (WITH_UNWIND)
# FIND_LIBRARY(UNWIND_LIBRARY
# NAMES libunwind${PIC_EXT}.a unwind
# HINTS ${WITH_UNWIND}/lib)
# SET(rocksdb_static_libs ${rocksdb_static_libs}
# ${UNWIND_LIBRARY})
#ENDIF()
TARGET_LINK_LIBRARIES(rocksdb rocksdb_aux_lib)
FIND_LIBRARY(LZ4_LIBRARY
NAMES liblz4${PIC_EXT}.a lz4
@ -191,6 +215,8 @@ ENDIF()
CHECK_FUNCTION_EXISTS(sched_getcpu HAVE_SCHED_GETCPU)
IF(HAVE_SCHED_GETCPU)
ADD_DEFINITIONS(-DHAVE_SCHED_GETCPU=1)
# MariaDB: don't do this:
# ADD_DEFINITIONS(-DZSTD_STATIC_LINKING_ONLY)
ENDIF()
IF (WITH_TBB)

View file

@ -21,11 +21,13 @@ else()
if(WITH_ROCKSDB_JEMALLOC)
find_package(JeMalloc REQUIRED)
add_definitions(-DROCKSDB_JEMALLOC)
ADD_DEFINITIONS(-DROCKSDB_MALLOC_USABLE_SIZE)
include_directories(${JEMALLOC_INCLUDE_DIR})
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
# FreeBSD has jemaloc as default malloc
add_definitions(-DROCKSDB_JEMALLOC)
ADD_DEFINITIONS(-DROCKSDB_MALLOC_USABLE_SIZE)
set(WITH_JEMALLOC ON)
endif()
endif()
@ -160,7 +162,7 @@ find_package(Threads REQUIRED)
if(WIN32)
set(SYSTEM_LIBS ${SYSTEM_LIBS} Shlwapi.lib Rpcrt4.lib)
else()
set(SYSTEM_LIBS ${CMAKE_THREAD_LIBS_INIT} ${LIBRT})
set(SYSTEM_LIBS ${CMAKE_THREAD_LIBS_INIT} ${LIBRT} ${LIBDL})
endif()
set(ROCKSDB_LIBS rocksdblib})
@ -178,24 +180,27 @@ set(ROCKSDB_SOURCES
db/c.cc
db/column_family.cc
db/compacted_db_impl.cc
db/compaction.cc
db/compaction_iterator.cc
db/compaction_job.cc
db/compaction_picker.cc
db/compaction_picker_universal.cc
db/compaction/compaction.cc
db/compaction/compaction_iterator.cc
db/compaction/compaction_job.cc
db/compaction/compaction_picker.cc
db/compaction/compaction_picker_fifo.cc
db/compaction/compaction_picker_level.cc
db/compaction/compaction_picker_universal.cc
db/convenience.cc
db/db_filesnapshot.cc
db/db_impl.cc
db/db_impl_compaction_flush.cc
db/db_impl_debug.cc
db/db_impl_experimental.cc
db/db_impl_files.cc
db/db_impl_open.cc
db/db_impl_readonly.cc
db/db_impl_write.cc
db/dbformat.cc
db/db_impl/db_impl.cc
db/db_impl/db_impl_compaction_flush.cc
db/db_impl/db_impl_debug.cc
db/db_impl/db_impl_experimental.cc
db/db_impl/db_impl_files.cc
db/db_impl/db_impl_open.cc
db/db_impl/db_impl_readonly.cc
db/db_impl/db_impl_secondary.cc
db/db_impl/db_impl_write.cc
db/db_info_dumper.cc
db/db_iter.cc
db/dbformat.cc
db/error_handler.cc
db/event_helpers.cc
db/experimental.cc
@ -204,17 +209,18 @@ set(ROCKSDB_SOURCES
db/flush_job.cc
db/flush_scheduler.cc
db/forward_iterator.cc
db/in_memory_stats_history.cc
db/internal_stats.cc
db/log_reader.cc
db/log_writer.cc
db/logs_with_prep_tracker.cc
db/log_writer.cc
db/malloc_stats.cc
db/managed_iterator.cc
db/memtable.cc
db/memtable_list.cc
db/merge_helper.cc
db/merge_operator.cc
db/range_del_aggregator.cc
db/range_tombstone_fragmenter.cc
db/repair.cc
db/snapshot_impl.cc
db/table_cache.cc
@ -224,24 +230,29 @@ set(ROCKSDB_SOURCES
db/version_edit.cc
db/version_set.cc
db/wal_manager.cc
db/write_batch.cc
db/write_batch_base.cc
db/write_batch.cc
db/write_controller.cc
db/write_thread.cc
env/env.cc
env/env_chroot.cc
env/env_hdfs.cc
env/mock_env.cc
file/delete_scheduler.cc
file/filename.cc
file/file_util.cc
file/sst_file_manager_impl.cc
logging/auto_roll_logger.cc
logging/event_logger.cc
logging/log_buffer.cc
memory/arena.cc
memory/concurrent_arena.cc
memory/jemalloc_nodump_allocator.cc
memtable/alloc_tracker.cc
memtable/hash_cuckoo_rep.cc
memtable/hash_cuckoo_rep.cc
memtable/hash_linklist_rep.cc
memtable/hash_linklist_rep.cc
memtable/hash_skiplist_rep.cc
memtable/hash_skiplist_rep.cc
memtable/memtablerep_bench.cc
memtable/skiplistrep.cc
memtable/skiplistrep.cc
memtable/vectorrep.cc
memtable/vectorrep.cc
memtable/write_buffer_manager.cc
monitoring/histogram.cc
@ -253,6 +264,7 @@ set(ROCKSDB_SOURCES
monitoring/statistics.cc
monitoring/thread_status_impl.cc
monitoring/thread_status_updater.cc
monitoring/thread_status_updater_debug.cc
monitoring/thread_status_util.cc
monitoring/thread_status_util_debug.cc
options/cf_options.cc
@ -262,108 +274,101 @@ set(ROCKSDB_SOURCES
options/options_parser.cc
options/options_sanity_check.cc
port/stack_trace.cc
table/adaptive_table_factory.cc
table/block.cc
table/block_based_filter_block.cc
table/block_based_table_builder.cc
table/block_based_table_factory.cc
table/block_based_table_reader.cc
table/block_builder.cc
table/adaptive/adaptive_table_factory.cc
table/block_based/block_based_filter_block.cc
table/block_based/block_based_table_builder.cc
table/block_based/block_based_table_factory.cc
table/block_based/block_based_table_reader.cc
table/block_based/block_builder.cc
table/block_based/block.cc
table/block_based/block_prefix_index.cc
table/block_based/data_block_footer.cc
table/block_based/data_block_hash_index.cc
table/block_based/flush_block_policy.cc
table/block_based/full_filter_block.cc
table/block_based/index_builder.cc
table/block_based/partitioned_filter_block.cc
table/block_fetcher.cc
table/block_prefix_index.cc
table/bloom_block.cc
table/cuckoo_table_builder.cc
table/cuckoo_table_factory.cc
table/cuckoo_table_reader.cc
table/flush_block_policy.cc
table/cuckoo/cuckoo_table_builder.cc
table/cuckoo/cuckoo_table_factory.cc
table/cuckoo/cuckoo_table_reader.cc
table/format.cc
table/full_filter_block.cc
table/get_context.cc
table/index_builder.cc
table/iterator.cc
table/merging_iterator.cc
table/meta_blocks.cc
table/partitioned_filter_block.cc
table/mock_table.cc
table/persistent_cache_helper.cc
table/plain_table_builder.cc
table/plain_table_factory.cc
table/plain_table_index.cc
table/plain_table_key_coding.cc
table/plain_table_reader.cc
table/plain/plain_table_builder.cc
table/plain/plain_table_factory.cc
table/plain/plain_table_index.cc
table/plain/plain_table_key_coding.cc
table/plain/plain_table_reader.cc
table/sst_file_reader.cc
table/sst_file_writer.cc
table/table_properties.cc
table/table_reader_bench.cc
table/two_level_iterator.cc
tools/db_bench_tool.cc
tools/dump/db_dump_tool.cc
test_util/sync_point.cc
test_util/sync_point_impl.cc
tools/ldb_cmd.cc
tools/ldb_tool.cc
tools/sst_dump_tool.cc
util/arena.cc
util/auto_roll_logger.cc
trace_replay/trace_replay.cc
util/bloom.cc
util/coding.cc
util/compaction_job_stats_impl.cc
util/comparator.cc
util/compression_context_cache.cc
util/concurrent_arena.cc
util/concurrent_task_limiter_impl.cc
util/crc32c_arm64.cc
util/crc32c.cc
util/delete_scheduler.cc
util/dynamic_bloom.cc
util/event_logger.cc
util/file_reader_writer.cc
util/file_util.cc
util/filename.cc
util/filter_policy.cc
util/hash.cc
util/log_buffer.cc
util/murmurhash.cc
util/random.cc
util/rate_limiter.cc
util/slice.cc
util/sst_file_manager_impl.cc
util/status.cc
util/status_message.cc
util/string_util.cc
util/sync_point.cc
util/sync_point_impl.cc
util/testutil.cc
util/thread_local.cc
util/threadpool_imp.cc
util/transaction_test_util.cc
util/xxhash.cc
utilities/backupable/backupable_db.cc
utilities/blob_db/blob_compaction_filter.cc
utilities/blob_db/blob_db.cc
utilities/blob_db/blob_db_impl.cc
utilities/blob_db/blob_db_impl_filesnapshot.cc
utilities/blob_db/blob_dump_tool.cc
utilities/blob_db/blob_file.cc
utilities/blob_db/blob_log_format.cc
utilities/blob_db/blob_log_reader.cc
utilities/blob_db/blob_log_writer.cc
utilities/cassandra/cassandra_compaction_filter.cc
utilities/cassandra/format.cc
utilities/cassandra/merge_operator.cc
utilities/cassandra/test_utils.cc
utilities/checkpoint/checkpoint_impl.cc
utilities/col_buf_decoder.cc
utilities/col_buf_encoder.cc
utilities/column_aware_encoding_util.cc
utilities/compaction_filters/remove_emptyvalue_compactionfilter.cc
utilities/date_tiered/date_tiered_db_impl.cc
utilities/convenience/info_log_finder.cc
utilities/debug.cc
utilities/document/document_db.cc
utilities/document/json_document.cc
utilities/document/json_document_builder.cc
utilities/env_mirror.cc
utilities/geodb/geodb_impl.cc
utilities/env_timed.cc
utilities/leveldb_options/leveldb_options.cc
utilities/lua/rocks_lua_compaction_filter.cc
utilities/memory/memory_util.cc
utilities/merge_operators/bytesxor.cc
utilities/merge_operators/max.cc
utilities/merge_operators/put.cc
utilities/merge_operators/string_append/stringappend.cc
utilities/merge_operators/string_append/stringappend2.cc
utilities/merge_operators/string_append/stringappend.cc
utilities/merge_operators/uint64add.cc
utilities/option_change_migration/option_change_migration.cc
utilities/options/options_util.cc
utilities/persistent_cache/block_cache_tier.cc
utilities/persistent_cache/block_cache_tier_file.cc
utilities/persistent_cache/block_cache_tier_metadata.cc
utilities/persistent_cache/hash_table_bench.cc
utilities/persistent_cache/persistent_cache_bench.cc
utilities/persistent_cache/persistent_cache_tier.cc
utilities/persistent_cache/volatile_tier_impl.cc
utilities/redis/redis_lists.cc
utilities/simulator_cache/sim_cache.cc
utilities/spatialdb/spatial_db.cc
utilities/table_properties_collectors/compact_on_deletion_collector.cc
utilities/trace/file_trace_reader_writer.cc
utilities/transactions/optimistic_transaction.cc
utilities/transactions/optimistic_transaction_db_impl.cc
utilities/transactions/pessimistic_transaction.cc
utilities/transactions/pessimistic_transaction_db.cc
@ -379,8 +384,19 @@ set(ROCKSDB_SOURCES
utilities/ttl/db_ttl_impl.cc
utilities/write_batch_with_index/write_batch_with_index.cc
utilities/write_batch_with_index/write_batch_with_index_internal.cc
util/log_write_bench.cc
util/murmurhash.cc
util/random.cc
util/rate_limiter.cc
util/slice.cc
util/status.cc
util/string_util.cc
util/thread_local.cc
util/threadpool_imp.cc
util/xxhash.cc
)
if(WIN32)
list(APPEND ROCKSDB_SOURCES
port/win/io_win.cc

View file

@ -33,9 +33,9 @@
namespace myrocks {
static std::vector<Rdb_index_stats>
extract_index_stats(const std::vector<std::string> &files,
const rocksdb::TablePropertiesCollection &props) {
static std::vector<Rdb_index_stats> extract_index_stats(
const std::vector<std::string> &files,
const rocksdb::TablePropertiesCollection &props) {
std::vector<Rdb_index_stats> ret;
for (auto fn : files) {
const auto it = props.find(fn);
@ -86,10 +86,11 @@ void Rdb_event_listener::OnExternalFileIngested(
void Rdb_event_listener::OnBackgroundError(
rocksdb::BackgroundErrorReason reason, rocksdb::Status *status) {
rdb_log_status_error(*status, "Error detected in background");
// NO_LINT_DEBUG
sql_print_error("RocksDB: BackgroundErrorReason: %d", (int)reason);
if (status->IsCorruption()) {
rdb_persist_corruption_marker();
abort();
}
}
} // namespace myrocks
} // namespace myrocks

View file

@ -22,7 +22,7 @@ namespace myrocks {
class Rdb_ddl_manager;
class Rdb_event_listener : public rocksdb::EventListener {
public:
public:
Rdb_event_listener(const Rdb_event_listener &) = delete;
Rdb_event_listener &operator=(const Rdb_event_listener &) = delete;
@ -40,10 +40,10 @@ public:
void OnBackgroundError(rocksdb::BackgroundErrorReason reason,
rocksdb::Status *status) override;
private:
private:
Rdb_ddl_manager *m_ddl_manager;
void update_index_stats(const rocksdb::TableProperties &props);
};
} // namespace myrocks
} // namespace myrocks

File diff suppressed because it is too large Load diff

View file

@ -50,7 +50,9 @@
#include "rocksdb/utilities/write_batch_with_index.h"
/* MyRocks header files */
#include "./rdb_buff.h"
#include "./rdb_comparator.h"
#include "./rdb_global.h"
#include "./rdb_index_merge.h"
#include "./rdb_io_watchdog.h"
#include "./rdb_perf_context.h"
@ -58,6 +60,8 @@
#include "./rdb_utils.h"
#include "./ut0counter.h"
#include "rdb_mariadb_server_port.h"
class Field_blob;
class Field_varstring;
/**
@ -69,181 +73,13 @@ class Field_varstring;
namespace myrocks {
/*
* class for exporting transaction information for
* information_schema.rocksdb_trx
*/
struct Rdb_trx_info {
std::string name;
ulonglong trx_id;
ulonglong write_count;
ulonglong lock_count;
int timeout_sec;
std::string state;
std::string waiting_key;
ulonglong waiting_cf_id;
int is_replication;
int skip_trx_api;
int read_only;
int deadlock_detect;
int num_ongoing_bulk_load;
ulong thread_id;
std::string query_str;
};
std::vector<Rdb_trx_info> rdb_get_all_trx_info();
/*
* class for exporting deadlock transaction information for
* information_schema.rocksdb_deadlock
*/
struct Rdb_deadlock_info {
struct Rdb_dl_trx_info {
ulonglong trx_id;
std::string cf_name;
std::string waiting_key;
bool exclusive_lock;
std::string index_name;
std::string table_name;
};
std::vector <Rdb_dl_trx_info> path;
int64_t deadlock_time;
ulonglong victim_trx_id;
};
std::vector<Rdb_deadlock_info> rdb_get_deadlock_info();
/*
This is
- the name of the default Column Family (the CF which stores indexes which
didn't explicitly specify which CF they are in)
- the name used to set the default column family parameter for per-cf
arguments.
*/
extern const std::string DEFAULT_CF_NAME;
/*
This is the name of the Column Family used for storing the data dictionary.
*/
extern const std::string DEFAULT_SYSTEM_CF_NAME;
/*
This is the name of the hidden primary key for tables with no pk.
*/
const char *const HIDDEN_PK_NAME = "HIDDEN_PK_ID";
/*
Column family name which means "put this index into its own column family".
DEPRECATED!!!
*/
extern const std::string PER_INDEX_CF_NAME;
/*
Name for the background thread.
*/
const char *const BG_THREAD_NAME = "myrocks-bg";
/*
Name for the drop index thread.
*/
const char *const INDEX_THREAD_NAME = "myrocks-index";
/*
Name for the manual compaction thread.
*/
const char *const MANUAL_COMPACTION_THREAD_NAME = "myrocks-mc";
/*
Separator between partition name and the qualifier. Sample usage:
- p0_cfname=foo
- p3_tts_col=bar
*/
const char RDB_PER_PARTITION_QUALIFIER_NAME_SEP = '_';
/*
Separator between qualifier name and value. Sample usage:
- p0_cfname=foo
- p3_tts_col=bar
*/
const char RDB_QUALIFIER_VALUE_SEP = '=';
/*
Separator between multiple qualifier assignments. Sample usage:
- p0_cfname=foo;p1_cfname=bar;p2_cfname=baz
*/
const char RDB_QUALIFIER_SEP = ';';
/*
Qualifier name for a custom per partition column family.
*/
const char *const RDB_CF_NAME_QUALIFIER = "cfname";
/*
Qualifier name for a custom per partition ttl duration.
*/
const char *const RDB_TTL_DURATION_QUALIFIER = "ttl_duration";
/*
Qualifier name for a custom per partition ttl duration.
*/
const char *const RDB_TTL_COL_QUALIFIER = "ttl_col";
/*
Default, minimal valid, and maximum valid sampling rate values when collecting
statistics about table.
*/
#define RDB_DEFAULT_TBL_STATS_SAMPLE_PCT 10
#define RDB_TBL_STATS_SAMPLE_PCT_MIN 1
#define RDB_TBL_STATS_SAMPLE_PCT_MAX 100
/*
Default and maximum values for rocksdb-compaction-sequential-deletes and
rocksdb-compaction-sequential-deletes-window to add basic boundary checking.
*/
#define DEFAULT_COMPACTION_SEQUENTIAL_DELETES 0
#define MAX_COMPACTION_SEQUENTIAL_DELETES 2000000
#define DEFAULT_COMPACTION_SEQUENTIAL_DELETES_WINDOW 0
#define MAX_COMPACTION_SEQUENTIAL_DELETES_WINDOW 2000000
/*
Default and maximum values for various compaction and flushing related
options. Numbers are based on the hardware we currently use and our internal
benchmarks which indicate that parallelization helps with the speed of
compactions.
Ideally of course we'll use heuristic technique to determine the number of
CPU-s and derive the values from there. This however has its own set of
problems and we'll choose simplicity for now.
*/
#define MAX_BACKGROUND_JOBS 64
#define DEFAULT_SUBCOMPACTIONS 1
#define MAX_SUBCOMPACTIONS 64
/*
Default value for rocksdb_sst_mgr_rate_bytes_per_sec = 0 (disabled).
*/
#define DEFAULT_SST_MGR_RATE_BYTES_PER_SEC 0
/*
Defines the field sizes for serializing XID object to a string representation.
string byte format: [field_size: field_value, ...]
[
8: XID.formatID,
1: XID.gtrid_length,
1: XID.bqual_length,
XID.gtrid_length + XID.bqual_length: XID.data
]
*/
#define RDB_FORMATID_SZ 8
#define RDB_GTRID_SZ 1
#define RDB_BQUAL_SZ 1
#define RDB_XIDHDR_LEN (RDB_FORMATID_SZ + RDB_GTRID_SZ + RDB_BQUAL_SZ)
class Rdb_converter;
class Rdb_key_def;
class Rdb_tbl_def;
class Rdb_transaction;
class Rdb_transaction_impl;
class Rdb_writebatch_impl;
class Rdb_field_encoder;
/* collations, used in MariaRocks */
enum collations_used {
COLLATION_UTF8MB4_BIN = 46,
@ -255,74 +91,13 @@ enum collations_used {
COLLATION_UTF8_BIN = 83
};
/*
To fix an unhandled exception we specify the upper bound as LONGLONGMAX
instead of ULONGLONGMAX because the latter is -1 and causes an exception when
cast to jlong (signed) of JNI
The reason behind the cast issue is the lack of unsigned int support in Java.
*/
#define MAX_RATE_LIMITER_BYTES_PER_SEC static_cast<uint64_t>(LONGLONG_MAX)
/*
Hidden PK column (for tables with no primary key) is a longlong (aka 8 bytes).
static_assert() in code will validate this assumption.
*/
#define ROCKSDB_SIZEOF_HIDDEN_PK_COLUMN sizeof(longlong)
/*
Bytes used to store TTL, in the beginning of all records for tables with TTL
enabled.
*/
#define ROCKSDB_SIZEOF_TTL_RECORD sizeof(longlong)
#define ROCKSDB_SIZEOF_AUTOINC_VALUE sizeof(longlong)
/*
Maximum index prefix length in bytes.
*/
#define MAX_INDEX_COL_LEN_LARGE 3072
#define MAX_INDEX_COL_LEN_SMALL 767
/*
MyRocks specific error codes. NB! Please make sure that you will update
HA_ERR_ROCKSDB_LAST when adding new ones. Also update the strings in
rdb_error_messages to include any new error messages.
*/
#define HA_ERR_ROCKSDB_FIRST (HA_ERR_LAST + 1)
#define HA_ERR_ROCKSDB_PK_REQUIRED (HA_ERR_ROCKSDB_FIRST + 0)
#define HA_ERR_ROCKSDB_TABLE_DATA_DIRECTORY_NOT_SUPPORTED \
(HA_ERR_ROCKSDB_FIRST + 1)
#define HA_ERR_ROCKSDB_TABLE_INDEX_DIRECTORY_NOT_SUPPORTED \
(HA_ERR_ROCKSDB_FIRST + 2)
#define HA_ERR_ROCKSDB_COMMIT_FAILED (HA_ERR_ROCKSDB_FIRST + 3)
#define HA_ERR_ROCKSDB_BULK_LOAD (HA_ERR_ROCKSDB_FIRST + 4)
#define HA_ERR_ROCKSDB_CORRUPT_DATA (HA_ERR_ROCKSDB_FIRST + 5)
#define HA_ERR_ROCKSDB_CHECKSUM_MISMATCH (HA_ERR_ROCKSDB_FIRST + 6)
#define HA_ERR_ROCKSDB_INVALID_TABLE (HA_ERR_ROCKSDB_FIRST + 7)
#define HA_ERR_ROCKSDB_PROPERTIES (HA_ERR_ROCKSDB_FIRST + 8)
#define HA_ERR_ROCKSDB_MERGE_FILE_ERR (HA_ERR_ROCKSDB_FIRST + 9)
/*
Each error code below maps to a RocksDB status code found in:
rocksdb/include/rocksdb/status.h
*/
#define HA_ERR_ROCKSDB_STATUS_NOT_FOUND (HA_ERR_LAST + 10)
#define HA_ERR_ROCKSDB_STATUS_CORRUPTION (HA_ERR_LAST + 11)
#define HA_ERR_ROCKSDB_STATUS_NOT_SUPPORTED (HA_ERR_LAST + 12)
#define HA_ERR_ROCKSDB_STATUS_INVALID_ARGUMENT (HA_ERR_LAST + 13)
#define HA_ERR_ROCKSDB_STATUS_IO_ERROR (HA_ERR_LAST + 14)
#define HA_ERR_ROCKSDB_STATUS_NO_SPACE (HA_ERR_LAST + 15)
#define HA_ERR_ROCKSDB_STATUS_MERGE_IN_PROGRESS (HA_ERR_LAST + 16)
#define HA_ERR_ROCKSDB_STATUS_INCOMPLETE (HA_ERR_LAST + 17)
#define HA_ERR_ROCKSDB_STATUS_SHUTDOWN_IN_PROGRESS (HA_ERR_LAST + 18)
#define HA_ERR_ROCKSDB_STATUS_TIMED_OUT (HA_ERR_LAST + 19)
#define HA_ERR_ROCKSDB_STATUS_ABORTED (HA_ERR_LAST + 20)
#define HA_ERR_ROCKSDB_STATUS_LOCK_LIMIT (HA_ERR_LAST + 21)
#define HA_ERR_ROCKSDB_STATUS_BUSY (HA_ERR_LAST + 22)
#define HA_ERR_ROCKSDB_STATUS_DEADLOCK (HA_ERR_LAST + 23)
#define HA_ERR_ROCKSDB_STATUS_EXPIRED (HA_ERR_LAST + 24)
#define HA_ERR_ROCKSDB_STATUS_TRY_AGAIN (HA_ERR_LAST + 25)
#define HA_ERR_ROCKSDB_LAST HA_ERR_ROCKSDB_STATUS_TRY_AGAIN
#if 0 // MARIAROCKS_NOT_YET : read-free replication is not supported
extern char *rocksdb_read_free_rpl_tables;
#if defined(HAVE_PSI_INTERFACE)
extern PSI_rwlock_key key_rwlock_read_free_rpl_tables;
#endif
extern Regex_list_handler rdb_read_free_regex_handler;
#endif
/**
@brief
@ -338,7 +113,7 @@ struct Rdb_table_handler {
atomic_stat<int> m_lock_wait_timeout_counter;
atomic_stat<int> m_deadlock_counter;
my_core::THR_LOCK m_thr_lock; ///< MySQL latch needed by m_db_lock
my_core::THR_LOCK m_thr_lock; ///< MySQL latch needed by m_db_lock
/* Stores cumulative table statistics */
my_io_perf_atomic_t m_io_perf_read;
@ -352,138 +127,19 @@ struct Rdb_table_handler {
uint64_t m_mtcache_last_update;
};
class Rdb_key_def;
class Rdb_tbl_def;
class Rdb_transaction;
class Rdb_transaction_impl;
class Rdb_writebatch_impl;
class Rdb_field_encoder;
const char *const rocksdb_hton_name = "ROCKSDB";
typedef struct _gl_index_id_s {
uint32_t cf_id;
uint32_t index_id;
bool operator==(const struct _gl_index_id_s &other) const {
return cf_id == other.cf_id && index_id == other.index_id;
}
bool operator!=(const struct _gl_index_id_s &other) const {
return cf_id != other.cf_id || index_id != other.index_id;
}
bool operator<(const struct _gl_index_id_s &other) const {
return cf_id < other.cf_id ||
(cf_id == other.cf_id && index_id < other.index_id);
}
bool operator<=(const struct _gl_index_id_s &other) const {
return cf_id < other.cf_id ||
(cf_id == other.cf_id && index_id <= other.index_id);
}
bool operator>(const struct _gl_index_id_s &other) const {
return cf_id > other.cf_id ||
(cf_id == other.cf_id && index_id > other.index_id);
}
bool operator>=(const struct _gl_index_id_s &other) const {
return cf_id > other.cf_id ||
(cf_id == other.cf_id && index_id >= other.index_id);
}
} GL_INDEX_ID;
enum operation_type : int {
ROWS_DELETED = 0,
ROWS_INSERTED,
ROWS_READ,
ROWS_UPDATED,
ROWS_DELETED_BLIND,
ROWS_EXPIRED,
ROWS_FILTERED,
ROWS_HIDDEN_NO_SNAPSHOT,
ROWS_MAX
};
enum query_type : int { QUERIES_POINT = 0, QUERIES_RANGE, QUERIES_MAX };
#if defined(HAVE_SCHED_GETCPU)
#define RDB_INDEXER get_sched_indexer_t
#else
#define RDB_INDEXER thread_id_indexer_t
#endif
/* Global statistics struct used inside MyRocks */
struct st_global_stats {
ib_counter_t<ulonglong, 64, RDB_INDEXER> rows[ROWS_MAX];
// system_rows_ stats are only for system
// tables. They are not counted in rows_* stats.
ib_counter_t<ulonglong, 64, RDB_INDEXER> system_rows[ROWS_MAX];
ib_counter_t<ulonglong, 64, RDB_INDEXER> queries[QUERIES_MAX];
ib_counter_t<ulonglong, 64, RDB_INDEXER> covered_secondary_key_lookups;
};
/* Struct used for exporting status to MySQL */
struct st_export_stats {
ulonglong rows_deleted;
ulonglong rows_inserted;
ulonglong rows_read;
ulonglong rows_updated;
ulonglong rows_deleted_blind;
ulonglong rows_expired;
ulonglong rows_filtered;
ulonglong rows_hidden_no_snapshot;
ulonglong system_rows_deleted;
ulonglong system_rows_inserted;
ulonglong system_rows_read;
ulonglong system_rows_updated;
ulonglong queries_point;
ulonglong queries_range;
ulonglong covered_secondary_key_lookups;
};
/* Struct used for exporting RocksDB memory status */
struct st_memory_stats {
ulonglong memtable_total;
ulonglong memtable_unflushed;
};
/* Struct used for exporting RocksDB IO stalls stats */
struct st_io_stall_stats {
ulonglong level0_slowdown;
ulonglong level0_slowdown_with_compaction;
ulonglong level0_numfiles;
ulonglong level0_numfiles_with_compaction;
ulonglong stop_for_pending_compaction_bytes;
ulonglong slowdown_for_pending_compaction_bytes;
ulonglong memtable_compaction;
ulonglong memtable_slowdown;
ulonglong total_stop;
ulonglong total_slowdown;
st_io_stall_stats()
: level0_slowdown(0), level0_slowdown_with_compaction(0),
level0_numfiles(0), level0_numfiles_with_compaction(0),
stop_for_pending_compaction_bytes(0),
slowdown_for_pending_compaction_bytes(0), memtable_compaction(0),
memtable_slowdown(0), total_stop(0), total_slowdown(0) {}
};
} // namespace myrocks
#include "./rdb_buff.h"
} // namespace myrocks
/* Provide hash function for GL_INDEX_ID so we can include it in sets */
namespace std {
template <> struct hash<myrocks::GL_INDEX_ID> {
template <>
struct hash<myrocks::GL_INDEX_ID> {
std::size_t operator()(const myrocks::GL_INDEX_ID &gl_index_id) const {
const uint64_t val =
((uint64_t)gl_index_id.cf_id << 32 | (uint64_t)gl_index_id.index_id);
return std::hash<uint64_t>()(val);
}
};
} // namespace std
} // namespace std
namespace myrocks {
@ -493,9 +149,9 @@ namespace myrocks {
*/
class ha_rocksdb : public my_core::handler {
my_core::THR_LOCK_DATA m_db_lock; ///< MySQL database lock
my_core::THR_LOCK_DATA m_db_lock; ///< MySQL database lock
Rdb_table_handler *m_table_handler; ///< Open table handler
Rdb_table_handler *m_table_handler; ///< Open table handler
/* Iterator used for range scans and for full table/index scans */
rocksdb::Iterator *m_scan_it;
@ -536,11 +192,6 @@ class ha_rocksdb : public my_core::handler {
*/
mutable bool m_pk_can_be_decoded;
/*
TRUE <=> Some fields in the PK may require unpack_info.
*/
bool m_maybe_unpack_info;
uchar *m_pk_tuple; /* Buffer for storing PK in KeyTupleFormat */
uchar *m_pk_packed_tuple; /* Buffer for storing PK in StorageFormat */
// ^^ todo: change it to 'char*'? TODO: ^ can we join this with last_rowkey?
@ -584,10 +235,13 @@ class ha_rocksdb : public my_core::handler {
*/
uchar *m_pack_buffer;
/* class to convert between Mysql format and RocksDB format*/
std::shared_ptr<Rdb_converter> m_converter;
/*
Pointer to the original TTL timestamp value (8 bytes) during UPDATE.
*/
char m_ttl_bytes[ROCKSDB_SIZEOF_TTL_RECORD];
char *m_ttl_bytes;
/*
The TTL timestamp value can change if the explicit TTL column is
updated. If we detect this when updating the PK, we indicate it here so
@ -598,9 +252,6 @@ class ha_rocksdb : public my_core::handler {
/* rowkey of the last record we've read, in StorageFormat. */
String m_last_rowkey;
/* Buffer used by convert_record_to_storage_format() */
String m_storage_record;
/*
Last retrieved record, in table->record[0] data format.
@ -620,15 +271,28 @@ class ha_rocksdb : public my_core::handler {
/* TRUE means we are accessing the first row after a snapshot was created */
bool m_rnd_scan_is_new_snapshot;
/* TRUE means the replication slave will use Read Free Replication */
bool m_use_read_free_rpl;
/*
TRUE means we should skip unique key checks for this table if the
replication lag gets too large
*/
bool m_skip_unique_check;
/*
TRUE means INSERT ON DUPLICATE KEY UPDATE. In such case we can optimize by
remember the failed attempt (if there is one that violates uniqueness check)
in write_row and in the following index_read to skip the lock check and read
entirely
*/
bool m_insert_with_update;
/* TRUE if last time the insertion failed due to duplicated PK */
bool m_dup_pk_found;
#ifndef DBUG_OFF
/* Last retreived record for sanity checking */
String m_dup_pk_retrieved_record;
#endif
/**
@brief
This is a bitmap of indexes (i.e. a set) whose keys (in future, values) may
@ -645,7 +309,7 @@ class ha_rocksdb : public my_core::handler {
/*
MySQL index number for duplicate key error
*/
int m_dupp_errkey;
uint m_dupp_errkey;
int create_key_defs(const TABLE *const table_arg,
Rdb_tbl_def *const tbl_def_arg,
@ -678,11 +342,10 @@ class ha_rocksdb : public my_core::handler {
MY_ATTRIBUTE((__nonnull__));
void release_scan_iterator(void);
rocksdb::Status
get_for_update(Rdb_transaction *const tx,
rocksdb::ColumnFamilyHandle *const column_family,
const rocksdb::Slice &key,
rocksdb::PinnableSlice *value) const;
rocksdb::Status get_for_update(
Rdb_transaction *const tx,
rocksdb::ColumnFamilyHandle *const column_family,
const rocksdb::Slice &key, rocksdb::PinnableSlice *value) const;
int get_row_by_rowid(uchar *const buf, const char *const rowid,
const uint rowid_size, const bool skip_lookup = false,
@ -707,7 +370,7 @@ class ha_rocksdb : public my_core::handler {
int load_hidden_pk_value() MY_ATTRIBUTE((__warn_unused_result__));
int read_hidden_pk_id_from_rowkey(longlong *const hidden_pk_id)
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
bool can_use_single_delete(const uint &index) const
bool can_use_single_delete(const uint index) const
MY_ATTRIBUTE((__warn_unused_result__));
bool is_blind_delete_enabled();
bool skip_unique_check() const MY_ATTRIBUTE((__warn_unused_result__));
@ -724,39 +387,6 @@ class ha_rocksdb : public my_core::handler {
void set_last_rowkey(const uchar *const old_data);
/*
Array of table->s->fields elements telling how to store fields in the
record.
*/
Rdb_field_encoder *m_encoder_arr;
/* Describes instructions on how to decode the field */
class READ_FIELD {
public:
/* Points to Rdb_field_encoder describing the field */
Rdb_field_encoder *m_field_enc;
/* if true, decode the field, otherwise skip it */
bool m_decode;
/* Skip this many bytes before reading (or skipping) this field */
int m_skip;
};
/*
This tells which table fields should be decoded (or skipped) when
decoding table row from (pk, encoded_row) pair. (Secondary keys are
just always decoded in full currently)
*/
std::vector<READ_FIELD> m_decoders_vect;
/*
This tells if any field which is part of the key needs to be unpacked and
decoded.
*/
bool m_key_requested = false;
/* Setup field_decoders based on type of scan and table->read_set */
void setup_read_decoders();
/*
For the active index, indicates which columns must be covered for the
current lookup to be covered. If the bitmap field is null, that means this
@ -764,14 +394,6 @@ class ha_rocksdb : public my_core::handler {
*/
MY_BITMAP m_lookup_bitmap = {nullptr, nullptr, nullptr, 0, 0};
/*
Number of bytes in on-disk (storage) record format that are used for
storing SQL NULL flags.
*/
uint m_null_bytes_in_rec;
void get_storage_type(Rdb_field_encoder *const encoder, const uint &kp);
void setup_field_converters();
int alloc_key_buffers(const TABLE *const table_arg,
const Rdb_tbl_def *const tbl_def_arg,
bool alloc_alter_buffers = false)
@ -779,25 +401,19 @@ class ha_rocksdb : public my_core::handler {
void free_key_buffers();
// the buffer size should be at least 2*Rdb_key_def::INDEX_NUMBER_SIZE
rocksdb::Range get_range(const int &i, uchar buf[]) const;
rocksdb::Range get_range(const int i, uchar buf[]) const;
/*
Perf timers for data reads
*/
Rdb_io_perf m_io_perf;
/*
A counter of how many row checksums were checked for this table. Note that
this does not include checksums for secondary index entries.
*/
my_core::ha_rows m_row_checksums_checked;
/*
Update stats
*/
void update_stats(void);
public:
public:
/*
The following two are currently only used for getting the range bounds
from QUICK_SELECT_DESC.
@ -816,19 +432,19 @@ public:
*/
bool m_store_row_debug_checksums;
/* Same as above but for verifying checksums when reading */
bool m_verify_row_debug_checksums;
int m_checksums_pct;
ha_rocksdb(my_core::handlerton *const hton,
my_core::TABLE_SHARE *const table_arg);
~ha_rocksdb() {
virtual ~ha_rocksdb() override {
int err MY_ATTRIBUTE((__unused__));
err = finalize_bulk_load(false);
if (err != 0) {
sql_print_error("RocksDB: Error %d finalizing bulk load while closing "
"handler.",
err);
// NO_LINT_DEBUG
sql_print_error(
"RocksDB: Error %d finalizing bulk load while closing "
"handler.",
err);
}
}
@ -898,21 +514,6 @@ public:
int rename_table(const char *const from, const char *const to) override
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
int convert_blob_from_storage_format(my_core::Field_blob *const blob,
Rdb_string_reader *const reader,
bool decode)
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
int convert_varchar_from_storage_format(
my_core::Field_varstring *const field_var,
Rdb_string_reader *const reader, bool decode)
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
int convert_field_from_storage_format(my_core::Field *const field,
Rdb_string_reader *const reader,
bool decode, uint len)
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
int convert_record_from_storage_format(const rocksdb::Slice *const key,
const rocksdb::Slice *const value,
uchar *const buf)
@ -925,10 +526,9 @@ public:
static const std::vector<std::string> parse_into_tokens(const std::string &s,
const char delim);
static const std::string generate_cf_name(const uint index,
const TABLE *const table_arg,
const Rdb_tbl_def *const tbl_def_arg,
bool *per_part_match_found);
static const std::string generate_cf_name(
const uint index, const TABLE *const table_arg,
const Rdb_tbl_def *const tbl_def_arg, bool *per_part_match_found);
static const char *get_key_name(const uint index,
const TABLE *const table_arg,
@ -1067,7 +667,7 @@ public:
/*
Default implementation from cancel_pushed_idx_cond() suits us
*/
private:
private:
struct key_def_cf_info {
rocksdb::ColumnFamilyHandle *cf_handle;
bool is_reverse_cf;
@ -1087,16 +687,6 @@ private:
longlong hidden_pk_id;
bool skip_unique_check;
// In certain cases, TTL is enabled on a table, as well as an explicit TTL
// column. The TTL column can be part of either the key or the value part
// of the record. If it is part of the key, we store the offset here.
//
// Later on, we use this offset to store the TTL in the value part of the
// record, which we can then access in the compaction filter.
//
// Set to UINT_MAX by default to indicate that the TTL is not in key.
uint ttl_pk_offset = UINT_MAX;
};
/*
@ -1129,23 +719,24 @@ private:
std::array<struct key_def_cf_info, MAX_INDEXES + 1> *const cfs)
const MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
int create_key_def(const TABLE *const table_arg, const uint &i,
int create_key_def(const TABLE *const table_arg, const uint i,
const Rdb_tbl_def *const tbl_def_arg,
std::shared_ptr<Rdb_key_def> *const new_key_def,
const struct key_def_cf_info &cf_info) const
const struct key_def_cf_info &cf_info, uint64 ttl_duration,
const std::string &ttl_column) const
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
int create_inplace_key_defs(
const TABLE *const table_arg, Rdb_tbl_def *vtbl_def_arg,
const TABLE *const old_table_arg,
const Rdb_tbl_def *const old_tbl_def_arg,
const std::array<key_def_cf_info, MAX_INDEXES + 1> &cfs) const
const std::array<key_def_cf_info, MAX_INDEXES + 1> &cf,
uint64 ttl_duration, const std::string &ttl_column) const
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
std::unordered_map<std::string, uint>
get_old_key_positions(const TABLE *table_arg, const Rdb_tbl_def *tbl_def_arg,
const TABLE *old_table_arg,
const Rdb_tbl_def *old_tbl_def_arg) const
std::unordered_map<std::string, uint> get_old_key_positions(
const TABLE *table_arg, const Rdb_tbl_def *tbl_def_arg,
const TABLE *old_table_arg, const Rdb_tbl_def *old_tbl_def_arg) const
MY_ATTRIBUTE((__nonnull__));
int compare_key_parts(const KEY *const old_key,
@ -1155,24 +746,20 @@ private:
int compare_keys(const KEY *const old_key, const KEY *const new_key) const
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
int convert_record_to_storage_format(const struct update_row_info &row_info,
rocksdb::Slice *const packed_rec)
MY_ATTRIBUTE((__nonnull__));
bool should_hide_ttl_rec(const Rdb_key_def &kd,
const rocksdb::Slice &ttl_rec_val,
const int64_t curr_ts)
MY_ATTRIBUTE((__warn_unused_result__));
void rocksdb_skip_expired_records(const Rdb_key_def &kd,
rocksdb::Iterator *const iter,
bool seek_backward);
int rocksdb_skip_expired_records(const Rdb_key_def &kd,
rocksdb::Iterator *const iter,
bool seek_backward);
int index_first_intern(uchar *buf)
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
int index_last_intern(uchar *buf)
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
int find_icp_matching_index_rec(const bool &move_forward, uchar *const buf)
int find_icp_matching_index_rec(const bool move_forward, uchar *const buf)
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
void calc_updated_indexes();
@ -1180,20 +767,20 @@ private:
const bool skip_unique_check)
MY_ATTRIBUTE((__warn_unused_result__));
int get_pk_for_update(struct update_row_info *const row_info);
int check_and_lock_unique_pk(const uint &key_id,
int check_and_lock_unique_pk(const uint key_id,
const struct update_row_info &row_info,
bool *const found, bool *const pk_changed)
bool *const found)
MY_ATTRIBUTE((__warn_unused_result__));
int check_and_lock_sk(const uint &key_id,
int check_and_lock_sk(const uint key_id,
const struct update_row_info &row_info,
bool *const found)
MY_ATTRIBUTE((__warn_unused_result__));
int check_uniqueness_and_lock(const struct update_row_info &row_info,
bool *const pk_changed)
bool pk_changed)
MY_ATTRIBUTE((__warn_unused_result__));
bool over_bulk_load_threshold(int *err)
MY_ATTRIBUTE((__warn_unused_result__));
int check_duplicate_sk(const TABLE *table_arg, const Rdb_key_def &index,
int check_duplicate_sk(const TABLE *table_arg, const Rdb_key_def &key_def,
const rocksdb::Slice *key,
struct unique_sk_buf_info *sk_info)
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
@ -1202,32 +789,36 @@ private:
bool sort)
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
void update_bytes_written(ulonglong bytes_written);
int update_pk(const Rdb_key_def &kd, const struct update_row_info &row_info,
const bool &pk_changed) MY_ATTRIBUTE((__warn_unused_result__));
int update_sk(const TABLE *const table_arg, const Rdb_key_def &kd,
const struct update_row_info &row_info, const bool bulk_load_sk)
int update_write_pk(const Rdb_key_def &kd,
const struct update_row_info &row_info,
const bool pk_changed)
MY_ATTRIBUTE((__warn_unused_result__));
int update_indexes(const struct update_row_info &row_info,
const bool &pk_changed)
int update_write_sk(const TABLE *const table_arg, const Rdb_key_def &kd,
const struct update_row_info &row_info,
const bool bulk_load_sk)
MY_ATTRIBUTE((__warn_unused_result__));
int update_write_indexes(const struct update_row_info &row_info,
const bool pk_changed)
MY_ATTRIBUTE((__warn_unused_result__));
int read_key_exact(const Rdb_key_def &kd, rocksdb::Iterator *const iter,
const bool &using_full_key,
const rocksdb::Slice &key_slice,
const bool using_full_key, const rocksdb::Slice &key_slice,
const int64_t ttl_filter_ts)
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
int read_before_key(const Rdb_key_def &kd, const bool &using_full_key,
int read_before_key(const Rdb_key_def &kd, const bool using_full_key,
const rocksdb::Slice &key_slice,
const int64_t ttl_filter_ts)
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
int read_after_key(const Rdb_key_def &kd, const rocksdb::Slice &key_slice,
const int64_t ttl_filter_ts)
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
int position_to_correct_key(
const Rdb_key_def &kd, const enum ha_rkey_function &find_flag,
const bool &full_key_match, const uchar *const key,
const key_part_map &keypart_map, const rocksdb::Slice &key_slice,
bool *const move_forward, const int64_t ttl_filter_ts)
int position_to_correct_key(const Rdb_key_def &kd,
const enum ha_rkey_function &find_flag,
const bool full_key_match, const uchar *const key,
const key_part_map &keypart_map,
const rocksdb::Slice &key_slice,
bool *const move_forward,
const int64_t ttl_filter_ts)
MY_ATTRIBUTE((__warn_unused_result__));
int read_row_from_primary_key(uchar *const buf)
@ -1239,7 +830,7 @@ private:
int calc_eq_cond_len(const Rdb_key_def &kd,
const enum ha_rkey_function &find_flag,
const rocksdb::Slice &slice,
const int &bytes_changed_by_succ,
const int bytes_changed_by_succ,
const key_range *const end_key,
uint *const end_key_packed_size)
MY_ATTRIBUTE((__warn_unused_result__));
@ -1261,6 +852,10 @@ private:
int calculate_stats_for_table() MY_ATTRIBUTE((__warn_unused_result__));
bool should_skip_invalidated_record(const int rc);
bool should_recreate_snapshot(const int rc, const bool is_new_snapshot);
bool can_assume_tracked(THD *thd);
public:
int index_init(uint idx, bool sorted) override
MY_ATTRIBUTE((__warn_unused_result__));
@ -1315,11 +910,15 @@ private:
ha_rows records_in_range(uint inx, key_range *const min_key,
key_range *const max_key) override
MY_ATTRIBUTE((__warn_unused_result__));
int delete_table(Rdb_tbl_def *const tbl);
int delete_table(const char *const from) override
MY_ATTRIBUTE((__warn_unused_result__));
int create(const char *const name, TABLE *const form,
HA_CREATE_INFO *const create_info) override
MY_ATTRIBUTE((__warn_unused_result__));
int create_table(const std::string &table_name, const TABLE *table_arg,
ulonglong auto_increment_value);
bool check_if_incompatible_data(HA_CREATE_INFO *const info,
uint table_changes) override
MY_ATTRIBUTE((__warn_unused_result__));
@ -1367,26 +966,25 @@ private:
TABLE *const altered_table,
my_core::Alter_inplace_info *const ha_alter_info) override;
bool
commit_inplace_alter_table(TABLE *const altered_table,
my_core::Alter_inplace_info *const ha_alter_info,
bool commit) override;
bool commit_inplace_alter_table(
TABLE *const altered_table,
my_core::Alter_inplace_info *const ha_alter_info, bool commit) override;
#ifdef MARIAROCKS_NOT_YET // MDEV-10976
void set_use_read_free_rpl(const char *const whitelist);
#endif
void set_skip_unique_check_tables(const char *const whitelist);
#ifdef MARIAROCKS_NOT_YET // MDEV-10976
bool is_read_free_rpl_table() const;
#endif
#ifdef MARIAROCKS_NOT_YET // MDEV-10976
public:
public:
virtual void rpl_before_delete_rows() override;
virtual void rpl_after_delete_rows() override;
virtual void rpl_before_update_rows() override;
virtual void rpl_after_update_rows() override;
virtual bool use_read_free_rpl() override;
virtual bool use_read_free_rpl() const override;
#endif // MARIAROCKS_NOT_YET
private:
private:
/* Flags tracking if we are inside different replication operation */
bool m_in_rpl_delete_rows;
bool m_in_rpl_update_rows;
@ -1436,16 +1034,21 @@ struct Rdb_inplace_alter_ctx : public my_core::inplace_alter_handler_ctx {
std::unordered_set<std::shared_ptr<Rdb_key_def>> added_indexes,
std::unordered_set<GL_INDEX_ID> dropped_index_ids, uint n_added_keys,
uint n_dropped_keys, ulonglong max_auto_incr)
: my_core::inplace_alter_handler_ctx(), m_new_tdef(new_tdef),
m_old_key_descr(old_key_descr), m_new_key_descr(new_key_descr),
m_old_n_keys(old_n_keys), m_new_n_keys(new_n_keys),
m_added_indexes(added_indexes), m_dropped_index_ids(dropped_index_ids),
m_n_added_keys(n_added_keys), m_n_dropped_keys(n_dropped_keys),
: my_core::inplace_alter_handler_ctx(),
m_new_tdef(new_tdef),
m_old_key_descr(old_key_descr),
m_new_key_descr(new_key_descr),
m_old_n_keys(old_n_keys),
m_new_n_keys(new_n_keys),
m_added_indexes(added_indexes),
m_dropped_index_ids(dropped_index_ids),
m_n_added_keys(n_added_keys),
m_n_dropped_keys(n_dropped_keys),
m_max_auto_incr(max_auto_incr) {}
~Rdb_inplace_alter_ctx() {}
private:
private:
/* Disable Copying */
Rdb_inplace_alter_ctx(const Rdb_inplace_alter_ctx &);
Rdb_inplace_alter_ctx &operator=(const Rdb_inplace_alter_ctx &);
@ -1460,5 +1063,5 @@ extern bool prevent_myrocks_loading;
void sql_print_verbose_info(const char *format, ...);
} // namespace myrocks
} // namespace myrocks

View file

@ -78,7 +78,7 @@ Rdb_cf_manager &rdb_get_cf_manager();
const rocksdb::BlockBasedTableOptions &rdb_get_table_options();
bool rdb_is_ttl_enabled();
bool rdb_is_ttl_read_filtering_enabled();
#ifndef NDEBUG
#ifndef DBUG_OFF
int rdb_dbug_set_ttl_rec_ts();
int rdb_dbug_set_ttl_snapshot_ts();
int rdb_dbug_set_ttl_read_filter_ts();
@ -100,4 +100,4 @@ Rdb_ddl_manager *rdb_get_ddl_manager(void)
class Rdb_binlog_manager;
Rdb_binlog_manager *rdb_get_binlog_manager(void)
MY_ATTRIBUTE((__warn_unused_result__));
} // namespace myrocks
} // namespace myrocks

View file

@ -22,7 +22,7 @@
namespace myrocks {
class Rdb_logger : public rocksdb::Logger {
public:
public:
explicit Rdb_logger(const rocksdb::InfoLogLevel log_level =
rocksdb::InfoLogLevel::ERROR_LEVEL)
: m_mysql_log_level(log_level) {}
@ -77,9 +77,9 @@ public:
m_mysql_log_level = log_level;
}
private:
private:
std::shared_ptr<rocksdb::Logger> m_logger;
rocksdb::InfoLogLevel m_mysql_log_level;
};
} // namespace myrocks
} // namespace myrocks

View file

@ -44,12 +44,14 @@ class Writer(object):
class StreamWriter(Writer):
stream_cmd= ''
def __init__(self, stream_option):
def __init__(self, stream_option, direct = 0):
super(StreamWriter, self).__init__()
if stream_option == 'tar':
self.stream_cmd= 'tar chf -'
elif stream_option == 'xbstream':
self.stream_cmd= 'xbstream -c'
if direct:
self.stream_cmd = self.stream_cmd + ' -d'
else:
raise Exception("Only tar or xbstream is supported as streaming option.")
@ -341,6 +343,13 @@ class MySQLUtil:
row = cur.fetchone()
return row[0]
@staticmethod
def is_directio_enabled(dbh):
sql = "SELECT @@global.rocksdb_use_direct_reads"
cur = dbh.cursor()
cur.execute(sql)
row = cur.fetchone()
return row[0]
class BackupRunner:
datadir = None
@ -362,9 +371,7 @@ class BackupRunner:
try:
signal.signal(signal.SIGINT, signal_handler)
w = None
if opts.output_stream:
w = StreamWriter(opts.output_stream)
else:
if not opts.output_stream:
raise Exception("Currently only streaming backup is supported.")
snapshot_dir = opts.checkpoint_directory + '/' + str(backup_round)
@ -372,6 +379,11 @@ class BackupRunner:
opts.mysql_password,
opts.mysql_port,
opts.mysql_socket)
direct = MySQLUtil.is_directio_enabled(dbh)
logger.info("Direct I/O: %d", direct)
w = StreamWriter(opts.output_stream, direct)
if not self.datadir:
self.datadir = MySQLUtil.get_datadir(dbh)
logger.info("Set datadir: %s", self.datadir)

View file

@ -3,4 +3,3 @@ loose-rocksdb_write_policy=write_committed
[write_prepared]
loose-rocksdb_write_policy=write_prepared
loose-rocksdb_commit_time_batch_for_recovery=on

Some files were not shown because too many files have changed in this diff Show more