Changeset: a7c6bb5d91ce for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a7c6bb5d91ce
Modified Files:
        gdk/gdk_logger.c
Branch: ustr
Log Message:

Whenever a bat with ustr property is updated, update count of ustr bat.


diffs (51 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -832,6 +832,7 @@ static gdk_return
 la_bat_updates(logger *lg, logaction *la, int tid)
 {
        log_bid bid = internal_find_bat(lg, la->cid, tid);
+       log_bid ubid;
        BAT *b = NULL;
 
        if (bid < 0)
@@ -845,6 +846,9 @@ la_bat_updates(logger *lg, logaction *la
                b = BATdescriptor(bid);
                if (b == NULL)
                        return GDK_FAIL;
+               ubid = b->ustr;
+       } else {
+               ubid = BBP_desc(bid)->ustr;
        }
        BUN cnt = 0;
        if (la->type == LOG_UPDATE_BULK) {
@@ -918,13 +922,28 @@ la_bat_updates(logger *lg, logaction *la
                }
        }
        cnt = (BUN) (la->offset + la->nr);
-       if (la_bat_update_count(lg, la->cid, cnt, tid) != GDK_SUCCEED) {
+       if (la_bat_update_count(lg, la->cid, (lng) cnt, tid) != GDK_SUCCEED) {
                if (b)
                        logbat_destroy(b);
                return GDK_FAIL;
        }
        if (b)
                logbat_destroy(b);
+       if (ubid != 0) {
+               BUN pos = log_find(lg->catalog_bid, lg->dcatalog, ubid);
+               if (pos == BUN_NONE)
+                       return GDK_FAIL;
+               b = BATdescriptor(ubid);
+               if (b == NULL)
+                       return GDK_FAIL;
+               MT_lock_set(&b->theaplock);
+               cnt = b->batCount;
+               MT_lock_unset(&b->theaplock);
+               BBPreclaim(b);
+               if (la_bat_update_count(lg, *(int*)Tloc(lg->catalog_id, pos),
+                                       (lng) cnt, tid) != GDK_SUCCEED)
+                       return GDK_FAIL;
+       }
        return GDK_SUCCEED;
 }
 
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to