Changeset: 8e0884fcb455 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8e0884fcb455
Modified Files:
gdk/gdk_bbp.c
gdk/gdk_private.h
gdk/gdk_storage.c
Branch: Jun2023
Log Message:
Use filename in heap structure instead of calculating it.
diffs (118 lines):
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -3326,7 +3326,7 @@ dirty_bat(bat *i, bool subcommit)
BATcheckmodes(b, false) != GDK_SUCCEED) /* check
mmap modes */
*i = -*i; /* error */
else if ((BBP_status(*i) & BBPPERSISTENT) &&
- (subcommit || BATdirty(b))) {
+ (subcommit || BATdirty(b))) {
MT_lock_unset(&b->theaplock);
return b; /* the bat is loaded,
persistent and dirty */
}
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -295,28 +295,6 @@ void VIEWdestroy(BAT *b)
BAT *virtualize(BAT *bn)
__attribute__((__visibility__("hidden")));
-static inline const char *
-BATITERtailname(const BATiter *bi)
-{
- if (bi->type == TYPE_str) {
- switch (bi->width) {
- case 1:
- return "tail1";
- case 2:
- return "tail2";
- case 4:
-#if SIZEOF_VAR_T == 8
- return "tail4";
- case 8:
-#endif
- break;
- default:
- MT_UNREACHABLE();
- }
- }
- return "tail";
-}
-
static inline bool
imprintable(int tpe)
{
diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -668,7 +668,6 @@ gdk_return
BATsave_iter(BAT *b, BATiter *bi, BUN size)
{
gdk_return err = GDK_SUCCEED;
- const char *nme;
bool dosync;
bool locked = false;
@@ -694,15 +693,13 @@ BATsave_iter(BAT *b, BATiter *bi, BUN si
}
/* start saving data */
- nme = BBP_physical(b->batCacheid);
- const char *tail = BATITERtailname(bi);
if (bi->type != TYPE_void && bi->base == NULL) {
assert(BBP_status(b->batCacheid) & BBPSWAPPED);
if (dosync && !(ATOMIC_GET(&GDKdebug) & NOSYNCMASK)) {
- int fd = GDKfdlocate(bi->h->farmid, nme, "rb+", tail);
+ int fd = GDKfdlocate(bi->h->farmid, bi->h->filename,
"rb+", NULL);
if (fd < 0) {
- GDKsyserror("cannot open file %s.%s for sync\n",
- nme, tail);
+ GDKsyserror("cannot open file %s for sync\n",
+ bi->h->filename);
err = GDK_FAIL;
} else {
if (
@@ -714,15 +711,15 @@ BATsave_iter(BAT *b, BATiter *bi, BUN si
fsync(fd) < 0
#endif
)
- GDKsyserror("sync failed for %s.%s\n",
- nme, tail);
+ GDKsyserror("sync failed for %s\n",
+ bi->h->filename);
close(fd);
}
if (bi->vh) {
- fd = GDKfdlocate(bi->vh->farmid, nme, "rb+",
"theap");
+ fd = GDKfdlocate(bi->vh->farmid,
bi->vh->filename, "rb+", NULL);
if (fd < 0) {
- GDKsyserror("cannot open file %s.theap
for sync\n",
- nme);
+ GDKsyserror("cannot open file %s for
sync\n",
+ bi->vh->filename);
err = GDK_FAIL;
} else {
if (
@@ -734,15 +731,18 @@ BATsave_iter(BAT *b, BATiter *bi, BUN si
fsync(fd) < 0
#endif
)
- GDKsyserror("sync failed for
%s.theap\n", nme);
+ GDKsyserror("sync failed for
%s\n", bi->vh->filename);
close(fd);
}
}
}
} else {
- if (!bi->copiedtodisk || bi->hdirty)
- if (err == GDK_SUCCEED && bi->type)
- err = HEAPsave(bi->h, nme, tail, dosync,
bi->hfree, &b->theaplock);
+ const char *nme = BBP_physical(b->batCacheid);
+ if ((!bi->copiedtodisk || bi->hdirty)
+ && (err == GDK_SUCCEED && bi->type)) {
+ const char *tail = strchr(bi->h->filename, '.') + 1;
+ err = HEAPsave(bi->h, nme, tail, dosync, bi->hfree,
&b->theaplock);
+ }
if (bi->vh
&& (!bi->copiedtodisk || bi->vhdirty)
&& ATOMvarsized(bi->type)
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]