Changeset: 2108927c7337 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2108927c7337
Modified Files:
        clients/Tests/MAL-signatures.stable.out
        clients/Tests/MAL-signatures.stable.out.int128
        clients/Tests/exports.stable.out
        common/utils/msabaoth.c
        common/utils/msabaoth.h
        gdk/gdk_join.c
        gdk/gdk_orderidx.c
        monetdb5/mal/mal.c
        monetdb5/modules/atoms/uuid.c
        monetdb5/modules/atoms/uuid.mal
        monetdb5/modules/atoms/xml.c
        monetdb5/modules/atoms/xml.h
        monetdb5/modules/atoms/xml.mal
        sql/server/sql_scan.c
        sql/storage/bat/bat_storage.c
        sql/storage/store.c
Branch: acticloud
Log Message:

Merge with Apr2019.


diffs (truncated from 394 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -12047,6 +12047,7 @@ Ready.
 [ "uuid",      "#read",        "command uuid.#read():void ",   "UUIDread;",    
""      ]
 [ "uuid",      "#tostr",       "command uuid.#tostr():void ",  
"UUIDtoString;",        ""      ]
 [ "uuid",      "#write",       "command uuid.#write():void ",  "UUIDwrite;",   
""      ]
+[ "uuid",      "epilogue",     "command uuid.epilogue():void ",        
"UUIDepilogue;",        "release the resources held by the uuid module" ]
 [ "uuid",      "isaUUID",      "command uuid.isaUUID(u:str):bit ",     
"UUIDisaUUID;", "Test a string for a UUID format"       ]
 [ "uuid",      "new",  "unsafe command uuid.new():uuid ",      
"UUIDgenerateUuid;",    "Generate a new uuid"   ]
 [ "uuid",      "new",  "unsafe command uuid.new(d:int):uuid ", 
"UUIDgenerateUuidInt;", "Generate a new uuid (dummy version for side effect 
free multiplex loop)"       ]
@@ -12218,6 +12219,7 @@ Ready.
 [ "xml",       "document",     "command xml.document(val:str):xml ",   
"XMLdocument;", "Check the value for compliance as XML document"        ]
 [ "xml",       "element",      "command xml.element(name:str, ns:xml, 
attr:xml, s:xml):xml ",  "XMLelement;",  "The basic building block for XML 
elements are namespaces, attributes and a sequence of xml elements. The name 
space and the attributes may be left unspecified(=nil:bat)."     ]
 [ "xml",       "element",      "command xml.element(name:str, s:xml):xml ",    
"XMLelementSmall;",     "The basic building block for XML elements are 
namespaces, attributes and a sequence of xml elements. The name space and the 
attributes may be left unspecified(=nil:bat)."     ]
+[ "xml",       "epilogue",     "command xml.epilogue():void ", "XMLepilogue;", 
"release the resources held by the xml module"  ]
 [ "xml",       "forest",       "pattern xml.forest(val:xml...):xml ",  
"XMLforest;",   "Construct an element list"     ]
 [ "xml",       "isdocument",   "command xml.isdocument(val:str):bit ", 
"XMLisdocument;",       "Validate the string as a document"     ]
 [ "xml",       "parse",        "command xml.parse(doccont:str, val:str, 
option:str):xml ",     "XMLparse;",    "Parse the XML document or element 
string values "      ]
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -16475,6 +16475,7 @@ Ready.
 [ "uuid",      "#read",        "command uuid.#read():void ",   "UUIDread;",    
""      ]
 [ "uuid",      "#tostr",       "command uuid.#tostr():void ",  
"UUIDtoString;",        ""      ]
 [ "uuid",      "#write",       "command uuid.#write():void ",  "UUIDwrite;",   
""      ]
+[ "uuid",      "epilogue",     "command uuid.epilogue():void ",        
"UUIDepilogue;",        "release the resources held by the uuid module" ]
 [ "uuid",      "isaUUID",      "command uuid.isaUUID(u:str):bit ",     
"UUIDisaUUID;", "Test a string for a UUID format"       ]
 [ "uuid",      "new",  "unsafe command uuid.new():uuid ",      
"UUIDgenerateUuid;",    "Generate a new uuid"   ]
 [ "uuid",      "new",  "unsafe command uuid.new(d:int):uuid ", 
"UUIDgenerateUuidInt;", "Generate a new uuid (dummy version for side effect 
free multiplex loop)"       ]
@@ -16646,6 +16647,7 @@ Ready.
 [ "xml",       "document",     "command xml.document(val:str):xml ",   
"XMLdocument;", "Check the value for compliance as XML document"        ]
 [ "xml",       "element",      "command xml.element(name:str, ns:xml, 
attr:xml, s:xml):xml ",  "XMLelement;",  "The basic building block for XML 
elements are namespaces, attributes and a sequence of xml elements. The name 
space and the attributes may be left unspecified(=nil:bat)."     ]
 [ "xml",       "element",      "command xml.element(name:str, s:xml):xml ",    
"XMLelementSmall;",     "The basic building block for XML elements are 
namespaces, attributes and a sequence of xml elements. The name space and the 
attributes may be left unspecified(=nil:bat)."     ]
+[ "xml",       "epilogue",     "command xml.epilogue():void ", "XMLepilogue;", 
"release the resources held by the xml module"  ]
 [ "xml",       "forest",       "pattern xml.forest(val:xml...):xml ",  
"XMLforest;",   "Construct an element list"     ]
 [ "xml",       "isdocument",   "command xml.isdocument(val:str):bit ", 
"XMLisdocument;",       "Validate the string as a document"     ]
 [ "xml",       "parse",        "command xml.parse(doccont:str, val:str, 
option:str):xml ",     "XMLparse;",    "Parse the XML document or element 
string values "      ]
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -1946,6 +1946,7 @@ str URLnew4(url *u, str *protocol, str *
 str URLnoop(url *u, url *val);
 ssize_t URLtoString(str *s, size_t *len, const char *src, bool external);
 int UUIDcompare(const uuid *l, const uuid *r);
+str UUIDepilogue(void *ret);
 str UUIDequal(bit *retval, uuid **l, uuid **r);
 ssize_t UUIDfromString(const char *svalue, size_t *len, uuid **retval, bool 
external);
 str UUIDgenerateUuid(uuid **retval);
@@ -1992,6 +1993,7 @@ str XMLcontent(xml *x, str *s);
 str XMLdocument(xml *x, str *s);
 str XMLelement(xml *ret, str *name, xml *nspace, xml *attr, xml *val);
 str XMLelementSmall(xml *ret, str *name, xml *val);
+str XMLepilogue(void *ret);
 str XMLforest(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
 ssize_t XMLfromString(const char *src, size_t *len, xml *x, bool external);
 str XMLisdocument(bit *x, str *s);
@@ -2427,6 +2429,7 @@ void moveInstruction(MalBlkPtr mb, int p
 void msab_dbfarminit(const char *dbfarm);
 void msab_dbpathinit(const char *dbpath);
 char *msab_deserialise(sabdb **ret, char *sabdb);
+void msab_exit(void);
 char *msab_freeStatus(sabdb **ret);
 char *msab_getDBfarm(char **ret);
 char *msab_getDBname(char **ret);
diff --git a/common/utils/msabaoth.c b/common/utils/msabaoth.c
--- a/common/utils/msabaoth.c
+++ b/common/utils/msabaoth.c
@@ -119,6 +119,23 @@ msab_isuuid(const char *restrict s)
        return hyphens == 4;
 }
 
+void
+msab_exit(void)
+{
+       if (_sabaoth_internal_dbfarm != NULL) {
+               free(_sabaoth_internal_dbfarm);
+               _sabaoth_internal_dbfarm = NULL;
+       }
+       if (_sabaoth_internal_dbname != NULL) {
+               free(_sabaoth_internal_dbname);
+               _sabaoth_internal_dbname = NULL;
+       }
+       if (_sabaoth_internal_uuid != NULL) {
+               free(_sabaoth_internal_uuid);
+               _sabaoth_internal_uuid = NULL;
+       }
+}
+
 /**
  * Initialises this Sabaoth instance to use the given dbfarm and dbname.
  * dbname may be NULL to indicate that there is no active database.  The
diff --git a/common/utils/msabaoth.h b/common/utils/msabaoth.h
--- a/common/utils/msabaoth.h
+++ b/common/utils/msabaoth.h
@@ -78,5 +78,6 @@ msab_export char *msab_freeStatus(sabdb*
 msab_export char *msab_getUplogInfo(sabuplog *ret, const sabdb *db);
 msab_export char *msab_serialise(char **ret, const sabdb *db);
 msab_export char *msab_deserialise(sabdb **ret, char *sabdb);
+msab_export void msab_exit(void);
 
 #endif
diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -524,11 +524,14 @@ mergejoin_void(BAT **r1p, BAT **r2p, BAT
                                r1 = mg;
                                if (r1 == NULL)
                                        return GDK_FAIL;
+                       } else {
+                               BBPunfix(r2->batCacheid);
                        }
+                       r2 = NULL;
                }
                *r1p = r1;
                if (r2p == NULL)
-                       return GDK_SUCCEED;
+                       goto doreturn2;
                if (BATtdense(r1) && BATtdense(l)) {
                        r2 = BATdense(0, l->tseqbase + r1->tseqbase - 
l->hseqbase + r->hseqbase - r->tseqbase, BATcount(r1));
                        if (r2 == NULL) {
diff --git a/gdk/gdk_orderidx.c b/gdk/gdk_orderidx.c
--- a/gdk/gdk_orderidx.c
+++ b/gdk/gdk_orderidx.c
@@ -77,11 +77,11 @@ BATcheckorderidx(BAT *b)
 
        if (b == NULL)
                return false;
+       ACCELDEBUG t = GDKusec();
        assert(b->batCacheid > 0);
        /* we don't need the lock just to read the value b->torderidx */
        if (b->torderidx == (Heap *) 1) {
                /* but when we want to change it, we need the lock */
-               ACCELDEBUG t = GDKusec();
                MT_lock_set(&GDKhashLock(b->batCacheid));
                if (b->torderidx == (Heap *) 1) {
                        Heap *hp;
diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c
--- a/monetdb5/mal/mal.c
+++ b/monetdb5/mal/mal.c
@@ -140,6 +140,7 @@ void mserver_reset(int exit)
        memset((char*)monet_characteristics,0, sizeof(monet_characteristics));
        mal_trace = 0;
        mal_namespace_reset();
+       msab_exit();
        /* No need to clean up the namespace, it will simply be extended
         * upon restart mal_namespace_reset(); */
        GDKreset(0, exit);      // terminate all other threads
diff --git a/monetdb5/modules/atoms/uuid.c b/monetdb5/modules/atoms/uuid.c
--- a/monetdb5/modules/atoms/uuid.c
+++ b/monetdb5/modules/atoms/uuid.c
@@ -51,6 +51,7 @@ typedef union {
 } uuid;
 
 mal_export str UUIDprelude(void *ret);
+mal_export str UUIDepilogue(void *ret);
 mal_export int UUIDcompare(const uuid *l, const uuid *r);
 mal_export ssize_t UUIDfromString(const char *svalue, size_t *len, uuid 
**retval, bool external);
 mal_export BUN UUIDhash(const void *u);
@@ -67,7 +68,7 @@ mal_export str UUIDisaUUID(bit *retval, 
 mal_export str UUIDequal(bit *retval, uuid **l, uuid **r);
 
 static uuid uuid_nil;                  /* automatically initialized as zeros */
-static uuid *uuid_session;             /* automatically set during system 
restart */
+static uuid *uuid_session = NULL;      /* automatically set during system 
restart */
 
 str
 UUIDprelude(void *ret)
@@ -75,6 +76,8 @@ UUIDprelude(void *ret)
        size_t len = 0;
        str msg;
 
+       if (uuid_session)
+               return MAL_SUCCEED;
        (void) ret;
        assert(UUID_SIZE == 16);
        (void) malAtomSize(sizeof(uuid), "uuid");
@@ -90,6 +93,17 @@ UUIDprelude(void *ret)
        return MAL_SUCCEED;
 }
 
+str
+UUIDepilogue(void *ret)
+{
+       (void) ret;
+       if (uuid_session) {
+               GDKfree(uuid_session);
+               uuid_session = NULL;
+       }
+       return MAL_SUCCEED;
+}
+
 #define is_uuid_nil(x) (memcmp((x)->u, uuid_nil.u, UUID_SIZE) == 0)
 
 /**
diff --git a/monetdb5/modules/atoms/uuid.mal b/monetdb5/modules/atoms/uuid.mal
--- a/monetdb5/modules/atoms/uuid.mal
+++ b/monetdb5/modules/atoms/uuid.mal
@@ -13,6 +13,10 @@ command write() address UUIDwrite;
 command prelude():void address UUIDprelude;
 uuid.prelude();
 
+command epilogue():void
+address UUIDepilogue
+comment "release the resources held by the uuid module";
+
 # unsafe is to prevent optimizers to reuse common expressions
 unsafe command new() :uuid
 address UUIDgenerateUuid
diff --git a/monetdb5/modules/atoms/xml.c b/monetdb5/modules/atoms/xml.c
--- a/monetdb5/modules/atoms/xml.c
+++ b/monetdb5/modules/atoms/xml.c
@@ -633,6 +633,14 @@ XMLprelude(void *ret)
        return MAL_SUCCEED;
 }
 
+str
+XMLepilogue(void *ret)
+{
+       (void) ret;
+       xmlCleanupParser();
+       return MAL_SUCCEED;
+}
+
 ssize_t
 XMLfromString(const char *src, size_t *len, xml *x, bool external)
 {
diff --git a/monetdb5/modules/atoms/xml.h b/monetdb5/modules/atoms/xml.h
--- a/monetdb5/modules/atoms/xml.h
+++ b/monetdb5/modules/atoms/xml.h
@@ -48,5 +48,6 @@ mal_export size_t XMLquotestring(const c
 mal_export size_t XMLunquotestring(const char **p, char q, char *buf);
 
 mal_export str XMLprelude(void *ret);
+mal_export str XMLepilogue(void *ret);
 
 #endif /* XML_H */
diff --git a/monetdb5/modules/atoms/xml.mal b/monetdb5/modules/atoms/xml.mal
--- a/monetdb5/modules/atoms/xml.mal
+++ b/monetdb5/modules/atoms/xml.mal
@@ -79,6 +79,10 @@ address XMLprelude;
 
 xml.prelude();
 
+command epilogue():void
+address XMLepilogue
+comment "release the resources held by the xml module";
+
 module calc;
 command xml(src:str):xml address XMLstr2xml;
 command xml(src:xml):xml address XMLxml2xml;
diff --git a/sql/server/sql_scan.c b/sql/server/sql_scan.c
--- a/sql/server/sql_scan.c
+++ b/sql/server/sql_scan.c
@@ -709,12 +709,14 @@ scanner_string(mvc *c, int quote, bool e
        while (cur != EOF) {
                unsigned int pos = (int)rs->pos + lc->yycur;
 
-               while ((((cur = rs->buf[pos++]) & 0x80) == 0) && cur && (cur != 
quote || escape)) {
+               while (cur != EOF && (((cur = rs->buf[pos++]) & 0x80) == 0) && 
cur && (cur != quote || escape)) {
                        if (escapes && cur == '\\')
                                escape = !escape;
                        else
                                escape = false;
                }
+               if (cur == EOF)
+                       break;
                lc->yycur = pos - (int)rs->pos;
                /* check for quote escaped quote: Obscure SQL Rule */
                /* TODO also handle double "" */
diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -1770,18 +1770,17 @@ destroy_delta(sql_delta *b)
 }
 
 static int
-destroy_bat(sql_trans *tr, sql_delta *b)
+destroy_bat(sql_delta *b)
 {
        sql_delta *n;
 
-       (void)tr;
        if (!b)
                return LOG_OK;
        n = b->next;
        destroy_delta(b);
        _DELETE(b);
        if (n)
-               return destroy_bat(tr, n);
+               return destroy_bat(n);
        return LOG_OK;
 }
 
@@ -1790,9 +1789,10 @@ destroy_col(sql_trans *tr, sql_column *c
 {
        int ok = LOG_OK;
        
+       (void)tr;
        if (c->data && c->base.allocated) {
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to