Changeset: 4cd4bb9da20e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4cd4bb9da20e
Modified Files:
geom/monetdb5/geom.c
monetdb5/mal/mal_interpreter.c
monetdb5/mal/mal_linker.c
monetdb5/mal/mal_profiler.c
monetdb5/modules/mal/bbp.c
monetdb5/modules/mal/clients.c
monetdb5/modules/mal/cluster.c
monetdb5/modules/mal/mal_mapi.c
monetdb5/modules/mal/profiler.c
monetdb5/modules/mal/remote.c
monetdb5/modules/mal/sysmon.c
monetdb5/optimizer/opt_pushselect.c
sql/backends/monet5/sql_scenario.c
Branch: geo
Log Message:
Merge with default branch.
diffs (truncated from 697 to 300 lines):
diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -862,13 +862,13 @@ int mbrFROMSTR(char *src, int *len, mbr
if (!nil && strstr(src,"BOX") == src && (c = strstr(src,"(")) != NULL)
{
/* Parse the mbr */
if ((c - src) != 3 && (c - src) != 4) {
- GDKerror("ParseException: Expected a string like 'BOX(0
0,1 1)' or 'BOX (0 0,1 1)'");
+ GDKerror("ParseException: Expected a string like 'BOX(0
0,1 1)' or 'BOX (0 0,1 1)'\n");
return 0;
}
if (sscanf(c,"(%lf %lf,%lf %lf)", &xmin, &ymin, &xmax, &ymax)
!= 4) {
+ GDKerror("ParseException: Not enough coordinates.\n");
return 0;
- GDKerror("ParseException: Not enough coordinates.");
}
} else if (!nil && (geosMbr = GEOSGeomFromWKT(src)) == NULL)
return 0;
diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c
--- a/monetdb5/mal/mal_interpreter.c
+++ b/monetdb5/mal/mal_interpreter.c
@@ -808,7 +808,7 @@ str runMALsequence(Client cntxt, MalBlkP
backup[i].val.bval = 0;
BBPdecref(bx,
TRUE);
}
- if (i >= 0 &&
garbage[i] >= 0) {
+ if (garbage[i] >= 0) {
PARDEBUG
mnstr_printf(GDKstdout, "#GC pc=%d bid=%d %s done\n", stkpc, bid,
getVarName(mb, garbage[i]));
bid =
abs(stk->stk[garbage[i]].val.bval);
stk->stk[garbage[i]].val.bval = 0;
diff --git a/monetdb5/mal/mal_linker.c b/monetdb5/mal/mal_linker.c
--- a/monetdb5/mal/mal_linker.c
+++ b/monetdb5/mal/mal_linker.c
@@ -59,7 +59,7 @@ static int lastfile = 0;
MALfcn
getAddress(stream *out, str filename, str modnme, str fcnname, int silent)
{
- void *dl = 0;
+ void *dl;
MALfcn adr;
static int idx=0;
static int prev= -1;
@@ -94,22 +94,27 @@ getAddress(stream *out, str filename, st
/*
* Try the program libraries at large or run through all
* loaded files and try to resolve the functionname again.
- */
+ *
+ * the first argument must be the same as the base name of the
+ * library that is created in src/tools */
+ dl = mdlopen("libmonetdb5", RTLD_NOW | RTLD_GLOBAL);
if (dl == NULL) {
- /* the first argument must be the same as the base name of the
- * library that is created in src/tools */
- dl = mdlopen("libmonetdb5", RTLD_NOW | RTLD_GLOBAL);
+ /* shouldn't happen, really */
+ if (!silent)
+ showException(out, MAL, "MAL.getAddress",
+ "address of '%s.%s' not
found",
+ (modnme?modnme:"<unknown>"),
fcnname);
+ return NULL;
}
- if( dl != NULL){
- adr = (MALfcn) dlsym(dl, fcnname);
- if( adr != NULL)
- return adr; /* found it */
- }
+
+ adr = (MALfcn) dlsym(dl, fcnname);
+ dlclose(dl);
+ if( adr != NULL)
+ return adr; /* found it */
+
if (!silent)
showException(out, MAL,"MAL.getAddress", "address of '%s.%s'
not found",
(modnme?modnme:"<unknown>"), fcnname);
- if ( dl)
- dlclose(dl);
return NULL;
}
/*
diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -1302,8 +1302,7 @@ static int getCPULoad(char cpuload[BUFSI
if ((n = fread(buf, 1, BUFSIZ,proc)) == 0 )
return -1;
buf[n] = 0;
- for ( s= buf; *s; s++)
- {
+ for ( s= buf; *s; s++) {
if ( strncmp(s,"cpu",3)== 0){
s +=3;
if ( *s == ' ') {
@@ -1315,7 +1314,9 @@ static int getCPULoad(char cpuload[BUFSI
cpu = 255;
}
s= strchr(s,' ');
- if ( s== 0 || cpu < 0 || cpu > 255) goto skip;
+ if (s == NULL) /* unexpected format of file */
+ break;
+ if ( cpu < 0 || cpu > 255) goto skip;
while( *s && isspace((int)*s)) s++;
i= sscanf(s,LLFMT" "LLFMT" "LLFMT" "LLFMT" "LLFMT,
&user, &nice, &system, &idle, &iowait);
@@ -1330,7 +1331,9 @@ static int getCPULoad(char cpuload[BUFSI
corestat[cpu].idle = idle;
corestat[cpu].iowait = iowait;
}
- skip: if(s) while( *s && *s != '\n') s++;
+ skip:
+ while (*s && *s != '\n')
+ s++;
}
s= cpuload;
diff --git a/monetdb5/modules/mal/clients.c b/monetdb5/modules/mal/clients.c
--- a/monetdb5/modules/mal/clients.c
+++ b/monetdb5/modules/mal/clients.c
@@ -597,6 +597,7 @@ CLTsessions(Client cntxt, MalBlkPtr mb,
char usrname[256]= {"monetdb"};
timestamp ts, ret;
lng clk,timeout;
+ str msg;
(void) cntxt;
(void) mb;
@@ -614,6 +615,7 @@ CLTsessions(Client cntxt, MalBlkPtr mb,
active = BATnew(TYPE_void, TYPE_bit, 0, TRANSIENT);
BATseqbase(active,0);
if ( user == NULL || login == NULL || stimeout == NULL || qtimeout ==
NULL || active == NULL){
+ if ( user) BBPreleaseref(user->batCacheid);
if ( login) BBPreleaseref(login->batCacheid);
if ( stimeout) BBPreleaseref(stimeout->batCacheid);
if ( qtimeout) BBPreleaseref(qtimeout->batCacheid);
@@ -627,15 +629,23 @@ CLTsessions(Client cntxt, MalBlkPtr mb,
for (c = mal_clients + (GDKgetenv_isyes("monet_daemon")?1:0); c <
mal_clients + MAL_MAXCLIENTS; c++)
if (c->mode == RUNCLIENT) {
BUNappend(user, &usrname, FALSE);
- (void) MTIMEunix_epoch(&ts);
+ msg = MTIMEunix_epoch(&ts);
+ if (msg)
+ goto bailout;
clk = c->login * 1000;
- (void) MTIMEtimestamp_add(&ret,&ts, &clk);
+ msg = MTIMEtimestamp_add(&ret,&ts, &clk);
+ if (msg)
+ goto bailout;
BUNappend(login, &ret, FALSE);
timeout = c->stimeout / 1000000;
BUNappend(stimeout, &timeout, FALSE);
- (void) MTIMEunix_epoch(&ts);
+ msg = MTIMEunix_epoch(&ts);
+ if (msg)
+ goto bailout;
clk = c->lastcmd * 1000;
- (void) MTIMEtimestamp_add(&ret,&ts, &clk);
+ msg = MTIMEtimestamp_add(&ret,&ts, &clk);
+ if (msg)
+ goto bailout;
BUNappend(last, &ret, FALSE);
timeout = c->qtimeout / 1000000;
BUNappend(qtimeout, &timeout, FALSE);
@@ -649,4 +659,14 @@ CLTsessions(Client cntxt, MalBlkPtr mb,
BBPkeepref(*lastId = last->batCacheid);
BBPkeepref(*activeId = active->batCacheid);
return MAL_SUCCEED;
+
+ bailout:
+ MT_lock_unset(&mal_contextLock, "clients.sessions");
+ BBPreleaseref(user->batCacheid);
+ BBPreleaseref(login->batCacheid);
+ BBPreleaseref(stimeout->batCacheid);
+ BBPreleaseref(qtimeout->batCacheid);
+ BBPreleaseref(last->batCacheid);
+ BBPreleaseref(active->batCacheid);
+ return msg;
}
diff --git a/monetdb5/modules/mal/cluster.c b/monetdb5/modules/mal/cluster.c
--- a/monetdb5/modules/mal/cluster.c
+++ b/monetdb5/modules/mal/cluster.c
@@ -612,8 +612,8 @@ CLS_create_bte( bat *rpsum, bat *rcmap,
BBPunfix(*B);
BBPkeepref(*rpsum = psum->batCacheid);
BBPkeepref(*rcmap = cmap->batCacheid);
- (void) BATsetaccess(psum, BAT_READ);
- (void) BATsetaccess(cmap, BAT_READ);
+ BATsetaccess(psum, BAT_READ);
+ BATsetaccess(cmap, BAT_READ);
return MAL_SUCCEED;
}
@@ -697,8 +697,8 @@ CLS_create_sht( bat *rpsum, bat *rcmap,
BBPunfix(*B);
BBPkeepref(*rpsum = psum->batCacheid);
BBPkeepref(*rcmap = cmap->batCacheid);
- (void) BATsetaccess(psum, BAT_READ);
- (void) BATsetaccess(cmap, BAT_READ);
+ BATsetaccess(psum, BAT_READ);
+ BATsetaccess(cmap, BAT_READ);
return MAL_SUCCEED;
}
@@ -782,8 +782,8 @@ CLS_create_int( bat *rpsum, bat *rcmap,
BBPunfix(*B);
BBPkeepref(*rpsum = psum->batCacheid);
BBPkeepref(*rcmap = cmap->batCacheid);
- (void) BATsetaccess(psum, BAT_READ);
- (void) BATsetaccess(cmap, BAT_READ);
+ BATsetaccess(psum, BAT_READ);
+ BATsetaccess(cmap, BAT_READ);
return MAL_SUCCEED;
}
@@ -867,8 +867,8 @@ CLS_create_wrd( bat *rpsum, bat *rcmap,
BBPunfix(*B);
BBPkeepref(*rpsum = psum->batCacheid);
BBPkeepref(*rcmap = cmap->batCacheid);
- (void) BATsetaccess(psum, BAT_READ);
- (void) BATsetaccess(cmap, BAT_READ);
+ BATsetaccess(psum, BAT_READ);
+ BATsetaccess(cmap, BAT_READ);
return MAL_SUCCEED;
}
@@ -952,8 +952,8 @@ CLS_create_lng( bat *rpsum, bat *rcmap,
BBPunfix(*B);
BBPkeepref(*rpsum = psum->batCacheid);
BBPkeepref(*rcmap = cmap->batCacheid);
- (void) BATsetaccess(psum, BAT_READ);
- (void) BATsetaccess(cmap, BAT_READ);
+ BATsetaccess(psum, BAT_READ);
+ BATsetaccess(cmap, BAT_READ);
return MAL_SUCCEED;
}
@@ -1037,8 +1037,8 @@ CLS_create_dbl( bat *rpsum, bat *rcmap,
BBPunfix(*B);
BBPkeepref(*rpsum = psum->batCacheid);
BBPkeepref(*rcmap = cmap->batCacheid);
- (void) BATsetaccess(psum, BAT_READ);
- (void) BATsetaccess(cmap, BAT_READ);
+ BATsetaccess(psum, BAT_READ);
+ BATsetaccess(cmap, BAT_READ);
return MAL_SUCCEED;
}
str
@@ -1121,8 +1121,8 @@ CLS_create_flt( bat *rpsum, bat *rcmap,
BBPunfix(*B);
BBPkeepref(*rpsum = psum->batCacheid);
BBPkeepref(*rcmap = cmap->batCacheid);
- (void) BATsetaccess(psum, BAT_READ);
- (void) BATsetaccess(cmap, BAT_READ);
+ BATsetaccess(psum, BAT_READ);
+ BATsetaccess(cmap, BAT_READ);
return MAL_SUCCEED;
}
@@ -1242,8 +1242,8 @@ CLS_create2_bte( bat *rpsum, bat *rcmap,
BBPunfix(*B);
BBPkeepref(*rpsum = psum->batCacheid);
BBPkeepref(*rcmap = cmap->batCacheid);
- (void) BATsetaccess(psum, BAT_READ);
- (void) BATsetaccess(cmap, BAT_READ);
+ BATsetaccess(psum, BAT_READ);
+ BATsetaccess(cmap, BAT_READ);
return MAL_SUCCEED;
}
@@ -1363,8 +1363,8 @@ CLS_create2_sht( bat *rpsum, bat *rcmap,
BBPunfix(*B);
BBPkeepref(*rpsum = psum->batCacheid);
BBPkeepref(*rcmap = cmap->batCacheid);
- psum = BATsetaccess(psum, BAT_READ);
- cmap = BATsetaccess(cmap, BAT_READ);
+ BATsetaccess(psum, BAT_READ);
+ BATsetaccess(cmap, BAT_READ);
return MAL_SUCCEED;
}
@@ -1484,8 +1484,8 @@ CLS_create2_int( bat *rpsum, bat *rcmap,
BBPunfix(*B);
BBPkeepref(*rpsum = psum->batCacheid);
BBPkeepref(*rcmap = cmap->batCacheid);
- (void) BATsetaccess(psum, BAT_READ);
- (void) BATsetaccess(cmap, BAT_READ);
+ BATsetaccess(psum, BAT_READ);
+ BATsetaccess(cmap, BAT_READ);
return MAL_SUCCEED;
}
@@ -1605,8 +1605,8 @@ CLS_create2_wrd( bat *rpsum, bat *rcmap,
BBPunfix(*B);
BBPkeepref(*rpsum = psum->batCacheid);
BBPkeepref(*rcmap = cmap->batCacheid);
- (void) BATsetaccess(psum, BAT_READ);
- (void) BATsetaccess(cmap, BAT_READ);
+ BATsetaccess(psum, BAT_READ);
+ BATsetaccess(cmap, BAT_READ);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list