Changeset: 54279b2cf214 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/54279b2cf214
Modified Files:
        documentation/source/manual_pages/monetdb.rst
        tools/merovingian/ChangeLog
        tools/merovingian/client/monetdb.1
        tools/merovingian/client/monetdb.c
        tools/merovingian/daemon/controlrunner.c
        tools/merovingian/daemon/forkmserver.c
        tools/merovingian/daemon/forkmserver.h
        tools/merovingian/utils/properties.h
Branch: default
Log Message:

Remove deprecated `profilerstart` and `profilerstop` commands


diffs (truncated from 612 to 300 lines):

diff --git a/documentation/source/manual_pages/monetdb.rst 
b/documentation/source/manual_pages/monetdb.rst
--- a/documentation/source/manual_pages/monetdb.rst
+++ b/documentation/source/manual_pages/monetdb.rst
@@ -183,20 +183,6 @@ return code of *monetdb*\ (1) indicates 
 had a failure, even though the operation on other databases was
 successful.
 
-**profilerstart**\ *database*\ **[**\ *database*\ **...]**
-
-**profilerstop**\ *database*\ **[**\ *database*\ **...]**
-
-Starts or stops the collection of profiling logs for the given database.
-The property **profilerlogpath** must be set for the given database, and
-it should point to a directory where the logs will be gathered. The
-filenames of the logs have the format:
-*proflog_<database>_YYYY-MM-DD_HH-MM-SS.json* where the last part is the
-date and time when the collection started. Please note that a file
-recording the pid of the profiler is written in the log directory,
-therefore each database needs to have a different **profilerlogpath**
-value.
-
 **monetdb snapshot write**\ *dbname*
    Takes a snapshot of the given database and writes it to stdout.
 
diff --git a/tools/merovingian/ChangeLog b/tools/merovingian/ChangeLog
--- a/tools/merovingian/ChangeLog
+++ b/tools/merovingian/ChangeLog
@@ -1,3 +1,7 @@
 # ChangeLog file for sql/src/backends/monet5/merovingian
 # This file is updated with mchangelog
 
+* Tue May 11 2021 Panagiotis Koutsourakis <[email protected]>
+- Removed the deprecated monetdb commands `profilerstart` and
+  `profilerstop`.
+
diff --git a/tools/merovingian/client/monetdb.1 
b/tools/merovingian/client/monetdb.1
--- a/tools/merovingian/client/monetdb.1
+++ b/tools/merovingian/client/monetdb.1
@@ -279,22 +279,6 @@ the return code of
 indicates failure if one of the databases had a failure, even though
 the operation on other databases was successful.
 .TP
-\fBprofilerstart\fP \fIdatabase\fP [\fIdatabase\fP ...]
-.PD 0
-.TP
-\fBprofilerstop\fP \fIdatabase\fP [\fIdatabase\fP ...]
-.PD
-Starts or stops the collection of profiling logs for the given database. The 
property
-.B profilerlogpath
-must be set for the given database, and it should point to a directory where 
the logs
-will be gathered. The filenames of the logs have the format:
-.I proflog_<database>_YYYY-MM-DD_HH-MM-SS.json
-where the last part is the date and time when the collection started. Please
-note that a file recording the pid of the profiler is written in the log
-directory, therefore each database needs to have a different
-.B profilerlogpath
-value.
-.TP
 \fBmonetdb\fP \fBsnapshot\fP \fBwrite\fP \fIdbname\fP
 Takes a snapshot of the given database and writes it to stdout.
 .TP
diff --git a/tools/merovingian/client/monetdb.c 
b/tools/merovingian/client/monetdb.c
--- a/tools/merovingian/client/monetdb.c
+++ b/tools/merovingian/client/monetdb.c
@@ -60,7 +60,6 @@ command_help(int argc, char *argv[])
                printf("  where command is one of:\n");
                printf("    create, destroy, lock, release,\n");
                printf("    status, start, stop, kill,\n");
-               printf("    profilerstart, profilerstop,\n");
                printf("    snapshot,\n");
                printf("    set, get, inherit,\n");
                printf("    discover, help, version\n");
@@ -97,14 +96,6 @@ command_help(int argc, char *argv[])
                printf("  Brings back a database from maintenance mode.  A 
released\n");
                printf("  database is available again for normal use.  Use 
the\n");
                printf("  \"lock\" command to take a database under 
maintenance.\n");
-       } else if (strcmp(argv[1], "profilerstart") == 0) {
-               printf("Usage: monetdb profilerstart database [database 
...]\n");
-               printf("  Starts the collection of profiling events. The 
property\n");
-               printf("  \""PROFILERLOGPROPERTY"\" should be set. Use the 
\"profilerstop\"\n");
-               printf("  command to stop the profiler.\n");
-       } else if (strcmp(argv[1], "profilerstop") == 0) {
-               printf("Usage: monetdb profilerstop database [database ...]\n");
-               printf("  Stops the collection of profiling events.\n");
        } else if (strcmp(argv[1], "status") == 0) {
                printf("Usage: monetdb status [-lc] [expression ...]\n");
                printf("  Shows the state of a given glob-style database match, 
or\n");
@@ -1701,20 +1692,6 @@ command_release(int argc, char *argv[])
        return simple_command(argc, argv, "release", "taken database out of 
maintenance mode", true);
 }
 
-static int
-command_profilerstart(int argc, char *argv[])
-{
-       fprintf(stderr, "The command \"profilerstart\" is deprecated and will 
be removed in a future MonetDB version.\n");
-       return simple_command(argc, argv, "profilerstart", "started profiler", 
true);
-}
-
-static int
-command_profilerstop(int argc, char *argv[])
-{
-       fprintf(stderr, "The command \"profilerstop\" is deprecated and will be 
removed in a future MonetDB version.\n");
-       return simple_command(argc, argv, "profilerstop", "stopped profiler", 
true);
-}
-
 /* Snapshot this single database to the given file */
 static void
 snapshot_create_adhoc(sabdb *databases, char *filename) {
@@ -2577,10 +2554,6 @@ main(int argc, char *argv[])
                retval = command_lock(argc - i, &argv[i]);
        } else if (strcmp(argv[i], "release") == 0) {
                retval = command_release(argc - i, &argv[i]);
-       } else if (strcmp(argv[i], "profilerstart") == 0) {
-               retval = command_profilerstart(argc - i, &argv[i]);
-       } else if (strcmp(argv[i], "profilerstop") == 0) {
-               retval = command_profilerstop(argc - i, &argv[i]);
        } else if (strcmp(argv[i], "status") == 0) {
                retval = command_status(argc - i, &argv[i]);
        } else if (strcmp(argv[i], "start") == 0) {
diff --git a/tools/merovingian/daemon/controlrunner.c 
b/tools/merovingian/daemon/controlrunner.c
--- a/tools/merovingian/daemon/controlrunner.c
+++ b/tools/merovingian/daemon/controlrunner.c
@@ -401,10 +401,7 @@ static void ctl_handle_client(
 
                                // Kill it appropriately
                                if (strcmp(p, "stop") == 0) {
-                                       /* make an attempt to shut down the 
profiler first. */
-                                       if ((e = shutdown_profiler(q, &stats)) 
!= NULL) {
-                                               free(e);
-                                       } else if (stats != NULL)
+                                       if (stats != NULL)
                                                msab_freeStatus(&stats);
                                        /* then kill it */
                                        if (dp)
@@ -674,47 +671,6 @@ static void ctl_handle_client(
                                        len = snprintf(buf2, sizeof(buf2), 
"OK\n");
                                        send_client("=");
                                }
-                       } else if (strncmp(p, "profilerstart", 
strlen("profilerstart")) == 0) {
-                               char *log_path = NULL;
-                               char *e = fork_profiler(q, &stats, &log_path);
-                               Mfprintf(_mero_ctlout, "The command 
\"profilerstart\" is deprecated"
-                                                " and will be removed in a 
future MonetDB version.\n");
-                               if (e != NULL) {
-                                       Mfprintf(_mero_ctlerr, "%s: failed to 
start the profiler "
-                                                        "database '%s': %s\n", 
origin, q, getErrMsg(e));
-                                       len = snprintf(buf2, sizeof(buf2),
-                                                                  "%s\n", 
getErrMsg(e));
-                                       send_client("!");
-                                       freeErr(e);
-                               } else {
-                                       len = snprintf(buf2, sizeof(buf2), 
"OK\n");
-                                       send_client("=");
-                                       Mfprintf(_mero_ctlout, "%s: started 
profiler for '%s'\n",
-                                                        origin, q);
-                                       Mfprintf(_mero_ctlout, "%s: logs at: 
%s\n",
-                                                        origin, log_path);
-                               }
-                               msab_freeStatus(&stats);
-                               if (log_path)
-                                       free(log_path);
-                       }  else if (strncmp(p, "profilerstop", 
strlen("profilerstop")) == 0) {
-                               char *e = shutdown_profiler(q, &stats);
-                               Mfprintf(_mero_ctlout, "The command 
\"profilerstop\" is deprecated"
-                                                " and will be removed in a 
future MonetDB version.\n");
-                               if (e != NULL) {
-                                       Mfprintf(_mero_ctlerr, "%s: failed to 
shutdown the profiler "
-                                                        "database '%s': %s\n", 
origin, q, getErrMsg(e));
-                                       len = snprintf(buf2, sizeof(buf2),
-                                                                  "%s\n", 
getErrMsg(e));
-                                       send_client("!");
-                                       freeErr(e);
-                               } else {
-                                       len = snprintf(buf2, sizeof(buf2), 
"OK\n");
-                                       send_client("=");
-                                       Mfprintf(_mero_ctlout, "%s: profiler 
shut down for '%s'\n",
-                                                        origin, q);
-                               }
-                               msab_freeStatus(&stats);
                        } else if (strncmp(p, "snapshot create adhoc ", 
strlen("snapshot create adhoc ")) == 0) {
                                char *dest = p + strlen("snapshot create adhoc 
");
                                Mfprintf(_mero_ctlout, "Start snapshot of 
database '%s' to file '%s'\n", q, dest);
diff --git a/tools/merovingian/daemon/forkmserver.c 
b/tools/merovingian/daemon/forkmserver.c
--- a/tools/merovingian/daemon/forkmserver.c
+++ b/tools/merovingian/daemon/forkmserver.c
@@ -861,403 +861,4 @@ forkMserver(const char *database, sabdb*
        return(newErr("%s", strerror(e)));
 }
 
-#define BUFLEN 1024
-
-#define STETHOSCOPE    "pystethoscope"
-
-/**
- * Fork stethoscope and detatch, after performing sanity checks. The assumption
- * is that each mserver5 process can have at most one stethoscope process
- * attached to it.
- */
-err
-fork_profiler(const char *dbname, sabdb **stats, char **log_path)
-{
-       pid_t pid;
-       char *error = NO_ERR;
-       char *pidfilename = NULL;
-       confkeyval *ckv = NULL, *kv;
-       size_t pidfnlen;
-       FILE *pidfile;
-       char *profiler_executable;
-#if 0
-       char *beat_frequency = NULL;
-#endif
-       char *tmp_exe;
-       struct stat path_info;
-       int error_code;
-       dpair dp;
-
-       pthread_mutex_lock(&_mero_topdp_lock);
-       dp = _mero_topdp->next;
-       while (dp != NULL && strcmp(dp->dbname, dbname) != 0) {
-               dp = dp->next;
-       }
-       pthread_mutex_unlock(&_mero_topdp_lock);
-       if (dp == NULL)
-               return newErr("Unknown database %s", dbname);
-       pthread_mutex_lock(&dp->fork_lock);
-
-       *log_path = NULL;
-       error = msab_getStatus(stats, dbname);
-       if (error != NULL) {
-               pthread_mutex_unlock(&dp->fork_lock);
-               return error;
-       }
-
-       if (*stats == NULL) {
-               /* TODO: What now? */
-               pthread_mutex_unlock(&dp->fork_lock);
-               return newErr("Null stats for db %s", dbname);
-       }
-
-       /* Find the profiler executable. The mserver is running as
-        * /path/to/installation/mserver5
-        * and the profiler executable should be:
-        * /path/to/installation/stethoscope
-        */
-       tmp_exe = strdup(_mero_mserver);
-       if (tmp_exe == NULL) {
-               pthread_mutex_unlock(&dp->fork_lock);
-               return newErr("Cannot find the profiler executable\n"
-                                         "    The python implementation of 
stethoscope needs"
-                                         " to be in the same directory as 
mserver5.");
-       } else {
-               char *server_filename = "mserver5";
-               char *profiler_filename = STETHOSCOPE;
-               char *s = strstr(tmp_exe, server_filename);
-               size_t executable_len = 0;
-
-               if (s == NULL || strncmp(s, server_filename, 
strlen(server_filename)) != 0) {
-                       pthread_mutex_unlock(&dp->fork_lock);
-                       error = newErr("Unexpected executable (missing the 
string \"%s\")", server_filename);
-                       free(tmp_exe);
-                       return error;
-               }
-
-               executable_len = strlen(tmp_exe) + strlen(profiler_filename) - 
strlen(server_filename) + 1;
-               *s = '\0';
-               profiler_executable = malloc(executable_len);
-               snprintf(profiler_executable, executable_len, "%s%s%s",
-                                tmp_exe, profiler_filename, s + 8);
-               free(tmp_exe);
-#ifndef __COVERITY__
-               /* hide for coverity: time-of-check time-of-use; it's ok to do
-                * this since if the file were to disappear between this check
-                * and the use, things won't fall apart */
-               if (stat(profiler_executable, &path_info) == -1) {
-                       error = newErr("Cannot find the profiler executable\n"
-                                                  "    The python 
implementation of stethoscope needs"
-                                                  " to be in the same 
directory as mserver5.");
-                       goto cleanup;
-               }
-#endif
-       }
-
-       /* Verify that the requested db is running */
-       if ((*stats)->state != SABdbRunning) {
-               /* server is not running, shoo */
-               error = newErr("Database %s is not running.", dbname);
-               goto cleanup;
-       }
-
-       /* find the path that the profiler will be storing files */
-       ckv = getDefaultProps();
-       readAllProps(ckv, (*stats)->path);
-#if 0
-       kv = findConfKey(ckv, PROFILERBEATFREQ);
-       if (kv) {
-               beat_frequency = kv->val;
-       }
-#endif
-       kv = findConfKey(ckv, PROFILERLOGPROPERTY);
-
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to