resolve a warning issue about inconsistent variable types with
Building CXX object src/mon/CMakeFiles/mon.dir/Elector.cc.o
../src/mon/Elector.cc: In member function 'void Elector::
notify_rank_removed(int)':
../src/mon/Elector.cc:765:15: warning: comparison of integer
expressions of different signedness: 'int' and 'unsigned int'
[-Wsign-compare] if (rank_removed < paxos_size()) {
warning:comparison of integer expressions of different
signedness: 'unsigned int' and 'const int'
[-Wsign-compare] if (total < NR_ROUNDS)
Fixes: https://tracker.ceph.com/issues/63917
Signed-off-by: cuiming <cuiming_yewu@cmss.chinamobile.com>
In the case where we are removing the highest rank,
we erase the removed rank from all sets.
*/
- if (rank_removed < paxos_size()) {
+ if (std::cmp_less(rank_removed, paxos_size())) {
for (unsigned i = rank_removed + 1; i <= paxos_size() ; ++i) {
if (live_pinging.count(i)) {
dead_pinging.erase(i-1);
scoreboard.end(),
0);
for (unsigned score : scoreboard) {
- if (total < NR_ROUNDS) {
+ if (std::cmp_less(total, NR_ROUNDS)) {
// not quite statistically significant. to reduce the false positive,
// just consider it fair
continue;