提交 9465d94c 编写于 作者: S slguan

fix the issue #404

上级 263bab87
......@@ -47,12 +47,18 @@ int slaveIndex;
void * tscTmr;
void * tscQhandle;
void * tscConnCache;
void * tscCheckDiskUsageTmr;
int tsInsertHeadSize;
extern int tscEmbedded;
int tscNumOfThreads;
static pthread_once_t tscinit = PTHREAD_ONCE_INIT;
void tscCheckDiskUsage(void *para, void *unused) {
taosGetDisk();
taosTmrReset(tscCheckDiskUsage, 1000, NULL, tscTmr, &tscCheckDiskUsageTmr);
}
void taos_init_imp() {
char temp[128];
struct stat dirstat;
......@@ -81,6 +87,7 @@ void taos_init_imp() {
tsReadGlobalConfig();
tsPrintGlobalConfig();
taosTmrReset(tscCheckDiskUsage, 10, NULL, tscTmr, &tscCheckDiskUsageTmr);
tscTrace("starting to initialize TAOS client ...");
tscTrace("Local IP address is:%s", tsLocalIp);
......
......@@ -326,13 +326,15 @@ bool taosGetDisk() {
struct statvfs info;
const double unit = 1024 * 1024 * 1024;
if (statvfs(dataDir, &info)) {
tsTotalDataDirGB = 0;
tsAvailDataDirGB = 0;
return false;
} else {
tsTotalDataDirGB = (float)((double)info.f_blocks * (double)info.f_frsize / unit);
tsAvailDataDirGB = (float)((double)info.f_bavail * (double)info.f_frsize / unit);
if (tscEmbedded) {
if (statvfs(tsDirectory, &info)) {
tsTotalDataDirGB = 0;
tsAvailDataDirGB = 0;
return false;
} else {
tsTotalDataDirGB = (float)((double)info.f_blocks * (double)info.f_frsize / unit);
tsAvailDataDirGB = (float)((double)info.f_bavail * (double)info.f_frsize / unit);
}
}
if (statvfs(logDir, &info)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册