create stable/table
This commit is contained in:
parent
30e52bb71a
commit
af9fdcd29d
|
@ -78,5 +78,6 @@ bool checkColumnLevel(uint8_t type, char level[TSDB_CL_COMPRESS_OPTION_LEN]);
|
||||||
void setColEncode(uint32_t* compress, uint8_t encode);
|
void setColEncode(uint32_t* compress, uint8_t encode);
|
||||||
void setColCompress(uint32_t* compress, uint16_t compressType);
|
void setColCompress(uint32_t* compress, uint16_t compressType);
|
||||||
void setColLevel(uint32_t* compress, uint8_t level);
|
void setColLevel(uint32_t* compress, uint8_t level);
|
||||||
|
void setColCompressByOption(uint32_t* compress, uint8_t encode, uint16_t compressType, uint8_t level);
|
||||||
|
|
||||||
#endif /*_TD_TCOL_H_*/
|
#endif /*_TD_TCOL_H_*/
|
||||||
|
|
|
@ -675,8 +675,16 @@ static FORCE_INLINE SColCmprWrapper* tCloneSColCmprWrapper(const SColCmprWrapper
|
||||||
return pDstWrapper;
|
return pDstWrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static FORCE_INLINE void tInitDefaultSColCmprWrapperByCols(SColCmprWrapper* pCmpr, int32_t nCols) {
|
||||||
|
assert(!pCmpr->pColCmpr);
|
||||||
|
pCmpr->pColCmpr = taosMemoryCalloc(nCols, sizeof(SColCmpr));
|
||||||
|
pCmpr->nCols = nCols;
|
||||||
|
}
|
||||||
|
|
||||||
static FORCE_INLINE void tInitDefaultSColCmprWrapper(SColCmprWrapper* pCmpr, SSchemaWrapper* pSchema) {
|
static FORCE_INLINE void tInitDefaultSColCmprWrapper(SColCmprWrapper* pCmpr, SSchemaWrapper* pSchema) {
|
||||||
pCmpr->nCols = pSchema->nCols;
|
pCmpr->nCols = pSchema->nCols;
|
||||||
|
assert(!pCmpr->pColCmpr);
|
||||||
|
pCmpr->pColCmpr = taosMemoryCalloc(pCmpr->nCols, sizeof(SColCmpr));
|
||||||
for (int32_t i = 0; i < pCmpr->nCols; i++) {
|
for (int32_t i = 0; i < pCmpr->nCols; i++) {
|
||||||
SColCmpr* pColCmpr = &pCmpr->pColCmpr[i];
|
SColCmpr* pColCmpr = &pCmpr->pColCmpr[i];
|
||||||
SSchema* pColSchema = &pSchema->pSchema[i];
|
SSchema* pColSchema = &pSchema->pSchema[i];
|
||||||
|
|
|
@ -152,11 +152,11 @@ const char* columnCompressStr(uint16_t type) {
|
||||||
|
|
||||||
uint8_t columnLevelVal(const char* level) {
|
uint8_t columnLevelVal(const char* level) {
|
||||||
uint8_t l = TSDB_COLVAL_LEVEL_MEDIUM;
|
uint8_t l = TSDB_COLVAL_LEVEL_MEDIUM;
|
||||||
if (0 == strcmp(level, TSDB_COLUMN_LEVEL_HIGH)) {
|
if (0 == strcmp(level, "h") || 0 == strcmp(level, TSDB_COLUMN_LEVEL_HIGH)) {
|
||||||
l = TSDB_COLVAL_LEVEL_HIGH;
|
l = TSDB_COLVAL_LEVEL_HIGH;
|
||||||
} else if (0 == strcmp(level, TSDB_COLUMN_LEVEL_MEDIUM)) {
|
} else if (0 == strcmp(level, "m") || 0 == strcmp(level, TSDB_COLUMN_LEVEL_MEDIUM)) {
|
||||||
l = TSDB_COLVAL_LEVEL_MEDIUM;
|
l = TSDB_COLVAL_LEVEL_MEDIUM;
|
||||||
} else if (0 == strcmp(level, TSDB_COLUMN_LEVEL_LOW)) {
|
} else if (0 == strcmp(level, "l") || 0 == strcmp(level, TSDB_COLUMN_LEVEL_LOW)) {
|
||||||
l = TSDB_COLVAL_LEVEL_LOW;
|
l = TSDB_COLVAL_LEVEL_LOW;
|
||||||
}
|
}
|
||||||
return l;
|
return l;
|
||||||
|
@ -228,7 +228,7 @@ bool checkColumnEncode(uint8_t type, char encode[TSDB_CL_COMPRESS_OPTION_LEN]) {
|
||||||
}
|
}
|
||||||
bool checkColumnCompress(uint8_t type, char compress[TSDB_CL_COMPRESS_OPTION_LEN]) {
|
bool checkColumnCompress(uint8_t type, char compress[TSDB_CL_COMPRESS_OPTION_LEN]) {
|
||||||
if (0 == strlen(compress)) {
|
if (0 == strlen(compress)) {
|
||||||
strncpy(compress, getDefaultEncodeStr(type), TSDB_CL_COMPRESS_OPTION_LEN);
|
strncpy(compress, getDefaultCompressStr(type), TSDB_CL_COMPRESS_OPTION_LEN);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
strtolower(compress, compress);
|
strtolower(compress, compress);
|
||||||
|
@ -272,3 +272,10 @@ void setColLevel(uint32_t* compress, uint8_t level) {
|
||||||
*compress |= level;
|
*compress |= level;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setColCompressByOption(uint32_t* compress, uint8_t encode, uint16_t compressType, uint8_t level) {
|
||||||
|
setColEncode(compress, encode);
|
||||||
|
setColCompress(compress, compressType);
|
||||||
|
setColLevel(compress, level);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
|
@ -7722,6 +7722,9 @@ void tDestroySVCreateTbReq(SVCreateTbReq *pReq, int32_t flags) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pReq->colCmpr.pColCmpr) taosMemoryFree(pReq->colCmpr.pColCmpr);
|
||||||
|
pReq->colCmpr.pColCmpr = NULL;
|
||||||
|
|
||||||
if (pReq->sql != NULL) {
|
if (pReq->sql != NULL) {
|
||||||
taosMemoryFree(pReq->sql);
|
taosMemoryFree(pReq->sql);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1125,6 +1125,10 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) {
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo xsdebug
|
||||||
|
terrno = TSDB_CODE_OPS_NOT_SUPPORT;
|
||||||
|
goto _OVER;
|
||||||
|
|
||||||
mInfo("stb:%s, start to create", createReq.name);
|
mInfo("stb:%s, start to create", createReq.name);
|
||||||
if (mndCheckCreateStbReq(&createReq) != 0) {
|
if (mndCheckCreateStbReq(&createReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
|
|
|
@ -9870,8 +9870,15 @@ static int32_t buildNormalTableBatchReq(int32_t acctId, const SCreateTableStmt*
|
||||||
}
|
}
|
||||||
SNode* pCol;
|
SNode* pCol;
|
||||||
col_id_t index = 0;
|
col_id_t index = 0;
|
||||||
|
tInitDefaultSColCmprWrapperByCols(&req.colCmpr, req.ntb.schemaRow.nCols);
|
||||||
FOREACH(pCol, pStmt->pCols) {
|
FOREACH(pCol, pStmt->pCols) {
|
||||||
toSchema((SColumnDefNode*)pCol, index + 1, req.ntb.schemaRow.pSchema + index);
|
SColumnDefNode* pColDef = (SColumnDefNode*)pCol;
|
||||||
|
toSchema(pColDef, index + 1, req.ntb.schemaRow.pSchema + index);
|
||||||
|
if (pColDef->pOptions) {
|
||||||
|
req.colCmpr.pColCmpr[index].id = index + 1;
|
||||||
|
setColCompressByOption(&req.colCmpr.pColCmpr[index].alg, columnEncodeVal(pColDef->pOptions->encode),
|
||||||
|
columnCompressVal(pColDef->pOptions->compress), columnLevelVal(pColDef->pOptions->compressLevel));
|
||||||
|
}
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
pBatch->info = *pVgroupInfo;
|
pBatch->info = *pVgroupInfo;
|
||||||
|
|
Loading…
Reference in New Issue