diff options
author | Amitay Isaacs <amitay@gmail.com> | 2013-09-24 13:10:31 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@gmail.com> | 2013-10-04 15:47:11 +1000 |
commit | c4a80c7a67f15907fc5f9b886837fa463cae2c3f (patch) | |
tree | 3f8e6d12864b9bfbdf86727312f9a2a5d05ede4e /ctdb/tools | |
parent | 524696fa269443f0bfd3e5c740e7c7b01a8b758c (diff) | |
download | samba-c4a80c7a67f15907fc5f9b886837fa463cae2c3f.tar.gz samba-c4a80c7a67f15907fc5f9b886837fa463cae2c3f.tar.xz samba-c4a80c7a67f15907fc5f9b886837fa463cae2c3f.zip |
tools/ctdb: Remove setdbseqnum command
This command was added to test persistent database recovery with sequence
numbers. With the new persistent transaction code, sequence numbers get
updated automatically, so there is no need for this command.
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
(This used to be ctdb commit 14bfd22fad1a5fd27eede1be7fccbaed9466e13e)
Diffstat (limited to 'ctdb/tools')
-rw-r--r-- | ctdb/tools/ctdb.c | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 727d38e051f..bad09c9c42e 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -5112,91 +5112,6 @@ static int control_getdbseqnum(struct ctdb_context *ctdb, int argc, const char * } /* - * set db seqnum - */ -static int control_setdbseqnum(struct ctdb_context *ctdb, int argc, const char **argv) -{ - int ret; - struct ctdb_db_context *ctdb_db; - uint32_t db_id; - uint8_t flags; - uint64_t old_seqnum, new_seqnum; - TALLOC_CTX *tmp_ctx = talloc_new(ctdb); - struct ctdb_transaction_handle *h; - TDB_DATA key, data; - bool persistent; - - if (argc != 2) { - talloc_free(tmp_ctx); - usage(); - } - - if (!db_exists(ctdb, argv[0], &db_id, &flags)) { - talloc_free(tmp_ctx); - return -1; - } - - persistent = flags & CTDB_DB_FLAGS_PERSISTENT; - if (!persistent) { - DEBUG(DEBUG_ERR,("Database '%s' is not persistent\n", argv[0])); - talloc_free(tmp_ctx); - return -1; - } - - ret = ctdb_ctrl_getdbseqnum(ctdb, TIMELIMIT(), options.pnn, db_id, &old_seqnum); - if (ret != 0) { - DEBUG(DEBUG_ERR, ("Unable to get seqnum from node.")); - talloc_free(tmp_ctx); - return -1; - } - - new_seqnum = strtoull(argv[1], NULL, 0); - if (new_seqnum <= old_seqnum) { - DEBUG(DEBUG_ERR, ("New sequence number is less than current sequence number\n")); - talloc_free(tmp_ctx); - return -1; - } - - ctdb_db = ctdb_attach(ctdb, TIMELIMIT(), argv[0], persistent, 0); - if (ctdb_db == NULL) { - DEBUG(DEBUG_ERR,("Unable to attach to database '%s'\n", argv[0])); - talloc_free(tmp_ctx); - return -1; - } - - h = ctdb_transaction_start(ctdb_db, tmp_ctx); - if (h == NULL) { - DEBUG(DEBUG_ERR,("Failed to start transaction on database %s\n", argv[0])); - talloc_free(tmp_ctx); - return -1; - } - - key.dptr = (uint8_t *)discard_const(CTDB_DB_SEQNUM_KEY); - key.dsize = strlen(CTDB_DB_SEQNUM_KEY) + 1; - - data.dsize = sizeof(new_seqnum); - data.dptr = talloc_size(tmp_ctx, data.dsize); - *data.dptr = new_seqnum; - - ret = ctdb_transaction_store(h, key, data); - if (ret != 0) { - DEBUG(DEBUG_ERR,("Failed to store record\n")); - talloc_free(tmp_ctx); - return -1; - } - - ret = ctdb_transaction_commit(h); - if (ret != 0) { - DEBUG(DEBUG_ERR,("Failed to commit transaction\n")); - talloc_free(tmp_ctx); - return -1; - } - - talloc_free(tmp_ctx); - return 0; -} - -/* run an eventscript on a node */ static int control_eventscript(struct ctdb_context *ctdb, int argc, const char **argv) @@ -6175,7 +6090,6 @@ static const struct { { "checktcpport", control_chktcpport, false, true, "check if a service is bound to a specific tcp port or not", "<port>" }, { "rebalancenode", control_rebalancenode, false, false, "mark nodes as forced IP rebalancing targets", "[<pnn-list>]"}, { "getdbseqnum", control_getdbseqnum, false, false, "get the sequence number off a database", "<dbname|dbid>" }, - { "setdbseqnum", control_setdbseqnum, false, false, "set the sequence number for a database", "<dbname|dbid> <seqnum>" }, { "nodestatus", control_nodestatus, true, false, "show and return node status", "[<pnn-list>]" }, { "dbstatistics", control_dbstatistics, false, false, "show db statistics", "<dbname|dbid>" }, { "reloadips", control_reloadips, false, false, "reload the public addresses file on specified nodes" , "[<pnn-list>]" }, |