Skip to content

Commit

Permalink
Fix error message in MyRocks
Browse files Browse the repository at this point in the history
Summary:
This is to fix the issue raised here - facebook#853
Essentially the correct parameter name is rocksdb_max_row_locks, so the error message should reflect this parameter name.

If RocksDB returns an error due to a "lock limit", then MyRocks will override the error message to indicate the correct parameter name.

Differential Revision: D13599991

fbshipit-source-id: d1ec276
  • Loading branch information
bhatvinay authored and inikep committed Aug 13, 2020
1 parent 8260be9 commit c107898
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
Expand Up @@ -15,7 +15,7 @@ count(b)
3000000
ALTER TABLE t1 ADD INDEX kb(b), ALGORITHM=INPLACE;
ALTER TABLE t1 ADD INDEX kb_copy(b), ALGORITHM=COPY;
ERROR HY000: Got error 10 'Operation aborted: Failed to acquire lock due to max_num_locks limit' from ROCKSDB
ERROR HY000: Got error 10 'Operation aborted: Failed to acquire lock due to rocksdb_max_row_locks limit' from ROCKSDB
set session rocksdb_bulk_load=1;
ALTER TABLE t1 ADD INDEX kb_copy(b), ALGORITHM=COPY;
set session rocksdb_bulk_load=0;
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/suite/rocksdb/r/rocksdb.result
Expand Up @@ -1345,7 +1345,7 @@ insert into t1 select (@a:=@a+1), 1234 from information_schema.session_variables
set @tmp1= @@rocksdb_max_row_locks;
set rocksdb_max_row_locks= 20;
update t1 set a=a+10;
ERROR HY000: Got error 10 'Operation aborted: Failed to acquire lock due to max_num_locks limit' from ROCKSDB
ERROR HY000: Got error 10 'Operation aborted: Failed to acquire lock due to rocksdb_max_row_locks limit' from ROCKSDB
DROP TABLE t1;
#
# Test AUTO_INCREMENT behavior problem,
Expand Down
16 changes: 13 additions & 3 deletions storage/rocksdb/ha_rocksdb.cc
Expand Up @@ -6778,11 +6778,21 @@ int ha_rocksdb::rdb_error_to_mysql(const rocksdb::Status &s,
return -1;
}

std::string errMsg;
if (s.IsLockLimit()) {
errMsg = "Operation aborted: Failed to acquire lock due to "
"rocksdb_max_row_locks limit";
} else {
errMsg = s.ToString();
}

if (opt_msg) {
std::string concatenated_error = s.ToString() + " (" + std::string(opt_msg) + ")";
my_error(ER_GET_ERRMSG, MYF(0), s.code(), concatenated_error.c_str(), rocksdb_hton_name);
std::string concatenated_error = errMsg + " (" + std::string(opt_msg) + ")";
my_error(ER_GET_ERRMSG, MYF(0), s.code(), concatenated_error.c_str(),
rocksdb_hton_name);
} else {
my_error(ER_GET_ERRMSG, MYF(0), s.code(), s.ToString().c_str(), rocksdb_hton_name);
my_error(ER_GET_ERRMSG, MYF(0), s.code(), errMsg.c_str(),
rocksdb_hton_name);
}

return err;
Expand Down

0 comments on commit c107898

Please sign in to comment.