Changeset: 9d79d77e8f39 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9d79d77e8f39
Modified Files:
        sql/storage/bat/bat_storage.c
        sql/storage/store.c
Branch: default
Log Message:

make sure we switch to the new persistent snapshot


diffs (80 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
@@ -2387,6 +2387,29 @@ gtr_minmax( sql_trans *tr )
        return _gtr_update(tr, &gtr_minmax_table);
 }
 
+/* when existing delta's get cleared and again filled with large amouts of 
data, the ibid has
+ * become the persistent bat. So we need to move this too the persistent (bid).
+ */
+static int 
+tr_handle_snapshot( sql_trans *tr, sql_delta *bat)
+{
+       if (bat->ibase || tr->parent != gtrans)
+               return LOG_OK;
+
+       BAT *ins = temp_descriptor(bat->ibid);
+       if (!ins)
+               return LOG_ERR;
+       if (BATcount(ins) > SNAPSHOT_MINSIZE){
+               temp_destroy(bat->bid);
+               bat->bid = bat->ibid;
+               bat->cnt = bat->ibase = BATcount(ins);
+               bat->ibid = e_bat(ins->ttype);
+               BATmsync(ins);
+       }
+       bat_destroy(ins);
+       return LOG_OK;
+}
+
 static int 
 tr_update_delta( sql_trans *tr, sql_delta *obat, sql_delta *cbat, int unique)
 {
@@ -2762,6 +2785,7 @@ update_table(sql_trans *tr, sql_table *f
                                cc->data = NULL;
                                b->next = oc->data;
                                oc->data = b;
+                               tr_handle_snapshot(tr, b);
 
                                if (b->cached) {
                                        bat_destroy(b->cached);
@@ -2848,6 +2872,8 @@ update_table(sql_trans *tr, sql_table *f
                                        ci->data = NULL;
                                        b->next = oi->data;
                                        oi->data = b;
+                                       tr_handle_snapshot(tr, b);
+
                                        if (b->cached) {
                                                bat_destroy(b->cached);
                                                b->cached = NULL;
@@ -2924,9 +2950,7 @@ tr_log_delta( sql_trans *tr, sql_delta *
        if (BUNlast(ins) > 0) {
                assert(ATOMIC_GET(&store_nr_active)>0);
                if (BUNlast(ins) > ins->batInserted &&
-                   (ATOMIC_GET(&store_nr_active) != 1 ||
-                    cbat->ibase ||
-                    BATcount(ins) <= SNAPSHOT_MINSIZE))
+                   (cbat->ibase || BATcount(ins) <= SNAPSHOT_MINSIZE))
                        ok = log_bat(bat_logger, ins, cbat->name, tpe, id);
                if (ok == GDK_SUCCEED &&
                    !cbat->ibase && BATcount(ins) > SNAPSHOT_MINSIZE) {
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -4685,15 +4685,6 @@ sql_trans_validate(sql_trans *tr)
 
        /* depends on the iso level */
 
-       if (tr->schema_number != store_schema_number())
-               return false;
-
-       /* since we protect usage through private copies both the iso levels
-          read uncommited and read commited always succeed.
-       if (tr->level == ISO_READ_UNCOMMITED || tr->level == ISO_READ_COMMITED)
-               return true;
-        */
-
        /* If only 'inserts' occurred on the read columns the repeatable reads
           iso level can continue */
 
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to