Changeset: d22e2ace0160 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d22e2ace0160
Modified Files:
sql/src/backends/monet5/sql.mx
Branch: default
Log Message:
Vacuum defense against errors
Vacuum should be a two phase process to cope with possible
errors compressing the individual columns.
diffs (60 lines):
diff -r 40c199ec64ad -r d22e2ace0160 sql/src/backends/monet5/sql.mx
--- a/sql/src/backends/monet5/sql.mx Sun Dec 19 11:48:04 2010 +0100
+++ b/sql/src/backends/monet5/sql.mx Mon Dec 20 08:03:39 2010 +0100
@@ -5118,6 +5118,7 @@
bat bid;
BAT *b, *del;
node *o;
+ int i,bids[2049];
if (msg)
return msg;
@@ -5134,8 +5135,13 @@
/* get the deletions BAT*/
del = mvc_bind_dbat(m, *sch, *tbl, RD_INS);
- for (o = t->columns.set->h; o; o = o->next) {
- sql_delta *d;
+ /* this code is insecure, because something may
+ go wrong while we compress the columns.
+ A two-phase action reduces the risks, but not all.
+ e.g. a crash during update of the catalog. */
+ i=0;
+ bids[i]=0;
+ for (o = t->columns.set->h; o; o = o->next,i++) {
c = o->data;
b = store_funcs.bind_col(tr, c, 0);
if (b == NULL)
@@ -5143,14 +5149,29 @@
msg = b...@1bat(&bid, &(b->batCacheid), &(del->batCacheid));
BBPreleaseref(b->batCacheid);
if (msg){
- BBPreleaseref(bid);
+ for( i--; i>=0; i--)
+ BBPreleaseref(bids[i]);
return msg;
}
- BBPdecref(b->batCacheid, TRUE);
+ if ( i <2048){
+ bids[i++]= bid;
+ bids[i]=0;
+ }
+ }
+ if ( i == 2048 )
+ throw(MAL,"s...@1","Too many columns to handle, use copy
instead");
+ i=0;
+ for (o = t->columns.set->h; o; o = o->next, i++) {
+ sql_delta *d;
+ c = o->data;
+ b = store_funcs.bind_col(tr, c, 0);
+ /* based on previous loop, BAT should be accessible */
+ if (b )
+ BBPdecref(b->batCacheid, TRUE);
d = c->data;
d->bid = 0;
d->ibase = 0;
- d->ibid = bid; /* use the insert bat */
+ d->ibid = bids[i]; /* use the insert bat */
c->base.wtime = c->base.rtime = tr->stime;
}
BBPreleaseref(del->batCacheid);
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list