commit
0aa4fb81f5
|
@ -26,6 +26,9 @@
|
||||||
#include "tlocale.h"
|
#include "tlocale.h"
|
||||||
#include "ttimezone.h"
|
#include "ttimezone.h"
|
||||||
|
|
||||||
|
// TSDB
|
||||||
|
bool tsdbForceKeepFile = false;
|
||||||
|
|
||||||
// cluster
|
// cluster
|
||||||
char tsFirst[TSDB_EP_LEN] = {0};
|
char tsFirst[TSDB_EP_LEN] = {0};
|
||||||
char tsSecond[TSDB_EP_LEN] = {0};
|
char tsSecond[TSDB_EP_LEN] = {0};
|
||||||
|
|
|
@ -42,6 +42,8 @@ int32_t main(int32_t argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[i], "-C") == 0) {
|
} else if (strcmp(argv[i], "-C") == 0) {
|
||||||
dump_config = 1;
|
dump_config = 1;
|
||||||
|
} else if (strcmp(argv[i], "--force-keep-file") == 0) {
|
||||||
|
tsdbForceKeepFile = true;
|
||||||
} else if (strcmp(argv[i], "-V") == 0) {
|
} else if (strcmp(argv[i], "-V") == 0) {
|
||||||
#ifdef _ACCT
|
#ifdef _ACCT
|
||||||
char *versionStr = "enterprise";
|
char *versionStr = "enterprise";
|
||||||
|
|
|
@ -18,6 +18,9 @@
|
||||||
|
|
||||||
#define TSDB_FS_VERSION 0
|
#define TSDB_FS_VERSION 0
|
||||||
|
|
||||||
|
// ================== TSDB global config
|
||||||
|
extern bool tsdbForceKeepFile;
|
||||||
|
|
||||||
// ================== CURRENT file header info
|
// ================== CURRENT file header info
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t version; // Current file system version (relating to code)
|
uint32_t version; // Current file system version (relating to code)
|
||||||
|
|
|
@ -982,6 +982,26 @@ static int tsdbRestoreMeta(STsdbRepo *pRepo) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tsdbForceKeepFile) {
|
||||||
|
struct stat tfstat;
|
||||||
|
|
||||||
|
// Get real file size
|
||||||
|
if (fstat(pfs->cstatus->pmf->fd, &tfstat) < 0) {
|
||||||
|
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||||
|
tsdbCloseMFile(pfs->cstatus->pmf);
|
||||||
|
tfsClosedir(tdir);
|
||||||
|
regfree(®ex);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pfs->cstatus->pmf->info.size != tfstat.st_size) {
|
||||||
|
int64_t tfsize = pfs->cstatus->pmf->info.size;
|
||||||
|
pfs->cstatus->pmf->info.size = tfstat.st_size;
|
||||||
|
tsdbInfo("vgId:%d file %s header size is changed from %" PRId64 " to %" PRId64, REPO_ID(pRepo),
|
||||||
|
TSDB_FILE_FULL_NAME(pfs->cstatus->pmf), tfsize, pfs->cstatus->pmf->info.size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tsdbCloseMFile(pfs->cstatus->pmf);
|
tsdbCloseMFile(pfs->cstatus->pmf);
|
||||||
}
|
}
|
||||||
} else if (code == REG_NOMATCH) {
|
} else if (code == REG_NOMATCH) {
|
||||||
|
@ -1141,6 +1161,24 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tsdbForceKeepFile) {
|
||||||
|
struct stat tfstat;
|
||||||
|
|
||||||
|
// Get real file size
|
||||||
|
if (fstat(pDFile->fd, &tfstat) < 0) {
|
||||||
|
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||||
|
taosArrayDestroy(fArray);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pDFile->info.size != tfstat.st_size) {
|
||||||
|
int64_t tfsize = pDFile->info.size;
|
||||||
|
pDFile->info.size = tfstat.st_size;
|
||||||
|
tsdbInfo("vgId:%d file %s header size is changed from %" PRId64 " to %" PRId64, REPO_ID(pRepo),
|
||||||
|
TSDB_FILE_FULL_NAME(pDFile), tfsize, pDFile->info.size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tsdbCloseDFile(pDFile);
|
tsdbCloseDFile(pDFile);
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,7 @@ typedef struct {
|
||||||
extern SGlobalCfg tsGlobalConfig[];
|
extern SGlobalCfg tsGlobalConfig[];
|
||||||
extern int32_t tsGlobalConfigNum;
|
extern int32_t tsGlobalConfigNum;
|
||||||
extern char * tsCfgStatusStr[];
|
extern char * tsCfgStatusStr[];
|
||||||
|
extern bool tsdbForceKeepFile;
|
||||||
|
|
||||||
void taosReadGlobalLogCfg();
|
void taosReadGlobalLogCfg();
|
||||||
bool taosReadGlobalCfg();
|
bool taosReadGlobalCfg();
|
||||||
|
|
Loading…
Reference in New Issue