[td-225] refactor code
This commit is contained in:
parent
7b77dcd1b6
commit
8f3798da1d
|
@ -474,33 +474,11 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
|
|||
// in case of insert, redo parsing the sql string and build new submit data block for two reasons:
|
||||
// 1. the table Id(tid & uid) may have been update, the submit block needs to be updated accordingly.
|
||||
// 2. vnode may need the schema information along with submit block to update its local table schema.
|
||||
if (pCmd->command == TSDB_SQL_INSERT) {
|
||||
tscDebug("%p redo parse sql string to build submit block", pSql);
|
||||
|
||||
pCmd->parseFinished = false;
|
||||
tscResetSqlCmdObj(pCmd);
|
||||
|
||||
code = tsParseSql(pSql, true);
|
||||
|
||||
if (code == TSDB_CODE_TSC_ACTION_IN_PROGRESS) {
|
||||
return;
|
||||
} else if (code != TSDB_CODE_SUCCESS) {
|
||||
goto _error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Discard previous built submit blocks, and then parse the sql string again and build up all submit blocks,
|
||||
* and send the required submit block according to index value in supporter to server.
|
||||
*/
|
||||
pSql->fp = pSql->fetchFp; // restore the fp
|
||||
tscHandleInsertRetry(pSql);
|
||||
} else if (pCmd->command == TSDB_SQL_SELECT) { // in case of other query type, continue
|
||||
if (pCmd->command == TSDB_SQL_INSERT || pCmd->command == TSDB_SQL_SELECT) {
|
||||
tscDebug("%p redo parse sql string and proceed", pSql);
|
||||
//tscDebug("before %p fp:%p, fetchFp:%p", pSql, pSql->fp, pSql->fetchFp);
|
||||
pCmd->parseFinished = false;
|
||||
tscResetSqlCmdObj(pCmd);
|
||||
|
||||
//tscDebug("after %p fp:%p, fetchFp:%p", pSql, pSql->fp, pSql->fetchFp);
|
||||
code = tsParseSql(pSql, true);
|
||||
|
||||
if (code == TSDB_CODE_TSC_ACTION_IN_PROGRESS) {
|
||||
|
@ -509,8 +487,17 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
|
|||
goto _error;
|
||||
}
|
||||
|
||||
tscProcessSql(pSql);
|
||||
} else { // in all other cases, simple retry
|
||||
if (pCmd->command == TSDB_SQL_INSERT) {
|
||||
/*
|
||||
* Discard previous built submit blocks, and then parse the sql string again and build up all submit blocks,
|
||||
* and send the required submit block according to index value in supporter to server.
|
||||
*/
|
||||
pSql->fp = pSql->fetchFp; // restore the fp
|
||||
tscHandleInsertRetry(pSql);
|
||||
} else if (pCmd->command == TSDB_SQL_SELECT) { // in case of other query type, continue
|
||||
tscProcessSql(pSql);
|
||||
}
|
||||
}else { // in all other cases, simple retry
|
||||
tscProcessSql(pSql);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue