mirror of
https://github.com/samba-team/samba.git
synced 2025-02-09 09:57:48 +03:00
setup the random number generator a bit better
(This used to be ctdb commit 708585eb0ed31b0df6543a1d7a20b82e751877c2)
This commit is contained in:
parent
1e38ae491f
commit
50390bcb18
@ -508,12 +508,11 @@ static void election_handler(struct ctdb_context *ctdb, uint64_t srvid,
|
||||
struct election_message *em = (struct election_message *)data.dptr;
|
||||
TALLOC_CTX *mem_ctx;
|
||||
|
||||
mem_ctx = talloc_new(ctdb);
|
||||
|
||||
if (em->vnn==ctdb_get_vnn(ctdb)) {
|
||||
talloc_free(mem_ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
mem_ctx = talloc_new(ctdb);
|
||||
|
||||
/* someone called an election. check their election data
|
||||
and if we disagree and we would rather be the elected node,
|
||||
@ -628,13 +627,12 @@ again:
|
||||
goto again;
|
||||
}
|
||||
|
||||
|
||||
/* verify that the recmaster node is still active */
|
||||
for (j=0; j<nodemap->num; j++) {
|
||||
if (nodemap->nodes[j].vnn==recmaster) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!(nodemap->nodes[j].flags&NODE_FLAGS_CONNECTED)) {
|
||||
DEBUG(0, ("Recmaster node %u no longer available. Force reelection\n", nodemap->nodes[j].vnn));
|
||||
force_election(ctdb, mem_ctx, vnn, nodemap);
|
||||
@ -736,7 +734,7 @@ again:
|
||||
|
||||
|
||||
/* there better be the same number of lmasters in the vnn map
|
||||
as there are active nodes or well have to do a recovery
|
||||
as there are active nodes or we will have to do a recovery
|
||||
*/
|
||||
if (vnnmap->size != num_active) {
|
||||
DEBUG(0, (__location__ "The vnnmap count is different from the number of active nodes. %d vs %d\n", vnnmap->size, num_active));
|
||||
@ -856,6 +854,8 @@ int main(int argc, const char *argv[])
|
||||
}
|
||||
#endif
|
||||
|
||||
srandom(getpid() ^ time(NULL));
|
||||
|
||||
ev = event_context_init(NULL);
|
||||
|
||||
/* initialise ctdb */
|
||||
|
Loading…
x
Reference in New Issue
Block a user