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

Slight modification to setting tvkey during WAL processing.


diffs (66 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1084,6 +1084,17 @@ la_bat_create_ustr(logger *lg, logaction
                logbat_destroy(b);
                return GDK_FAIL;
        }
+       /* we're the only thread around, so we don't need the heap lock */
+       if (!u->tvkey &&
+           (u->batCount <= 1 ||
+            (BAThash(u) == GDK_SUCCEED &&
+             u->thash->nunique == u->batCount))) {
+               /* most likely, this bat (u) was created and filled
+                * earlier during processing of the WAL, and since that
+                * wasn't done through the normal ustr processing, the
+                * tvkey property was lost */
+               u->tvkey = true;
+       }
 
        if (BATconvert2ustr(b, u) != GDK_SUCCEED) {
                BBPreclaim(u);
diff --git a/gdk/gdk_string.c b/gdk/gdk_string.c
--- a/gdk/gdk_string.c
+++ b/gdk/gdk_string.c
@@ -290,37 +290,10 @@ BATconvert2ustr(BAT *b, BAT *bu)
        }
        MT_lock_set(&bu->theaplock);
        if (!bu->tvkey) {
-               /* if bu was created and filled during initial WAL
-                * processing, the tvkey property may have gotten lost,
-                * so we check it: the way the bu bat is created, the
-                * offsets are strictly ascending */
-               assert(bu->twidth >= 4);
-               if (bu->twidth == 4) {
-                       const uint32_t *p = (const uint32_t *) bu->theap->base;
-                       uint32_t prev = 0;
-                       for (BUN i = 0, n = bu->batCount; i < n; i++) {
-                               if (p[i] <= prev) {
-                                       MT_lock_unset(&b->theaplock);
-                                       MT_lock_unset(&bu->theaplock);
-                                       GDKerror("USTR BAT must have tvkey 
property\n");
-                                       return GDK_FAIL;
-                               }
-                               prev = p[i];
-                       }
-               } else if (bu->twidth == 8) {
-                       const uint64_t *p = (const uint64_t *) bu->theap->base;
-                       uint64_t prev = 0;
-                       for (BUN i = 0, n = bu->batCount; i < n; i++) {
-                               if (p[i] <= prev) {
-                                       MT_lock_unset(&b->theaplock);
-                                       MT_lock_unset(&bu->theaplock);
-                                       GDKerror("USTR BAT must have tvkey 
property\n");
-                                       return GDK_FAIL;
-                               }
-                               prev = p[i];
-                       }
-               }
-               bu->tvkey = true;
+               MT_lock_unset(&b->theaplock);
+               MT_lock_unset(&bu->theaplock);
+               GDKerror("USTR BAT must have tvkey property\n");
+               return GDK_FAIL;
        }
        if (bu->ustr) {
                MT_lock_unset(&b->theaplock);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to