提交 c2aa4603 编写于 作者: H Hongze Cheng

compile

上级 f573875b
......@@ -186,11 +186,11 @@ static int32_t dnodeInitStorage() {
dError("failed to init TFS since %s", tstrerror(terrno));
return -1;
}
snprintf(tsDataDir, TFS_PRIMARY_PATH(), TSDB_FILENAME_LEN);
strncpy(tsDataDir, TFS_PRIMARY_PATH(), TSDB_FILENAME_LEN);
sprintf(tsMnodeDir, "%s/mnode", tsDataDir);
sprintf(tsVnodeDir, "%s/vnode", tsDataDir);
sprintf(tsDnodeDir, "%s/dnode", tsDataDir);
sprintf(tsVnodeBakDir, "%s/vnode_bak", tsDataDir);
// sprintf(tsVnodeBakDir, "%s/vnode_bak", tsDataDir);
//TODO(dengyihao): no need to init here
if (dnodeCreateDir(tsMnodeDir) < 0) {
......
......@@ -33,12 +33,13 @@ typedef struct {
#define TFS_PRIMARY_ID 0
// FS APIs ====================================
int tfsInit(SDiskCfg *pDiskCfg, int ndisk);
void tfsDestroy();
void tfsUpdateInfo();
void tfsIncDiskFile(int level, int id, int num);
void tfsDecDiskFile(int level, int id, int num);
int tfsInit(SDiskCfg *pDiskCfg, int ndisk);
void tfsDestroy();
void tfsUpdateInfo();
int64_t tfsTotalSize();
int64_t tfsAvailSize();
void tfsIncDiskFile(int level, int id, int num);
void tfsDecDiskFile(int level, int id, int num);
const char *TFS_PRIMARY_PATH();
const char *TFS_DISK_PATH(int level, int id);
......
......@@ -139,6 +139,10 @@ void tfsUpdateInfo() {
tfsUnLock();
}
int64_t tfsTotalSize() { return pfs->meta.tsize; }
int64_t tfsAvailSize() { return pfs->meta.avail; }
void tfsIncDiskFile(int level, int id, int num) {
tfsLock();
TFS_DISK_AT(level, id)->dmeta.nfiles += num;
......@@ -572,4 +576,26 @@ static int tfsAssignDisk(int level) {
return id;
}
// OTHER FUNCTIONS ===================================
void taosGetDisk() {
const double unit = 1024 * 1024 * 1024;
SysDiskSize diskSize;
if (tscEmbedded) {
tfsUpdateInfo();
tsTotalDataDirGB = (float)tfsTotalSize() / unit;
tsAvailDataDirGB = (float)tfsAvailSize() / unit;
}
if (taosGetDiskSize(tsLogDir, &diskSize)) {
tsTotalLogDirGB = (float)diskSize.tsize / unit;
tsAvailLogDirGB = (float)diskSize.avail / unit;
}
if (taosGetDiskSize("/tmp", &diskSize)) {
tsTotalTmpDirGB = (float)diskSize.tsize / unit;
tsAvailTmpDirectorySpace = (float)diskSize.avail / unit;
}
}
#pragma GCC diagnostic pop
\ No newline at end of file
......@@ -113,7 +113,7 @@ int32_t vnodeCreate(SCreateVnodeMsg *pVnodeCfg) {
char vnodeDir[TSDB_FILENAME_LEN] = "\0";
snprintf(vnodeDir, TSDB_FILENAME_LEN, "vnode%d", pVnodeCfg->cfg.vgId);
if (tfsMkdir(vnodeDir) < 0) {
vError("vgId:%d, failed to create vnode %d dir, reason:%s", pVnodeCfg->cfg.vgId, strerror(errno));
vError("vgId:%d, failed to create vnode dir %s, reason:%s", pVnodeCfg->cfg.vgId, vnodeDir, strerror(errno));
return terrno;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册