Changeset: b0f037d3798d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b0f037d3798d
Modified Files:
        tools/merovingian/ChangeLog.Jan2014
        tools/merovingian/client/monetdb.1
        tools/merovingian/client/monetdb.c
Branch: Jan2014
Log Message:

monetdb: make destroy -f deal with running databases

If the user provided -f (force), the intention on running databases most
likely was to remove them even if they were still running.


diffs (45 lines):

diff --git a/tools/merovingian/ChangeLog.Jan2014 
b/tools/merovingian/ChangeLog.Jan2014
--- a/tools/merovingian/ChangeLog.Jan2014
+++ b/tools/merovingian/ChangeLog.Jan2014
@@ -1,3 +1,6 @@
 # ChangeLog file for sql/src/backends/monet5/merovingian
 # This file is updated with mchangelog
 
+* Sun Feb 16 2014 Fabian Groffen <fab...@monetdb.org>
+- monetdb destroy -f now also works on running databases
+
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
@@ -82,8 +82,8 @@ command.
 By default, a confirmation question is asked, however the
 .I \-f
 option, when provided, suppresses this question and removal is executed
-right away.  Note that you cannot destroy a running database, bring it
-down first using the
+right away.  Note that without this option you cannot destroy a running
+database, bring it down first using the
 .B stop
 command.
 .IP "lock database [database ...]"
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
@@ -1559,6 +1559,17 @@ command_destroy(int argc, char *argv[])
                        printf("aborted\n");
                        exit(1);
                }
+       } else {
+               char *ret;
+               char *out;
+               for (stats = orig; stats != NULL; stats = stats->next) {
+                       if (stats->state == SABdbRunning) {
+                               ret = control_send(&out, mero_host, mero_port,
+                                               stats->dbname, "stop", 0, 
mero_pass);
+                               if (ret != NULL)
+                                       free(ret);
+                       }
+               }
        }
 
        simple_argv_cmd(argv[0], orig, "destroy", "destroyed database", NULL);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to