Commit 2b45eb77 authored by Sergei Petrunia's avatar Sergei Petrunia

MDEV-17261: sysbench oltp read only too slow for MyRocks

An error in "group commit with MariaDB's binlog" code: we would flush
the WAL even when the transaction did not do any writes (and so the logic
in myrocks::Rdb_transaction::commit caused it to rollback).
parent 61a6f4bd
...@@ -3753,12 +3753,13 @@ static int rocksdb_commit(handlerton* hton, THD* thd, bool commit_tx) ...@@ -3753,12 +3753,13 @@ static int rocksdb_commit(handlerton* hton, THD* thd, bool commit_tx)
// First, commit without syncing. This establishes the commit order // First, commit without syncing. This establishes the commit order
tx->set_sync(false); tx->set_sync(false);
bool tx_had_writes = tx->get_write_count()? true : false ;
if (tx->commit()) { if (tx->commit()) {
DBUG_RETURN(HA_ERR_ROCKSDB_COMMIT_FAILED); DBUG_RETURN(HA_ERR_ROCKSDB_COMMIT_FAILED);
} }
thd_wakeup_subsequent_commits(thd, 0); thd_wakeup_subsequent_commits(thd, 0);
if (rocksdb_flush_log_at_trx_commit == FLUSH_LOG_SYNC) if (tx_had_writes && rocksdb_flush_log_at_trx_commit == FLUSH_LOG_SYNC)
{ {
rocksdb::Status s= rdb->FlushWAL(true); rocksdb::Status s= rdb->FlushWAL(true);
if (!s.ok()) if (!s.ok())
......
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