Changeset: e9f0e32f094b for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e9f0e32f094b Modified Files: gdk/gdk_group.c gdk/gdk_storage.c Branch: Oct2014 Log Message:
Fix for when we run out of disk space during grouping. Two fixes, really: propagate error from fallocate() system call up, and act on failing BATextend. diffs (42 lines): diff --git a/gdk/gdk_group.c b/gdk/gdk_group.c --- a/gdk/gdk_group.c +++ b/gdk/gdk_group.c @@ -80,12 +80,14 @@ maxgrps = BATcount(b); \ if (extents) { \ BATsetcount(en, ngrp); \ - en = BATextend(en, maxgrps); \ + if (BATextend(en, maxgrps) == NULL) \ + goto error; \ exts = (oid *) Tloc(en, BUNfirst(en)); \ } \ if (histo) { \ BATsetcount(hn, ngrp); \ - hn = BATextend(hn, maxgrps); \ + if (BATextend(hn, maxgrps) == NULL) \ + goto error; \ cnts = (wrd *) Tloc(hn, BUNfirst(hn)); \ } \ } \ diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c --- a/gdk/gdk_storage.c +++ b/gdk/gdk_storage.c @@ -282,7 +282,7 @@ GDKextendf(int fd, size_t size, const ch IODEBUG t0 = GDKms(); if (stb.st_size < (off_t) size) { #ifdef HAVE_FALLOCATE - if (fallocate(fd, 0, stb.st_size, (off_t) size - stb.st_size) < 0 && + if ((rt = fallocate(fd, 0, stb.st_size, (off_t) size - stb.st_size)) < 0 && errno == EOPNOTSUPP) /* on Linux, posix_fallocate uses a slow * method to allocate blocks if the underlying @@ -298,6 +298,9 @@ GDKextendf(int fd, size_t size, const ch * the operation, so just resize the file */ #endif #endif + /* we get here when (posix_)fallocate fails because it + * is not supported on the file system, or if neither + * function exists */ rt = ftruncate(fd, (off_t) size); } IODEBUG fprintf(stderr, "#GDKextend %s " SZFMT " -> " SZFMT " %dms%s\n", _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list