There are cruft from the old primary/chain/splay replication code. All
current code says <0 is stray, 0 is primary, and >0 is replica. That is,
the role is the acting vector position, or -1 if not in the vector.
Signed-off-by: Sage Weil <sage@newdream.net>
{
if (!nrep)
nrep = acting.size();
- int rank = calc_pg_rank(osd, acting, nrep);
-
- if (rank < 0)
- return PG_ROLE_STRAY;
- else if (rank == 0)
- return PG_ROLE_HEAD;
- else if (rank == 1)
- return PG_ROLE_ACKER;
- else
- return PG_ROLE_MIDDLE;
+ return calc_pg_rank(osd, acting, nrep);
}
#include <ext/hash_set>
using __gnu_cxx::hash_set;
-
-
-/*
- * some system constants
- */
-
-// pg roles
-#define PG_ROLE_STRAY -1
-#define PG_ROLE_HEAD 0
-#define PG_ROLE_ACKER 1
-#define PG_ROLE_MIDDLE 2 // der.. misnomer
-//#define PG_ROLE_TAIL 2
-
-
-
/*
* we track up to two intervals during which the osd was alive and
* healthy. the most recent is [up_from,up_thru), where up_thru is
int get_role() const { return role; }
void set_role(int r) { role = r; }
- bool is_primary() const { return role == PG_ROLE_HEAD; }
+ bool is_primary() const { return role == 0; }
bool is_replica() const { return role > 0; }
epoch_t get_last_peering_reset() const { return last_peering_reset; }