Changeset: fd2290fd35cd for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fd2290fd35cd
Modified Files:
        
Branch: default
Log Message:

Merging


diffs (truncated from 975 to 300 lines):

diff -r 5fea5dbee4bd -r fd2290fd35cd MonetDB5/src/modules/mal/remote.mx
--- a/MonetDB5/src/modules/mal/remote.mx        Wed Dec 22 08:04:47 2010 +0100
+++ b/MonetDB5/src/modules/mal/remote.mx        Wed Dec 22 08:06:08 2010 +0100
@@ -216,8 +216,6 @@
        int fd;
        char **redirs;
        char **or;
-       str tmp;
-       int port;
 
        if (pat == NULL || *pat == NULL || strcmp(*pat, (str)str_nil) == 0)
                throw(ILLARG, "remote.resolve",
@@ -242,14 +240,8 @@
        if (list == NULL)
                throw(MAL, "remote.resolve", MAL_MALLOC_FAIL);
 
-       tmp = GDKgetenv("mero_port");
-       port = 0;
-       if (tmp != NULL)
-               port = atoi(tmp);
-       if (port == 0)
-               port = 50000;  /* hardcoded default from merovingian.c */
-       gethostname(path, 8096);
-       or = redirs = mapi_resolve(path, port, *pat);
+       snprintf(path, 8096, "%s/mapi_socket", GDKgetenv("gdk_dbfarm"));
+       or = redirs = mapi_resolve(path, 0, *pat);
 
        if (redirs == NULL)
                throw(MAL, "remote.resolve", "unknown failure when resolving 
pattern");
diff -r 5fea5dbee4bd -r fd2290fd35cd clients/src/mapilib/Mapi.mx
--- a/clients/src/mapilib/Mapi.mx       Wed Dec 22 08:04:47 2010 +0100
+++ b/clients/src/mapilib/Mapi.mx       Wed Dec 22 08:06:08 2010 +0100
@@ -3010,7 +3010,7 @@
        Mapi mid;
 
        /* if it doesn't make sense, don't try to crash */
-       if (host == NULL || port <= 0 || pattern == NULL)
+       if (host == NULL || (host[0] != '/' && port <= 0) || pattern == NULL)
                return NULL;
 
        mid = mapi_mapi(host, port, "mero", "mero", "resolve", pattern);
diff -r 5fea5dbee4bd -r fd2290fd35cd 
sql/src/backends/monet5/merovingian/ChangeLog
--- a/sql/src/backends/monet5/merovingian/ChangeLog     Wed Dec 22 08:04:47 
2010 +0100
+++ b/sql/src/backends/monet5/merovingian/ChangeLog     Wed Dec 22 08:06:08 
2010 +0100
@@ -1,6 +1,10 @@
 # ChangeLog file for sql/src/backends/monet5/merovingian
 # This file is updated with mchangelog
 
+* Mon Dec 20 2010 Fabian Groffen <fab...@cwi.nl>
+- Allow use of globs with all commands that accept database names as
+  their parameters
+
 * Mon Sep 20 2010 Fabian Groffen <fab...@cwi.nl>
 - merovingian has been renamed into monetdbd.  Internally, monetdbd keeps
   referring to merovingian for e.g. settings and logfiles.  Merovingian
diff -r 5fea5dbee4bd -r fd2290fd35cd 
sql/src/backends/monet5/merovingian/client/monetdb.1.in
--- a/sql/src/backends/monet5/merovingian/client/monetdb.1.in   Wed Dec 22 
08:04:47 2010 +0100
+++ b/sql/src/backends/monet5/merovingian/client/monetdb.1.in   Wed Dec 22 
08:06:08 2010 +0100
@@ -1,7 +1,7 @@
 .\" Process this file with
 .\" groff -man -Tascii foo.1
 .\"
-.TH MONETDB 1 "SEPTEMBER 2009" Application "MonetDB Applications"
+.TH MONETDB 1 "DECEMBER 2010" Application "MonetDB Applications"
 .SH NAME
 monetdb \- control a MonetDB Database Server instance
 .SH SYNOPSIS
@@ -45,9 +45,13 @@
 The commands for the
 .B monetdb
 utility are
-.BR create ", " destroy ", " lock ", " release ", " status ", " start ", " 
stop ", " kill ", " set ", " get ", " inherit ", " discover ", " help ", " 
version .
+.BR create ", " destroy ", " lock ", " release ", " status ", " start ", " 
stop ", " kill ", " set ", " get ", " inherit ", " discover ", " help " and " 
version .
 The commands facilitate adding, removing, maintaining, starting and
 stopping a database inside the MonetDB Database Server.
+.P
+For all commands, database arguments can be glob-like expressions.
+This allows to do wildcard matches.  For details on the syntax, see
+.IR EXPRESSIONS .
 .IP "create database [database ...]"
 Initialises a new database in the MonetDB Database Server.  A database
 created with this command makes it available under its database name,
@@ -75,7 +79,7 @@
 .I monetdb
 account).  A database which is under maintenance is not started
 automatically by
-.BR merovingian (1),
+.BR monetdbd (1),
 the MonetDB Database Server, when clients request for it.  Use the
 .B release
 command to bring the database back for normal usage.  To start a
@@ -88,16 +92,14 @@
 Use the
 .B lock
 command to take a database under maintenance.
-.IP "status [\-lc] [\-s states] [expression ...]"
-Shows the state of the given database(s) or, when none given, all known
-databases.  The database names can be given as expressions, allowing to
-do wildcard matches.  For details on the syntax, see
-.IR EXPRESSIONS .
+.IP "status [\-lc] [\-s states] [database ...]"
+Shows the state of the given database, or, when none given, all known
+databases.
 Three modes control the level of detail in the displayed
 output.  By default a condensed one-line output per database format is
 used.  This output resembles pretty much the output of various
-.B XXXstat
-functions, and is ideal for quickly gaining an overview of the system
+.B xxxstat
+programs, and is ideal for quickly gaining an overview of the system
 state.
 .IP "  \-c"
 The
@@ -131,11 +133,9 @@
 .IP "start [\-a] database [database ...]"
 .IP "stop [\-a] database [database ...]"
 .IP "kill [\-a] database [database ...]"
-Starts, stops or kills the given database(s) or, when
+Starts, stops or kills the given database, or, when
 .I "  \-a"
-is supplied, all known databases, if the MonetDB Database Server
-.BR merovingian (1)
-is running.  The
+is supplied, all known databases.  The
 .B kill
 command immediately sends a SIGKILL and should only be used as last
 resort for a database that doesn't respond any more.  Killing a database
@@ -145,14 +145,14 @@
 command to stop a database.  It will first attempt to stop the database,
 waiting for
 .I mero_exittimeout
-seconds and if that fails kill the database.
+seconds and if that fails, kill the database.
 When using the
 .B start
 command,
 .BR monetdb (1)
 will output diagnostic messages if the requested action failed.  When
 encountering an error, one should always consult the logfile of
-.BR merovingian (1)
+.BR monetdbd (1)
 for more details.  For the
 .B kill
 command a diagnostic message indicating the database has crashed is
@@ -162,14 +162,14 @@
 the return code of
 .BR monetdb (1)
 indicates failure if one of the databases had a failure, even though
-other databases were successful.
+the operation on other databases was successful.
 .IP "get <all | property[,property]> [database ...]"
 Prints the requested properties, or all known properties, for the given
-databases.  For each property its source and value are printed.  Source
+database.  For each property its source and value are printed.  Source
 indicates where the current value comes from, e.g. the configuration
 file, or a local override.
 .IP "set property=value database [database ...]"
-Sets property to value for the given databases.  For a list of
+Sets property to value for the given database.  For a list of
 properties, run
 .BR "monetdb get all" .
 Most properties require the database to be stopped when set.  The
@@ -194,7 +194,7 @@
 usage.  For information about the tag format and use, see section
 .I "REMOTE DATABASES"
 in the
-.BR merovingian (1)
+.BR monetdbd (1)
 manpage.  Note that this property can be set for a running database, and
 that a change takes immediate effect in the network.
 .IP "  master=<yes|no|id>"
@@ -226,7 +226,7 @@
 .IP "discover [expression]"
 Returns a list of remote merovingians and database URIs
 that were discovered by
-.BR merovingian (1).
+.BR monetdbd (1).
 All databases listed can be connected to via the local MonetDB Database
 Server as if it were local databases using their database name.  The
 connection is redirected or proxied based on configuration settings.  If
@@ -253,7 +253,8 @@
 .B monetdb
 utility.
 .SH "EXPRESSIONS"
-For various options, expressions can be used.  These expressions are
+For various options, typically database names, expressions can be used.
+These expressions are
 limited shell-globbing like, where the * in any position is expanded to
 an arbitrary string.  The * can occur multiple times in the expression,
 allowing for more advanced matches.  Note that the empty string also
@@ -279,5 +280,5 @@
 .I MONETDB5CONF
 in the enviroment.
 .SH "SEE ALSO"
-.BR merovingian (1)
+.BR monetdbd (1)
 .\".BR mserver5 (1)
diff -r 5fea5dbee4bd -r fd2290fd35cd 
sql/src/backends/monet5/merovingian/client/monetdb.c
--- a/sql/src/backends/monet5/merovingian/client/monetdb.c      Wed Dec 22 
08:04:47 2010 +0100
+++ b/sql/src/backends/monet5/merovingian/client/monetdb.c      Wed Dec 22 
08:06:08 2010 +0100
@@ -30,7 +30,7 @@
  * primary goals of this tool.
  */
 
-#define TOOLKIT_VERSION   "0.6"
+#define TOOLKIT_VERSION   "0.7"
 
 #include "sql_config.h"
 #include "mal_sabaoth.h"
@@ -188,103 +188,6 @@
                        TOOLKIT_VERSION, MONETDB_RELEASE);
 }
 
-/**
- * Helper function to run over argv, skip all values that are NULL,
- * perform merocmd for the value and reporting status on the performed
- * command.  Either a message is printed when success, or when premsg is
- * not NULL, premsg is printed before the action, and "done" printed
- * afterwards.
- */
-static void
-simple_argv_cmd(int argc, char *argv[], char *merocmd,
-               char *successmsg, char *premsg)
-{
-       int i;
-       int state = 0;        /* return status */
-       int hadwork = 0;      /* if we actually did something */
-       char *ret;
-       char *out;
-
-       /* do for each listed database */
-       for (i = 1; i < argc; i++) {
-               if (argv[i] == NULL)
-                       continue;
-
-               if (premsg != NULL && !monetdb_quiet) {
-                       printf("%s '%s'... ", premsg, argv[i]);
-                       fflush(stdout);
-               }
-
-               ret = control_send(&out, mero_host, mero_port,
-                               argv[i], merocmd, 0, mero_pass);
-
-               if (ret != NULL) {
-                       if (premsg != NULL && !monetdb_quiet)
-                               printf("FAILED\n");
-                       fprintf(stderr, "%s: failed to perform command: %s\n",
-                                       argv[0], ret);
-                       free(ret);
-                       exit(2);
-               }
-
-               if (strcmp(out, "OK") == 0) {
-                       if (!monetdb_quiet) {
-                               if (premsg != NULL) {
-                                       printf("done\n");
-                               } else {
-                                       printf("%s: %s\n", successmsg, argv[i]);
-                               }
-                       }
-               } else {
-                       if (premsg != NULL && !monetdb_quiet)
-                               printf("FAILED\n");
-                       fprintf(stderr, "%s: %s\n", argv[0], out);
-                       free(out);
-
-                       state |= 1;
-               }
-
-               hadwork = 1;
-       }
-
-       if (hadwork == 0) {
-               command_help(2, &argv[-1]);
-               exit(1);
-       }
-}
-
-/**
- * Helper function for commands in their most general form: no option
- * flags and just pushing all (database) arguments over to merovingian
- * for performing merocmd action.
- */
-static void
-simple_command(int argc, char *argv[], char *merocmd, char *successmsg)
-{
-       int i;
-
-       if (argc == 1) {
-               /* print help message for this command */
-               command_help(2, &argv[-1]);
-               exit(1);
-       }
-       
-       /* walk through the arguments and hunt for "options" */
-       for (i = 1; i < argc; i++) {
-               if (strcmp(argv[i], "--") == 0) {
-                       argv[i] = NULL;
-                       break;
-               }
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to