Changeset: 06624855292e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=06624855292e
Modified Files:
gdk/gdk.h
gdk/gdk_bbp.c
sql/backends/monet5/UDF/capi/Tests/capi00.sql
sql/backends/monet5/UDF/capi/capi.c
Branch: jitudf
Log Message:
Place temporary files in a new TEMPDIR instead of using the existing DELDIR,
because the BBPsync assumes DELDIR is empty.
diffs (99 lines):
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -391,18 +391,22 @@
#define GDKisalnum(c) isalnum((int) (unsigned char) (c))
#define GDKisdigit(c) (((unsigned char) (c)) >= '0' && ((unsigned char) (c))
<= '9')
+#define TEMPDIR_NAME "TEMP_DATA"
+
#ifndef NATIVE_WIN32
#define BATDIR "bat"
#define DELDIR "bat/DELETE_ME"
#define BAKDIR "bat/BACKUP"
#define SUBDIR "bat/BACKUP/SUBCOMMIT"
#define LEFTDIR "bat/LEFTOVERS"
+#define TEMPDIR "bat/"TEMPDIR_NAME
#else
#define BATDIR "bat"
#define DELDIR "bat\\DELETE_ME"
#define BAKDIR "bat\\BACKUP"
#define SUBDIR "bat\\BACKUP\\SUBCOMMIT"
#define LEFTDIR "bat\\LEFTOVERS"
+#define TEMPDIR "bat\\"TEMPDIR_NAME
#endif
#ifdef MAXPATHLEN
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -1355,6 +1355,9 @@ BBPinit(void)
BBPaddfarm(".", 1 << TRANSIENT);
}
+ if (GDKremovedir(0, TEMPDIR) != GDK_SUCCEED)
+ GDKfatal("BBPinit: cannot remove directory %s\n", TEMPDIR);
+
if (GDKremovedir(0, DELDIR) != GDK_SUCCEED)
GDKfatal("BBPinit: cannot remove directory %s\n", DELDIR);
diff --git a/sql/backends/monet5/UDF/capi/Tests/capi00.sql
b/sql/backends/monet5/UDF/capi/Tests/capi00.sql
--- a/sql/backends/monet5/UDF/capi/Tests/capi00.sql
+++ b/sql/backends/monet5/UDF/capi/Tests/capi00.sql
@@ -1,4 +1,3 @@
-
START TRANSACTION;
@@ -16,5 +15,6 @@ INSERT INTO integers VALUES (1), (2), (3
SELECT i, capi00(i) FROM integers;
DROP FUNCTION capi00;
+DROP TABLE integers;
ROLLBACK;
diff --git a/sql/backends/monet5/UDF/capi/capi.c
b/sql/backends/monet5/UDF/capi/capi.c
--- a/sql/backends/monet5/UDF/capi/capi.c
+++ b/sql/backends/monet5/UDF/capi/capi.c
@@ -603,13 +603,13 @@ static str CUDFeval(Client cntxt, MalBlk
// we have to compile it
// first generate the names of the files
- // we place the temporary files in the LEFTOVERS directory
+ // we place the temporary files in the DELDIR directory
// because this will be removed again upon server startup
const int RANDOM_NAME_SIZE = 32;
char *path = NULL;
- const char *prefix = "DELETE_ME" DIR_SEP_STR;
+ const char *prefix = TEMPDIR_NAME DIR_SEP_STR;
size_t prefix_size = strlen(prefix);
- char *leftdirpath;
+ char *deldirpath;
memcpy(buf, prefix, sizeof(char) * strlen(prefix));
// generate a random 32-character name for the temporary files
@@ -640,18 +640,18 @@ static str CUDFeval(Client cntxt, MalBlk
strcpy(libname, path);
GDKfree(path);
- // if LEFTOVERS directory does not exist, create it
- leftdirpath = GDKfilepath(0, NULL, DELDIR, NULL);
- if (!leftdirpath) {
+ // if DELDIR directory does not exist, create it
+ deldirpath = GDKfilepath(0, NULL, TEMPDIR, NULL);
+ if (!deldirpath) {
msg = createException(MAL, "cudf.eval",
MAL_MALLOC_FAIL);
goto wrapup;
}
- if (mkdir(leftdirpath, 0755) < 0 && errno != EEXIST) {
+ if (mkdir(deldirpath, 0755) < 0 && errno != EEXIST) {
msg = createException(MAL, "cudf.eval",
- "cannot
create directory %s\n", leftdirpath);
+ "cannot
create directory %s\n", deldirpath);
goto wrapup;
}
- GDKfree(leftdirpath);
+ GDKfree(deldirpath);
// now generate the source file
f = fopen(fname, "w+");
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list