Changeset: af59800d4b4c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=af59800d4b4c
Modified Files:
        common/stream/stream.c
        common/stream/stream.h
        gdk/gdk_logger.c
        tools/embedded/embedded.c
        tools/reverserapi/configure
Branch: embedded
Log Message:

Less output to stdout. Remaining: SQLprelude()


diffs (211 lines):

diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -3736,3 +3736,36 @@ wbstream(stream *s, size_t buflen)
        wbs->len = buflen;
        return ns;
 }
+
+
+static ssize_t
+stream_blackhole_write(stream *s, const void *buf, size_t elmsize, size_t cnt)
+{
+       s = (stream*)s;
+       buf = (const void*) buf;
+       elmsize = (size_t) elmsize;
+       return (ssize_t) cnt;
+}
+
+static void
+stream_blackhole_close(stream *s)
+{
+       s = (stream*)s;
+       // no resources to close
+}
+
+stream * stream_blackhole_create (void)
+{
+       stream *s;
+       if ((s = create_stream("blackhole")) == NULL) {
+               return NULL;
+       }
+
+       s->read = NULL;
+       s->write = stream_blackhole_write;
+       s->close = stream_blackhole_close;
+       s->flush = NULL;
+       s->access = ST_WRITE;
+       return s;
+}
+
diff --git a/common/stream/stream.h b/common/stream/stream.h
--- a/common/stream/stream.h
+++ b/common/stream/stream.h
@@ -240,4 +240,6 @@ typedef enum mnstr_errors {
        MNSTR_TIMEOUT
 } mnstr_errors;
 
+stream_export stream* stream_blackhole_create(void);
+
 #endif /*_STREAM_H_*/
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -958,8 +958,10 @@ logger_readlog(logger *lg, char *filenam
                return 1;
        }
        t0 = time(NULL);
-       printf("# Start reading the write-ahead log '%s'\n", filename);
-       fflush(stdout);
+       if (lg->debug & 1) {
+               printf("# Start reading the write-ahead log '%s'\n", filename);
+               fflush(stdout);
+       }
        while (!err && log_read_format(lg, &l)) {
                char *name = NULL;
 
@@ -1059,8 +1061,10 @@ logger_readlog(logger *lg, char *filenam
        while (tr)
                tr = tr_abort(lg, tr);
        t0 = time(NULL);
-       printf("# Finished reading the write-ahead log '%s'\n", filename);
-       fflush(stdout);
+       if (lg->debug & 1) {
+               printf("# Finished reading the write-ahead log '%s'\n", 
filename);
+               fflush(stdout);
+       }
        return LOG_OK;
 }
 
@@ -1884,10 +1888,11 @@ logger_create(int debug, const char *fn,
 {
        logger *lg;
 
-       printf("# Start processing logs %s/%s version %d\n",fn,logdir,version);
-       fflush(stdout);
        lg = logger_new(debug, fn, logdir, version, prefuncp, postfuncp, 0, 
NULL);
-
+       if (lg->debug & 1) {
+               printf("# Started processing logs %s/%s version 
%d\n",fn,logdir,version);
+               fflush(stdout);
+       }
        if (!lg)
                return NULL;
        if (logger_open(lg) == LOG_ERR) {
@@ -1895,7 +1900,9 @@ logger_create(int debug, const char *fn,
 
                return NULL;
        }
-       printf("# Finished processing logs %s/%s\n",fn,logdir);
+       if (lg->debug & 1) {
+               printf("# Finished processing logs %s/%s\n",fn,logdir);
+       }
        GDKsetenv("recovery","finished");
        fflush(stdout);
        if (lg->changes &&
@@ -1914,11 +1921,11 @@ logger *
 logger_create_shared(int debug, const char *fn, const char *logdir, const char 
*local_logdir, int version, preversionfix_fptr prefuncp, postversionfix_fptr 
postfuncp)
 {
        logger *lg;
-
-       printf("# Start processing logs %s/%s version %d\n",fn,logdir,version);
-       fflush(stdout);
        lg = logger_new(debug, fn, logdir, version, prefuncp, postfuncp, 1, 
local_logdir);
-
+       if (lg->debug & 1) {
+               printf("# Started processing logs %s/%s version 
%d\n",fn,logdir,version);
+               fflush(stdout);
+       }
        return lg;
 }
 
diff --git a/tools/embedded/embedded.c b/tools/embedded/embedded.c
--- a/tools/embedded/embedded.c
+++ b/tools/embedded/embedded.c
@@ -17,8 +17,9 @@
 #include "embedded.h"
 #include <stdio.h>
 #include <errno.h>
-#include <string.h> /* strerror */
+#include <string.h>
 #include <locale.h>
+
 #include "monet_options.h"
 #include "mal.h"
 #include "mal_session.h"
@@ -33,6 +34,7 @@
 #include "sql_catalog.h"
 #include "sql_execute.h"
 
+
 typedef str (*SQLstatementIntern_ptr_tpe)(Client, str*, str, bit, bit, 
res_table**);
 SQLstatementIntern_ptr_tpe SQLstatementIntern_ptr = NULL;
 typedef void (*res_table_destroy_ptr_tpe)(res_table *t);
@@ -69,18 +71,26 @@ int monetdb_startup(char* dir) {
        snprintf(mod_path, 1000, "%s/../lib/monetdb5", BINDIR);
        GDKsetenv("monet_mod_path", mod_path);
        GDKsetenv("mapi_disable", "true");
+       GDKsetenv("max_clients", "0");
 
        msab_dbpathinit(GDKgetenv("gdk_dbpath"));
        if (mal_init() != 0) goto cleanup;
 
-       printf("# Using data directory %s\n", GDKgetenv("gdk_dbpath"));
+       // hide output on client out
+       mal_clients[0].fdout = stream_blackhole_create();
 
        // This dynamically looks up functions, because the library containing 
them is loaded at runtime.
-       SQLstatementIntern_ptr = (SQLstatementIntern_ptr_tpe) 
lookup_function("lib_sql", "SQLstatementIntern");
-       res_table_destroy_ptr = (res_table_destroy_ptr_tpe) 
lookup_function("libstore",  "res_table_destroy");
+       SQLstatementIntern_ptr = (SQLstatementIntern_ptr_tpe) 
lookup_function("lib_sql",  "SQLstatementIntern");
+       res_table_destroy_ptr  = (res_table_destroy_ptr_tpe)  
lookup_function("libstore", "res_table_destroy");
        if (SQLstatementIntern_ptr == NULL || res_table_destroy_ptr == NULL) 
goto cleanup;
 
+
        monetdb_embedded_initialized = true;
+       // sanity check, run a SQL query
+       if (monetdb_query("SELECT * FROM tables;") == NULL) {
+               monetdb_embedded_initialized = false;
+               goto cleanup;
+       }
        retval = 0;
 
 cleanup:
@@ -112,7 +122,6 @@ void monetdb_cleanup_result(void* output
        (*res_table_destroy_ptr)((res_table*) output);
 }
 
-
 #define BAT_TO_INTSXP(bat,tpe,retsxp)                                          
\
        do {                                                                    
                                \
                tpe v;  size_t j;                                               
                        \
diff --git a/tools/reverserapi/configure b/tools/reverserapi/configure
--- a/tools/reverserapi/configure
+++ b/tools/reverserapi/configure
@@ -2,14 +2,16 @@
 cd src
 # TODO wget/unpack MonetDB here? Once embedded-lib is in release...
 CFLAGS="-I$R_INCLUDE_DIR" ./configure --prefix=$R_PACKAGE_DIR/install \
---enable-embedded  --disable-fits --disable-geom --disable-rintegration 
--disable-gsl \
+--enable-embedded  --disable-fits --disable-geom --disable-rintegration 
--disable-gsl --disable-netcdf \
 --disable-jdbc --disable-merocontrol --disable-odbc --disable-console 
--disable-microhttpd \
 --without-perl --without-python2 --without-python3 --without-rubygem 
--without-unixodbc \
---without-samtools --without-sphinxclient --without-geos --without-samtools 
--enable-optimize
+--without-samtools --without-sphinxclient --without-geos --without-samtools 
--without-readline \
+--enable-optimize --enable-silent-rules
 
 # Dirty hack, normally R would call make, but we need to also do a make 
install to get the libs in place. 
 # So we do it ourselves instead and then render the MonetDB makefile inert.
 make -j clean install
+
 echo -e "dummytarget:\n\ttrue\n" > Makefile
 cd ..
 
@@ -28,6 +30,6 @@ if [ -f "$R_PACKAGE_DIR/install/lib/libe
 fi
 # TODO: Windows case (shudder)
 if [ ! -f $RDYNLIB ]; then
-       echo "could not link $RDYNLIB"
+       echo "configure/build failure"
     exit -1
 fi
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to