Changeset: 3347fe723f28 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3347fe723f28
Modified Files:
monetdb5/modules/mal/xid.c
Branch: xid
Log Message:
Protect against concurrent write errors
diffs (84 lines):
diff --git a/monetdb5/modules/mal/xid.c b/monetdb5/modules/mal/xid.c
--- a/monetdb5/modules/mal/xid.c
+++ b/monetdb5/modules/mal/xid.c
@@ -300,15 +300,19 @@ XIDcompressCol( Client cntxt, MalBlkPtr
return msg;
if (i == BUN_NONE) {
/* compressed size > MAX_COMPRESSED_SIZE => abandon */
+ mal_set_lock(mal_profileLock, "compress");
mnstr_printf(cntxt->fdout,"#xid, pc %d var %d, %s
compress, " BUNFMT ", > " STR(MAX_COMPRESSED_SIZE) " => abandoned clk " LLFMT
" usec\n",
getPC(mb,pci), getArg(pci,0), s, cnt,
GDKusec()-clk);
+ mal_unset_lock(mal_profileLock, "compress");
return MAL_SUCCEED;
}
col[XID_IDX_ORIG].count = (xid)cnt; /* keep original size */
col[XID_IDX_COMP].count = (xid)(i+1); /* keep compression size
*/
col[XID_IDX_SHIF].count = (xid)min; /* keep oid range shift */
+ mal_set_lock(mal_profileLock, "columndump");
mnstr_printf(cntxt->fdout,"#xid, %d, %s compress, " BUNFMT ","
BUNFMT ", %4.2f %% clk " LLFMT " sec "LLFMT " usec\n",
getArg(pci,0), s, cnt, i, i/(cnt/100.0),
GDKusec()/1000000, GDKusec()-clk);
+ mal_unset_lock(mal_profileLock, "columndump");
cn->heap.xidcompressed = 1;
}
@@ -414,7 +418,9 @@ XIDcompress(Client cntxt, MalBlkPtr mb,
tt = b->ttype;
if ( isVIEWCOMBINE(b) || cnt < MIN_INPUT_COUNT || (ht == TYPE_void &&
tt != TYPE_oid) || (ht != TYPE_oid && tt == TYPE_void) ) {
/* no need to compress */
+ mal_set_lock(mal_profileLock, "compress");
mnstr_printf(cntxt->fdout,"#xid view (count = "BUNFMT")
variable %d\n",cnt, getArg(pci,1));
+ mal_unset_lock(mal_profileLock, "compress");
BBPkeepref(*ret = b->batCacheid);
return MAL_SUCCEED;
}
@@ -434,13 +440,17 @@ XIDcompress(Client cntxt, MalBlkPtr mb,
skip_t = (ATOMtype(tt) != TYPE_oid || (ttx == TYPE_oid && tmax >
XID_CNT_MAX));
if ((skip_h || ht == TYPE_void) && (skip_t || tt == TYPE_void)) {
/* cannot (yet?) compress */
+ mal_set_lock(mal_profileLock, "compress");
mnstr_printf(cntxt->fdout,"#xid NIL or too large OID " OIDFMT
":" OIDFMT", variable %d\n", hmax, tmax, getArg(pci,1));
+ mal_unset_lock(mal_profileLock, "compress");
BBPkeepref(*ret = b->batCacheid);
return MAL_SUCCEED;
}
if ( (!skip_h && htx == TYPE_oid && VIEWhparent(b)) || (!skip_t && ttx
== TYPE_oid && VIEWtparent(b)) ) {
/* no need to compress */
+ mal_set_lock(mal_profileLock, "compress");
mnstr_printf(cntxt->fdout,"#xid view (count = "BUNFMT")
variable %d\n",cnt, getArg(pci,1));
+ mal_unset_lock(mal_profileLock, "compress");
BBPkeepref(*ret = b->batCacheid);
return MAL_SUCCEED;
}
@@ -603,8 +613,10 @@ XIDdecompressCol( Client cntxt, MalBlkPt
msg = XIDdecode(&cnt,col,o,lim,cap,min);
if (msg != MAL_SUCCEED)
return msg;
+ mal_set_lock(mal_profileLock, "decompress");
mnstr_printf(cntxt->fdout,"#xid, pc %d var %d, %s decompress, "
BUNFMT ", " BUNFMT ", clk " LLFMT " sec " LLFMT " usec\n",
getPC(mb,pci), getArg(pci,1), s, lim, cnt,
GDKusec()/1000000, GDKusec()-clk);
+ mal_unset_lock(mal_profileLock, "decompress");
if (cnt != cap)
throw(MAL, "xid.decompress", "decompressed %s count
does not match original count: "BUNFMT" != "BUNFMT"", s, cnt, cap);
@@ -754,8 +766,10 @@ XIDdump(void *ret, bat *bid)
col = (XIDcolumn) b->T->heap.base;
lim = (BUN) col[XID_IDX_COMP].count;
+ mal_set_lock(mal_profileLock, "columndump");
mnstr_printf(GDKout,"column first "BUNFMT", size "BUNFMT", \n",
lim, BATcount(b));
msg = XIDcolumndump(GDKout,col,lim);
+ mal_unset_lock(mal_profileLock, "columndump");
if (msg != MAL_SUCCEED) {
BBPreleaseref(*bid);
return msg;
@@ -765,8 +779,10 @@ XIDdump(void *ret, bat *bid)
col = (XIDcolumn) b->H->heap.base;
lim = (BUN) col[XID_IDX_COMP].count;
+ mal_set_lock(mal_profileLock, "columndump");
mnstr_printf(GDKout,"column first "BUNFMT", size "BUNFMT", \n",
lim, BATcount(b));
msg = XIDcolumndump(GDKout,col,lim);
+ mal_unset_lock(mal_profileLock, "columndump");
if (msg != MAL_SUCCEED) {
BBPreleaseref(*bid);
return msg;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list