fix the issue #404
This commit is contained in:
parent
263bab87d2
commit
9465d94c74
|
@ -47,12 +47,18 @@ int slaveIndex;
|
||||||
void * tscTmr;
|
void * tscTmr;
|
||||||
void * tscQhandle;
|
void * tscQhandle;
|
||||||
void * tscConnCache;
|
void * tscConnCache;
|
||||||
|
void * tscCheckDiskUsageTmr;
|
||||||
int tsInsertHeadSize;
|
int tsInsertHeadSize;
|
||||||
|
|
||||||
extern int tscEmbedded;
|
extern int tscEmbedded;
|
||||||
int tscNumOfThreads;
|
int tscNumOfThreads;
|
||||||
static pthread_once_t tscinit = PTHREAD_ONCE_INIT;
|
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() {
|
void taos_init_imp() {
|
||||||
char temp[128];
|
char temp[128];
|
||||||
struct stat dirstat;
|
struct stat dirstat;
|
||||||
|
@ -81,6 +87,7 @@ void taos_init_imp() {
|
||||||
|
|
||||||
tsReadGlobalConfig();
|
tsReadGlobalConfig();
|
||||||
tsPrintGlobalConfig();
|
tsPrintGlobalConfig();
|
||||||
|
taosTmrReset(tscCheckDiskUsage, 10, NULL, tscTmr, &tscCheckDiskUsageTmr);
|
||||||
|
|
||||||
tscTrace("starting to initialize TAOS client ...");
|
tscTrace("starting to initialize TAOS client ...");
|
||||||
tscTrace("Local IP address is:%s", tsLocalIp);
|
tscTrace("Local IP address is:%s", tsLocalIp);
|
||||||
|
|
|
@ -326,13 +326,15 @@ bool taosGetDisk() {
|
||||||
struct statvfs info;
|
struct statvfs info;
|
||||||
const double unit = 1024 * 1024 * 1024;
|
const double unit = 1024 * 1024 * 1024;
|
||||||
|
|
||||||
if (statvfs(dataDir, &info)) {
|
if (tscEmbedded) {
|
||||||
tsTotalDataDirGB = 0;
|
if (statvfs(tsDirectory, &info)) {
|
||||||
tsAvailDataDirGB = 0;
|
tsTotalDataDirGB = 0;
|
||||||
return false;
|
tsAvailDataDirGB = 0;
|
||||||
} else {
|
return false;
|
||||||
tsTotalDataDirGB = (float)((double)info.f_blocks * (double)info.f_frsize / unit);
|
} else {
|
||||||
tsAvailDataDirGB = (float)((double)info.f_bavail * (double)info.f_frsize / unit);
|
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)) {
|
if (statvfs(logDir, &info)) {
|
||||||
|
|
Loading…
Reference in New Issue