Changeset: 116701254083 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/116701254083
Branch: smapi
Log Message:

Merge with default


diffs (truncated from 460 to 300 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -432,6 +432,7 @@ install it.
 Summary: Integration of MonetDB and Python, allowing use of Python from within 
SQL
 Group: Applications/Databases
 Requires: MonetDB5-server%{?_isa} = %{version}-%{release}
+Requires: python3-numpy
 
 %description python3
 MonetDB is a database management system that is developed from a
diff --git a/clients/mapiclient/mhelp.c b/clients/mapiclient/mhelp.c
--- a/clients/mapiclient/mhelp.c
+++ b/clients/mapiclient/mhelp.c
@@ -111,23 +111,32 @@ SQLhelp sqlhelp1[] = {
         "See also 
https://www.monetdb.org/documentation/user-guide/sql-manual/transactions/"},
        {"COPY BINARY",
         "Append binary representations into a table",
-        "COPY [( BIG | LITTLE | NATIVE) ENDIAN] BINARY INTO qname 
[column_list] FROM string [',' ...] [ON { CLIENT | SERVER }]",
+        "COPY [{BIG | LITTLE | NATIVE} ENDIAN] BINARY INTO qname [column_list] 
FROM string [',' ...] [ON { CLIENT | SERVER }]",
         "qname,column_list",
         "See also 
https://www.monetdb.org/documentation/user-guide/sql-manual/data-loading/binary-loading/"},
        {"COPY INTO",
-        "Parse a csv file into a table or write a query result to a csv file",
+        "Write query result data to a csv file or standard output stream",
+        "COPY query_expression INTO [STDOUT | string [ON { CLIENT | SERVER }]] 
[separators] [NULL [AS] string]",
+        "query_expression,separators",
+        "See also 
https://www.monetdb.org/documentation/user-guide/sql-manual/data-loading/export_data/"},
+       {"COPY INTO BINARY",
+        "Write query result data to binary files",
+        "COPY query_expression INTO [{{BIG | LITTLE | NATIVE}} ENDIAN] BINARY 
string_commalist [ON { CLIENT | SERVER }]",
+        "query_expression",
+        "See also 
https://www.monetdb.org/documentation/user-guide/sql-manual/data-loading/export_data/"},
+       {"COPY INTO FROM",
+        "Read csv file(s) or standard input stream data and insert into a 
table",
         "COPY [nrofrecords] INTO qname [column_list] FROM string [',' ...] 
[headerlist] [ON { CLIENT | SERVER }] [ separators]\n"
         " [NULL [AS] string] [BEST EFFORT] [FWF '(' integer [',' ...] ')'\n"
         "COPY [nrofrecords] INTO qname [column_list] FROM STDIN [headerlist] [ 
separators]\n"
-        " [NULL [AS] string] [BEST EFFORT]\n"
-        "COPY query_expression INTO [STDOUT | string [ON { CLIENT | SERVER }]] 
[separators] [NULL [AS] string]",
+        " [NULL [AS] string] [BEST EFFORT]\n",
         "nrofrecords,qname,column_list,headerlist,separators",
         "See also 
https://www.monetdb.org/documentation/user-guide/sql-manual/data-loading/copy-from/"},
        {"COPY LOADER",
         "Copy into using a user supplied parsing function",
         "COPY LOADER INTO qname FROM qname '(' [ scalar_expression ... ] ')'",
         "qname,scalar_expression",
-        NULL},
+        "See also 
https://www.monetdb.org/documentation/user-guide/sql-manual/data-loading/loader-functions/"},
        {"CREATE AGGREGATE",
         "Create a user-defined aggregate function. The body of the aggregate 
function\n"
         "can also be defined in other programming languages such as Python, R, 
C or CPP.",
@@ -228,8 +237,8 @@ SQLhelp sqlhelp1[] = {
        {"CREATE TRIGGER",
         "Define a triggered action for a table data update event",
         "CREATE [ OR REPLACE ] TRIGGER ident { BEFORE | AFTER }\n"
-        " { INSERT | DELETE | TRUNCATE | UPDATE [ OF ident_list ] }\n"
-        " ON qname [ REFERENCING trigger_reference [...] ] triggered_action",
+        " { INSERT | DELETE | TRUNCATE | UPDATE [ OF ident_list ] | LOGIN }\n"
+        " [ ON qname ] [ REFERENCING trigger_reference [...] ] 
triggered_action",
         "qname,ident_list,trigger_reference,triggered_action",
         "See also 
https://www.monetdb.org/documentation/user-guide/sql-programming/trigger-definition/"},
        {"CREATE TYPE",
@@ -297,11 +306,6 @@ SQLhelp sqlhelp1[] = {
         "DEALLOCATE [ PREPARE ] { intnr | ** | ALL }",
         NULL,
         NULL},
-       {"DEBUG",
-        "Debug a SQL statement using MAL debugger",
-        "DEBUG statement",
-        NULL,
-        "See also 
https://www.monetdb.org/documentation/admin-guide/debugging-features/debug-sql-stmt/"},
        {"DECLARE",
         "Define a local variable",
         "DECLARE ident_list data_type",
@@ -950,7 +954,7 @@ SQLhelp sqlhelp2[] = {
         NULL},
        {"triggered_action",
         NULL,
-        "[ FOR [EACH] { ROW | STATEMENT } ]\n"
+        "[ FOR EACH { ROW | STATEMENT } ]\n"
         "[ WHEN '(' search_condition ')' ]\n"
         "{ trigger_statement | BEGIN ATOMIC trigger_statement [ ; ... ] END }",
         "trigger_statement,search_condition",
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -268,40 +268,6 @@ static volatile MT_Id locked_by = 0;
 static int BBPunloadCnt = 0;
 static MT_Lock GDKunloadLock = MT_LOCK_INITIALIZER(GDKunloadLock);
 
-/* GDKtmLock protects all accesses and changes to BAKDIR and SUBDIR
- * must use BBPtmlock()/BBPtmunlock() to set/unset the lock */
-static MT_Lock GDKtmLock = MT_LOCK_INITIALIZER(GDKtmLock);
-static char *lockfile;
-static int lockfd;
-
-void
-BBPtmlock(void)
-{
-       MT_lock_set(&GDKtmLock);
-       if (GDKinmemory(0))
-               return;
-       /* also use an external lock file to synchronize with external
-        * programs */
-       if (lockfile == NULL) {
-               lockfile = GDKfilepath(0, NULL, ".tm_lock", NULL);
-               if (lockfile == NULL)
-                       return;
-       }
-       lockfd = MT_lockf(lockfile, F_LOCK);
-}
-
-void
-BBPtmunlock(void)
-{
-       if (lockfile && lockfd >= 0) {
-               assert(!GDKinmemory(0));
-               MT_lockf(lockfile, F_ULOCK);
-               close(lockfd);
-               lockfd = -1;
-       }
-       MT_lock_unset(&GDKtmLock);
-}
-
 void
 BBPlock(void)
 {
@@ -1510,7 +1476,7 @@ BBPtrim(bool aggressive)
                flag |= BBPHOT;
        for (bat bid = 1, nbat = (bat) ATOMIC_GET(&BBPsize); bid < nbat; bid++) 
{
                /* don't do this during a (sub)commit */
-               MT_lock_set(&GDKtmLock);
+               BBPtmlock();
                MT_lock_set(&GDKswapLock(bid));
                BAT *b = NULL;
                bool swap = false;
@@ -1536,7 +1502,7 @@ BBPtrim(bool aggressive)
                                GDKerror("unload failed for bat %d", bid);
                        n++;
                }
-               MT_lock_unset(&GDKtmLock);
+               BBPtmunlock();
        }
        TRC_DEBUG(BAT_, "unloaded %d bats%s\n", n, aggressive ? " (also hot)" : 
"");
 }
@@ -4532,3 +4498,40 @@ BBPcallbacks(void)
        }
        MT_lock_unset(&GDKCallbackListLock);
 }
+
+/* GDKtmLock protects all accesses and changes to BAKDIR and SUBDIR.
+ * MUST use BBPtmlock()/BBPtmunlock() to set/unset the lock.
+ *
+ * This is at the end of the file on purpose: we don't want people to
+ * accidentally use GDKtmLock directly. */
+static MT_Lock GDKtmLock = MT_LOCK_INITIALIZER(GDKtmLock);
+static char *lockfile;
+static int lockfd;
+
+void
+BBPtmlock(void)
+{
+       MT_lock_set(&GDKtmLock);
+       if (GDKinmemory(0))
+               return;
+       /* also use an external lock file to synchronize with external
+        * programs */
+       if (lockfile == NULL) {
+               lockfile = GDKfilepath(0, NULL, ".tm_lock", NULL);
+               if (lockfile == NULL)
+                       return;
+       }
+       lockfd = MT_lockf(lockfile, F_LOCK);
+}
+
+void
+BBPtmunlock(void)
+{
+       if (lockfile && lockfd >= 0) {
+               assert(!GDKinmemory(0));
+               MT_lockf(lockfile, F_ULOCK);
+               close(lockfd);
+               lockfd = -1;
+       }
+       MT_lock_unset(&GDKtmLock);
+}
diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -291,19 +291,27 @@ find_component(const char *comp)
  * API CALLS
  *
  */
+static volatile sig_atomic_t interrupted = 0;
+
 void
 GDKtracer_reinit_basic(int sig)
 {
        (void) sig;
+       interrupted = 1;
+}
+
+static void
+reinit(void)
+{
+       /* called locked */
+
+       interrupted = 0;
 
        // GDKtracer needs to reopen the file only in
        // case the adapter is BASIC
        if ((adapter_t) ATOMIC_GET(&cur_adapter) != BASIC)
                return;
 
-       // Make sure that GDKtracer is not trying to flush the buffer
-       MT_lock_set(&GDKtracer_lock);
-
        if (active_tracer) {
                if (active_tracer != stderr)
                        fclose(active_tracer);
@@ -312,8 +320,6 @@ GDKtracer_reinit_basic(int sig)
                active_tracer = NULL;
        }
        _GDKtracer_init_basic_adptr();
-
-       MT_lock_unset(&GDKtracer_lock);
 }
 
 
@@ -569,6 +575,10 @@ GDKtracer_log(const char *file, const ch
        if ((adapter_t) ATOMIC_GET(&cur_adapter) == MBEDDED)
                return;
 
+       MT_lock_set(&GDKtracer_lock);
+       if (interrupted)
+               reinit();
+
        if (level <= M_WARNING || (ATOMIC_GET(&GDKdebug) & FORCEMITOMASK)) {
                fprintf(stderr, "#%s%s%s: %s: %s: %s%s%s\n",
                        add_ts ? ts : "",
@@ -576,11 +586,15 @@ GDKtracer_log(const char *file, const ch
                        MT_thread_getname(), func, level_str[level] + 2,
                        msg, syserr ? ": " : "",
                        syserr ? syserr : "");
-               if (active_tracer == NULL || active_tracer == stderr || 
!write_to_tracer)
+               if (active_tracer == NULL || active_tracer == stderr || 
!write_to_tracer) {
+                       MT_lock_unset(&GDKtracer_lock);
                        return;
+               }
        }
-       if (active_tracer == NULL)
+       if (active_tracer == NULL) {
+               MT_lock_unset(&GDKtracer_lock);
                return;
+       }
        if (syserr)
                fprintf(active_tracer, "%s: %s\n", buffer, syserr);
        else
@@ -594,6 +608,7 @@ GDKtracer_log(const char *file, const ch
        // is still in the buffer which it never gets flushed.
        if (level == cur_flush_level || level <= M_ERROR)
                fflush(active_tracer);
+       MT_lock_unset(&GDKtracer_lock);
 }
 
 
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -402,9 +402,38 @@ BATSIGabort(int nr)
 static void
 BATSIGinit(void)
 {
+#ifdef HAVE_SIGACTION
+       struct sigaction sa;
+       sigemptyset(&sa.sa_mask);
+       sa.sa_flags = 0;
+#ifdef SIGPIPE
+       sa.sa_handler = SIG_IGN;
+       sigaction(SIGPIPE, &sa, NULL);
+#endif
+#ifdef SIGHUP
+       sa.sa_handler = GDKtracer_reinit_basic;
+       sigaction(SIGHUP, &sa, NULL);
+#endif
+#ifdef WIN32
+       sa.sa_handler = BATSIGabort;
+       sigaction(SIGABRT, &sa, NULL);
+#endif
+#else
 #ifdef SIGPIPE
        (void) signal(SIGPIPE, SIG_IGN);
 #endif
+#ifdef SIGHUP
+       // Register signal to GDKtracer (logrotate)
+       (void) signal(SIGHUP, GDKtracer_reinit_basic);
+#endif
+#ifdef WIN32
+       (void) signal(SIGABRT, BATSIGabort);
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to