diff options
author | Ronnie Sahlberg <sahlberg@ronnie> | 2007-04-27 18:43:52 +1000 |
---|---|---|
committer | Ronnie Sahlberg <sahlberg@ronnie> | 2007-04-27 18:43:52 +1000 |
commit | ec3856ead9089954ad61c539806262329c934dc6 (patch) | |
tree | e5c5cb97858398ce081cb42f33affe1316126643 /ctdb/common/cmdline.c | |
parent | 7d3ab0f5fba2be21802709ee41862db36ab24ac5 (diff) | |
download | samba-ec3856ead9089954ad61c539806262329c934dc6.tar.gz |
add a mapping table from a hash value to a lmaster vnn number
update ctdb_lmaster() return the lmaster based on this tables contents
initialize the vnn table based on number of nodes for now.
later when recovery is implemented the recovery process will populate
this mapping table.
(This used to be ctdb commit 71e440f6c26ea074f9887237c962101c8cef8c80)
Diffstat (limited to 'ctdb/common/cmdline.c')
-rw-r--r-- | ctdb/common/cmdline.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/ctdb/common/cmdline.c b/ctdb/common/cmdline.c index 2b9d5f43c6b..988fee81e84 100644 --- a/ctdb/common/cmdline.c +++ b/ctdb/common/cmdline.c @@ -66,7 +66,7 @@ struct poptOption popt_ctdb_cmdline[] = { struct ctdb_context *ctdb_cmdline_init(struct event_context *ev) { struct ctdb_context *ctdb; - int ret; + int i, ret; if (ctdb_cmdline.nlist == NULL || ctdb_cmdline.myaddress == NULL) { printf("You must provide a node list with --nlist and an address with --listen\n"); @@ -120,6 +120,31 @@ struct ctdb_context *ctdb_cmdline_init(struct event_context *ev) exit(1); } + /* 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(ctdb, struct ctdb_vnn_map); + 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 = 1024; + ctdb->vnn_map->map = talloc_array(ctdb->vnn_map, uint32_t, ctdb->vnn_map->size); + if (ctdb->vnn_map->map == NULL) { + DEBUG(0,(__location__ " Unable to allocate vnn_map->map structure\n")); + exit(1); + } + for(i=0;i<ctdb->vnn_map->size;i++){ + ctdb->vnn_map->map[i] = i%ctdb->num_nodes; + } + + return ctdb; } |