Changeset: d602c8268b62 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d602c8268b62
Modified Files:
sql/storage/bat/bat_storage.c
sql/storage/bat/bat_storage.h
Branch: newstorage
Log Message:
cleanup
diffs (223 lines):
diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -395,8 +395,7 @@ dup_delta(sql_trans *tr, sql_delta *obat
}
}
- //if(bat->bid)
- temp_dup(bat->bid);
+ temp_dup(bat->bid);
return LOG_OK;
}
@@ -462,55 +461,6 @@ update_idx(sql_trans *tr, sql_idx * i, v
else
assert(0);
}
-/**
-static void
-delta_append_bat( sql_delta *bat, BAT *i )
-{
- int id = i->batCacheid;
- BAT *b;
-#ifndef NDEBUG
- BAT *c = BBPquickdesc(bat->bid, 0);
- assert(!c || c->htype == TYPE_void);
-#endif
-
- if (bat_debug==2)
- printf("#in delta_append_bat\n");
-
- if (!BATcount(i))
- return ;
- b = temp_descriptor(bat->ibid);
- assert(b->htype == TYPE_void);
-
- if (bat->cached) {
- bat_destroy(bat->cached);
- bat->cached = NULL;
- }
- assert(!c || BATcount(c) == bat->ibase);
- if (!bat->ibase && !BATcount(b) && BBP_refs(id) == 1 && BBP_lrefs(id)
== 1 && !isVIEW(i) && i->ttype*/ /* we need info if this is comming from copy
into, like role == PERSISTENT *//*){
- temp_destroy(bat->ibid);
- bat->ibid = id;
- temp_dup(id);
- bat_destroy(b);
- } else {
- if (!isEbat(b)){
- *//* try to use mmap() *//*
- if (BATcount(b)+BATcount(i) > (BUN) REMAP_PAGE_MAXSIZE)
{
- BATmmap(b, STORE_MMAP, STORE_MMAP,
STORE_MMAP, STORE_MMAP, 1);
- }
- assert(b->T->heap.storage != STORE_PRIV);
- } else {
- temp_destroy(bat->ibid);
- bat->ibid = ebat2real(b->batCacheid, bat->ibase);
- bat_destroy(b);
- b = temp_descriptor(bat->ibid);
- }
- BATappend(b, i, TRUE);
- assert(BUNlast(b) > b->batInserted);
- bat_destroy(b);
- }
- bat->cnt += BATcount(i);
-}
-*/
static void
insert_val2col(sql_delta *col, void *i) {
@@ -523,7 +473,6 @@ insert_val2col(sql_delta *col, void *i)
col->cached = NULL;
}
- //assert(!c || BATcount(c) == col->ibase);
assert(c->T->heap.storage != STORE_PRIV);
BUNinplace(c, (BATcount(c) -1), c->H, i, TRUE);
@@ -532,37 +481,6 @@ insert_val2col(sql_delta *col, void *i)
bat_destroy(c);
}
-/**static void
-delta_append_val( sql_delta *bat, void *i )
-{
-
- BAT *b = temp_descriptor(bat->ibid);
-#ifndef NDEBUG
- BAT *c = BBPquickdesc(bat->bid, 0);
- assert(!c || c->htype == TYPE_void);
-#endif
-
- if (bat_debug==2)
- printf("#in delta append val\n");
-
- assert(b->htype == TYPE_void);
- if (bat->cached) {
- bat_destroy(bat->cached);
- bat->cached = NULL;
- }
- assert(!c || BATcount(c) == bat->ibase);
- if (isEbat(b)) {
- bat_destroy(b);
- temp_destroy(bat->ibid);
- bat->ibid = ebat2real(bat->ibid, bat->ibase);
- b = temp_descriptor(bat->ibid);
- }
- BUNappend(b, i, TRUE);
- assert(BUNlast(b) > b->batInserted);
- bat->cnt ++;
- bat_destroy(b);
-}*/
-
static int
dup_col(sql_trans *tr, sql_column *oc, sql_column *c )
{
@@ -593,38 +511,6 @@ dup_idx(sql_trans *tr, sql_idx *i, sql_i
}
return ok;
}
-/**
-static int
-dup_dbat( sql_trans *tr, sql_dbat *obat, sql_dbat *bat, int is_new, int temp)
-{
- if (bat_debug==2)
- printf("#in dup_dbat\n");
-
- bat->dbid = obat->dbid;
- bat->cnt = obat->cnt;
- bat->dname = _STRDUP(obat->dname);
- bat->wtime = obat->wtime;
-
- if (bat->dbid) {
- if (is_new)
- obat->dbid = temp_copy(bat->dbid, temp);
- else
- bat->dbid = ebat_copy(bat->dbid, 0, temp);
- }
- (void)tr;
- return LOG_OK;
-}
-
-static int
-dup_del(sql_trans *tr, sql_table *ot, sql_table *t)
-{
- sql_dbat *bat = t->data = ZNEW(sql_dbat), *obat = ot->data;
- int ok = dup_dbat( tr, obat, bat, isNew(t), isTempTable(t));
- assert(t->base.allocated == 0);
- //t->base.allocated = 1;
- return ok;
-}
-*/
static int
dup_tsbats(sql_trans *tr, sql_timestamps *ots, sql_timestamps *ts, int is_new,
int temp) {
@@ -728,7 +614,6 @@ static void
claim_tab(sql_trans *tr, sql_table *t, wrd cnt) {
sql_timestamps *ts;
- //sql_dbat *bat;
node *n, *in;
int growF=0;
@@ -740,15 +625,6 @@ claim_tab(sql_trans *tr, sql_table *t, w
store_lock();
- /*if (!t->data || !t->base.allocated) {
- sql_table *ot = tr_find_table(tr->parent, t);
- sql_dbat *bat = t->data = ZNEW(sql_dbat), *obat =
timestamp_dbat(ot->data, tr->stime);
- dup_dbat(tr, obat, bat, isNew(ot), isTempTable(t));
- //t->base.allocated = 1;
- }
- bat = t->data;
- (void)bat;*/
-
if (!t->data || !t->base.allocated) {
sql_table *ot = tr_find_table(tr->parent, t);
sql_timestamps *ts = t->data = ZNEW(sql_timestamps), *ots =
timestamp_tsbats(ot->data, tr->stime);
@@ -852,7 +728,6 @@ claim_tab(sql_trans *tr, sql_table *t, w
ts->wtime /*= t->base.wtime = t->s->base.wtime */= tr->wtime =
tr->wstime;
- //if(!isTempTable(t))
timestamps_insert(tr, t, ts, cnt);
store_unlock();
@@ -1128,24 +1003,6 @@ count_idx(sql_trans *tr, sql_idx *i, int
return b->cnt;// - b->ibase;
}
-/**static size_t
-count_del(sql_trans *tr, sql_table *t)
-{
- sql_dbat *d;
-
- if (bat_debug==2)
- printf("#in count_del\n");
-
- if (!t->data) {
- sql_table *ot = tr_find_table(tr->parent, t);
- t->data = timestamp_dbat(ot->data, tr->stime);
- }
- d = t->data;
- if (!d)
- return 0;
- return d->cnt;
-}*/
-
static size_t
count_timestamps(sql_trans *tr, sql_table *t) {
diff --git a/sql/storage/bat/bat_storage.h b/sql/storage/bat/bat_storage.h
--- a/sql/storage/bat/bat_storage.h
+++ b/sql/storage/bat/bat_storage.h
@@ -29,7 +29,7 @@ typedef struct sql_delta {
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) */
+ size_t cnt; /* number of tuples (including the deletes) */
size_t ucnt; /* number of updates */
BAT *cached; /* cached copy, used for schema bats only */
int wtime; /* time stamp */
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list