| 102 | } |
| 103 | |
| 104 | bool BaseMgr::NeedSkipAdd(const uint64_t cursor_id, const comm::proto::AddRequest &req) { |
| 105 | comm::RetCode ret; |
| 106 | |
| 107 | if (0 == req.items_size()) { |
| 108 | QLInfo("add req skip. item size 0"); |
| 109 | return true; |
| 110 | } |
| 111 | |
| 112 | const int topic_id = impl_->store->GetTopicID(); |
| 113 | |
| 114 | StoreMetaQueue &meta_queue = impl_->meta_queues[req.queue_id()]; |
| 115 | StoreMeta back_meta; |
| 116 | if (meta_queue.Back(back_meta) && back_meta.GetCursorID() >= cursor_id) { |
| 117 | // cursor_id already at meta_queue's back mostly in batch propose sistuation. |
| 118 | return true; |
| 119 | } |
| 120 | |
| 121 | shared_ptr<const config::TopicConfig> topic_config; |
| 122 | if (comm::RetCode::RET_OK != (ret = config::GlobalConfig::GetThreadInstance()->GetTopicConfigByTopicID(topic_id, topic_config))) { |
| 123 | QLErr("GetTopicConfig ret %d", as_integer(ret)); |
| 124 | return true; |
| 125 | } |
| 126 | |
| 127 | if (!topic_config->IsValidQueue(req.queue_id())) { |
| 128 | QLErr("IsValidQueue fail. queue_id %d", req.queue_id()); |
| 129 | return true; |
| 130 | } |
| 131 | /* |
| 132 | shared_ptr<const config::proto::Pub> pub; |
| 133 | if (comm::RetCode::RET_OK != (ret = topic_config->GetPubByPubID(req.pub_id(), pub))) { |
| 134 | QLErr("GetPubByPubID ret %d pub_id %d", as_integer(ret), req.pub_id()); |
| 135 | return true; |
| 136 | } |
| 137 | |
| 138 | SyncCtrl *sync = impl_->store->GetSyncCtrl(); |
| 139 | for (size_t i{0}; i < pub->sub_ids_size(); ++i) { |
| 140 | auto &&sub_id(pub->sub_ids(i)); |
| 141 | |
| 142 | uint64_t next_cursor_id; |
| 143 | ret = sync->GetCursorID(sub_id, req.queue_id(), next_cursor_id, false); |
| 144 | if (0 < as_integer(ret)) { |
| 145 | QLWarn("GetCursorID ret %d sub_id %d queue_id %d", ret, sub_id, req.queue_id()); |
| 146 | return false; |
| 147 | } else if (0 == as_integer(ret) && cursor_id <= next_cursor_id) { |
| 148 | QLInfo("add req skip. cursor_id %" PRIu64 " next_cursor_id %" PRIu64, cursor_id, next_cursor_id); |
| 149 | return true; |
| 150 | } |
| 151 | } |
| 152 | */ |
| 153 | return false; |
| 154 | } |
| 155 | |
| 156 | comm::RetCode BaseMgr::Get(const comm::proto::GetRequest &req, comm::proto::GetResponse &resp) { |
| 157 | comm::RetCode ret; |
nothing calls this directly
no test coverage detected