Update of /cvsroot/monetdb/MonetDB5/src/tools
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13472/src/tools
Modified Files:
Tag: GDK-2
Makefile.ag merovingian.mx monetdb.1 monetdb.mx stethoscope.mx
Log Message:
propagated changes of Monday Sep 03 2007 - Thursday Sep 06 2007
from the development trunk to the GDK-2 branch
Index: monetdb.1
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/tools/monetdb.1,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -d -r1.1.2.2 -r1.1.2.3
--- monetdb.1 3 Sep 2007 13:08:37 -0000 1.1.2.2
+++ monetdb.1 6 Sep 2007 13:52:48 -0000 1.1.2.3
@@ -64,10 +64,9 @@
Use the
.B lock
command to take a database under maintenance.
-.IP "status [\-als] [database ...]"
-Shows the state of the given database(s) or, when
-.I \-a
-is supplied, all known databases. Three modes control the level of
+.IP "status [\-ls] [database ...]"
+Shows the state of the given database(s) or, when none given, all known
+databases. Three modes control the level of
detail in the displayed output. By default the most used properties of
a database are being shown. This includes the state of the database
(running, crashed, stopped), whether it is under maintenance or not, the
@@ -87,9 +86,7 @@
resembles pretty much the output of various
.B XXXstat
functions, and is ideal for quickly gaining an overview of the system
-state in combination with the
-.I \-a
-flag.
+state.
.IP "start [\-a] [database ...]"
.IP "stop [\-a] [database ...]"
.IP "kill [\-a] [database ...]"
Index: stethoscope.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/tools/stethoscope.mx,v
retrieving revision 1.25.2.1
retrieving revision 1.25.2.2
diff -u -d -r1.25.2.1 -r1.25.2.2
--- stethoscope.mx 21 Aug 2007 13:24:54 -0000 1.25.2.1
+++ stethoscope.mx 6 Sep 2007 13:52:48 -0000 1.25.2.2
@@ -388,7 +388,8 @@
else
sprintf(cmd,"cp stet.dat stet_cur.dat");
/* printf("%s \n",cmd);*/
- system(cmd);
+ if (system(cmd) != 0)
+ fprintf(stderr, "command `%s'
failed\n", cmd);
}
response = e+1;
}
Index: merovingian.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/tools/merovingian.mx,v
retrieving revision 1.27.2.3
retrieving revision 1.27.2.4
diff -u -d -r1.27.2.3 -r1.27.2.4
--- merovingian.mx 3 Sep 2007 13:08:36 -0000 1.27.2.3
+++ merovingian.mx 6 Sep 2007 13:52:48 -0000 1.27.2.4
@@ -475,6 +475,7 @@
_merovingian_mserver, database);
execl(_merovingian_mserver, _merovingian_mserver,
"--set", "daemon=yes",
+ "--set", "mapi_open=true",
dbname,
"--dbinit=include sql;", /* yes, this IS
correct */
(char *)NULL);
@@ -869,26 +870,23 @@
static void
controlRunner(void *d)
{
- FILE *f;
char buf[256];
char *p;
sabdb *stats;
-
- if ((f = fopen((char *)d, "r")) == NULL) {
- fprintf(stderr, "unable to open up control command channel "
- "for reading: %s\n", strerror(errno));
- return;
- }
+ int fd = *((int *)d);
+ int len;
/* Try to handle control signals. We can get race conditions due to
* clients coming in at the same time. We might need to fix this
* situation sometime. */
while (_keepListening == 1) {
- if (fgets(buf, 256, f) == NULL) {
+ if ((len = read(fd, buf, 255)) == 0) {
/* ignore EOF, but don't spin-lock */
- MT_sleep_ms(1000);
+ MT_sleep_ms(500);
continue;
}
+ buf[len] = '\0';
+
/* format is simple: database<space>command */
if ((p = strchr(buf, ' ')) == NULL) {
fprintf(stderr, "malformed control signal: %s\n", buf);
@@ -930,8 +928,8 @@
}
}
}
- fclose(f);
- fprintf(stderr, "control channel closed\n");
+ close(fd);
+ merlog("control channel closed");
}
static str
@@ -1197,7 +1195,8 @@
/* open up a connection */
e = openConnection(&sock, MEROV_PORT);
if (e == NO_ERR) {
- pthread_t ctid;
+ pthread_t ctid = 0;
+ int comfd = -1;
for (argp = 1; argp < argc; argp++) {
e = forkMserver(argv[argp], &stats, 0);
if (e != NO_ERR) {
@@ -1209,7 +1208,8 @@
}
/* handle control commands */
- if (pthread_create(&ctid, NULL, (void *(*)(void
*))controlRunner, (void *)buf) < 0) {
+ comfd = open(buf, O_RDONLY | O_NONBLOCK);
+ if (pthread_create(&ctid, NULL, (void *(*)(void
*))controlRunner, (void *)&comfd) < 0) {
fprintf(stderr, "unable to create control command
thread\n");
ctid = 0;
}
@@ -1218,7 +1218,10 @@
e = acceptConnections(sock);
/* shut down the control runner too */
- pthread_join(ctid, NULL);
+ if (comfd > -1)
+ close(comfd);
+ if (ctid != 0)
+ pthread_join(ctid, NULL);
}
unlink(buf);
Index: monetdb.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/tools/monetdb.mx,v
retrieving revision 1.8.2.4
retrieving revision 1.8.2.5
diff -u -d -r1.8.2.4 -r1.8.2.5
--- monetdb.mx 3 Sep 2007 13:08:37 -0000 1.8.2.4
+++ monetdb.mx 6 Sep 2007 13:52:48 -0000 1.8.2.5
@@ -109,11 +109,11 @@
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], "status") == 0) {
- printf("Usage: monetdb status [-als] [database ...]\n");
- printf(" Shows the state of a given database. Various
options\n");
+ printf("Usage: monetdb status [-ls] [database ...]\n");
+ printf(" Shows the state of a given database, or all known if
none\n");
+ printf(" given. Instead of the normal mode, a long and short
mode\n");
printf(" control what information is displayed.\n");
printf("Options:\n");
- printf(" -a list status of all databases\n");
printf(" -l use long listing\n");
printf(" -s use short one-line listing\n");
} else if (strcmp(argv[1], "start") == 0) {
@@ -356,18 +356,14 @@
static void
command_status(int argc, char *argv[])
{
- int doall = 0;
+ int doall = 1; /* we default to showing all */
int mode = 0; /* 0=normal, 1=short, 2=long */
int i;
char *p;
str e;
sabdb *stats;
- if (argc == 1) {
- /* print help message for this command */
- command_help(2, &argv[-1]);
- exit(1);
- } else if (argc == 0) {
+ if (argc == 0) {
exit(2);
}
@@ -376,9 +372,6 @@
if (argv[i][0] == '-') {
for (p = argv[i] + 1; *p != '\0'; p++) {
switch (*p) {
- case 'a':
- doall = 1;
- break;
case 's':
mode = 1;
break;
@@ -387,6 +380,8 @@
break;
case '-':
if (p[1] == '\0') {
+ if (argc - 1 > i)
+ doall = 0;
i = argc;
break;
}
@@ -400,6 +395,8 @@
/* make this option no longer available, for easy use
* lateron */
argv[i] = NULL;
+ } else {
+ doall = 0;
}
}
@@ -646,13 +643,14 @@
/* to all insanity, .gdk_lock is "valid" if it contains
a
* ':', which it does by pure coincidence of a time
having a
* ':' in there twice... */
- fwrite("bla:", 4, 1, f);
+ if (fwrite("bla:", 1, 4, f) < 4)
+ fprintf(stderr, "create: failure in writing
lock file\n");
fclose(f);
- printf("successfully created database %s%s\n", dbname,
+ printf("successfully created database '%s'%s\n", dbname,
(maintenance == 1 ? " in maintenance
mode" : ""));
} else {
SABAOTHfreeStatus(&stats);
- fprintf(stderr, "create: database %s already exists\n",
dbname);
+ fprintf(stderr, "create: database '%s' already
exists\n", dbname);
exit(1);
}
}
@@ -765,13 +763,13 @@
err e;
if (stats->state == SABdbRunning) {
- fprintf(stderr, "destroy: database %s is still
running, "
+ fprintf(stderr, "destroy: database '%s' is
still running, "
"stop database first\n",
dbname);
SABAOTHfreeStatus(&stats);
exit(1);
}
if (stats->locked == 1) {
- fprintf(stderr, "destroy: database %s is under
maintenance"
+ fprintf(stderr, "destroy: database '%s' is
under maintenance"
", release database first\n",
dbname);
SABAOTHfreeStatus(&stats);
exit(1);
@@ -779,11 +777,10 @@
if (force == 0) {
char answ;
- printf("you are about to remove database %s\n",
dbname);
+ printf("you are about to remove database
'%s'\n", dbname);
printf("ALL data in this database will get
lost, "
"are you sure? [y/N] ");
- scanf("%c", &answ);
- if (answ == 'y' || answ == 'Y') {
+ if (scanf("%c", &answ) >= 1 && (answ == 'y' ||
answ == 'Y')) {
/* do it! */
} else {
printf("battle control terminated\n");
@@ -794,13 +791,13 @@
/* annoyingly we have to delete file by file, and
* directories recursively... */
if ((e = deletedir(stats->path)) != NULL) {
- fprintf(stderr, "destroy: failed to destroy %s:
%s\n",
+ fprintf(stderr, "destroy: failed to destroy
'%s': %s\n",
argv[1], e);
GDKfree(e);
exit(1);
}
SABAOTHfreeStatus(&stats);
- printf("successfully destroyed database %s\n", dbname);
+ printf("successfully destroyed database '%s'\n",
dbname);
} else {
fprintf(stderr, "destroy: no such database: %s\n",
dbname);
exit(1);
@@ -832,7 +829,7 @@
char path[8096];
if (stats->locked == 1) {
- fprintf(stderr, "lock: database %s already is "
+ fprintf(stderr, "lock: database '%s' already is
"
"under maintenance\n", dbname);
SABAOTHfreeStatus(&stats);
exit(1);
@@ -844,7 +841,7 @@
printf("database %s is now under maintenance\n",
dbname);
SABAOTHfreeStatus(&stats);
} else {
- fprintf(stderr, "lock: no such database %s\n", dbname);
+ fprintf(stderr, "lock: no such database: %s\n", dbname);
exit(1);
}
}
@@ -874,7 +871,7 @@
char path[8096];
if (stats->locked != 1) {
- fprintf(stderr, "release: database %s is not "
+ fprintf(stderr, "release: database '%s' is not "
"under maintenance\n", dbname);
SABAOTHfreeStatus(&stats);
exit(1);
@@ -883,16 +880,16 @@
/* put this database in maintenance mode */
snprintf(path, 8095, "%s/.maintenance", stats->path);
if (unlink(path) != 0) {
- fprintf(stderr, "failed to take database %s out
of maintenance"
- " mode: %s\n", dbname,
strerror(errno));
+ fprintf(stderr, "failed to take database '%s'
out of "
+ " maintenance mode: %s\n",
dbname, strerror(errno));
SABAOTHfreeStatus(&stats);
exit(1);
}
- printf("database %s has been taken out of maintenance
mode\n",
+ printf("database '%s' has been taken out of maintenance
mode\n",
dbname);
SABAOTHfreeStatus(&stats);
} else {
- fprintf(stderr, "release: no such database %s\n",
dbname);
+ fprintf(stderr, "release: no such database: %s\n",
dbname);
exit(1);
}
}
Index: Makefile.ag
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/tools/Makefile.ag,v
retrieving revision 1.43.2.3
retrieving revision 1.43.2.4
diff -u -d -r1.43.2.3 -r1.43.2.4
--- Makefile.ag 3 Sep 2007 13:08:35 -0000 1.43.2.3
+++ Makefile.ag 6 Sep 2007 13:52:48 -0000 1.43.2.4
@@ -79,4 +79,5 @@
SOURCES = monetdb5-config.bat.in
}
-EXTRA_DIST_DIR = Tests $(man_MANS)
+EXTRA_DIST = $(man_MANS)
+EXTRA_DIST_DIR = Tests
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins