summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2011-11-29 10:24:52 +0100
committerMichael Adam <obnox@samba.org>2011-11-29 13:43:35 +0100
commit31d62794fe342b1207194c8b1e241361e01b71de (patch)
tree53284f55c22d9dc30a0853483cc11ac9067494d6
parent8fe8e277d9618dfce6c39436a40ef2fcfdeaadba (diff)
downloadsamba-31d62794fe342b1207194c8b1e241361e01b71de.tar.gz
samba-31d62794fe342b1207194c8b1e241361e01b71de.tar.xz
samba-31d62794fe342b1207194c8b1e241361e01b71de.zip
ctdb: add an option --print-recordflags to trigger printing record flags in catdb and dumpdbbackup
This changes the default behaviour to not print record flags. (This used to be ctdb commit 2d2ce07c51055d9400b22cd3c1fd682597cb921c)
-rw-r--r--ctdb/client/ctdb_client.c20
-rw-r--r--ctdb/include/ctdb_client.h1
-rw-r--r--ctdb/tools/ctdb.c5
3 files changed, 17 insertions, 9 deletions
diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c
index 47f3759271..75ad0e134f 100644
--- a/ctdb/client/ctdb_client.c
+++ b/ctdb/client/ctdb_client.c
@@ -2150,15 +2150,17 @@ int ctdb_dumpdb_record(struct ctdb_context *ctdb, TDB_DATA key, TDB_DATA data, v
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");
- if (h->flags & CTDB_REC_FLAG_AUTOMATIC) printf(" AUTOMATIC");
- if (h->flags & CTDB_REC_RO_HAVE_DELEGATIONS) printf(" RO_HAVE_DELEGATIONS");
- if (h->flags & CTDB_REC_RO_HAVE_READONLY) printf(" RO_HAVE_READONLY");
- if (h->flags & CTDB_REC_RO_REVOKING_READONLY) printf(" RO_REVOKING_READONLY");
- if (h->flags & CTDB_REC_RO_REVOKE_COMPLETE) printf(" RO_REVOKE_COMPLETE");
- fprintf(f, "\n");
+ if (c->printrecordflags) {
+ 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");
+ if (h->flags & CTDB_REC_FLAG_AUTOMATIC) printf(" AUTOMATIC");
+ if (h->flags & CTDB_REC_RO_HAVE_DELEGATIONS) printf(" RO_HAVE_DELEGATIONS");
+ if (h->flags & CTDB_REC_RO_HAVE_READONLY) printf(" RO_HAVE_READONLY");
+ if (h->flags & CTDB_REC_RO_REVOKING_READONLY) printf(" RO_REVOKING_READONLY");
+ if (h->flags & CTDB_REC_RO_REVOKE_COMPLETE) printf(" RO_REVOKE_COMPLETE");
+ fprintf(f, "\n");
+ }
if (c->printdatasize) {
fprintf(f, "data size: %u\n", (unsigned)data.dsize);
diff --git a/ctdb/include/ctdb_client.h b/ctdb/include/ctdb_client.h
index 0c25d7becf..2eef33595b 100644
--- a/ctdb/include/ctdb_client.h
+++ b/ctdb/include/ctdb_client.h
@@ -379,6 +379,7 @@ struct ctdb_dump_db_context {
bool printdatasize;
bool printlmaster;
bool printhash;
+ bool printrecordflags;
};
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 10c11e4ccf..06e2a0b5d1 100644
--- a/ctdb/tools/ctdb.c
+++ b/ctdb/tools/ctdb.c
@@ -50,6 +50,7 @@ static struct {
int printdatasize;
int printlmaster;
int printhash;
+ int printrecordflags;
} options;
#define TIMELIMIT() timeval_current_ofs(options.timelimit, 0)
@@ -3015,6 +3016,7 @@ static int control_catdb(struct ctdb_context *ctdb, int argc, const char **argv)
c.printdatasize = (bool)options.printdatasize;
c.printlmaster = (bool)options.printlmaster;
c.printhash = (bool)options.printhash;
+ c.printrecordflags = (bool)options.printrecordflags;
/* traverse and dump the cluster tdb */
ret = ctdb_dump_db(ctdb_db, &c);
@@ -3049,6 +3051,7 @@ static int cattdb_traverse(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data,
c.printdatasize = (bool)options.printdatasize;
c.printlmaster = false;
c.printhash = (bool)options.printhash;
+ c.printrecordflags = true;
return ctdb_dumpdb_record(d->ctdb, key, data, &c);
}
@@ -4619,6 +4622,7 @@ static int control_dumpdbbackup(struct ctdb_context *ctdb, int argc, const char
c.printdatasize = (bool)options.printdatasize;
c.printlmaster = false;
c.printhash = (bool)options.printhash;
+ c.printrecordflags = (bool)options.printrecordflags;
for (i=0; i < m->count; i++) {
uint32_t reqid = 0;
@@ -5188,6 +5192,7 @@ int main(int argc, const char *argv[])
{ "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 },
+ { "print-recordflags", 0, POPT_ARG_NONE, &options.printrecordflags, 0, "print the record flags in catdb and dumpdbbackup", NULL },
POPT_TABLEEND
};
int opt;