enhance: add bi mode to script

This commit is contained in:
slzhou 2023-09-22 13:34:14 +08:00
parent 9bb628650c
commit d858b26939
5 changed files with 79 additions and 0 deletions

View File

@ -1011,6 +1011,7 @@
,,y,script,./test.sh -f tsim/query/partitionby.sim ,,y,script,./test.sh -f tsim/query/partitionby.sim
,,y,script,./test.sh -f tsim/query/tableCount.sim ,,y,script,./test.sh -f tsim/query/tableCount.sim
,,y,script,./test.sh -f tsim/query/show_db_table_kind.sim ,,y,script,./test.sh -f tsim/query/show_db_table_kind.sim
,,y,script,./test.sh -f tsim/query/bi_star_tbname.sim
,,y,script,./test.sh -f tsim/query/tag_scan.sim ,,y,script,./test.sh -f tsim/query/tag_scan.sim
,,y,script,./test.sh -f tsim/query/nullColSma.sim ,,y,script,./test.sh -f tsim/query/nullColSma.sim
,,y,script,./test.sh -f tsim/query/bug3398.sim ,,y,script,./test.sh -f tsim/query/bug3398.sim

View File

@ -0,0 +1,29 @@
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect
sql drop database if exists db1;
sql create database db1 vgroups 3;
sql create database db1;
sql use db1;
sql create stable sta (ts timestamp, f1 int, f2 binary(200)) tags(t1 int, t2 int, t3 int);
sql create stable stb (ts timestamp, f1 int, f2 binary(200)) tags(t1 int, t2 int, t3 int);
sql create table tba1 using sta tags(1, 1, 1);
sql create table tba2 using sta tags(2, 2, 2);
sql insert into tba1 values(now, 1, "1");
sql insert into tba2 values(now + 1s, 2, "2");
sql create table tbn1 (ts timestamp, f1 int);
sql create database db2 vgroups 3;
sql create database db2;
sql use db2;
sql create stable sta (ts timestamp, f1 int, f2 binary(200)) tags(t1 int, t2 int, t3 int);
sql create stable stb (ts timestamp, f1 int, f2 binary(200)) tags(t1 int, t2 int, t3 int);
sql create table tba1 using sta tags(1, 1, 1);
sql create table tba2 using sta tags(2, 2, 2);
set_bi_mode 1
sql select * from db1.sta;
print $rows
print $data00 $data01 $data02 $data03 $data04 $data05 $data06
system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -123,6 +123,7 @@ enum {
SIM_CMD_RETURN, SIM_CMD_RETURN,
SIM_CMD_LINE_INSERT, SIM_CMD_LINE_INSERT,
SIM_CMD_LINE_INSERT_ERROR, SIM_CMD_LINE_INSERT_ERROR,
SIM_CMD_SET_BI_MODE,
SIM_CMD_END SIM_CMD_END
}; };
@ -210,6 +211,7 @@ bool simExecuteSqlSlowCmd(SScript *script, char *option);
bool simExecuteRestfulCmd(SScript *script, char *rest); bool simExecuteRestfulCmd(SScript *script, char *rest);
bool simExecuteLineInsertCmd(SScript *script, char *option); bool simExecuteLineInsertCmd(SScript *script, char *option);
bool simExecuteLineInsertErrorCmd(SScript *script, char *option); bool simExecuteLineInsertErrorCmd(SScript *script, char *option);
bool simExecuteSetBIModeCmd(SScript *script, char *option);
void simVisuallizeOption(SScript *script, char *src, char *dst); void simVisuallizeOption(SScript *script, char *src, char *dst);
#endif /*_TD_SIM_INT_H_*/ #endif /*_TD_SIM_INT_H_*/

View File

@ -502,6 +502,26 @@ bool simExecuteSystemContentCmd(SScript *script, char *option) {
return true; return true;
} }
bool simExecuteSetBIModeCmd(SScript *script, char *option) {
char buf[1024];
simVisuallizeOption(script, option, buf);
option = buf;
int32_t mode = atoi(option);
simInfo("script:%s, set bi mode %d", script->fileName, mode);
if (mode != 0) {
taos_set_conn_mode(script->taos, TAOS_CONN_MODE_BI, 1);
} else {
taos_set_conn_mode(script->taos, TAOS_CONN_MODE_BI, 0);
}
script->linePos++;
return true;
}
bool simExecutePrintCmd(SScript *script, char *rest) { bool simExecutePrintCmd(SScript *script, char *rest) {
char buf[65536]; char buf[65536];

View File

@ -745,6 +745,25 @@ bool simParseSystemContentCmd(char *rest, SCommand *pCmd, int32_t lineNum) {
return true; return true;
} }
bool simParseSetBIModeCmd(char *rest, SCommand *pCmd, int32_t lineNum) {
char *token;
int32_t tokenLen;
cmdLine[numOfLines].cmdno = SIM_CMD_SET_BI_MODE;
cmdLine[numOfLines].lineNum = lineNum;
paGetToken(rest, &token, &tokenLen);
if (tokenLen > 0) {
cmdLine[numOfLines].optionOffset = optionOffset;
memcpy(optionBuffer + optionOffset, token, tokenLen);
optionOffset += tokenLen + 1;
*(optionBuffer + optionOffset - 1) = 0;
}
numOfLines++;
return true;
}
bool simParseSleepCmd(char *rest, SCommand *pCmd, int32_t lineNum) { bool simParseSleepCmd(char *rest, SCommand *pCmd, int32_t lineNum) {
char *token; char *token;
int32_t tokenLen; int32_t tokenLen;
@ -1074,6 +1093,14 @@ void simInitsimCmdList() {
simCmdList[cmdno].executeCmd = simExecuteReturnCmd; simCmdList[cmdno].executeCmd = simExecuteReturnCmd;
simAddCmdIntoHash(&(simCmdList[cmdno])); simAddCmdIntoHash(&(simCmdList[cmdno]));
cmdno = SIM_CMD_SET_BI_MODE;
simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "set_bi_mode");
simCmdList[cmdno].nlen = (int16_t)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = simParseSetBIModeCmd;
simCmdList[cmdno].executeCmd = simExecuteSetBIModeCmd;
simAddCmdIntoHash(&(simCmdList[cmdno]));
#if 0 #if 0
cmdno = SIM_CMD_LINE_INSERT; cmdno = SIM_CMD_LINE_INSERT;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;