Changeset: 014d39a54490 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/014d39a54490 Modified Files: sql/storage/store.c Branch: transaction_layer_revamp Log Message:
merge with default diffs (truncated from 425510 to 300 lines): diff --git a/clients/examples/perl/malsample.pl b/clients/examples/perl/malsample.pl --- a/clients/examples/perl/malsample.pl +++ b/clients/examples/perl/malsample.pl @@ -8,14 +8,6 @@ # # Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V. -# SPDX-License-Identifier: MPL-2.0 -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V. - use strict; use warnings; use DBI(); diff --git a/clients/examples/perl/sqlsample.pl b/clients/examples/perl/sqlsample.pl --- a/clients/examples/perl/sqlsample.pl +++ b/clients/examples/perl/sqlsample.pl @@ -8,14 +8,6 @@ # # Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V. -# SPDX-License-Identifier: MPL-2.0 -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V. - use strict; use warnings; use DBI(); diff --git a/common/stream/memio.c b/common/stream/memio.c --- a/common/stream/memio.c +++ b/common/stream/memio.c @@ -63,7 +63,6 @@ buffer_get_buf(buffer *b) b->buf = r; return NULL; } - b->len = b->buf ? b->len : 0; b->pos = 0; return r; } diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -3705,7 +3705,7 @@ gdk_return BBPsync(int cnt, bat *restrict subcommit, BUN *restrict sizes, lng logno, lng transid) { gdk_return ret = GDK_SUCCEED; - int t0 = 0, t1 = 0; + lng t0 = 0, t1 = 0; str bakdir, deldir; const bool lock = locked_by == 0 || locked_by != MT_getpid(); char buf[3000]; @@ -3719,7 +3719,7 @@ BBPsync(int cnt, bat *restrict subcommit return GDK_FAIL; } - TRC_DEBUG_IF(PERF) t0 = t1 = GDKms(); + TRC_DEBUG_IF(PERF) t0 = t1 = GDKusec(); ret = BBPprepare(subcommit != NULL); @@ -3767,7 +3767,7 @@ BBPsync(int cnt, bat *restrict subcommit if (idx < cnt) ret = GDK_FAIL; } - TRC_DEBUG(PERF, "move time %d, %d files\n", (t1 = GDKms()) - t0, backup_files); + TRC_DEBUG(PERF, "move time "LLFMT" usec, %d files\n", (t1 = GDKusec()) - t0, backup_files); /* PHASE 2: save the repository and write new BBP.dir file */ if (ret == GDK_SUCCEED) { @@ -3831,13 +3831,13 @@ BBPsync(int cnt, bat *restrict subcommit } } - TRC_DEBUG(PERF, "write time %d\n", (t0 = GDKms()) - t1); + TRC_DEBUG(PERF, "write time "LLFMT" usec\n", (t0 = GDKusec()) - t1); if (ret == GDK_SUCCEED) { ret = BBPdir_last(n, buf, sizeof(buf), obbpf, nbbpf); } - TRC_DEBUG(PERF, "dir time %d, %d bats\n", (t1 = GDKms()) - t0, (bat) ATOMIC_GET(&BBPsize)); + TRC_DEBUG(PERF, "dir time "LLFMT" usec, %d bats\n", (t1 = GDKusec()) - t0, (bat) ATOMIC_GET(&BBPsize)); if (ret == GDK_SUCCEED) { /* atomic switchover */ @@ -3873,9 +3873,9 @@ BBPsync(int cnt, bat *restrict subcommit backup_files = 1; } } - TRC_DEBUG(PERF, "%s (ready time %d)\n", + TRC_DEBUG(PERF, "%s (ready time "LLFMT" usec)\n", ret == GDK_SUCCEED ? "" : " failed", - (t0 = GDKms()) - t1); + (t0 = GDKusec()) - t1); /* turn off the BBPSYNCING bits for all bats, even when things * didn't go according to plan (i.e., don't check for ret == diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c --- a/gdk/gdk_heap.c +++ b/gdk/gdk_heap.c @@ -745,7 +745,7 @@ HEAPload_intern(Heap *h, const char *nme size_t minsize; int ret = 0; char *srcpath, *dstpath; - int t0; + lng t0; if (h->storage == STORE_INVALID || h->newstorage == STORE_INVALID) { size_t allocated; @@ -802,11 +802,11 @@ HEAPload_intern(Heap *h, const char *nme } strconcat_len(srcpath, minsize, dstpath, suffix, NULL); - t0 = GDKms(); + t0 = GDKusec(); ret = MT_rename(srcpath, dstpath); - TRC_DEBUG(HEAP, "rename %s %s = %d %s (%dms)\n", + TRC_DEBUG(HEAP, "rename %s %s = %d %s ("LLFMT"usec)\n", srcpath, dstpath, ret, ret < 0 ? GDKstrerror(errno, (char[128]){0}, 128) : "", - GDKms() - t0); + GDKusec() - t0); GDKfree(srcpath); GDKfree(dstpath); diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c --- a/gdk/gdk_storage.c +++ b/gdk/gdk_storage.c @@ -326,7 +326,8 @@ GDKmove(int farmid, const char *dir1, co { char *path1; char *path2; - int ret, t0 = GDKms(); + int ret; + lng t0 = GDKusec(); if (nme1 == NULL || *nme1 == 0) { GDKerror("no file specified\n"); @@ -339,7 +340,7 @@ GDKmove(int farmid, const char *dir1, co if (ret < 0 && report) GDKsyserror("cannot rename %s to %s\n", path1, path2); - TRC_DEBUG(IO_, "Move %s %s = %d (%dms)\n", path1, path2, ret, GDKms() - t0); + TRC_DEBUG(IO_, "Move %s %s = %d ("LLFMT" usec)\n", path1, path2, ret, GDKusec() - t0); } else { ret = -1; } @@ -353,7 +354,7 @@ GDKextendf(int fd, size_t size, const ch { struct stat stb; int rt = 0; - int t0 = GDKms(); + lng t0 = GDKusec(); assert(!GDKinmemory(0)); #ifdef __COVERITY__ @@ -397,9 +398,9 @@ GDKextendf(int fd, size_t size, const ch GDKsyserror("ftruncate to old size"); } } - TRC_DEBUG(IO_, "GDKextend %s %zu -> %zu %dms%s\n", + TRC_DEBUG(IO_, "GDKextend %s %zu -> %zu "LLFMT" usec%s\n", fn, (size_t) stb.st_size, size, - GDKms() - t0, rt != 0 ? " (failed)" : ""); + GDKusec() - t0, rt != 0 ? " (failed)" : ""); /* posix_fallocate returns != 0 on failure, fallocate and * ftruncate return -1 on failure, but all three return 0 on * success */ diff --git a/gdk/gdk_system.h b/gdk/gdk_system.h --- a/gdk/gdk_system.h +++ b/gdk/gdk_system.h @@ -207,8 +207,10 @@ gdk_export void MT_thread_set_qry_ctx(Qr /* define this to keep track of which locks a thread has acquired */ #ifndef NDEBUG /* normally only in debug builds */ +#ifndef __COVERITY__ #define LOCK_OWNER 1 #endif +#endif #ifndef LOCK_OWNER #define MT_thread_add_mylock(l) ((void) 0) @@ -469,7 +471,7 @@ typedef struct MT_Lock { #define MT_lock_set(l) \ do { \ _DBG_LOCK_COUNT_0(l); \ - if (!MT_lock_try(l)) { \ + if (pthread_mutex_trylock(&(l)->lock) { \ _DBG_LOCK_CONTENTION(l); \ MT_thread_setlockwait(l); \ pthread_mutex_lock(&(l)->lock); \ diff --git a/monetdb5/mal/Tests/msk000.malC b/monetdb5/mal/Tests/msk000.malC deleted file mode 100644 --- a/monetdb5/mal/Tests/msk000.malC +++ /dev/null @@ -1,75 +0,0 @@ -# scalar tests for msk-type -# the msk type only know true/false, nil is mapped to false - -function foo(); -t := true:msk; -io.print(t); -f := false:msk; -io.print(f); -n := nil:msk; -io.print(n); - -# Coercions should be chosen carefully -# One way is to align it with 0/1 -ti:msk := 1:msk; -io.print(ti); -fi:msk := 0:msk; -io.print(fi); - -tl:= 1:lng; -fl:= 0:lng; -t:msk := tl:msk; -io.print(t); -f:msk := fl:msk; -io.print(f); - -tsv:= 1:sht; -fsv:= 0:bit; -t:msk := tsv:msk; -io.print(t); -f:msk := fsv:msk; -io.print(f); - -tbv:= 1:bit; -fbv:= 0:bit; -t:msk := tbv:msk; -io.print(t); -f:msk := fbv:msk; -io.print(f); - -tfv:= 1:flt; -ffv:= 0:flt; -t:msk := calc.msk(tfv); -io.print(t); -f:msk := calc.msk(ffv); -io.print(f); - -# perhaps case incensitive -t:msk := "t":msk; -io.print(t); -f:msk := "f":msk; -io.print(f); - -t:msk := "T":msk; -io.print(t); -f:msk := "F":msk; -io.print(f); - -t:msk := "true":msk; -io.print(t); -f:msk := "false":msk; -io.print(f); -end foo; - -# the following examples all should cause errors -function error1(); -n:msk := nil:msk; -end error1; - -function error2(); -n:msk := calc.msk(nil); -end error2; - -foo(); -error1(); -error2(); diff --git a/monetdb5/mal/Tests/msk001.malC b/monetdb5/mal/Tests/msk001.malC deleted file mode 100644 --- a/monetdb5/mal/Tests/msk001.malC +++ /dev/null @@ -1,20 +0,0 @@ -# create a simple MSK BAT by appending values -# The MSK should behave like any other BAT although it only holds values from {0,1} - -bv1:= bat.new(:msk); -bat.append(bv1,1:msk); -bat.append(bv1,1:msk); -bat.append(bv1,0:msk); -bat.append(bv1,1:msk); - -io.print(bv1); # this should produce (1,1,0,1) - -# select all elements that are not set -cnd:bat[:oid]:= algebra.select(bv1, nil:bat[:oid], 0, 0, true, true, false); - -io.print(f); # returns 2@0:oid - -# select operations can also return a MASK _______________________________________________ checkin-list mailing list -- [email protected] To unsubscribe send an email to [email protected]
