Changeset: 0dc65a35beba for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0dc65a35beba
Modified Files:
        gdk/gdk_hash.c
Branch: partioned-hash
Log Message:

Persist hash tables again.


diffs (40 lines):

diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c
--- a/gdk/gdk_hash.c
+++ b/gdk/gdk_hash.c
@@ -377,6 +377,7 @@ BAThash(BAT *b)
                Heap *hp;
                const char *nme = BBP_physical(b->batCacheid);
                const char *ext = b->batCacheid > 0 ? "thash" : "hash";
+               int fd;
                lng t0;
 
                if ((hp = GDKzalloc(sizeof(*hp))) == NULL ||
@@ -426,6 +427,28 @@ BAThash(BAT *b)
                        }
                }
 #endif
+               t0 = GDKusec();
+               if ((BBP_status(b->batCacheid) & BBPEXISTING) &&
+                   b->batInserted == b->batCount &&
+                   HEAPsave(hp, nme, ext) == GDK_SUCCEED &&
+                   (fd = GDKfdlocate(hp->farmid, nme, "rb+", ext)) >= 0) {
+                       ((size_t *) hp->base)[0] |= 1 << 24;
+                       if (write(fd, hp->base, SIZEOF_SIZE_T) < 0)
+                               perror("write hash");
+                       if (!(GDKdebug & FORCEMITOMASK)) {
+#if defined(NATIVE_WIN32)
+                               _commit(fd);
+#elif defined(HAVE_FDATASYNC)
+                               fdatasync(fd);
+#elif defined(HAVE_FSYNC)
+                               fsync(fd);
+#endif
+                       }
+                       close(fd);
+                       ALGODEBUG fprintf(stderr, "#BAThash: persisting hash %d 
(" LLFMT " usec)\n", b->batCacheid, GDKusec() - t0);
+               } else {
+                       ALGODEBUG fprintf(stderr, "#BAThash: NOT persisting 
hash %d\n", b->batCacheid);
+               }
                b->T->hash = h;
        }
   bailout:
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to