未验证 提交 87d794f4 编写于 作者: D dapan1121 提交者: GitHub

Merge pull request #8804 from taosdata/TD-11383-dev

[TD-11383]taos_fetch_block crashes during multithreaded operation on windows
...@@ -28,6 +28,7 @@ void taosClose(FileFd fd) { ...@@ -28,6 +28,7 @@ void taosClose(FileFd fd) {
void taosGetTmpfilePath(const char *fileNamePrefix, char *dstPath) { void taosGetTmpfilePath(const char *fileNamePrefix, char *dstPath) {
const char *tdengineTmpFileNamePrefix = "tdengine-"; const char *tdengineTmpFileNamePrefix = "tdengine-";
char tmpPath[PATH_MAX]; char tmpPath[PATH_MAX];
static uint64_t seqId = 0;
int32_t len = (int32_t)strlen(tsTempDir); int32_t len = (int32_t)strlen(tsTempDir);
memcpy(tmpPath, tsTempDir, len); memcpy(tmpPath, tsTempDir, len);
...@@ -43,8 +44,10 @@ void taosGetTmpfilePath(const char *fileNamePrefix, char *dstPath) { ...@@ -43,8 +44,10 @@ void taosGetTmpfilePath(const char *fileNamePrefix, char *dstPath) {
strcat(tmpPath, "-%d-%s"); strcat(tmpPath, "-%d-%s");
} }
char rand[8] = {0}; char rand[32] = {0};
taosRandStr(rand, tListLen(rand) - 1);
sprintf(rand, "%" PRIu64, atomic_add_fetch_64(&seqId, 1));
snprintf(dstPath, PATH_MAX, tmpPath, getpid(), rand); snprintf(dstPath, PATH_MAX, tmpPath, getpid(), rand);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册