diff options
| author | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2011-11-28 16:30:46 +1100 |
|---|---|---|
| committer | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2011-11-30 08:48:14 +1100 |
| commit | 3cbff2edd82ddc8f1d44696e35cf6e8b355cf6ae (patch) | |
| tree | 0ca0880c2a8e23cd471b2b4b4404efbd6e7b40c4 /ctdb/tools | |
| parent | 3e2c40c5900f93cf691087041e62a375a27d9ce0 (diff) | |
LibCTDB: add get persistent db seqnum control
(This used to be ctdb commit 6e96a62494bbb2c7b0682ebf0c2115dd2f44f7af)
Diffstat (limited to 'ctdb/tools')
| -rw-r--r-- | ctdb/tools/ctdb.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 06e2a0b5d1..9899b7dc54 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -4132,6 +4132,32 @@ static int control_setdbreadonly(struct ctdb_context *ctdb, int argc, const char } /* + get db seqnum + */ +static int control_getdbseqnum(struct ctdb_context *ctdb, int argc, const char **argv) +{ + bool ret; + uint32_t db_id; + uint64_t seqnum; + + if (argc < 1) { + usage(); + } + + db_id = strtoul(argv[0], NULL, 0); + + ret = ctdb_getdbseqnum(ctdb_connection, options.pnn, db_id, &seqnum); + if (!ret) { + DEBUG(DEBUG_ERR, ("Unable to get seqnum from node.")); + return -1; + } + + printf("Sequence number:%lld\n", (long long)seqnum); + + return 0; +} + +/* run an eventscript on a node */ static int control_eventscript(struct ctdb_context *ctdb, int argc, const char **argv) @@ -5141,6 +5167,7 @@ static const struct { { "readkey", control_readkey, true, false, "read the content off a database key", "<tdb-file> <key>" }, { "writekey", control_writekey, true, false, "write to a database key", "<tdb-file> <key> <value>" }, { "checktcpport", control_chktcpport, false, true, "check if a service is bound to a specific tcp port or not", "<port>" }, + { "getdbseqnum", control_getdbseqnum, false, false, "get the sequence number off a database", "<dbid>" }, }; /* |
