Merge pull request #15688 from taosdata/fix/ZhiqiangWang/TD-17383-add-table-create-limit
feat: add table create limit
This commit is contained in:
commit
087d431088
|
@ -490,6 +490,16 @@ static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pR
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((terrno = grantCheck(TSDB_GRANT_STABLE)) < 0) {
|
||||||
|
rcode = -1;
|
||||||
|
goto _exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((terrno = grantCheck(TSDB_GRANT_TABLE)) < 0) {
|
||||||
|
rcode = -1;
|
||||||
|
goto _exit;
|
||||||
|
}
|
||||||
|
|
||||||
// validate hash
|
// validate hash
|
||||||
sprintf(tbName, "%s.%s", pVnode->config.dbname, pCreateReq->name);
|
sprintf(tbName, "%s.%s", pVnode->config.dbname, pCreateReq->name);
|
||||||
if (vnodeValidateTableHash(pVnode, tbName) < 0) {
|
if (vnodeValidateTableHash(pVnode, tbName) < 0) {
|
||||||
|
@ -840,6 +850,20 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((terrno = grantCheck(TSDB_GRANT_STABLE)) < 0) {
|
||||||
|
pRsp->code = terrno;
|
||||||
|
tDecoderClear(&decoder);
|
||||||
|
taosArrayDestroy(createTbReq.ctb.tagName);
|
||||||
|
goto _exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((terrno = grantCheck(TSDB_GRANT_TABLE)) < 0) {
|
||||||
|
pRsp->code = terrno;
|
||||||
|
tDecoderClear(&decoder);
|
||||||
|
taosArrayDestroy(createTbReq.ctb.tagName);
|
||||||
|
goto _exit;
|
||||||
|
}
|
||||||
|
|
||||||
if (metaCreateTable(pVnode->pMeta, version, &createTbReq) < 0) {
|
if (metaCreateTable(pVnode->pMeta, version, &createTbReq) < 0) {
|
||||||
if (terrno != TSDB_CODE_TDB_TABLE_ALREADY_EXIST) {
|
if (terrno != TSDB_CODE_TDB_TABLE_ALREADY_EXIST) {
|
||||||
submitBlkRsp.code = terrno;
|
submitBlkRsp.code = terrno;
|
||||||
|
|
|
@ -410,6 +410,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_SPEED_LIMITED, "Write speed limited b
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_STORAGE_LIMITED, "Storage capacity limited by license")
|
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_STORAGE_LIMITED, "Storage capacity limited by license")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_QUERYTIME_LIMITED, "Query time limited by license")
|
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_QUERYTIME_LIMITED, "Query time limited by license")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_CPU_LIMITED, "CPU cores limited by license")
|
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_CPU_LIMITED, "CPU cores limited by license")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_STABLE_LIMITED, "STable creation limited by license")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_TABLE_LIMITED, "Table creation limited by license")
|
||||||
|
|
||||||
// sync
|
// sync
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_SYN_TIMEOUT, "Sync timeout")
|
TAOS_DEFINE_ERROR(TSDB_CODE_SYN_TIMEOUT, "Sync timeout")
|
||||||
|
|
|
@ -525,7 +525,11 @@ int32_t shellReadCommand(char *command) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'A': // Up arrow
|
case 'A': // Up arrow
|
||||||
hist_counter = (hist_counter + SHELL_MAX_HISTORY_SIZE - 1) % SHELL_MAX_HISTORY_SIZE;
|
hist_counter = (hist_counter + SHELL_MAX_HISTORY_SIZE - 1) % SHELL_MAX_HISTORY_SIZE;
|
||||||
shellResetCommand(&cmd, (pHistory->hist[hist_counter] == NULL) ? "" : pHistory->hist[hist_counter]);
|
if (pHistory->hist[hist_counter] == NULL) {
|
||||||
|
hist_counter = (hist_counter + SHELL_MAX_HISTORY_SIZE + 1) % SHELL_MAX_HISTORY_SIZE;
|
||||||
|
} else {
|
||||||
|
shellResetCommand(&cmd, pHistory->hist[hist_counter]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'B': // Down arrow
|
case 'B': // Down arrow
|
||||||
if (hist_counter != pHistory->hend) {
|
if (hist_counter != pHistory->hend) {
|
||||||
|
|
Loading…
Reference in New Issue