Commit 618d8fdf authored by Vicențiu Ciorbaru's avatar Vicențiu Ciorbaru

5.6.37-82.2

parent d5164569
SET(TOKUDB_VERSION 5.6.36-82.1)
SET(TOKUDB_VERSION 5.6.37-82.2)
# PerconaFT only supports x86-64 and cmake-2.8.9+
IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND
NOT CMAKE_VERSION VERSION_LESS "2.8.9")
......
......@@ -231,6 +231,8 @@ static void print_defines (void) {
printf("#define DB_SET_RANGE_REVERSE 252\n"); // private tokudb
//printf("#define DB_GET_BOTH_RANGE_REVERSE 251\n"); // private tokudb. No longer supported #2862.
dodefine(DB_RMW);
printf("#define DB_LOCKING_READ 0x80000000\n");
printf("#define DB_IS_RESETTING_OP 0x01000000\n"); // private tokudb
printf("#define DB_PRELOCKED 0x00800000\n"); // private tokudb
printf("#define DB_PRELOCKED_WRITE 0x00400000\n"); // private tokudb
......
......@@ -238,13 +238,16 @@ struct __toku_dbc_internal {
struct simple_dbt skey_s,sval_s;
struct simple_dbt *skey,*sval;
// if the rmw flag is asserted, cursor operations (like set) grab write locks instead of read locks
// if the rmw flag is asserted, cursor operations (like set) grab write
// locks instead of read locks
// the rmw flag is set when the cursor is created with the DB_RMW flag set
bool rmw;
bool locking_read;
};
static_assert(sizeof(__toku_dbc_internal) <= sizeof(((DBC *) nullptr)->_internal),
"__toku_dbc_internal doesn't fit in the internal portion of a DBC");
static_assert(
sizeof(__toku_dbc_internal) <= sizeof(((DBC *)nullptr)->_internal),
"__toku_dbc_internal doesn't fit in the internal portion of a DBC");
static inline __toku_dbc_internal *dbc_struct_i(DBC *c) {
union dbc_union {
......
......@@ -110,12 +110,14 @@ c_get_wrapper_callback(DBT const *key, DBT const *val, void *extra) {
return r;
}
static inline uint32_t
get_cursor_prelocked_flags(uint32_t flags, DBC* dbc) {
static inline uint32_t get_cursor_prelocked_flags(uint32_t flags, DBC *dbc) {
uint32_t lock_flags = flags & (DB_PRELOCKED | DB_PRELOCKED_WRITE);
//DB_READ_UNCOMMITTED and DB_READ_COMMITTED transactions 'own' all read locks for user-data dictionaries.
if (dbc_struct_i(dbc)->iso != TOKU_ISO_SERIALIZABLE) {
// DB_READ_UNCOMMITTED and DB_READ_COMMITTED transactions 'own' all read
// locks for user-data dictionaries.
if (dbc_struct_i(dbc)->iso != TOKU_ISO_SERIALIZABLE &&
!(dbc_struct_i(dbc)->iso == TOKU_ISO_SNAPSHOT &&
dbc_struct_i(dbc)->locking_read)) {
lock_flags |= DB_PRELOCKED;
}
return lock_flags;
......@@ -671,37 +673,44 @@ int toku_c_close(DBC *c) {
return 0;
}
static int
c_set_bounds(DBC *dbc, const DBT *left_key, const DBT *right_key, bool pre_acquire, int out_of_range_error) {
static int c_set_bounds(DBC *dbc,
const DBT *left_key,
const DBT *right_key,
bool pre_acquire,
int out_of_range_error) {
if (out_of_range_error != DB_NOTFOUND &&
out_of_range_error != TOKUDB_OUT_OF_RANGE &&
out_of_range_error != 0) {
return toku_ydb_do_error(
dbc->dbp->dbenv,
EINVAL,
"Invalid out_of_range_error [%d] for %s\n",
out_of_range_error,
__FUNCTION__
);
}
if (left_key == toku_dbt_negative_infinity() && right_key == toku_dbt_positive_infinity()) {
out_of_range_error != TOKUDB_OUT_OF_RANGE && out_of_range_error != 0) {
return toku_ydb_do_error(dbc->dbp->dbenv,
EINVAL,
"Invalid out_of_range_error [%d] for %s\n",
out_of_range_error,
__FUNCTION__);
}
if (left_key == toku_dbt_negative_infinity() &&
right_key == toku_dbt_positive_infinity()) {
out_of_range_error = 0;
}
DB *db = dbc->dbp;
DB_TXN *txn = dbc_struct_i(dbc)->txn;
HANDLE_PANICKED_DB(db);
toku_ft_cursor_set_range_lock(dbc_ftcursor(dbc), left_key, right_key,
(left_key == toku_dbt_negative_infinity()),
(right_key == toku_dbt_positive_infinity()),
out_of_range_error);
toku_ft_cursor_set_range_lock(dbc_ftcursor(dbc),
left_key,
right_key,
(left_key == toku_dbt_negative_infinity()),
(right_key == toku_dbt_positive_infinity()),
out_of_range_error);
if (!db->i->lt || !txn || !pre_acquire)
return 0;
//READ_UNCOMMITTED and READ_COMMITTED transactions do not need read locks.
if (!dbc_struct_i(dbc)->rmw && dbc_struct_i(dbc)->iso != TOKU_ISO_SERIALIZABLE)
// READ_UNCOMMITTED and READ_COMMITTED transactions do not need read locks.
if (!dbc_struct_i(dbc)->rmw &&
dbc_struct_i(dbc)->iso != TOKU_ISO_SERIALIZABLE &&
!(dbc_struct_i(dbc)->iso == TOKU_ISO_SNAPSHOT &&
dbc_struct_i(dbc)->locking_read))
return 0;
toku::lock_request::type lock_type = dbc_struct_i(dbc)->rmw ?
toku::lock_request::type::WRITE : toku::lock_request::type::READ;
toku::lock_request::type lock_type = dbc_struct_i(dbc)->rmw
? toku::lock_request::type::WRITE
: toku::lock_request::type::READ;
int r = toku_db_get_range_lock(db, txn, left_key, right_key, lock_type);
return r;
}
......@@ -783,18 +792,20 @@ toku_c_get(DBC* c, DBT* key, DBT* val, uint32_t flag) {
return r;
}
int
toku_db_cursor_internal(DB * db, DB_TXN * txn, DBC *c, uint32_t flags, int is_temporary_cursor) {
int toku_db_cursor_internal(DB *db,
DB_TXN *txn,
DBC *c,
uint32_t flags,
int is_temporary_cursor) {
HANDLE_PANICKED_DB(db);
HANDLE_DB_ILLEGAL_WORKING_PARENT_TXN(db, txn);
DB_ENV* env = db->dbenv;
DB_ENV *env = db->dbenv;
if (flags & ~(DB_SERIALIZABLE | DB_INHERIT_ISOLATION | DB_RMW | DBC_DISABLE_PREFETCHING)) {
if (flags &
~(DB_SERIALIZABLE | DB_INHERIT_ISOLATION | DB_LOCKING_READ | DB_RMW |
DBC_DISABLE_PREFETCHING)) {
return toku_ydb_do_error(
env,
EINVAL,
"Invalid flags set for toku_db_cursor\n"
);
env, EINVAL, "Invalid flags set for toku_db_cursor\n");
}
#define SCRS(name) c->name = name
......@@ -819,8 +830,8 @@ toku_db_cursor_internal(DB * db, DB_TXN * txn, DBC *c, uint32_t flags, int is_te
c->dbp = db;
dbc_struct_i(c)->txn = txn;
dbc_struct_i(c)->skey_s = (struct simple_dbt){0,0};
dbc_struct_i(c)->sval_s = (struct simple_dbt){0,0};
dbc_struct_i(c)->skey_s = (struct simple_dbt){0, 0};
dbc_struct_i(c)->sval_s = (struct simple_dbt){0, 0};
if (is_temporary_cursor) {
dbc_struct_i(c)->skey = &db->i->skey;
dbc_struct_i(c)->sval = &db->i->sval;
......@@ -831,28 +842,27 @@ toku_db_cursor_internal(DB * db, DB_TXN * txn, DBC *c, uint32_t flags, int is_te
if (flags & DB_SERIALIZABLE) {
dbc_struct_i(c)->iso = TOKU_ISO_SERIALIZABLE;
} else {
dbc_struct_i(c)->iso = txn ? db_txn_struct_i(txn)->iso : TOKU_ISO_SERIALIZABLE;
dbc_struct_i(c)->iso =
txn ? db_txn_struct_i(txn)->iso : TOKU_ISO_SERIALIZABLE;
}
dbc_struct_i(c)->rmw = (flags & DB_RMW) != 0;
enum cursor_read_type read_type = C_READ_ANY; // default, used in serializable and read uncommitted
dbc_struct_i(c)->locking_read = (flags & DB_LOCKING_READ) != 0;
enum cursor_read_type read_type =
C_READ_ANY; // default, used in serializable and read uncommitted
if (txn) {
if (dbc_struct_i(c)->iso == TOKU_ISO_READ_COMMITTED ||
dbc_struct_i(c)->iso == TOKU_ISO_SNAPSHOT)
{
dbc_struct_i(c)->iso == TOKU_ISO_SNAPSHOT) {
read_type = C_READ_SNAPSHOT;
}
else if (dbc_struct_i(c)->iso == TOKU_ISO_READ_COMMITTED_ALWAYS) {
} else if (dbc_struct_i(c)->iso == TOKU_ISO_READ_COMMITTED_ALWAYS) {
read_type = C_READ_COMMITTED;
}
}
int r = toku_ft_cursor_create(
db->i->ft_handle,
dbc_ftcursor(c),
txn ? db_txn_struct_i(txn)->tokutxn : NULL,
read_type,
((flags & DBC_DISABLE_PREFETCHING) != 0),
is_temporary_cursor != 0
);
int r = toku_ft_cursor_create(db->i->ft_handle,
dbc_ftcursor(c),
txn ? db_txn_struct_i(txn)->tokutxn : NULL,
read_type,
((flags & DBC_DISABLE_PREFETCHING) != 0),
is_temporary_cursor != 0);
if (r != 0) {
invariant(r == TOKUDB_MVCC_DICTIONARY_TOO_NEW);
}
......
......@@ -7644,7 +7644,13 @@ static bool tokudb_check_db_dir_exist_from_table_name(const char *table_name) {
memcpy(db_name, db_name_begin, db_name_size);
db_name[db_name_size] = '\0';
mysql_dir_exists = (check_db_dir_existence(db_name) == 0);
// At this point, db_name contains the MySQL formatted database name.
// This is exactly the same format that would come into us through a
// CREATE TABLE. Some charaters (like ':' for example) might be expanded
// into hex (':' would papear as "@003a").
// We need to check that the MySQL destination database directory exists.
mysql_dir_exists = (my_access(db_name, F_OK) == 0);
return mysql_dir_exists;
}
......
include/master-slave.inc
Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
[connection master]
include/sync_slave_sql_with_master.inc
include/stop_slave.inc
include/wait_for_slave_to_stop.inc
reset master;
reset slave;
start slave;
include/wait_for_slave_to_start.inc
create table t1(n int not null auto_increment primary key)ENGINE=TokuDB;
insert into t1 values (NULL);
drop table t1;
create table t1 (word char(20) not null)ENGINE=TokuDB;
load data infile 'LOAD_FILE' into table t1 ignore 1 lines;
select count(*) from t1;
count(*)
69
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=TokuDB
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=TokuDB
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=TokuDB
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
flush logs;
create table t3 (a int)ENGINE=TokuDB;
select * from t1 order by 1 asc;
word
Aarhus
Aaron
Aaron
Ababa
Ababa
aback
aback
abaft
abaft
abandon
abandon
abandoned
abandoned
abandoning
abandoning
abandonment
abandonment
abandons
abandons
abase
abased
abasement
abasements
abases
abash
abashed
abashes
abashing
abasing
abate
abated
abatement
abatements
abater
abates
abating
Abba
abbe
abbey
abbeys
abbot
abbots
Abbott
abbreviate
abbreviated
abbreviates
abbreviating
abbreviation
abbreviations
Abby
abdomen
abdomens
abdominal
abduct
abducted
abduction
abductions
abductor
abductors
abducts
Abe
abed
Abel
Abelian
Abelson
Aberdeen
Abernathy
aberrant
aberration
include/sync_slave_sql_with_master.inc
select * from t1 order by 1 asc;
word
Aarhus
Aaron
Aaron
Ababa
Ababa
aback
aback
abaft
abaft
abandon
abandon
abandoned
abandoned
abandoning
abandoning
abandonment
abandonment
abandons
abandons
abase
abased
abasement
abasements
abases
abash
abashed
abashes
abashing
abasing
abate
abated
abatement
abatements
abater
abates
abating
Abba
abbe
abbey
abbeys
abbot
abbots
Abbott
abbreviate
abbreviated
abbreviates
abbreviating
abbreviation
abbreviations
Abby
abdomen
abdomens
abdominal
abduct
abducted
abduction
abductions
abductor
abductors
abducts
Abe
abed
Abel
Abelian
Abelson
Aberdeen
Abernathy
aberrant
aberration
flush logs;
include/stop_slave.inc
include/start_slave.inc
create table t2 (n int)ENGINE=TokuDB;
insert into t2 values (1);
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=TokuDB
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=TokuDB
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Rotate # # master-bin.000002;pos=POS
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 # Query # # use `test`; create table t3 (a int)ENGINE=TokuDB
master-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=TokuDB
master-bin.000002 # Query # # BEGIN
master-bin.000002 # Table_map # # table_id: # (test.t2)
master-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000002 # Xid # # COMMIT /* XID */
show binary logs;
Log_name File_size
master-bin.000001 #
master-bin.000002 #
include/sync_slave_sql_with_master.inc
show binary logs;
Log_name File_size
slave-bin.000001 #
slave-bin.000002 #
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=TokuDB
slave-bin.000001 # Query # # BEGIN
slave-bin.000001 # Table_map # # table_id: # (test.t1)
slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
slave-bin.000001 # Xid # # COMMIT /* XID */
slave-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
slave-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=TokuDB
slave-bin.000001 # Query # # BEGIN
slave-bin.000001 # Table_map # # table_id: # (test.t1)
slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
slave-bin.000001 # Xid # # COMMIT /* XID */
slave-bin.000001 # Query # # use `test`; create table t3 (a int)ENGINE=TokuDB
slave-bin.000001 # Rotate # # slave-bin.000002;pos=POS
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=TokuDB
slave-bin.000002 # Query # # BEGIN
slave-bin.000002 # Table_map # # table_id: # (test.t2)
slave-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F
slave-bin.000002 # Xid # # COMMIT /* XID */
include/check_slave_is_running.inc
show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
include/rpl_reset.inc
create table t1(a int auto_increment primary key, b int);
insert into t1 values (NULL, 1);
set insert_id=5;
insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; create table t1(a int auto_increment primary key, b int)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
select * from t1;
a b
1 1
5 1
6 1
drop table t1;
include/sync_slave_sql_with_master.inc
include/rpl_end.inc
--skip-external-locking
--default-storage-engine=MyISAM
###################################
# Wrapper for rpl_row_log.test #
# Added wrapper so that MyISAM & #
# Innodb and NDB could all use the#
# Same test. NDB produced a diff #
# bin-log #
###################################
-- source include/not_ndb_default.inc
-- source include/have_binlog_format_row.inc
-- source include/have_tokudb.inc
-- source include/master-slave.inc
let $engine_type=TokuDB;
-- source extra/rpl_tests/rpl_log.test
--source include/rpl_end.inc
SET @orig_tokudb_dir_per_db=@@global.tokudb_dir_per_db;
########
# tokudb_dir_per_db = 1
########
......@@ -177,4 +178,11 @@ t1_status_id.tokudb
DROP TABLE t2;
## Looking for *.tokudb files in data_dir
## Looking for *.tokudb files in data_dir/test
SET GLOBAL tokudb_dir_per_db=default;
CREATE DATABASE `a::a@@`;
CREATE TABLE `a::a@@`.`t1` (a INT) ENGINE=TOKUDB;
CREATE DATABASE `!@#$%^&*()`;
ALTER TABLE `a::a@@`.`t1` RENAME `!@#$%^&*()`.`t1`;
DROP TABLE `!@#$%^&*()`.`t1`;
DROP DATABASE `!@#$%^&*()`;
DROP DATABASE `a::a@@`;
SET GLOBAL tokudb_dir_per_db=@orig_tokudb_dir_per_db;
source include/have_tokudb.inc;
SET @orig_tokudb_dir_per_db=@@global.tokudb_dir_per_db;
--let $DB= test
--let $DATADIR= `select @@datadir`
--let $i= 2
......@@ -73,4 +75,17 @@ while ($i) {
--source dir_per_db_show_table_files.inc
}
SET GLOBAL tokudb_dir_per_db=default;
# test case for TDB-72 : Can not rename table in database with non alphanum
# characters in its name.
CREATE DATABASE `a::a@@`;
CREATE TABLE `a::a@@`.`t1` (a INT) ENGINE=TOKUDB;
CREATE DATABASE `!@#$%^&*()`;
ALTER TABLE `a::a@@`.`t1` RENAME `!@#$%^&*()`.`t1`;
DROP TABLE `!@#$%^&*()`.`t1`;
DROP DATABASE `!@#$%^&*()`;
DROP DATABASE `a::a@@`;
# cleanup
SET GLOBAL tokudb_dir_per_db=@orig_tokudb_dir_per_db;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment