------------------------------------------------------------ revno: 267 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell <[EMAIL PROTECTED]> branch nick: tridge timestamp: Thu 2007-05-10 07:55:46 +1000 message: moved the vnn_map initialisation out of the cmdline code modified: common/cmdline.c cmdline.c-20070416041216-w1zvz91bkdsgjckw-1 common/ctdb.c ctdb.c-20061127094323-t50f58d65iaao5of-2 common/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1 === modified file 'common/cmdline.c' --- a/common/cmdline.c 2007-05-08 23:59:23 +0000 +++ b/common/cmdline.c 2007-05-09 21:55:46 +0000 @@ -89,7 +89,7 @@ struct ctdb_context *ctdb_cmdline_init(struct event_context *ev) { struct ctdb_context *ctdb; - int i, ret; + int ret; if (ctdb_cmdline.nlist == NULL) { printf("You must provide a node list with --nlist\n"); @@ -156,26 +156,6 @@ } } - /* initialize the vnn mapping table */ -/* -XXX we currently initialize it to the maximum number of nodes to -XXX make it behave the same way as previously. -XXX Once we have recovery working we should initialize this always to -XXX generation==0 (==invalid) and let the recovery tool populate this -XXX table for the daemons. -*/ - ctdb->vnn_map = talloc_zero_size(ctdb, offsetof(struct ctdb_vnn_map, map) + 4*ctdb->num_nodes); - if (ctdb->vnn_map == NULL) { - DEBUG(0,(__location__ " Unable to allocate vnn_map structure\n")); - exit(1); - } - ctdb->vnn_map->generation = 1; - ctdb->vnn_map->size = ctdb->num_nodes; - for(i=0;i<ctdb->vnn_map->size;i++){ - ctdb->vnn_map->map[i] = i%ctdb->num_nodes; - } - - return ctdb; }
=== modified file 'common/ctdb.c' --- a/common/ctdb.c 2007-05-06 19:02:48 +0000 +++ b/common/ctdb.c 2007-05-09 21:55:46 +0000 @@ -152,6 +152,25 @@ return -1; } } + + /* initialize the vnn mapping table now that we have num_nodes setup */ +/* +XXX we currently initialize it to the maximum number of nodes to +XXX make it behave the same way as previously. +XXX Once we have recovery working we should initialize this always to +XXX generation==0 (==invalid) and let the recovery tool populate this +XXX table for the daemons. +*/ + ctdb->vnn_map = talloc_zero_size(ctdb, offsetof(struct ctdb_vnn_map, map) + 4*ctdb->num_nodes); + if (ctdb->vnn_map == NULL) { + DEBUG(0,(__location__ " Unable to allocate vnn_map structure\n")); + exit(1); + } + ctdb->vnn_map->generation = 1; + ctdb->vnn_map->size = ctdb->num_nodes; + for(i=0;i<ctdb->vnn_map->size;i++){ + ctdb->vnn_map->map[i] = i%ctdb->num_nodes; + } talloc_free(lines); return 0; === modified file 'common/ctdb_daemon.c' --- a/common/ctdb_daemon.c 2007-05-09 21:43:18 +0000 +++ b/common/ctdb_daemon.c 2007-05-09 21:55:46 +0000 @@ -721,7 +721,6 @@ close(fd[1]); - ctdb->ev = event_context_init(NULL); fde = event_add_fd(ctdb->ev, ctdb, fd[0], EVENT_FD_READ|EVENT_FD_AUTOCLOSE, ctdb_read_from_parent, &fd[0]); fde = event_add_fd(ctdb->ev, ctdb, ctdb->daemon.sd, EVENT_FD_READ|EVENT_FD_AUTOCLOSE, ctdb_accept_client, ctdb);