fix the issue #404
This commit is contained in:
parent
263bab87d2
commit
9465d94c74
|
@ -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)) {
|
||||
|
|
Loading…
Reference in New Issue