-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #813 from taosdata/fix/TD-32823-3.0
enh: support retry after sleep
- Loading branch information
Showing
11 changed files
with
3,560 additions
and
2,909 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#ifndef INC_DUMPUTIL_H_ | ||
#define INC_DUMPUTIL_H_ | ||
|
||
#include <taos.h> | ||
#include <taoserror.h> | ||
#include <toolsdef.h> | ||
|
||
// | ||
// ------------ error code range defin ------------ | ||
// | ||
|
||
// engine can retry code range | ||
#define TSDB_CODE_RPC_BEGIN TSDB_CODE_RPC_NETWORK_UNAVAIL | ||
#define TSDB_CODE_RPC_END TSDB_CODE_RPC_ASYNC_MODULE_QUIT | ||
|
||
// websocket can retry code range | ||
// range1 [0x0001~0x00FF] | ||
#define WEBSOCKET_CODE_BEGIN1 0x0001 | ||
#define WEBSOCKET_CODE_END1 0x00FF | ||
// range2 [0x0001~0x00FF] | ||
#define WEBSOCKET_CODE_BEGIN2 0xE000 | ||
#define WEBSOCKET_CODE_END2 0xE0FF | ||
|
||
// | ||
// encapsulate the api of calling engine | ||
// | ||
#define RETRY_TYPE_CONNECT 0 | ||
#define RETRY_TYPE_QUERY 1 | ||
#define RETRY_TYPE_FETCH 2 | ||
|
||
//come from TDengine util/tdef.h | ||
#define TSDB_TABLE_NAME_LEN 193 // it is a null-terminated string | ||
|
||
// | ||
// ------------- struct define ---------- | ||
// | ||
|
||
// single link | ||
typedef struct SNode { | ||
char name[TSDB_TABLE_NAME_LEN]; | ||
struct SNode *next; | ||
}SNode; | ||
|
||
|
||
// return true to do retry , false no retry , code is error code | ||
bool canRetry(int32_t code, int8_t type); | ||
|
||
// single linked list | ||
|
||
// malloc new node | ||
SNode *mallocNode(const char* name, int32_t len); | ||
|
||
// free nodes | ||
void freeNodes(SNode* head); | ||
|
||
|
||
|
||
// | ||
// --------------- native ------------------ | ||
// | ||
|
||
|
||
// connect | ||
TAOS *taosConnect(const char *dbName); | ||
// query | ||
TAOS_RES *taosQuery(TAOS *taos, const char *sql, int32_t *code); | ||
|
||
|
||
// | ||
// --------------- websocket ------------------ | ||
// | ||
#ifdef WEBSOCKET | ||
// ws connect | ||
WS_TAOS *wsConnect(); | ||
// ws query | ||
WS_RES *wsQuery(WS_TAOS **ws_taos, const char *sql, int32_t *code); | ||
// ws fetch | ||
int32_t wsFetchBlock(WS_RES *rs, const void **pData, int32_t *numOfRows); | ||
|
||
#endif | ||
|
||
|
||
#endif // INC_DUMPUTIL_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#ifndef INC_WSDUMP_H_ | ||
#define INC_WSDUMP_H_ | ||
|
||
// | ||
// --------------- websocket ------------------ | ||
// | ||
|
||
#ifdef WEBSOCKET | ||
|
||
#include <taoserror.h> | ||
#include <taosws.h> | ||
#include <toolsdef.h> | ||
|
||
int cleanIfQueryFailedWS(const char *funcname, int lineno, char *command, WS_RES *res); | ||
int getTableRecordInfoWS(char *dbName, char *table, TableRecordInfo *pTableRecordInfo); | ||
int getDbCountWS(WS_RES *ws_res); | ||
int64_t getNtbCountOfStbWS(char *dbName, const char *stbName); | ||
int getTableDesFromStbWS(WS_TAOS **taos_v, const char *dbName, const TableDes *stbTableDes, const char *table, | ||
TableDes **ppTableDes); | ||
int getTableDesWS(WS_TAOS **taos_v, const char *dbName, const char *table, TableDes *tableDes, const bool colOnly); | ||
int64_t queryDbForDumpOutCountWS(char *command, WS_TAOS **taos_v, const char *dbName, const char *tbName, | ||
const int precision); | ||
TAOS_RES *queryDbForDumpOutOffsetWS(WS_TAOS **taos_v, char *command); | ||
int64_t dumpTableDataAvroWS(char *dataFilename, int64_t index, const char *tbName, const bool belongStb, | ||
const char *dbName, const int precision, int colCount, TableDes *tableDes, | ||
int64_t start_time, int64_t end_time); | ||
int64_t fillTbNameArrWS(WS_TAOS **taos_v, char *command, char **tbNameArr, const char *stable, const int64_t preCount); | ||
int readNextTableDesWS(void *ws_res, TableDes *tbDes, int *idx, int *cnt); | ||
void dumpExtraInfoVarWS(void **taos_v, FILE *fp); | ||
int queryDbImplWS(WS_TAOS *taos_v, char *command); | ||
void dumpNormalTablesOfStbWS(threadInfo *pThreadInfo, FILE *fp, char *dumpFilename); | ||
int64_t dumpStbAndChildTbOfDbWS(WS_TAOS **taos_v, SDbInfo *dbInfo, FILE *fpDbs); | ||
int64_t dumpNTablesOfDbWS(WS_TAOS **taos_v, SDbInfo *dbInfo); | ||
int fillDbInfoWS(void **taos_v); | ||
bool jointCloudDsn(); | ||
bool splitCloudDsn(); | ||
int64_t dumpTableDataWS(const int64_t index, FILE *fp, const char *tbName, const char *dbName, const int precision, | ||
TableDes *tableDes, const int64_t start_time, const int64_t end_time); | ||
int32_t readRowWS(void *res, int32_t idx, int32_t col, uint32_t *len, char **data); | ||
#endif | ||
|
||
#endif // INC_WSDUMP_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.