| 770 | } |
| 771 | |
| 772 | comm::RetCode HeartBeatLock::Lock(const int vpid, int &sub_id, int &store_id, int &queue_id) { |
| 773 | auto &&opt = impl_->consumer->GetConsumerOption(); |
| 774 | |
| 775 | auto topic_id = impl_->consumer->GetTopicID(); |
| 776 | |
| 777 | comm::ConsumerHeartBeatLockBP::GetThreadInstance()->OnLock(topic_id, sub_id, store_id, queue_id); |
| 778 | |
| 779 | if (vpid >= impl_->nproc) { |
| 780 | QLErr("ERR: vpid err. vpid %u impl_->nproc %u", vpid, impl_->nproc); |
| 781 | comm::ConsumerHeartBeatLockBP::GetThreadInstance()->OnProcLack(topic_id); |
| 782 | exit(-1); |
| 783 | } |
| 784 | |
| 785 | Queue_t queue; |
| 786 | { |
| 787 | comm::utils::RWLock l(impl_->rwlock, comm::utils::RWLock::LockMode::READ); |
| 788 | memcpy(&queue, &impl_->buf->queues[vpid], sizeof(Queue_t)); |
| 789 | } |
| 790 | QLVerb("vpid %u queue sub_id %u store_id %u queue_id %u", vpid, queue.sub_id, queue.store_id, queue.queue_id); |
| 791 | |
| 792 | |
| 793 | comm::RetCode ret; |
| 794 | if (comm::RetCode::RET_OK != (ret = DoLock(vpid, &queue))) { |
| 795 | if (comm::as_integer(ret) < 0) { |
| 796 | QLErr("ERR: DoLock ret %d vpid %u", comm::as_integer(ret), vpid); |
| 797 | comm::ConsumerHeartBeatLockBP::GetThreadInstance()->OnLockFail(topic_id, sub_id, store_id, queue_id); |
| 798 | } |
| 799 | return ret; |
| 800 | } |
| 801 | sub_id = queue.sub_id; |
| 802 | store_id = queue.store_id; |
| 803 | queue_id = queue.queue_id; |
| 804 | |
| 805 | comm::ConsumerHeartBeatLockBP::GetThreadInstance()->OnLockSucc(topic_id, sub_id, store_id, queue_id); |
| 806 | return comm::RetCode::RET_OK; |
| 807 | } |
| 808 | |
| 809 | comm::RetCode HeartBeatLock::GetQueuesDistribute(vector<Queue_t> &queues) { |
| 810 | queues.clear(); |
no test coverage detected