Changeset: 17d2cc7e6898 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/17d2cc7e6898 Modified Files: sql/storage/bat/bat_storage.c sql/storage/store.c Branch: smart-merge-jan22 Log Message:
Merge with Jan2022. diffs (140 lines): diff --git a/gdk/ChangeLog.Jan2022 b/gdk/ChangeLog.Jan2022 --- a/gdk/ChangeLog.Jan2022 +++ b/gdk/ChangeLog.Jan2022 @@ -1,6 +1,15 @@ # ChangeLog file for GDK # This file is updated with Maddlog +* Thu Jul 28 2022 Sjoerd Mullender <sjo...@acm.org> +- Fixed an off-by-one error in the logger which caused older log files + to stick around longer in the write-ahead log than necessary. +- When an empty BAT is committed, skip writing (and synchronizing to + disk) the heap (tail and theap) files and write 0 for their sizes to + the BBP.dir file. When reading the BBP.dir file, if an empty BAT is + encountered, set the sizes of those files to 0. This fixes potential + issues during startup of the server (BBPcheckbats reporting errors). + * Wed Jun 22 2022 Sjoerd Mullender <sjo...@acm.org> - Make sure heap files of transient bats get deleted when the bat is destroyed. If the bat was a partial view (sharing the vheap but not diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -3275,10 +3275,6 @@ BBPdestroy(BAT *b) bat tp = VIEWtparent(b); bat vtp = VIEWvtparent(b); - HASHdestroy(b); - IMPSdestroy(b); - OIDXdestroy(b); - PROPdestroy_nolock(b); if (tp == 0) { /* bats that get destroyed must unfix their atoms */ gdk_return (*tunfix) (const void *) = BATatoms[b->ttype].atomUnfix; @@ -3295,12 +3291,7 @@ BBPdestroy(BAT *b) } if (tp || vtp) VIEWunlink(b); - if (b->theap) { - HEAPfree(b->theap, true); - } - if (b->tvheap) - HEAPfree(b->tvheap, true); - b->batCopiedtodisk = false; + BATdelete(b); BBPclear(b->batCacheid, true); /* if destroyed; de-register from BBP */ @@ -3879,6 +3870,8 @@ BBPcheckBBPdir(bool subcommit) case 0: /* end of file */ fclose(fp); + /* don't leak errors, this is just debug code */ + GDKclrerr(); return; case 1: /* successfully read an entry */ diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c --- a/gdk/gdk_storage.c +++ b/gdk/gdk_storage.c @@ -959,8 +959,11 @@ BATdelete(BAT *b) { bat bid = b->batCacheid; BAT *loaded = BBP_cache(bid); + char o[10]; + char *f; assert(bid > 0); + snprintf(o, sizeof(o), "%o", (unsigned) bid); if (loaded) { b = loaded; } @@ -969,9 +972,29 @@ BATdelete(BAT *b) OIDXdestroy(b); PROPdestroy_nolock(b); STRMPdestroy(b); - HEAPfree(b->theap, true); - if (b->tvheap) + if (b->theap) { + HEAPfree(b->theap, true); + if ((f = GDKfilepath(b->theap->farmid, BAKDIR, o, "tail1")) != NULL) { + MT_remove(f); + size_t i = strlen(f) - 1; + f[i] = '2'; + MT_remove(f); +#if SIZEOF_VAR_T == 8 + f[i] = '4'; + MT_remove(f); +#endif + f[i] = '\0'; + MT_remove(f); + GDKfree(f); + } + } + if (b->tvheap) { HEAPfree(b->tvheap, true); + if ((f = GDKfilepath(b->theap->farmid, BAKDIR, o, "theap")) != NULL) { + MT_remove(f); + GDKfree(f); + } + } b->batCopiedtodisk = false; } 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 @@ -3395,7 +3395,7 @@ commit_create_del( sql_trans *tr, sql_ch assert(ok == LOG_OK); if (ok != LOG_OK) return ok; - merge_segments(dbat, tr, change, commit_ts, commit_ts); + merge_segments(dbat, tr, change, commit_ts, commit_ts/* create is we are alone */ /*oldest*/); assert(dbat->cs.ts == tr->tid); dbat->cs.ts = commit_ts; if (ok == LOG_OK) { diff --git a/sql/storage/store.c b/sql/storage/store.c --- a/sql/storage/store.c +++ b/sql/storage/store.c @@ -3627,9 +3627,8 @@ sql_trans_rollback(sql_trans *tr, bool c for(node *n=nl->h; n; n = n->next) { sql_change *c = n->data; - if (c->commit) { + if (c->commit) c->commit(tr, c, 0 /* ie rollback */, oldest); - } c->ts = commit_ts; } store_pending_changes(store, oldest); @@ -3978,9 +3977,8 @@ sql_trans_commit(sql_trans *tr) for(node *n=tr->changes->h; n && ok == LOG_OK; n = n->next) { sql_change *c = n->data; - if (c->commit && ok == LOG_OK) { + if (c->commit && ok == LOG_OK) ok = c->commit(tr, c, commit_ts, oldest); - } else c->obj->new = 0; c->ts = commit_ts; _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org