mirror of
https://github.com/samba-team/samba.git
synced 2025-02-28 01:58:17 +03:00
ctdb: add an option --print-lmaster to enable printing of lmaster in "ctdb catdb"
(This used to be ctdb commit 326f88ef622620cb9e0569c4497bc0e86124beaa)
This commit is contained in:
parent
239ae605e3
commit
86cd78efee
@ -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");
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user