Changeset: 1505c818ead3 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/1505c818ead3 Modified Files: gdk/gdk.h gdk/gdk_tracer.c monetdb5/mal/mal_profiler.c sql/server/rel_dump.c sql/server/rel_optimize_sel.c sql/storage/store.c testing/Mtest.py.in Branch: default Log Message:
Merge with Aug2024 branch. diffs (truncated from 322 to 300 lines): diff --git a/documentation/source/manual_pages/mserver5.rst.in b/documentation/source/manual_pages/mserver5.rst.in --- a/documentation/source/manual_pages/mserver5.rst.in +++ b/documentation/source/manual_pages/mserver5.rst.in @@ -167,13 +167,16 @@ MSERVER5 OPTIONS **268435456** (HEAPMASK) trace/debug HEAPextend; used only for development & - debugging **536870912** (FORCEMITOMASK) forcefully activate - mitosis even on small tables, i.e., split small tables in as many - (tiny) pieces as there are cores (threads) available; this allows - us to test mitosis functionality without requiring large data sets - (— at the expense of a potentially significant interpretation - overhead for unnecessarily large plans); used only for development - & testing; set automatically by Mtest.py + debugging + + **536870912** + (FORCEMITOMASK) forcefully activate mitosis even on small tables, + i.e., split small tables in as many (tiny) pieces as there are + cores (threads) available; this allows us to test mitosis + functionality without requiring large data sets (— at the expense + of a potentially significant interpretation overhead for + unnecessarily large plans); used only for development & testing; + set automatically by Mtest.py **--algorithms** Equivalent to **--debug=**\ *(ALGOMASK)*. diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -390,6 +390,7 @@ gdk_export _Noreturn void GDKfatal(_In_z #define IOMASK (1U<<4) #define BATMASK (1U<<5) #define PARMASK (1U<<7) +#define TESTINGMASK (1U<<8) #define TMMASK (1U<<9) #define TEMMASK (1U<<10) #define PERFMASK (1U<<12) diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c --- a/gdk/gdk_logger.c +++ b/gdk/gdk_logger.c @@ -2350,7 +2350,7 @@ log_new(int debug, const char *fn, const lng max_file_age = GDKgetenv_int("wal_max_file_age", 600); lng max_file_size = 0; - if (GDKdebug & FORCEMITOMASK) { + if (GDKdebug & TESTINGMASK) { max_file_size = 2048; /* 2 KiB */ } else { const char *max_file_size_str = GDKgetenv("wal_max_file_size"); @@ -2548,7 +2548,7 @@ log_create(int debug, const char *fn, co static logged_range * log_next_logfile(logger *lg, ulng ts) { - int m = (ATOMIC_GET(&GDKdebug) & FORCEMITOMASK) ? 1000 : 100; + int m = (ATOMIC_GET(&GDKdebug) & TESTINGMASK) ? 1000 : 100; if (!lg->pending || !lg->pending->next) return NULL; rotation_lock(lg); diff --git a/gdk/gdk_strimps.c b/gdk/gdk_strimps.c --- a/gdk/gdk_strimps.c +++ b/gdk/gdk_strimps.c @@ -94,7 +94,7 @@ #define STRIMP_HEADER_SIZE 64 #define STRIMP_PAIRS (STRIMP_HEADER_SIZE - 1) #define STRIMP_CREATION_THRESHOLD \ - ((BUN) ((ATOMIC_GET(&GDKdebug) & FORCEMITOMASK)? 100 : 5000)) + ((BUN) ((ATOMIC_GET(&GDKdebug) & TESTINGMASK)? 100 : 5000)) typedef struct { #ifdef UTF8STRIMPS diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c --- a/gdk/gdk_tracer.c +++ b/gdk/gdk_tracer.c @@ -605,7 +605,7 @@ GDKtracer_log(const char *file, const ch if (interrupted) reinit(); - if (level <= M_WARNING || (ATOMIC_GET(&GDKdebug) & FORCEMITOMASK)) { + if (level <= M_WARNING || (ATOMIC_GET(&GDKdebug) & TESTINGMASK)) { fprintf(level <= M_ERROR && !isexit ? stderr : stdout, "#%s%s%s: %s: %s: %s%s%s\n", add_ts ? ts : "", diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c --- a/monetdb5/mal/mal_profiler.c +++ b/monetdb5/mal/mal_profiler.c @@ -1079,7 +1079,7 @@ static void profilerHeartbeat(void *dummy) { int t; - const int timeout = ATOMIC_GET(&GDKdebug) & FORCEMITOMASK ? 10 : 25; + const int timeout = ATOMIC_GET(&GDKdebug) & TESTINGMASK ? 10 : 25; (void) dummy; for (;;) { diff --git a/monetdb5/modules/mal/clients.c b/monetdb5/modules/mal/clients.c --- a/monetdb5/modules/mal/clients.c +++ b/monetdb5/modules/mal/clients.c @@ -475,8 +475,8 @@ CLTqueryTimeout(Client cntxt, MalBlkPtr msg = createException(MAL, "clients.setquerytimeout", "Session not active anymore"); else { - /* when testing (FORCEMITOMASK), reduce timeout of 1 sec to 1 msec */ - lng timeout_micro = ATOMIC_GET(&GDKdebug) & FORCEMITOMASK + /* when testing (TESTINGMASK), reduce timeout of 1 sec to 1 msec */ + lng timeout_micro = ATOMIC_GET(&GDKdebug) & TESTINGMASK && qto == 1 ? 1000 : (lng) qto * 1000000; mal_clients[idx].querytimeout = timeout_micro; } 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 @@ -292,7 +292,7 @@ SERVERlistenThread(SOCKET *Sock) } /* Wait up to 0.1 seconds (0.01 if testing) */ retval = poll(pfd, npfd, - ATOMIC_GET(&GDKdebug) & FORCEMITOMASK ? 10 : 100); + ATOMIC_GET(&GDKdebug) & TESTINGMASK ? 10 : 100); if (retval == -1 && errno == EINTR) continue; #else @@ -308,7 +308,7 @@ SERVERlistenThread(SOCKET *Sock) } /* Wait up to 0.1 seconds (0.01 if testing) */ struct timeval tv = (struct timeval) { - .tv_usec = ATOMIC_GET(&GDKdebug) & FORCEMITOMASK ? 10000 : 100000, + .tv_usec = ATOMIC_GET(&GDKdebug) & TESTINGMASK ? 10000 : 100000, }; retval = select((int) msgsock + 1, &fds, NULL, NULL, &tv); diff --git a/monetdb5/optimizer/opt_candidates.c b/monetdb5/optimizer/opt_candidates.c --- a/monetdb5/optimizer/opt_candidates.c +++ b/monetdb5/optimizer/opt_candidates.c @@ -24,7 +24,7 @@ OPTcandidatesImplementation(Client cntxt InstrPtr p; str msg = MAL_SUCCEED; - if (!(ATOMIC_GET(&GDKdebug) & FORCEMITOMASK)) + if (!(ATOMIC_GET(&GDKdebug) & TESTINGMASK)) goto wrapup; (void) cntxt; (void) stk; /* to fool compilers */ diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c --- a/sql/server/rel_dump.c +++ b/sql/server/rel_dump.c @@ -335,7 +335,7 @@ exp_print(mvc *sql, stream *fout, sql_ex if (decorate && e->p && e->type != e_atom && !exp_is_atom(e)) { for (prop *p = e->p; p; p = p->p) { /* Don't show min/max/unique est on atoms, or when running tests with forcemito */ - if ((ATOMIC_GET(&GDKdebug) & NOSYNCMASK) == 0 || + if ((ATOMIC_GET(&GDKdebug) & TESTINGMASK) == 0 || (p->kind != PROP_MIN && p->kind != PROP_MAX && p->kind != PROP_NUNIQUES)) { char *pv = propvalue2string(sql->ta, p); mnstr_printf(fout, " %s %s", propkind2string(p), pv); @@ -697,7 +697,7 @@ rel_print_rel(mvc *sql, stream *fout, s } if (decorate && rel->p) { for (prop *p = rel->p; p; p = p->p) { - if (p->kind != PROP_COUNT || (ATOMIC_GET(&GDKdebug) & NOSYNCMASK) == 0) { + if (p->kind != PROP_COUNT || (ATOMIC_GET(&GDKdebug) & TESTINGMASK) == 0) { char *pv = propvalue2string(sql->ta, p); mnstr_printf(fout, " %s %s", propkind2string(p), pv); } diff --git a/sql/server/rel_optimize_sel.c b/sql/server/rel_optimize_sel.c --- a/sql/server/rel_optimize_sel.c +++ b/sql/server/rel_optimize_sel.c @@ -2383,7 +2383,7 @@ order_joins(visitor *v, list *rels, list h[ci] = r1[ci] = r2[ci] = 0; r3[ci] = 0; /* h[ci] = exp_find_rels(cje, rels) */ - if (cje->type != e_cmp || is_complex_exp(cje->flag) || !find_prop(cje->p, PROP_HASHCOL) || + if (cje->type != e_cmp || !is_complex_exp(cje->flag) || !find_prop(cje->p, PROP_HASHCOL) || (cje->type == e_cmp && cje->f == NULL)) { cje->tmp = ci; r1[ci] = rels_find_one_rel(rels_a, nr_rels, cje->l); @@ -2404,27 +2404,30 @@ order_joins(visitor *v, list *rels, list /* open problem, some expressions use more than 2 relations */ /* For example a.x = b.y * c.z; */ if (list_length(rels) >= 2 && sdje->h) { - /* get the first expression */ - cje = sdje->h->data; - - /* find the involved relations */ - - /* complex expressions may touch multiple base tables - * Should be pushed up to extra selection. - * */ - if (0 && popcount64(h[cje->tmp]) > 2) - assert(0); - if (cje->type != e_cmp || is_complex_exp(cje->flag) || !find_prop(cje->p, PROP_HASHCOL) || - (cje->type == e_cmp && cje->f == NULL)) { - l = rels_a[r1[cje->tmp]]; - r = rels_a[r2[cje->tmp]]; - rel_mask |= h[cje->tmp]; + for (node *n = sdje->h; n && !l && !r; n = n->next, ci++) { + cje = n->data; + + /* find the involved relations */ + + /* complex expressions may touch multiple base tables + * Should be pushed up to extra selection. + * */ + if (0 && popcount64(h[cje->tmp]) > 2) + assert(0); + if (cje->type != e_cmp || !is_complex_exp(cje->flag) || !find_prop(cje->p, PROP_HASHCOL) || + (cje->type == e_cmp && cje->f == NULL)) { + l = rels_a[r1[cje->tmp]]; + r = rels_a[r2[cje->tmp]]; + if (l && r) + rel_mask |= h[cje->tmp]; + } } cje->tmp = 0; if (l && r && l != r) list_remove_data(sdje, NULL, cje); } + if (l && r && l != r) { list_remove_data(rels, NULL, l); list_remove_data(rels, NULL, r); @@ -2530,7 +2533,7 @@ order_joins(visitor *v, list *rels, list for (en = sdje->h; en; ) { node *next = en->next; sql_exp *e = en->data; - if ((direct && ((e->flag <= cmp_notequal && (h[e->tmp] & rel_mask) == h[e->tmp]) || (e->flag > cmp_notequal && rel_rebind_exp(v->sql, top, e)))) || + if ((direct && ((e->flag <= cmp_notequal && (h[e->tmp] & rel_mask) == h[e->tmp] && h[e->tmp]) || (e->flag > cmp_notequal && rel_rebind_exp(v->sql, top, e)))) || (!direct && rel_rebind_exp(v->sql, top, e))) { rel_join_add_exp(v->sql->sa, top, e); list_remove_data(sdje, NULL, en->data); diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -669,7 +669,7 @@ rel_optimizer_one(mvc *sql, sql_rel *rel .has_special_modify = rel && is_modify(rel->op) && rel->flag&UPD_COMP}; visitor v = { .sql = sql, .value_based_opt = value_based_opt, .storage_based_opt = storage_based_opt, .changes = 1, .data = &gp }; - sql->runs = !(ATOMIC_GET(&GDKdebug) & FORCEMITOMASK) && profile ? sa_zalloc(sql->sa, NSQLREWRITERS * sizeof(sql_optimizer_run)) : NULL; + sql->runs = !(ATOMIC_GET(&GDKdebug) & TESTINGMASK) && profile ? sa_zalloc(sql->sa, NSQLREWRITERS * sizeof(sql_optimizer_run)) : NULL; for ( ;rel && gp.opt_cycle < 20 && v.changes; gp.opt_cycle++) { v.changes = 0; gp = (global_props) {.cnt = {0}, .instantiate = (uint8_t)instantiate, .opt_cycle = gp.opt_cycle, .has_special_modify = gp.has_special_modify}; diff --git a/sql/storage/store.c b/sql/storage/store.c --- a/sql/storage/store.c +++ b/sql/storage/store.c @@ -2452,7 +2452,7 @@ store_manager(sqlstore *store) MT_lock_set(&store->flush); for (;;) { - const int idle = ATOMIC_GET(&GDKdebug) & FORCEMITOMASK ? 5000 : IDLE_TIME * 1000000; + const int idle = ATOMIC_GET(&GDKdebug) & TESTINGMASK ? 5000 : IDLE_TIME * 1000000; /* if debug bit 1024 is set, attempt immediate log activation * and clear the bit */ if (store->debug&(128|1024) || ATOMIC_GET(&store->lastactive) + idle < (ATOMIC_BASE_TYPE) GDKusec()) { @@ -4113,7 +4113,7 @@ sql_trans_commit(sql_trans *tr) const bool log = !tr->parent && tr->logchanges > 0; if (log) { - const lng min_changes = ATOMIC_GET(&GDKdebug) & FORCEMITOMASK ? 5 : 1000000; + const lng min_changes = ATOMIC_GET(&GDKdebug) & TESTINGMASK ? 5 : 1000000; flush = (tr->logchanges > min_changes && list_empty(store->changes)); } diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in --- a/testing/Mtest.py.in +++ b/testing/Mtest.py.in @@ -2715,13 +2715,13 @@ class ServerClass: self.outfile.flush() self.errfile.flush() + cmd = self.cmd if procdebug: - print('LaunchIt: starting process "%s" (inpipe)\n' % '" "'.join(self.cmd)) + print('LaunchIt: starting process "%s" (inpipe)\n' % '" "'.join(cmd)) setpgrp = True stdin = open(os.devnull) stdout = self.outfile stderr = self.errfile - cmd = self.cmd if self.inmem: stdout = process.PIPE elif self.pollfile: @@ -2731,7 +2731,7 @@ class ServerClass: pass if self.dbg: stdin = stdout = stderr = None - cmd = splitcommand(self.dbg) + self.cmd + cmd = splitcommand(self.dbg) + cmd else: stdout = process.PIPE if os.name == "nt": @@ -3337,7 +3337,7 @@ if THISFILE == 'Mz.py': produce_html = False verbosity == 0 THISPATH = os.path.realpath(os.path.dirname(sys.argv[0])) -TSTDBG = str(2+8) +TSTDBG = "2" TSTTHREADS = "0" dftTSTPREF = "mTests" TSTSUFF = "Tests" _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org