Changeset: 80534e3eab59 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/80534e3eab59 Modified Files: common/utils/mutils.c gdk/gdk_posix.c Branch: Jan2022 Log Message:
On Windows, avoid indexing files we create. When opening a file for writing with fopen, or when the O_CREAT flag is specified in open, or when creating a file for a memory map, we specify the FILE_ATTRIBUTE_NOT_CONTENT_INDEXED file attribute. diffs (43 lines): diff --git a/common/utils/mutils.c b/common/utils/mutils.c --- a/common/utils/mutils.c +++ b/common/utils/mutils.c @@ -498,7 +498,7 @@ MT_lockf(const char *filename, int mode) * directly */ fh = CreateFileW(wfilename, GENERIC_READ | GENERIC_WRITE, 0, - NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NOT_CONTENT_INDEXED, NULL); free(wfilename); if (fh == INVALID_HANDLE_VALUE) return -2; @@ -560,8 +560,8 @@ MT_fopen(const char *filename, const cha wfilename = utf8towchar(filename); wmode = utf8towchar(mode); FILE *f = NULL; - if (wfilename != NULL && wmode != NULL) - f = _wfopen(wfilename, wmode); + if (wfilename != NULL && wmode != NULL && (f = _wfopen(wfilename, wmode)) != NULL && strchr(mode, 'w') != NULL) + SetFileAttributesW(wfilename, FILE_ATTRIBUTE_NOT_CONTENT_INDEXED); free(wfilename); free(wmode); return f; @@ -576,6 +576,8 @@ MT_open(const char *filename, int flags) int fd; if (_wsopen_s(&fd, wfilename, flags, _SH_DENYNO, _S_IREAD | _S_IWRITE) != 0) fd = -1; + else if (flags & O_CREAT) + SetFileAttributesW(wfilename, FILE_ATTRIBUTE_NOT_CONTENT_INDEXED); free(wfilename); return fd; } diff --git a/gdk/gdk_posix.c b/gdk/gdk_posix.c --- a/gdk/gdk_posix.c +++ b/gdk/gdk_posix.c @@ -734,6 +734,7 @@ MT_mmap(const char *path, int mode, size mode3 = PAGE_READWRITE; mode4 = FILE_MAP_WRITE; } + mode2 |= FILE_ATTRIBUTE_NOT_CONTENT_INDEXED; sa.nLength = sizeof(SECURITY_ATTRIBUTES); sa.bInheritHandle = TRUE; sa.lpSecurityDescriptor = 0; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list