mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
fix(tx): guard parallel writes to local result (#2417)
This commit is contained in:
parent
39e7e5ad87
commit
078db5caae
2 changed files with 8 additions and 4 deletions
|
@ -484,14 +484,16 @@ bool Transaction::RunInShard(EngineShard* shard, bool txq_ooo) {
|
|||
local_result_ = status;
|
||||
} else {
|
||||
if (status == OpStatus::OUT_OF_MEMORY) {
|
||||
absl::base_internal::SpinLockHolder lk{&local_result_mu_};
|
||||
CHECK(local_result_ == OpStatus::OK || local_result_ == OpStatus::OUT_OF_MEMORY);
|
||||
local_result_ = status;
|
||||
} else {
|
||||
CHECK_EQ(OpStatus::OK, status);
|
||||
}
|
||||
}
|
||||
} catch (std::bad_alloc&) {
|
||||
// TODO: to log at most once per sec.
|
||||
LOG_FIRST_N(ERROR, 16) << " out of memory";
|
||||
LOG_FIRST_N(ERROR, 16) << " out of memory"; // TODO: to log at most once per sec.
|
||||
absl::base_internal::SpinLockHolder lk{&local_result_mu_};
|
||||
local_result_ = OpStatus::OUT_OF_MEMORY;
|
||||
} catch (std::exception& e) {
|
||||
LOG(FATAL) << "Unexpected exception " << e.what();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue