Changeset: e534cf5cb97a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e534cf5cb97a
Modified Files:
gdk/gdk_join.c
Branch: default
Log Message:
Merge with Dec2025 branch.
diffs (104 lines):
diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -3677,6 +3677,20 @@ joincost(BAT *r, BUN lcount, struct cand
if (rhash) {
/* average chain length */
rcost *= (double) cnt / nheads;
+ /* If the hash exists, but the working set
+ * exceeds physical RAM, random-access probes
+ * will cause massive page fault thrashing.
+ * Multiply the probe cost by an I/O latency
+ * factor to encourage swapping to a sequential
+ * scan instead. */
+ if (!GDKinmemory(r->theap->farmid) &&
+ (size_t)cnt * ATOMsize(r->ttype) + (r->tvheap ?
r->tvheap->free : 0) > GDK_mem_maxsize / 4) {
+ /* Disk random access is ~100x to 1000x
+ * slower than RAM. A 100x penalty
+ * forces the optimizer to treat these
+ * probes as highly toxic. */
+ rcost *= 100.0;
+ }
} else if ((parent = VIEWtparent(r)) != 0 &&
(b = BATdescriptor(parent)) != NULL) {
if (BATcheckhash(b)) {
@@ -3705,7 +3719,12 @@ joincost(BAT *r, BUN lcount, struct cand
/* only count the cost of creating the hash for
* non-persistent bats */
MT_lock_set(&r->theaplock);
- if (r->batRole != PERSISTENT /* || r->theap->dirty */
|| GDKinmemory(r->theap->farmid))
+ /* If the BAT is persistent but so large that
+ * building a hash might thrash memory, consider
+ * it very expensive, so encourage choosing a
+ * linear scan of this side instead. */
+ if (r->batRole != PERSISTENT /* || r->theap->dirty */
|| GDKinmemory(r->theap->farmid) ||
+ (size_t)cnt * ATOMsize(r->ttype) + (r->tvheap ?
r->tvheap->free : 0) > GDK_mem_maxsize / 4)
rcost += cnt * 2.0;
MT_lock_unset(&r->theaplock);
}
diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -49,6 +49,7 @@ mserver5_opts = []
global_timeout = 0
start_time = time.time()
test_progress = 0
+test_errors = 0
# whether output goes to a tty
isatty = os.isatty(sys.stdout.fileno())
@@ -1045,6 +1046,7 @@ def find_test_dirs(thisdir, recursive=Tr
def PerformDir(env, testdir, testlist, total_tests):
global test_progress
+ global test_errors
interrupted = False
td = time.time()
elem = None
@@ -1272,6 +1274,7 @@ def PerformDir(env, testdir, testlist, t
tt, FtOut, FtErr, bodyline, reason, links = RunTest(env,
TST, COND, oktests, length, pSrvr, total_tests, options, environ, TSTDB,
TSTDIR, TSTSRCDIR, RELSRCDIR, TSTTRGDIR)
alllinks.extend(links)
TIMES.append((TSTDIR, TST, tt, FtOut, FtErr, reason))
+ test_errors += (FtOut > F_WARN) or (FtErr > F_WARN)
FdOut = max(FdOut,FtOut)
FdErr = max(FdErr,FtErr)
if bodyline is not None:
@@ -3015,7 +3018,10 @@ def mapi_ping(port, host='localhost', tr
threadids = {}
up = '\033[A'
down = '\033[B'
-def progress(count, total, test, spaces=' '*(ttywidth or 100)):
+
+
+def progress(count, errors, total, test, spaces=' '*(ttywidth or 100)):
+ errs = ''
if os.name == 'nt':
nl = ''
line = 0
@@ -3025,21 +3031,23 @@ def progress(count, total, test, spaces=
if tid not in threadids:
threadids[tid] = len(threadids)
nl = '\n'
- line = len(threadids) - threadids[tid] - 1
+ line = len(threadids) - threadids[tid]
+ if errors:
+ errs = f'\r{errors} errors'
perc = int(count*100/total) if total and count else 0
width = len(str(total))
s = f'[{count:{width}}/{total}] ({perc:2}%) {test}'
if len(s) > ttywidth:
test = test[len(s)-ttywidth:]
s = f'[{count:{width}}/{total}] ({perc:2}%) {test}'
- sys.stdout.write(nl + '\r' + up*line + spaces + '\r' + s + down*line)
+ sys.stdout.write(nl + '\r' + up*line + spaces + '\r' + s + down*line +
errs)
def DoIt(env, SERVER, CALL, TST, EXT, TestOutFile, TestErrFile, TIMEOUT, ME,
length, nomito, threads, user, passwd, COND, PSRVR, total_tests, options,
TSTDB, TSTDIR, TSTTRGDIR, TSTSRCDIR, environ):
ATJOB2 = ''
print(file=sys.stderr, end='', flush=True)
if not verbose:
- progress(test_progress, total_tests, os.path.join(TSTDIR, TST + EXT))
+ progress(test_progress, test_errors, total_tests, os.path.join(TSTDIR,
TST + EXT))
else:
if ttywidth > 0 and length + 10 + 21 >= ttywidth:
# 10 - length of prompt()
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]