提交 66e16868 编写于 作者: L liuyq-617

[TD-3119]<fix> when only dbs.sql, dumpin error

上级 b6c3ef5b
...@@ -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);
} }
if (0 != tsSqlFileNumOfTbls) {
taosStartDumpInWorkThreads(taos, arguments); 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.
先完成此消息的编辑!
想要评论请 注册