ctdb-daemon: Rename struct ctdb_dbid_map to ctdb_dbid_map_old
authorAmitay Isaacs <amitay@gmail.com>
Thu, 29 Oct 2015 06:46:05 +0000 (17:46 +1100)
committerMartin Schwenke <martins@samba.org>
Tue, 3 Nov 2015 23:47:15 +0000 (00:47 +0100)
Match struct ctdb_dbid as per protocol/protocol.h

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/client/ctdb_client.c
ctdb/include/ctdb_client.h
ctdb/include/ctdb_protocol.h
ctdb/server/ctdb_recover.c
ctdb/server/ctdb_recoverd.c
ctdb/tools/ctdb.c

index 90b7891f9658011688a35254ba1779c50c635a7e..407eefd8155744e1cb86453242fcad366600d71e 100644 (file)
@@ -1533,7 +1533,7 @@ int ctdb_ctrl_setrecmaster(struct ctdb_context *ctdb, struct timeval timeout, ui
   get a list of databases off a remote node
  */
 int ctdb_ctrl_getdbmap(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, 
-                      TALLOC_CTX *mem_ctx, struct ctdb_dbid_map **dbmap)
+                      TALLOC_CTX *mem_ctx, struct ctdb_dbid_map_old **dbmap)
 {
        int ret;
        TDB_DATA outdata;
@@ -1547,7 +1547,7 @@ int ctdb_ctrl_getdbmap(struct ctdb_context *ctdb, struct timeval timeout, uint32
                return -1;
        }
 
-       *dbmap = (struct ctdb_dbid_map *)talloc_memdup(mem_ctx, outdata.dptr, outdata.dsize);
+       *dbmap = (struct ctdb_dbid_map_old *)talloc_memdup(mem_ctx, outdata.dptr, outdata.dsize);
        talloc_free(outdata.dptr);
                    
        return 0;
index 6e34df0f4526ff33a9ef56ba5fed3d4d265bcf73..5e43347c712ac4ab57ea2a843564d28a16a92969 100644 (file)
@@ -203,7 +203,7 @@ int ctdb_ctrl_setrecmaster(struct ctdb_context *ctdb, struct timeval timeout,
 
 int ctdb_ctrl_getdbmap(struct ctdb_context *ctdb, struct timeval timeout,
                       uint32_t destnode, TALLOC_CTX *mem_ctx,
-                      struct ctdb_dbid_map **dbmap);
+                      struct ctdb_dbid_map_old **dbmap);
 
 int ctdb_ctrl_getnodemap(struct ctdb_context *ctdb, struct timeval timeout,
                         uint32_t destnode, TALLOC_CTX *mem_ctx,
index c9f0a9d86a1e367a4eb4de1a801095529c523b0b..6505873d5d8267f07678b30d934229519216fc1f 100644 (file)
@@ -767,15 +767,18 @@ struct ctdb_notify_data_old {
 
 /* table that contains a list of all dbids on a node
  */
-struct ctdb_dbid_map {
-       uint32_t num;
-       struct ctdb_dbid {
-               uint32_t dbid;
+
+struct ctdb_dbid {
+       uint32_t db_id;
 #define CTDB_DB_FLAGS_PERSISTENT       0x01
 #define CTDB_DB_FLAGS_READONLY         0x02
 #define CTDB_DB_FLAGS_STICKY           0x04
-               uint8_t flags;
-       } dbs[1];
+       uint8_t flags;
+};
+
+struct ctdb_dbid_map_old {
+       uint32_t num;
+       struct ctdb_dbid dbs[1];
 };
 
 #define CTDB_RECOVERY_NORMAL           0
index 9ca4ab3502010f4b0f5cbc20d4e7ecebf5be5bfa..623d18ad03b40075d6ca2d0690adad218bd77071 100644 (file)
@@ -91,7 +91,7 @@ ctdb_control_getdbmap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indat
 {
        uint32_t i, len;
        struct ctdb_db_context *ctdb_db;
-       struct ctdb_dbid_map *dbid_map;
+       struct ctdb_dbid_map_old *dbid_map;
 
        CHECK_CONTROL_DATA_SIZE(0);
 
@@ -101,17 +101,17 @@ ctdb_control_getdbmap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indat
        }
 
 
-       outdata->dsize = offsetof(struct ctdb_dbid_map, dbs) + sizeof(dbid_map->dbs[0])*len;
+       outdata->dsize = offsetof(struct ctdb_dbid_map_old, dbs) + sizeof(dbid_map->dbs[0])*len;
        outdata->dptr  = (unsigned char *)talloc_zero_size(outdata, outdata->dsize);
        if (!outdata->dptr) {
                DEBUG(DEBUG_ALERT, (__location__ " Failed to allocate dbmap array\n"));
                exit(1);
        }
 
-       dbid_map = (struct ctdb_dbid_map *)outdata->dptr;
+       dbid_map = (struct ctdb_dbid_map_old *)outdata->dptr;
        dbid_map->num = len;
        for (i=0,ctdb_db=ctdb->db_list;ctdb_db;i++,ctdb_db=ctdb_db->next){
-               dbid_map->dbs[i].dbid       = ctdb_db->db_id;
+               dbid_map->dbs[i].db_id       = ctdb_db->db_id;
                if (ctdb_db->persistent != 0) {
                        dbid_map->dbs[i].flags |= CTDB_DB_FLAGS_PERSISTENT;
                }
index 92132038a419353c63eab799d54c77ee6d6b061c..e1f580a4fb2bc9114e3a078e67ce0c005977b476 100644 (file)
@@ -565,7 +565,7 @@ static int set_recovery_master(struct ctdb_context *ctdb, struct ctdb_node_map_o
 */
 static int update_db_priority_on_remote_nodes(struct ctdb_context *ctdb,
        struct ctdb_node_map_old *nodemap, 
-       uint32_t pnn, struct ctdb_dbid_map *dbmap, TALLOC_CTX *mem_ctx)
+       uint32_t pnn, struct ctdb_dbid_map_old *dbmap, TALLOC_CTX *mem_ctx)
 {
        int db;
 
@@ -574,14 +574,14 @@ static int update_db_priority_on_remote_nodes(struct ctdb_context *ctdb,
                struct ctdb_db_priority db_prio;
                int ret;
 
-               db_prio.db_id     = dbmap->dbs[db].dbid;
-               ret = ctdb_ctrl_get_db_priority(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, dbmap->dbs[db].dbid, &db_prio.priority);
+               db_prio.db_id     = dbmap->dbs[db].db_id;
+               ret = ctdb_ctrl_get_db_priority(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, dbmap->dbs[db].db_id, &db_prio.priority);
                if (ret != 0) {
-                       DEBUG(DEBUG_ERR,(__location__ " Failed to read database priority from local node for db 0x%08x\n", dbmap->dbs[db].dbid));
+                       DEBUG(DEBUG_ERR,(__location__ " Failed to read database priority from local node for db 0x%08x\n", dbmap->dbs[db].db_id));
                        continue;
                }
 
-               DEBUG(DEBUG_INFO,("Update DB priority for db 0x%08x to %u\n", dbmap->dbs[db].dbid, db_prio.priority)); 
+               DEBUG(DEBUG_INFO,("Update DB priority for db 0x%08x to %u\n", dbmap->dbs[db].db_id, db_prio.priority)); 
 
                ret = ctdb_ctrl_set_db_priority(ctdb, CONTROL_TIMEOUT(),
                                                CTDB_CURRENT_NODE, &db_prio);
@@ -598,10 +598,10 @@ static int update_db_priority_on_remote_nodes(struct ctdb_context *ctdb,
   ensure all other nodes have attached to any databases that we have
  */
 static int create_missing_remote_databases(struct ctdb_context *ctdb, struct ctdb_node_map_old *nodemap, 
-                                          uint32_t pnn, struct ctdb_dbid_map *dbmap, TALLOC_CTX *mem_ctx)
+                                          uint32_t pnn, struct ctdb_dbid_map_old *dbmap, TALLOC_CTX *mem_ctx)
 {
        int i, j, db, ret;
-       struct ctdb_dbid_map *remote_dbmap;
+       struct ctdb_dbid_map_old *remote_dbmap;
 
        /* verify that all other nodes have all our databases */
        for (j=0; j<nodemap->num; j++) {
@@ -627,7 +627,7 @@ static int create_missing_remote_databases(struct ctdb_context *ctdb, struct ctd
 
 
                        for (i=0;i<remote_dbmap->num;i++) {
-                               if (dbmap->dbs[db].dbid == remote_dbmap->dbs[i].dbid) {
+                               if (dbmap->dbs[db].db_id == remote_dbmap->dbs[i].db_id) {
                                        break;
                                }
                        }
@@ -637,7 +637,7 @@ static int create_missing_remote_databases(struct ctdb_context *ctdb, struct ctd
                        }
                        /* ok so we need to create this database */
                        ret = ctdb_ctrl_getdbname(ctdb, CONTROL_TIMEOUT(), pnn,
-                                                 dbmap->dbs[db].dbid, mem_ctx,
+                                                 dbmap->dbs[db].db_id, mem_ctx,
                                                  &name);
                        if (ret != 0) {
                                DEBUG(DEBUG_ERR, (__location__ " Unable to get dbname from node %u\n", pnn));
@@ -662,10 +662,10 @@ static int create_missing_remote_databases(struct ctdb_context *ctdb, struct ctd
   ensure we are attached to any databases that anyone else is attached to
  */
 static int create_missing_local_databases(struct ctdb_context *ctdb, struct ctdb_node_map_old *nodemap, 
-                                         uint32_t pnn, struct ctdb_dbid_map **dbmap, TALLOC_CTX *mem_ctx)
+                                         uint32_t pnn, struct ctdb_dbid_map_old **dbmap, TALLOC_CTX *mem_ctx)
 {
        int i, j, db, ret;
-       struct ctdb_dbid_map *remote_dbmap;
+       struct ctdb_dbid_map_old *remote_dbmap;
 
        /* verify that we have all database any other node has */
        for (j=0; j<nodemap->num; j++) {
@@ -690,7 +690,7 @@ static int create_missing_local_databases(struct ctdb_context *ctdb, struct ctdb
                        const char *name;
 
                        for (i=0;i<(*dbmap)->num;i++) {
-                               if (remote_dbmap->dbs[db].dbid == (*dbmap)->dbs[i].dbid) {
+                               if (remote_dbmap->dbs[db].db_id == (*dbmap)->dbs[i].db_id) {
                                        break;
                                }
                        }
@@ -702,7 +702,7 @@ static int create_missing_local_databases(struct ctdb_context *ctdb, struct ctdb
                           rebuild dbmap
                         */
                        ctdb_ctrl_getdbname(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn, 
-                                           remote_dbmap->dbs[db].dbid, mem_ctx, &name);
+                                           remote_dbmap->dbs[db].db_id, mem_ctx, &name);
                        if (ret != 0) {
                                DEBUG(DEBUG_ERR, (__location__ " Unable to get dbname from node %u\n", 
                                          nodemap->nodes[j].pnn));
@@ -1090,7 +1090,7 @@ static void vacuum_fetch_handler(uint64_t srvid, TDB_DATA data,
        int ret, i;
        TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
        const char *name;
-       struct ctdb_dbid_map *dbmap=NULL;
+       struct ctdb_dbid_map_old *dbmap=NULL;
        bool persistent = false;
        struct ctdb_db_context *ctdb_db;
        struct ctdb_rec_data_old *r;
@@ -1109,7 +1109,7 @@ static void vacuum_fetch_handler(uint64_t srvid, TDB_DATA data,
        }
 
        for (i=0;i<dbmap->num;i++) {
-               if (dbmap->dbs[i].dbid == recs->db_id) {
+               if (dbmap->dbs[i].db_id == recs->db_id) {
                        persistent = dbmap->dbs[i].flags & CTDB_DB_FLAGS_PERSISTENT;
                        break;
                }
@@ -1942,7 +1942,7 @@ fail:
 static int db_recovery_serial(struct ctdb_recoverd *rec, TALLOC_CTX *mem_ctx,
                              uint32_t pnn, struct ctdb_node_map_old *nodemap,
                              struct ctdb_vnn_map *vnnmap,
-                             struct ctdb_dbid_map *dbmap)
+                             struct ctdb_dbid_map_old *dbmap)
 {
        struct ctdb_context *ctdb = rec->ctdb;
        uint32_t generation;
@@ -2016,11 +2016,11 @@ static int db_recovery_serial(struct ctdb_recoverd *rec, TALLOC_CTX *mem_ctx,
 
        for (i=0;i<dbmap->num;i++) {
                ret = recover_database(rec, mem_ctx,
-                                      dbmap->dbs[i].dbid,
+                                      dbmap->dbs[i].db_id,
                                       dbmap->dbs[i].flags & CTDB_DB_FLAGS_PERSISTENT,
                                       pnn, nodemap, generation);
                if (ret != 0) {
-                       DEBUG(DEBUG_ERR, (__location__ " Failed to recover database 0x%x\n", dbmap->dbs[i].dbid));
+                       DEBUG(DEBUG_ERR, (__location__ " Failed to recover database 0x%x\n", dbmap->dbs[i].db_id));
                        return -1;
                }
        }
@@ -2112,7 +2112,7 @@ static int do_recovery(struct ctdb_recoverd *rec,
 {
        struct ctdb_context *ctdb = rec->ctdb;
        int i, ret;
-       struct ctdb_dbid_map *dbmap;
+       struct ctdb_dbid_map_old *dbmap;
        struct timeval start_time;
        uint32_t culprit = (uint32_t)-1;
        bool self_ban;
index 9994f84e9d4e9ce2e1b7fc9f2ea5b1904188fd4e..d33ea2a22c9329700f7691437b816a23f75dad4f 100644 (file)
@@ -364,7 +364,7 @@ static bool db_exists(struct ctdb_context *ctdb, const char *dbarg,
                      uint32_t *dbid, const char **dbname, uint8_t *flags)
 {
        int i, ret;
-       struct ctdb_dbid_map *dbmap=NULL;
+       struct ctdb_dbid_map_old *dbmap=NULL;
        bool dbid_given = false, found = false;
        uint32_t id;
        TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
@@ -383,19 +383,19 @@ static bool db_exists(struct ctdb_context *ctdb, const char *dbarg,
 
        for(i=0; i<dbmap->num; i++) {
                if (dbid_given) {
-                       if (id == dbmap->dbs[i].dbid) {
+                       if (id == dbmap->dbs[i].db_id) {
                                found = true;
                                break;
                        }
                } else {
-                       ret = ctdb_ctrl_getdbname(ctdb, TIMELIMIT(), options.pnn, dbmap->dbs[i].dbid, tmp_ctx, &name);
+                       ret = ctdb_ctrl_getdbname(ctdb, TIMELIMIT(), options.pnn, dbmap->dbs[i].db_id, tmp_ctx, &name);
                        if (ret != 0) {
-                               DEBUG(DEBUG_ERR, ("Unable to get dbname from dbid %u\n", dbmap->dbs[i].dbid));
+                               DEBUG(DEBUG_ERR, ("Unable to get dbname from dbid %u\n", dbmap->dbs[i].db_id));
                                goto fail;
                        }
 
                        if (strcmp(name, dbarg) == 0) {
-                               id = dbmap->dbs[i].dbid;
+                               id = dbmap->dbs[i].db_id;
                                found = true;
                                break;
                        }
@@ -403,9 +403,9 @@ static bool db_exists(struct ctdb_context *ctdb, const char *dbarg,
        }
 
        if (found && dbid_given && dbname != NULL) {
-               ret = ctdb_ctrl_getdbname(ctdb, TIMELIMIT(), options.pnn, dbmap->dbs[i].dbid, tmp_ctx, &name);
+               ret = ctdb_ctrl_getdbname(ctdb, TIMELIMIT(), options.pnn, dbmap->dbs[i].db_id, tmp_ctx, &name);
                if (ret != 0) {
-                       DEBUG(DEBUG_ERR, ("Unable to get dbname from dbid %u\n", dbmap->dbs[i].dbid));
+                       DEBUG(DEBUG_ERR, ("Unable to get dbname from dbid %u\n", dbmap->dbs[i].db_id));
                        found = false;
                        goto fail;
                }
@@ -4610,7 +4610,7 @@ done:
 static int control_getdbmap(struct ctdb_context *ctdb, int argc, const char **argv)
 {
        int i, ret;
-       struct ctdb_dbid_map *dbmap=NULL;
+       struct ctdb_dbid_map_old *dbmap=NULL;
 
        ret = ctdb_ctrl_getdbmap(ctdb, TIMELIMIT(), options.pnn, ctdb, &dbmap);
        if (ret != 0) {
@@ -4629,16 +4629,16 @@ static int control_getdbmap(struct ctdb_context *ctdb, int argc, const char **ar
                        bool sticky;
 
                        ctdb_ctrl_getdbpath(ctdb, TIMELIMIT(), options.pnn,
-                                           dbmap->dbs[i].dbid, ctdb, &path);
+                                           dbmap->dbs[i].db_id, ctdb, &path);
                        ctdb_ctrl_getdbname(ctdb, TIMELIMIT(), options.pnn,
-                                           dbmap->dbs[i].dbid, ctdb, &name);
+                                           dbmap->dbs[i].db_id, ctdb, &name);
                        ctdb_ctrl_getdbhealth(ctdb, TIMELIMIT(), options.pnn,
-                                             dbmap->dbs[i].dbid, ctdb, &health);
+                                             dbmap->dbs[i].db_id, ctdb, &health);
                        persistent = dbmap->dbs[i].flags & CTDB_DB_FLAGS_PERSISTENT;
                        readonly   = dbmap->dbs[i].flags & CTDB_DB_FLAGS_READONLY;
                        sticky     = dbmap->dbs[i].flags & CTDB_DB_FLAGS_STICKY;
                        printm(":0x%08X:%s:%s:%d:%d:%d:%d:\n",
-                              dbmap->dbs[i].dbid, name, path,
+                              dbmap->dbs[i].db_id, name, path,
                               !!(persistent), !!(sticky),
                               !!(health), !!(readonly));
                }
@@ -4654,14 +4654,14 @@ static int control_getdbmap(struct ctdb_context *ctdb, int argc, const char **ar
                bool readonly;
                bool sticky;
 
-               ctdb_ctrl_getdbpath(ctdb, TIMELIMIT(), options.pnn, dbmap->dbs[i].dbid, ctdb, &path);
-               ctdb_ctrl_getdbname(ctdb, TIMELIMIT(), options.pnn, dbmap->dbs[i].dbid, ctdb, &name);
-               ctdb_ctrl_getdbhealth(ctdb, TIMELIMIT(), options.pnn, dbmap->dbs[i].dbid, ctdb, &health);
+               ctdb_ctrl_getdbpath(ctdb, TIMELIMIT(), options.pnn, dbmap->dbs[i].db_id, ctdb, &path);
+               ctdb_ctrl_getdbname(ctdb, TIMELIMIT(), options.pnn, dbmap->dbs[i].db_id, ctdb, &name);
+               ctdb_ctrl_getdbhealth(ctdb, TIMELIMIT(), options.pnn, dbmap->dbs[i].db_id, ctdb, &health);
                persistent = dbmap->dbs[i].flags & CTDB_DB_FLAGS_PERSISTENT;
                readonly   = dbmap->dbs[i].flags & CTDB_DB_FLAGS_READONLY;
                sticky     = dbmap->dbs[i].flags & CTDB_DB_FLAGS_STICKY;
                printf("dbid:0x%08x name:%s path:%s%s%s%s%s\n",
-                      dbmap->dbs[i].dbid, name, path,
+                      dbmap->dbs[i].db_id, name, path,
                       persistent?" PERSISTENT":"",
                       sticky?" STICKY":"",
                       readonly?" READONLY":"",