Changeset: cec03b614776 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/cec03b614776 Modified Files: clients/mapilib/mapi.c gdk/gdk_bbp.c gdk/gdk_hash.c gdk/gdk_private.h monetdb5/modules/mal/mal_mapi.c monetdb5/modules/mal/tokenizer.c Branch: default Log Message:
Merged with Jul2021 diffs (truncated from 376 to 300 lines): diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c --- a/clients/mapilib/mapi.c +++ b/clients/mapilib/mapi.c @@ -3113,6 +3113,10 @@ close_connection(Mapi mid) } mid->redircnt = 0; mapi_log_record(mid, "Connection closed\n"); + if (mid->tracelog) { + close_stream(mid->tracelog); + mid->tracelog = 0; + } } MapiMsg diff --git a/ctest/tools/monetdbe/backup.c b/ctest/tools/monetdbe/backup.c --- a/ctest/tools/monetdbe/backup.c +++ b/ctest/tools/monetdbe/backup.c @@ -41,13 +41,16 @@ main(void) /* open file stream */ stream *fd = open_wastream("/tmp/backup"); - - if (dump_database(mid, fd, 0, 0, false)) { - if (mid->msg) - error(mid->msg) - fprintf(stderr, "database backup failed\n"); + if (fd) { + if (dump_database(mid, fd, 0, 0, false)) { + if (mid->msg) + error(mid->msg) + error("database backup failed\n"); + } + close_stream(fd); + } else { + fprintf(stderr, "Failure: unable to open file /tmp/backup: %s", mnstr_peek_error(NULL)); } - close_stream(fd); if ((mid->msg = monetdbe_close(mid->mdbe)) != NULL) error(mid->msg); diff --git a/gdk/ChangeLog.Jul2021 b/gdk/ChangeLog.Jul2021 --- a/gdk/ChangeLog.Jul2021 +++ b/gdk/ChangeLog.Jul2021 @@ -1,3 +1,10 @@ # ChangeLog file for GDK # This file is updated with Maddlog +* Wed Aug 11 2021 Sjoerd Mullender <sjo...@acm.org> +- When appending to a string bat, we made an optimization where the string + heap was sometimes copied completely to avoid having to insert strings + individually. This copying was still done too eagerly, so now the + string heap is copied less frequently. In particular, when appending + to an empty bat, the string heap is now not always copied whole. + diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -1396,7 +1396,7 @@ BBPinit(void) if (BBPrecover_subdir() != GDK_SUCCEED) { GDKfree(bbpdirstr); GDKfree(backupbbpdirstr); - TRC_CRITICAL(GDK, "cannot properly recover_subdir process %s. Please check whether your disk is full or write-protected", SUBDIR); + TRC_CRITICAL(GDK, "cannot properly recover_subdir process %s.", SUBDIR); MT_lock_unset(&GDKtmLock); return GDK_FAIL; } @@ -1434,6 +1434,7 @@ BBPinit(void) TRC_DEBUG(IO_, "reverting to dir saved in BBP.bak.\n"); if ((fp = GDKfilelocate(0, "BBP", "r", "dir")) == NULL) { + GDKsyserror("cannot open BBP.dir"); GDKfree(bbpdirstr); GDKfree(backupbbpdirstr); MT_lock_unset(&GDKtmLock); @@ -1486,7 +1487,7 @@ BBPinit(void) gdk_return rc = BBPprepare(false); MT_lock_unset(&GDKtmLock); if (rc != GDK_SUCCEED) { - TRC_CRITICAL(GDK, "cannot properly prepare process %s. Please check whether your disk is full or write-protected", BAKDIR); + TRC_CRITICAL(GDK, "cannot properly prepare process %s.", BAKDIR); return rc; } } @@ -1542,7 +1543,7 @@ BBPinit(void) bailout: /* now it is time for real panic */ - TRC_CRITICAL(GDK, "could not write %s%cBBP.dir. Please check whether your disk is full or write-protected", BATDIR, DIR_SEP); + TRC_CRITICAL(GDK, "could not write %s%cBBP.dir.", BATDIR, DIR_SEP); return GDK_FAIL; } @@ -3199,10 +3200,11 @@ BBPprepare(bool subcommit) str bakdirpath, subdirpath; gdk_return ret = GDK_SUCCEED; - if(!(bakdirpath = GDKfilepath(0, NULL, BAKDIR, NULL))) - return GDK_FAIL; - if(!(subdirpath = GDKfilepath(0, NULL, SUBDIR, NULL))) { + bakdirpath = GDKfilepath(0, NULL, BAKDIR, NULL); + subdirpath = GDKfilepath(0, NULL, SUBDIR, NULL); + if (bakdirpath == NULL || subdirpath == NULL) { GDKfree(bakdirpath); + GDKfree(subdirpath); return GDK_FAIL; } @@ -3833,7 +3835,7 @@ BBPrecover(int farmid) TRC_DEBUG(IO_, "rmdir %s = %d\n", bakdirpath, (int) ret); } if (ret != GDK_SUCCEED) - GDKerror("recovery failed. Please check whether your disk is full or write-protected.\n"); + GDKerror("recovery failed.\n"); TRC_DEBUG(IO_, "end\n"); GDKfree(bakdirpath); @@ -3889,7 +3891,7 @@ BBPrecover_subdir(void) TRC_DEBUG(IO_, "end = %d\n", (int) ret); if (ret != GDK_SUCCEED) - GDKerror("recovery failed. Please check whether your disk is full or write-protected.\n"); + GDKerror("recovery failed.\n"); return ret; } diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c --- a/gdk/gdk_hash.c +++ b/gdk/gdk_hash.c @@ -583,10 +583,9 @@ BATcheckhash(BAT *b) return ret; } -static gdk_return +static void BAThashsave_intern(BAT *b, bool dosync) { - gdk_return rc = GDK_SUCCEED; Hash *h; lng t0 = 0; @@ -600,7 +599,6 @@ BAThashsave_intern(BAT *b, bool dosync) dosync = false; #endif - rc = GDK_FAIL; /* only persist if parent BAT hasn't changed in the * mean time */ if (!b->theap->dirty && @@ -609,20 +607,20 @@ BAThashsave_intern(BAT *b, bool dosync) HEAPsave(hp, hp->filename, NULL, dosync, hp->free) == GDK_SUCCEED) { h->heaplink.dirty = false; hp->dirty = false; - rc = HASHfix(h, true, dosync); + gdk_return rc = HASHfix(h, true, dosync); TRC_DEBUG(ACCELERATOR, ALGOBATFMT ": persisting hash %s%s (" LLFMT " usec)%s\n", ALGOBATPAR(b), hp->filename, dosync ? "" : " no sync", GDKusec() - t0, rc == GDK_SUCCEED ? "" : " failed"); } + GDKclrerr(); } - return rc; } -gdk_return +void BAThashsave(BAT *b, bool dosync) { Hash *h = b->thash; if (h == NULL) - return GDK_SUCCEED; + return; ((size_t *) h->heapbckt.base)[0] = (size_t) HASH_VERSION; ((size_t *) h->heapbckt.base)[1] = (size_t) (h->heaplink.free / h->width); ((size_t *) h->heapbckt.base)[2] = (size_t) h->nbucket; @@ -630,7 +628,7 @@ BAThashsave(BAT *b, bool dosync) ((size_t *) h->heapbckt.base)[4] = (size_t) BATcount(b); ((size_t *) h->heapbckt.base)[5] = (size_t) h->nunique; ((size_t *) h->heapbckt.base)[6] = (size_t) h->nheads; - return BAThashsave_intern(b, dosync); + BAThashsave_intern(b, dosync); } #ifdef PERSISTENTHASH @@ -1123,21 +1121,25 @@ HASHappend_locked(BAT *b, BUN i, const v if (h == (Hash *) 1) { b->thash = NULL; doHASHdestroy(b, h); + GDKclrerr(); return; } assert(i * h->width == h->heaplink.free); if (h->nunique < b->batCount / HASH_DESTROY_UNIQUES_FRACTION) { b->thash = NULL; doHASHdestroy(b, h); + GDKclrerr(); return; } if (HASHfix(h, false, true) != GDK_SUCCEED) { b->thash = NULL; doHASHdestroy(b, h); + GDKclrerr(); return; } if (HASHwidth(i + 1) > h->width && HASHupgradehashheap(b) != GDK_SUCCEED) { + GDKclrerr(); return; } if ((ATOMsize(b->ttype) > 2 && @@ -1150,6 +1152,7 @@ HASHappend_locked(BAT *b, BUN i, const v HEAPfree(&h->heapbckt, true); HEAPfree(&h->heaplink, true); GDKfree(h); + GDKclrerr(); return; } h->Link = h->heaplink.base; @@ -1192,17 +1195,20 @@ HASHinsert_locked(BAT *b, BUN p, const v if (h == (Hash *) 1) { b->thash = NULL; doHASHdestroy(b, h); + GDKclrerr(); return; } assert(p * h->width < h->heaplink.free); if (h->nunique < b->batCount / HASH_DESTROY_UNIQUES_FRACTION) { b->thash = NULL; doHASHdestroy(b, h); + GDKclrerr(); return; } if (HASHfix(h, false, true) != GDK_SUCCEED) { b->thash = NULL; doHASHdestroy(b, h); + GDKclrerr(); return; } BUN c = HASHprobe(h, v); @@ -1273,17 +1279,20 @@ HASHdelete_locked(BAT *b, BUN p, const v if (h == (Hash *) 1) { b->thash = NULL; doHASHdestroy(b, h); + GDKclrerr(); return; } assert(p * h->width < h->heaplink.free); if (h->nunique < b->batCount / HASH_DESTROY_UNIQUES_FRACTION) { b->thash = NULL; doHASHdestroy(b, h); + GDKclrerr(); return; } if (HASHfix(h, false, true) != GDK_SUCCEED) { b->thash = NULL; doHASHdestroy(b, h); + GDKclrerr(); return; } BUN c = HASHprobe(h, v); diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h --- a/gdk/gdk_private.h +++ b/gdk/gdk_private.h @@ -66,7 +66,7 @@ gdk_return BATgroup_internal(BAT **group __attribute__((__visibility__("hidden"))); Hash *BAThash_impl(BAT *restrict b, struct canditer *restrict ci, const char *restrict ext) __attribute__((__visibility__("hidden"))); -gdk_return BAThashsave(BAT *b, bool dosync) +void BAThashsave(BAT *b, bool dosync) __attribute__((__visibility__("hidden"))); void BATinit_idents(BAT *bn) __attribute__((__visibility__("hidden"))); diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c --- a/gdk/gdk_storage.c +++ b/gdk/gdk_storage.c @@ -308,6 +308,7 @@ GDKunlink(int farmid, const char *dir, c GDKfree(path); return GDK_SUCCEED; } + GDKerror("no name specified"); return GDK_FAIL; } diff --git a/monetdb5/modules/mal/mal_mapi.c b/monetdb5/modules/mal/mal_mapi.c --- a/monetdb5/modules/mal/mal_mapi.c +++ b/monetdb5/modules/mal/mal_mapi.c @@ -400,7 +400,7 @@ SERVERlistenThread(SOCKET *Sock) } #endif - data = GDKmalloc(sizeof(*data)); + data = GDKzalloc(sizeof(*data)); if( data == NULL){ closesocket(msgsock); TRC_ERROR(MAL_SERVER, MAL_MALLOC_FAIL "\n"); diff --git a/monetdb5/modules/mal/tablet.c b/monetdb5/modules/mal/tablet.c --- a/monetdb5/modules/mal/tablet.c +++ b/monetdb5/modules/mal/tablet.c @@ -927,7 +927,7 @@ SQLworker_column(READERtask *task, int c MT_lock_set(&mal_copyLock); if (!fmt[col].skip && BATcapacity(fmt[col].c) < BATcount(fmt[col].c) + task->next) { if (BATextend(fmt[col].c, BATgrows(fmt[col].c) + task->limit) != GDK_SUCCEED) { _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list