Skip to content

Commit

Permalink
Fix error message in MyRocks
Browse files Browse the repository at this point in the history
Upstream commit ID : fb-mysql-5.6.35/3ed8b062eaacb2a8dd9616bbf4d3f267af7ba91e
PS-6864 : Merge fb-prod201902

Summary:
This is to fix the issue raised here - facebook/mysql-5.6#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: 7c6bf6fa584
  • Loading branch information
bhatvinay authored and oleksandr-kachan committed Apr 12, 2024
1 parent 19dbb43 commit 44806b4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mysql-test/suite/rocksdb/r/rocksdb.result
Expand Up @@ -1411,7 +1411,7 @@ Warning 1287 Setting user variables within expressions is deprecated and will be
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
13 changes: 10 additions & 3 deletions storage/rocksdb/ha_rocksdb.cc
Expand Up @@ -6509,13 +6509,20 @@ 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) + ")";
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(),
my_error(ER_GET_ERRMSG, MYF(0), s.code(), errMsg.c_str(),
rocksdb_hton_name);
}

Expand Down

0 comments on commit 44806b4

Please sign in to comment.