Update of /cvsroot/monetdb/sql/src/storage/restrict
In directory
sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv29007/src/storage/restrict
Modified Files:
restrict_storage.mx
Log Message:
propagated changes of Thursday Nov 19 2009 - Saturday Nov 28 2009
from the Nov2009 branch to the development trunk
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2009/11/19 - nielsnes: src/storage/restrict/restrict_storage.mx,1.18.2.1
fixed performance issue with loading (in readonly mode) complex schema's
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Index: restrict_storage.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/storage/restrict/restrict_storage.mx,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- restrict_storage.mx 12 Aug 2009 17:41:30 -0000 1.18
+++ restrict_storage.mx 28 Nov 2009 19:57:59 -0000 1.19
@@ -29,6 +29,7 @@
int bid;
int ubid; /* bat with old updated values (su only) */
size_t cnt; /* number of tuples (excluding the deletes) */
+ BAT *cached; /* cached copy, used for schema bats only */
} sql_bat;
#define bat_set_access(b,access) b->P->restricted = access
@@ -103,8 +104,13 @@
static void
update_bat( sql_bat *bat, BAT *upd, int isnew)
{
- BAT *b = temp_descriptor(bat->bid);
+ BAT *b;
+ if (bat->cached) {
+ bat_destroy(bat->cached);
+ bat->cached = NULL;
+ }
+ b = temp_descriptor(bat->bid);
if (!isnew) {
BAT *u = NULL;
BAT *old = BATkdiff(b, upd), *r;
@@ -131,6 +137,10 @@
BAT *b;
assert(rid != oid_nil);
+ if (bat->cached) {
+ bat_destroy(bat->cached);
+ bat->cached = NULL;
+ }
b = temp_descriptor(bat->bid);
if (!isnew) {
BAT *u = NULL;
@@ -192,6 +202,10 @@
{
BAT *b = temp_descriptor(bat->bid);
+ if (bat->cached) {
+ bat_destroy(bat->cached);
+ bat->cached = NULL;
+ }
bat->cnt += BATcount(i);
if (BATcount(b) == 0 && !isVIEW(i) && i->htype == TYPE_void && i->ttype
!= TYPE_void){
temp_destroy(bat->bid);
@@ -206,8 +220,13 @@
static void
append_val( sql_bat *bat, void *i )
{
- BAT *b = temp_descriptor(bat->bid);
+ BAT *b;
+ if (bat->cached) {
+ bat_destroy(bat->cached);
+ bat->cached = NULL;
+ }
+ b = temp_descriptor(bat->bid);
BUNappend(b, i, TRUE);
bat->cnt ++;
bat_destroy(b);
@@ -265,8 +284,32 @@
static void
delete_tab(sql_trans *tr, sql_table * t, void *ib, int tpe)
{
+ node *n;
sql_bat *bat = t->data;
+ /* delete all cached copies */
+ for (n = t->columns.set->h; n; n = n->next) {
+ sql_column *c = n->data;
+ sql_bat *bat = c->data;
+
+ if (bat->cached) {
+ bat_destroy(bat->cached);
+ bat->cached = NULL;
+ }
+ }
+ if (t->idxs.set) {
+ for (n = t->idxs.set->h; n; n = n->next) {
+ sql_idx *i = n->data;
+ sql_bat *bat = i->data;
+
+ if (bat->cached) {
+ bat_destroy(bat->cached);
+ bat->cached = NULL;
+ }
+ }
+ }
+
+
t->base.wtime = t->s->base.wtime = tr->wtime = tr->stime;
t->base.rtime = t->s->base.rtime = tr->rtime = tr->stime;
if (tpe == TYPE_bat)
@@ -609,8 +652,11 @@
temp_destroy(b->bid);
if (b->ubid)
temp_destroy(b->ubid);
+ if (b->cached)
+ temp_destroy(b->cached->batCacheid);
b->bid = b->ubid = 0;
b->name = NULL;
+ b->cached = NULL;
_DELETE(b);
return 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