Changeset: 2b201ed25477 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2b201ed25477 Modified Files: gdk/gdk_bbp.c Branch: Feb2013 Log Message:
Tell BBPextend and BBPinithash which free list should really get an entry. When BBPextend is called from BBPinsert, we need a free entry in the free list identified by idx. If we don't pass this idx to BBPinithash which initializes the free lists, we may well end up with an empty free list and then a failed assertion a few lines down in BBPinsert. diffs (72 lines): diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -287,11 +287,11 @@ BBPunlock(const char *nme) static void -BBPinithash(void) +BBPinithash(int j) { bat i = BBPsize; - int j = 0; - + + assert(j >= 0 && j <= BBP_THREADMASK); for (BBP_mask = 1; (BBP_mask << 1) <= BBPlimit; BBP_mask <<= 1) ; BBP_hash = (bat *) GDKzalloc(BBP_mask * sizeof(bat)); @@ -326,7 +326,7 @@ BBPinithash(void) * BBPtrim, causing deadlock. */ static void -BBPextend(int buildhash) +BBPextend(int idx, int buildhash) { BBP_notrim = MT_getpid(); @@ -350,7 +350,7 @@ BBPextend(int buildhash) BBP_hash = NULL; for (i = 0; i <= BBP_THREADMASK; i++) BBP_free(i) = 0; - BBPinithash(); + BBPinithash(idx); } BBP_notrim = 0; } @@ -836,7 +836,7 @@ BBPreadEntries(FILE *fp, int *min_stamp, if ((bat) batid >= BBPsize) { BBPsize = (bat) batid + 1; if (BBPsize >= BBPlimit) - BBPextend(FALSE); + BBPextend(0, FALSE); } if (BBP_desc(bid) != NULL) GDKfatal("BBPinit: duplicate entry in BBP.dir."); @@ -1012,7 +1012,7 @@ BBPinit(void) bbpversion = BBPheader(fp, &BBPoid, &oidsize); - BBPextend(0); /* allocate BBP records */ + BBPextend(0, FALSE); /* allocate BBP records */ BBPsize = 1; BBPreadEntries(fp, &min_stamp, &max_stamp, oidsize, bbpversion); @@ -1026,7 +1026,7 @@ BBPinit(void) BBPsetstamp(max_stamp - min_stamp); } - BBPinithash(); + BBPinithash(0); BBP_notrim = 0; OIDbase(BBPoid); @@ -1650,7 +1650,7 @@ BBPinsert(BATstore *bs) * while we were waiting */ if (BBP_free(idx) <= 0) { if (BBPsize++ >= BBPlimit) { - BBPextend(TRUE); + BBPextend(idx, TRUE); } else { BBP_free(idx) = BBPsize - 1; } _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list