Changeset: 6b48b7e30b70 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/6b48b7e30b70
Branch: iso
Log Message:
Merged with Jul2021
diffs (truncated from 413 to 300 lines):
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1559,10 +1559,10 @@ gdk_export BBPrec *BBP[N_BBPINIT];
#define BBPvalid(i) (BBP_logical(i) != NULL && *BBP_logical(i) != '.')
/* macros that nicely check parameters */
-#define BBPstatus(i) (BBPcheck((i),"BBPstatus")?BBP_status(i):0)
-#define BBPrefs(i) (BBPcheck((i),"BBPrefs")?BBP_refs(i):-1)
-#define BBPcache(i) (BBPcheck((i),"BBPcache")?BBP_cache(i):(BAT*) NULL)
-#define BBPname(i) (BBPcheck((i), "BBPname") ? BBP_logical(i) : "")
+#define BBPstatus(i) (BBPcheck(i) ? BBP_status(i) : 0)
+#define BBPrefs(i) (BBPcheck(i) ? BBP_refs(i) : -1)
+#define BBPcache(i) (BBPcheck(i) ? BBP_cache(i) : (BAT*) NULL)
+#define BBPname(i) (BBPcheck(i) ? BBP_logical(i) : "")
#define BBPRENAME_ALREADY (-1)
#define BBPRENAME_ILLEGAL (-2)
@@ -1966,13 +1966,13 @@ gdk_export void *THRdata[THREADDATA];
#define THRset_errbuf(t,b) (t->data[2] = b)
static inline bat
-BBPcheck(bat x, const char *y)
+BBPcheck(bat x)
{
if (!is_bat_nil(x)) {
assert(x > 0);
if (x < 0 || x >= getBBPsize() || BBP_logical(x) == NULL) {
- TRC_DEBUG(CHECK_, "%s: range error %d\n", y, (int) x);
+ TRC_DEBUG(CHECK_, "range error %d\n", (int) x);
} else {
return x;
}
@@ -1985,7 +1985,7 @@ BATdescriptor(bat i)
{
BAT *b = NULL;
- if (BBPcheck(i, "BATdescriptor")) {
+ if (BBPcheck(i)) {
if (BBPfix(i) <= 0)
return NULL;
b = BBP_cache(i);
diff --git a/gdk/gdk_atoms.c b/gdk/gdk_atoms.c
--- a/gdk/gdk_atoms.c
+++ b/gdk/gdk_atoms.c
@@ -595,7 +595,7 @@ batToStr(char **dst, size_t *len, const
size_t i;
str s;
- if (is_bat_nil(b) || (s = BBPname(b)) == NULL || *s == 0) {
+ if (is_bat_nil(b) || !BBPcheck(b) || (s = BBP_logical(b)) == NULL || *s
== 0) {
atommem(4);
if (external) {
strcpy(*dst, "nil");
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -1644,8 +1644,8 @@ BATappend_or_update(BAT *b, BAT *p, cons
}
bat_iterator_end(&ni);
TRC_DEBUG(ALGO,
- "BATreplace(" ALGOBATFMT "," ALGOBATFMT "," ALGOBATFMT ") "
LLFMT " usec\n",
- ALGOBATPAR(b), ALGOBATPAR(p), ALGOBATPAR(n),
+ "BATreplace(" ALGOBATFMT "," ALGOOPTBATFMT "," ALGOBATFMT ")
" LLFMT " usec\n",
+ ALGOBATPAR(b), ALGOOPTBATPAR(p), ALGOBATPAR(n),
GDKusec() - t0);
return GDK_SUCCEED;
}
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -1570,12 +1570,11 @@ BBPdir_init(void)
void
BBPdump(void)
{
- bat i;
size_t mem = 0, vm = 0;
size_t cmem = 0, cvm = 0;
int n = 0, nc = 0;
- for (i = 0; i < (bat) ATOMIC_GET(&BBPsize); i++) {
+ for (bat i = 0; i < (bat) ATOMIC_GET(&BBPsize); i++) {
if (BBP_refs(i) == 0 && BBP_lrefs(i) == 0)
continue;
BAT *b = BBP_desc(i);
@@ -1590,6 +1589,10 @@ BBPdump(void)
BBP_lrefs(i),
status,
BBP_cache(i) ? "" : " not cached");
+ if (b == NULL) {
+ fprintf(stderr, ", no descriptor\n");
+ continue;
+ }
if (b->batSharecnt > 0)
fprintf(stderr, " shares=%d", b->batSharecnt);
if (b->batDirtydesc)
@@ -1888,7 +1891,7 @@ BBPinsert(BAT *bn)
if (len == -1 || len >= FILENAME_MAX)
return 0;
- TRC_DEBUG(BAT_, "%d = new %s(%s)\n", (int) i, BBPname(i),
ATOMname(bn->ttype));
+ TRC_DEBUG(BAT_, "%d = new %s(%s)\n", (int) i, BBP_logical(i),
ATOMname(bn->ttype));
}
return i;
@@ -1941,14 +1944,14 @@ BBPuncacheit(bat i, bool unloaddesc)
{
if (i < 0)
i = -i;
- if (BBPcheck(i, "BBPuncacheit")) {
+ if (BBPcheck(i)) {
BAT *b = BBP_desc(i);
assert(unloaddesc || BBP_refs(i) == 0);
if (b) {
if (BBP_cache(i)) {
- TRC_DEBUG(BAT_, "uncache %d (%s)\n", (int) i,
BBPname(i));
+ TRC_DEBUG(BAT_, "uncache %d (%s)\n", (int) i,
BBP_logical(i));
BBP_cache(i) = NULL;
@@ -1970,7 +1973,7 @@ BBPuncacheit(bat i, bool unloaddesc)
static inline void
bbpclear(bat i, int idx, bool lock)
{
- TRC_DEBUG(BAT_, "clear %d (%s)\n", (int) i, BBPname(i));
+ TRC_DEBUG(BAT_, "clear %d (%s)\n", (int) i, BBP_logical(i));
BBPuncacheit(i, true);
TRC_DEBUG(BAT_, "set to unloading %d\n", i);
BBP_status_set(i, BBPUNLOADING);
@@ -2000,7 +2003,7 @@ BBPclear(bat i)
MT_Id pid = MT_getpid();
bool lock = locked_by == 0 || locked_by != pid;
- if (BBPcheck(i, "BBPclear")) {
+ if (BBPcheck(i)) {
bbpclear(i, threadmask(pid), lock);
}
}
@@ -2118,7 +2121,7 @@ BBPrename(bat bid, const char *nme)
static inline void
BBPspin(bat i, const char *s, unsigned event)
{
- if (BBPcheck(i, "BBPspin") && (BBP_status(i) & event)) {
+ if (BBPcheck(i) && (BBP_status(i) & event)) {
lng spin = LL_CONSTANT(0);
do {
@@ -2156,7 +2159,7 @@ incref(bat i, bool logical, bool lock)
BAT *b, *pb = NULL, *pvb = NULL;
bool load = false;
- if (!BBPcheck(i, logical ? "BBPretain" : "BBPfix"))
+ if (!BBPcheck(i))
return 0;
/* Before we get the lock and before we do all sorts of
@@ -2297,7 +2300,7 @@ decref(bat i, bool logical, bool release
MT_lock_set(&GDKswapLock(i));
if (releaseShare) {
if (BBP_desc(i)->batSharecnt == 0) {
- GDKerror("%s: %s does not have any shares.\n", func,
BBPname(i));
+ GDKerror("%s: %s does not have any shares.\n", func,
BBP_logical(i));
assert(0);
} else {
--BBP_desc(i)->batSharecnt;
@@ -2320,14 +2323,14 @@ decref(bat i, bool logical, bool release
/* decrement references by one */
if (logical) {
if (BBP_lrefs(i) == 0) {
- GDKerror("%s: %s does not have logical references.\n",
func, BBPname(i));
+ GDKerror("%s: %s does not have logical references.\n",
func, BBP_logical(i));
assert(0);
} else {
refs = --BBP_lrefs(i);
}
} else {
if (BBP_refs(i) == 0) {
- GDKerror("%s: %s does not have pointer fixes.\n", func,
BBPname(i));
+ GDKerror("%s: %s does not have pointer fixes.\n", func,
BBP_logical(i));
assert(0);
} else {
assert(b == NULL || b->theap == NULL ||
BBP_refs(b->theap->parentid) > 0);
@@ -2359,8 +2362,7 @@ decref(bat i, bool logical, bool release
(BBP_lrefs(i) > 0 &&
(b == NULL ||
BATdirty(b) ||
- (BBP_status(i) & BBPHOT) ||
- (BBP_status(i) & BBPSYNCING) ||
+ (BBP_status(i) & (BBPHOT | BBPSYNCING)) ||
!(BBP_status(i) & BBPPERSISTENT) ||
GDKinmemory(b->theap->farmid)))) {
/* bat cannot be swapped out */
@@ -2402,7 +2404,7 @@ decref(bat i, bool logical, bool release
int
BBPunfix(bat i)
{
- if (BBPcheck(i, "BBPunfix") == 0) {
+ if (BBPcheck(i) == 0) {
return -1;
}
return decref(i, false, false, true, "BBPunfix");
@@ -2411,7 +2413,7 @@ BBPunfix(bat i)
int
BBPrelease(bat i)
{
- if (BBPcheck(i, "BBPrelease") == 0) {
+ if (BBPcheck(i) == 0) {
return -1;
}
return decref(i, true, false, true, "BBPrelease");
@@ -2427,9 +2429,7 @@ BBPrelease(bat i)
void
BBPkeepref(bat i)
{
- if (is_bat_nil(i))
- return;
- if (BBPcheck(i, "BBPkeepref")) {
+ if (BBPcheck(i)) {
bool lock = locked_by == 0 || locked_by != MT_getpid();
BAT *b;
@@ -2495,7 +2495,7 @@ getBBPdescriptor(bat i, bool lock)
BAT *b = NULL;
assert(i > 0);
- if (!BBPcheck(i, "BBPdescriptor")) {
+ if (!BBPcheck(i)) {
GDKerror("BBPcheck failed for bat id %d\n", i);
return NULL;
}
@@ -2523,7 +2523,7 @@ getBBPdescriptor(bat i, bool lock)
if (lock)
MT_lock_unset(&GDKswapLock(i));
if (load) {
- TRC_DEBUG(IO_, "load %s\n", BBPname(i));
+ TRC_DEBUG(IO_, "load %s\n", BBP_logical(i));
b = BATload_intern(i, lock);
@@ -2698,11 +2698,11 @@ BBPquickdesc(bat bid, bool delaccess)
{
BAT *b;
- if (is_bat_nil(bid))
- return NULL;
- if (bid < 0) {
- GDKerror("called with negative batid.\n");
- assert(0);
+ if (!BBPcheck(bid)) {
+ if (!is_bat_nil(bid)) {
+ GDKerror("called with invalid batid.\n");
+ assert(0);
+ }
return NULL;
}
if ((b = BBP_cache(bid)) != NULL)
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1475,7 +1475,7 @@ bm_subcommit(logger *lg)
if (lids && lids[p] != lng_nil && lids[p] <= lg->saved_tid)
cleanup++;
if (lg->debug & 1)
- fprintf(stderr, "#commit new %s (%d)\n", BBPname(col),
col);
+ fprintf(stderr, "#commit new %s (%d)\n",
BBP_logical(col), col);
assert(col);
sizes[i] = cnts?(BUN)cnts[p]:0;
n[i++] = col;
diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -772,7 +772,7 @@ BATsave_locked(BAT *bd)
/* views cannot be saved, but make an exception for
* force-remapped views */
if (isVIEW(bd)) {
- GDKerror("%s is a view on %s; cannot be saved\n", BATgetId(bd),
BBPname(VIEWtparent(bd)));
+ GDKerror("%s is a view on %s; cannot be saved\n", BATgetId(bd),
BBP_logical(VIEWtparent(bd)));
return GDK_FAIL;
}
if (!BATdirty(bd)) {
diff --git a/monetdb5/mal/mal_debugger.c b/monetdb5/mal/mal_debugger.c
--- a/monetdb5/mal/mal_debugger.c
+++ b/monetdb5/mal/mal_debugger.c
@@ -89,7 +89,7 @@ printBATproperties(stream *f, BAT *b)
if (b->batSharecnt)
mnstr_printf(f, " views=%d", b->batSharecnt);
if (b->theap->parentid != b->batCacheid)
- mnstr_printf(f, "view on %s ", BBPname(b->theap->parentid));
+ mnstr_printf(f, "view on %s ", BBP_logical(b->theap->parentid));
}
static void
@@ -1091,7 +1091,7 @@ retryRead:
/* watchout, you don't want to wait for locks
by others */
mnstr_printf(out, "BBP contains %d entries\n",
limit);
for (; i < limit; i++)
- if ((BBP_lrefs(i) || BBP_refs(i)) &&
BBP_cache(i)) {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list