Changeset: 3fa35fd503c3 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3fa35fd503c3
Modified Files:
        
Branch: sciql
Log Message:

merge with default


diffs (truncated from 998 to 300 lines):

diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -643,7 +643,10 @@
 /* modifiable single-machine data */
 #define LOCALSTATEDIR PREFIX "\\var"
 
-#define lstat stat
+#include <sys/stat.h>
+#define lstat _stat64
+#define stat _stat64
+#define fstat _fstat64
 #ifndef S_ISREG        /* swig-generated source file doesn't include us first 
*/
 #define S_ISREG(mode)  (((mode) & _S_IFMT) == _S_IFREG)
 #endif
diff --git a/common/options/monet_options.mx b/common/options/monet_options.mx
--- a/common/options/monet_options.mx
+++ b/common/options/monet_options.mx
@@ -291,7 +291,7 @@
        if (Set == NULL)
                return 0;
 
-#define N_OPTIONS      14      /*MUST MATCH # OPTIONS BELOW */
+#define N_OPTIONS      12      /*MUST MATCH # OPTIONS BELOW */
        set = malloc(sizeof(opt) * N_OPTIONS);
        if (set == NULL)
                return 0;
@@ -339,14 +339,6 @@
        set[i].value = strdup("false");
        i++;
        set[i].kind = opt_builtin;
-       set[i].name = strdup("default_pipe");
-       set[i].value = 
strdup("inline,remap,evaluate,costModel,coercions,emptySet,aliases,mitosis,mergetable,deadcode,commonTerms,joinPath,reorder,deadcode,reduce,dataflow,history,multiplex,garbageCollector");
-       i++;
-       set[i].kind = opt_builtin;
-       set[i].name = strdup("minimal_pipe");
-       set[i].value = 
strdup("inline,remap,deadcode,multiplex,garbageCollector");
-       i++;
-       set[i].kind = opt_builtin;
        set[i].name = strdup("sql_optimizer");
        set[i].value = strdup("default_pipe");
        i++;
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -2725,7 +2725,6 @@
                                getlogin \
                                getopt \
                                getopt_long \
-                               getrlimit \
                                GetSystemInfo \
                                gettimeofday \
                                getuid \
diff --git a/gdk/ChangeLog.Apr2011 b/gdk/ChangeLog.Apr2011
--- a/gdk/ChangeLog.Apr2011
+++ b/gdk/ChangeLog.Apr2011
@@ -1,3 +1,7 @@
 # ChangeLog file for MonetDB
 # This file is updated with Maddlog
 
+* Fri May 13 2011 Sjoerd Mullender <[email protected]>
+- Fixed a bug where large files (> 2GB) didn't always get deleted on
+  Windows.
+
diff --git a/gdk/gdk_posix.mx b/gdk/gdk_posix.mx
--- a/gdk/gdk_posix.mx
+++ b/gdk/gdk_posix.mx
@@ -260,7 +260,7 @@
 gdk_export int win_unlink(const char *);
 gdk_export int win_mkdir(const char *, const int mode);
 
-#define stat(x,y)      win_stat(x,y)
+#define _stat64(x,y)   win_stat(x,y)
 #define mkdir          win_mkdir
 #define rmdir          win_rmdir
 #define rename         win_rename
@@ -1670,11 +1670,12 @@
        return buf;
 }
 
+#undef _stat64
 int
-win_stat(const char *pathname, struct stat *st)
+win_stat(const char *pathname, struct _stat64 *st)
 {
        char buf[128], *p = reduce_dir_name(pathname, buf, sizeof(buf));
-       int ret = stat(p, st);
+       int ret = _stat64(p, st);
 
        if (p != buf)
                free(p);
diff --git a/gdk/gdk_storage.mx b/gdk/gdk_storage.mx
--- a/gdk/gdk_storage.mx
+++ b/gdk/gdk_storage.mx
@@ -194,27 +194,20 @@
 @-
 Unlink the file.
 @c
-static int
-delete_file(const char *path)
-{
-       int err = unlink(path);
-
-       if (err)
-               GDKsyserror("GDKunlink(%s)\n", path);
-       IODEBUG THRprintf(GDKout, "#unlink %s = %d\n", path, err);
-
-       return err;
-}
-
 int
 GDKunlink(const char *dir, const char *nme, const char *ext)
 {
        char path[PATHLENGTH];
-       struct stat st;
+
        if (nme && *nme) {
                GDKfilepath(path, dir, nme, ext);
-               if (lstat(path, &st) == 0)
-                       return delete_file(path);
+               /* if file already doesn't exist, we don't care */
+               if (unlink(path) == -1 && errno != ENOENT) {
+                       GDKsyserror("GDKunlink(%s)\n", path);
+                       IODEBUG THRprintf(GDKout, "#unlink %s = -1\n", path);
+                       return -1;
+               }
+               return 0;
        }
        return -1;
 }
diff --git a/gdk/gdk_utils.mx b/gdk/gdk_utils.mx
--- a/gdk/gdk_utils.mx
+++ b/gdk/gdk_utils.mx
@@ -65,17 +65,6 @@
 # include <sys/sysctl.h>
 #endif
 
-/* getrlimit on FreeBSD */
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
-#ifdef HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
 #ifdef NATIVE_WIN32
 #define chdir _chdir
 #endif
@@ -473,15 +462,16 @@
        }
 #elif defined(HAVE_SYS_SYSCTL_H) && defined(HW_PAGESIZE)
        {
-               size_t len = sizeof(_MT_pagesize);
-               int mib[3];
+               int size;
+               size_t len = sizeof(int);
+               int mib[2];
 
                /* Everyone should have permission to make this call, 
                 * if we get a failure something is really wrong. */
                mib[0] = CTL_HW;
                mib[1] = HW_PAGESIZE;
-               mib[2] = -1;
-               sysctl(mib, 3, &_MT_pagesize, &len, NULL, 0);
+               sysctl(mib, 2, &size, &len, NULL, 0);
+               _MT_pagesize = size;
        }
 #elif defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE)
        _MT_pagesize = sysconf(_SC_PAGESIZE);
@@ -509,14 +499,19 @@
        {
                uint64_t size = 0;
                size_t len = sizeof(size);
-               int mib[3];
+               int mib[2];
 
                /* Everyone should have permission to make this call, 
                 * if we get a failure something is really wrong. */
                mib[0] = CTL_HW;
                mib[1] = HW_MEMSIZE;
-               mib[2] = -1;
-               sysctl(mib, 3, &size, &len, NULL, 0);
+               sysctl(mib, 2, &size, &len, NULL, 0);
+# ifdef SIZEOF_SIZE_T == SIZEOF_INT
+               /* we can have more memory than a size_t can handle on a 32-bits
+                * platform, so trim it down, if that is the case */
+               if (size > 0xffffffff)
+                       size = 0xffffffff;
+# endif
                _MT_npages = size / _MT_pagesize;
        }
 #elif defined(HAVE_SYS_SYSCTL_H) && defined (HW_PHYSMEM64)
@@ -524,14 +519,19 @@
        {
                int64_t size = 0;
                size_t len = sizeof(size);
-               int mib[3];
+               int mib[2];
 
                /* Everyone should have permission to make this call, 
                 * if we get a failure something is really wrong. */
                mib[0] = CTL_HW;
                mib[1] = HW_PHYSMEM64;
-               mib[2] = -1;
-               sysctl(mib, 3, &size, &len, NULL, 0);
+               sysctl(mib, 2, &size, &len, NULL, 0);
+# ifdef SIZEOF_SIZE_T == SIZEOF_INT
+               /* we can have more memory than a size_t can handle on a 32-bits
+                * platform, so trim it down, if that is the case */
+               if (size > 0xffffffff)
+                       size = 0xffffffff;
+# endif
                _MT_npages = size / _MT_pagesize;
        }
 #elif defined(HAVE_SYSCONF) && defined(_SC_PHYS_PAGES)
@@ -539,25 +539,6 @@
 #else
 # error "don't know how to get the amount of physical memory for your OS"
 #endif
-
-#ifdef HAVE_GETRLIMIT
-       {
-               struct rlimit rl;
-               size_t memlim;
-
-               /* The environment can be limited memory wise.  In such case the
-                * physically available memory, is not necessarily what we can
-                * also use. */
-               getrlimit(RLIMIT_DATA, &rl);
-               if (rl.rlim_cur != (rlim_t) RLIM_INFINITY) {
-                       /* rlimit returns in bytes, recalculate */
-                       memlim = rl.rlim_cur / _MT_pagesize;
-                       /* if it's more restrictive, take that as value */
-                       if (memlim < _MT_npages)
-                               _MT_npages = memlim;
-               }
-       }
-#endif
 }
 
 size_t
diff --git a/monetdb5/mal/mal_interpreter.mx b/monetdb5/mal/mal_interpreter.mx
--- a/monetdb5/mal/mal_interpreter.mx
+++ b/monetdb5/mal/mal_interpreter.mx
@@ -82,10 +82,8 @@
 static void displayVolume(Client cntxt, lng vol);
 
 #define MEMORY_THRESHOLD  0.8
-#define MAXHOT 16
 
 static lng memorypool;         /* memory claimed by concurrent threads */
-static lng memoryused;         /* memory used for intermediates */
 static int memoryclaims = 0;   /* number of threads active with expensive 
operations */
 
 #define heapinfo(X) if((X) && (X)->base) vol = (X)->free; else vol = 0;
@@ -711,25 +709,27 @@
        /* optimistically set memory */
        if ( argclaim == 0)
                return 0;
-       return 0;       /* invalidate */
+       /* experiments on sf-100 on small machine showed no real improvement
+          Q10 became even 3x slower.
+       */
+       return 0;
 
        mal_set_lock(mal_contextLock, "DFLOWdelay");
-       if (memorypool <= 0 && memoryclaims == 0) {
+       if (memorypool <= 0 && memoryclaims == 0) 
                        memorypool = (lng) (MEMORY_THRESHOLD * monet_memory);
-       }
 
        if ( argclaim > 0 ) {
-               if (memoryclaims == 0 || memorypool - memoryused > argclaim + 
hotclaim){
+               if (memoryclaims == 0 || memorypool > argclaim+ hotclaim ){
                        memorypool -= (argclaim + hotclaim);
                        memoryclaims ++;
                        PARDEBUG
-                               mnstr_printf(GDKstdout,"#DFLOWadmit %3d thread 
%d pool " LLFMT","LLFMT " claims " LLFMT "," LLFMT"\n",
-                                       memoryclaims, THRgettid(), memorypool, 
memoryused, argclaim, hotclaim);
+                               mnstr_printf(GDKstdout,"#DFLOWadmit %3d thread 
%d pool " LLFMT"claims " LLFMT "," LLFMT"\n",
+                                       memoryclaims, THRgettid(), memorypool, 
argclaim, hotclaim);
                        mal_unset_lock(mal_contextLock, "DFLOWdelay");
                        return 0;
                }
                PARDEBUG
-                       mnstr_printf(GDKstdout,"#Delayed due to lack of memory 
" LLFMT " used " LLFMT " requestd " LLFMT "\n", memorypool, memoryused, 
argclaim+hotclaim);
+                       mnstr_printf(GDKstdout,"#Delayed due to lack of memory 
" LLFMT " requested " LLFMT "\n", memorypool, argclaim+hotclaim);
                mal_unset_lock(mal_contextLock, "DFLOWdelay");
                return -1;
        }
@@ -737,8 +737,8 @@
        memorypool += -argclaim - hotclaim ;
        memoryclaims --;
        PARDEBUG
-               mnstr_printf(GDKstdout,"#DFLOWadmit %3d thread %d pool " 
LLFMT","LLFMT " claims " LLFMT "," LLFMT"\n",
-                       memoryclaims, THRgettid(), memorypool, memoryused, 
argclaim, hotclaim);
+               mnstr_printf(GDKstdout,"#DFLOWadmit %3d thread %d pool " LLFMT" 
claims " LLFMT "," LLFMT"\n",
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to