diff --git a/include/client/taos.h b/include/client/taos.h index 379363c51de7cdd11d8bd050b515ae21d1fa4858..647f906d4fc8490f44b025cda30c3cf86867835c 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -59,6 +59,7 @@ typedef enum { TSDB_OPTION_TIMEZONE, TSDB_OPTION_CONFIGDIR, TSDB_OPTION_SHELL_ACTIVITY_TIMER, + TSDB_OPTION_USE_ADAPTER, TSDB_MAX_OPTIONS } TSDB_OPTION; @@ -218,7 +219,7 @@ DLL_EXPORT const void *taos_get_raw_block(TAOS_RES *res); DLL_EXPORT int taos_get_db_route_info(TAOS *taos, const char *db, TAOS_DB_ROUTE_INFO *dbInfo); DLL_EXPORT int taos_get_table_vgId(TAOS *taos, const char *db, const char *table, int *vgId); -DLL_EXPORT int taos_load_table_info(TAOS *taos, const char *tableNameList); +DLL_EXPORT int taos_load_table_info(TAOS *taos, const char *tableNameList); /* --------------------------schemaless INTERFACE------------------------------- */ @@ -229,13 +230,14 @@ DLL_EXPORT TAOS_RES *taos_schemaless_insert_raw(TAOS *taos, char *lines, int len int precision); DLL_EXPORT TAOS_RES *taos_schemaless_insert_raw_with_reqid(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision, int64_t reqid); -DLL_EXPORT TAOS_RES *taos_schemaless_insert_ttl(TAOS *taos, char *lines[], int numLines, int protocol, int precision, int32_t ttl); +DLL_EXPORT TAOS_RES *taos_schemaless_insert_ttl(TAOS *taos, char *lines[], int numLines, int protocol, int precision, + int32_t ttl); DLL_EXPORT TAOS_RES *taos_schemaless_insert_ttl_with_reqid(TAOS *taos, char *lines[], int numLines, int protocol, - int precision, int32_t ttl, int64_t reqid); + int precision, int32_t ttl, int64_t reqid); DLL_EXPORT TAOS_RES *taos_schemaless_insert_raw_ttl(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, - int precision, int32_t ttl); + int precision, int32_t ttl); DLL_EXPORT TAOS_RES *taos_schemaless_insert_raw_ttl_with_reqid(TAOS *taos, char *lines, int len, int32_t *totalRows, - int protocol, int precision, int32_t ttl, int64_t reqid); + int protocol, int precision, int32_t ttl, int64_t reqid); /* --------------------------TMQ INTERFACE------------------------------- */ @@ -308,7 +310,8 @@ DLL_EXPORT tmq_res_t tmq_get_res_type(TAOS_RES *res); DLL_EXPORT int32_t tmq_get_raw(TAOS_RES *res, tmq_raw_data *raw); DLL_EXPORT int32_t tmq_write_raw(TAOS *taos, tmq_raw_data raw); DLL_EXPORT int taos_write_raw_block(TAOS *taos, int numOfRows, char *pData, const char *tbname); -DLL_EXPORT int taos_write_raw_block_with_fields(TAOS* taos, int rows, char* pData, const char* tbname, TAOS_FIELD *fields, int numFields); +DLL_EXPORT int taos_write_raw_block_with_fields(TAOS *taos, int rows, char *pData, const char *tbname, + TAOS_FIELD *fields, int numFields); DLL_EXPORT void tmq_free_raw(tmq_raw_data raw); // Returning null means error. Returned result need to be freed by tmq_free_json_meta DLL_EXPORT char *tmq_get_json_meta(TAOS_RES *res); diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 92672311d0661af86fbf2026d23ac1cb8f5a345c..9e8a139b31abe31d2a382fe1c6c30282c5bf2a27 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -101,6 +101,7 @@ extern int32_t tsRedirectPeriod; extern int32_t tsRedirectFactor; extern int32_t tsRedirectMaxPeriod; extern int32_t tsMaxRetryWaitTime; +extern bool tsUseAdapter; // client extern int32_t tsMinSlidingTime; diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 2cb337fc4ce6c8432b80e6d87a3824b78d299cb2..64e1fd908a6badc5876548193beeed513e894c22 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -469,6 +469,9 @@ int taos_options_imp(TSDB_OPTION option, const char *str) { case TSDB_OPTION_TIMEZONE: pItem = cfgGetItem(pCfg, "timezone"); break; + case TSDB_OPTION_USE_ADAPTER: + pItem = cfgGetItem(pCfg, "useAdapter"); + break; default: break; } diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index f57d59fb41381ecf87ffc56f01e8ee929b7da231..9caf0cc33e3e97243b0fd00b7ccfb7f2c3e81110 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -96,6 +96,7 @@ int32_t tsRedirectPeriod = 10; int32_t tsRedirectFactor = 2; int32_t tsRedirectMaxPeriod = 1000; int32_t tsMaxRetryWaitTime = 10000; +bool tsUseAdapter = false; /* * denote if the server needs to compress response message at the application layer to client, including query rsp, @@ -201,9 +202,7 @@ int32_t taosSetTfsCfg(SConfig *pCfg) { int32_t taosSetTfsCfg(SConfig *pCfg); #endif -struct SConfig *taosGetCfg() { - return tsCfg; -} +struct SConfig *taosGetCfg() { return tsCfg; } static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *inputCfgDir, const char *envFile, char *apolloUrl) { @@ -314,6 +313,7 @@ static int32_t taosAddClientCfg(SConfig *pCfg) { if (cfgAddInt32(pCfg, "smlBatchSize", tsSmlBatchSize, 1, INT32_MAX, true) != 0) return -1; if (cfgAddInt32(pCfg, "maxMemUsedByInsert", tsMaxMemUsedByInsert, 1, INT32_MAX, true) != 0) return -1; if (cfgAddInt32(pCfg, "maxRetryWaitTime", tsMaxRetryWaitTime, 0, 86400000, 0) != 0) return -1; + if (cfgAddBool(pCfg, "useAdapter", tsUseAdapter, true) != 0) return -1; tsNumOfTaskQueueThreads = tsNumOfCores / 2; tsNumOfTaskQueueThreads = TMAX(tsNumOfTaskQueueThreads, 4); @@ -668,6 +668,7 @@ static int32_t taosSetClientCfg(SConfig *pCfg) { tsQueryNodeChunkSize = cfgGetItem(pCfg, "queryNodeChunkSize")->i32; tsQueryUseNodeAllocator = cfgGetItem(pCfg, "queryUseNodeAllocator")->bval; tsKeepColumnName = cfgGetItem(pCfg, "keepColumnName")->bval; + tsUseAdapter = cfgGetItem(pCfg, "useAdapter")->bval; tsMaxRetryWaitTime = cfgGetItem(pCfg, "maxRetryWaitTime")->i32; return 0; diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 159fc966c1ab892916243eac6acbf1d9e97b58c2..98c6aed829128140217d2c1ba243afac7b3ecb01 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -1494,6 +1494,10 @@ static int32_t parseDataFromFile(SInsertParseContext* pCxt, SVnodeModifOpStmt* p static int32_t parseFileClause(SInsertParseContext* pCxt, SVnodeModifOpStmt* pStmt, STableDataBlocks* pDataBuf, SToken* pToken) { + if (tsUseAdapter) { + return buildInvalidOperationMsg(&pCxt->msg, "proxy mode does not support csv loading"); + } + NEXT_TOKEN(pStmt->pSql, *pToken); if (0 == pToken->n || (TK_NK_STRING != pToken->type && TK_NK_ID != pToken->type)) { return buildSyntaxErrMsg(&pCxt->msg, "file path is required following keyword FILE", pToken->z);