Skip to content

Commit 8fcd947

Browse files
committed
MDEV-18080, part#1: MyRocks is slow with log-bin=off
The cause for this was fix MDEV-15372, which was trying to speed up the parallel slave. Part#1: Do not attempt the "optimization" for transactions that are not replication slave workers.
1 parent e42192d commit 8fcd947

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

storage/rocksdb/ha_rocksdb.cc

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3750,20 +3750,32 @@ static int rocksdb_commit(handlerton* hton, THD* thd, bool commit_tx)
37503750
- For a COMMIT statement that finishes a multi-statement transaction
37513751
- For a statement that has its own transaction
37523752
*/
3753+
if (thd->slave_thread)
3754+
{
3755+
// An attempt to make parallel slave performant (not fully successful,
3756+
// see MDEV-15372):
37533757

3754-
// First, commit without syncing. This establishes the commit order
3755-
tx->set_sync(false);
3756-
bool tx_had_writes = tx->get_write_count()? true : false ;
3757-
if (tx->commit()) {
3758-
DBUG_RETURN(HA_ERR_ROCKSDB_COMMIT_FAILED);
3759-
}
3760-
thd_wakeup_subsequent_commits(thd, 0);
3758+
// First, commit without syncing. This establishes the commit order
3759+
tx->set_sync(false);
3760+
bool tx_had_writes = tx->get_write_count()? true : false ;
3761+
if (tx->commit()) {
3762+
DBUG_RETURN(HA_ERR_ROCKSDB_COMMIT_FAILED);
3763+
}
3764+
thd_wakeup_subsequent_commits(thd, 0);
37613765

3762-
if (tx_had_writes && rocksdb_flush_log_at_trx_commit == FLUSH_LOG_SYNC)
3766+
if (tx_had_writes && rocksdb_flush_log_at_trx_commit == FLUSH_LOG_SYNC)
3767+
{
3768+
rocksdb::Status s= rdb->FlushWAL(true);
3769+
if (!s.ok())
3770+
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
3771+
}
3772+
}
3773+
else
37633774
{
3764-
rocksdb::Status s= rdb->FlushWAL(true);
3765-
if (!s.ok())
3766-
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
3775+
/* Not a slave thread */
3776+
if (tx->commit()) {
3777+
DBUG_RETURN(HA_ERR_ROCKSDB_COMMIT_FAILED);
3778+
}
37673779
}
37683780
} else {
37693781
/*

0 commit comments

Comments
 (0)