mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2024-12-14 11:58:02 +00:00
chore: zset error log (from 1.18 branch) (#3109)
This commit is contained in:
parent
0394387a5f
commit
b3ca27068a
3 changed files with 25 additions and 3 deletions
|
@ -357,8 +357,18 @@ OpResult<string> RunCbOnFirstNonEmptyBlocking(Transaction* trans, int req_obj_ty
|
|||
return OpStatus::OK;
|
||||
};
|
||||
trans->Execute(std::move(cb), true);
|
||||
if (info)
|
||||
if (info) {
|
||||
*info = "BLOCK/";
|
||||
for (unsigned sid = 0; sid < shard_set->size(); sid++) {
|
||||
if (!trans->IsActive(sid))
|
||||
continue;
|
||||
if (auto wake_key = trans->GetWakeKey(sid); wake_key)
|
||||
*info += absl::StrCat("sid:", sid, ",key:", *wake_key, ",");
|
||||
}
|
||||
*info += "/";
|
||||
*info += trans->DEBUGV18_BlockInfo();
|
||||
*info += "/";
|
||||
}
|
||||
return result_key;
|
||||
}
|
||||
|
||||
|
|
|
@ -363,6 +363,13 @@ class Transaction {
|
|||
return shard_data_[SidToId(sid)].local_mask;
|
||||
}
|
||||
|
||||
// Remove once BZPOP is stabilized
|
||||
std::string DEBUGV18_BlockInfo() {
|
||||
return "claimed=" + std::to_string(blocking_barrier_.IsClaimed()) +
|
||||
" coord_state=" + std::to_string(int(coordinator_state_)) +
|
||||
" local_res=" + std::to_string(int(local_result_));
|
||||
}
|
||||
|
||||
private:
|
||||
// Holds number of locks for each IntentLock::Mode: shared and exlusive.
|
||||
struct LockCnt {
|
||||
|
|
|
@ -1325,7 +1325,7 @@ void BZPopMinMax(CmdArgList args, ConnectionContext* cntx, bool is_max) {
|
|||
Transaction* transaction = cntx->transaction;
|
||||
|
||||
std::string dinfo;
|
||||
std::string callback_ran_key = "/NONE/";
|
||||
optional<std::string> callback_ran_key;
|
||||
OpResult<ScoredArray> popped_array;
|
||||
auto cb = [is_max, &popped_array, &callback_ran_key](Transaction* t, EngineShard* shard,
|
||||
std::string_view key) {
|
||||
|
@ -1339,10 +1339,15 @@ void BZPopMinMax(CmdArgList args, ConnectionContext* cntx, bool is_max) {
|
|||
|
||||
auto* rb = static_cast<RedisReplyBuilder*>(cntx->reply_builder());
|
||||
if (popped_key) {
|
||||
if (!callback_ran_key) {
|
||||
LOG(ERROR) << "BUG: Callback didn't run! " << popped_key.value() << " " << dinfo;
|
||||
return rb->SendNullArray();
|
||||
}
|
||||
|
||||
DVLOG(1) << "BZPop " << transaction->DebugId() << " popped from key " << popped_key; // key.
|
||||
CHECK(popped_array.ok()) << dinfo;
|
||||
CHECK_EQ(popped_array->size(), 1u)
|
||||
<< popped_key << " ran " << callback_ran_key << " info " << dinfo;
|
||||
<< popped_key << " ran " << *callback_ran_key << " info " << dinfo;
|
||||
rb->StartArray(3);
|
||||
rb->SendBulkString(*popped_key);
|
||||
rb->SendBulkString(popped_array->front().first);
|
||||
|
|
Loading…
Reference in a new issue