Update of /cvsroot/monetdb/sql/src/storage/bat
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv24178/src/storage/bat
Modified Files:
Tag: Aug2009
bat_storage.mx
Log Message:
fixed bug, ie handle 0.0 correctly as a decimal(1,0)
fixed bug, ie decimal(d,s) d < 19 and s < d (not d+s < 19)
make sure we flush all inserts to disk when we restart the log
U bat_storage.mx
Index: bat_storage.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/storage/bat/bat_storage.mx,v
retrieving revision 1.42
retrieving revision 1.42.2.1
diff -u -d -r1.42 -r1.42.2.1
--- bat_storage.mx 25 Jul 2009 22:08:38 -0000 1.42
+++ bat_storage.mx 4 Aug 2009 22:15:24 -0000 1.42.2.1
@@ -1088,6 +1088,88 @@
}
int
+gtr_update_delta( sql_trans *tr, sql_delta *cbat)
+{
+ int ok = LOG_OK;
+ BAT *ups, *ins, *cur;
+
+ (void)tr;
+ assert(store_nr_active==0);
+
+ cur = temp_descriptor(cbat->bid);
+ ins = temp_descriptor(cbat->ibid);
+ /* any inserts */
+ if (BUNlast(ins) > BUNfirst(ins)) {
+ if (BATcount(cur)+BATcount(ins) > (BUN) REMAP_PAGE_MAXSIZE) {
/* try to use mmap() */
+ BATmmap(cur, STORE_MMAP, STORE_MMAP,
STORE_MMAP, STORE_MMAP);
+ }
+ BATappend(cur,ins,TRUE);
+ temp_destroy(cbat->ibid);
+ cbat->ibid = e_bat(cur->ttype);
+ }
+ bat_destroy(ins);
+
+ ups = temp_descriptor(cbat->ubid);
+ /* any updates */
+ if (BUNlast(ups) > BUNfirst(ups)) {
+ void_replace_bat(cur, ups, TRUE);
+ temp_destroy(cbat->ubid);
+ cbat->ubid = e_ubat(cur->ttype);
+ }
+ bat_destroy(ups);
+ bat_destroy(cur);
+ return ok;
+}
+
+static int
+gtr_update_table(sql_trans *tr, sql_table *t)
+{
+ int ok = LOG_OK;
+ node *n;
+
+ for (n = t->columns.set->h; ok == LOG_OK && n; n = n->next) {
+ sql_column *c = n->data;
+
+ if (!c->base.wtime)
+ continue;
+ gtr_update_delta(tr, c->data);
+ }
+ if (ok == LOG_OK && t->idxs.set) {
+ for (n = t->idxs.set->h; ok == LOG_OK && n; n = n->next) {
+ sql_idx *ci = n->data;
+
+ /* some indices have no bats */
+ if (!ci->base.wtime)
+ continue;
+
+ gtr_update_delta(tr, ci->data);
+ }
+ }
+ return ok;
+}
+
+static int
+gtr_update( sql_trans *tr )
+{
+ node *sn;
+
+ for(sn = tr->schemas.set->h; sn; sn = sn->next) {
+ sql_schema *s = sn->data;
+
+ if (!isTempSchema(s) && s->tables.set) {
+ node *n;
+ for (n = s->tables.set->h; n; n = n->next) {
+ sql_table *t = n->data;
+
+ if (isGlobalTable(t))
+ gtr_update_table(tr, t);
+ }
+ }
+ }
+ return LOG_OK;
+}
+
+int
tr_update_delta( sql_trans *tr, sql_delta *obat, sql_delta *cbat, int cluster,
BUN snapshot_minsize)
{
int ok = LOG_OK;
@@ -1455,6 +1537,7 @@
sf->update_table = (update_table_fptr)&update_table;
sf->log_table = (update_table_fptr)&log_table;
sf->snapshot_table = (update_table_fptr)&snapshot_table;
+ sf->gtrans_update = (gtrans_update_fptr)>r_update;
return LOG_OK;
}
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins