未验证 提交 cdbd3df4 编写于 作者: H huili 提交者: GitHub

Merge pull request #5312 from taosdata/hotfix/test

[TD-3119]<fix> when only dbs.sql, dumpin error
...@@ -2109,13 +2109,15 @@ static void taosGetDirectoryFileList(char *inputDir) ...@@ -2109,13 +2109,15 @@ static void taosGetDirectoryFileList(char *inputDir)
if (fileStat.st_mode & S_IFDIR) { if (fileStat.st_mode & S_IFDIR) {
taosCheckTablesSQLFile(inputDir); taosCheckTablesSQLFile(inputDir);
tsSqlFileNum = taosGetFilesNum(inputDir, "sql"); tsSqlFileNum = taosGetFilesNum(inputDir, "sql");
int totalSQLFileNum = tsSqlFileNum; int tsSqlFileNumOfTbls = tsSqlFileNum;
if (tsDbSqlFile[0] != 0) { if (tsDbSqlFile[0] != 0) {
tsSqlFileNum--; tsSqlFileNumOfTbls--;
} }
taosMallocSQLFiles(); taosMallocSQLFiles();
taosParseDirectory(inputDir, "sql", tsDumpInSqlFiles, tsSqlFileNum); if (0 != tsSqlFileNumOfTbls) {
fprintf(stdout, "\nstart to dispose %d files in %s\n", totalSQLFileNum, inputDir); taosParseDirectory(inputDir, "sql", tsDumpInSqlFiles, tsSqlFileNumOfTbls);
}
fprintf(stdout, "\nstart to dispose %d files in %s\n", tsSqlFileNum, inputDir);
} }
else { else {
fprintf(stderr, "ERROR: %s is not a directory\n", inputDir); fprintf(stderr, "ERROR: %s is not a directory\n", inputDir);
...@@ -2268,7 +2270,10 @@ int taosDumpIn(struct arguments *arguments) { ...@@ -2268,7 +2270,10 @@ int taosDumpIn(struct arguments *arguments) {
taosGetDirectoryFileList(arguments->inpath); taosGetDirectoryFileList(arguments->inpath);
int32_t tsSqlFileNumOfTbls = tsSqlFileNum;
if (tsDbSqlFile[0] != 0) { if (tsDbSqlFile[0] != 0) {
tsSqlFileNumOfTbls--;
fp = taosOpenDumpInFile(tsDbSqlFile); fp = taosOpenDumpInFile(tsDbSqlFile);
if (NULL == fp) { if (NULL == fp) {
fprintf(stderr, "failed to open input file %s\n", tsDbSqlFile); fprintf(stderr, "failed to open input file %s\n", tsDbSqlFile);
...@@ -2281,7 +2286,9 @@ int taosDumpIn(struct arguments *arguments) { ...@@ -2281,7 +2286,9 @@ int taosDumpIn(struct arguments *arguments) {
taosDumpInOneFile(taos, fp, tsfCharset, arguments->encode, tsDbSqlFile); taosDumpInOneFile(taos, fp, tsfCharset, arguments->encode, tsDbSqlFile);
} }
taosStartDumpInWorkThreads(taos, arguments); if (0 != tsSqlFileNumOfTbls) {
taosStartDumpInWorkThreads(taos, arguments);
}
taos_close(taos); taos_close(taos);
taosFreeSQLFiles(); taosFreeSQLFiles();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册