Changeset: 0122150a298f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/0122150a298f Modified Files: gdk/gdk_logger.c sql/storage/store.c Branch: group-commit Log Message:
Merge with default. diffs (truncated from 183402 to 300 lines): diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -754,3 +754,5 @@ 97e76b882f9fb28327393d21708fb22f2f6c22f1 f458e1c71c73d6bd9636369c1406eadb74f016bf Jan2022_9 f458e1c71c73d6bd9636369c1406eadb74f016bf Jan2022_SP1_release 00463fdd0d51d7ce058549a82bc74efaea6035a2 Jul2021_15 +00463fdd0d51d7ce058549a82bc74efaea6035a2 Jul2021_SP3_release +db3cec8ea853884e857fcfb413428116cb95e786 Jul2021_17 diff --git a/clients/ChangeLog.Jan2022 b/clients/ChangeLog.Jan2022 --- a/clients/ChangeLog.Jan2022 +++ b/clients/ChangeLog.Jan2022 @@ -2,9 +2,9 @@ # This file is updated with Maddlog * Wed Feb 16 2022 Sjoerd Mullender <sjo...@acm.org> -- Improved the handling of the \r command in mclient. It now properly - counts the header of table, and when a (very) long table is being - printed and aborted part way in the built-in pager, not all data is - transferred to the client (and then discarded). Instead at most 1000 - rows are transferred. +- Improved the handling of the \r (internal pager) command in mclient. + It now properly counts the header of table, and when a (very) long + table is being printed and aborted part way in the built-in pager, not + all data is transferred to the client (and then discarded). Instead + at most 1000 rows are transferred. diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c --- a/clients/mapiclient/dump.c +++ b/clients/mapiclient/dump.c @@ -3124,8 +3124,8 @@ dump_database(Mapi mid, stream *toConsol if (curschema == NULL || strcmp(schema, curschema) != 0) { if (curschema) free(curschema); - curschema = schema ? strdup(schema) : NULL; - if (schema && !curschema) { + curschema = strdup(schema); + if (curschema == NULL) { free(id); free(schema); free(name); diff --git a/common/stream/xz_stream.c b/common/stream/xz_stream.c --- a/common/stream/xz_stream.c +++ b/common/stream/xz_stream.c @@ -161,9 +161,9 @@ xz_stream(stream *inner, int preset) ret = lzma_easy_encoder(&xz->strm, preset, LZMA_CHECK_CRC64); } - stream *s = pump_stream(inner, state); + stream *s; - if (ret != LZMA_OK || s == NULL) { + if (ret != LZMA_OK || (s = pump_stream(inner, state)) == NULL) { lzma_end(&xz->strm); free(xz); free(state); diff --git a/common/utils/msabaoth.c b/common/utils/msabaoth.c --- a/common/utils/msabaoth.c +++ b/common/utils/msabaoth.c @@ -612,14 +612,26 @@ msab_pickSecret(char **generated_secret) } } #else - (void)bin_secret; - if (generated_secret) - // do not return an error, just continue without a secret - *generated_secret = NULL; - free(secret); - return NULL; + int rfd = open("/dev/urandom", O_RDONLY); + if (rfd >= 0) { + ssize_t nr; + for (size_t n = 0; n < sizeof(bin_secret); n += nr) { + nr = read(rfd, bin_secret + n, sizeof(bin_secret) - n); + if (nr < 0) { + free(secret); + return strdup("reading /dev/urandom failed"); + } + } + close(rfd); + } else { + (void)bin_secret; + if (generated_secret) + // do not return an error, just continue without a secret + *generated_secret = NULL; + free(secret); + return NULL; + } #endif -#if defined(HAVE_GETENTROPY) || defined(HAVE_RAND_S) int fd; FILE *f; for (size_t i = 0; i < sizeof(bin_secret); i++) { @@ -659,7 +671,6 @@ msab_pickSecret(char **generated_secret) else free(secret); return NULL; -#endif } /** diff --git a/gdk/ChangeLog.Jan2022 b/gdk/ChangeLog.Jan2022 --- a/gdk/ChangeLog.Jan2022 +++ b/gdk/ChangeLog.Jan2022 @@ -1,3 +1,11 @@ # ChangeLog file for GDK # This file is updated with Maddlog +* Wed Mar 9 2022 Sjoerd Mullender <sjo...@acm.org> +- Fixed a bug in the append code for msk (bit mask) bats. +- Conversions from floating point types to integral types that involve + multiplication now use the "long double" as intermediate type, thereby + loosing as few significant bits as is feasible. +- Found and fixed another source for the now infamous BBPcheckbats error + that sometimes occurs at startup of the server. + diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -775,6 +775,8 @@ typedef struct BAT { batTransient:1; /* should the BAT persist on disk? */ uint8_t /* adjacent bit fields are packed together (if they fit) */ batRestricted:2; /* access privileges */ + uint16_t /* adjacent bit fields are packed together (if they fit) */ + selcnt:10; /* how often used in equi select without hash */ role_t batRole; /* role of the bat */ uint16_t unused; /* value=0 for now (sneakily used by mat.c) */ int batSharecnt; /* incoming view count */ diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -1896,6 +1896,7 @@ new_bbpentry(FILE *fp, bat i, BUN size) } #endif + assert(size <= BBP_desc(i)->batCount || size == BUN_NONE); if (size > BBP_desc(i)->batCount) size = BBP_desc(i)->batCount; if (fprintf(fp, "%d %u %s %s %d " BUNFMT " " BUNFMT " " OIDFMT, @@ -3927,6 +3928,7 @@ BBPsync(int cnt, bat *restrict subcommit if (lock) MT_lock_unset(&GDKswapLock(i)); BATiter bi = bat_iterator(b); + assert(size <= bi.count || size == BUN_NONE); if (size > bi.count) size = bi.count; MT_rwlock_rdlock(&b->thashlock); diff --git a/gdk/gdk_calc_convert.c b/gdk/gdk_calc_convert.c --- a/gdk/gdk_calc_convert.c +++ b/gdk/gdk_calc_convert.c @@ -443,7 +443,8 @@ convert_##TYPE1##_##TYPE2(const TYPE1 *s dst[i] = TYPE2##_nil; \ nils++; \ } else { \ - dst[i] = (TYPE2) round##TYPE1(v * mul); \ + ldouble m = (ldouble) v * mul; \ + dst[i] = (TYPE2) rounddbl(m); \ if ((is_##TYPE2##_nil(dst[i]) || \ (precision && \ (dst[i] >= prec || \ @@ -466,7 +467,8 @@ convert_##TYPE1##_##TYPE2(const TYPE1 *s dst[i] = TYPE2##_nil; \ nils++; \ } else { \ - dst[i] = (TYPE2) round##TYPE1(v * mul); \ + ldouble m = (ldouble) v * mul; \ + dst[i] = (TYPE2) rounddbl(m); \ if ((is_##TYPE2##_nil(dst[i]) || \ (precision && \ (dst[i] >= prec || \ diff --git a/gdk/gdk_calc_muldiv.c b/gdk/gdk_calc_muldiv.c --- a/gdk/gdk_calc_muldiv.c +++ b/gdk/gdk_calc_muldiv.c @@ -360,7 +360,7 @@ mul_##TYPE1##_##TYPE2##_##TYPE3( \ dst[k] = TYPE3##_nil; \ nils++; \ } else { \ - double m = lft[i] * rgt[j]; \ + ldouble m = lft[i] * (ldouble) rgt[j]; \ dst[k] = (TYPE3) rounddbl(m); \ } \ } \ @@ -382,7 +382,7 @@ mul_##TYPE1##_##TYPE2##_##TYPE3( \ dst[k] = TYPE3##_nil; \ nils++; \ } else { \ - double m = lft[i] * rgt[j]; \ + ldouble m = lft[i] * (ldouble) rgt[j]; \ dst[k] = (TYPE3) rounddbl(m); \ } \ } \ @@ -2674,8 +2674,7 @@ div_##TYPE1##_##TYPE2##_##TYPE3( \ dst[k] = TYPE3##_nil; \ nils++; \ } else { \ - m = lft[i] / rgt[j]; \ - dst[k] = (TYPE3) rounddbl(m); \ + dst[k] = (TYPE3) rounddbl(lft[i] / (ldouble) rgt[j]); \ } \ } \ } \ @@ -2705,8 +2704,7 @@ div_##TYPE1##_##TYPE2##_##TYPE3( \ dst[k] = TYPE3##_nil; \ nils++; \ } else { \ - m = lft[i] / rgt[j]; \ - dst[k] = (TYPE3) rounddbl(m); \ + dst[k] = (TYPE3) rounddbl(lft[i] / (ldouble) rgt[j]); \ } \ } \ } \ diff --git a/gdk/gdk_calc_private.h b/gdk/gdk_calc_private.h --- a/gdk/gdk_calc_private.h +++ b/gdk/gdk_calc_private.h @@ -651,10 +651,21 @@ BUN dofsum(const void *restrict values, } \ } while (0) +#if defined(_MSC_VER) && defined(__INTEL_COMPILER) +/* with Intel compiler on Windows, avoid using roundl and llroundl: they + * cause a mysterious crash; long double is the same size as double + * anyway */ +typedef double ldouble; #ifdef TRUNCATE_NUMBERS -#define roundflt(x) (x) #define rounddbl(x) (x) #else -#define roundflt(x) roundf(x) #define rounddbl(x) round(x) #endif +#else +typedef long double ldouble; +#ifdef TRUNCATE_NUMBERS +#define rounddbl(x) (x) +#else +#define rounddbl(x) roundl(x) +#endif +#endif diff --git a/gdk/gdk_delta.c b/gdk/gdk_delta.c --- a/gdk/gdk_delta.c +++ b/gdk/gdk_delta.c @@ -35,6 +35,7 @@ BATcommit(BAT *b, BUN size) { if (b == NULL) return; + assert(size <= BATcount(b) || size == BUN_NONE); TRC_DEBUG(DELTA, "BATcommit1 %s free %zu ins " BUNFMT " base %p\n", BATgetId(b), b->theap->free, b->batInserted, b->theap->base); if (!BATdirty(b)) { diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c --- a/gdk/gdk_logger.c +++ b/gdk/gdk_logger.c @@ -572,7 +572,7 @@ log_read_updates(logger *lg, trans *tr, static gdk_return -la_bat_update_count(logger *lg, log_id id, lng cnt) +la_bat_update_count(logger *lg, log_id id, lng cnt, int tid) { BATiter cni = bat_iterator_nolock(lg->catalog_id); @@ -583,7 +583,7 @@ la_bat_update_count(logger *lg, log_id i HASHloop_int(cni, cni.b->thash, p, &id) { lng lid = *(lng *) Tloc(lg->catalog_lid, p); - if (lid != lng_nil && lid <= lg->tid) + if (lid != lng_nil && lid <= tid) break; cp = p; } @@ -601,7 +601,7 @@ la_bat_update_count(logger *lg, log_id i } static gdk_return -la_bat_updates(logger *lg, logaction *la) +la_bat_updates(logger *lg, logaction *la, int tid) { log_bid bid = internal_find_bat(lg, la->cid); BAT *b = NULL; @@ -665,7 +665,7 @@ la_bat_updates(logger *lg, logaction *la } } cnt = (BUN)(la->offset + la->nr); - if (la_bat_update_count(lg, la->cid, cnt) != GDK_SUCCEED) { + if (la_bat_update_count(lg, la->cid, cnt, tid) != GDK_SUCCEED) { if (b) logbat_destroy(b); return GDK_FAIL; @@ -816,14 +816,14 @@ tr_create(trans *tr, int tid) } static gdk_return -la_apply(logger *lg, logaction *c) +la_apply(logger *lg, logaction *c, int tid) { gdk_return ret = GDK_SUCCEED; switch (c->type) { case LOG_UPDATE_BULK: case LOG_UPDATE: _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org