diff options
author | Michael Adam <obnox@samba.org> | 2011-11-28 17:36:03 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2011-11-29 13:43:33 +0100 |
commit | 86cd78efeef8e6304311f6d5511706465a1bb973 (patch) | |
tree | 432eda16c89ffabc3899a46559ab79b9f8d6463e | |
parent | 239ae605e3b3c5ea586942598425da7d571964f0 (diff) | |
download | samba-86cd78efeef8e6304311f6d5511706465a1bb973.tar.gz samba-86cd78efeef8e6304311f6d5511706465a1bb973.tar.xz samba-86cd78efeef8e6304311f6d5511706465a1bb973.zip |
ctdb: add an option --print-lmaster to enable printing of lmaster in "ctdb catdb"
(This used to be ctdb commit 326f88ef622620cb9e0569c4497bc0e86124beaa)
-rw-r--r-- | ctdb/client/ctdb_client.c | 5 | ||||
-rw-r--r-- | ctdb/include/ctdb_client.h | 1 | ||||
-rw-r--r-- | ctdb/tools/ctdb.c | 15 |
3 files changed, 21 insertions, 0 deletions
diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c index 31a6ffc665..1190fba8b2 100644 --- a/ctdb/client/ctdb_client.c +++ b/ctdb/client/ctdb_client.c @@ -2141,6 +2141,11 @@ int ctdb_dumpdb_record(struct ctdb_context *ctdb, TDB_DATA key, TDB_DATA data, v fprintf(f, "dmaster: %u\n", h->dmaster); fprintf(f, "rsn: %llu\n", (unsigned long long)h->rsn); + + if (c->printlmaster && ctdb->vnn_map != NULL) { + fprintf(f, "lmaster: %u\n", ctdb_lmaster(ctdb, &key)); + } + fprintf(f, "flags: 0x%08x", h->flags); if (h->flags & CTDB_REC_FLAG_MIGRATED_WITH_DATA) printf(" MIGRATED_WITH_DATA"); if (h->flags & CTDB_REC_FLAG_VACUUM_MIGRATED) printf(" VACUUM_MIGRATED"); diff --git a/ctdb/include/ctdb_client.h b/ctdb/include/ctdb_client.h index 610c6ccc1f..15a3ba52bf 100644 --- a/ctdb/include/ctdb_client.h +++ b/ctdb/include/ctdb_client.h @@ -377,6 +377,7 @@ struct ctdb_dump_db_context { FILE *f; bool printemptyrecords; bool printdatasize; + bool printlmaster; }; int ctdb_dumpdb_record(struct ctdb_context *ctdb, TDB_DATA key, TDB_DATA data, void *p); diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 302c4dcdb3..0f4d223703 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -48,6 +48,7 @@ static struct { int maxruntime; int printemptyrecords; int printdatasize; + int printlmaster; } options; #define TIMELIMIT() timeval_current_ofs(options.timelimit, 0) @@ -2997,10 +2998,21 @@ static int control_catdb(struct ctdb_context *ctdb, int argc, const char **argv) return -1; } + if (options.printlmaster) { + ret = ctdb_ctrl_getvnnmap(ctdb, TIMELIMIT(), options.pnn, + ctdb, &ctdb->vnn_map); + if (ret != 0) { + DEBUG(DEBUG_ERR, ("Unable to get vnnmap from node %u\n", + options.pnn)); + return ret; + } + } + ZERO_STRUCT(c); c.f = stdout; c.printemptyrecords = (bool)options.printemptyrecords; c.printdatasize = (bool)options.printdatasize; + c.printlmaster = (bool)options.printlmaster; /* traverse and dump the cluster tdb */ ret = ctdb_dump_db(ctdb_db, &c); @@ -3033,6 +3045,7 @@ static int cattdb_traverse(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, c.f = stdout; c.printemptyrecords = (bool)options.printemptyrecords; c.printdatasize = (bool)options.printdatasize; + c.printlmaster = false; return ctdb_dumpdb_record(d->ctdb, key, data, &c); } @@ -4601,6 +4614,7 @@ static int control_dumpdbbackup(struct ctdb_context *ctdb, int argc, const char c.f = stdout; c.printemptyrecords = (bool)options.printemptyrecords; c.printdatasize = (bool)options.printdatasize; + c.printlmaster = false; for (i=0; i < m->count; i++) { uint32_t reqid = 0; @@ -5168,6 +5182,7 @@ int main(int argc, const char *argv[]) { "maxruntime", 'T', POPT_ARG_INT, &options.maxruntime, 0, "die if runtime exceeds this limit (in seconds)", "integer" }, { "print-emptyrecords", 0, POPT_ARG_NONE, &options.printemptyrecords, 0, "print the empty records when dumping databases (catdb, cattdb, dumpdbbackup)", NULL }, { "print-datasize", 0, POPT_ARG_NONE, &options.printdatasize, 0, "do not print record data when dumping databases, only the data size", NULL }, + { "print-lmaster", 0, POPT_ARG_NONE, &options.printlmaster, 0, "print the record's lmaster in catdb", NULL }, POPT_TABLEEND }; int opt; |