Changeset: 55d3b70db4d9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/55d3b70db4d9
Modified Files:
gdk/gdk.h
gdk/gdk_bbp.c
sql/storage/bat/bat_logger.c
Branch: default
Log Message:
Remove columns for heap size and bat capacity from BBP.dir.
Good values for these can be derived.
diffs (213 lines):
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -758,8 +758,9 @@ typedef struct {
#define GDKLIBRARY_MINMAX_POS 061042U /* first in Nov2019: no min/max
position; no BBPinfo value */
#define GDKLIBRARY_TAILN 061043U /* first in Jul2021: str offset heaps
names don't take width into account */
#define GDKLIBRARY_HASHASH 061044U /* first in Jul2021: hashash bit in
string heaps */
+#define GDKLIBRARY_HSIZE 061045U /* first in Jan2022: heap "size" values
*/
/* if the version number is updated, also fix snapshot_bats() in bat_logger.c
*/
-#define GDKLIBRARY 061045U /* first after Jul2021 */
+#define GDKLIBRARY 061046U /* first after Jan2022 */
typedef struct BAT {
/* static bat properties */
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -443,6 +443,8 @@ heapinit(BAT *b, const char *buf,
(void) bbpversion; /* could be used to implement compatibility */
minpos = maxpos = (uint64_t) oid_nil; /* for GDKLIBRARY_MINMAX_POS case
*/
+ size = 0; /* for GDKLIBRARY_HSIZE case */
+ storage = STORE_INVALID; /* for GDKLIBRARY_HSIZE case */
if (bbpversion <= GDKLIBRARY_MINMAX_POS ?
sscanf(buf,
" %10s %" SCNu16 " %" SCNu16 " %" SCNu16 " %" SCNu64
@@ -453,6 +455,7 @@ heapinit(BAT *b, const char *buf,
&nokey1, &nosorted, &norevsorted, &base,
&free, &size, &storage,
&n) < 12 :
+ bbpversion <= GDKLIBRARY_HSIZE ?
sscanf(buf,
" %10s %" SCNu16 " %" SCNu16 " %" SCNu16 " %" SCNu64
" %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64
@@ -461,7 +464,16 @@ heapinit(BAT *b, const char *buf,
type, &width, &var, &properties, &nokey0,
&nokey1, &nosorted, &norevsorted, &base,
&free, &size, &storage, &minpos, &maxpos,
- &n) < 14) {
+ &n) < 14 :
+ sscanf(buf,
+ " %10s %" SCNu16 " %" SCNu16 " %" SCNu16 " %" SCNu64
+ " %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64
+ " %" SCNu64 " %" SCNu64 " %" SCNu64
+ "%n",
+ type, &width, &var, &properties, &nokey0,
+ &nokey1, &nosorted, &norevsorted, &base,
+ &free, &minpos, &maxpos,
+ &n) < 12) {
TRC_CRITICAL(GDK, "invalid format for BBP.dir on line %d",
lineno);
return -1;
}
@@ -542,17 +554,26 @@ heapinit(BAT *b, const char *buf,
}
static int
-vheapinit(BAT *b, const char *buf, bat bid, const char *filename, int lineno)
+vheapinit(BAT *b, const char *buf, bat bid, unsigned bbpversion, const char
*filename, int lineno)
{
int n = 0;
uint64_t free, size;
uint16_t storage;
+ (void) bbpversion; /* could be used to implement compatibility */
+
+ size = 0; /* for GDKLIBRARY_HSIZE case */
+ storage = STORE_INVALID; /* for GDKLIBRARY_HSIZE case */
if (b->tvarsized && b->ttype != TYPE_void) {
- if (sscanf(buf,
+ if (bbpversion <= GDKLIBRARY_HSIZE ?
+ sscanf(buf,
" %" SCNu64 " %" SCNu64 " %" SCNu16
"%n",
- &free, &size, &storage, &n) < 3) {
+ &free, &size, &storage, &n) < 3 :
+ sscanf(buf,
+ " %" SCNu64
+ "%n",
+ &free, &n) < 1) {
TRC_CRITICAL(GDK, "invalid format for BBP.dir on line
%d", lineno);
return -1;
}
@@ -611,7 +632,7 @@ BBPreadEntries(FILE *fp, unsigned bbpver
int nread, n;
char *s, *options = NULL;
char logical[1024];
- uint64_t count, capacity, base = 0;
+ uint64_t count, capacity = 0, base = 0;
#ifdef GDKLIBRARY_HASHASH
int Thashash;
#endif
@@ -627,14 +648,21 @@ BBPreadEntries(FILE *fp, unsigned bbpver
*s = 0;
}
- if (sscanf(buf,
+ if (bbpversion <= GDKLIBRARY_HSIZE ?
+ sscanf(buf,
"%" SCNu64 " %" SCNu16 " %128s %19s %u %" SCNu64
" %" SCNu64 " %" SCNu64
"%n",
&batid, &status, headname, filename,
- &properties,
- &count, &capacity, &base,
- &nread) < 8) {
+ &properties, &count, &capacity, &base,
+ &nread) < 8 :
+ sscanf(buf,
+ "%" SCNu64 " %" SCNu16 " %128s %19s %u %" SCNu64
+ " %" SCNu64
+ "%n",
+ &batid, &status, headname, filename,
+ &properties, &count, &base,
+ &nread) < 7) {
TRC_CRITICAL(GDK, "invalid format for BBP.dir on line
%d", lineno);
goto bailout;
}
@@ -713,7 +741,7 @@ BBPreadEntries(FILE *fp, unsigned bbpver
goto bailout;
}
nread += n;
- n = vheapinit(bn, buf + nread, bid, filename, lineno);
+ n = vheapinit(bn, buf + nread, bid, bbpversion, filename,
lineno);
if (n < 0) {
BATdestroy(bn);
goto bailout;
@@ -932,6 +960,7 @@ BBPheader(FILE *fp, int *lineno, bat *bb
return 0;
}
if (bbpversion != GDKLIBRARY &&
+ bbpversion != GDKLIBRARY_HSIZE &&
bbpversion != GDKLIBRARY_HASHASH &&
bbpversion != GDKLIBRARY_TAILN &&
bbpversion != GDKLIBRARY_MINMAX_POS) {
@@ -1842,7 +1871,7 @@ heap_entry(FILE *fp, BATiter *bi, BUN si
}
return fprintf(fp, " %s %d %d %d " BUNFMT " " BUNFMT " " BUNFMT " "
- BUNFMT " " OIDFMT " %zu %zu %d %" PRIu64" %" PRIu64,
+ BUNFMT " " OIDFMT " %zu %" PRIu64" %" PRIu64,
bi->type >= 0 ? BATatoms[bi->type].name :
ATOMunknown_name(bi->type),
bi->width,
b->tvarsized,
@@ -1858,8 +1887,6 @@ heap_entry(FILE *fp, BATiter *bi, BUN si
b->tnorevsorted >= size ? 0 : b->tnorevsorted,
b->tseqbase,
free,
- bi->h->size,
- 0,
bi->minpos < b->hseqbase + size ? (uint64_t) bi->minpos
: (uint64_t) oid_nil,
bi->maxpos < b->hseqbase + size ? (uint64_t) bi->maxpos
: (uint64_t) oid_nil);
}
@@ -1884,7 +1911,7 @@ vheap_entry(FILE *fp, BATiter *bi, BUN s
GDKfree(fname);
}
}
- return fprintf(fp, " %zu %zu %d", bi->vhfree, bi->vh->size, 0);
+ return fprintf(fp, " %zu", bi->vhfree);
}
static gdk_return
@@ -1907,7 +1934,7 @@ new_bbpentry(FILE *fp, bat i, BUN size,
if (size > bi->count)
size = bi->count;
- if (fprintf(fp, "%d %u %s %s %d " BUNFMT " " BUNFMT " " OIDFMT,
+ if (fprintf(fp, "%d %u %s %s %d " BUNFMT " " OIDFMT,
/* BAT info */
(int) i,
BBP_status(i) & BBPPERSISTENT,
@@ -1915,7 +1942,6 @@ new_bbpentry(FILE *fp, bat i, BUN size,
BBP_physical(i),
bi->b->batRestricted << 1,
size,
- bi->b->batCapacity,
bi->b->hseqbase) < 0 ||
heap_entry(fp, bi, size) < 0 ||
vheap_entry(fp, bi, size) < 0 ||
diff --git a/sql/storage/bat/bat_logger.c b/sql/storage/bat/bat_logger.c
--- a/sql/storage/bat/bat_logger.c
+++ b/sql/storage/bat/bat_logger.c
@@ -3354,7 +3354,7 @@ snapshot_bats(stream *plan, const char *
GDKerror("Invalid first line of %s", bbpdir);
goto end;
}
- if (gdk_version != 061045U) {
+ if (gdk_version != 061046U) {
// If this version number has changed, the structure of BBP.dir
// may have changed. Update this whole function to take this
// into account.
@@ -3392,16 +3392,16 @@ snapshot_bats(stream *plan, const char *
// were actually present.
int scanned = sscanf(line,
// Taken from the sscanf in BBPreadEntries() in
gdk_bbp.c.
- // 8 fields, we need field 1 (batid) and field
4 (filename)
- "%" SCNu64 " %*s %*s %19s %*s %*s %*s %*s"
+ // 7 fields, we need field 1 (batid) and field
4 (filename)
+ "%" SCNu64 " %*s %*s %19s %*s %*s %*s"
// Taken from the sscanf in heapinit() in
gdk_bbp.c.
- // 14 fields, we need fields 1 (type), 2
(width), 10 (free)
- " %10s %" SCNu16 " %*s %*s %*s %*s %*s %*s %*s
%" SCNu64 " %*s %*s %*s %*s"
+ // 12 fields, we need fields 1 (type), 2
(width), 10 (free)
+ " %10s %" SCNu16 " %*s %*s %*s %*s %*s %*s %*s
%" SCNu64 " %*s %*s"
// Taken from the sscanf in vheapinit() in
gdk_bbp.c.
- // 3 fields, we need field 1 (free).
- "%" SCNu64 " %*s ^*s"
+ // 1 field, we need field 1 (free).
+ "%" SCNu64
,
&batid, filename,
type, &width, &tail_free,
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]