diff --git a/src/client/src/tscSystem.c b/src/client/src/tscSystem.c index 381bd79bf81afd19c4c5e545d8b75173f898a6cd..9ca05b8166dc4bb56f5c541b4461732cba32c86b 100644 --- a/src/client/src/tscSystem.c +++ b/src/client/src/tscSystem.c @@ -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); diff --git a/src/util/src/tsystem.c b/src/util/src/tsystem.c index 7eebeb3b8ddf9943d5ea3b81c35f42910f053c4a..b6d5250f12c42ea9ebffe24d3c83d429ed25ba7c 100644 --- a/src/util/src/tsystem.c +++ b/src/util/src/tsystem.c @@ -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)) {