write config lock
This commit is contained in:
parent
d06bfd9cea
commit
c43e937538
|
@ -367,6 +367,10 @@ int mainWindows(int argc, char **argv) {
|
|||
}
|
||||
|
||||
if(global.generateCode) {
|
||||
if(dmCheckRunning(tsDataDir) == NULL) {
|
||||
dError("failed to generate encrypt code since taosd is running, please stop it first");
|
||||
return -1;
|
||||
}
|
||||
int ret = updateEncryptKey(global.encryptKey);
|
||||
taosCloseLog();
|
||||
taosCleanupArgs();
|
||||
|
|
|
@ -148,7 +148,7 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) {
|
|||
strncpy(pCfg->tsdbCfg.encryptKey, tsEncryptKey, ENCRYPT_KEY_LEN);
|
||||
}
|
||||
#else
|
||||
pCfg->tsdbCfg.cryptAlgorithm = 0;
|
||||
pCfg->tsdbCfg.encryptAlgorithm = 0;
|
||||
#endif
|
||||
|
||||
pCfg->walCfg.vgId = pCreate->vgId;
|
||||
|
@ -164,7 +164,7 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) {
|
|||
strncpy(pCfg->walCfg.encryptKey, tsEncryptKey, ENCRYPT_KEY_LEN);
|
||||
}
|
||||
#else
|
||||
pCfg->walCfg.cryptAlgorithm = 0;
|
||||
pCfg->walCfg.encryptAlgorithm = 0;
|
||||
#endif
|
||||
|
||||
#if defined(TD_ENTERPRISE)
|
||||
|
@ -173,7 +173,7 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) {
|
|||
strncpy(pCfg->tdbEncryptKey, tsEncryptKey, ENCRYPT_KEY_LEN);
|
||||
}
|
||||
#else
|
||||
pCfg->tdbEncryptKey = 0;
|
||||
pCfg->tdbEncryptAlgorithm = 0;
|
||||
#endif
|
||||
|
||||
pCfg->sttTrigger = pCreate->sstTrigger;
|
||||
|
|
|
@ -246,15 +246,15 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) {
|
|||
tjsonGetNumberValue(pJson, "tsdb.encryptAlgorithm", pCfg->tsdbCfg.encryptAlgorithm, code);
|
||||
if (code < 0) return -1;
|
||||
#if defined(TD_ENTERPRISE)
|
||||
// if(pCfg->tsdbCfg.encryptAlgorithm == DND_CA_SM4){
|
||||
// if(tsEncryptKey[0] == 0){
|
||||
// terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY;
|
||||
// return -1;
|
||||
// }
|
||||
// else{
|
||||
// strncpy(pCfg->tsdbCfg.encryptKey, tsEncryptKey, ENCRYPT_KEY_LEN);
|
||||
// }
|
||||
// }
|
||||
if(pCfg->tsdbCfg.encryptAlgorithm == DND_CA_SM4){
|
||||
if(tsEncryptKey[0] == 0){
|
||||
terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY;
|
||||
return -1;
|
||||
}
|
||||
else{
|
||||
strncpy(pCfg->tsdbCfg.encryptKey, tsEncryptKey, ENCRYPT_KEY_LEN);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
tjsonGetNumberValue(pJson, "wal.vgId", pCfg->walCfg.vgId, code);
|
||||
if (code < 0) return -1;
|
||||
|
@ -273,28 +273,28 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) {
|
|||
tjsonGetNumberValue(pJson, "wal.encryptAlgorithm", pCfg->walCfg.encryptAlgorithm, code);
|
||||
if (code < 0) return -1;
|
||||
#if defined(TD_ENTERPRISE)
|
||||
// if(pCfg->walCfg.encryptAlgorithm == DND_CA_SM4){
|
||||
// if(tsEncryptKey[0] == 0){
|
||||
// terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY;
|
||||
// return -1;
|
||||
// }
|
||||
// else{
|
||||
// strncpy(pCfg->walCfg.encryptKey, tsEncryptKey, ENCRYPT_KEY_LEN);
|
||||
// }
|
||||
// }
|
||||
if(pCfg->walCfg.encryptAlgorithm == DND_CA_SM4){
|
||||
if(tsEncryptKey[0] == 0){
|
||||
terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY;
|
||||
return -1;
|
||||
}
|
||||
else{
|
||||
strncpy(pCfg->walCfg.encryptKey, tsEncryptKey, ENCRYPT_KEY_LEN);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
tjsonGetNumberValue(pJson, "tdbEncryptAlgorithm", pCfg->tdbEncryptAlgorithm, code);
|
||||
if (code < 0) return -1;
|
||||
#if defined(TD_ENTERPRISE)
|
||||
// if(pCfg->tdbEncryptAlgorithm == DND_CA_SM4){
|
||||
// if(tsEncryptKey[0] == 0){
|
||||
// terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY;
|
||||
// return -1;
|
||||
// }
|
||||
// else{
|
||||
// strncpy(pCfg->tdbEncryptKey, tsEncryptKey, ENCRYPT_KEY_LEN);
|
||||
// }
|
||||
// }
|
||||
if(pCfg->tdbEncryptAlgorithm == DND_CA_SM4){
|
||||
if(tsEncryptKey[0] == 0){
|
||||
terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY;
|
||||
return -1;
|
||||
}
|
||||
else{
|
||||
strncpy(pCfg->tdbEncryptKey, tsEncryptKey, ENCRYPT_KEY_LEN);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
tjsonGetNumberValue(pJson, "sstTrigger", pCfg->sttTrigger, code);
|
||||
if (code < 0) pCfg->sttTrigger = TSDB_DEFAULT_SST_TRIGGER;
|
||||
|
|
Loading…
Reference in New Issue