| 182 | class LoadComparator : public Comparator { |
| 183 | public: |
| 184 | int Compare(const TabletNodePtr& a, const TabletNodePtr& b, const std::string& table_name) { |
| 185 | uint64_t a_read_pending = GetPending(a); |
| 186 | uint64_t b_read_pending = GetPending(b); |
| 187 | if (a_read_pending < b_read_pending) { |
| 188 | return -1; |
| 189 | } else if (a_read_pending > b_read_pending) { |
| 190 | return 1; |
| 191 | } |
| 192 | |
| 193 | uint64_t a_row_read_delay = a->GetRowReadDelay(); |
| 194 | uint64_t b_row_read_delay = b->GetRowReadDelay(); |
| 195 | if (a_row_read_delay < b_row_read_delay) { |
| 196 | return -1; |
| 197 | } else if (a_row_read_delay > b_row_read_delay) { |
| 198 | return 1; |
| 199 | } |
| 200 | |
| 201 | uint64_t a_qps = a->GetQps(table_name); |
| 202 | uint64_t b_qps = b->GetQps(table_name); |
| 203 | if (a_qps < b_qps) { |
| 204 | return -1; |
| 205 | } else if (a_qps > b_qps) { |
| 206 | return 1; |
| 207 | } else { |
| 208 | return 0; |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | virtual ~LoadComparator() {} |
| 213 | }; |
nothing calls this directly
no test coverage detected