summaryrefslogtreecommitdiff
path: root/ctdb/tools
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2014-08-08 12:51:03 +1000
committerVolker Lendecke <vl@samba.org>2014-10-06 12:34:32 +0200
commitb544073653a5b54ba8ec2621c7314136656cfaeb (patch)
treeeac4cbb58746bcfdaaa21d55759bd389330ac311 /ctdb/tools
parent57bcb8055eb3e15c4ce7bcdeeef7efed175ed347 (diff)
downloadsamba-b544073653a5b54ba8ec2621c7314136656cfaeb.tar.gz
ctdb-logging: Remove log ringbuffer
As far as we know, nobody uses this and it just complicates the logging subsystem. Remove all ringbuffer code and documentation. Update the local daemons startup code correspondingly. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org>
Diffstat (limited to 'ctdb/tools')
-rw-r--r--ctdb/tools/ctdb.c123
1 files changed, 0 insertions, 123 deletions
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c
index 82783d8dfa1..71dfc28779f 100644
--- a/ctdb/tools/ctdb.c
+++ b/ctdb/tools/ctdb.c
@@ -4503,127 +4503,6 @@ static int control_chktcpport(struct ctdb_context *ctdb, int argc, const char **
}
-
-static void log_handler(struct ctdb_context *ctdb, uint64_t srvid,
- TDB_DATA data, void *private_data)
-{
- DEBUG(DEBUG_ERR,("Log data received\n"));
- if (data.dsize > 0) {
- printf("%s", data.dptr);
- }
-
- exit(0);
-}
-
-/*
- display a list of log messages from the in memory ringbuffer
- */
-static int control_getlog(struct ctdb_context *ctdb, int argc, const char **argv)
-{
- int ret, i;
- bool main_daemon;
- struct ctdb_get_log_addr log_addr;
- TDB_DATA data;
- struct timeval tv;
-
- /* Process options */
- main_daemon = true;
- log_addr.pnn = ctdb_get_pnn(ctdb);
- log_addr.level = DEBUG_NOTICE;
- for (i = 0; i < argc; i++) {
- if (strcmp(argv[i], "recoverd") == 0) {
- main_daemon = false;
- } else {
- if (isalpha(argv[i][0]) || argv[i][0] == '-') {
- log_addr.level = get_debug_by_desc(argv[i]);
- } else {
- log_addr.level = strtol(argv[i], NULL, 0);
- }
- }
- }
-
- /* Our message port is our PID */
- log_addr.srvid = getpid();
-
- data.dptr = (unsigned char *)&log_addr;
- data.dsize = sizeof(log_addr);
-
- DEBUG(DEBUG_ERR, ("Pulling logs from node %u\n", options.pnn));
-
- ctdb_client_set_message_handler(ctdb, log_addr.srvid, log_handler, NULL);
- sleep(1);
-
- DEBUG(DEBUG_ERR,("Listen for response on %d\n", (int)log_addr.srvid));
-
- if (main_daemon) {
- int32_t res;
- char *errmsg;
- TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
-
- ret = ctdb_control(ctdb, options.pnn, 0, CTDB_CONTROL_GET_LOG,
- 0, data, tmp_ctx, NULL, &res, NULL, &errmsg);
- if (ret != 0 || res != 0) {
- DEBUG(DEBUG_ERR,("Failed to get logs - %s\n", errmsg));
- talloc_free(tmp_ctx);
- return -1;
- }
- talloc_free(tmp_ctx);
- } else {
- ret = ctdb_client_send_message(ctdb, options.pnn,
- CTDB_SRVID_GETLOG, data);
- if (ret != 0) {
- DEBUG(DEBUG_ERR,("Failed to send getlog request message to %u\n", options.pnn));
- return -1;
- }
- }
-
- tv = timeval_current();
- /* this loop will terminate when we have received the reply */
- while (timeval_elapsed(&tv) < (double)options.timelimit) {
- event_loop_once(ctdb->ev);
- }
-
- DEBUG(DEBUG_INFO,("Timed out waiting for log data.\n"));
-
- return 0;
-}
-
-/*
- clear the in memory log area
- */
-static int control_clearlog(struct ctdb_context *ctdb, int argc, const char **argv)
-{
- int ret;
-
- if (argc == 0 || (argc >= 1 && strcmp(argv[0], "recoverd") != 0)) {
- /* "recoverd" not given - get logs from main daemon */
- int32_t res;
- char *errmsg;
- TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
-
- ret = ctdb_control(ctdb, options.pnn, 0, CTDB_CONTROL_CLEAR_LOG,
- 0, tdb_null, tmp_ctx, NULL, &res, NULL, &errmsg);
- if (ret != 0 || res != 0) {
- DEBUG(DEBUG_ERR,("Failed to clear logs\n"));
- talloc_free(tmp_ctx);
- return -1;
- }
-
- talloc_free(tmp_ctx);
- } else {
- TDB_DATA data; /* unused in recoverd... */
- data.dsize = 0;
-
- ret = ctdb_client_send_message(ctdb, options.pnn, CTDB_SRVID_CLEARLOG, data);
- if (ret != 0) {
- DEBUG(DEBUG_ERR,("Failed to send clearlog request message to %u\n", options.pnn));
- return -1;
- }
- }
-
- return 0;
-}
-
/* Reload public IPs on a specified nodes */
static int control_reloadips(struct ctdb_context *ctdb, int argc, const char **argv)
{
@@ -6356,8 +6235,6 @@ static const struct {
{ "enablemonitor", control_enable_monmode, true, false, "set monitoring mode to ACTIVE" },
{ "setdebug", control_setdebug, true, false, "set debug level", "<EMERG|ALERT|CRIT|ERR|WARNING|NOTICE|INFO|DEBUG>" },
{ "getdebug", control_getdebug, true, false, "get debug level" },
- { "getlog", control_getlog, true, false, "get the log data from the in memory ringbuffer", "[<level>] [recoverd]" },
- { "clearlog", control_clearlog, true, false, "clear the log data from the in memory ringbuffer", "[recoverd]" },
{ "attach", control_attach, true, false, "attach to a database", "<dbname> [persistent]" },
{ "detach", control_detach, false, false, "detach from a database", "<dbname|dbid> [<dbname|dbid> ...]" },
{ "dumpmemory", control_dumpmemory, true, false, "dump memory map to stdout" },