Merge pull request #5320 from taosdata/hotfix/test
[TD-3151]<feature> support config cachelast
This commit is contained in:
commit
535234a1a3
|
@ -335,6 +335,7 @@ typedef struct SDbCfg_S {
|
||||||
int maxRows;
|
int maxRows;
|
||||||
int comp;
|
int comp;
|
||||||
int walLevel;
|
int walLevel;
|
||||||
|
int cacheLast;
|
||||||
int fsync;
|
int fsync;
|
||||||
int replica;
|
int replica;
|
||||||
int update;
|
int update;
|
||||||
|
@ -2022,6 +2023,9 @@ static int createDatabases() {
|
||||||
if (g_Dbs.db[i].dbCfg.walLevel > 0) {
|
if (g_Dbs.db[i].dbCfg.walLevel > 0) {
|
||||||
dataLen += snprintf(command + dataLen, BUFFER_SIZE - dataLen, "wal %d ", g_Dbs.db[i].dbCfg.walLevel);
|
dataLen += snprintf(command + dataLen, BUFFER_SIZE - dataLen, "wal %d ", g_Dbs.db[i].dbCfg.walLevel);
|
||||||
}
|
}
|
||||||
|
if (g_Dbs.db[i].dbCfg.cacheLast > 0) {
|
||||||
|
dataLen += snprintf(command + dataLen, BUFFER_SIZE - dataLen, "cachelast %d ", g_Dbs.db[i].dbCfg.cacheLast);
|
||||||
|
}
|
||||||
if (g_Dbs.db[i].dbCfg.fsync > 0) {
|
if (g_Dbs.db[i].dbCfg.fsync > 0) {
|
||||||
dataLen += snprintf(command + dataLen, BUFFER_SIZE - dataLen, "fsync %d ", g_Dbs.db[i].dbCfg.fsync);
|
dataLen += snprintf(command + dataLen, BUFFER_SIZE - dataLen, "fsync %d ", g_Dbs.db[i].dbCfg.fsync);
|
||||||
}
|
}
|
||||||
|
@ -2722,6 +2726,16 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cJSON* cacheLast= cJSON_GetObjectItem(dbinfo, "cachelast");
|
||||||
|
if (cacheLast && cacheLast->type == cJSON_Number) {
|
||||||
|
g_Dbs.db[i].dbCfg.cacheLast = cacheLast->valueint;
|
||||||
|
} else if (!cacheLast) {
|
||||||
|
g_Dbs.db[i].dbCfg.cacheLast = -1;
|
||||||
|
} else {
|
||||||
|
printf("failed to read json, cacheLast not found");
|
||||||
|
goto PARSE_OVER;
|
||||||
|
}
|
||||||
|
|
||||||
cJSON* quorum= cJSON_GetObjectItem(dbinfo, "quorum");
|
cJSON* quorum= cJSON_GetObjectItem(dbinfo, "quorum");
|
||||||
if (quorum && quorum->type == cJSON_Number) {
|
if (quorum && quorum->type == cJSON_Number) {
|
||||||
g_Dbs.db[i].dbCfg.quorum = quorum->valueint;
|
g_Dbs.db[i].dbCfg.quorum = quorum->valueint;
|
||||||
|
|
Loading…
Reference in New Issue