Update of /cvsroot/monetdb/sql/src/storage/bat
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26843/src/storage/bat
Modified Files:
bat_storage.mx bat_table.mx bat_utils.mx
Log Message:
redid most of the bpm storage layer as it needed to be split in snapshot, log
and rollforward
U bat_table.mx
Index: bat_table.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/storage/bat/bat_table.mx,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- bat_table.mx 15 Jan 2008 10:40:25 -0000 1.33
+++ bat_table.mx 22 Aug 2008 09:50:30 -0000 1.34
@@ -41,21 +41,23 @@
#define BAT_TABLE_H
#include "sql_storage.h"
+#include "bat/bat_storage.h"
+#include "bat/bat_utils.h"
/* initialize bat storage call back functions interface */
extern int bat_table_init( table_functions *tf );
+extern BAT* delta_full_bat( sql_delta *bat, int temp, BAT *d, BAT *s);
+
#endif /*BAT_TABLE_H*/
@c
#include "sql_config.h"
#include "bat_table.h"
#include "bat_utils.h"
-#include "bat_storage.h"
-static BAT *
-full_column(sql_column *c, BAT *d, BAT *s )
+BAT *
+delta_full_bat( sql_delta *bat, int temp, BAT *d, BAT *s)
{
- sql_delta *bat = c->data;
/* return full normalized column bat
if (s) {
@@ -70,7 +72,7 @@
*/
BAT *r, *b, *u, *i = temp_descriptor(bat->ibid);
r = i;
- if (isTemp(c)) {
+ if (temp) {
if (s) {
r = BATsemijoin(i,s);
bat_destroy(i);
@@ -103,6 +105,12 @@
return b;
}
+static BAT *
+full_column(sql_column *c, BAT *d, BAT *s )
+{
+ return delta_full_bat(c->data, isTemp(c), d, s);
+}
+
static ssize_t
column_find_row(sql_trans *tr, sql_column *c, void *value, ...)
{
@@ -199,7 +207,6 @@
store_funcs.append_col(tr, c, val, c->type.type->localtype);
cnt++;
}
- t->cnt ++;
if (n) {
fprintf(stderr, "called table_insert(%s) with wrong number of
args (%d,%d)\n", t->base.name, list_length(t->columns.set), cnt);
assert(0);
U bat_storage.mx
Index: bat_storage.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/storage/bat/bat_storage.mx,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- bat_storage.mx 28 Jul 2008 13:25:17 -0000 1.21
+++ bat_storage.mx 22 Aug 2008 09:50:30 -0000 1.22
@@ -30,21 +30,50 @@
oid ibase; /* ibase: first id of inserts */
int ibid; /* bat with inserts */
int ubid; /* bat with updates */
+ size_t cnt; /* number of tuples (excluding the deletes) */
} sql_delta;
typedef struct sql_dbat {
char *dname; /* name of the persistent deletes bat */
int dbid; /* bat with deletes */
+ size_t cnt;
[...1141 lines suppressed...]
+
sf->create_col = (create_col_fptr)&create_col;
sf->create_idx = (create_idx_fptr)&create_idx;
sf->create_del = (create_del_fptr)&create_del;
@@ -1340,15 +1391,6 @@
sf->update_table = (update_table_fptr)&update_table;
sf->log_table = (update_table_fptr)&log_table;
sf->snapshot_table = (update_table_fptr)&snapshot_table;
- for (t=1; t<GDKatomcnt; t++) {
- if (BATatoms[t].name[0]) {
- eubats[t] = BATnew(TYPE_oid, t, 0);
- ebats[t] = BATnew(TYPE_void, t, 0);
- BATseqbase(ebats[t],0);
- bat_set_access(eubats[t], BAT_READ);
- bat_set_access(ebats[t], BAT_READ);
- }
- }
return LOG_OK;
}
U bat_utils.mx
Index: bat_utils.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/storage/bat/bat_utils.mx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- bat_utils.mx 11 Jun 2008 21:38:19 -0000 1.5
+++ bat_utils.mx 22 Aug 2008 09:50:30 -0000 1.6
@@ -42,6 +42,19 @@
extern void leaks(void);
+extern BAT *ebats[MAXATOMS];
+extern BAT *eubats[MAXATOMS];
+
+#define isEbat(b) (ebats[b->ttype] && ebats[b->ttype] == b)
+#define isEUbat(b) (eubats[b->ttype] && eubats[b->ttype] == b)
+
+extern log_bid ebat2real(log_bid b, oid ibase);
+extern log_bid e_bat(int type);
+extern log_bid e_ubat(int type);
+extern log_bid ebat_copy(log_bid b, oid ibase, int temp);
+extern log_bid eubat_copy(log_bid b, int temp);
+extern void bat_utils_init(void);
+
#endif /* BAT_UTILS_H */
@c
#include "sql_config.h"
@@ -192,3 +205,107 @@
}
return nr;
}
+
+BAT *ebats[MAXATOMS] = { NULL };
+BAT *eubats[MAXATOMS] = { NULL };
+
+log_bid
+ebat2real(log_bid b, oid ibase)
+{
+ /* make a copy of b */
+ BAT *o = temp_descriptor(b);
+ BAT *c = BATcopy(o, TYPE_void, ATOMtype(o->ttype), TRUE);
+ log_bid r;
+
+ BATseqbase(c, ibase );
+ c->batDirty |= 2;
+ r = temp_create(c);
+ bat_destroy(c);
+ bat_destroy(o);
+ return r;
+}
+
+log_bid
+e_bat(int type)
+{
+ if (!ebats[type])
+ ebats[type] = BATnew(TYPE_void, type, 0);
+ return temp_create(ebats[type]);
+}
+
+log_bid
+e_ubat(int type)
+{
+ if (!eubats[type])
+ eubats[type] = BATnew(TYPE_oid, type, 0);
+ return temp_create(eubats[type]);
+}
+
+
+log_bid
+ebat_copy(log_bid b, oid ibase, int temp)
+{
+ /* make a copy of b */
+ BAT *o = temp_descriptor(b);
+ BAT *c;
+ log_bid r;
+
+ if (!ebats[o->ttype])
+ ebats[o->ttype] = BATnew(TYPE_void, o->ttype, 0);
+
+ if (!temp && BATcount(o)) {
+ c = BATcopy(o, TYPE_void, o->ttype, TRUE);
+ BATseqbase(c, ibase );
+ c->batDirty |= 2;
+ BATcommit(c);
+ bat_set_access(c, BAT_READ);
+ r = temp_create(c);
+ bat_destroy(c);
+ } else {
+ c = ebats[o->ttype];
+ r = temp_create(c);
+ }
+ bat_destroy(o);
+ return r;
+}
+
+log_bid
+eubat_copy(log_bid b, int temp)
+{
+ /* make a copy of b */
+ BAT *o = temp_descriptor(b);
+ BAT *c;
+ log_bid r;
+
+ if (!eubats[o->ttype])
+ eubats[o->ttype] = BATnew(TYPE_oid, o->ttype, 0);
+
+ if (!temp && BATcount(o)) {
+ c = BATcopy(o, TYPE_oid, o->ttype, TRUE);
+ BATcommit(c);
+ r = temp_create(c);
+ bat_set_access(c, BAT_READ);
+ bat_destroy(c);
+ } else {
+ c = eubats[o->ttype];
+ r = temp_create(c);
+ }
+ bat_destroy(o);
+ return r;
+}
+
+void
+bat_utils_init(void)
+{
+ int t;
+
+ for (t=1; t<GDKatomcnt; t++) {
+ if (BATatoms[t].name[0]) {
+ eubats[t] = BATnew(TYPE_oid, t, 0);
+ ebats[t] = BATnew(TYPE_void, t, 0);
+ BATseqbase(ebats[t],0);
+ bat_set_access(eubats[t], BAT_READ);
+ bat_set_access(ebats[t], BAT_READ);
+ }
+ }
+}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins