os: fix minimalDirGB invalid error
This commit is contained in:
parent
be63a2e45e
commit
d67339bfc8
|
@ -49,6 +49,8 @@ void osDefaultInit();
|
|||
void osUpdate();
|
||||
void osCleanup();
|
||||
bool osLogSpaceAvailable();
|
||||
bool osDataSpaceAvailable();
|
||||
bool osTempSpaceAvailable();
|
||||
void osSetTimezone(const char *timezone);
|
||||
void osSetSystemLocale(const char *inLocale, const char *inCharSet);
|
||||
|
||||
|
|
|
@ -30,6 +30,12 @@ static int32_t STSBufUpdateHeader(STSBuf* pTSBuf, STSBufFileHeader* pHeader);
|
|||
* @return
|
||||
*/
|
||||
STSBuf* tsBufCreate(bool autoDelete, int32_t order) {
|
||||
if (!osTempSpaceAvailable()) {
|
||||
terrno = TSDB_CODE_TSC_NO_DISKSPACE;
|
||||
tscError("tmp file created failed since %s", terrstr());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
STSBuf* pTSBuf = taosMemoryCalloc(1, sizeof(STSBuf));
|
||||
if (pTSBuf == NULL) {
|
||||
return NULL;
|
||||
|
|
|
@ -176,7 +176,11 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp
|
|||
taosWriteQitem(pVnode->pFetchQ, pMsg);
|
||||
break;
|
||||
case WRITE_QUEUE:
|
||||
if ((pMsg->msgType == TDMT_VND_SUBMIT) && (grantCheck(TSDB_GRANT_STORAGE) != TSDB_CODE_SUCCESS)) {
|
||||
if (!osDataSpaceAvailable()) {
|
||||
terrno = TSDB_CODE_VND_NO_DISKSPACE;
|
||||
code = terrno;
|
||||
dError("vgId:%d, msg:%p put into vnode-write queue failed since %s", pVnode->vgId, pMsg, terrstr());
|
||||
} else if ((pMsg->msgType == TDMT_VND_SUBMIT) && (grantCheck(TSDB_GRANT_STORAGE) != TSDB_CODE_SUCCESS)) {
|
||||
terrno = TSDB_CODE_VND_NO_WRITE_AUTH;
|
||||
code = terrno;
|
||||
dDebug("vgId:%d, msg:%p put into vnode-write queue failed since %s", pVnode->vgId, pMsg, terrstr());
|
||||
|
|
|
@ -49,8 +49,26 @@ static int32_t dmInitMonitor() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static bool dmCheckDiskSpace() {
|
||||
osUpdate();
|
||||
if (osDataSpaceAvailable()) {
|
||||
dError("free disk size: %f GB, too little, quit", tsDataSpace.size.avail);
|
||||
return false;
|
||||
}
|
||||
if (osLogSpaceAvailable()) {
|
||||
dError("free disk size: %f GB, too little, quit", tsLogSpace.size.avail);
|
||||
return false;
|
||||
}
|
||||
if (osTempSpaceAvailable()) {
|
||||
dError("free disk size: %f GB, too little, quit", tsTempSpace.size.avail);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t dmInit(int8_t rtype) {
|
||||
dInfo("start to init dnode env");
|
||||
if (!dmCheckDiskSpace()) return -1;
|
||||
if (dmCheckRepeatInit(dmInstance()) != 0) return -1;
|
||||
if (dmInitSystem() != 0) return -1;
|
||||
if (dmInitMonitor() != 0) return -1;
|
||||
|
|
|
@ -105,6 +105,10 @@ void osCleanup() {}
|
|||
|
||||
bool osLogSpaceAvailable() { return tsLogSpace.reserved <= tsLogSpace.size.avail; }
|
||||
|
||||
bool osDataSpaceAvailable() { return tsDataSpace.reserved <= tsDataSpace.size.avail; }
|
||||
|
||||
bool osTempSpaceAvailable() { return tsTempSpace.reserved <= tsTempSpace.size.avail; }
|
||||
|
||||
void osSetTimezone(const char *timezone) { taosSetSystemTimezone(timezone, tsTimezoneStr, &tsDaylight, &tsTimezone); }
|
||||
|
||||
void osSetSystemLocale(const char *inLocale, const char *inCharSet) {
|
||||
|
|
Loading…
Reference in New Issue