Commit b3e5332e authored by Rich Prohaska's avatar Rich Prohaska

Merge branch 'master' into releases/tokudb-7.5

parents d8493f40 a06c7d6a
...@@ -30,14 +30,14 @@ working MySQL or MariaDB with Tokutek patches, and with the TokuDB storage ...@@ -30,14 +30,14 @@ working MySQL or MariaDB with Tokutek patches, and with the TokuDB storage
engine, called `make.mysql.bash`. This script will download copies of the engine, called `make.mysql.bash`. This script will download copies of the
needed source code from github and build everything. needed source code from github and build everything.
To build MySQL 5.5.40 with TokuDB 7.5.3: To build MySQL 5.5.41 with TokuDB 7.5.5:
```sh ```sh
scripts/make.mysql.bash --mysqlbuild=mysql-5.5.40-tokudb-7.5.3-linux-x86_64 scripts/make.mysql.bash --mysqlbuild=mysql-5.5.41-tokudb-7.5.5-linux-x86_64
``` ```
To build MariaDB 5.5.40 with TokuDB 7.5.3: To build MariaDB 5.5.41 with TokuDB 7.5.5:
```sh ```sh
scripts/make.mysql.bash --mysqlbuild=mariadb-5.5.40-tokudb-7.5.3-linux-x86_64 scripts/make.mysql.bash --mysqlbuild=mariadb-5.5.41-tokudb-7.5.5-linux-x86_64
``` ```
Before you start, make sure you have a C++11-compatible compiler (GCC >= Before you start, make sure you have a C++11-compatible compiler (GCC >=
...@@ -59,6 +59,7 @@ repositories, run this: ...@@ -59,6 +59,7 @@ repositories, run this:
scripts/make.mysql.debug.env.bash scripts/make.mysql.debug.env.bash
``` ```
We use gcc from devtoolset-1.1 on CentOS 5.9 for builds.
Contribute Contribute
---------- ----------
......
...@@ -10003,7 +10003,7 @@ insert into t values (9998,0); ...@@ -10003,7 +10003,7 @@ insert into t values (9998,0);
insert into t values (9999,0); insert into t values (9999,0);
explain select id from t where id>0 limit 10; explain select id from t where id>0 limit 10;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t range PRIMARY PRIMARY 8 NULL # Using where; Using index 1 SIMPLE t range_or_index PRIMARY PRIMARY 8 NULL # Using where; Using index
explain select * from t where id>0 limit 10; explain select * from t where id>0 limit 10;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t range PRIMARY PRIMARY 8 NULL # Using where 1 SIMPLE t range PRIMARY PRIMARY 8 NULL # Using where
......
...@@ -18,7 +18,18 @@ while ($i < $n) { ...@@ -18,7 +18,18 @@ while ($i < $n) {
inc $i; inc $i;
} }
replace_column 9 #; # the plan for the following query should be a range scan. about 1 of 10 times,
# the plan is an index scan. the different scan type occurs because the query optimizer
# is handed different row counts by tokudb::records_in_range. the cost estimates made
# by the query optimizer are very close to begin with. sometimes, the cost of an index
# scan is less than the cost of a range scan.
#
# if a tokudb checkpoint occurs before this query is run, then the records_in_range
# function returns a larger than expected row estimate.
#
# column 4 is the join type (should be range or index)
# column 9 is the estimated key count
replace_column 4 range_or_index 9 #;
explain select id from t where id>0 limit 10; explain select id from t where id>0 limit 10;
replace_column 9 #; replace_column 9 #;
......
...@@ -117,6 +117,7 @@ elif [ $build_type = enterprise ] ; then ...@@ -117,6 +117,7 @@ elif [ $build_type = enterprise ] ; then
github_download Tokutek/tokudb-backup-plugin $(git_tree $git_tag $backup_tree) tokudb-backup-plugin github_download Tokutek/tokudb-backup-plugin $(git_tree $git_tag $backup_tree) tokudb-backup-plugin
mv tokudb-backup-plugin plugin mv tokudb-backup-plugin plugin
github_download Tokutek/backup-enterprise $(git_tree $git_tag $backup_tree) backup-enterprise github_download Tokutek/backup-enterprise $(git_tree $git_tag $backup_tree) backup-enterprise
rm -rf plugin/tokudb-backup-plugin/backup
mv backup-enterprise/backup plugin/tokudb-backup-plugin mv backup-enterprise/backup plugin/tokudb-backup-plugin
rm -rf backup-enterprise rm -rf backup-enterprise
fi fi
......
...@@ -7154,12 +7154,15 @@ To rename the table, make sure no transactions touch the table.", from, to); ...@@ -7154,12 +7154,15 @@ To rename the table, make sure no transactions touch the table.", from, to);
double ha_tokudb::scan_time() { double ha_tokudb::scan_time() {
TOKUDB_HANDLER_DBUG_ENTER(""); TOKUDB_HANDLER_DBUG_ENTER("");
double ret_val = (double)stats.records / 3; double ret_val = (double)stats.records / 3;
if (tokudb_debug & TOKUDB_DEBUG_RETURN) {
TOKUDB_HANDLER_TRACE("return %" PRIu64 " %f", (uint64_t) stats.records, ret_val);
}
DBUG_RETURN(ret_val); DBUG_RETURN(ret_val);
} }
double ha_tokudb::keyread_time(uint index, uint ranges, ha_rows rows) double ha_tokudb::keyread_time(uint index, uint ranges, ha_rows rows)
{ {
TOKUDB_HANDLER_DBUG_ENTER(""); TOKUDB_HANDLER_DBUG_ENTER("%u %u %" PRIu64, index, ranges, (uint64_t) rows);
double ret_val; double ret_val;
if (index == primary_key || key_is_clustering(&table->key_info[index])) { if (index == primary_key || key_is_clustering(&table->key_info[index])) {
ret_val = read_time(index, ranges, rows); ret_val = read_time(index, ranges, rows);
...@@ -7177,6 +7180,9 @@ double ha_tokudb::keyread_time(uint index, uint ranges, ha_rows rows) ...@@ -7177,6 +7180,9 @@ double ha_tokudb::keyread_time(uint index, uint ranges, ha_rows rows)
(table->key_info[index].key_length + (table->key_info[index].key_length +
ref_length) + 1); ref_length) + 1);
ret_val = (rows + keys_per_block - 1)/ keys_per_block; ret_val = (rows + keys_per_block - 1)/ keys_per_block;
if (tokudb_debug & TOKUDB_DEBUG_RETURN) {
TOKUDB_HANDLER_TRACE("return %f", ret_val);
}
DBUG_RETURN(ret_val); DBUG_RETURN(ret_val);
} }
...@@ -7197,7 +7203,7 @@ double ha_tokudb::read_time( ...@@ -7197,7 +7203,7 @@ double ha_tokudb::read_time(
ha_rows rows ha_rows rows
) )
{ {
TOKUDB_HANDLER_DBUG_ENTER(""); TOKUDB_HANDLER_DBUG_ENTER("%u %u %" PRIu64, index, ranges, (uint64_t) rows);
double total_scan; double total_scan;
double ret_val; double ret_val;
bool is_primary = (index == primary_key); bool is_primary = (index == primary_key);
...@@ -7239,12 +7245,18 @@ double ha_tokudb::read_time( ...@@ -7239,12 +7245,18 @@ double ha_tokudb::read_time(
ret_val = is_clustering ? ret_val + 0.00001 : ret_val; ret_val = is_clustering ? ret_val + 0.00001 : ret_val;
cleanup: cleanup:
if (tokudb_debug & TOKUDB_DEBUG_RETURN) {
TOKUDB_HANDLER_TRACE("return %f", ret_val);
}
DBUG_RETURN(ret_val); DBUG_RETURN(ret_val);
} }
double ha_tokudb::index_only_read_time(uint keynr, double records) { double ha_tokudb::index_only_read_time(uint keynr, double records) {
TOKUDB_HANDLER_DBUG_ENTER(""); TOKUDB_HANDLER_DBUG_ENTER("%u %f", keynr, records);
double ret_val = keyread_time(keynr, 1, (ha_rows)records); double ret_val = keyread_time(keynr, 1, (ha_rows)records);
if (tokudb_debug & TOKUDB_DEBUG_RETURN) {
TOKUDB_HANDLER_TRACE("return %f", ret_val);
}
DBUG_RETURN(ret_val); DBUG_RETURN(ret_val);
} }
...@@ -7319,7 +7331,7 @@ ha_rows ha_tokudb::records_in_range(uint keynr, key_range* start_key, key_range* ...@@ -7319,7 +7331,7 @@ ha_rows ha_tokudb::records_in_range(uint keynr, key_range* start_key, key_range*
cleanup: cleanup:
if (tokudb_debug & TOKUDB_DEBUG_RETURN) { if (tokudb_debug & TOKUDB_DEBUG_RETURN) {
TOKUDB_HANDLER_TRACE("%" PRIu64 " %" PRIu64, (uint64_t) ret_val, rows); TOKUDB_HANDLER_TRACE("return %" PRIu64 " %" PRIu64, (uint64_t) ret_val, rows);
} }
DBUG_RETURN(ret_val); DBUG_RETURN(ret_val);
} }
......
...@@ -777,7 +777,7 @@ extern "C" enum durability_properties thd_get_durability_property(const MYSQL_TH ...@@ -777,7 +777,7 @@ extern "C" enum durability_properties thd_get_durability_property(const MYSQL_TH
#endif #endif
// Determine if an fsync is used when a transaction is committed. // Determine if an fsync is used when a transaction is committed.
static bool tokudb_fsync_on_commit(THD *thd, tokudb_trx_data *trx, DB_TXN *txn) { static bool tokudb_sync_on_commit(THD *thd, tokudb_trx_data *trx, DB_TXN *txn) {
#if MYSQL_VERSION_ID >= 50600 #if MYSQL_VERSION_ID >= 50600
// Check the client durability property which is set during 2PC // Check the client durability property which is set during 2PC
if (thd_get_durability_property(thd) == HA_IGNORE_DURABILITY) if (thd_get_durability_property(thd) == HA_IGNORE_DURABILITY)
...@@ -788,6 +788,8 @@ static bool tokudb_fsync_on_commit(THD *thd, tokudb_trx_data *trx, DB_TXN *txn) ...@@ -788,6 +788,8 @@ static bool tokudb_fsync_on_commit(THD *thd, tokudb_trx_data *trx, DB_TXN *txn)
if (txn->is_prepared(txn) && mysql_bin_log.is_open()) if (txn->is_prepared(txn) && mysql_bin_log.is_open())
return false; return false;
#endif #endif
if (tokudb_fsync_log_period > 0)
return false;
return THDVAR(thd, commit_sync) != 0; return THDVAR(thd, commit_sync) != 0;
} }
...@@ -798,7 +800,7 @@ static int tokudb_commit(handlerton * hton, THD * thd, bool all) { ...@@ -798,7 +800,7 @@ static int tokudb_commit(handlerton * hton, THD * thd, bool all) {
DB_TXN **txn = all ? &trx->all : &trx->stmt; DB_TXN **txn = all ? &trx->all : &trx->stmt;
DB_TXN *this_txn = *txn; DB_TXN *this_txn = *txn;
if (this_txn) { if (this_txn) {
uint32_t syncflag = tokudb_fsync_on_commit(thd, trx, this_txn) ? 0 : DB_TXN_NOSYNC; uint32_t syncflag = tokudb_sync_on_commit(thd, trx, this_txn) ? 0 : DB_TXN_NOSYNC;
if (tokudb_debug & TOKUDB_DEBUG_TXN) { if (tokudb_debug & TOKUDB_DEBUG_TXN) {
TOKUDB_TRACE("commit trx %u txn %p syncflag %u", all, this_txn, syncflag); TOKUDB_TRACE("commit trx %u txn %p syncflag %u", all, this_txn, syncflag);
} }
...@@ -849,6 +851,13 @@ static int tokudb_rollback(handlerton * hton, THD * thd, bool all) { ...@@ -849,6 +851,13 @@ static int tokudb_rollback(handlerton * hton, THD * thd, bool all) {
} }
#if TOKU_INCLUDE_XA #if TOKU_INCLUDE_XA
static bool tokudb_sync_on_prepare(void) {
// skip sync of log if fsync log period > 0
if (tokudb_fsync_log_period > 0)
return false;
else
return true;
}
static int tokudb_xa_prepare(handlerton* hton, THD* thd, bool all) { static int tokudb_xa_prepare(handlerton* hton, THD* thd, bool all) {
TOKUDB_DBUG_ENTER(""); TOKUDB_DBUG_ENTER("");
...@@ -863,6 +872,7 @@ static int tokudb_xa_prepare(handlerton* hton, THD* thd, bool all) { ...@@ -863,6 +872,7 @@ static int tokudb_xa_prepare(handlerton* hton, THD* thd, bool all) {
tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(thd, hton); tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(thd, hton);
DB_TXN* txn = all ? trx->all : trx->stmt; DB_TXN* txn = all ? trx->all : trx->stmt;
if (txn) { if (txn) {
uint32_t syncflag = tokudb_sync_on_prepare() ? 0 : DB_TXN_NOSYNC;
if (tokudb_debug & TOKUDB_DEBUG_TXN) { if (tokudb_debug & TOKUDB_DEBUG_TXN) {
TOKUDB_TRACE("doing txn prepare:%d:%p", all, txn); TOKUDB_TRACE("doing txn prepare:%d:%p", all, txn);
} }
...@@ -871,7 +881,7 @@ static int tokudb_xa_prepare(handlerton* hton, THD* thd, bool all) { ...@@ -871,7 +881,7 @@ static int tokudb_xa_prepare(handlerton* hton, THD* thd, bool all) {
thd_get_xid(thd, (MYSQL_XID*) &thd_xid); thd_get_xid(thd, (MYSQL_XID*) &thd_xid);
// test hook to induce a crash on a debug build // test hook to induce a crash on a debug build
DBUG_EXECUTE_IF("tokudb_crash_prepare_before", DBUG_SUICIDE();); DBUG_EXECUTE_IF("tokudb_crash_prepare_before", DBUG_SUICIDE(););
r = txn->xa_prepare(txn, &thd_xid); r = txn->xa_prepare(txn, &thd_xid, syncflag);
// test hook to induce a crash on a debug build // test hook to induce a crash on a debug build
DBUG_EXECUTE_IF("tokudb_crash_prepare_after", DBUG_SUICIDE();); DBUG_EXECUTE_IF("tokudb_crash_prepare_after", DBUG_SUICIDE(););
} }
......
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