Changeset: 265a611cc480 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=265a611cc480
Added Files:
        sql/test/wlcr/Tests/wlr01.stable.err
        sql/test/wlcr/Tests/wlr01.stable.out
        sql/test/wlcr/Tests/wlr20.stable.err
        sql/test/wlcr/Tests/wlr20.stable.out
        sql/test/wlcr/Tests/wlr30.stable.err
        sql/test/wlcr/Tests/wlr30.stable.out
Modified Files:
        monetdb5/modules/mal/wlcr.c
        sql/backends/monet5/sql_wlcr.c
Branch: wlcr
Log Message:

GDKfree and updates
- remove temporary allocated strings
- fix string comparison in configuration
- fix update code for replica


diffs (truncated from 476 to 300 lines):

diff --git a/monetdb5/modules/mal/wlcr.c b/monetdb5/modules/mal/wlcr.c
--- a/monetdb5/modules/mal/wlcr.c
+++ b/monetdb5/modules/mal/wlcr.c
@@ -271,8 +271,10 @@ WLCinit(Client cntxt)
                snprintf(path, PATHLENGTH,"%s%cwlc.config", pathname, DIR_SEP);
 
                fd = fopen(path,"r");
-               if( fd == NULL) // not in master mode
+               if( fd == NULL){        // not in master mode
+                       GDKfree(pathname);
                        return MAL_SUCCEED;
+               }
                fclose(fd);
                // we are in master mode
                wlcr_dbname = GDKgetenv("gdk_dbname");
@@ -350,8 +352,12 @@ WLCmaster(Client cntxt, MalBlkPtr mb, Ma
                wlcr_dbname = GDKgetenv("gdk_dbname");
                wlcr_logs = GDKfilepath(0,0,"master",0);
                snprintf(path, PATHLENGTH,"%s%c%s_wlcr", wlcr_logs, DIR_SEP, 
wlcr_dbname);
-               if( GDKcreatedir(path) == GDK_FAIL)
+               if( GDKcreatedir(path) == GDK_FAIL){
+                       wlcr_dbname = NULL;
+                       GDKfree(wlcr_logs);
+                       wlcr_logs = NULL;
                        throw(SQL,"wlcr.master","Could not create %s\n", 
wlcr_logs);
+               }
                WLCsetConfig();
        } else
                WLCgetConfig();
@@ -478,7 +484,7 @@ WLCgeneric(Client cntxt, MalBlkPtr mb, M
                p = pushStr(cntxt->wlcr, p, sch);\
                p = pushStr(cntxt->wlcr, p, tbl);\
                p = pushStr(cntxt->wlcr, p, col);\
-               p = pushOid(cntxt->wlcr, p, (ol? *ol++: o++));\
+               p = pushOid(cntxt->wlcr, p,  (ol? *ol++: o++));\
                p = push##TPE2(cntxt->wlcr, p ,*x);\
 } }
 
@@ -602,7 +608,7 @@ WLCupdate(Client cntxt, MalBlkPtr mb, Ma
        str sch,tbl,col;
        ValRecord cst;
        int tpe, varid;
-       oid o = 0, *ol;
+       oid o = 0, *ol = 0;
        
        sch = *getArgReference_str(stk,pci,1);
        tbl = *getArgReference_str(stk,pci,2);
@@ -615,8 +621,10 @@ WLCupdate(Client cntxt, MalBlkPtr mb, Ma
                assert(b);
                bval= BATdescriptor(stk->stk[getArg(pci,5)].val.bval);
                assert(bval);
-               o = b->hseqbase;
-               ol = (oid*) Tloc(b,0);
+               if( b->ttype == TYPE_void)
+                       o = b->tseqbase;
+               else
+                       ol = (oid*) Tloc(b,0);
                switch( ATOMstorage(bval->ttype)){
                case TYPE_bit: updateBatch(bit,Bit); break;
                case TYPE_bte: updateBatch(bte,Bte); break;
diff --git a/sql/backends/monet5/sql_wlcr.c b/sql/backends/monet5/sql_wlcr.c
--- a/sql/backends/monet5/sql_wlcr.c
+++ b/sql/backends/monet5/sql_wlcr.c
@@ -36,25 +36,29 @@ static int wlr_nextbatch;   // the next f
 static int wlr_tag;                    // the next transaction to be processed
 static int wlr_threshold = -1; // minimum time for a query to be re-executed
 
+#define MAXLINE 2048
+
 static
 str WLRgetConfig(void){
     char *path;
+       char line[MAXLINE];
     FILE *fd;
 
        path = GDKfilepath(0,0,"wlr.config",0);
     fd = fopen(path,"r");
+       GDKfree(path);
     if( fd == NULL)
-        throw(MAL,"wlr.getConfig","Could not access %s\n",path);
-    while( fgets(path, PATHLENGTH, fd) ){
-               path[strlen(path)-1]= 0;
-        if( strncmp("master=", path,7) == 0)
-            wlr_master = GDKstrdup(path + 7);
-        if( strncmp("logs=", path,5) == 0)
-            wlr_logs = GDKstrdup(path + 5);
-        if( strncmp("nextbatch=", path, 10) == 0)
-            wlr_nextbatch = atoi(path+ 10);
-        if( strncmp("tag=", path, 4) == 0)
-            wlr_tag = atoi(path+ 4);
+        throw(MAL,"wlr.getConfig","Could not access configuration file\n");
+    while( fgets(line, MAXLINE, fd) ){
+               line[strlen(line)-1]= 0;
+        if( strncmp("master=", line,7) == 0)
+            wlr_master = GDKstrdup(line + 7);
+        if( strncmp("logs=", line,5) == 0)
+            wlr_logs = GDKstrdup(line + 5);
+        if( strncmp("nextbatch=", line, 10) == 0)
+            wlr_nextbatch = atoi(line+ 10);
+        if( strncmp("tag=", line, 4) == 0)
+            wlr_tag = atoi(line+ 4);
     }
     fclose(fd);
     return MAL_SUCCEED;
@@ -67,8 +71,9 @@ str WLRsetConfig(void){
 
        path = GDKfilepath(0,0,"wlr.config",0);
     fd = fopen(path,"w");
+       GDKfree(path);
     if( fd == NULL)
-        throw(MAL,"wlr.setConfig","Could not access %s\n",path);
+        throw(MAL,"wlr.setConfig","Could not access configuration file\n");
        fprintf(fd,"master=%s\n", wlr_master);
        fprintf(fd,"logs=%s\n", wlr_logs);
        fprintf(fd,"nextbatch=%d\n", wlr_nextbatch);
@@ -105,7 +110,7 @@ WLRgetMaster(str dbname)
        fd = fopen(dir,"r");
        if( fd == NULL){
                GDKfree(dir);
-               throw(SQL,"getMaster","Database '%s' not acting as a 
master",dir);
+               throw(SQL,"getMaster","Database '%s' not acting as a 
master",dbname);
        }
        (void) fclose(fd);
 
@@ -113,8 +118,8 @@ WLRgetMaster(str dbname)
        snprintf(path,PATHLENGTH,"..%c%s%cmaster",DIR_SEP,dbname,DIR_SEP);
        dir = GDKfilepath(0,path,"wlc.config",0);
        fd = fopen(dir,"r");
+       GDKfree(dir);
        if( fd == NULL){
-               GDKfree(dir);
                GDKfree(wlr_logs);
                wlr_logs = 0;
                throw(SQL,"getMaster","missing configuration file");
@@ -128,7 +133,6 @@ WLRgetMaster(str dbname)
         if( strncmp("drift=", path, 6) == 0)
             wlcr_drift = atoi(path+ 6);
     }
-       GDKfree(dir);
        (void) fclose(fd);
        return MAL_SUCCEED;
 }
@@ -142,11 +146,11 @@ WLRinitReplica(str dbname)
        /* The replica mode can be set only once */
        dir = GDKfilepath(0,0,"wlr.config",0);
        fd = fopen(dir,"r");
+       GDKfree(dir);
        if( fd ){
                (void) fclose(fd);
                throw(SQL,"setreplica","Already in replica mode for 
'%s'",dbname);
        }
-       GDKfree(dir);
 
        msg = WLRgetMaster(dbname);
        if( msg)
@@ -605,11 +609,11 @@ WLRupdate(Client cntxt, MalBlkPtr mb, Ma
        BATmsync(tids);
        BATmsync(upd);
     if (cname[0] != '%' && (c = mvc_bind_column(m, t, cname)) != NULL) {
-        store_funcs.update_col(m->session->tr, c, tids, upd, tpe);
+        store_funcs.update_col(m->session->tr, c, tids, upd, TYPE_bat);
     } else if (cname[0] == '%') {
         sql_idx *i = mvc_bind_idx(m, s, cname + 1);
         if (i)
-            store_funcs.update_idx(m->session->tr, i, tids, upd, tpe);
+            store_funcs.update_idx(m->session->tr, i, tids, upd, TYPE_bat);
     }
        BBPunfix(((BAT *) tids)->batCacheid);
        BBPunfix(((BAT *) upd)->batCacheid);
diff --git a/sql/test/wlcr/Tests/wlr01.stable.err 
b/sql/test/wlcr/Tests/wlr01.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/wlcr/Tests/wlr01.stable.err
@@ -0,0 +1,46 @@
+stderr of test 'wlr01` in directory 'sql/test/wlcr` itself:
+
+
+# 22:16:34 >  
+# 22:16:34 >  "/usr/bin/python2" "wlr01.py" "wlr01"
+# 22:16:34 >  
+
+# builtin opt  gdk_dbpath = 
/export/scratch1/mk/wlcr//Linux/var/monetdb5/dbfarm/demo
+# builtin opt  gdk_debug = 0
+# builtin opt  gdk_vmtrim = no
+# builtin opt  monet_prompt = >
+# builtin opt  monet_daemon = no
+# builtin opt  mapi_port = 50000
+# builtin opt  mapi_open = false
+# builtin opt  mapi_autosense = false
+# builtin opt  sql_optimizer = default_pipe
+# builtin opt  sql_debug = 0
+# cmdline opt  gdk_nr_threads = 0
+# cmdline opt  mapi_open = true
+# cmdline opt  mapi_port = 36992
+# cmdline opt  mapi_usock = /var/tmp/mtest-32142/.s.monetdb.36992
+# cmdline opt  monet_prompt = 
+# cmdline opt  gdk_dbpath = 
/export/scratch1/mk/wlcr//Linux/var/MonetDB/mTests_sql_test_wlcr
+# cmdline opt  gdk_debug = 536870922
+# builtin opt  gdk_dbpath = 
/export/scratch1/mk/wlcr//Linux/var/monetdb5/dbfarm/demo
+# builtin opt  gdk_debug = 0
+# builtin opt  gdk_vmtrim = no
+# builtin opt  monet_prompt = >
+# builtin opt  monet_daemon = no
+# builtin opt  mapi_port = 50000
+# builtin opt  mapi_open = false
+# builtin opt  mapi_autosense = false
+# builtin opt  sql_optimizer = default_pipe
+# builtin opt  sql_debug = 0
+# cmdline opt  gdk_nr_threads = 0
+# cmdline opt  mapi_open = true
+# cmdline opt  monet_prompt = 
+# cmdline opt  mapi_port = 34919
+# cmdline opt  mapi_usock = /var/tmp/mtest-32142/.s.monetdb.34919
+# cmdline opt  gdk_dbpath = 
/export/scratch1/mk/wlcr//Linux/var/MonetDB/mTests_sql_test_wlcr-clone
+# cmdline opt  gdk_debug = 536870922
+
+# 22:16:35 >  
+# 22:16:35 >  "Done."
+# 22:16:35 >  
+
diff --git a/sql/test/wlcr/Tests/wlr01.stable.out 
b/sql/test/wlcr/Tests/wlr01.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/wlcr/Tests/wlr01.stable.out
@@ -0,0 +1,89 @@
+stdout of test 'wlr01` in directory 'sql/test/wlcr` itself:
+
+
+# 22:16:34 >  
+# 22:16:34 >  "/usr/bin/python2" "wlr01.py" "wlr01"
+# 22:16:34 >  
+
+Executing: Mtimeout -timeout 60 mserver5 --debug=10 --set gdk_nr_threads=0 
--set mapi_open=true --set mapi_port=36992 --set 
mapi_usock=/var/tmp/mtest-32142/.s.monetdb.36992 --set monet_prompt= 
--forcemito 
--dbpath=/export/scratch1/mk/wlcr//Linux/var/MonetDB/mTests_sql_test_wlcr
+Executing: Mtimeout -timeout 60 mserver5 --debug=10 --set gdk_nr_threads=0 
--set mapi_open=true --set monet_prompt= --forcemito --set mapi_port=34919 
--set mapi_usock=/var/tmp/mtest-32142/.s.monetdb.34919 
--dbpath=/export/scratch1/mk/wlcr//Linux/var/MonetDB/mTests_sql_test_wlcr-clone
+Executing: Mtimeout -timeout 60 mclient -lsql -ftest -Eutf-8 -i -e 
--host=/var/tmp/mtest-32142 --port=34919 --database=mTests_sql_test_wlcr-clone
+# MonetDB 5 server v11.26.0
+# This is an unreleased version
+# Serving database 'mTests_sql_test_wlcr', using 8 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 128bit integers
+# Found 15.589 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2017 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://vienna.da.cwi.nl:36992/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-32142/.s.monetdb.36992
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+# MonetDB 5 server v11.26.0
+# This is an unreleased version
+# Serving database 'mTests_sql_test_wlcr-clone', using 8 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 128bit integers
+# Found 15.589 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2017 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://vienna.da.cwi.nl:34919/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-32142/.s.monetdb.34919
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+# SQL catalog created, loading sql scripts once
+# loading sql script: 09_like.sql
+# loading sql script: 10_math.sql
+# loading sql script: 11_times.sql
+# loading sql script: 12_url.sql
+# loading sql script: 13_date.sql
+# loading sql script: 14_inet.sql
+# loading sql script: 15_querylog.sql
+# loading sql script: 16_tracelog.sql
+# loading sql script: 17_temporal.sql
+# loading sql script: 18_index.sql
+# loading sql script: 20_vacuum.sql
+# loading sql script: 21_dependency_functions.sql
+# loading sql script: 22_clients.sql
+# loading sql script: 23_skyserver.sql
+# loading sql script: 25_debug.sql
+# loading sql script: 26_sysmon.sql
+# loading sql script: 27_rejects.sql
+# loading sql script: 39_analytics.sql
+# loading sql script: 39_analytics_hge.sql
+# loading sql script: 40_geom.sql
+# loading sql script: 40_json.sql
+# loading sql script: 40_json_hge.sql
+# loading sql script: 41_md5sum.sql
+# loading sql script: 45_uuid.sql
+# loading sql script: 46_gsl.sql
+# loading sql script: 46_profiler.sql
+# loading sql script: 51_sys_schema_extension.sql
+# loading sql script: 60_wlcr.sql
+# loading sql script: 72_fits.sql
+# loading sql script: 74_netcdf.sql
+# loading sql script: 75_lidar.sql
+# loading sql script: 75_shp.sql
+# loading sql script: 75_storagemodel.sql
+# loading sql script: 80_statistics.sql
+# loading sql script: 80_udf.sql
+# loading sql script: 80_udf_hge.sql
+# loading sql script: 85_bam.sql
+# loading sql script: 90_generator.sql
+# loading sql script: 90_generator_hge.sql
+# loading sql script: 99_system.sql
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to