diff options
Diffstat (limited to 'storage/rocksdb/ha_rocksdb.cc')
-rw-r--r-- | storage/rocksdb/ha_rocksdb.cc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index 49104911c69..9f73b95cb4d 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation @@ -3753,12 +3753,13 @@ static int rocksdb_commit(handlerton* hton, THD* thd, bool commit_tx) // First, commit without syncing. This establishes the commit order tx->set_sync(false); + bool tx_had_writes = tx->get_write_count()? true : false ; if (tx->commit()) { DBUG_RETURN(HA_ERR_ROCKSDB_COMMIT_FAILED); } 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); if (!s.ok()) @@ -3769,7 +3770,6 @@ static int rocksdb_commit(handlerton* hton, THD* thd, bool commit_tx) We get here when committing a statement within a transaction. */ tx->make_stmt_savepoint_permanent(); - tx->make_stmt_savepoint_permanent(); } if (my_core::thd_tx_isolation(thd) <= ISO_READ_COMMITTED) { @@ -5437,6 +5437,9 @@ static int rocksdb_done_func(void *const p) { //rocksdb_tbl_options = nullptr; rocksdb_stats = nullptr; + my_free(rocksdb_update_cf_options); + rocksdb_update_cf_options = nullptr; + my_error_unregister(HA_ERR_ROCKSDB_FIRST, HA_ERR_ROCKSDB_LAST); /* @@ -8559,9 +8562,17 @@ int ha_rocksdb::index_read_map_impl(uchar *const buf, const uchar *const key, packed_size); uint end_key_packed_size = 0; + /* + In MariaDB, the end_key is always the bigger end of the range. + If we are doing a reverse-ordered scan (that is, walking from the bigger + key values to smaller), we should use the smaller end of range as end_key. + */ const key_range *cur_end_key= end_key; - if (find_flag == HA_READ_PREFIX_LAST_OR_PREV) + if (find_flag == HA_READ_PREFIX_LAST_OR_PREV || + find_flag == HA_READ_BEFORE_KEY) + { cur_end_key= m_start_range; + } const uint eq_cond_len = calc_eq_cond_len(kd, find_flag, slice, bytes_changed_by_succ, cur_end_key, @@ -14001,6 +14012,8 @@ rocksdb_set_update_cf_options(THD *const /* unused */, RDB_MUTEX_LOCK_CHECK(rdb_sysvars_mutex); + my_free(*reinterpret_cast<char **>(var_ptr)); + if (!val) { *reinterpret_cast<char **>(var_ptr) = nullptr; RDB_MUTEX_UNLOCK_CHECK(rdb_sysvars_mutex); |