more code
This commit is contained in:
parent
fcbff54e59
commit
dfc91a38b0
|
@ -35,7 +35,11 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
|
|||
*ppMeta = NULL;
|
||||
|
||||
// create handle
|
||||
slen = strlen(tfsGetPrimaryPath(pVnode->pTfs)) + strlen(pVnode->path) + strlen(VNODE_META_DIR) + 3;
|
||||
if (pVnode->pTfs) {
|
||||
slen = strlen(tfsGetPrimaryPath(pVnode->pTfs)) + strlen(pVnode->path) + strlen(VNODE_META_DIR) + 3;
|
||||
} else {
|
||||
slen = strlen(pVnode->path) + strlen(VNODE_META_DIR) + 2;
|
||||
}
|
||||
if ((pMeta = taosMemoryCalloc(1, sizeof(*pMeta) + slen)) == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
|
@ -43,8 +47,12 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
|
|||
|
||||
metaInitLock(pMeta);
|
||||
pMeta->path = (char *)&pMeta[1];
|
||||
sprintf(pMeta->path, "%s%s%s%s%s", tfsGetPrimaryPath(pVnode->pTfs), TD_DIRSEP, pVnode->path, TD_DIRSEP,
|
||||
VNODE_META_DIR);
|
||||
if (pVnode->pTfs) {
|
||||
sprintf(pMeta->path, "%s%s%s%s%s", tfsGetPrimaryPath(pVnode->pTfs), TD_DIRSEP, pVnode->path, TD_DIRSEP,
|
||||
VNODE_META_DIR);
|
||||
} else {
|
||||
sprintf(pMeta->path, "%s%s%s", pVnode->path, TD_DIRSEP, VNODE_META_DIR);
|
||||
}
|
||||
taosRealPath(pMeta->path, NULL, slen);
|
||||
pMeta->pVnode = pVnode;
|
||||
|
||||
|
|
|
@ -417,6 +417,7 @@ _err:
|
|||
// EXPOSED APIS ====================================================================================
|
||||
int32_t tsdbFSOpen(STsdb *pTsdb) {
|
||||
int32_t code = 0;
|
||||
SVnode *pVnode = pTsdb->pVnode;
|
||||
|
||||
// open handle
|
||||
pTsdb->fs.pDelFile = NULL;
|
||||
|
@ -429,8 +430,12 @@ int32_t tsdbFSOpen(STsdb *pTsdb) {
|
|||
// load fs or keep empty
|
||||
char fname[TSDB_FILENAME_LEN];
|
||||
|
||||
snprintf(fname, TSDB_FILENAME_LEN - 1, "%s%s%s%sCURRENT", tfsGetPrimaryPath(pTsdb->pVnode->pTfs), TD_DIRSEP,
|
||||
pTsdb->path, TD_DIRSEP);
|
||||
if (pVnode->pTfs) {
|
||||
snprintf(fname, TSDB_FILENAME_LEN - 1, "%s%s%s%sCURRENT", tfsGetPrimaryPath(pTsdb->pVnode->pTfs), TD_DIRSEP,
|
||||
pTsdb->path, TD_DIRSEP);
|
||||
} else {
|
||||
snprintf(fname, TSDB_FILENAME_LEN - 1, "%s%sCURRENT", pTsdb->path, TD_DIRSEP);
|
||||
}
|
||||
|
||||
if (!taosCheckExistFile(fname)) {
|
||||
// empty one
|
||||
|
|
|
@ -57,10 +57,13 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee
|
|||
} else {
|
||||
memcpy(&pTsdb->keepCfg, pKeepCfg, sizeof(STsdbKeepCfg));
|
||||
}
|
||||
// pTsdb->fs = tsdbNewFS(REPO_KEEP_CFG(pTsdb));
|
||||
|
||||
// create dir
|
||||
tfsMkdir(pVnode->pTfs, pTsdb->path);
|
||||
if (pVnode->pTfs) {
|
||||
tfsMkdir(pVnode->pTfs, pTsdb->path);
|
||||
} else {
|
||||
taosMkDir(pTsdb->path);
|
||||
}
|
||||
|
||||
// open tsdb
|
||||
if (tsdbFSOpen(pTsdb) < 0) {
|
||||
|
|
Loading…
Reference in New Issue