Skip to content

Commit

Permalink
Merge branch 'merge-tokudb-5.6' into 10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Apr 26, 2019
2 parents e049f92 + 33d8a28 commit f22ed27
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 13 deletions.
40 changes: 40 additions & 0 deletions storage/tokudb/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# .clang-format file for Percona TokuDB
# Minimum required version of clang-format is 5.0.1. Earlier versions will work
# but may need removal of some parameters.
Language: Cpp
BasedOnStyle: Google

# The following parameters are default for Google style,
# but as they are important for our project they
# are set explicitly here
AlignAfterOpenBracket: Align
BreakBeforeBinaryOperators: None
ColumnLimit: 80
PointerAlignment: Left
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
UseTab: Never

# Non-default parameters
NamespaceIndentation: All
IndentWidth: 4
TabWidth: 4
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
BinPackParameters: false
BinPackArguments: false
ExperimentalAutoDetectBinPacking: false
AllowAllParametersOfDeclarationOnNextLine: false
# not supported in 5.0.1
#AlignConsecutiveAssignments: yes
#AlignConsecutiveDeclarations: yes
BreakStringLiterals: false
ReflowComments: true
28 changes: 16 additions & 12 deletions storage/tokudb/ha_tokudb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3368,15 +3368,17 @@ void ha_tokudb::start_bulk_insert(ha_rows rows) {
int ha_tokudb::bulk_insert_poll(void* extra, float progress) {
LOADER_CONTEXT context = (LOADER_CONTEXT)extra;
if (thd_killed(context->thd)) {
sprintf(context->write_status_msg,
"The process has been killed, aborting bulk load.");
snprintf(context->write_status_msg,
sizeof(context->write_status_msg),
"The process has been killed, aborting bulk load.");
return ER_ABORTING_CONNECTION;
}
float percentage = progress * 100;
sprintf(context->write_status_msg,
"Loading of data t %s about %.1f%% done",
context->ha->share->full_table_name(),
percentage);
snprintf(context->write_status_msg,
sizeof(context->write_status_msg),
"Loading of data t %s about %.1f%% done",
context->ha->share->full_table_name(),
percentage);
thd_proc_info(context->thd, context->write_status_msg);
#ifdef HA_TOKUDB_HAS_THD_PROGRESS
thd_progress_report(context->thd, (unsigned long long)percentage, 100);
Expand Down Expand Up @@ -8548,15 +8550,17 @@ int ha_tokudb::tokudb_add_index(
int ha_tokudb::tokudb_add_index_poll(void* extra, float progress) {
LOADER_CONTEXT context = (LOADER_CONTEXT)extra;
if (thd_killed(context->thd)) {
sprintf(context->write_status_msg,
"The process has been killed, aborting add index.");
snprintf(context->write_status_msg,
sizeof(context->write_status_msg),
"The process has been killed, aborting add index.");
return ER_ABORTING_CONNECTION;
}
float percentage = progress * 100;
sprintf(context->write_status_msg,
"Adding of indexes to %s about %.1f%% done",
context->ha->share->full_table_name(),
percentage);
snprintf(context->write_status_msg,
sizeof(context->write_status_msg),
"Adding of indexes to %s about %.1f%% done",
context->ha->share->full_table_name(),
percentage);
thd_proc_info(context->thd, context->write_status_msg);
#ifdef HA_TOKUDB_HAS_THD_PROGRESS
thd_progress_report(context->thd, (unsigned long long)percentage, 100);
Expand Down
2 changes: 1 addition & 1 deletion storage/tokudb/ha_tokudb.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ha_tokudb;

typedef struct loader_context {
THD* thd;
char write_status_msg[200];
char write_status_msg[1024];
ha_tokudb* ha;
} *LOADER_CONTEXT;

Expand Down
1 change: 1 addition & 0 deletions storage/tokudb/ha_tokudb_mrr_mysql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ int ha_tokudb::multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param,
uint n_ranges, uint mode,
HANDLER_BUFFER *buf)
{
ds_mrr.init(this, table);
return ds_mrr.dsmrr_init(this, seq, seq_init_param, n_ranges, mode, buf);
}

Expand Down
6 changes: 6 additions & 0 deletions storage/tokudb/mysql-test/tokudb_bugs/r/PS-5158.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CREATE DATABASE `new..............................................end`;
USE `new..............................................end`;
CREATE TABLE t1(a INT KEY,b INT)ENGINE=TokuDB;
INSERT INTO t1 VALUES(1,11),(2,12),(3,13),(4,14),(5,15);
USE test;
DROP DATABASE `new..............................................end`;
5 changes: 5 additions & 0 deletions storage/tokudb/mysql-test/tokudb_bugs/r/PS-5163.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CREATE TABLE t1(c1 INT,c2 INT,c3 CHAR(10),c4 CHAR(10),c5 CHAR(10),PRIMARY KEY(c1),INDEX(c3,c4(1),c5(1)),INDEX(c2)) ENGINE=TokuDB;
INSERT INTO t1 VALUES(),(),(),(),();
ERROR 23000: Duplicate entry '0' for key 'PRIMARY'
UPDATE t1 SET c1=1 WHERE c1=1 OR c2=1;
DROP TABLE t1;
2 changes: 2 additions & 0 deletions storage/tokudb/mysql-test/tokudb_bugs/t/PS-5158-master.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--loose-tokudb_dir_per_db=ON

27 changes: 27 additions & 0 deletions storage/tokudb/mysql-test/tokudb_bugs/t/PS-5158.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Test for PS-5163 : [PS8QA] handle_fatal_signal (sig=11) in DsMrr_impl::dsmrr_init
# and PS-4828 : Inserting data into TokuDB database with name that contains non-alphanumerical characters can lead to the ZN9ha_tokudb16bulk_insert_pollEPvf assertion
#
# The cause is a buffer overrun in LOADER_CONTEXT where the char buffer used for
# maintaining the proc info string was too small and no validation or prevention
# was being done to ensure the string stayed within the limits of the buffer.
# Normally this would have been difficult to hit, but, now with the combination
# of tokudb_dir_per_db=ON and the expansion of the database name from latin1
# (or whatever) to the fscs encoding the space required for a max length
# db.table name could be quite larger than the buffer was originally sized.

--source include/have_tokudb.inc

if (`SELECT @@tokudb_dir_per_db != 1`) {
skip Requires tokudb_dir_per_db=1;
}

CREATE DATABASE `new..............................................end`;
USE `new..............................................end`;
CREATE TABLE t1(a INT KEY,b INT)ENGINE=TokuDB;

#
# TokuDB bulk_insert_poll would crash here
#
INSERT INTO t1 VALUES(1,11),(2,12),(3,13),(4,14),(5,15);
USE test;
DROP DATABASE `new..............................................end`;
11 changes: 11 additions & 0 deletions storage/tokudb/mysql-test/tokudb_bugs/t/PS-5163.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--source include/have_tokudb.inc

CREATE TABLE t1(c1 INT,c2 INT,c3 CHAR(10),c4 CHAR(10),c5 CHAR(10),PRIMARY KEY(c1),INDEX(c3,c4(1),c5(1)),INDEX(c2)) ENGINE=TokuDB;
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES(),(),(),(),();

# 8.0 asserts here down in data dictionary because ha_tokudb::ds_mrr did not
# properly call ds_mrr.init(this, table)
UPDATE t1 SET c1=1 WHERE c1=1 OR c2=1;

DROP TABLE t1;

0 comments on commit f22ed27

Please sign in to comment.