add fsync option
This commit is contained in:
parent
e78ce3bbe3
commit
ee14fa074c
|
@ -5530,6 +5530,13 @@ int32_t tscCheckCreateDbParams(SSqlCmd* pCmd, SCMCreateDbMsg* pCreate) {
|
|||
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg);
|
||||
}
|
||||
|
||||
val = htonl(pCreate->fsyncPeriod);
|
||||
if (val != -1 && (val < TSDB_MIN_FSYNC_PERIOD || val > TSDB_MAX_FSYNC_PERIOD)) {
|
||||
snprintf(msg, tListLen(msg), "invalid db option fsyncPeriod: %d valid range: [%d, %d]", val,
|
||||
TSDB_MIN_FSYNC_PERIOD, TSDB_MAX_FSYNC_PERIOD);
|
||||
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg);
|
||||
}
|
||||
|
||||
if (pCreate->compression != -1 &&
|
||||
(pCreate->compression < TSDB_MIN_COMP_LEVEL || pCreate->compression > TSDB_MAX_COMP_LEVEL)) {
|
||||
snprintf(msg, tListLen(msg), "invalid db option compression: %d valid range: [%d, %d]", pCreate->compression,
|
||||
|
|
|
@ -401,6 +401,7 @@ static int32_t dnodeProcessCreateVnodeMsg(SRpcMsg *rpcMsg) {
|
|||
pCreate->cfg.daysToKeep = htonl(pCreate->cfg.daysToKeep);
|
||||
pCreate->cfg.minRowsPerFileBlock = htonl(pCreate->cfg.minRowsPerFileBlock);
|
||||
pCreate->cfg.maxRowsPerFileBlock = htonl(pCreate->cfg.maxRowsPerFileBlock);
|
||||
pCreate->cfg.fsyncPeriod = htonl(pCreate->cfg.fsyncPeriod);
|
||||
pCreate->cfg.commitTime = htonl(pCreate->cfg.commitTime);
|
||||
|
||||
for (int32_t j = 0; j < pCreate->cfg.replications; ++j) {
|
||||
|
|
|
@ -222,7 +222,6 @@
|
|||
#define TK_INTO 204
|
||||
#define TK_VALUES 205
|
||||
|
||||
|
||||
#define TK_SPACE 300
|
||||
#define TK_COMMENT 301
|
||||
#define TK_ILLEGAL 302
|
||||
|
|
|
@ -561,6 +561,12 @@ static int32_t mnodeGetDbMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn
|
|||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 4;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_INT;
|
||||
strcpy(pSchema[cols].name, "fsync");
|
||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 1;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_TINYINT;
|
||||
strcpy(pSchema[cols].name, "comp");
|
||||
|
@ -764,6 +770,7 @@ static int32_t mnodeProcessCreateDbMsg(SMnodeMsg *pMsg) {
|
|||
pCreate->daysToKeep1 = htonl(pCreate->daysToKeep1);
|
||||
pCreate->daysToKeep2 = htonl(pCreate->daysToKeep2);
|
||||
pCreate->commitTime = htonl(pCreate->commitTime);
|
||||
pCreate->fsyncPeriod = htonl(pCreate->fsyncPeriod);
|
||||
pCreate->minRowsPerFileBlock = htonl(pCreate->minRowsPerFileBlock);
|
||||
pCreate->maxRowsPerFileBlock = htonl(pCreate->maxRowsPerFileBlock);
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ db_optr(Y) ::= db_optr(Z) maxrows(X). { Y = Z; Y.maxRowsPerBlock = strtod
|
|||
db_optr(Y) ::= db_optr(Z) blocks(X). { Y = Z; Y.numOfBlocks = strtol(X.z, NULL, 10); }
|
||||
db_optr(Y) ::= db_optr(Z) ctime(X). { Y = Z; Y.commitTime = strtol(X.z, NULL, 10); }
|
||||
db_optr(Y) ::= db_optr(Z) wal(X). { Y = Z; Y.walLevel = strtol(X.z, NULL, 10); }
|
||||
db_optr(Y) ::= db_optr(Z) fsync(X). { Y = Z; Y.fsyncPeriod = strtod(X.z, NULL); }
|
||||
db_optr(Y) ::= db_optr(Z) fsync(X). { Y = Z; Y.fsyncPeriod = strtol(X.z, NULL, 10); }
|
||||
db_optr(Y) ::= db_optr(Z) comp(X). { Y = Z; Y.compressionLevel = strtol(X.z, NULL, 10); }
|
||||
db_optr(Y) ::= db_optr(Z) prec(X). { Y = Z; Y.precision = X; }
|
||||
db_optr(Y) ::= db_optr(Z) keep(X). { Y = Z; Y.keep = X; }
|
||||
|
|
|
@ -30,8 +30,12 @@
|
|||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
#include "qsqlparser.h"
|
||||
#include "tcmdtype.h"
|
||||
#include "tstoken.h"
|
||||
#include "ttokendef.h"
|
||||
#include "tutil.h"
|
||||
|
||||
#include "tvariant.h"
|
||||
/**************** End of %include directives **********************************/
|
||||
/* These constants specify the various numeric values for terminal symbols
|
||||
** in a format understandable to "makeheaders". This section is blank unless
|
||||
|
@ -2252,7 +2256,7 @@ static void yy_reduce(
|
|||
yymsp[-1].minor.yy158 = yylhsminor.yy158;
|
||||
break;
|
||||
case 93: /* db_optr ::= db_optr fsync */
|
||||
{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.fsyncPeriod = strtod(yymsp[0].minor.yy0.z, NULL); }
|
||||
{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
|
||||
yymsp[-1].minor.yy158 = yylhsminor.yy158;
|
||||
break;
|
||||
case 94: /* db_optr ::= db_optr comp */
|
||||
|
@ -2273,7 +2277,7 @@ static void yy_reduce(
|
|||
{ setDefaultCreateDbOption(&yymsp[1].minor.yy158);}
|
||||
break;
|
||||
case 104: /* alter_db_optr ::= alter_db_optr fsync */
|
||||
{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.fsyncPeriod = strtod(yymsp[0].minor.yy0.z, NULL, 10); }
|
||||
{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
|
||||
yymsp[-1].minor.yy158 = yylhsminor.yy158;
|
||||
break;
|
||||
case 105: /* typename ::= ids */
|
||||
|
|
|
@ -68,7 +68,10 @@ static void walRelease(SWal *pWal);
|
|||
|
||||
static void walModuleInitFunc() {
|
||||
walTmrCtrl = taosTmrInit(1000, 100, 300000, "WAL");
|
||||
if (walTmrCtrl == NULL) walModuleInit = PTHREAD_ONCE_INIT;
|
||||
if (walTmrCtrl == NULL)
|
||||
walModuleInit = PTHREAD_ONCE_INIT;
|
||||
else
|
||||
wDebug("WAL module is initialized");
|
||||
}
|
||||
|
||||
void *walOpen(const char *path, const SWalCfg *pCfg) {
|
||||
|
@ -343,6 +346,7 @@ static void walRelease(SWal *pWal) {
|
|||
if (walTmrCtrl) taosTmrCleanUp(walTmrCtrl);
|
||||
walTmrCtrl = NULL;
|
||||
walModuleInit = PTHREAD_ONCE_INIT;
|
||||
wDebug("WAL module is cleaned up");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue