diff options
author | Michael Adam <obnox@samba.org> | 2011-11-29 00:56:23 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2011-11-29 13:43:34 +0100 |
commit | e6923904e892e9a69f8a7441c4414353ad7ca324 (patch) | |
tree | ef2ddca21125a0f31f14a4b2fb465932625b6079 | |
parent | 290559e53d343057ef8b516c06cf62f69e08ecd5 (diff) | |
download | samba-e6923904e892e9a69f8a7441c4414353ad7ca324.tar.gz samba-e6923904e892e9a69f8a7441c4414353ad7ca324.tar.xz samba-e6923904e892e9a69f8a7441c4414353ad7ca324.zip |
ctdb: add an option --print-hash to enable printing of record hashes when dumping dbs
(This used to be ctdb commit efc033c28ade97f9884794256d59a4553e052d5f)
-rw-r--r-- | ctdb/client/ctdb_client.c | 4 | ||||
-rw-r--r-- | ctdb/include/ctdb_client.h | 1 | ||||
-rw-r--r-- | ctdb/tools/ctdb.c | 5 |
3 files changed, 10 insertions, 0 deletions
diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c index 1190fba8b2..47f3759271 100644 --- a/ctdb/client/ctdb_client.c +++ b/ctdb/client/ctdb_client.c @@ -2146,6 +2146,10 @@ int ctdb_dumpdb_record(struct ctdb_context *ctdb, TDB_DATA key, TDB_DATA data, v fprintf(f, "lmaster: %u\n", ctdb_lmaster(ctdb, &key)); } + if (c->printhash) { + fprintf(f, "hash: 0x%08x\n", ctdb_hash(&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 15a3ba52bf..0c25d7becf 100644 --- a/ctdb/include/ctdb_client.h +++ b/ctdb/include/ctdb_client.h @@ -378,6 +378,7 @@ struct ctdb_dump_db_context { bool printemptyrecords; bool printdatasize; bool printlmaster; + bool printhash; }; 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 0f4d223703..10c11e4ccf 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -49,6 +49,7 @@ static struct { int printemptyrecords; int printdatasize; int printlmaster; + int printhash; } options; #define TIMELIMIT() timeval_current_ofs(options.timelimit, 0) @@ -3013,6 +3014,7 @@ static int control_catdb(struct ctdb_context *ctdb, int argc, const char **argv) c.printemptyrecords = (bool)options.printemptyrecords; c.printdatasize = (bool)options.printdatasize; c.printlmaster = (bool)options.printlmaster; + c.printhash = (bool)options.printhash; /* traverse and dump the cluster tdb */ ret = ctdb_dump_db(ctdb_db, &c); @@ -3046,6 +3048,7 @@ static int cattdb_traverse(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, c.printemptyrecords = (bool)options.printemptyrecords; c.printdatasize = (bool)options.printdatasize; c.printlmaster = false; + c.printhash = (bool)options.printhash; return ctdb_dumpdb_record(d->ctdb, key, data, &c); } @@ -4615,6 +4618,7 @@ static int control_dumpdbbackup(struct ctdb_context *ctdb, int argc, const char c.printemptyrecords = (bool)options.printemptyrecords; c.printdatasize = (bool)options.printdatasize; c.printlmaster = false; + c.printhash = (bool)options.printhash; for (i=0; i < m->count; i++) { uint32_t reqid = 0; @@ -5183,6 +5187,7 @@ int main(int argc, const char *argv[]) { "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 }, + { "print-hash", 0, POPT_ARG_NONE, &options.printhash, 0, "print the record's hash when dumping databases", NULL }, POPT_TABLEEND }; int opt; |