Changeset: 53d4cb5e7cdc for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=53d4cb5e7cdc
Modified Files:
gdk/gdk_heap.c
Branch: Jul2015
Log Message:
Always create backup when widening, not just for memory-mapped files.
This fixes an occasional bug where the server complains during starup
about the failure to rename the dsnapshots bat.
diffs (39 lines):
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -412,12 +412,15 @@ GDKupgradevarheap(COLrec *c, var_t v, in
* indicated by the "free" pointer */
n = (copyall ? c->heap.size : c->heap.free) >> c->shift;
- /* for memory mapped files, create a backup copy before widening
+ /* Create a backup copy before widening.
*
- * this solves a problem that we don't control what's in the
- * actual file until the next commit happens, so a crash might
- * otherwise leave the file (and the database) in an
- * inconsistent state
+ * If the file is memory-mapped, this solves a problem that we
+ * don't control what's in the actual file until the next
+ * commit happens, so a crash might otherwise leave the file
+ * (and the database) in an inconsistent state. If, on the
+ * other hand, the heap is allocated, it may happen that later
+ * on the heap is extended and converted into a memory-mapped
+ * file. Then the same problem arises.
*
* also see do_backup in gdk_bbp.c */
filename = strrchr(c->heap.filename, DIR_SEP);
@@ -426,9 +429,11 @@ GDKupgradevarheap(COLrec *c, var_t v, in
else
filename++;
bid = strtol(filename, NULL, 8);
- if (c->heap.storage == STORE_MMAP &&
- (BBP_status(bid) & (BBPEXISTING|BBPDELETED)) &&
- !file_exists(c->heap.farmid, BAKDIR, filename, NULL)) {
+ if ((BBP_status(bid) & (BBPEXISTING|BBPDELETED)) &&
+ !file_exists(c->heap.farmid, BAKDIR, filename, NULL) &&
+ (c->heap.storage != STORE_MEM ||
+ GDKmove(c->heap.farmid, BATDIR, c->heap.filename, NULL,
+ BAKDIR, filename, NULL) != GDK_SUCCEED)) {
int fd;
ssize_t ret = 0;
size_t size = n << c->shift;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list