feat: add minDiskFreeSize cfg
This commit is contained in:
parent
588e453df7
commit
6a20420f07
|
@ -11,7 +11,7 @@ ExternalProject_Add(aprutil-1
|
||||||
BUILD_IN_SOURCE TRUE
|
BUILD_IN_SOURCE TRUE
|
||||||
BUILD_ALWAYS 1
|
BUILD_ALWAYS 1
|
||||||
#UPDATE_COMMAND ""
|
#UPDATE_COMMAND ""
|
||||||
CONFIGURE_COMMAND ./configure --prefix=$ENV{HOME}/.cos-local.1/ --with-apr=$ENV{HOME}/.cos-local.1 --without-expat
|
CONFIGURE_COMMAND ./configure --prefix=$ENV{HOME}/.cos-local.1/ --with-apr=$ENV{HOME}/.cos-local.1
|
||||||
#CONFIGURE_COMMAND ./configure --with-apr=/usr/local/apr
|
#CONFIGURE_COMMAND ./configure --with-apr=/usr/local/apr
|
||||||
BUILD_COMMAND make
|
BUILD_COMMAND make
|
||||||
INSTALL_COMMAND make install
|
INSTALL_COMMAND make install
|
||||||
|
|
|
@ -161,6 +161,7 @@ extern char tsCompressor[];
|
||||||
// tfs
|
// tfs
|
||||||
extern int32_t tsDiskCfgNum;
|
extern int32_t tsDiskCfgNum;
|
||||||
extern SDiskCfg tsDiskCfg[];
|
extern SDiskCfg tsDiskCfg[];
|
||||||
|
extern int64_t tsMinDiskFreeSize;
|
||||||
|
|
||||||
// udf
|
// udf
|
||||||
extern bool tsStartUdfd;
|
extern bool tsStartUdfd;
|
||||||
|
|
|
@ -186,6 +186,7 @@ int32_t tsCacheLazyLoadThreshold = 500;
|
||||||
|
|
||||||
int32_t tsDiskCfgNum = 0;
|
int32_t tsDiskCfgNum = 0;
|
||||||
SDiskCfg tsDiskCfg[TFS_MAX_DISKS] = {0};
|
SDiskCfg tsDiskCfg[TFS_MAX_DISKS] = {0};
|
||||||
|
int64_t tsMinDiskFreeSize = TFS_MIN_DISK_FREE_SIZE;
|
||||||
|
|
||||||
// stream scheduler
|
// stream scheduler
|
||||||
bool tsDeployOnSnode = true;
|
bool tsDeployOnSnode = true;
|
||||||
|
@ -305,9 +306,7 @@ int32_t taosSetS3Cfg(SConfig *pCfg) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SConfig *taosGetCfg() {
|
struct SConfig *taosGetCfg() { return tsCfg; }
|
||||||
return tsCfg;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *inputCfgDir, const char *envFile,
|
static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *inputCfgDir, const char *envFile,
|
||||||
char *apolloUrl) {
|
char *apolloUrl) {
|
||||||
|
@ -635,6 +634,11 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
|
||||||
if (cfgAddString(pCfg, "s3Endpoint", tsS3Endpoint, CFG_SCOPE_SERVER) != 0) return -1;
|
if (cfgAddString(pCfg, "s3Endpoint", tsS3Endpoint, CFG_SCOPE_SERVER) != 0) return -1;
|
||||||
if (cfgAddString(pCfg, "s3BucketName", tsS3BucketName, CFG_SCOPE_SERVER) != 0) return -1;
|
if (cfgAddString(pCfg, "s3BucketName", tsS3BucketName, CFG_SCOPE_SERVER) != 0) return -1;
|
||||||
|
|
||||||
|
// min free disk space used to check if the disk is full [50MB, 1GB]
|
||||||
|
if (cfgAddInt64(pCfg, "minDiskFreeSize", tsMinDiskFreeSize, TFS_MIN_DISK_FREE_SIZE, 1024 * 1024 * 1024,
|
||||||
|
CFG_SCOPE_SERVER) != 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
GRANT_CFG_ADD;
|
GRANT_CFG_ADD;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1034,6 +1038,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
|
||||||
tsMaxStreamBackendCache = cfgGetItem(pCfg, "maxStreamBackendCache")->i32;
|
tsMaxStreamBackendCache = cfgGetItem(pCfg, "maxStreamBackendCache")->i32;
|
||||||
tsPQSortMemThreshold = cfgGetItem(pCfg, "pqSortMemThreshold")->i32;
|
tsPQSortMemThreshold = cfgGetItem(pCfg, "pqSortMemThreshold")->i32;
|
||||||
tsResolveFQDNRetryTime = cfgGetItem(pCfg, "resolveFQDNRetryTime")->i32;
|
tsResolveFQDNRetryTime = cfgGetItem(pCfg, "resolveFQDNRetryTime")->i32;
|
||||||
|
tsMinDiskFreeSize = cfgGetItem(pCfg, "minDiskFreeSize")->i64;
|
||||||
|
|
||||||
GRANT_CFG_GET;
|
GRANT_CFG_GET;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "tfsInt.h"
|
#include "tfsInt.h"
|
||||||
|
|
||||||
|
extern int64_t tsMinDiskFreeSize;
|
||||||
|
|
||||||
int32_t tfsInitTier(STfsTier *pTier, int32_t level) {
|
int32_t tfsInitTier(STfsTier *pTier, int32_t level) {
|
||||||
memset(pTier, 0, sizeof(STfsTier));
|
memset(pTier, 0, sizeof(STfsTier));
|
||||||
|
|
||||||
|
@ -114,7 +116,7 @@ int32_t tfsAllocDiskOnTier(STfsTier *pTier) {
|
||||||
|
|
||||||
if (pDisk == NULL) continue;
|
if (pDisk == NULL) continue;
|
||||||
|
|
||||||
if (pDisk->size.avail < TFS_MIN_DISK_FREE_SIZE) continue;
|
if (pDisk->size.avail < tsMinDiskFreeSize) continue;
|
||||||
|
|
||||||
retId = diskId;
|
retId = diskId;
|
||||||
terrno = 0;
|
terrno = 0;
|
||||||
|
@ -132,7 +134,7 @@ void tfsPosNextId(STfsTier *pTier) {
|
||||||
for (int32_t id = 1; id < pTier->ndisk; id++) {
|
for (int32_t id = 1; id < pTier->ndisk; id++) {
|
||||||
STfsDisk *pLDisk = pTier->disks[nextid];
|
STfsDisk *pLDisk = pTier->disks[nextid];
|
||||||
STfsDisk *pDisk = pTier->disks[id];
|
STfsDisk *pDisk = pTier->disks[id];
|
||||||
if (pDisk->size.avail > TFS_MIN_DISK_FREE_SIZE && pDisk->size.avail > pLDisk->size.avail) {
|
if (pDisk->size.avail > tsMinDiskFreeSize && pDisk->size.avail > pLDisk->size.avail) {
|
||||||
nextid = id;
|
nextid = id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue