Merge branch '3.0' of https://github.com/taosdata/TDengine into refact/submit_req
This commit is contained in:
commit
899d7b0bcc
|
|
@ -2,7 +2,7 @@
|
||||||
# taosadapter
|
# taosadapter
|
||||||
ExternalProject_Add(taosadapter
|
ExternalProject_Add(taosadapter
|
||||||
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
|
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
|
||||||
GIT_TAG ff7de07
|
GIT_TAG 0dfad5b
|
||||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
|
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
|
||||||
BINARY_DIR ""
|
BINARY_DIR ""
|
||||||
#BUILD_IN_SOURCE TRUE
|
#BUILD_IN_SOURCE TRUE
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
# taos-tools
|
# taos-tools
|
||||||
ExternalProject_Add(taos-tools
|
ExternalProject_Add(taos-tools
|
||||||
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
|
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
|
||||||
GIT_TAG 823fae5
|
GIT_TAG e62c5ea
|
||||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
|
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
|
||||||
BINARY_DIR ""
|
BINARY_DIR ""
|
||||||
#BUILD_IN_SOURCE TRUE
|
#BUILD_IN_SOURCE TRUE
|
||||||
|
|
|
||||||
|
|
@ -532,7 +532,12 @@ TIMEDIFF(expr1, expr2 [, time_unit])
|
||||||
#### TIMETRUNCATE
|
#### TIMETRUNCATE
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
TIMETRUNCATE(expr, time_unit)
|
TIMETRUNCATE(expr, time_unit [, ignore_timezone])
|
||||||
|
|
||||||
|
ignore_timezone: {
|
||||||
|
0
|
||||||
|
| 1
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
**Description**: Truncate the input timestamp with unit specified by `time_unit`
|
**Description**: Truncate the input timestamp with unit specified by `time_unit`
|
||||||
|
|
@ -548,7 +553,10 @@ TIMETRUNCATE(expr, time_unit)
|
||||||
1b (nanoseconds), 1u (microseconds), 1a (milliseconds), 1s (seconds), 1m (minutes), 1h (hours), 1d (days), or 1w (weeks)
|
1b (nanoseconds), 1u (microseconds), 1a (milliseconds), 1s (seconds), 1m (minutes), 1h (hours), 1d (days), or 1w (weeks)
|
||||||
- The precision of the returned timestamp is same as the precision set for the current data base in use
|
- The precision of the returned timestamp is same as the precision set for the current data base in use
|
||||||
- If the input data is not formatted as a timestamp, the returned value is null.
|
- If the input data is not formatted as a timestamp, the returned value is null.
|
||||||
|
- If `1d` is used as `time_unit` to truncate the timestamp, `ignore_timezone` option can be set to indicate if the returned result is affected by client timezone or not.
|
||||||
|
For example, if client timezone is set to UTC+0800, TIMETRUNCATE('2020-01-01 23:00:00', 1d, 0) will return '2020-01-01 08:00:00'.
|
||||||
|
Otherwise, TIMETRUNCATE('2020-01-01 23:00:00', 1d, 1) will return '2020-01-01 00:00:00'.
|
||||||
|
If `ignore_timezone` option is omitted, the default value is set to 1.
|
||||||
|
|
||||||
#### TIMEZONE
|
#### TIMEZONE
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,10 +59,10 @@ The different database framework specifications for various programming language
|
||||||
| -------------------------------------- | ------------- | --------------- | ------------- | ------------- | ------------- | ------------- |
|
| -------------------------------------- | ------------- | --------------- | ------------- | ------------- | ------------- | ------------- |
|
||||||
| **Connection Management** | Support | Support | Support | Support | Support | Support |
|
| **Connection Management** | Support | Support | Support | Support | Support | Support |
|
||||||
| **Regular Query** | Support | Support | Support | Support | Support | Support |
|
| **Regular Query** | Support | Support | Support | Support | Support | Support |
|
||||||
| **Parameter Binding** | Not supported | Not supported | Not supported | Support | Not supported | Support |
|
| **Parameter Binding** | Not supported | Not supported | support | Support | Not supported | Support |
|
||||||
| **Subscription (TMQ) ** | Not supported | Not supported | Not supported | Not supported | Not supported | Support |
|
| **Subscription (TMQ) ** | Not supported | Not supported | support | Not supported | Not supported | Support |
|
||||||
| **Schemaless** | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported |
|
| **Schemaless** | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported |
|
||||||
| **Bulk Pulling (based on WebSocket) ** | Support | Support | Not Supported | support | Not Supported | Supported |
|
| **Bulk Pulling (based on WebSocket) ** | Support | Support | Support | support | Support | Support |
|
||||||
| **DataFrame** | Not supported | Support | Not supported | Not supported | Not supported | Not supported |
|
| **DataFrame** | Not supported | Support | Not supported | Not supported | Not supported | Not supported |
|
||||||
|
|
||||||
:::warning
|
:::warning
|
||||||
|
|
|
||||||
|
|
@ -5,22 +5,24 @@ namespace Examples
|
||||||
{
|
{
|
||||||
public class WSConnExample
|
public class WSConnExample
|
||||||
{
|
{
|
||||||
static void Main(string[] args)
|
static int Main(string[] args)
|
||||||
{
|
{
|
||||||
string DSN = "ws://root:taosdata@127.0.0.1:6041/test";
|
string DSN = "ws://root:taosdata@127.0.0.1:6041/test";
|
||||||
IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN);
|
IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN);
|
||||||
|
|
||||||
if (wsConn == IntPtr.Zero)
|
if (wsConn == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
throw new Exception("get WS connection failed");
|
Console.WriteLine("get WS connection failed");
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Console.WriteLine("Establish connect success.");
|
Console.WriteLine("Establish connect success.");
|
||||||
|
// close connection.
|
||||||
|
LibTaosWS.WSClose(wsConn);
|
||||||
}
|
}
|
||||||
|
|
||||||
// close connection.
|
return 0;
|
||||||
LibTaosWS.WSClose(wsConn);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5,7 +5,7 @@ namespace Examples
|
||||||
{
|
{
|
||||||
public class WSInsertExample
|
public class WSInsertExample
|
||||||
{
|
{
|
||||||
static void Main(string[] args)
|
static int Main(string[] args)
|
||||||
{
|
{
|
||||||
string DSN = "ws://root:taosdata@127.0.0.1:6041/test";
|
string DSN = "ws://root:taosdata@127.0.0.1:6041/test";
|
||||||
IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN);
|
IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN);
|
||||||
|
|
@ -13,7 +13,8 @@ namespace Examples
|
||||||
// Assert if connection is validate
|
// Assert if connection is validate
|
||||||
if (wsConn == IntPtr.Zero)
|
if (wsConn == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
throw new Exception("get WS connection failed");
|
Console.WriteLine("get WS connection failed");
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -36,6 +37,8 @@ namespace Examples
|
||||||
|
|
||||||
// close connection.
|
// close connection.
|
||||||
LibTaosWS.WSClose(wsConn);
|
LibTaosWS.WSClose(wsConn);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ValidInsert(string desc, IntPtr wsRes)
|
static void ValidInsert(string desc, IntPtr wsRes)
|
||||||
|
|
@ -43,7 +46,7 @@ namespace Examples
|
||||||
int code = LibTaosWS.WSErrorNo(wsRes);
|
int code = LibTaosWS.WSErrorNo(wsRes);
|
||||||
if (code != 0)
|
if (code != 0)
|
||||||
{
|
{
|
||||||
throw new Exception($"execute SQL failed: reason: {LibTaosWS.WSErrorStr(wsRes)}, code:{code}");
|
Console.WriteLine($"execute SQL failed: reason: {LibTaosWS.WSErrorStr(wsRes)}, code:{code}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,14 @@ namespace Examples
|
||||||
{
|
{
|
||||||
public class WSQueryExample
|
public class WSQueryExample
|
||||||
{
|
{
|
||||||
static void Main(string[] args)
|
static int Main(string[] args)
|
||||||
{
|
{
|
||||||
string DSN = "ws://root:taosdata@127.0.0.1:6041/test";
|
string DSN = "ws://root:taosdata@127.0.0.1:6041/test";
|
||||||
IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN);
|
IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN);
|
||||||
if (wsConn == IntPtr.Zero)
|
if (wsConn == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
throw new Exception("get WS connection failed");
|
Console.WriteLine("get WS connection failed");
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -28,7 +29,9 @@ namespace Examples
|
||||||
int code = LibTaosWS.WSErrorNo(wsRes);
|
int code = LibTaosWS.WSErrorNo(wsRes);
|
||||||
if (code != 0)
|
if (code != 0)
|
||||||
{
|
{
|
||||||
throw new Exception($"execute SQL failed: reason: {LibTaosWS.WSErrorStr(wsRes)}, code:{code}");
|
Console.WriteLine($"execute SQL failed: reason: {LibTaosWS.WSErrorStr(wsRes)}, code:{code}");
|
||||||
|
LibTaosWS.WSFreeResult(wsRes);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get meta data
|
// get meta data
|
||||||
|
|
@ -58,6 +61,8 @@ namespace Examples
|
||||||
|
|
||||||
// close connection.
|
// close connection.
|
||||||
LibTaosWS.WSClose(wsConn);
|
LibTaosWS.WSClose(wsConn);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ namespace Examples
|
||||||
{
|
{
|
||||||
public class WSStmtExample
|
public class WSStmtExample
|
||||||
{
|
{
|
||||||
static void Main(string[] args)
|
static int Main(string[] args)
|
||||||
{
|
{
|
||||||
const string DSN = "ws://root:taosdata@127.0.0.1:6041/test";
|
const string DSN = "ws://root:taosdata@127.0.0.1:6041/test";
|
||||||
const string table = "meters";
|
const string table = "meters";
|
||||||
|
|
@ -21,7 +21,8 @@ namespace Examples
|
||||||
IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN);
|
IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN);
|
||||||
if (wsConn == IntPtr.Zero)
|
if (wsConn == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
throw new Exception($"get WS connection failed");
|
Console.WriteLine($"get WS connection failed");
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -66,18 +67,20 @@ namespace Examples
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception("Init STMT failed...");
|
Console.WriteLine("Init STMT failed...");
|
||||||
}
|
}
|
||||||
|
|
||||||
// close connection.
|
// close connection.
|
||||||
LibTaosWS.WSClose(wsConn);
|
LibTaosWS.WSClose(wsConn);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ValidStmtStep(int code, IntPtr wsStmt, string desc)
|
static void ValidStmtStep(int code, IntPtr wsStmt, string desc)
|
||||||
{
|
{
|
||||||
if (code != 0)
|
if (code != 0)
|
||||||
{
|
{
|
||||||
throw new Exception($"{desc} failed,reason: {LibTaosWS.WSErrorStr(wsStmt)}, code: {code}");
|
Console.WriteLine($"{desc} failed,reason: {LibTaosWS.WSErrorStr(wsStmt)}, code: {code}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -59,10 +59,10 @@ TDengine 版本更新往往会增加新的功能特性,列表中的连接器
|
||||||
| ------------------------------ | -------- | ---------- | -------- | -------- | ----------- | -------- |
|
| ------------------------------ | -------- | ---------- | -------- | -------- | ----------- | -------- |
|
||||||
| **连接管理** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
|
| **连接管理** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
|
||||||
| **普通查询** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
|
| **普通查询** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
|
||||||
| **参数绑定** | 暂不支持 | 暂不支持 | 暂不支持 | 支持 | 暂不支持 | 支持 |
|
| **参数绑定** | 暂不支持 | 暂不支持 | 支持 | 支持 | 暂不支持 | 支持 |
|
||||||
| **数据订阅(TMQ)** | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 | 支持 |
|
| **数据订阅(TMQ)** | 暂不支持 | 暂不支持 | 支持 | 暂不支持 | 暂不支持 | 支持 |
|
||||||
| **Schemaless** | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 |
|
| **Schemaless** | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 |
|
||||||
| **批量拉取(基于 WebSocket)** | 支持 | 支持 | 暂不支持 | 支持 | 暂不支持 | 支持 |
|
| **批量拉取(基于 WebSocket)** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
|
||||||
| **DataFrame** | 不支持 | 支持 | 不支持 | 不支持 | 不支持 | 不支持 |
|
| **DataFrame** | 不支持 | 支持 | 不支持 | 不支持 | 不支持 | 不支持 |
|
||||||
|
|
||||||
:::warning
|
:::warning
|
||||||
|
|
|
||||||
|
|
@ -533,7 +533,12 @@ TIMEDIFF(expr1, expr2 [, time_unit])
|
||||||
#### TIMETRUNCATE
|
#### TIMETRUNCATE
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
TIMETRUNCATE(expr, time_unit)
|
TIMETRUNCATE(expr, time_unit [, ignore_timezone])
|
||||||
|
|
||||||
|
ignore_timezone: {
|
||||||
|
0
|
||||||
|
| 1
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
**功能说明**:将时间戳按照指定时间单位 time_unit 进行截断。
|
**功能说明**:将时间戳按照指定时间单位 time_unit 进行截断。
|
||||||
|
|
@ -549,6 +554,11 @@ TIMETRUNCATE(expr, time_unit)
|
||||||
1b(纳秒), 1u(微秒),1a(毫秒),1s(秒),1m(分),1h(小时),1d(天), 1w(周)。
|
1b(纳秒), 1u(微秒),1a(毫秒),1s(秒),1m(分),1h(小时),1d(天), 1w(周)。
|
||||||
- 返回的时间戳精度与当前 DATABASE 设置的时间精度一致。
|
- 返回的时间戳精度与当前 DATABASE 设置的时间精度一致。
|
||||||
- 输入包含不符合时间日期格式的字符串则返回 NULL。
|
- 输入包含不符合时间日期格式的字符串则返回 NULL。
|
||||||
|
- 当使用 1d 作为时间单位对时间戳进行截断时, 可通过设置 ignore_timezone 参数指定返回结果的显示是否忽略客户端时区的影响。
|
||||||
|
例如客户端所配置时区为 UTC+0800, 则 TIMETRUNCATE('2020-01-01 23:00:00', 1d, 0) 返回结果为 '2020-01-01 08:00:00'。
|
||||||
|
而使用 TIMETRUNCATE('2020-01-01 23:00:00', 1d, 1) 设置忽略时区时,返回结果为 '2020-01-01 00:00:00'
|
||||||
|
ignore_timezone 如果忽略的话,则默认值为 1 。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### TIMEZONE
|
#### TIMEZONE
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,7 @@ DLL_EXPORT void taos_kill_query(TAOS *taos);
|
||||||
DLL_EXPORT int taos_field_count(TAOS_RES *res);
|
DLL_EXPORT int taos_field_count(TAOS_RES *res);
|
||||||
DLL_EXPORT int taos_num_fields(TAOS_RES *res);
|
DLL_EXPORT int taos_num_fields(TAOS_RES *res);
|
||||||
DLL_EXPORT int taos_affected_rows(TAOS_RES *res);
|
DLL_EXPORT int taos_affected_rows(TAOS_RES *res);
|
||||||
|
DLL_EXPORT int64_t taos_affected_rows64(TAOS_RES *res);
|
||||||
|
|
||||||
DLL_EXPORT TAOS_FIELD *taos_fetch_fields(TAOS_RES *res);
|
DLL_EXPORT TAOS_FIELD *taos_fetch_fields(TAOS_RES *res);
|
||||||
DLL_EXPORT int taos_select_db(TAOS *taos, const char *db);
|
DLL_EXPORT int taos_select_db(TAOS *taos, const char *db);
|
||||||
|
|
|
||||||
|
|
@ -249,10 +249,11 @@ typedef struct SColumnInfoData {
|
||||||
|
|
||||||
typedef struct SQueryTableDataCond {
|
typedef struct SQueryTableDataCond {
|
||||||
uint64_t suid;
|
uint64_t suid;
|
||||||
int32_t order; // desc|asc order to iterate the data block
|
int32_t order; // desc|asc order to iterate the data block
|
||||||
int32_t numOfCols;
|
int32_t numOfCols;
|
||||||
SColumnInfo* colList;
|
SColumnInfo* colList;
|
||||||
int32_t type; // data block load type:
|
int32_t* pSlotList; // the column output destation slot, and it may be null
|
||||||
|
int32_t type; // data block load type:
|
||||||
STimeWindow twindows;
|
STimeWindow twindows;
|
||||||
int64_t startVersion;
|
int64_t startVersion;
|
||||||
int64_t endVersion;
|
int64_t endVersion;
|
||||||
|
|
|
||||||
|
|
@ -41,9 +41,9 @@ typedef struct SBlockOrderInfo {
|
||||||
BMCharPos(bm_, r_) |= (1u << (7u - BitPos(r_))); \
|
BMCharPos(bm_, r_) |= (1u << (7u - BitPos(r_))); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define colDataSetNotNull_f(bm_, r_) \
|
#define colDataClearNull_f(bm_, r_) \
|
||||||
do { \
|
do { \
|
||||||
BMCharPos(bm_, r_) &= ~(1u << (7u - BitPos(r_))); \
|
BMCharPos(bm_, r_) &= ((char)(~(1u << (7u - BitPos(r_))))); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define colDataIsNull_var(pColumnInfoData, row) (pColumnInfoData->varmeta.offset[row] == -1)
|
#define colDataIsNull_var(pColumnInfoData, row) (pColumnInfoData->varmeta.offset[row] == -1)
|
||||||
|
|
@ -151,9 +151,6 @@ static FORCE_INLINE void colDataAppendNNULL(SColumnInfoData* pColumnInfoData, ui
|
||||||
for (int32_t i = start; i < start + nRows; ++i) {
|
for (int32_t i = start; i < start + nRows; ++i) {
|
||||||
colDataSetNull_f(pColumnInfoData->nullbitmap, i);
|
colDataSetNull_f(pColumnInfoData->nullbitmap, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t bytes = pColumnInfoData->info.bytes;
|
|
||||||
memset(pColumnInfoData->pData + start * bytes, 0, nRows * bytes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pColumnInfoData->hasNull = true;
|
pColumnInfoData->hasNull = true;
|
||||||
|
|
@ -234,9 +231,11 @@ int32_t blockDataSort_rv(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullF
|
||||||
|
|
||||||
int32_t colInfoDataEnsureCapacity(SColumnInfoData* pColumn, uint32_t numOfRows, bool clearPayload);
|
int32_t colInfoDataEnsureCapacity(SColumnInfoData* pColumn, uint32_t numOfRows, bool clearPayload);
|
||||||
int32_t blockDataEnsureCapacity(SSDataBlock* pDataBlock, uint32_t numOfRows);
|
int32_t blockDataEnsureCapacity(SSDataBlock* pDataBlock, uint32_t numOfRows);
|
||||||
|
int32_t blockDataEnsureCapacityNoClear(SSDataBlock* pDataBlock, uint32_t numOfRows);
|
||||||
|
|
||||||
void colInfoDataCleanup(SColumnInfoData* pColumn, uint32_t numOfRows);
|
void colInfoDataCleanup(SColumnInfoData* pColumn, uint32_t numOfRows);
|
||||||
void blockDataCleanup(SSDataBlock* pDataBlock);
|
void blockDataCleanup(SSDataBlock* pDataBlock);
|
||||||
|
void blockDataEmpty(SSDataBlock* pDataBlock);
|
||||||
|
|
||||||
size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize);
|
size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,11 @@ extern int32_t tsNumOfSnodeStreamThreads;
|
||||||
extern int32_t tsNumOfSnodeWriteThreads;
|
extern int32_t tsNumOfSnodeWriteThreads;
|
||||||
extern int64_t tsRpcQueueMemoryAllowed;
|
extern int64_t tsRpcQueueMemoryAllowed;
|
||||||
|
|
||||||
|
// sync raft
|
||||||
|
extern int32_t tsElectInterval;
|
||||||
|
extern int32_t tsHeartbeatInterval;
|
||||||
|
extern int32_t tsHeartbeatTimeout;
|
||||||
|
|
||||||
// monitor
|
// monitor
|
||||||
extern bool tsEnableMonitor;
|
extern bool tsEnableMonitor;
|
||||||
extern int32_t tsMonitorInterval;
|
extern int32_t tsMonitorInterval;
|
||||||
|
|
@ -126,9 +131,9 @@ extern char tsUdfdResFuncs[];
|
||||||
extern char tsUdfdLdLibPath[];
|
extern char tsUdfdLdLibPath[];
|
||||||
|
|
||||||
// schemaless
|
// schemaless
|
||||||
extern char tsSmlChildTableName[];
|
extern char tsSmlChildTableName[];
|
||||||
extern char tsSmlTagName[];
|
extern char tsSmlTagName[];
|
||||||
extern bool tsSmlDataFormat;
|
extern bool tsSmlDataFormat;
|
||||||
extern int32_t tsSmlBatchSize;
|
extern int32_t tsSmlBatchSize;
|
||||||
|
|
||||||
// wal
|
// wal
|
||||||
|
|
@ -146,7 +151,7 @@ extern int32_t tsUptimeInterval;
|
||||||
extern int32_t tsRpcRetryLimit;
|
extern int32_t tsRpcRetryLimit;
|
||||||
extern int32_t tsRpcRetryInterval;
|
extern int32_t tsRpcRetryInterval;
|
||||||
|
|
||||||
//#define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
|
// #define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
|
||||||
|
|
||||||
int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDir, const char **envCmd,
|
int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDir, const char **envCmd,
|
||||||
const char *envFile, char *apolloUrl, SArray *pArgs, bool tsc);
|
const char *envFile, char *apolloUrl, SArray *pArgs, bool tsc);
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,10 @@ extern int32_t tMsgDict[];
|
||||||
|
|
||||||
typedef uint16_t tmsg_t;
|
typedef uint16_t tmsg_t;
|
||||||
|
|
||||||
|
static inline bool vnodeIsMsgBlock(tmsg_t type) {
|
||||||
|
return (type == TDMT_VND_CREATE_TABLE) || (type == TDMT_VND_ALTER_TABLE) || (type == TDMT_VND_DROP_TABLE) ||
|
||||||
|
(type == TDMT_VND_UPDATE_TAG_VAL);
|
||||||
|
}
|
||||||
/* ------------------------ OTHER DEFINITIONS ------------------------ */
|
/* ------------------------ OTHER DEFINITIONS ------------------------ */
|
||||||
// IE type
|
// IE type
|
||||||
#define TSDB_IE_TYPE_SEC 1
|
#define TSDB_IE_TYPE_SEC 1
|
||||||
|
|
@ -1401,8 +1405,8 @@ typedef struct {
|
||||||
int8_t streamBlockType;
|
int8_t streamBlockType;
|
||||||
int32_t compLen;
|
int32_t compLen;
|
||||||
int32_t numOfBlocks;
|
int32_t numOfBlocks;
|
||||||
int32_t numOfRows;
|
int64_t numOfRows; // from int32_t change to int64_t
|
||||||
int32_t numOfCols;
|
int64_t numOfCols;
|
||||||
int64_t skey;
|
int64_t skey;
|
||||||
int64_t ekey;
|
int64_t ekey;
|
||||||
int64_t version; // for stream
|
int64_t version; // for stream
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,6 @@ typedef int32_t (*PutToQueueFp)(void* pMgmt, EQueueType qtype, SRpcMsg* pMsg);
|
||||||
typedef int32_t (*GetQueueSizeFp)(void* pMgmt, int32_t vgId, EQueueType qtype);
|
typedef int32_t (*GetQueueSizeFp)(void* pMgmt, int32_t vgId, EQueueType qtype);
|
||||||
typedef int32_t (*SendReqFp)(const SEpSet* pEpSet, SRpcMsg* pMsg);
|
typedef int32_t (*SendReqFp)(const SEpSet* pEpSet, SRpcMsg* pMsg);
|
||||||
typedef void (*SendRspFp)(SRpcMsg* pMsg);
|
typedef void (*SendRspFp)(SRpcMsg* pMsg);
|
||||||
typedef void (*SendRedirectRspFp)(SRpcMsg* pMsg, const SEpSet* pNewEpSet);
|
|
||||||
typedef void (*RegisterBrokenLinkArgFp)(SRpcMsg* pMsg);
|
typedef void (*RegisterBrokenLinkArgFp)(SRpcMsg* pMsg);
|
||||||
typedef void (*ReleaseHandleFp)(SRpcHandleInfo* pHandle, int8_t type);
|
typedef void (*ReleaseHandleFp)(SRpcHandleInfo* pHandle, int8_t type);
|
||||||
typedef void (*ReportStartup)(const char* name, const char* desc);
|
typedef void (*ReportStartup)(const char* name, const char* desc);
|
||||||
|
|
@ -55,7 +54,6 @@ typedef struct {
|
||||||
GetQueueSizeFp qsizeFp;
|
GetQueueSizeFp qsizeFp;
|
||||||
SendReqFp sendReqFp;
|
SendReqFp sendReqFp;
|
||||||
SendRspFp sendRspFp;
|
SendRspFp sendRspFp;
|
||||||
SendRedirectRspFp sendRedirectRspFp;
|
|
||||||
RegisterBrokenLinkArgFp registerBrokenLinkArgFp;
|
RegisterBrokenLinkArgFp registerBrokenLinkArgFp;
|
||||||
ReleaseHandleFp releaseHandleFp;
|
ReleaseHandleFp releaseHandleFp;
|
||||||
ReportStartup reportStartupFp;
|
ReportStartup reportStartupFp;
|
||||||
|
|
@ -66,7 +64,6 @@ int32_t tmsgPutToQueue(const SMsgCb* msgcb, EQueueType qtype, SRpcMsg* pMsg);
|
||||||
int32_t tmsgGetQueueSize(const SMsgCb* msgcb, int32_t vgId, EQueueType qtype);
|
int32_t tmsgGetQueueSize(const SMsgCb* msgcb, int32_t vgId, EQueueType qtype);
|
||||||
int32_t tmsgSendReq(const SEpSet* epSet, SRpcMsg* pMsg);
|
int32_t tmsgSendReq(const SEpSet* epSet, SRpcMsg* pMsg);
|
||||||
void tmsgSendRsp(SRpcMsg* pMsg);
|
void tmsgSendRsp(SRpcMsg* pMsg);
|
||||||
void tmsgSendRedirectRsp(SRpcMsg* pMsg, const SEpSet* pNewEpSet);
|
|
||||||
void tmsgRegisterBrokenLinkArg(SRpcMsg* pMsg);
|
void tmsgRegisterBrokenLinkArg(SRpcMsg* pMsg);
|
||||||
void tmsgReleaseHandle(SRpcHandleInfo* pHandle, int8_t type);
|
void tmsgReleaseHandle(SRpcHandleInfo* pHandle, int8_t type);
|
||||||
void tmsgReportStartup(const char* name, const char* desc);
|
void tmsgReportStartup(const char* name, const char* desc);
|
||||||
|
|
|
||||||
|
|
@ -278,11 +278,9 @@ typedef struct {
|
||||||
#define IS_VALID_TINYINT(_t) ((_t) >= INT8_MIN && (_t) <= INT8_MAX)
|
#define IS_VALID_TINYINT(_t) ((_t) >= INT8_MIN && (_t) <= INT8_MAX)
|
||||||
#define IS_VALID_SMALLINT(_t) ((_t) >= INT16_MIN && (_t) <= INT16_MAX)
|
#define IS_VALID_SMALLINT(_t) ((_t) >= INT16_MIN && (_t) <= INT16_MAX)
|
||||||
#define IS_VALID_INT(_t) ((_t) >= INT32_MIN && (_t) <= INT32_MAX)
|
#define IS_VALID_INT(_t) ((_t) >= INT32_MIN && (_t) <= INT32_MAX)
|
||||||
#define IS_VALID_BIGINT(_t) ((_t) >= INT64_MIN && (_t) <= INT64_MAX)
|
|
||||||
#define IS_VALID_UTINYINT(_t) ((_t) >= 0 && (_t) <= UINT8_MAX)
|
#define IS_VALID_UTINYINT(_t) ((_t) >= 0 && (_t) <= UINT8_MAX)
|
||||||
#define IS_VALID_USMALLINT(_t) ((_t) >= 0 && (_t) <= UINT16_MAX)
|
#define IS_VALID_USMALLINT(_t) ((_t) >= 0 && (_t) <= UINT16_MAX)
|
||||||
#define IS_VALID_UINT(_t) ((_t) >= 0 && (_t) <= UINT32_MAX)
|
#define IS_VALID_UINT(_t) ((_t) >= 0 && (_t) <= UINT32_MAX)
|
||||||
#define IS_VALID_UBIGINT(_t) ((_t) >= 0 && (_t) <= UINT64_MAX)
|
|
||||||
#define IS_VALID_FLOAT(_t) ((_t) >= -FLT_MAX && (_t) <= FLT_MAX)
|
#define IS_VALID_FLOAT(_t) ((_t) >= -FLT_MAX && (_t) <= FLT_MAX)
|
||||||
#define IS_VALID_DOUBLE(_t) ((_t) >= -DBL_MAX && (_t) <= DBL_MAX)
|
#define IS_VALID_DOUBLE(_t) ((_t) >= -DBL_MAX && (_t) <= DBL_MAX)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ typedef struct SInputData {
|
||||||
|
|
||||||
typedef struct SOutputData {
|
typedef struct SOutputData {
|
||||||
int32_t numOfBlocks;
|
int32_t numOfBlocks;
|
||||||
int32_t numOfRows;
|
int64_t numOfRows; // int32_t changed to int64_t
|
||||||
int32_t numOfCols;
|
int32_t numOfCols;
|
||||||
int8_t compressed;
|
int8_t compressed;
|
||||||
char* pData;
|
char* pData;
|
||||||
|
|
|
||||||
|
|
@ -137,22 +137,22 @@ typedef struct SqlFunctionCtx {
|
||||||
int16_t functionId; // function id
|
int16_t functionId; // function id
|
||||||
char *pOutput; // final result output buffer, point to sdata->data
|
char *pOutput; // final result output buffer, point to sdata->data
|
||||||
int32_t numOfParams;
|
int32_t numOfParams;
|
||||||
SFunctParam *param; // input parameter, e.g., top(k, 20), the number of results for top query is kept in param
|
// input parameter, e.g., top(k, 20), the number of results of top query is kept in param
|
||||||
SColumnInfoData *pTsOutput; // corresponding output buffer for timestamp of each result, e.g., top/bottom*/
|
SFunctParam *param;
|
||||||
int32_t offset;
|
// corresponding output buffer for timestamp of each result, e.g., diff/csum
|
||||||
struct SResultRowEntryInfo *resultInfo;
|
SColumnInfoData *pTsOutput;
|
||||||
SSubsidiaryResInfo subsidiaries;
|
int32_t offset;
|
||||||
SPoint1 start;
|
SResultRowEntryInfo *resultInfo;
|
||||||
SPoint1 end;
|
SSubsidiaryResInfo subsidiaries;
|
||||||
SFuncExecFuncs fpSet;
|
SPoint1 start;
|
||||||
SScalarFuncExecFuncs sfp;
|
SPoint1 end;
|
||||||
struct SExprInfo *pExpr;
|
SFuncExecFuncs fpSet;
|
||||||
struct SSDataBlock *pSrcBlock;
|
SScalarFuncExecFuncs sfp;
|
||||||
struct SSDataBlock *pDstBlock; // used by indefinite rows function to set selectivity
|
struct SExprInfo *pExpr;
|
||||||
SSerializeDataHandle saveHandle;
|
struct SSDataBlock *pSrcBlock;
|
||||||
bool isStream;
|
struct SSDataBlock *pDstBlock; // used by indefinite rows function to set selectivity
|
||||||
|
SSerializeDataHandle saveHandle;
|
||||||
char udfName[TSDB_FUNC_NAME_LEN];
|
char udfName[TSDB_FUNC_NAME_LEN];
|
||||||
} SqlFunctionCtx;
|
} SqlFunctionCtx;
|
||||||
|
|
||||||
typedef struct tExprNode {
|
typedef struct tExprNode {
|
||||||
|
|
@ -163,6 +163,7 @@ typedef struct tExprNode {
|
||||||
int32_t functionId;
|
int32_t functionId;
|
||||||
int32_t num;
|
int32_t num;
|
||||||
struct SFunctionNode *pFunctNode;
|
struct SFunctionNode *pFunctNode;
|
||||||
|
int32_t functionType;
|
||||||
} _function;
|
} _function;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
@ -182,7 +183,6 @@ struct SScalarParam {
|
||||||
};
|
};
|
||||||
|
|
||||||
void cleanupResultRowEntry(struct SResultRowEntryInfo *pCell);
|
void cleanupResultRowEntry(struct SResultRowEntryInfo *pCell);
|
||||||
//int32_t getNumOfResult(SqlFunctionCtx *pCtx, int32_t num, SSDataBlock *pResBlock);
|
|
||||||
bool isRowEntryCompleted(struct SResultRowEntryInfo *pEntry);
|
bool isRowEntryCompleted(struct SResultRowEntryInfo *pEntry);
|
||||||
bool isRowEntryInitialized(struct SResultRowEntryInfo *pEntry);
|
bool isRowEntryInitialized(struct SResultRowEntryInfo *pEntry);
|
||||||
|
|
||||||
|
|
@ -194,32 +194,6 @@ typedef struct SPoint {
|
||||||
int32_t taosGetLinearInterpolationVal(SPoint *point, int32_t outputType, SPoint *point1, SPoint *point2,
|
int32_t taosGetLinearInterpolationVal(SPoint *point, int32_t outputType, SPoint *point1, SPoint *point2,
|
||||||
int32_t inputType);
|
int32_t inputType);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// udf api
|
|
||||||
/**
|
|
||||||
* create udfd proxy, called once in process that call doSetupUdf/callUdfxxx/doTeardownUdf
|
|
||||||
* @return error code
|
|
||||||
*/
|
|
||||||
int32_t udfcOpen();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* destroy udfd proxy
|
|
||||||
* @return error code
|
|
||||||
*/
|
|
||||||
int32_t udfcClose();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* start udfd that serves udf function invocation under dnode startDnodeId
|
|
||||||
* @param startDnodeId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
int32_t udfStartUdfd(int32_t startDnodeId);
|
|
||||||
/**
|
|
||||||
* stop udfd
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
int32_t udfStopUdfd();
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,7 @@ typedef enum EFunctionType {
|
||||||
FUNCTION_TYPE_GROUP_KEY,
|
FUNCTION_TYPE_GROUP_KEY,
|
||||||
FUNCTION_TYPE_CACHE_LAST_ROW,
|
FUNCTION_TYPE_CACHE_LAST_ROW,
|
||||||
FUNCTION_TYPE_CACHE_LAST,
|
FUNCTION_TYPE_CACHE_LAST,
|
||||||
|
FUNCTION_TYPE_TABLE_COUNT,
|
||||||
|
|
||||||
// distributed splitting functions
|
// distributed splitting functions
|
||||||
FUNCTION_TYPE_APERCENTILE_PARTIAL = 4000,
|
FUNCTION_TYPE_APERCENTILE_PARTIAL = 4000,
|
||||||
|
|
|
||||||
|
|
@ -228,7 +228,7 @@ static FORCE_INLINE int32_t udfColDataSet(SUdfColumn *pColumn, uint32_t currentR
|
||||||
newSize = 8;
|
newSize = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (newSize < data->varLenCol.payloadLen + dataLen) {
|
while (newSize < (uint32_t)(data->varLenCol.payloadLen + dataLen)) {
|
||||||
newSize = newSize * UDF_MEMORY_EXP_GROWTH;
|
newSize = newSize * UDF_MEMORY_EXP_GROWTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -248,7 +248,7 @@ static FORCE_INLINE int32_t udfColDataSet(SUdfColumn *pColumn, uint32_t currentR
|
||||||
data->varLenCol.payloadLen += dataLen;
|
data->varLenCol.payloadLen += dataLen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data->numOfRows = (currentRow + 1 > data->numOfRows) ? (currentRow + 1) : data->numOfRows;
|
data->numOfRows = ((int32_t)(currentRow + 1) > data->numOfRows) ? (int32_t)(currentRow + 1) : data->numOfRows;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,32 @@ int32_t callUdfScalarFunc(char *udfName, SScalarParam *input, int32_t numOfCols,
|
||||||
|
|
||||||
int32_t cleanUpUdfs();
|
int32_t cleanUpUdfs();
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// udf api
|
||||||
|
/**
|
||||||
|
* create udfd proxy, called once in process that call doSetupUdf/callUdfxxx/doTeardownUdf
|
||||||
|
* @return error code
|
||||||
|
*/
|
||||||
|
int32_t udfcOpen();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* destroy udfd proxy
|
||||||
|
* @return error code
|
||||||
|
*/
|
||||||
|
int32_t udfcClose();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* start udfd that serves udf function invocation under dnode startDnodeId
|
||||||
|
* @param startDnodeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int32_t udfStartUdfd(int32_t startDnodeId);
|
||||||
|
/**
|
||||||
|
* stop udfd
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int32_t udfStopUdfd();
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,12 @@ extern "C" {
|
||||||
for (SListCell* cell = (NULL != (list) ? (list)->pHead : NULL); \
|
for (SListCell* cell = (NULL != (list) ? (list)->pHead : NULL); \
|
||||||
(NULL != cell ? (node = &(cell->pNode), true) : (node = NULL, false)); cell = cell->pNext)
|
(NULL != cell ? (node = &(cell->pNode), true) : (node = NULL, false)); cell = cell->pNext)
|
||||||
|
|
||||||
|
#define NODES_DESTORY_NODE(node) \
|
||||||
|
do { \
|
||||||
|
nodesDestroyNode((node)); \
|
||||||
|
(node) = NULL; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#define NODES_DESTORY_LIST(list) \
|
#define NODES_DESTORY_LIST(list) \
|
||||||
do { \
|
do { \
|
||||||
nodesDestroyList((list)); \
|
nodesDestroyList((list)); \
|
||||||
|
|
@ -228,6 +234,7 @@ typedef enum ENodeType {
|
||||||
QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN,
|
QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN,
|
||||||
QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN,
|
QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN,
|
||||||
QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN,
|
QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN,
|
||||||
|
QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN,
|
||||||
QUERY_NODE_PHYSICAL_PLAN_PROJECT,
|
QUERY_NODE_PHYSICAL_PLAN_PROJECT,
|
||||||
QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN,
|
QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN,
|
||||||
QUERY_NODE_PHYSICAL_PLAN_HASH_AGG,
|
QUERY_NODE_PHYSICAL_PLAN_HASH_AGG,
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,8 @@ typedef enum EScanType {
|
||||||
SCAN_TYPE_STREAM,
|
SCAN_TYPE_STREAM,
|
||||||
SCAN_TYPE_TABLE_MERGE,
|
SCAN_TYPE_TABLE_MERGE,
|
||||||
SCAN_TYPE_BLOCK_INFO,
|
SCAN_TYPE_BLOCK_INFO,
|
||||||
SCAN_TYPE_LAST_ROW
|
SCAN_TYPE_LAST_ROW,
|
||||||
|
SCAN_TYPE_TABLE_COUNT
|
||||||
} EScanType;
|
} EScanType;
|
||||||
|
|
||||||
typedef struct SScanLogicNode {
|
typedef struct SScanLogicNode {
|
||||||
|
|
@ -323,6 +324,8 @@ typedef struct SLastRowScanPhysiNode {
|
||||||
bool ignoreNull;
|
bool ignoreNull;
|
||||||
} SLastRowScanPhysiNode;
|
} SLastRowScanPhysiNode;
|
||||||
|
|
||||||
|
typedef SLastRowScanPhysiNode STableCountScanPhysiNode;
|
||||||
|
|
||||||
typedef struct SSystemTableScanPhysiNode {
|
typedef struct SSystemTableScanPhysiNode {
|
||||||
SScanPhysiNode scan;
|
SScanPhysiNode scan;
|
||||||
SEpSet mgmtEpSet;
|
SEpSet mgmtEpSet;
|
||||||
|
|
|
||||||
|
|
@ -58,8 +58,7 @@ typedef enum {
|
||||||
#define QUERY_RSP_POLICY_QUICK 1
|
#define QUERY_RSP_POLICY_QUICK 1
|
||||||
|
|
||||||
#define QUERY_MSG_MASK_SHOW_REWRITE() (1 << 0)
|
#define QUERY_MSG_MASK_SHOW_REWRITE() (1 << 0)
|
||||||
#define TEST_SHOW_REWRITE_MASK(m) (((m) & QUERY_MSG_MASK_SHOW_REWRITE()) != 0)
|
#define TEST_SHOW_REWRITE_MASK(m) (((m)&QUERY_MSG_MASK_SHOW_REWRITE()) != 0)
|
||||||
|
|
||||||
|
|
||||||
typedef struct STableComInfo {
|
typedef struct STableComInfo {
|
||||||
uint8_t numOfTags; // the number of tags in schema
|
uint8_t numOfTags; // the number of tags in schema
|
||||||
|
|
@ -128,7 +127,8 @@ typedef struct SDBVgInfo {
|
||||||
int8_t hashMethod;
|
int8_t hashMethod;
|
||||||
int32_t numOfTable; // DB's table num, unit is TSDB_TABLE_NUM_UNIT
|
int32_t numOfTable; // DB's table num, unit is TSDB_TABLE_NUM_UNIT
|
||||||
int64_t stateTs;
|
int64_t stateTs;
|
||||||
SHashObj* vgHash; // key:vgId, value:SVgroupInfo
|
SHashObj* vgHash; // key:vgId, value:SVgroupInfo
|
||||||
|
SArray* vgArray;
|
||||||
} SDBVgInfo;
|
} SDBVgInfo;
|
||||||
|
|
||||||
typedef struct SUseDbOutput {
|
typedef struct SUseDbOutput {
|
||||||
|
|
@ -163,20 +163,18 @@ typedef struct STargetInfo {
|
||||||
int32_t vgId;
|
int32_t vgId;
|
||||||
} STargetInfo;
|
} STargetInfo;
|
||||||
|
|
||||||
|
|
||||||
typedef struct SBoundColInfo {
|
typedef struct SBoundColInfo {
|
||||||
int16_t *pColIndex; // bound index => schema index
|
int16_t* pColIndex; // bound index => schema index
|
||||||
int32_t numOfCols;
|
int32_t numOfCols;
|
||||||
int32_t numOfBound;
|
int32_t numOfBound;
|
||||||
} SBoundColInfo;
|
} SBoundColInfo;
|
||||||
|
|
||||||
|
|
||||||
typedef struct STableDataCxt {
|
typedef struct STableDataCxt {
|
||||||
STableMeta *pMeta;
|
STableMeta* pMeta;
|
||||||
STSchema *pSchema;
|
STSchema* pSchema;
|
||||||
SBoundColInfo boundColsInfo;
|
SBoundColInfo boundColsInfo;
|
||||||
SArray *pValues;
|
SArray* pValues;
|
||||||
SSubmitTbData *pData;
|
SSubmitTbData* pData;
|
||||||
TSKEY lastTs;
|
TSKEY lastTs;
|
||||||
bool ordered;
|
bool ordered;
|
||||||
bool duplicateTs;
|
bool duplicateTs;
|
||||||
|
|
@ -258,6 +256,7 @@ char* parseTagDatatoJson(void* p);
|
||||||
int32_t cloneTableMeta(STableMeta* pSrc, STableMeta** pDst);
|
int32_t cloneTableMeta(STableMeta* pSrc, STableMeta** pDst);
|
||||||
int32_t cloneDbVgInfo(SDBVgInfo* pSrc, SDBVgInfo** pDst);
|
int32_t cloneDbVgInfo(SDBVgInfo* pSrc, SDBVgInfo** pDst);
|
||||||
int32_t cloneSVreateTbReq(SVCreateTbReq* pSrc, SVCreateTbReq** pDst);
|
int32_t cloneSVreateTbReq(SVCreateTbReq* pSrc, SVCreateTbReq** pDst);
|
||||||
|
void freeVgInfo(SDBVgInfo* vgInfo);
|
||||||
|
|
||||||
extern int32_t (*queryBuildMsg[TDMT_MAX])(void* input, char** msg, int32_t msgSize, int32_t* msgLen,
|
extern int32_t (*queryBuildMsg[TDMT_MAX])(void* input, char** msg, int32_t msgSize, int32_t* msgLen,
|
||||||
void* (*mallocFp)(int64_t));
|
void* (*mallocFp)(int64_t));
|
||||||
|
|
@ -280,25 +279,26 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t
|
||||||
(NEED_CLIENT_RM_TBLMETA_ERROR(_code) || NEED_CLIENT_REFRESH_VG_ERROR(_code) || \
|
(NEED_CLIENT_RM_TBLMETA_ERROR(_code) || NEED_CLIENT_REFRESH_VG_ERROR(_code) || \
|
||||||
NEED_CLIENT_REFRESH_TBLMETA_ERROR(_code))
|
NEED_CLIENT_REFRESH_TBLMETA_ERROR(_code))
|
||||||
|
|
||||||
#define SYNC_UNKNOWN_LEADER_REDIRECT_ERROR(_code) ((_code) == TSDB_CODE_SYN_NOT_LEADER || (_code) == TSDB_CODE_SYN_INTERNAL_ERROR || (_code) == TSDB_CODE_VND_STOPPED)
|
#define SYNC_UNKNOWN_LEADER_REDIRECT_ERROR(_code) \
|
||||||
#define SYNC_SELF_LEADER_REDIRECT_ERROR(_code) ((_code) == TSDB_CODE_SYN_NOT_LEADER || (_code) == TSDB_CODE_SYN_INTERNAL_ERROR)
|
((_code) == TSDB_CODE_SYN_NOT_LEADER || (_code) == TSDB_CODE_SYN_INTERNAL_ERROR || \
|
||||||
#define SYNC_OTHER_LEADER_REDIRECT_ERROR(_code) (false) // used later
|
(_code) == TSDB_CODE_VND_STOPPED || (_code) == TSDB_CODE_APP_IS_STARTING || (_code) == TSDB_CODE_APP_IS_STOPPING)
|
||||||
|
#define SYNC_SELF_LEADER_REDIRECT_ERROR(_code) \
|
||||||
|
((_code) == TSDB_CODE_SYN_NOT_LEADER || (_code) == TSDB_CODE_SYN_RESTORING || (_code) == TSDB_CODE_SYN_INTERNAL_ERROR)
|
||||||
|
#define SYNC_OTHER_LEADER_REDIRECT_ERROR(_code) ((_code) == TSDB_CODE_MNODE_NOT_FOUND)
|
||||||
|
|
||||||
#define NEED_REDIRECT_ERROR(_code) \
|
#define NO_RET_REDIRECT_ERROR(_code) ((_code) == TSDB_CODE_RPC_BROKEN_LINK || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL)
|
||||||
((_code) == TSDB_CODE_RPC_REDIRECT || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || \
|
|
||||||
(_code) == TSDB_CODE_NODE_NOT_DEPLOYED || SYNC_UNKNOWN_LEADER_REDIRECT_ERROR(_code) || \
|
#define NEED_REDIRECT_ERROR(_code) \
|
||||||
SYNC_SELF_LEADER_REDIRECT_ERROR(_code) || SYNC_OTHER_LEADER_REDIRECT_ERROR(_code) || \
|
(NO_RET_REDIRECT_ERROR(_code) || SYNC_UNKNOWN_LEADER_REDIRECT_ERROR(_code) || \
|
||||||
(_code) == TSDB_CODE_APP_NOT_READY || (_code) == TSDB_CODE_RPC_BROKEN_LINK || \
|
SYNC_SELF_LEADER_REDIRECT_ERROR(_code) || SYNC_OTHER_LEADER_REDIRECT_ERROR(_code))
|
||||||
(_code) == TSDB_CODE_APP_IS_STARTING || (_code) == TSDB_CODE_APP_IS_STOPPING)
|
|
||||||
|
|
||||||
#define NEED_CLIENT_RM_TBLMETA_REQ(_type) \
|
#define NEED_CLIENT_RM_TBLMETA_REQ(_type) \
|
||||||
((_type) == TDMT_VND_CREATE_TABLE || (_type) == TDMT_MND_CREATE_STB || (_type) == TDMT_VND_DROP_TABLE || \
|
((_type) == TDMT_VND_CREATE_TABLE || (_type) == TDMT_MND_CREATE_STB || (_type) == TDMT_VND_DROP_TABLE || \
|
||||||
(_type) == TDMT_MND_DROP_STB)
|
(_type) == TDMT_MND_DROP_STB)
|
||||||
|
|
||||||
#define NEED_SCHEDULER_REDIRECT_ERROR(_code) \
|
#define NEED_SCHEDULER_REDIRECT_ERROR(_code) \
|
||||||
((_code) == TSDB_CODE_RPC_REDIRECT || (_code) == TSDB_CODE_NODE_NOT_DEPLOYED || \
|
(SYNC_UNKNOWN_LEADER_REDIRECT_ERROR(_code) || SYNC_SELF_LEADER_REDIRECT_ERROR(_code) || \
|
||||||
SYNC_UNKNOWN_LEADER_REDIRECT_ERROR(_code) || SYNC_SELF_LEADER_REDIRECT_ERROR(_code) || \
|
SYNC_OTHER_LEADER_REDIRECT_ERROR(_code))
|
||||||
SYNC_OTHER_LEADER_REDIRECT_ERROR(_code) || (_code) == TSDB_CODE_APP_NOT_READY)
|
|
||||||
|
|
||||||
#define REQUEST_TOTAL_EXEC_TIMES 2
|
#define REQUEST_TOTAL_EXEC_TIMES 2
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ typedef struct STdbState {
|
||||||
TTB* pFillStateDb; // todo refactor
|
TTB* pFillStateDb; // todo refactor
|
||||||
TTB* pSessionStateDb;
|
TTB* pSessionStateDb;
|
||||||
TTB* pParNameDb;
|
TTB* pParNameDb;
|
||||||
TXN txn;
|
TXN* txn;
|
||||||
} STdbState;
|
} STdbState;
|
||||||
|
|
||||||
// incremental state storage
|
// incremental state storage
|
||||||
|
|
|
||||||
|
|
@ -620,7 +620,7 @@ typedef struct SStreamMeta {
|
||||||
SHashObj* pTasks;
|
SHashObj* pTasks;
|
||||||
SHashObj* pRecoverStatus;
|
SHashObj* pRecoverStatus;
|
||||||
void* ahandle;
|
void* ahandle;
|
||||||
TXN txn;
|
TXN* txn;
|
||||||
FTaskExpand* expandFunc;
|
FTaskExpand* expandFunc;
|
||||||
int32_t vgId;
|
int32_t vgId;
|
||||||
SRWLatch lock;
|
SRWLatch lock;
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ extern "C" {
|
||||||
#define SYNC_MAX_RETRY_BACKOFF 5
|
#define SYNC_MAX_RETRY_BACKOFF 5
|
||||||
#define SYNC_LOG_REPL_RETRY_WAIT_MS 100
|
#define SYNC_LOG_REPL_RETRY_WAIT_MS 100
|
||||||
#define SYNC_APPEND_ENTRIES_TIMEOUT_MS 10000
|
#define SYNC_APPEND_ENTRIES_TIMEOUT_MS 10000
|
||||||
#define SYNC_HEART_TIMEOUT_MS 1000 * 8
|
#define SYNC_HEART_TIMEOUT_MS 1000 * 15
|
||||||
|
|
||||||
#define SYNC_HEARTBEAT_SLOW_MS 1500
|
#define SYNC_HEARTBEAT_SLOW_MS 1500
|
||||||
#define SYNC_HEARTBEAT_REPLY_SLOW_MS 1500
|
#define SYNC_HEARTBEAT_REPLY_SLOW_MS 1500
|
||||||
|
|
@ -138,8 +138,8 @@ typedef struct SSnapshotMeta {
|
||||||
typedef struct SSyncFSM {
|
typedef struct SSyncFSM {
|
||||||
void* data;
|
void* data;
|
||||||
|
|
||||||
void (*FpCommitCb)(const struct SSyncFSM* pFsm, SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
|
int32_t (*FpCommitCb)(const struct SSyncFSM* pFsm, SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
|
||||||
void (*FpPreCommitCb)(const struct SSyncFSM* pFsm, SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
|
int32_t (*FpPreCommitCb)(const struct SSyncFSM* pFsm, SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
|
||||||
void (*FpRollBackCb)(const struct SSyncFSM* pFsm, SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
|
void (*FpRollBackCb)(const struct SSyncFSM* pFsm, SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
|
||||||
|
|
||||||
void (*FpRestoreFinishCb)(const struct SSyncFSM* pFsm);
|
void (*FpRestoreFinishCb)(const struct SSyncFSM* pFsm);
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,8 @@ typedef struct SWal {
|
||||||
TdFilePtr pIdxFile;
|
TdFilePtr pIdxFile;
|
||||||
int32_t writeCur;
|
int32_t writeCur;
|
||||||
SArray *fileInfoSet; // SArray<SWalFileInfo>
|
SArray *fileInfoSet; // SArray<SWalFileInfo>
|
||||||
|
// gc
|
||||||
|
SArray *toDeleteFiles; // SArray<SWalFileInfo>
|
||||||
// status
|
// status
|
||||||
int64_t totSize;
|
int64_t totSize;
|
||||||
int64_t lastRollSeq;
|
int64_t lastRollSeq;
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,7 @@ int32_t taosFsyncFile(TdFilePtr pFile);
|
||||||
int64_t taosReadFile(TdFilePtr pFile, void *buf, int64_t count);
|
int64_t taosReadFile(TdFilePtr pFile, void *buf, int64_t count);
|
||||||
int64_t taosPReadFile(TdFilePtr pFile, void *buf, int64_t count, int64_t offset);
|
int64_t taosPReadFile(TdFilePtr pFile, void *buf, int64_t count, int64_t offset);
|
||||||
int64_t taosWriteFile(TdFilePtr pFile, const void *buf, int64_t count);
|
int64_t taosWriteFile(TdFilePtr pFile, const void *buf, int64_t count);
|
||||||
|
int64_t taosPWriteFile(TdFilePtr pFile, const void *buf, int64_t count, int64_t offset);
|
||||||
void taosFprintfFile(TdFilePtr pFile, const char *format, ...);
|
void taosFprintfFile(TdFilePtr pFile, const char *format, ...);
|
||||||
|
|
||||||
int64_t taosGetLineFile(TdFilePtr pFile, char **__restrict ptrBuf);
|
int64_t taosGetLineFile(TdFilePtr pFile, char **__restrict ptrBuf);
|
||||||
|
|
|
||||||
|
|
@ -40,61 +40,61 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_FAILED -1 // unknown or needn't tell detail error
|
#define TSDB_CODE_FAILED -1 // unknown or needn't tell detail error
|
||||||
|
|
||||||
// rpc
|
// rpc
|
||||||
// #define TSDB_CODE_RPC_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0001) //2.x
|
// #define TSDB_CODE_RPC_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0001) // 2.x
|
||||||
// #define TSDB_CODE_RPC_AUTH_REQUIRED TAOS_DEF_ERROR_CODE(0, 0x0002) //2.x
|
// #define TSDB_CODE_RPC_AUTH_REQUIRED TAOS_DEF_ERROR_CODE(0, 0x0002) // 2.x
|
||||||
#define TSDB_CODE_RPC_AUTH_FAILURE TAOS_DEF_ERROR_CODE(0, 0x0003)
|
// #define TSDB_CODE_RPC_AUTH_FAILURE TAOS_DEF_ERROR_CODE(0, 0x0003) // 2.x
|
||||||
#define TSDB_CODE_RPC_REDIRECT TAOS_DEF_ERROR_CODE(0, 0x0004)
|
// #define TSDB_CODE_RPC_REDIRECT TAOS_DEF_ERROR_CODE(0, 0x0004) // 2.x
|
||||||
// #define TSDB_CODE_RPC_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0005) //2.x
|
// #define TSDB_CODE_RPC_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0005) // 2.x
|
||||||
// #define TSDB_CODE_RPC_ALREADY_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0006) //2.x
|
// #define TSDB_CODE_RPC_ALREADY_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0006) // 2.x
|
||||||
// #define TSDB_CODE_RPC_LAST_SESSION_NOT_FINI. TAOS_DEF_ERROR_CODE(0, 0x0007) //2.x
|
// #define TSDB_CODE_RPC_LAST_SESSION_NOT_FINI. TAOS_DEF_ERROR_CODE(0, 0x0007) // 2.x
|
||||||
// #define TSDB_CODE_RPC_MISMATCHED_LINK_ID TAOS_DEF_ERROR_CODE(0, 0x0008) //2.x
|
// #define TSDB_CODE_RPC_MISMATCHED_LINK_ID TAOS_DEF_ERROR_CODE(0, 0x0008) // 2.x
|
||||||
// #define TSDB_CODE_RPC_TOO_SLOW TAOS_DEF_ERROR_CODE(0, 0x0009) //2.x
|
// #define TSDB_CODE_RPC_TOO_SLOW TAOS_DEF_ERROR_CODE(0, 0x0009) // 2.x
|
||||||
// #define TSDB_CODE_RPC_MAX_SESSIONS TAOS_DEF_ERROR_CODE(0, 0x000A) //2.x
|
// #define TSDB_CODE_RPC_MAX_SESSIONS TAOS_DEF_ERROR_CODE(0, 0x000A) // 2.x
|
||||||
#define TSDB_CODE_RPC_NETWORK_UNAVAIL TAOS_DEF_ERROR_CODE(0, 0x000B)
|
#define TSDB_CODE_RPC_NETWORK_UNAVAIL TAOS_DEF_ERROR_CODE(0, 0x000B)
|
||||||
// #define TSDB_CODE_RPC_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x000C) //2.x
|
// #define TSDB_CODE_RPC_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x000C) // 2.x
|
||||||
// #define TSDB_CODE_RPC_UNEXPECTED_RESPONSE TAOS_DEF_ERROR_CODE(0, 0x000D) //2.x
|
// #define TSDB_CODE_RPC_UNEXPECTED_RESPONSE TAOS_DEF_ERROR_CODE(0, 0x000D) // 2.x
|
||||||
// #define TSDB_CODE_RPC_INVALID_VALUE TAOS_DEF_ERROR_CODE(0, 0x000E) //2.x
|
// #define TSDB_CODE_RPC_INVALID_VALUE TAOS_DEF_ERROR_CODE(0, 0x000E) // 2.x
|
||||||
// #define TSDB_CODE_RPC_INVALID_TRAN_ID TAOS_DEF_ERROR_CODE(0, 0x000F) //2.x
|
// #define TSDB_CODE_RPC_INVALID_TRAN_ID TAOS_DEF_ERROR_CODE(0, 0x000F) // 2.x
|
||||||
// #define TSDB_CODE_RPC_INVALID_SESSION_ID TAOS_DEF_ERROR_CODE(0, 0x0010) //2.x
|
// #define TSDB_CODE_RPC_INVALID_SESSION_ID TAOS_DEF_ERROR_CODE(0, 0x0010) // 2.x
|
||||||
// #define TSDB_CODE_RPC_INVALID_MSG_TYPE TAOS_DEF_ERROR_CODE(0, 0x0011) //2.x
|
// #define TSDB_CODE_RPC_INVALID_MSG_TYPE TAOS_DEF_ERROR_CODE(0, 0x0011) // 2.x
|
||||||
// #define TSDB_CODE_RPC_INVALID_RESPONSE_TYPE TAOS_DEF_ERROR_CODE(0, 0x0012) //2.x
|
// #define TSDB_CODE_RPC_INVALID_RESPONSE_TYPE TAOS_DEF_ERROR_CODE(0, 0x0012) // 2.x
|
||||||
#define TSDB_CODE_TIME_UNSYNCED TAOS_DEF_ERROR_CODE(0, 0x0013)
|
#define TSDB_CODE_TIME_UNSYNCED TAOS_DEF_ERROR_CODE(0, 0x0013) //
|
||||||
#define TSDB_CODE_APP_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0014)
|
// #define TSDB_CODE_APP_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0014) // 2.x
|
||||||
#define TSDB_CODE_RPC_FQDN_ERROR TAOS_DEF_ERROR_CODE(0, 0x0015)
|
#define TSDB_CODE_RPC_FQDN_ERROR TAOS_DEF_ERROR_CODE(0, 0x0015)
|
||||||
// #define TSDB_CODE_RPC_INVALID_VERSION TAOS_DEF_ERROR_CODE(0, 0x0016) //2.x
|
// #define TSDB_CODE_RPC_INVALID_VERSION TAOS_DEF_ERROR_CODE(0, 0x0016) // 2.x
|
||||||
#define TSDB_CODE_RPC_PORT_EADDRINUSE TAOS_DEF_ERROR_CODE(0, 0x0017)
|
#define TSDB_CODE_RPC_PORT_EADDRINUSE TAOS_DEF_ERROR_CODE(0, 0x0017) //
|
||||||
#define TSDB_CODE_RPC_BROKEN_LINK TAOS_DEF_ERROR_CODE(0, 0x0018)
|
#define TSDB_CODE_RPC_BROKEN_LINK TAOS_DEF_ERROR_CODE(0, 0x0018) //
|
||||||
#define TSDB_CODE_RPC_TIMEOUT TAOS_DEF_ERROR_CODE(0, 0x0019)
|
#define TSDB_CODE_RPC_TIMEOUT TAOS_DEF_ERROR_CODE(0, 0x0019) //
|
||||||
|
|
||||||
//common & util
|
//common & util
|
||||||
#define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0100)
|
#define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0100) //
|
||||||
#define TSDB_CODE_MEMORY_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0101)
|
// #define TSDB_CODE_MEMORY_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0101) // 2.x
|
||||||
#define TSDB_CODE_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0102)
|
#define TSDB_CODE_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0102)
|
||||||
// #define TSDB_CODE_COM_INVALID_CFG_MSG TAOS_DEF_ERROR_CODE(0, 0x0103) // 2.x
|
// #define TSDB_CODE_COM_INVALID_CFG_MSG TAOS_DEF_ERROR_CODE(0, 0x0103) // 2.x
|
||||||
#define TSDB_CODE_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0104)
|
#define TSDB_CODE_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0104) //
|
||||||
#define TSDB_CODE_REF_NO_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0105)
|
// #define TSDB_CODE_REF_NO_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0105) // 2.x
|
||||||
#define TSDB_CODE_REF_FULL TAOS_DEF_ERROR_CODE(0, 0x0106)
|
#define TSDB_CODE_REF_FULL TAOS_DEF_ERROR_CODE(0, 0x0106) // internal
|
||||||
#define TSDB_CODE_REF_ID_REMOVED TAOS_DEF_ERROR_CODE(0, 0x0107)
|
#define TSDB_CODE_REF_ID_REMOVED TAOS_DEF_ERROR_CODE(0, 0x0107) // internal
|
||||||
#define TSDB_CODE_REF_INVALID_ID TAOS_DEF_ERROR_CODE(0, 0x0108)
|
#define TSDB_CODE_REF_INVALID_ID TAOS_DEF_ERROR_CODE(0, 0x0108) // internal
|
||||||
#define TSDB_CODE_REF_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0109)
|
#define TSDB_CODE_REF_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0109) // internal
|
||||||
#define TSDB_CODE_REF_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x010A)
|
#define TSDB_CODE_REF_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x010A) // internal
|
||||||
|
|
||||||
#define TSDB_CODE_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0110)
|
#define TSDB_CODE_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0110) //
|
||||||
#define TSDB_CODE_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0111)
|
#define TSDB_CODE_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0111) // internal
|
||||||
#define TSDB_CODE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0112)
|
#define TSDB_CODE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0112) //
|
||||||
#define TSDB_CODE_OUT_OF_SHM_MEM TAOS_DEF_ERROR_CODE(0, 0x0113)
|
// #define TSDB_CODE_OUT_OF_SHM_MEM TAOS_DEF_ERROR_CODE(0, 0x0113)
|
||||||
#define TSDB_CODE_INVALID_SHM_ID TAOS_DEF_ERROR_CODE(0, 0x0114)
|
// #define TSDB_CODE_INVALID_SHM_ID TAOS_DEF_ERROR_CODE(0, 0x0114)
|
||||||
#define TSDB_CODE_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x0115)
|
#define TSDB_CODE_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x0115) //
|
||||||
#define TSDB_CODE_INVALID_MSG_LEN TAOS_DEF_ERROR_CODE(0, 0x0116) //
|
#define TSDB_CODE_INVALID_MSG_LEN TAOS_DEF_ERROR_CODE(0, 0x0116) //
|
||||||
#define TSDB_CODE_INVALID_PTR TAOS_DEF_ERROR_CODE(0, 0x0117)
|
#define TSDB_CODE_INVALID_PTR TAOS_DEF_ERROR_CODE(0, 0x0117) // internal
|
||||||
#define TSDB_CODE_INVALID_PARA TAOS_DEF_ERROR_CODE(0, 0x0118)
|
#define TSDB_CODE_INVALID_PARA TAOS_DEF_ERROR_CODE(0, 0x0118) //
|
||||||
#define TSDB_CODE_INVALID_CFG TAOS_DEF_ERROR_CODE(0, 0x0119)
|
#define TSDB_CODE_INVALID_CFG TAOS_DEF_ERROR_CODE(0, 0x0119) // internal
|
||||||
#define TSDB_CODE_INVALID_OPTION TAOS_DEF_ERROR_CODE(0, 0x011A)
|
#define TSDB_CODE_INVALID_OPTION TAOS_DEF_ERROR_CODE(0, 0x011A) // internal
|
||||||
#define TSDB_CODE_INVALID_JSON_FORMAT TAOS_DEF_ERROR_CODE(0, 0x011B)
|
#define TSDB_CODE_INVALID_JSON_FORMAT TAOS_DEF_ERROR_CODE(0, 0x011B) // internal
|
||||||
#define TSDB_CODE_INVALID_VERSION_NUMBER TAOS_DEF_ERROR_CODE(0, 0x011C)
|
#define TSDB_CODE_INVALID_VERSION_NUMBER TAOS_DEF_ERROR_CODE(0, 0x011C) // internal
|
||||||
#define TSDB_CODE_INVALID_VERSION_STRING TAOS_DEF_ERROR_CODE(0, 0x011D)
|
#define TSDB_CODE_INVALID_VERSION_STRING TAOS_DEF_ERROR_CODE(0, 0x011D) // internal
|
||||||
#define TSDB_CODE_VERSION_NOT_COMPATIBLE TAOS_DEF_ERROR_CODE(0, 0x011E)
|
#define TSDB_CODE_VERSION_NOT_COMPATIBLE TAOS_DEF_ERROR_CODE(0, 0x011E) // internal
|
||||||
#define TSDB_CODE_CHECKSUM_ERROR TAOS_DEF_ERROR_CODE(0, 0x011F)
|
#define TSDB_CODE_CHECKSUM_ERROR TAOS_DEF_ERROR_CODE(0, 0x011F) // internal
|
||||||
|
|
||||||
#define TSDB_CODE_COMPRESS_ERROR TAOS_DEF_ERROR_CODE(0, 0x0120)
|
#define TSDB_CODE_COMPRESS_ERROR TAOS_DEF_ERROR_CODE(0, 0x0120)
|
||||||
#define TSDB_CODE_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0121) //
|
#define TSDB_CODE_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0121) //
|
||||||
|
|
@ -126,11 +126,11 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_TSC_INVALID_DB_LENGTH TAOS_DEF_ERROR_CODE(0, 0x0209)
|
#define TSDB_CODE_TSC_INVALID_DB_LENGTH TAOS_DEF_ERROR_CODE(0, 0x0209)
|
||||||
#define TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH TAOS_DEF_ERROR_CODE(0, 0x020A)
|
#define TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH TAOS_DEF_ERROR_CODE(0, 0x020A)
|
||||||
#define TSDB_CODE_TSC_INVALID_CONNECTION TAOS_DEF_ERROR_CODE(0, 0x020B)
|
#define TSDB_CODE_TSC_INVALID_CONNECTION TAOS_DEF_ERROR_CODE(0, 0x020B)
|
||||||
#define TSDB_CODE_TSC_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x020C)
|
// #define TSDB_CODE_TSC_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x020C) // 2.x
|
||||||
#define TSDB_CODE_TSC_QUERY_CACHE_ERASED TAOS_DEF_ERROR_CODE(0, 0x020E)
|
#define TSDB_CODE_TSC_QUERY_CACHE_ERASED TAOS_DEF_ERROR_CODE(0, 0x020E)
|
||||||
#define TSDB_CODE_TSC_QUERY_CANCELLED TAOS_DEF_ERROR_CODE(0, 0x020F)
|
#define TSDB_CODE_TSC_QUERY_CANCELLED TAOS_DEF_ERROR_CODE(0, 0x020F)
|
||||||
#define TSDB_CODE_TSC_SORTED_RES_TOO_MANY TAOS_DEF_ERROR_CODE(0, 0x0210)
|
#define TSDB_CODE_TSC_SORTED_RES_TOO_MANY TAOS_DEF_ERROR_CODE(0, 0x0210)
|
||||||
#define TSDB_CODE_TSC_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0211)
|
// #define TSDB_CODE_TSC_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0211) // 2.x
|
||||||
#define TSDB_CODE_TSC_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0212)
|
#define TSDB_CODE_TSC_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0212)
|
||||||
#define TSDB_CODE_TSC_DISCONNECTED TAOS_DEF_ERROR_CODE(0, 0x0213)
|
#define TSDB_CODE_TSC_DISCONNECTED TAOS_DEF_ERROR_CODE(0, 0x0213)
|
||||||
#define TSDB_CODE_TSC_NO_WRITE_AUTH TAOS_DEF_ERROR_CODE(0, 0x0214)
|
#define TSDB_CODE_TSC_NO_WRITE_AUTH TAOS_DEF_ERROR_CODE(0, 0x0214)
|
||||||
|
|
@ -158,32 +158,41 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_TSC_NOT_STABLE_ERROR TAOS_DEF_ERROR_CODE(0, 0X022F)
|
#define TSDB_CODE_TSC_NOT_STABLE_ERROR TAOS_DEF_ERROR_CODE(0, 0X022F)
|
||||||
|
|
||||||
// mnode-common
|
// mnode-common
|
||||||
|
// #define TSDB_CODE_MND_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0300) // 2.x
|
||||||
|
// #define TSDB_CODE_MND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0301) // 2.x
|
||||||
|
// #define TSDB_CODE_MND_ACTION_NEED_REPROCESSEDTAOS_DEF_ERROR_CODE(0, 0x0302) // 2.x
|
||||||
#define TSDB_CODE_MND_NO_RIGHTS TAOS_DEF_ERROR_CODE(0, 0x0303)
|
#define TSDB_CODE_MND_NO_RIGHTS TAOS_DEF_ERROR_CODE(0, 0x0303)
|
||||||
#define TSDB_CODE_MND_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0304)
|
// #define TSDB_CODE_MND_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0304) // 2.x
|
||||||
#define TSDB_CODE_MND_INVALID_CONNECTION TAOS_DEF_ERROR_CODE(0, 0x0305)
|
// #define TSDB_CODE_MND_INVALID_CONNECTION TAOS_DEF_ERROR_CODE(0, 0x0305) // 2.x
|
||||||
|
// #define TSDB_CODE_MND_INVALID_MSG_VERSION TAOS_DEF_ERROR_CODE(0, 0x0306) // 2.x
|
||||||
|
// #define TSDB_CODE_MND_INVALID_MSG_LEN TAOS_DEF_ERROR_CODE(0, 0x0307) // 2.x
|
||||||
|
// #define TSDB_CODE_MND_INVALID_MSG_TYPE TAOS_DEF_ERROR_CODE(0, 0x0308) // 2.x
|
||||||
|
// #define TSDB_CODE_MND_TOO_MANY_SHELL_CONNS TAOS_DEF_ERROR_CODE(0, 0x0309) // 2.x
|
||||||
|
// #define TSDB_CODE_MND_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x030A) // 2.x
|
||||||
#define TSDB_CODE_MND_INVALID_SHOWOBJ TAOS_DEF_ERROR_CODE(0, 0x030B)
|
#define TSDB_CODE_MND_INVALID_SHOWOBJ TAOS_DEF_ERROR_CODE(0, 0x030B)
|
||||||
#define TSDB_CODE_MND_INVALID_QUERY_ID TAOS_DEF_ERROR_CODE(0, 0x030C)
|
#define TSDB_CODE_MND_INVALID_QUERY_ID TAOS_DEF_ERROR_CODE(0, 0x030C)
|
||||||
#define TSDB_CODE_MND_INVALID_STREAM_ID TAOS_DEF_ERROR_CODE(0, 0x030D)
|
// #define TSDB_CODE_MND_INVALID_STREAM_ID TAOS_DEF_ERROR_CODE(0, 0x030D) // 2.x
|
||||||
#define TSDB_CODE_MND_INVALID_CONN_ID TAOS_DEF_ERROR_CODE(0, 0x030E)
|
#define TSDB_CODE_MND_INVALID_CONN_ID TAOS_DEF_ERROR_CODE(0, 0x030E)
|
||||||
#define TSDB_CODE_MND_MNODE_IS_RUNNING TAOS_DEF_ERROR_CODE(0, 0x0310)
|
// #define TSDB_CODE_MND_MNODE_IS_RUNNING TAOS_DEF_ERROR_CODE(0, 0x0310) // 2.x
|
||||||
#define TSDB_CODE_MND_FAILED_TO_CONFIG_SYNC TAOS_DEF_ERROR_CODE(0, 0x0311)
|
// #define TSDB_CODE_MND_FAILED_TO_CONFIG_SYNC TAOS_DEF_ERROR_CODE(0, 0x0311) // 2.x
|
||||||
#define TSDB_CODE_MND_FAILED_TO_START_SYNC TAOS_DEF_ERROR_CODE(0, 0x0312)
|
// #define TSDB_CODE_MND_FAILED_TO_START_SYNC TAOS_DEF_ERROR_CODE(0, 0x0312) // 2.x
|
||||||
#define TSDB_CODE_MND_FAILED_TO_CREATE_DIR TAOS_DEF_ERROR_CODE(0, 0x0313)
|
// #define TSDB_CODE_MND_FAILED_TO_CREATE_DIR TAOS_DEF_ERROR_CODE(0, 0x0313) // 2.x
|
||||||
#define TSDB_CODE_MND_FAILED_TO_INIT_STEP TAOS_DEF_ERROR_CODE(0, 0x0314)
|
// #define TSDB_CODE_MND_FAILED_TO_INIT_STEP TAOS_DEF_ERROR_CODE(0, 0x0314) // 2.x
|
||||||
#define TSDB_CODE_MND_USER_DISABLED TAOS_DEF_ERROR_CODE(0, 0x0315)
|
#define TSDB_CODE_MND_USER_DISABLED TAOS_DEF_ERROR_CODE(0, 0x0315)
|
||||||
|
|
||||||
// mnode-sdb
|
// mnode-sdb
|
||||||
#define TSDB_CODE_SDB_OBJ_ALREADY_THERE TAOS_DEF_ERROR_CODE(0, 0x0320)
|
#define TSDB_CODE_SDB_OBJ_ALREADY_THERE TAOS_DEF_ERROR_CODE(0, 0x0320) // internal
|
||||||
#define TSDB_CODE_SDB_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0321) // internal
|
// #define TSDB_CODE_MND_SDB_ERROR TAOS_DEF_ERROR_CODE(0, 0x0321) // 2.x
|
||||||
#define TSDB_CODE_SDB_INVALID_TABLE_TYPE TAOS_DEF_ERROR_CODE(0, 0x0322)
|
#define TSDB_CODE_SDB_INVALID_TABLE_TYPE TAOS_DEF_ERROR_CODE(0, 0x0322) // internal
|
||||||
#define TSDB_CODE_SDB_OBJ_NOT_THERE TAOS_DEF_ERROR_CODE(0, 0x0323)
|
#define TSDB_CODE_SDB_OBJ_NOT_THERE TAOS_DEF_ERROR_CODE(0, 0x0323)
|
||||||
#define TSDB_CODE_SDB_INVALID_KEY_TYPE TAOS_DEF_ERROR_CODE(0, 0x0325)
|
// #define TSDB_CODE_MND_SDB_INVAID_META_ROW TAOS_DEF_ERROR_CODE(0, 0x0324) // 2.x
|
||||||
#define TSDB_CODE_SDB_INVALID_ACTION_TYPE TAOS_DEF_ERROR_CODE(0, 0x0326)
|
// #define TSDB_CODE_SDB_INVALID_KEY_TYPE TAOS_DEF_ERROR_CODE(0, 0x0325) // 2.x
|
||||||
#define TSDB_CODE_SDB_INVALID_STATUS_TYPE TAOS_DEF_ERROR_CODE(0, 0x0327)
|
#define TSDB_CODE_SDB_INVALID_ACTION_TYPE TAOS_DEF_ERROR_CODE(0, 0x0326) // internal
|
||||||
#define TSDB_CODE_SDB_INVALID_DATA_VER TAOS_DEF_ERROR_CODE(0, 0x0328)
|
// #define TSDB_CODE_SDB_INVALID_STATUS_TYPE TAOS_DEF_ERROR_CODE(0, 0x0327) // unused
|
||||||
#define TSDB_CODE_SDB_INVALID_DATA_LEN TAOS_DEF_ERROR_CODE(0, 0x0329)
|
#define TSDB_CODE_SDB_INVALID_DATA_VER TAOS_DEF_ERROR_CODE(0, 0x0328) // internal
|
||||||
|
#define TSDB_CODE_SDB_INVALID_DATA_LEN TAOS_DEF_ERROR_CODE(0, 0x0329) // internal
|
||||||
#define TSDB_CODE_SDB_INVALID_DATA_CONTENT TAOS_DEF_ERROR_CODE(0, 0x032A)
|
#define TSDB_CODE_SDB_INVALID_DATA_CONTENT TAOS_DEF_ERROR_CODE(0, 0x032A)
|
||||||
#define TSDB_CODE_SDB_INVALID_WAl_VER TAOS_DEF_ERROR_CODE(0, 0x032B)
|
// #define TSDB_CODE_SDB_INVALID_WAl_VER TAOS_DEF_ERROR_CODE(0, 0x032B) // unused
|
||||||
#define TSDB_CODE_SDB_OBJ_CREATING TAOS_DEF_ERROR_CODE(0, 0x032C)
|
#define TSDB_CODE_SDB_OBJ_CREATING TAOS_DEF_ERROR_CODE(0, 0x032C)
|
||||||
#define TSDB_CODE_SDB_OBJ_DROPPING TAOS_DEF_ERROR_CODE(0, 0x032D)
|
#define TSDB_CODE_SDB_OBJ_DROPPING TAOS_DEF_ERROR_CODE(0, 0x032D)
|
||||||
|
|
||||||
|
|
@ -217,22 +226,31 @@ int32_t* taosGetErrno();
|
||||||
|
|
||||||
// mnode-stable-part1
|
// mnode-stable-part1
|
||||||
#define TSDB_CODE_MND_STB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0360)
|
#define TSDB_CODE_MND_STB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0360)
|
||||||
|
// #define TSDB_CODE_MND_INVALID_TABLE_ID TAOS_DEF_ERROR_CODE(0, 0x0361) // 2.x
|
||||||
#define TSDB_CODE_MND_STB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0362)
|
#define TSDB_CODE_MND_STB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0362)
|
||||||
|
// #define TSDB_CODE_MND_INVALID_TABLE_TYPE TAOS_DEF_ERROR_CODE(0, 0x0363) // 2.x
|
||||||
#define TSDB_CODE_MND_TOO_MANY_TAGS TAOS_DEF_ERROR_CODE(0, 0x0364)
|
#define TSDB_CODE_MND_TOO_MANY_TAGS TAOS_DEF_ERROR_CODE(0, 0x0364)
|
||||||
#define TSDB_CODE_MND_TOO_MANY_COLUMNS TAOS_DEF_ERROR_CODE(0, 0x0365)
|
#define TSDB_CODE_MND_TOO_MANY_COLUMNS TAOS_DEF_ERROR_CODE(0, 0x0365)
|
||||||
|
// #define TSDB_CODE_MND_TOO_MANY_TIMESERIES TAOS_DEF_ERROR_CODE(0, 0x0366) // 2.x
|
||||||
|
// #define TSDB_CODE_MND_NOT_SUPER_TABLE TAOS_DEF_ERROR_CODE(0, 0x0367) // 2.x
|
||||||
|
// #define TSDB_CODE_MND_COL_NAME_TOO_LONG TAOS_DEF_ERROR_CODE(0, 0x0368) // 2.x
|
||||||
#define TSDB_CODE_MND_TAG_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0369)
|
#define TSDB_CODE_MND_TAG_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0369)
|
||||||
#define TSDB_CODE_MND_TAG_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x036A)
|
#define TSDB_CODE_MND_TAG_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x036A)
|
||||||
#define TSDB_CODE_MND_COLUMN_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x036B)
|
#define TSDB_CODE_MND_COLUMN_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x036B)
|
||||||
#define TSDB_CODE_MND_COLUMN_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x036C)
|
#define TSDB_CODE_MND_COLUMN_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x036C)
|
||||||
|
// #define TSDB_CODE_MND_INVALID_STABLE_NAME TAOS_DEF_ERROR_CODE(0, 0x036D) // 2.x
|
||||||
#define TSDB_CODE_MND_INVALID_STB_OPTION TAOS_DEF_ERROR_CODE(0, 0x036E)
|
#define TSDB_CODE_MND_INVALID_STB_OPTION TAOS_DEF_ERROR_CODE(0, 0x036E)
|
||||||
#define TSDB_CODE_MND_INVALID_ROW_BYTES TAOS_DEF_ERROR_CODE(0, 0x036F)
|
#define TSDB_CODE_MND_INVALID_ROW_BYTES TAOS_DEF_ERROR_CODE(0, 0x036F)
|
||||||
|
|
||||||
// mnode-func
|
// mnode-func
|
||||||
#define TSDB_CODE_MND_INVALID_FUNC_NAME TAOS_DEF_ERROR_CODE(0, 0x0370)
|
#define TSDB_CODE_MND_INVALID_FUNC_NAME TAOS_DEF_ERROR_CODE(0, 0x0370)
|
||||||
|
// #define TSDB_CODE_MND_INVALID_FUNC_LEN TAOS_DEF_ERROR_CODE(0, 0x0371) // 2.x
|
||||||
#define TSDB_CODE_MND_INVALID_FUNC_CODE TAOS_DEF_ERROR_CODE(0, 0x0372)
|
#define TSDB_CODE_MND_INVALID_FUNC_CODE TAOS_DEF_ERROR_CODE(0, 0x0372)
|
||||||
#define TSDB_CODE_MND_FUNC_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0373)
|
#define TSDB_CODE_MND_FUNC_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0373)
|
||||||
#define TSDB_CODE_MND_FUNC_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0374)
|
#define TSDB_CODE_MND_FUNC_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0374)
|
||||||
#define TSDB_CODE_MND_INVALID_FUNC_BUFSIZE TAOS_DEF_ERROR_CODE(0, 0x0375)
|
#define TSDB_CODE_MND_INVALID_FUNC_BUFSIZE TAOS_DEF_ERROR_CODE(0, 0x0375)
|
||||||
|
// #define TSDB_CODE_MND_INVALID_TAG_LENGTH TAOS_DEF_ERROR_CODE(0, 0x0376) // 2.x
|
||||||
|
// #define TSDB_CODE_MND_INVALID_COLUMN_LENGTH TAOS_DEF_ERROR_CODE(0, 0x0377) // 2.x
|
||||||
#define TSDB_CODE_MND_INVALID_FUNC_COMMENT TAOS_DEF_ERROR_CODE(0, 0x0378)
|
#define TSDB_CODE_MND_INVALID_FUNC_COMMENT TAOS_DEF_ERROR_CODE(0, 0x0378)
|
||||||
#define TSDB_CODE_MND_INVALID_FUNC_RETRIEVE TAOS_DEF_ERROR_CODE(0, 0x0379)
|
#define TSDB_CODE_MND_INVALID_FUNC_RETRIEVE TAOS_DEF_ERROR_CODE(0, 0x0379)
|
||||||
|
|
||||||
|
|
@ -298,6 +316,7 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_MND_TRANS_CONFLICT TAOS_DEF_ERROR_CODE(0, 0x03D3)
|
#define TSDB_CODE_MND_TRANS_CONFLICT TAOS_DEF_ERROR_CODE(0, 0x03D3)
|
||||||
#define TSDB_CODE_MND_TRANS_CLOG_IS_NULL TAOS_DEF_ERROR_CODE(0, 0x03D4)
|
#define TSDB_CODE_MND_TRANS_CLOG_IS_NULL TAOS_DEF_ERROR_CODE(0, 0x03D4)
|
||||||
#define TSDB_CODE_MND_TRANS_NETWORK_UNAVAILL TAOS_DEF_ERROR_CODE(0, 0x03D5)
|
#define TSDB_CODE_MND_TRANS_NETWORK_UNAVAILL TAOS_DEF_ERROR_CODE(0, 0x03D5)
|
||||||
|
#define TSDB_CODE_MND_LAST_TRANS_NOT_FINISHED TAOS_DEF_ERROR_CODE(0, 0x03D6) //internal
|
||||||
#define TSDB_CODE_MND_TRANS_UNKNOW_ERROR TAOS_DEF_ERROR_CODE(0, 0x03DF)
|
#define TSDB_CODE_MND_TRANS_UNKNOW_ERROR TAOS_DEF_ERROR_CODE(0, 0x03DF)
|
||||||
|
|
||||||
// mnode-mq
|
// mnode-mq
|
||||||
|
|
@ -330,13 +349,49 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_MND_INVALID_SMA_OPTION TAOS_DEF_ERROR_CODE(0, 0x0482)
|
#define TSDB_CODE_MND_INVALID_SMA_OPTION TAOS_DEF_ERROR_CODE(0, 0x0482)
|
||||||
|
|
||||||
// dnode
|
// dnode
|
||||||
#define TSDB_CODE_NODE_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x0408)
|
// #define TSDB_CODE_DND_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0400) // 2.x
|
||||||
#define TSDB_CODE_NODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x0409)
|
// #define TSDB_CODE_DND_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0401) // 2.x
|
||||||
#define TSDB_CODE_NODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x040A)
|
// #define TSDB_CODE_DND_NO_WRITE_ACCESS TAOS_DEF_ERROR_CODE(0, 0x0402) // 2.x
|
||||||
|
// #define TSDB_CODE_DND_INVALID_MSG_LEN TAOS_DEF_ERROR_CODE(0, 0x0403) // 2.x
|
||||||
|
// #define TSDB_CODE_DND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0404) // 2.x
|
||||||
|
// #define TSDB_CODE_DND_TOO_MANY_VNODES TAOS_DEF_ERROR_CODE(0, 0x0405) // 2.x
|
||||||
|
// #define TSDB_CODE_DND_EXITING TAOS_DEF_ERROR_CODE(0, 0x0406) // 2.x
|
||||||
|
// #define TSDB_CODE_DND_VNODE_OPEN_FAILED TAOS_DEF_ERROR_CODE(0, 0x0407) // 2.x
|
||||||
|
#define TSDB_CODE_DNODE_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x0408)
|
||||||
|
#define TSDB_CODE_MNODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x0409)
|
||||||
|
#define TSDB_CODE_MNODE_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x040A)
|
||||||
|
#define TSDB_CODE_MNODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x040B)
|
||||||
|
#define TSDB_CODE_QNODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x040C)
|
||||||
|
#define TSDB_CODE_QNODE_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x040D)
|
||||||
|
#define TSDB_CODE_QNODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x040E)
|
||||||
|
#define TSDB_CODE_SNODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x040F)
|
||||||
|
#define TSDB_CODE_SNODE_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x0410)
|
||||||
|
#define TSDB_CODE_SNODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x0411)
|
||||||
|
|
||||||
// vnode
|
// vnode
|
||||||
|
// #define TSDB_CODE_VND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0500) // 2.x
|
||||||
|
// #define TSDB_CODE_VND_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0501) // 2.x
|
||||||
|
// #define TSDB_CODE_VND_ACTION_NEED_REPROCESS. TAOS_DEF_ERROR_CODE(0, 0x0502) // 2.x
|
||||||
#define TSDB_CODE_VND_INVALID_VGROUP_ID TAOS_DEF_ERROR_CODE(0, 0x0503)
|
#define TSDB_CODE_VND_INVALID_VGROUP_ID TAOS_DEF_ERROR_CODE(0, 0x0503)
|
||||||
|
// #define TSDB_CODE_VND_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x0504) // 2.x
|
||||||
|
// #define TSDB_CODE_VND_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x0505) // 2.x
|
||||||
|
// #define TSDB_CODE_VND_NO_DISK_PERMISSIONS TAOS_DEF_ERROR_CODE(0, 0x0506) // 2.x
|
||||||
|
// #define TSDB_CODE_VND_NO_SUCH_FILE_OR_DIR TAOS_DEF_ERROR_CODE(0, 0x0507) // 2.x
|
||||||
|
// #define TSDB_CODE_VND_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0508) // 2.x
|
||||||
|
// #define TSDB_CODE_VND_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0509) // 2.x
|
||||||
|
// #define TSDB_CODE_VND_INVALID_VRESION_FILE TAOS_DEF_ERROR_CODE(0, 0x050A) // 2.x
|
||||||
|
// #define TSDB_CODE_VND_IS_FULL TAOS_DEF_ERROR_CODE(0, 0x050B) // 2.x
|
||||||
|
// #define TSDB_CODE_VND_IS_FLOWCTRL TAOS_DEF_ERROR_CODE(0, 0x050C) // 2.x
|
||||||
|
// #define TSDB_CODE_VND_IS_DROPPING TAOS_DEF_ERROR_CODE(0, 0x050D) // 2.x
|
||||||
|
// #define TSDB_CODE_VND_IS_BALANCING TAOS_DEF_ERROR_CODE(0, 0x050E) // 2.x
|
||||||
|
// #define TSDB_CODE_VND_IS_CLOSING TAOS_DEF_ERROR_CODE(0, 0x0510) // 2.x
|
||||||
|
// #define TSDB_CODE_VND_NOT_SYNCED TAOS_DEF_ERROR_CODE(0, 0x0511) // 2.x
|
||||||
#define TSDB_CODE_VND_NO_WRITE_AUTH TAOS_DEF_ERROR_CODE(0, 0x0512)
|
#define TSDB_CODE_VND_NO_WRITE_AUTH TAOS_DEF_ERROR_CODE(0, 0x0512)
|
||||||
|
// #define TSDB_CODE_VND_IS_SYNCING TAOS_DEF_ERROR_CODE(0, 0x0513) // 2.x
|
||||||
|
// #define TSDB_CODE_VND_INVALID_TSDB_STATE TAOS_DEF_ERROR_CODE(0, 0x0514) // 2.x
|
||||||
|
// #define TSDB_CODE_WAIT_THREAD_TOO_MANY TAOS_DEF_ERROR_CODE(0, 0x0515) // 2.x
|
||||||
|
#define TSDB_CODE_VND_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0520) // internal
|
||||||
|
#define TSDB_CODE_VND_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0521) // internal
|
||||||
#define TSDB_CODE_VND_HASH_MISMATCH TAOS_DEF_ERROR_CODE(0, 0x0522)
|
#define TSDB_CODE_VND_HASH_MISMATCH TAOS_DEF_ERROR_CODE(0, 0x0522)
|
||||||
#define TSDB_CODE_VND_INVALID_TABLE_ACTION TAOS_DEF_ERROR_CODE(0, 0x0524)
|
#define TSDB_CODE_VND_INVALID_TABLE_ACTION TAOS_DEF_ERROR_CODE(0, 0x0524)
|
||||||
#define TSDB_CODE_VND_COL_ALREADY_EXISTS TAOS_DEF_ERROR_CODE(0, 0x0525)
|
#define TSDB_CODE_VND_COL_ALREADY_EXISTS TAOS_DEF_ERROR_CODE(0, 0x0525)
|
||||||
|
|
@ -344,6 +399,7 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_VND_COL_SUBSCRIBED TAOS_DEF_ERROR_CODE(0, 0x0527)
|
#define TSDB_CODE_VND_COL_SUBSCRIBED TAOS_DEF_ERROR_CODE(0, 0x0527)
|
||||||
#define TSDB_CODE_VND_NO_AVAIL_BUFPOOL TAOS_DEF_ERROR_CODE(0, 0x0528)
|
#define TSDB_CODE_VND_NO_AVAIL_BUFPOOL TAOS_DEF_ERROR_CODE(0, 0x0528)
|
||||||
#define TSDB_CODE_VND_STOPPED TAOS_DEF_ERROR_CODE(0, 0x0529)
|
#define TSDB_CODE_VND_STOPPED TAOS_DEF_ERROR_CODE(0, 0x0529)
|
||||||
|
#define TSDB_CODE_VND_DUP_REQUEST TAOS_DEF_ERROR_CODE(0, 0x0530)
|
||||||
|
|
||||||
// tsdb
|
// tsdb
|
||||||
#define TSDB_CODE_TDB_INVALID_TABLE_ID TAOS_DEF_ERROR_CODE(0, 0x0600)
|
#define TSDB_CODE_TDB_INVALID_TABLE_ID TAOS_DEF_ERROR_CODE(0, 0x0600)
|
||||||
|
|
@ -353,8 +409,8 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_TDB_INVALID_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0604)
|
#define TSDB_CODE_TDB_INVALID_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0604)
|
||||||
#define TSDB_CODE_TDB_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x0605)
|
#define TSDB_CODE_TDB_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x0605)
|
||||||
#define TSDB_CODE_TDB_NO_DISK_PERMISSIONS TAOS_DEF_ERROR_CODE(0, 0x0607)
|
#define TSDB_CODE_TDB_NO_DISK_PERMISSIONS TAOS_DEF_ERROR_CODE(0, 0x0607)
|
||||||
#define TSDB_CODE_TDB_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0608)
|
// #define TSDB_CODE_TDB_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0608) // 2.x
|
||||||
#define TSDB_CODE_TDB_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0609)
|
// #define TSDB_CODE_TDB_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0609) // 2.x
|
||||||
#define TSDB_CODE_TDB_TAG_VER_OUT_OF_DATE TAOS_DEF_ERROR_CODE(0, 0x060A)
|
#define TSDB_CODE_TDB_TAG_VER_OUT_OF_DATE TAOS_DEF_ERROR_CODE(0, 0x060A)
|
||||||
#define TSDB_CODE_TDB_TIMESTAMP_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x060B)
|
#define TSDB_CODE_TDB_TIMESTAMP_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x060B)
|
||||||
#define TSDB_CODE_TDB_SUBMIT_MSG_MSSED_UP TAOS_DEF_ERROR_CODE(0, 0x060C)
|
#define TSDB_CODE_TDB_SUBMIT_MSG_MSSED_UP TAOS_DEF_ERROR_CODE(0, 0x060C)
|
||||||
|
|
@ -368,6 +424,7 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_TDB_MESSED_MSG TAOS_DEF_ERROR_CODE(0, 0x0614)
|
#define TSDB_CODE_TDB_MESSED_MSG TAOS_DEF_ERROR_CODE(0, 0x0614)
|
||||||
#define TSDB_CODE_TDB_IVLD_TAG_VAL TAOS_DEF_ERROR_CODE(0, 0x0615)
|
#define TSDB_CODE_TDB_IVLD_TAG_VAL TAOS_DEF_ERROR_CODE(0, 0x0615)
|
||||||
#define TSDB_CODE_TDB_NO_CACHE_LAST_ROW TAOS_DEF_ERROR_CODE(0, 0x0616)
|
#define TSDB_CODE_TDB_NO_CACHE_LAST_ROW TAOS_DEF_ERROR_CODE(0, 0x0616)
|
||||||
|
// #define TSDB_CODE_TDB_INCOMPLETE_DFILESET TAOS_DEF_ERROR_CODE(0, 0x0617) // 2.x
|
||||||
#define TSDB_CODE_TDB_TABLE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0618)
|
#define TSDB_CODE_TDB_TABLE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0618)
|
||||||
#define TSDB_CODE_TDB_STB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0619)
|
#define TSDB_CODE_TDB_STB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0619)
|
||||||
#define TSDB_CODE_TDB_STB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x061A)
|
#define TSDB_CODE_TDB_STB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x061A)
|
||||||
|
|
@ -378,8 +435,9 @@ int32_t* taosGetErrno();
|
||||||
// query
|
// query
|
||||||
#define TSDB_CODE_QRY_INVALID_QHANDLE TAOS_DEF_ERROR_CODE(0, 0x0700)
|
#define TSDB_CODE_QRY_INVALID_QHANDLE TAOS_DEF_ERROR_CODE(0, 0x0700)
|
||||||
#define TSDB_CODE_QRY_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x0701)
|
#define TSDB_CODE_QRY_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x0701)
|
||||||
#define TSDB_CODE_QRY_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0703)
|
// #define TSDB_CODE_QRY_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x0702) // 2.x
|
||||||
#define TSDB_CODE_QRY_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0704)
|
// #define TSDB_CODE_QRY_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0703) // 2.x
|
||||||
|
// #define TSDB_CODE_QRY_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0704) // 2.x
|
||||||
#define TSDB_CODE_QRY_DUP_JOIN_KEY TAOS_DEF_ERROR_CODE(0, 0x0705)
|
#define TSDB_CODE_QRY_DUP_JOIN_KEY TAOS_DEF_ERROR_CODE(0, 0x0705)
|
||||||
#define TSDB_CODE_QRY_EXCEED_TAGS_LIMIT TAOS_DEF_ERROR_CODE(0, 0x0706)
|
#define TSDB_CODE_QRY_EXCEED_TAGS_LIMIT TAOS_DEF_ERROR_CODE(0, 0x0706)
|
||||||
#define TSDB_CODE_QRY_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0707)
|
#define TSDB_CODE_QRY_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0707)
|
||||||
|
|
@ -391,6 +449,8 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_QRY_SYS_ERROR TAOS_DEF_ERROR_CODE(0, 0x070D)
|
#define TSDB_CODE_QRY_SYS_ERROR TAOS_DEF_ERROR_CODE(0, 0x070D)
|
||||||
#define TSDB_CODE_QRY_INVALID_TIME_CONDITION TAOS_DEF_ERROR_CODE(0, 0x070E)
|
#define TSDB_CODE_QRY_INVALID_TIME_CONDITION TAOS_DEF_ERROR_CODE(0, 0x070E)
|
||||||
#define TSDB_CODE_QRY_INVALID_INPUT TAOS_DEF_ERROR_CODE(0, 0x070F)
|
#define TSDB_CODE_QRY_INVALID_INPUT TAOS_DEF_ERROR_CODE(0, 0x070F)
|
||||||
|
// #define TSDB_CODE_QRY_INVALID_SCHEMA_VERSION TAOS_DEF_ERROR_CODE(0, 0x0710) // 2.x
|
||||||
|
// #define TSDB_CODE_QRY_RESULT_TOO_LARGE TAOS_DEF_ERROR_CODE(0, 0x0711) // 2.x
|
||||||
#define TSDB_CODE_QRY_SCH_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0720)
|
#define TSDB_CODE_QRY_SCH_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0720)
|
||||||
#define TSDB_CODE_QRY_TASK_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0721)
|
#define TSDB_CODE_QRY_TASK_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0721)
|
||||||
#define TSDB_CODE_QRY_TASK_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0722)
|
#define TSDB_CODE_QRY_TASK_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0722)
|
||||||
|
|
@ -426,7 +486,17 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_GRANT_TABLE_LIMITED TAOS_DEF_ERROR_CODE(0, 0x080D)
|
#define TSDB_CODE_GRANT_TABLE_LIMITED TAOS_DEF_ERROR_CODE(0, 0x080D)
|
||||||
|
|
||||||
// sync
|
// sync
|
||||||
|
// #define TSDB_CODE_SYN_INVALID_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0900) // 2.x
|
||||||
|
// #define TSDB_CODE_SYN_NOT_ENABLED TAOS_DEF_ERROR_CODE(0, 0x0901) // 2.x
|
||||||
|
// #define TSDB_CODE_SYN_INVALID_VERSION TAOS_DEF_ERROR_CODE(0, 0x0902) // 2.x
|
||||||
#define TSDB_CODE_SYN_TIMEOUT TAOS_DEF_ERROR_CODE(0, 0x0903)
|
#define TSDB_CODE_SYN_TIMEOUT TAOS_DEF_ERROR_CODE(0, 0x0903)
|
||||||
|
// #define TSDB_CODE_SYN_TOO_MANY_FWDINFO TAOS_DEF_ERROR_CODE(0, 0x0904) // 2.x
|
||||||
|
// #define TSDB_CODE_SYN_MISMATCHED_PROTOCOL TAOS_DEF_ERROR_CODE(0, 0x0905) // 2.x
|
||||||
|
// #define TSDB_CODE_SYN_MISMATCHED_CLUSTERID TAOS_DEF_ERROR_CODE(0, 0x0906) // 2.x
|
||||||
|
// #define TSDB_CODE_SYN_MISMATCHED_SIGNATURE TAOS_DEF_ERROR_CODE(0, 0x0907) // 2.x
|
||||||
|
// #define TSDB_CODE_SYN_INVALID_CHECKSUM TAOS_DEF_ERROR_CODE(0, 0x0908) // 2.x
|
||||||
|
// #define TSDB_CODE_SYN_INVALID_MSGLEN TAOS_DEF_ERROR_CODE(0, 0x0909) // 2.x
|
||||||
|
// #define TSDB_CODE_SYN_INVALID_MSGTYPE TAOS_DEF_ERROR_CODE(0, 0x090A) // 2.x
|
||||||
#define TSDB_CODE_SYN_IS_LEADER TAOS_DEF_ERROR_CODE(0, 0x090B)
|
#define TSDB_CODE_SYN_IS_LEADER TAOS_DEF_ERROR_CODE(0, 0x090B)
|
||||||
#define TSDB_CODE_SYN_NOT_LEADER TAOS_DEF_ERROR_CODE(0, 0x090C)
|
#define TSDB_CODE_SYN_NOT_LEADER TAOS_DEF_ERROR_CODE(0, 0x090C)
|
||||||
#define TSDB_CODE_SYN_ONE_REPLICA TAOS_DEF_ERROR_CODE(0, 0x090D)
|
#define TSDB_CODE_SYN_ONE_REPLICA TAOS_DEF_ERROR_CODE(0, 0x090D)
|
||||||
|
|
@ -443,8 +513,8 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_TQ_INVALID_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0A00)
|
#define TSDB_CODE_TQ_INVALID_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0A00)
|
||||||
#define TSDB_CODE_TQ_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x0A01)
|
#define TSDB_CODE_TQ_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x0A01)
|
||||||
#define TSDB_CODE_TQ_NO_DISK_PERMISSIONS TAOS_DEF_ERROR_CODE(0, 0x0A03)
|
#define TSDB_CODE_TQ_NO_DISK_PERMISSIONS TAOS_DEF_ERROR_CODE(0, 0x0A03)
|
||||||
#define TSDB_CODE_TQ_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0A04)
|
// #define TSDB_CODE_TQ_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0A04)
|
||||||
#define TSDB_CODE_TQ_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0A05)
|
// #define TSDB_CODE_TQ_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0A05)
|
||||||
#define TSDB_CODE_TQ_FILE_ALREADY_EXISTS TAOS_DEF_ERROR_CODE(0, 0x0A06)
|
#define TSDB_CODE_TQ_FILE_ALREADY_EXISTS TAOS_DEF_ERROR_CODE(0, 0x0A06)
|
||||||
#define TSDB_CODE_TQ_FAILED_TO_CREATE_DIR TAOS_DEF_ERROR_CODE(0, 0x0A07)
|
#define TSDB_CODE_TQ_FAILED_TO_CREATE_DIR TAOS_DEF_ERROR_CODE(0, 0x0A07)
|
||||||
#define TSDB_CODE_TQ_META_NO_SUCH_KEY TAOS_DEF_ERROR_CODE(0, 0x0A08)
|
#define TSDB_CODE_TQ_META_NO_SUCH_KEY TAOS_DEF_ERROR_CODE(0, 0x0A08)
|
||||||
|
|
@ -455,16 +525,17 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_TQ_NO_COMMITTED_OFFSET TAOS_DEF_ERROR_CODE(0, 0x0A0D)
|
#define TSDB_CODE_TQ_NO_COMMITTED_OFFSET TAOS_DEF_ERROR_CODE(0, 0x0A0D)
|
||||||
|
|
||||||
// wal
|
// wal
|
||||||
#define TSDB_CODE_WAL_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x1000)
|
// #define TSDB_CODE_WAL_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x1000) // 2.x
|
||||||
#define TSDB_CODE_WAL_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x1001)
|
#define TSDB_CODE_WAL_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x1001)
|
||||||
#define TSDB_CODE_WAL_SIZE_LIMIT TAOS_DEF_ERROR_CODE(0, 0x1002)
|
#define TSDB_CODE_WAL_SIZE_LIMIT TAOS_DEF_ERROR_CODE(0, 0x1002)
|
||||||
#define TSDB_CODE_WAL_INVALID_VER TAOS_DEF_ERROR_CODE(0, 0x1003)
|
#define TSDB_CODE_WAL_INVALID_VER TAOS_DEF_ERROR_CODE(0, 0x1003)
|
||||||
#define TSDB_CODE_WAL_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x1004)
|
// #define TSDB_CODE_WAL_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x1004) // 2.x
|
||||||
#define TSDB_CODE_WAL_LOG_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x1005)
|
#define TSDB_CODE_WAL_LOG_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x1005)
|
||||||
#define TSDB_CODE_WAL_CHKSUM_MISMATCH TAOS_DEF_ERROR_CODE(0, 0x1006)
|
#define TSDB_CODE_WAL_CHKSUM_MISMATCH TAOS_DEF_ERROR_CODE(0, 0x1006)
|
||||||
#define TSDB_CODE_WAL_LOG_INCOMPLETE TAOS_DEF_ERROR_CODE(0, 0x1007)
|
#define TSDB_CODE_WAL_LOG_INCOMPLETE TAOS_DEF_ERROR_CODE(0, 0x1007)
|
||||||
|
|
||||||
// tfs
|
// tfs
|
||||||
|
// #define TSDB_CODE_FS_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x2200) // 2.x
|
||||||
#define TSDB_CODE_FS_INVLD_CFG TAOS_DEF_ERROR_CODE(0, 0x2201)
|
#define TSDB_CODE_FS_INVLD_CFG TAOS_DEF_ERROR_CODE(0, 0x2201)
|
||||||
#define TSDB_CODE_FS_TOO_MANY_MOUNT TAOS_DEF_ERROR_CODE(0, 0x2202)
|
#define TSDB_CODE_FS_TOO_MANY_MOUNT TAOS_DEF_ERROR_CODE(0, 0x2202)
|
||||||
#define TSDB_CODE_FS_DUP_PRIMARY TAOS_DEF_ERROR_CODE(0, 0x2203)
|
#define TSDB_CODE_FS_DUP_PRIMARY TAOS_DEF_ERROR_CODE(0, 0x2203)
|
||||||
|
|
@ -473,7 +544,7 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_FS_FILE_ALREADY_EXISTS TAOS_DEF_ERROR_CODE(0, 0x2206)
|
#define TSDB_CODE_FS_FILE_ALREADY_EXISTS TAOS_DEF_ERROR_CODE(0, 0x2206)
|
||||||
#define TSDB_CODE_FS_INVLD_LEVEL TAOS_DEF_ERROR_CODE(0, 0x2207)
|
#define TSDB_CODE_FS_INVLD_LEVEL TAOS_DEF_ERROR_CODE(0, 0x2207)
|
||||||
#define TSDB_CODE_FS_NO_VALID_DISK TAOS_DEF_ERROR_CODE(0, 0x2208)
|
#define TSDB_CODE_FS_NO_VALID_DISK TAOS_DEF_ERROR_CODE(0, 0x2208)
|
||||||
#define TSDB_CODE_FS_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x220F)
|
// #define TSDB_CODE_FS_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x220F) // 2.x
|
||||||
|
|
||||||
// catalog
|
// catalog
|
||||||
#define TSDB_CODE_CTG_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2400)
|
#define TSDB_CODE_CTG_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2400)
|
||||||
|
|
@ -628,7 +699,7 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_RSMA_INVALID_ENV TAOS_DEF_ERROR_CODE(0, 0x3150)
|
#define TSDB_CODE_RSMA_INVALID_ENV TAOS_DEF_ERROR_CODE(0, 0x3150)
|
||||||
#define TSDB_CODE_RSMA_INVALID_STAT TAOS_DEF_ERROR_CODE(0, 0x3151)
|
#define TSDB_CODE_RSMA_INVALID_STAT TAOS_DEF_ERROR_CODE(0, 0x3151)
|
||||||
#define TSDB_CODE_RSMA_QTASKINFO_CREATE TAOS_DEF_ERROR_CODE(0, 0x3152)
|
#define TSDB_CODE_RSMA_QTASKINFO_CREATE TAOS_DEF_ERROR_CODE(0, 0x3152)
|
||||||
#define TSDB_CODE_RSMA_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x3153)
|
// #define TSDB_CODE_RSMA_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x3153)
|
||||||
#define TSDB_CODE_RSMA_REMOVE_EXISTS TAOS_DEF_ERROR_CODE(0, 0x3154)
|
#define TSDB_CODE_RSMA_REMOVE_EXISTS TAOS_DEF_ERROR_CODE(0, 0x3154)
|
||||||
#define TSDB_CODE_RSMA_FETCH_MSG_MSSED_UP TAOS_DEF_ERROR_CODE(0, 0x3155)
|
#define TSDB_CODE_RSMA_FETCH_MSG_MSSED_UP TAOS_DEF_ERROR_CODE(0, 0x3155)
|
||||||
#define TSDB_CODE_RSMA_EMPTY_INFO TAOS_DEF_ERROR_CODE(0, 0x3156)
|
#define TSDB_CODE_RSMA_EMPTY_INFO TAOS_DEF_ERROR_CODE(0, 0x3156)
|
||||||
|
|
|
||||||
|
|
@ -171,9 +171,9 @@ typedef struct SReqResultInfo {
|
||||||
char** convertBuf;
|
char** convertBuf;
|
||||||
TAOS_ROW row;
|
TAOS_ROW row;
|
||||||
SResultColumn* pCol;
|
SResultColumn* pCol;
|
||||||
uint32_t numOfRows;
|
uint64_t numOfRows; // from int32_t change to int64_t
|
||||||
uint64_t totalRows;
|
uint64_t totalRows;
|
||||||
uint32_t current;
|
uint64_t current;
|
||||||
bool localResultFetched;
|
bool localResultFetched;
|
||||||
bool completed;
|
bool completed;
|
||||||
int32_t precision;
|
int32_t precision;
|
||||||
|
|
|
||||||
|
|
@ -244,14 +244,14 @@ void destroyTscObj(void *pObj) {
|
||||||
void *createTscObj(const char *user, const char *auth, const char *db, int32_t connType, SAppInstInfo *pAppInfo) {
|
void *createTscObj(const char *user, const char *auth, const char *db, int32_t connType, SAppInstInfo *pAppInfo) {
|
||||||
STscObj *pObj = (STscObj *)taosMemoryCalloc(1, sizeof(STscObj));
|
STscObj *pObj = (STscObj *)taosMemoryCalloc(1, sizeof(STscObj));
|
||||||
if (NULL == pObj) {
|
if (NULL == pObj) {
|
||||||
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pObj->pRequests = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
|
pObj->pRequests = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
|
||||||
if (NULL == pObj->pRequests) {
|
if (NULL == pObj->pRequests) {
|
||||||
taosMemoryFree(pObj);
|
taosMemoryFree(pObj);
|
||||||
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -281,7 +281,7 @@ int32_t releaseTscObj(int64_t rid) { return taosReleaseRef(clientConnRefPool, ri
|
||||||
void *createRequest(uint64_t connId, int32_t type, int64_t reqid) {
|
void *createRequest(uint64_t connId, int32_t type, int64_t reqid) {
|
||||||
SRequestObj *pRequest = (SRequestObj *)taosMemoryCalloc(1, sizeof(SRequestObj));
|
SRequestObj *pRequest = (SRequestObj *)taosMemoryCalloc(1, sizeof(SRequestObj));
|
||||||
if (NULL == pRequest) {
|
if (NULL == pRequest) {
|
||||||
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -397,8 +397,8 @@ void taos_init_imp(void) {
|
||||||
deltaToUtcInitOnce();
|
deltaToUtcInitOnce();
|
||||||
|
|
||||||
if (taosCreateLog("taoslog", 10, configDir, NULL, NULL, NULL, NULL, 1) != 0) {
|
if (taosCreateLog("taoslog", 10, configDir, NULL, NULL, NULL, NULL, 1) != 0) {
|
||||||
tscInitRes = -1;
|
// ignore create log failed, only print
|
||||||
return;
|
printf(" WARING: Create taoslog failed. configDir=%s\n", configDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosInitCfg(configDir, NULL, NULL, NULL, NULL, 1) != 0) {
|
if (taosInitCfg(configDir, NULL, NULL, NULL, NULL, 1) != 0) {
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog
|
||||||
} else {
|
} else {
|
||||||
SDBVgInfo *vgInfo = taosMemoryCalloc(1, sizeof(SDBVgInfo));
|
SDBVgInfo *vgInfo = taosMemoryCalloc(1, sizeof(SDBVgInfo));
|
||||||
if (NULL == vgInfo) {
|
if (NULL == vgInfo) {
|
||||||
code = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto _return;
|
goto _return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -82,7 +82,7 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog
|
||||||
if (NULL == vgInfo->vgHash) {
|
if (NULL == vgInfo->vgHash) {
|
||||||
taosMemoryFree(vgInfo);
|
taosMemoryFree(vgInfo);
|
||||||
tscError("hash init[%d] failed", rsp->vgNum);
|
tscError("hash init[%d] failed", rsp->vgNum);
|
||||||
code = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto _return;
|
goto _return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,7 +92,7 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog
|
||||||
tscError("hash push failed, errno:%d", errno);
|
tscError("hash push failed, errno:%d", errno);
|
||||||
taosHashCleanup(vgInfo->vgHash);
|
taosHashCleanup(vgInfo->vgHash);
|
||||||
taosMemoryFree(vgInfo);
|
taosMemoryFree(vgInfo);
|
||||||
code = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto _return;
|
goto _return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -366,7 +366,7 @@ int32_t hbBuildQueryDesc(SQueryHbReqBasic *hbBasic, STscObj *pObj) {
|
||||||
desc.subDesc = taosArrayInit(desc.subPlanNum, sizeof(SQuerySubDesc));
|
desc.subDesc = taosArrayInit(desc.subPlanNum, sizeof(SQuerySubDesc));
|
||||||
if (NULL == desc.subDesc) {
|
if (NULL == desc.subDesc) {
|
||||||
releaseRequest(*rid);
|
releaseRequest(*rid);
|
||||||
return TSDB_CODE_QRY_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = schedulerGetTasksStatus(pRequest->body.queryJob, desc.subDesc);
|
code = schedulerGetTasksStatus(pRequest->body.queryJob, desc.subDesc);
|
||||||
|
|
@ -394,14 +394,14 @@ int32_t hbGetQueryBasicInfo(SClientHbKey *connKey, SClientHbReq *req) {
|
||||||
STscObj *pTscObj = (STscObj *)acquireTscObj(connKey->tscRid);
|
STscObj *pTscObj = (STscObj *)acquireTscObj(connKey->tscRid);
|
||||||
if (NULL == pTscObj) {
|
if (NULL == pTscObj) {
|
||||||
tscWarn("tscObj rid %" PRIx64 " not exist", connKey->tscRid);
|
tscWarn("tscObj rid %" PRIx64 " not exist", connKey->tscRid);
|
||||||
return TSDB_CODE_QRY_APP_ERROR;
|
return TSDB_CODE_APP_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
SQueryHbReqBasic *hbBasic = (SQueryHbReqBasic *)taosMemoryCalloc(1, sizeof(SQueryHbReqBasic));
|
SQueryHbReqBasic *hbBasic = (SQueryHbReqBasic *)taosMemoryCalloc(1, sizeof(SQueryHbReqBasic));
|
||||||
if (NULL == hbBasic) {
|
if (NULL == hbBasic) {
|
||||||
tscError("calloc %d failed", (int32_t)sizeof(SQueryHbReqBasic));
|
tscError("calloc %d failed", (int32_t)sizeof(SQueryHbReqBasic));
|
||||||
releaseTscObj(connKey->tscRid);
|
releaseTscObj(connKey->tscRid);
|
||||||
return TSDB_CODE_QRY_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
hbBasic->connId = pTscObj->connId;
|
hbBasic->connId = pTscObj->connId;
|
||||||
|
|
@ -419,7 +419,7 @@ int32_t hbGetQueryBasicInfo(SClientHbKey *connKey, SClientHbReq *req) {
|
||||||
tscWarn("taosArrayInit %d queryDesc failed", numOfQueries);
|
tscWarn("taosArrayInit %d queryDesc failed", numOfQueries);
|
||||||
releaseTscObj(connKey->tscRid);
|
releaseTscObj(connKey->tscRid);
|
||||||
taosMemoryFree(hbBasic);
|
taosMemoryFree(hbBasic);
|
||||||
return TSDB_CODE_QRY_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t code = hbBuildQueryDesc(hbBasic, pTscObj);
|
int32_t code = hbBuildQueryDesc(hbBasic, pTscObj);
|
||||||
|
|
@ -613,7 +613,7 @@ static FORCE_INLINE void hbMgrInitHandle() {
|
||||||
SClientHbBatchReq *hbGatherAllInfo(SAppHbMgr *pAppHbMgr) {
|
SClientHbBatchReq *hbGatherAllInfo(SAppHbMgr *pAppHbMgr) {
|
||||||
SClientHbBatchReq *pBatchReq = taosMemoryCalloc(1, sizeof(SClientHbBatchReq));
|
SClientHbBatchReq *pBatchReq = taosMemoryCalloc(1, sizeof(SClientHbBatchReq));
|
||||||
if (pBatchReq == NULL) {
|
if (pBatchReq == NULL) {
|
||||||
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
int32_t connKeyCnt = atomic_load_32(&pAppHbMgr->connKeyCnt);
|
int32_t connKeyCnt = atomic_load_32(&pAppHbMgr->connKeyCnt);
|
||||||
|
|
@ -737,7 +737,7 @@ static void *hbThreadFunc(void *param) {
|
||||||
int tlen = tSerializeSClientHbBatchReq(NULL, 0, pReq);
|
int tlen = tSerializeSClientHbBatchReq(NULL, 0, pReq);
|
||||||
void *buf = taosMemoryMalloc(tlen);
|
void *buf = taosMemoryMalloc(tlen);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
tFreeClientHbBatchReq(pReq);
|
tFreeClientHbBatchReq(pReq);
|
||||||
// hbClearReqInfo(pAppHbMgr);
|
// hbClearReqInfo(pAppHbMgr);
|
||||||
taosArrayPush(mgr, &pAppHbMgr);
|
taosArrayPush(mgr, &pAppHbMgr);
|
||||||
|
|
@ -748,7 +748,7 @@ static void *hbThreadFunc(void *param) {
|
||||||
SMsgSendInfo *pInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
|
SMsgSendInfo *pInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
|
||||||
|
|
||||||
if (pInfo == NULL) {
|
if (pInfo == NULL) {
|
||||||
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
tFreeClientHbBatchReq(pReq);
|
tFreeClientHbBatchReq(pReq);
|
||||||
// hbClearReqInfo(pAppHbMgr);
|
// hbClearReqInfo(pAppHbMgr);
|
||||||
taosMemoryFree(buf);
|
taosMemoryFree(buf);
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,7 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param,
|
||||||
tscError("0x%" PRIx64 " failed to prepare sql string buffer, %s", (*pRequest)->self, sql);
|
tscError("0x%" PRIx64 " failed to prepare sql string buffer, %s", (*pRequest)->self, sql);
|
||||||
destroyRequest(*pRequest);
|
destroyRequest(*pRequest);
|
||||||
*pRequest = NULL;
|
*pRequest = NULL;
|
||||||
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
strntolower((*pRequest)->sqlstr, sql, (int32_t)sqlLen);
|
strntolower((*pRequest)->sqlstr, sql, (int32_t)sqlLen);
|
||||||
|
|
@ -179,7 +179,7 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param,
|
||||||
if (pParam == NULL) {
|
if (pParam == NULL) {
|
||||||
destroyRequest(*pRequest);
|
destroyRequest(*pRequest);
|
||||||
*pRequest = NULL;
|
*pRequest = NULL;
|
||||||
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
tsem_init(&pParam->sem, 0, 0);
|
tsem_init(&pParam->sem, 0, 0);
|
||||||
|
|
@ -198,7 +198,7 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param,
|
||||||
taosMemoryFree(param);
|
taosMemoryFree(param);
|
||||||
destroyRequest(*pRequest);
|
destroyRequest(*pRequest);
|
||||||
*pRequest = NULL;
|
*pRequest = NULL;
|
||||||
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*pRequest)->allocatorRefId = -1;
|
(*pRequest)->allocatorRefId = -1;
|
||||||
|
|
@ -209,7 +209,7 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param,
|
||||||
(*pRequest)->self, (*pRequest)->requestId, pTscObj->id, sql);
|
(*pRequest)->self, (*pRequest)->requestId, pTscObj->id, sql);
|
||||||
destroyRequest(*pRequest);
|
destroyRequest(*pRequest);
|
||||||
*pRequest = NULL;
|
*pRequest = NULL;
|
||||||
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -317,7 +317,7 @@ void asyncExecLocalCmd(SRequestObj* pRequest, SQuery* pQuery) {
|
||||||
tscError("0x%" PRIx64 " fetch results failed, code:%s, reqId:0x%" PRIx64, pRequest->self, tstrerror(code),
|
tscError("0x%" PRIx64 " fetch results failed, code:%s, reqId:0x%" PRIx64, pRequest->self, tstrerror(code),
|
||||||
pRequest->requestId);
|
pRequest->requestId);
|
||||||
} else {
|
} else {
|
||||||
tscDebug("0x%" PRIx64 " fetch results, numOfRows:%d total Rows:%" PRId64 ", complete:%d, reqId:0x%" PRIx64,
|
tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d, reqId:0x%" PRIx64,
|
||||||
pRequest->self, pResultInfo->numOfRows, pResultInfo->totalRows, pResultInfo->completed,
|
pRequest->self, pResultInfo->numOfRows, pResultInfo->totalRows, pResultInfo->completed,
|
||||||
pRequest->requestId);
|
pRequest->requestId);
|
||||||
}
|
}
|
||||||
|
|
@ -609,7 +609,7 @@ int32_t buildAsyncExecNodeList(SRequestObj* pRequest, SArray** pNodeList, SArray
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
tscError("unknown query policy: %d", tsQueryPolicy);
|
tscError("unknown query policy: %d", tsQueryPolicy);
|
||||||
return TSDB_CODE_TSC_APP_ERROR;
|
return TSDB_CODE_APP_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
taosArrayDestroy(pDbVgList);
|
taosArrayDestroy(pDbVgList);
|
||||||
|
|
@ -670,7 +670,7 @@ int32_t buildSyncExecNodeList(SRequestObj* pRequest, SArray** pNodeList, SArray*
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
tscError("unknown query policy: %d", tsQueryPolicy);
|
tscError("unknown query policy: %d", tsQueryPolicy);
|
||||||
return TSDB_CODE_TSC_APP_ERROR;
|
return TSDB_CODE_APP_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
_return:
|
_return:
|
||||||
|
|
@ -1111,7 +1111,7 @@ int32_t refreshMeta(STscObj* pTscObj, SRequestObj* pRequest) {
|
||||||
int32_t tblNum = taosArrayGetSize(pRequest->tableList);
|
int32_t tblNum = taosArrayGetSize(pRequest->tableList);
|
||||||
|
|
||||||
if (dbNum <= 0 && tblNum <= 0) {
|
if (dbNum <= 0 && tblNum <= 0) {
|
||||||
return TSDB_CODE_QRY_APP_ERROR;
|
return TSDB_CODE_APP_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = catalogGetHandle(pTscObj->pAppInfo->clusterId, &pCatalog);
|
code = catalogGetHandle(pTscObj->pAppInfo->clusterId, &pCatalog);
|
||||||
|
|
@ -1206,7 +1206,7 @@ STscObj* taosConnectImpl(const char* user, const char* auth, const char* db, __t
|
||||||
SAppInstInfo* pAppInfo, int connType) {
|
SAppInstInfo* pAppInfo, int connType) {
|
||||||
STscObj* pTscObj = createTscObj(user, auth, db, connType, pAppInfo);
|
STscObj* pTscObj = createTscObj(user, auth, db, connType, pAppInfo);
|
||||||
if (NULL == pTscObj) {
|
if (NULL == pTscObj) {
|
||||||
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return pTscObj;
|
return pTscObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1243,7 +1243,7 @@ STscObj* taosConnectImpl(const char* user, const char* auth, const char* db, __t
|
||||||
static SMsgSendInfo* buildConnectMsg(SRequestObj* pRequest) {
|
static SMsgSendInfo* buildConnectMsg(SRequestObj* pRequest) {
|
||||||
SMsgSendInfo* pMsgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
|
SMsgSendInfo* pMsgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
|
||||||
if (pMsgSendInfo == NULL) {
|
if (pMsgSendInfo == NULL) {
|
||||||
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1502,7 +1502,7 @@ void* doFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
tscDebug("0x%" PRIx64 " fetch results, numOfRows:%d total Rows:%" PRId64 ", complete:%d, reqId:0x%" PRIx64,
|
tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d, reqId:0x%" PRIx64,
|
||||||
pRequest->self, pResInfo->numOfRows, pResInfo->totalRows, pResInfo->completed, pRequest->requestId);
|
pRequest->self, pResInfo->numOfRows, pResInfo->totalRows, pResInfo->completed, pRequest->requestId);
|
||||||
|
|
||||||
STscObj* pTscObj = pRequest->pTscObj;
|
STscObj* pTscObj = pRequest->pTscObj;
|
||||||
|
|
@ -1916,7 +1916,7 @@ int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableR
|
||||||
|
|
||||||
pResultInfo->pRspMsg = (const char*)pRsp;
|
pResultInfo->pRspMsg = (const char*)pRsp;
|
||||||
pResultInfo->pData = (void*)pRsp->data;
|
pResultInfo->pData = (void*)pRsp->data;
|
||||||
pResultInfo->numOfRows = htonl(pRsp->numOfRows);
|
pResultInfo->numOfRows = htobe64(pRsp->numOfRows);
|
||||||
pResultInfo->current = 0;
|
pResultInfo->current = 0;
|
||||||
pResultInfo->completed = (pRsp->completed == 1);
|
pResultInfo->completed = (pRsp->completed == 1);
|
||||||
pResultInfo->payloadLen = htonl(pRsp->compLen);
|
pResultInfo->payloadLen = htonl(pRsp->compLen);
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ int32_t check_for_params(jobject jobj, jlong conn, jlong res) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((TAOS_RES *)res == NULL) {
|
if ((TAOS_RES *)res == NULL) {
|
||||||
jniError("jobj:%p, conn:%p, res is null", jobj, (TAOS *)conn);
|
jniError("jobj:%p, conn:%p, param res is null", jobj, (TAOS *)conn);
|
||||||
return JNI_RESULT_SET_NULL;
|
return JNI_RESULT_SET_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -393,9 +393,8 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_freeResultSetImp(
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
taos_free_result((void *)res);
|
|
||||||
jniDebug("jobj:%p, conn:%p, free resultset:%p", jobj, (TAOS *)con, (void *)res);
|
jniDebug("jobj:%p, conn:%p, free resultset:%p", jobj, (TAOS *)con, (void *)res);
|
||||||
|
taos_free_result((void *)res);
|
||||||
return JNI_SUCCESS;
|
return JNI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -489,7 +488,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_fetchRowImp(JNIEn
|
||||||
numOfFields);
|
numOfFields);
|
||||||
return JNI_FETCH_END;
|
return JNI_FETCH_END;
|
||||||
} else {
|
} else {
|
||||||
jniDebug("jobj:%p, conn:%p, interrupted query", jobj, tscon);
|
jniDebug("jobj:%p, conn:%p, interrupted query. fetch row error code: %d, msg:%s", jobj, tscon, code, taos_errstr(result));
|
||||||
return JNI_RESULT_SET_NULL;
|
return JNI_RESULT_SET_NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -584,7 +583,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_fetchBlockImp(JNI
|
||||||
jniDebug("jobj:%p, conn:%p, resultset:%p, no data to retrieve", jobj, tscon, (void *)res);
|
jniDebug("jobj:%p, conn:%p, resultset:%p, no data to retrieve", jobj, tscon, (void *)res);
|
||||||
return JNI_FETCH_END;
|
return JNI_FETCH_END;
|
||||||
} else {
|
} else {
|
||||||
jniError("jobj:%p, conn:%p, query interrupted", jobj, tscon);
|
jniError("jobj:%p, conn:%p, query interrupted. fetch block error code:%d, msg:%s", jobj, tscon, error_code, taos_errstr(tres));
|
||||||
return JNI_RESULT_SET_NULL;
|
return JNI_RESULT_SET_NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,6 @@ void taos_close(TAOS *taos) {
|
||||||
|
|
||||||
int taos_errno(TAOS_RES *res) {
|
int taos_errno(TAOS_RES *res) {
|
||||||
if (res == NULL || TD_RES_TMQ_META(res)) {
|
if (res == NULL || TD_RES_TMQ_META(res)) {
|
||||||
if (terrno == TSDB_CODE_RPC_REDIRECT) terrno = TSDB_CODE_QRY_NOT_READY;
|
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -154,12 +153,11 @@ int taos_errno(TAOS_RES *res) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ((SRequestObj *)res)->code == TSDB_CODE_RPC_REDIRECT ? TSDB_CODE_QRY_NOT_READY : ((SRequestObj *)res)->code;
|
return ((SRequestObj *)res)->code;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *taos_errstr(TAOS_RES *res) {
|
const char *taos_errstr(TAOS_RES *res) {
|
||||||
if (res == NULL || TD_RES_TMQ_META(res)) {
|
if (res == NULL || TD_RES_TMQ_META(res)) {
|
||||||
if (terrno == TSDB_CODE_RPC_REDIRECT) terrno = TSDB_CODE_QRY_NOT_READY;
|
|
||||||
return (const char *)tstrerror(terrno);
|
return (const char *)tstrerror(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -171,8 +169,7 @@ const char *taos_errstr(TAOS_RES *res) {
|
||||||
if (NULL != pRequest->msgBuf && (strlen(pRequest->msgBuf) > 0 || pRequest->code == TSDB_CODE_RPC_FQDN_ERROR)) {
|
if (NULL != pRequest->msgBuf && (strlen(pRequest->msgBuf) > 0 || pRequest->code == TSDB_CODE_RPC_FQDN_ERROR)) {
|
||||||
return pRequest->msgBuf;
|
return pRequest->msgBuf;
|
||||||
} else {
|
} else {
|
||||||
return pRequest->code == TSDB_CODE_RPC_REDIRECT ? (const char *)tstrerror(TSDB_CODE_QRY_NOT_READY)
|
return (const char *)tstrerror(pRequest->code);
|
||||||
: (const char *)tstrerror(pRequest->code);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -438,11 +435,23 @@ const char *taos_data_type(int type) {
|
||||||
|
|
||||||
const char *taos_get_client_info() { return version; }
|
const char *taos_get_client_info() { return version; }
|
||||||
|
|
||||||
|
// return int32_t
|
||||||
int taos_affected_rows(TAOS_RES *res) {
|
int taos_affected_rows(TAOS_RES *res) {
|
||||||
if (res == NULL || TD_RES_TMQ(res) || TD_RES_TMQ_META(res) || TD_RES_TMQ_METADATA(res)) {
|
if (res == NULL || TD_RES_TMQ(res) || TD_RES_TMQ_META(res) || TD_RES_TMQ_METADATA(res)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SRequestObj *pRequest = (SRequestObj *)res;
|
||||||
|
SReqResultInfo *pResInfo = &pRequest->body.resInfo;
|
||||||
|
return (int)pResInfo->numOfRows;
|
||||||
|
}
|
||||||
|
|
||||||
|
// return int64_t
|
||||||
|
int64_t taos_affected_rows64(TAOS_RES *res) {
|
||||||
|
if (res == NULL || TD_RES_TMQ(res) || TD_RES_TMQ_META(res) || TD_RES_TMQ_METADATA(res)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
SRequestObj *pRequest = (SRequestObj *)res;
|
SRequestObj *pRequest = (SRequestObj *)res;
|
||||||
SReqResultInfo *pResInfo = &pRequest->body.resInfo;
|
SReqResultInfo *pResInfo = &pRequest->body.resInfo;
|
||||||
return pResInfo->numOfRows;
|
return pResInfo->numOfRows;
|
||||||
|
|
@ -959,7 +968,7 @@ static void fetchCallback(void *pResult, void *param, int32_t code) {
|
||||||
tscError("0x%" PRIx64 " fetch results failed, code:%s, reqId:0x%" PRIx64, pRequest->self, tstrerror(code),
|
tscError("0x%" PRIx64 " fetch results failed, code:%s, reqId:0x%" PRIx64, pRequest->self, tstrerror(code),
|
||||||
pRequest->requestId);
|
pRequest->requestId);
|
||||||
} else {
|
} else {
|
||||||
tscDebug("0x%" PRIx64 " fetch results, numOfRows:%d total Rows:%" PRId64 ", complete:%d, reqId:0x%" PRIx64,
|
tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d, reqId:0x%" PRIx64,
|
||||||
pRequest->self, pResultInfo->numOfRows, pResultInfo->totalRows, pResultInfo->completed,
|
pRequest->self, pResultInfo->numOfRows, pResultInfo->totalRows, pResultInfo->completed,
|
||||||
pRequest->requestId);
|
pRequest->requestId);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
||||||
|
|
||||||
/*assert(connectRsp.epSet.numOfEps > 0);*/
|
/*assert(connectRsp.epSet.numOfEps > 0);*/
|
||||||
if (connectRsp.epSet.numOfEps == 0) {
|
if (connectRsp.epSet.numOfEps == 0) {
|
||||||
setErrno(pRequest, TSDB_CODE_MND_APP_ERROR);
|
setErrno(pRequest, TSDB_CODE_APP_ERROR);
|
||||||
tsem_post(&pRequest->body.rspSem);
|
tsem_post(&pRequest->body.rspSem);
|
||||||
goto End;
|
goto End;
|
||||||
}
|
}
|
||||||
|
|
@ -450,7 +450,7 @@ static int32_t buildShowVariablesRsp(SArray* pVars, SRetrieveTableRsp** pRsp) {
|
||||||
(*pRsp)->precision = 0;
|
(*pRsp)->precision = 0;
|
||||||
(*pRsp)->compressed = 0;
|
(*pRsp)->compressed = 0;
|
||||||
(*pRsp)->compLen = 0;
|
(*pRsp)->compLen = 0;
|
||||||
(*pRsp)->numOfRows = htonl(pBlock->info.rows);
|
(*pRsp)->numOfRows = htobe64((int64_t)pBlock->info.rows);
|
||||||
(*pRsp)->numOfCols = htonl(SHOW_VARIABLES_RESULT_COLS);
|
(*pRsp)->numOfCols = htonl(SHOW_VARIABLES_RESULT_COLS);
|
||||||
|
|
||||||
int32_t len = blockEncode(pBlock, (*pRsp)->data, SHOW_VARIABLES_RESULT_COLS);
|
int32_t len = blockEncode(pBlock, (*pRsp)->data, SHOW_VARIABLES_RESULT_COLS);
|
||||||
|
|
|
||||||
|
|
@ -1388,7 +1388,7 @@ int taos_write_raw_block_with_fields(TAOS* taos, int rows, char* pData, const ch
|
||||||
|
|
||||||
SVgDataBlocks* dst = taosMemoryCalloc(1, sizeof(SVgDataBlocks));
|
SVgDataBlocks* dst = taosMemoryCalloc(1, sizeof(SVgDataBlocks));
|
||||||
if (NULL == dst) {
|
if (NULL == dst) {
|
||||||
code = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
dst->vg = vgData;
|
dst->vg = vgData;
|
||||||
|
|
@ -1579,7 +1579,7 @@ int taos_write_raw_block(TAOS* taos, int rows, char* pData, const char* tbname)
|
||||||
|
|
||||||
SVgDataBlocks* dst = taosMemoryCalloc(1, sizeof(SVgDataBlocks));
|
SVgDataBlocks* dst = taosMemoryCalloc(1, sizeof(SVgDataBlocks));
|
||||||
if (NULL == dst) {
|
if (NULL == dst) {
|
||||||
code = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
dst->vg = vgData;
|
dst->vg = vgData;
|
||||||
|
|
@ -1726,7 +1726,7 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) {
|
||||||
int32_t totalLen = ((SSubmitReq*)(vgData.data))->length + submitLen;
|
int32_t totalLen = ((SSubmitReq*)(vgData.data))->length + submitLen;
|
||||||
void* tmp = taosMemoryRealloc(vgData.data, totalLen);
|
void* tmp = taosMemoryRealloc(vgData.data, totalLen);
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
code = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
vgData.data = tmp;
|
vgData.data = tmp;
|
||||||
|
|
@ -1737,7 +1737,7 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) {
|
||||||
int32_t totalLen = sizeof(SSubmitReq) + submitLen;
|
int32_t totalLen = sizeof(SSubmitReq) + submitLen;
|
||||||
void* tmp = taosMemoryCalloc(1, totalLen);
|
void* tmp = taosMemoryCalloc(1, totalLen);
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
code = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
vgData.data = tmp;
|
vgData.data = tmp;
|
||||||
|
|
@ -1840,7 +1840,7 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) {
|
||||||
while (vData) {
|
while (vData) {
|
||||||
SVgDataBlocks* dst = taosMemoryCalloc(1, sizeof(SVgDataBlocks));
|
SVgDataBlocks* dst = taosMemoryCalloc(1, sizeof(SVgDataBlocks));
|
||||||
if (NULL == dst) {
|
if (NULL == dst) {
|
||||||
code = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
dst->vg = vData->vg;
|
dst->vg = vData->vg;
|
||||||
|
|
@ -2029,7 +2029,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
|
||||||
int32_t totalLen = ((SSubmitReq*)(vgData.data))->length + submitLen;
|
int32_t totalLen = ((SSubmitReq*)(vgData.data))->length + submitLen;
|
||||||
void* tmp = taosMemoryRealloc(vgData.data, totalLen);
|
void* tmp = taosMemoryRealloc(vgData.data, totalLen);
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
code = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
vgData.data = tmp;
|
vgData.data = tmp;
|
||||||
|
|
@ -2040,7 +2040,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
|
||||||
int32_t totalLen = sizeof(SSubmitReq) + submitLen;
|
int32_t totalLen = sizeof(SSubmitReq) + submitLen;
|
||||||
void* tmp = taosMemoryCalloc(1, totalLen);
|
void* tmp = taosMemoryCalloc(1, totalLen);
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
code = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
vgData.data = tmp;
|
vgData.data = tmp;
|
||||||
|
|
@ -2146,7 +2146,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
|
||||||
while (vData) {
|
while (vData) {
|
||||||
SVgDataBlocks* dst = taosMemoryCalloc(1, sizeof(SVgDataBlocks));
|
SVgDataBlocks* dst = taosMemoryCalloc(1, sizeof(SVgDataBlocks));
|
||||||
if (NULL == dst) {
|
if (NULL == dst) {
|
||||||
code = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
dst->vg = vData->vg;
|
dst->vg = vData->vg;
|
||||||
|
|
|
||||||
|
|
@ -1416,7 +1416,7 @@ static int32_t smlDealCols(SSmlTableInfo *oneTable, bool dataFormat, SArray *col
|
||||||
SHashObj *kvHash = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK);
|
SHashObj *kvHash = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK);
|
||||||
if (!kvHash) {
|
if (!kvHash) {
|
||||||
uError("SML:smlDealCols failed to allocate memory");
|
uError("SML:smlDealCols failed to allocate memory");
|
||||||
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < taosArrayGetSize(cols); i++) {
|
for (size_t i = 0; i < taosArrayGetSize(cols); i++) {
|
||||||
SSmlKv *kv = (SSmlKv *)taosArrayGetP(cols, i);
|
SSmlKv *kv = (SSmlKv *)taosArrayGetP(cols, i);
|
||||||
|
|
@ -2076,7 +2076,7 @@ static int32_t smlParseInfluxLine(SSmlHandle *info, const char *sql, const int l
|
||||||
cols = taosArrayInit(16, POINTER_BYTES);
|
cols = taosArrayInit(16, POINTER_BYTES);
|
||||||
if (cols == NULL) {
|
if (cols == NULL) {
|
||||||
uError("SML:0x%" PRIx64 " smlParseInfluxLine failed to allocate memory", info->id);
|
uError("SML:0x%" PRIx64 " smlParseInfluxLine failed to allocate memory", info->id);
|
||||||
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
} else { // if dataFormat is false, cols do not need to save data, there is another new memory to save data
|
} else { // if dataFormat is false, cols do not need to save data, there is another new memory to save data
|
||||||
cols = info->colsContainer;
|
cols = info->colsContainer;
|
||||||
|
|
@ -2105,7 +2105,7 @@ static int32_t smlParseInfluxLine(SSmlHandle *info, const char *sql, const int l
|
||||||
if (!tinfo) {
|
if (!tinfo) {
|
||||||
smlDestroyCols(cols);
|
smlDestroyCols(cols);
|
||||||
if (info->dataFormat) taosArrayDestroy(cols);
|
if (info->dataFormat) taosArrayDestroy(cols);
|
||||||
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
taosHashPut(info->childTables, elements.measure, elements.measureTagsLen, &tinfo, POINTER_BYTES);
|
taosHashPut(info->childTables, elements.measure, elements.measureTagsLen, &tinfo, POINTER_BYTES);
|
||||||
oneTable = &tinfo;
|
oneTable = &tinfo;
|
||||||
|
|
@ -2176,13 +2176,13 @@ static int32_t smlParseTelnetLine(SSmlHandle *info, void *data, const int len) {
|
||||||
int ret = TSDB_CODE_SUCCESS;
|
int ret = TSDB_CODE_SUCCESS;
|
||||||
SSmlTableInfo *tinfo = smlBuildTableInfo();
|
SSmlTableInfo *tinfo = smlBuildTableInfo();
|
||||||
if (!tinfo) {
|
if (!tinfo) {
|
||||||
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
SArray *cols = taosArrayInit(16, POINTER_BYTES);
|
SArray *cols = taosArrayInit(16, POINTER_BYTES);
|
||||||
if (cols == NULL) {
|
if (cols == NULL) {
|
||||||
uError("SML:0x%" PRIx64 " smlParseTelnetLine failed to allocate memory", info->id);
|
uError("SML:0x%" PRIx64 " smlParseTelnetLine failed to allocate memory", info->id);
|
||||||
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->protocol == TSDB_SML_TELNET_PROTOCOL) {
|
if (info->protocol == TSDB_SML_TELNET_PROTOCOL) {
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ int32_t stmtSwitchStatus(STscStmt* pStmt, STMT_STATUS newStatus) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
code = TSDB_CODE_TSC_APP_ERROR;
|
code = TSDB_CODE_APP_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -118,7 +118,7 @@ int32_t stmtBackupQueryFields(STscStmt* pStmt) {
|
||||||
pRes->fields = taosMemoryMalloc(size);
|
pRes->fields = taosMemoryMalloc(size);
|
||||||
pRes->userFields = taosMemoryMalloc(size);
|
pRes->userFields = taosMemoryMalloc(size);
|
||||||
if (NULL == pRes->fields || NULL == pRes->userFields) {
|
if (NULL == pRes->fields || NULL == pRes->userFields) {
|
||||||
STMT_ERR_RET(TSDB_CODE_TSC_OUT_OF_MEMORY);
|
STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||||
}
|
}
|
||||||
memcpy(pRes->fields, pStmt->exec.pRequest->body.resInfo.fields, size);
|
memcpy(pRes->fields, pStmt->exec.pRequest->body.resInfo.fields, size);
|
||||||
memcpy(pRes->userFields, pStmt->exec.pRequest->body.resInfo.userFields, size);
|
memcpy(pRes->userFields, pStmt->exec.pRequest->body.resInfo.userFields, size);
|
||||||
|
|
@ -136,7 +136,7 @@ int32_t stmtRestoreQueryFields(STscStmt* pStmt) {
|
||||||
if (NULL == pStmt->exec.pRequest->body.resInfo.fields) {
|
if (NULL == pStmt->exec.pRequest->body.resInfo.fields) {
|
||||||
pStmt->exec.pRequest->body.resInfo.fields = taosMemoryMalloc(size);
|
pStmt->exec.pRequest->body.resInfo.fields = taosMemoryMalloc(size);
|
||||||
if (NULL == pStmt->exec.pRequest->body.resInfo.fields) {
|
if (NULL == pStmt->exec.pRequest->body.resInfo.fields) {
|
||||||
STMT_ERR_RET(TSDB_CODE_TSC_OUT_OF_MEMORY);
|
STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||||
}
|
}
|
||||||
memcpy(pStmt->exec.pRequest->body.resInfo.fields, pRes->fields, size);
|
memcpy(pStmt->exec.pRequest->body.resInfo.fields, pRes->fields, size);
|
||||||
}
|
}
|
||||||
|
|
@ -144,7 +144,7 @@ int32_t stmtRestoreQueryFields(STscStmt* pStmt) {
|
||||||
if (NULL == pStmt->exec.pRequest->body.resInfo.userFields) {
|
if (NULL == pStmt->exec.pRequest->body.resInfo.userFields) {
|
||||||
pStmt->exec.pRequest->body.resInfo.userFields = taosMemoryMalloc(size);
|
pStmt->exec.pRequest->body.resInfo.userFields = taosMemoryMalloc(size);
|
||||||
if (NULL == pStmt->exec.pRequest->body.resInfo.userFields) {
|
if (NULL == pStmt->exec.pRequest->body.resInfo.userFields) {
|
||||||
STMT_ERR_RET(TSDB_CODE_TSC_OUT_OF_MEMORY);
|
STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||||
}
|
}
|
||||||
memcpy(pStmt->exec.pRequest->body.resInfo.userFields, pRes->userFields, size);
|
memcpy(pStmt->exec.pRequest->body.resInfo.userFields, pRes->userFields, size);
|
||||||
}
|
}
|
||||||
|
|
@ -152,9 +152,10 @@ int32_t stmtRestoreQueryFields(STscStmt* pStmt) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t stmtUpdateBindInfo(TAOS_STMT* stmt, STableMeta* pTableMeta, void* tags, SName* tbName, const char* sTableName, bool autoCreateTbl) {
|
int32_t stmtUpdateBindInfo(TAOS_STMT* stmt, STableMeta* pTableMeta, void* tags, SName* tbName, const char* sTableName,
|
||||||
|
bool autoCreateTbl) {
|
||||||
STscStmt* pStmt = (STscStmt*)stmt;
|
STscStmt* pStmt = (STscStmt*)stmt;
|
||||||
char tbFName[TSDB_TABLE_FNAME_LEN];
|
char tbFName[TSDB_TABLE_FNAME_LEN];
|
||||||
tNameExtractFullName(tbName, tbFName);
|
tNameExtractFullName(tbName, tbFName);
|
||||||
|
|
||||||
memcpy(&pStmt->bInfo.sname, tbName, sizeof(*tbName));
|
memcpy(&pStmt->bInfo.sname, tbName, sizeof(*tbName));
|
||||||
|
|
@ -354,7 +355,8 @@ int32_t stmtCleanSQLInfo(STscStmt* pStmt) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t stmtRebuildDataBlock(STscStmt* pStmt, STableDataCxt* pDataBlock, STableDataCxt** newBlock, uint64_t uid, uint64_t suid) {
|
int32_t stmtRebuildDataBlock(STscStmt* pStmt, STableDataCxt* pDataBlock, STableDataCxt** newBlock, uint64_t uid,
|
||||||
|
uint64_t suid) {
|
||||||
SEpSet ep = getEpSet_s(&pStmt->taos->pAppInfo->mgmtEp);
|
SEpSet ep = getEpSet_s(&pStmt->taos->pAppInfo->mgmtEp);
|
||||||
SVgroupInfo vgInfo = {0};
|
SVgroupInfo vgInfo = {0};
|
||||||
SRequestConnInfo conn = {.pTrans = pStmt->taos->pAppInfo->pTransporter,
|
SRequestConnInfo conn = {.pTrans = pStmt->taos->pAppInfo->pTransporter,
|
||||||
|
|
@ -377,8 +379,7 @@ int32_t stmtGetFromCache(STscStmt* pStmt) {
|
||||||
pStmt->bInfo.needParse = true;
|
pStmt->bInfo.needParse = true;
|
||||||
pStmt->bInfo.inExecCache = false;
|
pStmt->bInfo.inExecCache = false;
|
||||||
|
|
||||||
STableDataCxt** pCxtInExec =
|
STableDataCxt** pCxtInExec = taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
|
||||||
taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
|
|
||||||
if (pCxtInExec) {
|
if (pCxtInExec) {
|
||||||
pStmt->bInfo.needParse = false;
|
pStmt->bInfo.needParse = false;
|
||||||
pStmt->bInfo.inExecCache = true;
|
pStmt->bInfo.inExecCache = true;
|
||||||
|
|
@ -467,7 +468,7 @@ int32_t stmtGetFromCache(STscStmt* pStmt) {
|
||||||
tscError("table [%s, %" PRIx64 ", %" PRIx64 "] found in exec blockHash, but not in sql blockHash",
|
tscError("table [%s, %" PRIx64 ", %" PRIx64 "] found in exec blockHash, but not in sql blockHash",
|
||||||
pStmt->bInfo.tbFName, uid, cacheUid);
|
pStmt->bInfo.tbFName, uid, cacheUid);
|
||||||
|
|
||||||
STMT_ERR_RET(TSDB_CODE_TSC_APP_ERROR);
|
STMT_ERR_RET(TSDB_CODE_APP_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
pStmt->bInfo.needParse = false;
|
pStmt->bInfo.needParse = false;
|
||||||
|
|
@ -518,7 +519,7 @@ int32_t stmtResetStmt(STscStmt* pStmt) {
|
||||||
|
|
||||||
pStmt->sql.pTableCache = taosHashInit(100, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
pStmt->sql.pTableCache = taosHashInit(100, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
||||||
if (NULL == pStmt->sql.pTableCache) {
|
if (NULL == pStmt->sql.pTableCache) {
|
||||||
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
STMT_ERR_RET(terrno);
|
STMT_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -533,13 +534,13 @@ TAOS_STMT* stmtInit(STscObj* taos, int64_t reqid) {
|
||||||
|
|
||||||
pStmt = taosMemoryCalloc(1, sizeof(STscStmt));
|
pStmt = taosMemoryCalloc(1, sizeof(STscStmt));
|
||||||
if (NULL == pStmt) {
|
if (NULL == pStmt) {
|
||||||
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pStmt->sql.pTableCache = taosHashInit(100, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
pStmt->sql.pTableCache = taosHashInit(100, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
||||||
if (NULL == pStmt->sql.pTableCache) {
|
if (NULL == pStmt->sql.pTableCache) {
|
||||||
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
taosMemoryFree(pStmt);
|
taosMemoryFree(pStmt);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -624,7 +625,7 @@ int stmtSetTbTags(TAOS_STMT* stmt, TAOS_MULTI_BIND* tags) {
|
||||||
(STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
|
(STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
|
||||||
if (NULL == pDataBlock) {
|
if (NULL == pDataBlock) {
|
||||||
tscError("table %s not found in exec blockHash", pStmt->bInfo.tbFName);
|
tscError("table %s not found in exec blockHash", pStmt->bInfo.tbFName);
|
||||||
STMT_ERR_RET(TSDB_CODE_QRY_APP_ERROR);
|
STMT_ERR_RET(TSDB_CODE_APP_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
tscDebug("start to bind stmt tag values");
|
tscDebug("start to bind stmt tag values");
|
||||||
|
|
@ -645,7 +646,7 @@ int stmtFetchTagFields(STscStmt* pStmt, int32_t* fieldNum, TAOS_FIELD_E** fields
|
||||||
(STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
|
(STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
|
||||||
if (NULL == pDataBlock) {
|
if (NULL == pDataBlock) {
|
||||||
tscError("table %s not found in exec blockHash", pStmt->bInfo.tbFName);
|
tscError("table %s not found in exec blockHash", pStmt->bInfo.tbFName);
|
||||||
STMT_ERR_RET(TSDB_CODE_QRY_APP_ERROR);
|
STMT_ERR_RET(TSDB_CODE_APP_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
STMT_ERR_RET(qBuildStmtTagFields(*pDataBlock, pStmt->bInfo.boundTags, fieldNum, fields));
|
STMT_ERR_RET(qBuildStmtTagFields(*pDataBlock, pStmt->bInfo.boundTags, fieldNum, fields));
|
||||||
|
|
@ -663,7 +664,7 @@ int stmtFetchColFields(STscStmt* pStmt, int32_t* fieldNum, TAOS_FIELD_E** fields
|
||||||
(STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
|
(STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
|
||||||
if (NULL == pDataBlock) {
|
if (NULL == pDataBlock) {
|
||||||
tscError("table %s not found in exec blockHash", pStmt->bInfo.tbFName);
|
tscError("table %s not found in exec blockHash", pStmt->bInfo.tbFName);
|
||||||
STMT_ERR_RET(TSDB_CODE_QRY_APP_ERROR);
|
STMT_ERR_RET(TSDB_CODE_APP_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
STMT_ERR_RET(qBuildStmtColFields(*pDataBlock, fieldNum, fields));
|
STMT_ERR_RET(qBuildStmtColFields(*pDataBlock, fieldNum, fields));
|
||||||
|
|
@ -738,7 +739,8 @@ int stmtBindBatch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind, int32_t colIdx) {
|
||||||
if (pStmt->exec.pCurrBlock) {
|
if (pStmt->exec.pCurrBlock) {
|
||||||
pDataBlock = &pStmt->exec.pCurrBlock;
|
pDataBlock = &pStmt->exec.pCurrBlock;
|
||||||
} else {
|
} else {
|
||||||
pDataBlock= (STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
|
pDataBlock =
|
||||||
|
(STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
|
||||||
if (NULL == pDataBlock) {
|
if (NULL == pDataBlock) {
|
||||||
tscError("table %s not found in exec blockHash", pStmt->bInfo.tbFName);
|
tscError("table %s not found in exec blockHash", pStmt->bInfo.tbFName);
|
||||||
STMT_ERR_RET(TSDB_CODE_QRY_APP_ERROR);
|
STMT_ERR_RET(TSDB_CODE_QRY_APP_ERROR);
|
||||||
|
|
@ -755,7 +757,7 @@ int stmtBindBatch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind, int32_t colIdx) {
|
||||||
} else {
|
} else {
|
||||||
if (colIdx != (pStmt->bInfo.sBindLastIdx + 1) && colIdx != 0) {
|
if (colIdx != (pStmt->bInfo.sBindLastIdx + 1) && colIdx != 0) {
|
||||||
tscError("bind column index not in sequence");
|
tscError("bind column index not in sequence");
|
||||||
STMT_ERR_RET(TSDB_CODE_QRY_APP_ERROR);
|
STMT_ERR_RET(TSDB_CODE_APP_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
pStmt->bInfo.sBindLastIdx = colIdx;
|
pStmt->bInfo.sBindLastIdx = colIdx;
|
||||||
|
|
@ -789,10 +791,10 @@ int stmtUpdateTableUid(STscStmt* pStmt, SSubmitRsp* pRsp) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
int32_t finalCode = 0;
|
int32_t finalCode = 0;
|
||||||
size_t keyLen = 0;
|
size_t keyLen = 0;
|
||||||
void* pIter = taosHashIterate(pStmt->exec.pBlockHash, NULL);
|
void* pIter = taosHashIterate(pStmt->exec.pBlockHash, NULL);
|
||||||
while (pIter) {
|
while (pIter) {
|
||||||
STableDataCxt* pBlock = *(STableDataCxt**)pIter;
|
STableDataCxt* pBlock = *(STableDataCxt**)pIter;
|
||||||
char* key = taosHashGetKey(pIter, &keyLen);
|
char* key = taosHashGetKey(pIter, &keyLen);
|
||||||
|
|
||||||
STableMeta* pMeta = qGetTableMetaInDataBlock(pBlock);
|
STableMeta* pMeta = qGetTableMetaInDataBlock(pBlock);
|
||||||
if (pMeta->uid) {
|
if (pMeta->uid) {
|
||||||
|
|
|
||||||
|
|
@ -303,7 +303,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_fetchRawBlockImp(
|
||||||
jniDebug("jobj:%p, conn:%p, resultset:%p, no data to retrieve", jobj, tscon, (void *)res);
|
jniDebug("jobj:%p, conn:%p, resultset:%p, no data to retrieve", jobj, tscon, (void *)res);
|
||||||
return JNI_FETCH_END;
|
return JNI_FETCH_END;
|
||||||
} else {
|
} else {
|
||||||
jniError("jobj:%p, conn:%p, query interrupted", jobj, tscon);
|
jniError("jobj:%p, conn:%p, query interrupted, tmq fetch block error code:%d, msg:%s", jobj, tscon, error_code, taos_errstr(tres));
|
||||||
return JNI_RESULT_SET_NULL;
|
return JNI_RESULT_SET_NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1138,14 +1138,15 @@ int32_t blockDataSort_rv(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullF
|
||||||
}
|
}
|
||||||
|
|
||||||
void blockDataCleanup(SSDataBlock* pDataBlock) {
|
void blockDataCleanup(SSDataBlock* pDataBlock) {
|
||||||
|
blockDataEmpty(pDataBlock);
|
||||||
SDataBlockInfo* pInfo = &pDataBlock->info;
|
SDataBlockInfo* pInfo = &pDataBlock->info;
|
||||||
|
|
||||||
pInfo->rows = 0;
|
|
||||||
pInfo->id.uid = 0;
|
pInfo->id.uid = 0;
|
||||||
pInfo->id.groupId = 0;
|
pInfo->id.groupId = 0;
|
||||||
pInfo->window.ekey = 0;
|
}
|
||||||
pInfo->window.skey = 0;
|
|
||||||
|
|
||||||
|
void blockDataEmpty(SSDataBlock* pDataBlock) {
|
||||||
|
SDataBlockInfo* pInfo = &pDataBlock->info;
|
||||||
|
ASSERT(pInfo->rows <= pDataBlock->info.capacity);
|
||||||
if (pInfo->capacity == 0) {
|
if (pInfo->capacity == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1155,6 +1156,10 @@ void blockDataCleanup(SSDataBlock* pDataBlock) {
|
||||||
SColumnInfoData* p = taosArrayGet(pDataBlock->pDataBlock, i);
|
SColumnInfoData* p = taosArrayGet(pDataBlock->pDataBlock, i);
|
||||||
colInfoDataCleanup(p, pInfo->capacity);
|
colInfoDataCleanup(p, pInfo->capacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pInfo->rows = 0;
|
||||||
|
pInfo->window.ekey = 0;
|
||||||
|
pInfo->window.skey = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo temporarily disable it
|
// todo temporarily disable it
|
||||||
|
|
@ -1188,7 +1193,6 @@ static int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo*
|
||||||
int32_t oldLen = BitmapLen(existedRows);
|
int32_t oldLen = BitmapLen(existedRows);
|
||||||
pColumn->nullbitmap = tmp;
|
pColumn->nullbitmap = tmp;
|
||||||
memset(&pColumn->nullbitmap[oldLen], 0, BitmapLen(numOfRows) - oldLen);
|
memset(&pColumn->nullbitmap[oldLen], 0, BitmapLen(numOfRows) - oldLen);
|
||||||
|
|
||||||
ASSERT(pColumn->info.bytes);
|
ASSERT(pColumn->info.bytes);
|
||||||
|
|
||||||
// make sure the allocated memory is MALLOC_ALIGN_BYTES aligned
|
// make sure the allocated memory is MALLOC_ALIGN_BYTES aligned
|
||||||
|
|
@ -1204,6 +1208,12 @@ static int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo*
|
||||||
}
|
}
|
||||||
|
|
||||||
pColumn->pData = tmp;
|
pColumn->pData = tmp;
|
||||||
|
|
||||||
|
// todo remove it soon
|
||||||
|
#if defined LINUX
|
||||||
|
ASSERT((((uint64_t)pColumn->pData) & (MALLOC_ALIGN_BYTES - 1)) == 0x0);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (clearPayload) {
|
if (clearPayload) {
|
||||||
memset(tmp + pColumn->info.bytes * existedRows, 0, pColumn->info.bytes * (numOfRows - existedRows));
|
memset(tmp + pColumn->info.bytes * existedRows, 0, pColumn->info.bytes * (numOfRows - existedRows));
|
||||||
}
|
}
|
||||||
|
|
@ -1251,6 +1261,25 @@ int32_t blockDataEnsureCapacity(SSDataBlock* pDataBlock, uint32_t numOfRows) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t blockDataEnsureCapacityNoClear(SSDataBlock* pDataBlock, uint32_t numOfRows) {
|
||||||
|
int32_t code = 0;
|
||||||
|
if (numOfRows == 0 || numOfRows <= pDataBlock->info.capacity) {
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t numOfCols = taosArrayGetSize(pDataBlock->pDataBlock);
|
||||||
|
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||||
|
SColumnInfoData* p = taosArrayGet(pDataBlock->pDataBlock, i);
|
||||||
|
code = doEnsureCapacity(p, &pDataBlock->info, numOfRows, false);
|
||||||
|
if (code) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pDataBlock->info.capacity = numOfRows;
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
void blockDataFreeRes(SSDataBlock* pBlock) {
|
void blockDataFreeRes(SSDataBlock* pBlock) {
|
||||||
int32_t numOfOutput = taosArrayGetSize(pBlock->pDataBlock);
|
int32_t numOfOutput = taosArrayGetSize(pBlock->pDataBlock);
|
||||||
for (int32_t i = 0; i < numOfOutput; ++i) {
|
for (int32_t i = 0; i < numOfOutput; ++i) {
|
||||||
|
|
@ -1623,6 +1652,8 @@ static int32_t colDataMoveVarData(SColumnInfoData* pColInfoData, size_t start, s
|
||||||
static void colDataTrimFirstNRows(SColumnInfoData* pColInfoData, size_t n, size_t total) {
|
static void colDataTrimFirstNRows(SColumnInfoData* pColInfoData, size_t n, size_t total) {
|
||||||
if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) {
|
if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) {
|
||||||
pColInfoData->varmeta.length = colDataMoveVarData(pColInfoData, n, total);
|
pColInfoData->varmeta.length = colDataMoveVarData(pColInfoData, n, total);
|
||||||
|
|
||||||
|
// clear the offset value of the unused entries.
|
||||||
memset(&pColInfoData->varmeta.offset[total - n], 0, n);
|
memset(&pColInfoData->varmeta.offset[total - n], 0, n);
|
||||||
} else {
|
} else {
|
||||||
int32_t bytes = pColInfoData->info.bytes;
|
int32_t bytes = pColInfoData->info.bytes;
|
||||||
|
|
@ -1637,7 +1668,7 @@ int32_t blockDataTrimFirstNRows(SSDataBlock* pBlock, size_t n) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pBlock->info.rows <= n) {
|
if (pBlock->info.rows <= n) {
|
||||||
blockDataCleanup(pBlock);
|
blockDataEmpty(pBlock);
|
||||||
} else {
|
} else {
|
||||||
size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
|
size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
|
||||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||||
|
|
@ -1654,12 +1685,22 @@ static void colDataKeepFirstNRows(SColumnInfoData* pColInfoData, size_t n, size_
|
||||||
if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) {
|
if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) {
|
||||||
pColInfoData->varmeta.length = colDataMoveVarData(pColInfoData, 0, n);
|
pColInfoData->varmeta.length = colDataMoveVarData(pColInfoData, 0, n);
|
||||||
memset(&pColInfoData->varmeta.offset[n], 0, total - n);
|
memset(&pColInfoData->varmeta.offset[n], 0, total - n);
|
||||||
|
} else { // reset the bitmap value
|
||||||
|
/*int32_t stopIndex = BitmapLen(n) * 8;
|
||||||
|
for(int32_t i = n; i < stopIndex; ++i) {
|
||||||
|
colDataClearNull_f(pColInfoData->nullbitmap, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t remain = BitmapLen(total) - BitmapLen(n);
|
||||||
|
if (remain > 0) {
|
||||||
|
memset(pColInfoData->nullbitmap+BitmapLen(n), 0, remain);
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t blockDataKeepFirstNRows(SSDataBlock* pBlock, size_t n) {
|
int32_t blockDataKeepFirstNRows(SSDataBlock* pBlock, size_t n) {
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
blockDataCleanup(pBlock);
|
blockDataEmpty(pBlock);
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2211,7 +2252,7 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq2** ppReq, const SSDataBlock* pDat
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!(pTbData->aRowP = taosArrayInit(rows, sizeof(SRow*)))){
|
if (!(pTbData->aRowP = taosArrayInit(rows, sizeof(SRow*)))) {
|
||||||
taosMemoryFree(pTbData);
|
taosMemoryFree(pTbData);
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -652,7 +652,7 @@ int32_t tRowIterOpen(SRow *pRow, STSchema *pTSchema, SRowIter **ppIter) {
|
||||||
|
|
||||||
SRowIter *pIter = taosMemoryCalloc(1, sizeof(*pIter));
|
SRowIter *pIter = taosMemoryCalloc(1, sizeof(*pIter));
|
||||||
if (pIter == NULL) {
|
if (pIter == NULL) {
|
||||||
code = TSDB_CODE_TDB_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,11 @@ int32_t tsNumOfQnodeFetchThreads = 1;
|
||||||
int32_t tsNumOfSnodeStreamThreads = 4;
|
int32_t tsNumOfSnodeStreamThreads = 4;
|
||||||
int32_t tsNumOfSnodeWriteThreads = 1;
|
int32_t tsNumOfSnodeWriteThreads = 1;
|
||||||
|
|
||||||
|
// sync raft
|
||||||
|
int32_t tsElectInterval = 25 * 1000;
|
||||||
|
int32_t tsHeartbeatInterval = 1000;
|
||||||
|
int32_t tsHeartbeatTimeout = 20 * 1000;
|
||||||
|
|
||||||
// monitor
|
// monitor
|
||||||
bool tsEnableMonitor = true;
|
bool tsEnableMonitor = true;
|
||||||
int32_t tsMonitorInterval = 30;
|
int32_t tsMonitorInterval = 30;
|
||||||
|
|
@ -74,8 +79,8 @@ char tsSmlTagName[TSDB_COL_NAME_LEN] = "_tag_null";
|
||||||
char tsSmlChildTableName[TSDB_TABLE_NAME_LEN] = ""; // user defined child table name can be specified in tag value.
|
char tsSmlChildTableName[TSDB_TABLE_NAME_LEN] = ""; // user defined child table name can be specified in tag value.
|
||||||
// If set to empty system will generate table name using MD5 hash.
|
// If set to empty system will generate table name using MD5 hash.
|
||||||
// true means that the name and order of cols in each line are the same(only for influx protocol)
|
// true means that the name and order of cols in each line are the same(only for influx protocol)
|
||||||
bool tsSmlDataFormat = false;
|
bool tsSmlDataFormat = false;
|
||||||
int32_t tsSmlBatchSize = 10000;
|
int32_t tsSmlBatchSize = 10000;
|
||||||
|
|
||||||
// query
|
// query
|
||||||
int32_t tsQueryPolicy = 1;
|
int32_t tsQueryPolicy = 1;
|
||||||
|
|
@ -198,9 +203,7 @@ int32_t taosSetTfsCfg(SConfig *pCfg) {
|
||||||
int32_t taosSetTfsCfg(SConfig *pCfg);
|
int32_t taosSetTfsCfg(SConfig *pCfg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct SConfig *taosGetCfg() {
|
struct SConfig *taosGetCfg() { return tsCfg; }
|
||||||
return tsCfg;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *inputCfgDir, const char *envFile,
|
static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *inputCfgDir, const char *envFile,
|
||||||
char *apolloUrl) {
|
char *apolloUrl) {
|
||||||
|
|
@ -423,6 +426,10 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
|
||||||
if (cfgAddInt64(pCfg, "rpcQueueMemoryAllowed", tsRpcQueueMemoryAllowed, TSDB_MAX_MSG_SIZE * 10L, INT64_MAX, 0) != 0)
|
if (cfgAddInt64(pCfg, "rpcQueueMemoryAllowed", tsRpcQueueMemoryAllowed, TSDB_MAX_MSG_SIZE * 10L, INT64_MAX, 0) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if (cfgAddInt32(pCfg, "syncElectInterval", tsElectInterval, 10, 1000 * 60 * 24 * 2, 0) != 0) return -1;
|
||||||
|
if (cfgAddInt32(pCfg, "syncHeartbeatInterval", tsHeartbeatInterval, 10, 1000 * 60 * 24 * 2, 0) != 0) return -1;
|
||||||
|
if (cfgAddInt32(pCfg, "syncHeartbeatTimeout", tsHeartbeatTimeout, 10, 1000 * 60 * 24 * 2, 0) != 0) return -1;
|
||||||
|
|
||||||
if (cfgAddBool(pCfg, "monitor", tsEnableMonitor, 0) != 0) return -1;
|
if (cfgAddBool(pCfg, "monitor", tsEnableMonitor, 0) != 0) return -1;
|
||||||
if (cfgAddInt32(pCfg, "monitorInterval", tsMonitorInterval, 1, 200000, 0) != 0) return -1;
|
if (cfgAddInt32(pCfg, "monitorInterval", tsMonitorInterval, 1, 200000, 0) != 0) return -1;
|
||||||
if (cfgAddString(pCfg, "monitorFqdn", tsMonitorFqdn, 0) != 0) return -1;
|
if (cfgAddString(pCfg, "monitorFqdn", tsMonitorFqdn, 0) != 0) return -1;
|
||||||
|
|
@ -728,6 +735,10 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
|
||||||
tstrncpy(tsTelemServer, cfgGetItem(pCfg, "telemetryServer")->str, TSDB_FQDN_LEN);
|
tstrncpy(tsTelemServer, cfgGetItem(pCfg, "telemetryServer")->str, TSDB_FQDN_LEN);
|
||||||
tsTelemPort = (uint16_t)cfgGetItem(pCfg, "telemetryPort")->i32;
|
tsTelemPort = (uint16_t)cfgGetItem(pCfg, "telemetryPort")->i32;
|
||||||
|
|
||||||
|
tsElectInterval = cfgGetItem(pCfg, "syncElectInterval")->i32;
|
||||||
|
tsHeartbeatInterval = cfgGetItem(pCfg, "syncHeartbeatInterval")->i32;
|
||||||
|
tsHeartbeatTimeout = cfgGetItem(pCfg, "syncHeartbeatTimeout")->i32;
|
||||||
|
|
||||||
tsTransPullupInterval = cfgGetItem(pCfg, "transPullupInterval")->i32;
|
tsTransPullupInterval = cfgGetItem(pCfg, "transPullupInterval")->i32;
|
||||||
tsMqRebalanceInterval = cfgGetItem(pCfg, "mqRebalanceInterval")->i32;
|
tsMqRebalanceInterval = cfgGetItem(pCfg, "mqRebalanceInterval")->i32;
|
||||||
tsTtlUnit = cfgGetItem(pCfg, "ttlUnit")->i32;
|
tsTtlUnit = cfgGetItem(pCfg, "ttlUnit")->i32;
|
||||||
|
|
@ -737,6 +748,10 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
|
||||||
|
|
||||||
tsWalFsyncDataSizeLimit = cfgGetItem(pCfg, "walFsyncDataSizeLimit")->i64;
|
tsWalFsyncDataSizeLimit = cfgGetItem(pCfg, "walFsyncDataSizeLimit")->i64;
|
||||||
|
|
||||||
|
tsElectInterval = cfgGetItem(pCfg, "syncElectInterval")->i32;
|
||||||
|
tsHeartbeatInterval = cfgGetItem(pCfg, "syncHeartbeatInterval")->i32;
|
||||||
|
tsHeartbeatTimeout = cfgGetItem(pCfg, "syncHeartbeatTimeout")->i32;
|
||||||
|
|
||||||
tsStartUdfd = cfgGetItem(pCfg, "udf")->bval;
|
tsStartUdfd = cfgGetItem(pCfg, "udf")->bval;
|
||||||
tstrncpy(tsUdfdResFuncs, cfgGetItem(pCfg, "udfdResFuncs")->str, sizeof(tsUdfdResFuncs));
|
tstrncpy(tsUdfdResFuncs, cfgGetItem(pCfg, "udfdResFuncs")->str, sizeof(tsUdfdResFuncs));
|
||||||
tstrncpy(tsUdfdLdLibPath, cfgGetItem(pCfg, "udfdLdLibPath")->str, sizeof(tsUdfdLdLibPath));
|
tstrncpy(tsUdfdLdLibPath, cfgGetItem(pCfg, "udfdLdLibPath")->str, sizeof(tsUdfdLdLibPath));
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ static void mmProcessRpcMsg(SQueueInfo *pInfo, SRpcMsg *pMsg) {
|
||||||
pMsg->info.rsp = NULL;
|
pMsg->info.rsp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code == TSDB_CODE_RPC_REDIRECT) {
|
if (code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_SYN_RESTORING) {
|
||||||
mndPostProcessQueryMsg(pMsg);
|
mndPostProcessQueryMsg(pMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,7 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
dDebug("vgId:%d, already exist", req.vgId);
|
dDebug("vgId:%d, already exist", req.vgId);
|
||||||
tFreeSCreateVnodeReq(&req);
|
tFreeSCreateVnodeReq(&req);
|
||||||
vmReleaseVnode(pMgmt, pVnode);
|
vmReleaseVnode(pMgmt, pVnode);
|
||||||
terrno = TSDB_CODE_NODE_ALREADY_DEPLOYED;
|
terrno = TSDB_CODE_VND_ALREADY_EXIST;
|
||||||
code = terrno;
|
code = terrno;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -307,7 +307,7 @@ int32_t vmProcessAlterVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
SVnodeObj *pVnode = vmAcquireVnode(pMgmt, vgId);
|
SVnodeObj *pVnode = vmAcquireVnode(pMgmt, vgId);
|
||||||
if (pVnode == NULL) {
|
if (pVnode == NULL) {
|
||||||
dError("vgId:%d, failed to alter replica since %s", vgId, terrstr());
|
dError("vgId:%d, failed to alter replica since %s", vgId, terrstr());
|
||||||
terrno = TSDB_CODE_NODE_NOT_DEPLOYED;
|
terrno = TSDB_CODE_VND_NOT_EXIST;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -369,7 +369,7 @@ int32_t vmProcessDropVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
SVnodeObj *pVnode = vmAcquireVnode(pMgmt, vgId);
|
SVnodeObj *pVnode = vmAcquireVnode(pMgmt, vgId);
|
||||||
if (pVnode == NULL) {
|
if (pVnode == NULL) {
|
||||||
dDebug("vgId:%d, failed to drop since %s", vgId, terrstr());
|
dDebug("vgId:%d, failed to drop since %s", vgId, terrstr());
|
||||||
terrno = TSDB_CODE_NODE_NOT_DEPLOYED;
|
terrno = TSDB_CODE_VND_NOT_EXIST;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,19 @@ static int32_t dmProcessCreateNodeReq(EDndNodeType ntype, SRpcMsg *pMsg) {
|
||||||
SMgmtWrapper *pWrapper = dmAcquireWrapper(pDnode, ntype);
|
SMgmtWrapper *pWrapper = dmAcquireWrapper(pDnode, ntype);
|
||||||
if (pWrapper != NULL) {
|
if (pWrapper != NULL) {
|
||||||
dmReleaseWrapper(pWrapper);
|
dmReleaseWrapper(pWrapper);
|
||||||
terrno = TSDB_CODE_NODE_ALREADY_DEPLOYED;
|
switch (ntype) {
|
||||||
|
case MNODE:
|
||||||
|
terrno = TSDB_CODE_MNODE_ALREADY_DEPLOYED;
|
||||||
|
break;
|
||||||
|
case QNODE:
|
||||||
|
terrno = TSDB_CODE_QNODE_ALREADY_DEPLOYED;
|
||||||
|
break;
|
||||||
|
case SNODE:
|
||||||
|
terrno = TSDB_CODE_SNODE_ALREADY_DEPLOYED;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
terrno = TSDB_CODE_APP_ERROR;
|
||||||
|
}
|
||||||
dError("failed to create node since %s", terrstr());
|
dError("failed to create node since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -191,7 +203,20 @@ static int32_t dmProcessDropNodeReq(EDndNodeType ntype, SRpcMsg *pMsg) {
|
||||||
|
|
||||||
SMgmtWrapper *pWrapper = dmAcquireWrapper(pDnode, ntype);
|
SMgmtWrapper *pWrapper = dmAcquireWrapper(pDnode, ntype);
|
||||||
if (pWrapper == NULL) {
|
if (pWrapper == NULL) {
|
||||||
terrno = TSDB_CODE_NODE_NOT_DEPLOYED;
|
switch (ntype) {
|
||||||
|
case MNODE:
|
||||||
|
terrno = TSDB_CODE_MNODE_NOT_DEPLOYED;
|
||||||
|
break;
|
||||||
|
case QNODE:
|
||||||
|
terrno = TSDB_CODE_QNODE_NOT_DEPLOYED;
|
||||||
|
break;
|
||||||
|
case SNODE:
|
||||||
|
terrno = TSDB_CODE_SNODE_NOT_DEPLOYED;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
terrno = TSDB_CODE_APP_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
dError("failed to drop node since %s", terrstr());
|
dError("failed to drop node since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,6 @@ SMgmtWrapper *dmAcquireWrapper(SDnode *pDnode, EDndNodeType ntype) {
|
||||||
int32_t refCount = atomic_add_fetch_32(&pWrapper->refCount, 1);
|
int32_t refCount = atomic_add_fetch_32(&pWrapper->refCount, 1);
|
||||||
// dTrace("node:%s, is acquired, ref:%d", pWrapper->name, refCount);
|
// dTrace("node:%s, is acquired, ref:%d", pWrapper->name, refCount);
|
||||||
} else {
|
} else {
|
||||||
terrno = TSDB_CODE_NODE_NOT_DEPLOYED;
|
|
||||||
pRetWrapper = NULL;
|
pRetWrapper = NULL;
|
||||||
}
|
}
|
||||||
taosThreadRwlockUnlock(&pWrapper->lock);
|
taosThreadRwlockUnlock(&pWrapper->lock);
|
||||||
|
|
@ -205,7 +204,20 @@ int32_t dmMarkWrapper(SMgmtWrapper *pWrapper) {
|
||||||
int32_t refCount = atomic_add_fetch_32(&pWrapper->refCount, 1);
|
int32_t refCount = atomic_add_fetch_32(&pWrapper->refCount, 1);
|
||||||
// dTrace("node:%s, is marked, ref:%d", pWrapper->name, refCount);
|
// dTrace("node:%s, is marked, ref:%d", pWrapper->name, refCount);
|
||||||
} else {
|
} else {
|
||||||
terrno = TSDB_CODE_NODE_NOT_DEPLOYED;
|
switch (pWrapper->ntype) {
|
||||||
|
case MNODE:
|
||||||
|
terrno = TSDB_CODE_MNODE_NOT_FOUND;
|
||||||
|
break;
|
||||||
|
case QNODE:
|
||||||
|
terrno = TSDB_CODE_QNODE_NOT_FOUND;
|
||||||
|
break;
|
||||||
|
case SNODE:
|
||||||
|
terrno = TSDB_CODE_SNODE_NOT_FOUND;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
terrno = TSDB_CODE_APP_IS_STOPPING;
|
||||||
|
break;
|
||||||
|
}
|
||||||
code = -1;
|
code = -1;
|
||||||
}
|
}
|
||||||
taosThreadRwlockUnlock(&pWrapper->lock);
|
taosThreadRwlockUnlock(&pWrapper->lock);
|
||||||
|
|
|
||||||
|
|
@ -33,23 +33,6 @@ static inline void dmBuildMnodeRedirectRsp(SDnode *pDnode, SRpcMsg *pMsg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void dmSendRedirectRsp(SRpcMsg *pMsg, const SEpSet *pNewEpSet) {
|
|
||||||
pMsg->info.hasEpSet = 1;
|
|
||||||
SRpcMsg rsp = {.code = TSDB_CODE_RPC_REDIRECT, .info = pMsg->info, .msgType = pMsg->msgType};
|
|
||||||
int32_t contLen = tSerializeSEpSet(NULL, 0, pNewEpSet);
|
|
||||||
|
|
||||||
rsp.pCont = rpcMallocCont(contLen);
|
|
||||||
if (rsp.pCont == NULL) {
|
|
||||||
pMsg->code = TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
} else {
|
|
||||||
tSerializeSEpSet(rsp.pCont, contLen, pNewEpSet);
|
|
||||||
rsp.contLen = contLen;
|
|
||||||
}
|
|
||||||
dmSendRsp(&rsp);
|
|
||||||
rpcFreeCont(pMsg->pCont);
|
|
||||||
pMsg->pCont = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t dmProcessNodeMsg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg) {
|
int32_t dmProcessNodeMsg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg) {
|
||||||
const STraceId *trace = &pMsg->info.traceId;
|
const STraceId *trace = &pMsg->info.traceId;
|
||||||
|
|
||||||
|
|
@ -172,8 +155,7 @@ _OVER:
|
||||||
|
|
||||||
if (IsReq(pRpc)) {
|
if (IsReq(pRpc)) {
|
||||||
SRpcMsg rsp = {.code = code, .info = pRpc->info};
|
SRpcMsg rsp = {.code = code, .info = pRpc->info};
|
||||||
if ((code == TSDB_CODE_NODE_NOT_DEPLOYED || code == TSDB_CODE_APP_NOT_READY) && pRpc->msgType > TDMT_MND_MSG &&
|
if (code == TSDB_CODE_MNODE_NOT_FOUND) {
|
||||||
pRpc->msgType < TDMT_VND_MSG) {
|
|
||||||
dmBuildMnodeRedirectRsp(pDnode, &rsp);
|
dmBuildMnodeRedirectRsp(pDnode, &rsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -226,7 +208,11 @@ static inline int32_t dmSendReq(const SEpSet *pEpSet, SRpcMsg *pMsg) {
|
||||||
if (pDnode->status != DND_STAT_RUNNING && pMsg->msgType < TDMT_SYNC_MSG) {
|
if (pDnode->status != DND_STAT_RUNNING && pMsg->msgType < TDMT_SYNC_MSG) {
|
||||||
rpcFreeCont(pMsg->pCont);
|
rpcFreeCont(pMsg->pCont);
|
||||||
pMsg->pCont = NULL;
|
pMsg->pCont = NULL;
|
||||||
terrno = TSDB_CODE_NODE_OFFLINE;
|
if (pDnode->status == DND_STAT_INIT) {
|
||||||
|
terrno = TSDB_CODE_APP_IS_STARTING;
|
||||||
|
} else {
|
||||||
|
terrno = TSDB_CODE_APP_IS_STOPPING;
|
||||||
|
}
|
||||||
dError("failed to send rpc msg:%s since %s, handle:%p", TMSG_INFO(pMsg->msgType), terrstr(), pMsg->info.handle);
|
dError("failed to send rpc msg:%s since %s, handle:%p", TMSG_INFO(pMsg->msgType), terrstr(), pMsg->info.handle);
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -240,9 +226,9 @@ static inline void dmRegisterBrokenLinkArg(SRpcMsg *pMsg) { rpcRegisterBrokenLin
|
||||||
static inline void dmReleaseHandle(SRpcHandleInfo *pHandle, int8_t type) { rpcReleaseHandle(pHandle, type); }
|
static inline void dmReleaseHandle(SRpcHandleInfo *pHandle, int8_t type) { rpcReleaseHandle(pHandle, type); }
|
||||||
|
|
||||||
static bool rpcRfp(int32_t code, tmsg_t msgType) {
|
static bool rpcRfp(int32_t code, tmsg_t msgType) {
|
||||||
if (code == TSDB_CODE_RPC_REDIRECT || code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_NODE_NOT_DEPLOYED ||
|
if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_RPC_BROKEN_LINK || code == TSDB_CODE_MNODE_NOT_FOUND ||
|
||||||
code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_APP_NOT_READY || code == TSDB_CODE_RPC_BROKEN_LINK ||
|
code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_SYN_RESTORING || code == TSDB_CODE_VND_STOPPED ||
|
||||||
code == TSDB_CODE_VND_STOPPED) {
|
code == TSDB_CODE_APP_IS_STARTING || code == TSDB_CODE_APP_IS_STOPPING) {
|
||||||
if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH ||
|
if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH ||
|
||||||
msgType == TDMT_SCH_MERGE_FETCH) {
|
msgType == TDMT_SCH_MERGE_FETCH) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -331,7 +317,6 @@ SMsgCb dmGetMsgcb(SDnode *pDnode) {
|
||||||
.clientRpc = pDnode->trans.clientRpc,
|
.clientRpc = pDnode->trans.clientRpc,
|
||||||
.sendReqFp = dmSendReq,
|
.sendReqFp = dmSendReq,
|
||||||
.sendRspFp = dmSendRsp,
|
.sendRspFp = dmSendRsp,
|
||||||
.sendRedirectRspFp = dmSendRedirectRsp,
|
|
||||||
.registerBrokenLinkArgFp = dmRegisterBrokenLinkArg,
|
.registerBrokenLinkArgFp = dmRegisterBrokenLinkArg,
|
||||||
.releaseHandleFp = dmReleaseHandle,
|
.releaseHandleFp = dmReleaseHandle,
|
||||||
.reportStartupFp = dmReportStartup,
|
.reportStartupFp = dmReportStartup,
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@
|
||||||
#include "sync.h"
|
#include "sync.h"
|
||||||
#include "wal.h"
|
#include "wal.h"
|
||||||
|
|
||||||
#include "libs/function/function.h"
|
#include "libs/function/tudf.h"
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ TEST_F(DndTestMnode, 01_Create_Mnode) {
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_ALREADY_DEPLOYED);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_MNODE_ALREADY_DEPLOYED);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
@ -57,7 +57,7 @@ TEST_F(DndTestMnode, 01_Create_Mnode) {
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_ALREADY_DEPLOYED);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_MNODE_ALREADY_DEPLOYED);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
@ -77,7 +77,7 @@ TEST_F(DndTestMnode, 01_Create_Mnode) {
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_ALREADY_DEPLOYED);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_MNODE_ALREADY_DEPLOYED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -171,7 +171,7 @@ TEST_F(DndTestMnode, 03_Drop_Mnode) {
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_NOT_DEPLOYED);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_MNODE_NOT_DEPLOYED);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
@ -188,7 +188,7 @@ TEST_F(DndTestMnode, 03_Drop_Mnode) {
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_NOT_DEPLOYED);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_MNODE_NOT_DEPLOYED);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ TEST_F(DndTestQnode, 01_Create_Qnode) {
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_ALREADY_DEPLOYED);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_QNODE_ALREADY_DEPLOYED);
|
||||||
}
|
}
|
||||||
|
|
||||||
test.Restart();
|
test.Restart();
|
||||||
|
|
@ -77,7 +77,7 @@ TEST_F(DndTestQnode, 01_Create_Qnode) {
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_ALREADY_DEPLOYED);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_QNODE_ALREADY_DEPLOYED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,7 +120,7 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_NOT_DEPLOYED);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_QNODE_NOT_DEPLOYED);
|
||||||
}
|
}
|
||||||
|
|
||||||
test.Restart();
|
test.Restart();
|
||||||
|
|
@ -135,7 +135,7 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_NOT_DEPLOYED);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_QNODE_NOT_DEPLOYED);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ TEST_F(DndTestSnode, 01_Create_Snode) {
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_ALREADY_DEPLOYED);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_SNODE_ALREADY_DEPLOYED);
|
||||||
}
|
}
|
||||||
|
|
||||||
test.Restart();
|
test.Restart();
|
||||||
|
|
@ -77,7 +77,7 @@ TEST_F(DndTestSnode, 01_Create_Snode) {
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_ALREADY_DEPLOYED);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_SNODE_ALREADY_DEPLOYED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,7 +120,7 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_NOT_DEPLOYED);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_SNODE_NOT_DEPLOYED);
|
||||||
}
|
}
|
||||||
|
|
||||||
test.Restart();
|
test.Restart();
|
||||||
|
|
@ -135,7 +135,7 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_NOT_DEPLOYED);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_SNODE_NOT_DEPLOYED);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ TEST_F(DndTestVnode, 01_Create_Vnode) {
|
||||||
ASSERT_EQ(pRsp->code, 0);
|
ASSERT_EQ(pRsp->code, 0);
|
||||||
test.Restart();
|
test.Restart();
|
||||||
} else {
|
} else {
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_ALREADY_DEPLOYED);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_VND_ALREADY_EXIST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -285,7 +285,7 @@ TEST_F(DndTestVnode, 06_Drop_Vnode) {
|
||||||
ASSERT_EQ(pRsp->code, 0);
|
ASSERT_EQ(pRsp->code, 0);
|
||||||
test.Restart();
|
test.Restart();
|
||||||
} else {
|
} else {
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_NOT_DEPLOYED);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_VND_NOT_EXIST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -31,6 +31,7 @@ void mndReleaseUser(SMnode *pMnode, SUserObj *pUser);
|
||||||
// for trans test
|
// for trans test
|
||||||
SSdbRaw *mndUserActionEncode(SUserObj *pUser);
|
SSdbRaw *mndUserActionEncode(SUserObj *pUser);
|
||||||
SHashObj *mndDupDbHash(SHashObj *pOld);
|
SHashObj *mndDupDbHash(SHashObj *pOld);
|
||||||
|
SHashObj *mndDupTopicHash(SHashObj *pOld);
|
||||||
int32_t mndValidateUserAuthInfo(SMnode *pMnode, SUserAuthVersion *pUsers, int32_t numOfUses, void **ppRsp,
|
int32_t mndValidateUserAuthInfo(SMnode *pMnode, SUserAuthVersion *pUsers, int32_t numOfUses, void **ppRsp,
|
||||||
int32_t *pRspLen);
|
int32_t *pRspLen);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,7 @@ static int32_t mndProcessCreateAcctReq(SRpcMsg *pReq) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
terrno = TSDB_CODE_MSG_NOT_PROCESSED;
|
terrno = TSDB_CODE_OPS_NOT_SUPPORT;
|
||||||
mError("failed to process create acct request since %s", terrstr());
|
mError("failed to process create acct request since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -230,7 +230,7 @@ static int32_t mndProcessAlterAcctReq(SRpcMsg *pReq) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
terrno = TSDB_CODE_MSG_NOT_PROCESSED;
|
terrno = TSDB_CODE_OPS_NOT_SUPPORT;
|
||||||
mError("failed to process create acct request since %s", terrstr());
|
mError("failed to process create acct request since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -240,7 +240,7 @@ static int32_t mndProcessDropAcctReq(SRpcMsg *pReq) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
terrno = TSDB_CODE_MSG_NOT_PROCESSED;
|
terrno = TSDB_CODE_OPS_NOT_SUPPORT;
|
||||||
mError("failed to process create acct request since %s", terrstr());
|
mError("failed to process create acct request since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -787,7 +787,7 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq) {
|
||||||
int32_t numOfVnodes = mndGetVnodesNum(pMnode, pDnode->id);
|
int32_t numOfVnodes = mndGetVnodesNum(pMnode, pDnode->id);
|
||||||
if ((numOfVnodes > 0 || pMObj != NULL || pSObj != NULL || pQObj != NULL) && !dropReq.force) {
|
if ((numOfVnodes > 0 || pMObj != NULL || pSObj != NULL || pQObj != NULL) && !dropReq.force) {
|
||||||
if (!mndIsDnodeOnline(pDnode, taosGetTimestampMs())) {
|
if (!mndIsDnodeOnline(pDnode, taosGetTimestampMs())) {
|
||||||
terrno = TSDB_CODE_NODE_OFFLINE;
|
terrno = TSDB_CODE_DNODE_OFFLINE;
|
||||||
mError("dnode:%d, failed to drop since %s, vnodes:%d mnode:%d qnode:%d snode:%d", pDnode->id, terrstr(),
|
mError("dnode:%d, failed to drop since %s, vnodes:%d mnode:%d qnode:%d snode:%d", pDnode->id, terrstr(),
|
||||||
numOfVnodes, pMObj != NULL, pQObj != NULL, pSObj != NULL);
|
numOfVnodes, pMObj != NULL, pQObj != NULL, pSObj != NULL);
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ static int32_t mndInsInitMeta(SHashObj *hash) {
|
||||||
int32_t mndBuildInsTableSchema(SMnode *pMnode, const char *dbFName, const char *tbName, bool sysinfo,
|
int32_t mndBuildInsTableSchema(SMnode *pMnode, const char *dbFName, const char *tbName, bool sysinfo,
|
||||||
STableMetaRsp *pRsp) {
|
STableMetaRsp *pRsp) {
|
||||||
if (NULL == pMnode->infosMeta) {
|
if (NULL == pMnode->infosMeta) {
|
||||||
terrno = TSDB_CODE_APP_NOT_READY;
|
terrno = TSDB_CODE_APP_ERROR;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -97,7 +97,7 @@ int32_t mndBuildInsTableSchema(SMnode *pMnode, const char *dbFName, const char *
|
||||||
|
|
||||||
int32_t mndBuildInsTableCfg(SMnode *pMnode, const char *dbFName, const char *tbName, STableCfgRsp *pRsp) {
|
int32_t mndBuildInsTableCfg(SMnode *pMnode, const char *dbFName, const char *tbName, STableCfgRsp *pRsp) {
|
||||||
if (NULL == pMnode->infosMeta) {
|
if (NULL == pMnode->infosMeta) {
|
||||||
terrno = TSDB_CODE_APP_NOT_READY;
|
terrno = TSDB_CODE_APP_ERROR;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ static inline int32_t mndAcquireRpc(SMnode *pMnode) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
taosThreadRwlockRdlock(&pMnode->lock);
|
taosThreadRwlockRdlock(&pMnode->lock);
|
||||||
if (pMnode->stopped) {
|
if (pMnode->stopped) {
|
||||||
terrno = TSDB_CODE_APP_NOT_READY;
|
terrno = TSDB_CODE_APP_IS_STOPPING;
|
||||||
code = -1;
|
code = -1;
|
||||||
} else if (!mndIsLeader(pMnode)) {
|
} else if (!mndIsLeader(pMnode)) {
|
||||||
code = -1;
|
code = -1;
|
||||||
|
|
@ -599,11 +599,45 @@ static int32_t mndCheckMnodeState(SRpcMsg *pMsg) {
|
||||||
pMsg->msgType == TDMT_SCH_FETCH || pMsg->msgType == TDMT_SCH_MERGE_FETCH || pMsg->msgType == TDMT_SCH_DROP_TASK) {
|
pMsg->msgType == TDMT_SCH_FETCH || pMsg->msgType == TDMT_SCH_MERGE_FETCH || pMsg->msgType == TDMT_SCH_DROP_TASK) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (mndAcquireRpc(pMsg->info.node) == 0) return 0;
|
|
||||||
|
|
||||||
SMnode *pMnode = pMsg->info.node;
|
SMnode *pMnode = pMsg->info.node;
|
||||||
|
taosThreadRwlockRdlock(&pMnode->lock);
|
||||||
|
if (pMnode->stopped) {
|
||||||
|
taosThreadRwlockUnlock(&pMnode->lock);
|
||||||
|
terrno = TSDB_CODE_APP_IS_STOPPING;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
terrno = 0;
|
||||||
SSyncState state = syncGetState(pMnode->syncMgmt.sync);
|
SSyncState state = syncGetState(pMnode->syncMgmt.sync);
|
||||||
|
if (terrno != 0) {
|
||||||
|
taosThreadRwlockUnlock(&pMnode->lock);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.state != TAOS_SYNC_STATE_LEADER) {
|
||||||
|
taosThreadRwlockUnlock(&pMnode->lock);
|
||||||
|
terrno = TSDB_CODE_SYN_NOT_LEADER;
|
||||||
|
goto _OVER;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!state.restored || !pMnode->restored) {
|
||||||
|
taosThreadRwlockUnlock(&pMnode->lock);
|
||||||
|
terrno = TSDB_CODE_SYN_RESTORING;
|
||||||
|
goto _OVER;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
atomic_add_fetch_32(&pMnode->rpcRef, 1);
|
||||||
|
#else
|
||||||
|
int32_t ref = atomic_add_fetch_32(&pMnode->rpcRef, 1);
|
||||||
|
mTrace("mnode rpc is acquired, ref:%d", ref);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
taosThreadRwlockUnlock(&pMnode->lock);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
_OVER:
|
||||||
if (pMsg->msgType == TDMT_MND_TMQ_TIMER || pMsg->msgType == TDMT_MND_TELEM_TIMER ||
|
if (pMsg->msgType == TDMT_MND_TMQ_TIMER || pMsg->msgType == TDMT_MND_TELEM_TIMER ||
|
||||||
pMsg->msgType == TDMT_MND_TRANS_TIMER || pMsg->msgType == TDMT_MND_TTL_TIMER ||
|
pMsg->msgType == TDMT_MND_TRANS_TIMER || pMsg->msgType == TDMT_MND_TTL_TIMER ||
|
||||||
pMsg->msgType == TDMT_MND_UPTIME_TIMER) {
|
pMsg->msgType == TDMT_MND_UPTIME_TIMER) {
|
||||||
|
|
@ -616,29 +650,24 @@ static int32_t mndCheckMnodeState(SRpcMsg *pMsg) {
|
||||||
SEpSet epSet = {0};
|
SEpSet epSet = {0};
|
||||||
mndGetMnodeEpSet(pMnode, &epSet);
|
mndGetMnodeEpSet(pMnode, &epSet);
|
||||||
|
|
||||||
mDebug(
|
mGDebug(
|
||||||
"msg:%p, type:%s failed to process since %s, mnode restored:%d stopped:%d, sync restored:%d "
|
"msg:%p, type:%s failed to process since %s, mnode restored:%d stopped:%d, sync restored:%d "
|
||||||
"role:%s, redirect numOfEps:%d inUse:%d",
|
"role:%s, redirect numOfEps:%d inUse:%d",
|
||||||
pMsg, TMSG_INFO(pMsg->msgType), terrstr(), pMnode->restored, pMnode->stopped, state.restored,
|
pMsg, TMSG_INFO(pMsg->msgType), terrstr(), pMnode->restored, pMnode->stopped, state.restored,
|
||||||
syncStr(state.restored), epSet.numOfEps, epSet.inUse);
|
syncStr(state.restored), epSet.numOfEps, epSet.inUse);
|
||||||
|
|
||||||
if (epSet.numOfEps > 0) {
|
if (epSet.numOfEps <= 0) return -1;
|
||||||
for (int32_t i = 0; i < epSet.numOfEps; ++i) {
|
|
||||||
mDebug("mnode index:%d, ep:%s:%u", i, epSet.eps[i].fqdn, epSet.eps[i].port);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t contLen = tSerializeSEpSet(NULL, 0, &epSet);
|
for (int32_t i = 0; i < epSet.numOfEps; ++i) {
|
||||||
pMsg->info.rsp = rpcMallocCont(contLen);
|
mDebug("mnode index:%d, ep:%s:%u", i, epSet.eps[i].fqdn, epSet.eps[i].port);
|
||||||
if (pMsg->info.rsp != NULL) {
|
}
|
||||||
tSerializeSEpSet(pMsg->info.rsp, contLen, &epSet);
|
|
||||||
pMsg->info.hasEpSet = 1;
|
int32_t contLen = tSerializeSEpSet(NULL, 0, &epSet);
|
||||||
pMsg->info.rspLen = contLen;
|
pMsg->info.rsp = rpcMallocCont(contLen);
|
||||||
terrno = TSDB_CODE_RPC_REDIRECT;
|
if (pMsg->info.rsp != NULL) {
|
||||||
} else {
|
tSerializeSEpSet(pMsg->info.rsp, contLen, &epSet);
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
pMsg->info.hasEpSet = 1;
|
||||||
}
|
pMsg->info.rspLen = contLen;
|
||||||
} else {
|
|
||||||
terrno = TSDB_CODE_APP_NOT_READY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
||||||
|
|
@ -292,7 +292,7 @@ static int32_t mndBuildCreateMnodeRedoAction(STrans *pTrans, SDCreateMnodeReq *p
|
||||||
.pCont = pReq,
|
.pCont = pReq,
|
||||||
.contLen = contLen,
|
.contLen = contLen,
|
||||||
.msgType = TDMT_DND_CREATE_MNODE,
|
.msgType = TDMT_DND_CREATE_MNODE,
|
||||||
.acceptableCode = TSDB_CODE_NODE_ALREADY_DEPLOYED,
|
.acceptableCode = TSDB_CODE_MNODE_ALREADY_DEPLOYED,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||||
|
|
@ -333,7 +333,7 @@ static int32_t mndBuildDropMnodeRedoAction(STrans *pTrans, SDDropMnodeReq *pDrop
|
||||||
.pCont = pReq,
|
.pCont = pReq,
|
||||||
.contLen = contLen,
|
.contLen = contLen,
|
||||||
.msgType = TDMT_DND_DROP_MNODE,
|
.msgType = TDMT_DND_DROP_MNODE,
|
||||||
.acceptableCode = TSDB_CODE_NODE_NOT_DEPLOYED,
|
.acceptableCode = TSDB_CODE_MNODE_NOT_DEPLOYED,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||||
|
|
@ -440,7 +440,7 @@ static int32_t mndProcessCreateMnodeReq(SRpcMsg *pReq) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mndIsDnodeOnline(pDnode, taosGetTimestampMs())) {
|
if (!mndIsDnodeOnline(pDnode, taosGetTimestampMs())) {
|
||||||
terrno = TSDB_CODE_NODE_OFFLINE;
|
terrno = TSDB_CODE_DNODE_OFFLINE;
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -490,7 +490,7 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
|
||||||
if (totalMnodes == 2) {
|
if (totalMnodes == 2) {
|
||||||
if (force) {
|
if (force) {
|
||||||
mError("cant't force drop dnode, since a mnode on it and replica is 2");
|
mError("cant't force drop dnode, since a mnode on it and replica is 2");
|
||||||
terrno = TSDB_CODE_NODE_OFFLINE;
|
terrno = TSDB_CODE_DNODE_OFFLINE;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
mInfo("vgId:1, has %d mnodes, exec redo log first", totalMnodes);
|
mInfo("vgId:1, has %d mnodes, exec redo log first", totalMnodes);
|
||||||
|
|
@ -574,7 +574,7 @@ static int32_t mndProcessDropMnodeReq(SRpcMsg *pReq) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mndIsDnodeOnline(pObj->pDnode, taosGetTimestampMs())) {
|
if (!mndIsDnodeOnline(pObj->pDnode, taosGetTimestampMs())) {
|
||||||
terrno = TSDB_CODE_NODE_OFFLINE;
|
terrno = TSDB_CODE_DNODE_OFFLINE;
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ int32_t mndPerfsInitMeta(SHashObj *hash) {
|
||||||
|
|
||||||
int32_t mndBuildPerfsTableSchema(SMnode *pMnode, const char *dbFName, const char *tbName, STableMetaRsp *pRsp) {
|
int32_t mndBuildPerfsTableSchema(SMnode *pMnode, const char *dbFName, const char *tbName, STableMetaRsp *pRsp) {
|
||||||
if (NULL == pMnode->perfsMeta) {
|
if (NULL == pMnode->perfsMeta) {
|
||||||
terrno = TSDB_CODE_APP_NOT_READY;
|
terrno = TSDB_CODE_APP_ERROR;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -94,7 +94,7 @@ int32_t mndBuildPerfsTableSchema(SMnode *pMnode, const char *dbFName, const char
|
||||||
|
|
||||||
int32_t mndBuildPerfsTableCfg(SMnode *pMnode, const char *dbFName, const char *tbName, STableCfgRsp *pRsp) {
|
int32_t mndBuildPerfsTableCfg(SMnode *pMnode, const char *dbFName, const char *tbName, STableCfgRsp *pRsp) {
|
||||||
if (NULL == pMnode->perfsMeta) {
|
if (NULL == pMnode->perfsMeta) {
|
||||||
terrno = TSDB_CODE_APP_NOT_READY;
|
terrno = TSDB_CODE_APP_ERROR;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -542,7 +542,7 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
mError("invalid kv key:%d", kv->key);
|
mError("invalid kv key:%d", kv->key);
|
||||||
hbRsp.status = TSDB_CODE_MND_APP_ERROR;
|
hbRsp.status = TSDB_CODE_APP_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,7 @@ static int32_t mndSetCreateQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
||||||
action.pCont = pReq;
|
action.pCont = pReq;
|
||||||
action.contLen = contLen;
|
action.contLen = contLen;
|
||||||
action.msgType = TDMT_DND_CREATE_QNODE;
|
action.msgType = TDMT_DND_CREATE_QNODE;
|
||||||
action.acceptableCode = TSDB_CODE_NODE_ALREADY_DEPLOYED;
|
action.acceptableCode = TSDB_CODE_QNODE_ALREADY_DEPLOYED;
|
||||||
|
|
||||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||||
taosMemoryFree(pReq);
|
taosMemoryFree(pReq);
|
||||||
|
|
@ -232,7 +232,7 @@ static int32_t mndSetCreateQnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
||||||
action.pCont = pReq;
|
action.pCont = pReq;
|
||||||
action.contLen = contLen;
|
action.contLen = contLen;
|
||||||
action.msgType = TDMT_DND_DROP_QNODE;
|
action.msgType = TDMT_DND_DROP_QNODE;
|
||||||
action.acceptableCode = TSDB_CODE_NODE_NOT_DEPLOYED;
|
action.acceptableCode = TSDB_CODE_QNODE_NOT_DEPLOYED;
|
||||||
|
|
||||||
if (mndTransAppendUndoAction(pTrans, &action) != 0) {
|
if (mndTransAppendUndoAction(pTrans, &action) != 0) {
|
||||||
taosMemoryFree(pReq);
|
taosMemoryFree(pReq);
|
||||||
|
|
@ -345,7 +345,7 @@ static int32_t mndSetDropQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQn
|
||||||
action.pCont = pReq;
|
action.pCont = pReq;
|
||||||
action.contLen = contLen;
|
action.contLen = contLen;
|
||||||
action.msgType = TDMT_DND_DROP_QNODE;
|
action.msgType = TDMT_DND_DROP_QNODE;
|
||||||
action.acceptableCode = TSDB_CODE_NODE_NOT_DEPLOYED;
|
action.acceptableCode = TSDB_CODE_QNODE_NOT_DEPLOYED;
|
||||||
|
|
||||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||||
taosMemoryFree(pReq);
|
taosMemoryFree(pReq);
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,8 @@ static int32_t convertToRetrieveType(char *name, int32_t len) {
|
||||||
type = TSDB_MGMT_TABLE_APPS;
|
type = TSDB_MGMT_TABLE_APPS;
|
||||||
} else if (strncasecmp(name, TSDB_INS_TABLE_STREAM_TASKS, len) == 0) {
|
} else if (strncasecmp(name, TSDB_INS_TABLE_STREAM_TASKS, len) == 0) {
|
||||||
type = TSDB_MGMT_TABLE_STREAM_TASKS;
|
type = TSDB_MGMT_TABLE_STREAM_TASKS;
|
||||||
|
} else if (strncasecmp(name, TSDB_INS_TABLE_USER_PRIVILEGES, len) == 0) {
|
||||||
|
type = TSDB_MGMT_TABLE_PRIVILEGES;
|
||||||
} else {
|
} else {
|
||||||
// ASSERT(0);
|
// ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
@ -196,9 +198,9 @@ static int32_t mndProcessRetrieveSysTableReq(SRpcMsg *pReq) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retrieveReq.showId == 0) {
|
if (retrieveReq.showId == 0) {
|
||||||
STableMetaRsp *pMeta = (STableMetaRsp *)taosHashGet(pMnode->infosMeta, retrieveReq.tb, strlen(retrieveReq.tb));
|
STableMetaRsp *pMeta = taosHashGet(pMnode->infosMeta, retrieveReq.tb, strlen(retrieveReq.tb));
|
||||||
if (pMeta == NULL) {
|
if (pMeta == NULL) {
|
||||||
pMeta = (STableMetaRsp *)taosHashGet(pMnode->perfsMeta, retrieveReq.tb, strlen(retrieveReq.tb));
|
pMeta = taosHashGet(pMnode->perfsMeta, retrieveReq.tb, strlen(retrieveReq.tb));
|
||||||
if (pMeta == NULL) {
|
if (pMeta == NULL) {
|
||||||
terrno = TSDB_CODE_MND_INVALID_SYS_TABLENAME;
|
terrno = TSDB_CODE_MND_INVALID_SYS_TABLENAME;
|
||||||
mError("failed to process show-retrieve req:%p since %s", pShow, terrstr());
|
mError("failed to process show-retrieve req:%p since %s", pShow, terrstr());
|
||||||
|
|
|
||||||
|
|
@ -463,7 +463,7 @@ static int32_t mndSetCreateSmaVgroupRedoActions(SMnode *pMnode, STrans *pTrans,
|
||||||
action.pCont = pReq;
|
action.pCont = pReq;
|
||||||
action.contLen = contLen;
|
action.contLen = contLen;
|
||||||
action.msgType = TDMT_DND_CREATE_VNODE;
|
action.msgType = TDMT_DND_CREATE_VNODE;
|
||||||
action.acceptableCode = TSDB_CODE_NODE_ALREADY_DEPLOYED;
|
action.acceptableCode = TSDB_CODE_VND_ALREADY_EXIST;
|
||||||
|
|
||||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||||
taosMemoryFree(pReq);
|
taosMemoryFree(pReq);
|
||||||
|
|
@ -780,7 +780,7 @@ static int32_t mndSetDropSmaVgroupRedoActions(SMnode *pMnode, STrans *pTrans, SD
|
||||||
action.pCont = pReq;
|
action.pCont = pReq;
|
||||||
action.contLen = contLen;
|
action.contLen = contLen;
|
||||||
action.msgType = TDMT_DND_DROP_VNODE;
|
action.msgType = TDMT_DND_DROP_VNODE;
|
||||||
action.acceptableCode = TSDB_CODE_NODE_NOT_DEPLOYED;
|
action.acceptableCode = TSDB_CODE_VND_NOT_EXIST;
|
||||||
|
|
||||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||||
taosMemoryFree(pReq);
|
taosMemoryFree(pReq);
|
||||||
|
|
|
||||||
|
|
@ -210,7 +210,7 @@ static int32_t mndSetCreateSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
||||||
action.pCont = pReq;
|
action.pCont = pReq;
|
||||||
action.contLen = contLen;
|
action.contLen = contLen;
|
||||||
action.msgType = TDMT_DND_CREATE_SNODE;
|
action.msgType = TDMT_DND_CREATE_SNODE;
|
||||||
action.acceptableCode = TSDB_CODE_NODE_ALREADY_DEPLOYED;
|
action.acceptableCode = TSDB_CODE_SNODE_ALREADY_DEPLOYED;
|
||||||
|
|
||||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||||
taosMemoryFree(pReq);
|
taosMemoryFree(pReq);
|
||||||
|
|
@ -237,7 +237,7 @@ static int32_t mndSetCreateSnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
||||||
action.pCont = pReq;
|
action.pCont = pReq;
|
||||||
action.contLen = contLen;
|
action.contLen = contLen;
|
||||||
action.msgType = TDMT_DND_DROP_SNODE;
|
action.msgType = TDMT_DND_DROP_SNODE;
|
||||||
action.acceptableCode = TSDB_CODE_NODE_NOT_DEPLOYED;
|
action.acceptableCode = TSDB_CODE_SNODE_NOT_DEPLOYED;
|
||||||
|
|
||||||
if (mndTransAppendUndoAction(pTrans, &action) != 0) {
|
if (mndTransAppendUndoAction(pTrans, &action) != 0) {
|
||||||
taosMemoryFree(pReq);
|
taosMemoryFree(pReq);
|
||||||
|
|
@ -352,7 +352,7 @@ static int32_t mndSetDropSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SSn
|
||||||
action.pCont = pReq;
|
action.pCont = pReq;
|
||||||
action.contLen = contLen;
|
action.contLen = contLen;
|
||||||
action.msgType = TDMT_DND_DROP_SNODE;
|
action.msgType = TDMT_DND_DROP_SNODE;
|
||||||
action.acceptableCode = TSDB_CODE_NODE_NOT_DEPLOYED;
|
action.acceptableCode = TSDB_CODE_SNODE_NOT_DEPLOYED;
|
||||||
|
|
||||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||||
taosMemoryFree(pReq);
|
taosMemoryFree(pReq);
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ static int32_t mndSyncSendMsg(const SEpSet *pEpSet, SRpcMsg *pMsg) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mndProcessWriteMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta *pMeta) {
|
int32_t mndProcessWriteMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta *pMeta) {
|
||||||
SMnode *pMnode = pFsm->data;
|
SMnode *pMnode = pFsm->data;
|
||||||
SSyncMgmt *pMgmt = &pMnode->syncMgmt;
|
SSyncMgmt *pMgmt = &pMnode->syncMgmt;
|
||||||
SSdbRaw *pRaw = pMsg->pCont;
|
SSdbRaw *pRaw = pMsg->pCont;
|
||||||
|
|
@ -114,12 +114,15 @@ void mndProcessWriteMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta *p
|
||||||
mError("trans:%d, not found while execute in mnode since %s", transId, terrstr());
|
mError("trans:%d, not found while execute in mnode since %s", transId, terrstr());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mndSyncCommitMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta *pMeta) {
|
int32_t mndSyncCommitMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta *pMeta) {
|
||||||
mndProcessWriteMsg(pFsm, pMsg, pMeta);
|
int32_t code = mndProcessWriteMsg(pFsm, pMsg, pMeta);
|
||||||
rpcFreeCont(pMsg->pCont);
|
rpcFreeCont(pMsg->pCont);
|
||||||
pMsg->pCont = NULL;
|
pMsg->pCont = NULL;
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mndSyncGetSnapshot(const SSyncFSM *pFsm, SSnapshot *pSnapshot, void *pReaderParam, void **ppReader) {
|
int32_t mndSyncGetSnapshot(const SSyncFSM *pFsm, SSnapshot *pSnapshot, void *pReaderParam, void **ppReader) {
|
||||||
|
|
@ -318,7 +321,7 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
|
||||||
if (pMgmt->transId != 0) {
|
if (pMgmt->transId != 0) {
|
||||||
mError("trans:%d, can't be proposed since trans:%d already waiting for confirm", transId, pMgmt->transId);
|
mError("trans:%d, can't be proposed since trans:%d already waiting for confirm", transId, pMgmt->transId);
|
||||||
taosWUnLockLatch(&pMgmt->lock);
|
taosWUnLockLatch(&pMgmt->lock);
|
||||||
terrno = TSDB_CODE_APP_NOT_READY;
|
terrno = TSDB_CODE_MND_LAST_TRANS_NOT_FINISHED;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -339,13 +342,11 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
|
||||||
sdbSetApplyInfo(pMnode->pSdb, req.info.conn.applyIndex, req.info.conn.applyTerm, SYNC_INDEX_INVALID);
|
sdbSetApplyInfo(pMnode->pSdb, req.info.conn.applyIndex, req.info.conn.applyTerm, SYNC_INDEX_INVALID);
|
||||||
code = 0;
|
code = 0;
|
||||||
} else {
|
} else {
|
||||||
mInfo("trans:%d, failed to proposed since %s", transId, terrstr());
|
mError("trans:%d, failed to proposed since %s", transId, terrstr());
|
||||||
taosWLockLatch(&pMgmt->lock);
|
taosWLockLatch(&pMgmt->lock);
|
||||||
pMgmt->transId = 0;
|
pMgmt->transId = 0;
|
||||||
taosWUnLockLatch(&pMgmt->lock);
|
taosWUnLockLatch(&pMgmt->lock);
|
||||||
if (terrno == TSDB_CODE_SYN_NOT_LEADER) {
|
if (terrno == 0) {
|
||||||
terrno = TSDB_CODE_APP_NOT_READY;
|
|
||||||
} else {
|
|
||||||
terrno = TSDB_CODE_APP_ERROR;
|
terrno = TSDB_CODE_APP_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -381,20 +382,23 @@ void mndSyncStop(SMnode *pMnode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool mndIsLeader(SMnode *pMnode) {
|
bool mndIsLeader(SMnode *pMnode) {
|
||||||
|
terrno = 0;
|
||||||
SSyncState state = syncGetState(pMnode->syncMgmt.sync);
|
SSyncState state = syncGetState(pMnode->syncMgmt.sync);
|
||||||
|
|
||||||
if (state.state != TAOS_SYNC_STATE_LEADER || !state.restored) {
|
if (terrno != 0) {
|
||||||
if (state.state != TAOS_SYNC_STATE_LEADER) {
|
mDebug("vgId:1, mnode is stopping");
|
||||||
terrno = TSDB_CODE_SYN_NOT_LEADER;
|
|
||||||
} else {
|
|
||||||
terrno = TSDB_CODE_APP_NOT_READY;
|
|
||||||
}
|
|
||||||
mDebug("vgId:1, mnode not ready, state:%s, restore:%d", syncStr(state.state), state.restored);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mndGetRestored(pMnode)) {
|
if (state.state != TAOS_SYNC_STATE_LEADER) {
|
||||||
terrno = TSDB_CODE_APP_NOT_READY;
|
terrno = TSDB_CODE_SYN_NOT_LEADER;
|
||||||
|
mDebug("vgId:1, mnode not leader, state:%s", syncStr(state.state));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!state.restored || !pMnode->restored) {
|
||||||
|
terrno = TSDB_CODE_SYN_RESTORING;
|
||||||
|
mDebug("vgId:1, mnode not restored:%d:%d", state.restored, pMnode->restored);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -918,10 +918,13 @@ static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans) {
|
||||||
sendRsp = true;
|
sendRsp = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (pTrans->stage == TRN_STAGE_REDO_ACTION && ((code == TSDB_CODE_APP_NOT_READY && pTrans->failedTimes > 60) ||
|
if (pTrans->stage == TRN_STAGE_REDO_ACTION) {
|
||||||
(code != TSDB_CODE_APP_NOT_READY && pTrans->failedTimes > 6))) {
|
if (code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_SYN_RESTORING || code == TSDB_CODE_APP_IS_STARTING) {
|
||||||
|
if (pTrans->failedTimes > 60) sendRsp = true;
|
||||||
|
} else {
|
||||||
|
if (pTrans->failedTimes > 6) sendRsp = true;
|
||||||
|
}
|
||||||
if (code == 0) code = TSDB_CODE_MND_TRANS_UNKNOW_ERROR;
|
if (code == 0) code = TSDB_CODE_MND_TRANS_UNKNOW_ERROR;
|
||||||
sendRsp = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -942,7 +945,7 @@ static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans) {
|
||||||
code = TSDB_CODE_MND_TRANS_NETWORK_UNAVAILL;
|
code = TSDB_CODE_MND_TRANS_NETWORK_UNAVAILL;
|
||||||
}
|
}
|
||||||
if (i != 0 && code == 0) {
|
if (i != 0 && code == 0) {
|
||||||
code = TSDB_CODE_RPC_REDIRECT;
|
code = TSDB_CODE_MNODE_NOT_FOUND;
|
||||||
}
|
}
|
||||||
mInfo("trans:%d, client:%d send rsp, code:0x%x stage:%s app:%p", pTrans->id, i, code, mndTransStr(pTrans->stage),
|
mInfo("trans:%d, client:%d send rsp, code:0x%x stage:%s app:%p", pTrans->id, i, code, mndTransStr(pTrans->stage),
|
||||||
pInfo->ahandle);
|
pInfo->ahandle);
|
||||||
|
|
@ -1039,8 +1042,8 @@ static void mndTransResetAction(SMnode *pMnode, STrans *pTrans, STransAction *pA
|
||||||
pAction->rawWritten = 0;
|
pAction->rawWritten = 0;
|
||||||
pAction->msgSent = 0;
|
pAction->msgSent = 0;
|
||||||
pAction->msgReceived = 0;
|
pAction->msgReceived = 0;
|
||||||
if (pAction->errCode == TSDB_CODE_RPC_REDIRECT || pAction->errCode == TSDB_CODE_SYN_NEW_CONFIG_ERROR ||
|
if (pAction->errCode == TSDB_CODE_SYN_NEW_CONFIG_ERROR || pAction->errCode == TSDB_CODE_SYN_INTERNAL_ERROR ||
|
||||||
pAction->errCode == TSDB_CODE_SYN_INTERNAL_ERROR || pAction->errCode == TSDB_CODE_SYN_NOT_LEADER) {
|
pAction->errCode == TSDB_CODE_SYN_NOT_LEADER) {
|
||||||
pAction->epSet.inUse = (pAction->epSet.inUse + 1) % pAction->epSet.numOfEps;
|
pAction->epSet.inUse = (pAction->epSet.inUse + 1) % pAction->epSet.numOfEps;
|
||||||
mInfo("trans:%d, %s:%d execute status is reset and set epset inuse:%d", pTrans->id, mndTransStr(pAction->stage),
|
mInfo("trans:%d, %s:%d execute status is reset and set epset inuse:%d", pTrans->id, mndTransStr(pAction->stage),
|
||||||
pAction->id, pAction->epSet.inUse);
|
pAction->id, pAction->epSet.inUse);
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) {
|
||||||
char *topic = taosHashIterate(pUser->topics, NULL);
|
char *topic = taosHashIterate(pUser->topics, NULL);
|
||||||
while (topic != NULL) {
|
while (topic != NULL) {
|
||||||
SDB_SET_BINARY(pRaw, dataPos, topic, TSDB_TOPIC_FNAME_LEN, _OVER);
|
SDB_SET_BINARY(pRaw, dataPos, topic, TSDB_TOPIC_FNAME_LEN, _OVER);
|
||||||
db = taosHashIterate(pUser->topics, topic);
|
topic = taosHashIterate(pUser->topics, topic);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDB_SET_RESERVE(pRaw, dataPos, USER_RESERVE_SIZE, _OVER)
|
SDB_SET_RESERVE(pRaw, dataPos, USER_RESERVE_SIZE, _OVER)
|
||||||
|
|
@ -446,7 +446,7 @@ static int32_t mndAlterUser(SMnode *pMnode, SUserObj *pOld, SUserObj *pNew, SRpc
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SHashObj *mndDupDbHash(SHashObj *pOld) {
|
SHashObj *mndDupObjHash(SHashObj *pOld, int32_t dataLen) {
|
||||||
SHashObj *pNew =
|
SHashObj *pNew =
|
||||||
taosHashInit(taosHashGetSize(pOld), taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
taosHashInit(taosHashGetSize(pOld), taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
||||||
if (pNew == NULL) {
|
if (pNew == NULL) {
|
||||||
|
|
@ -457,7 +457,7 @@ SHashObj *mndDupDbHash(SHashObj *pOld) {
|
||||||
char *db = taosHashIterate(pOld, NULL);
|
char *db = taosHashIterate(pOld, NULL);
|
||||||
while (db != NULL) {
|
while (db != NULL) {
|
||||||
int32_t len = strlen(db) + 1;
|
int32_t len = strlen(db) + 1;
|
||||||
if (taosHashPut(pNew, db, len, db, TSDB_DB_FNAME_LEN) != 0) {
|
if (taosHashPut(pNew, db, len, db, dataLen) != 0) {
|
||||||
taosHashCancelIterate(pOld, db);
|
taosHashCancelIterate(pOld, db);
|
||||||
taosHashCleanup(pNew);
|
taosHashCleanup(pNew);
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
@ -469,6 +469,10 @@ SHashObj *mndDupDbHash(SHashObj *pOld) {
|
||||||
return pNew;
|
return pNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SHashObj *mndDupDbHash(SHashObj *pOld) { return mndDupObjHash(pOld, TSDB_DB_FNAME_LEN); }
|
||||||
|
|
||||||
|
SHashObj *mndDupTopicHash(SHashObj *pOld) { return mndDupObjHash(pOld, TSDB_TOPIC_FNAME_LEN); }
|
||||||
|
|
||||||
static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) {
|
static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) {
|
||||||
SMnode *pMnode = pReq->info.node;
|
SMnode *pMnode = pReq->info.node;
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
SSdb *pSdb = pMnode->pSdb;
|
||||||
|
|
@ -519,7 +523,7 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) {
|
||||||
taosRLockLatch(&pUser->lock);
|
taosRLockLatch(&pUser->lock);
|
||||||
newUser.readDbs = mndDupDbHash(pUser->readDbs);
|
newUser.readDbs = mndDupDbHash(pUser->readDbs);
|
||||||
newUser.writeDbs = mndDupDbHash(pUser->writeDbs);
|
newUser.writeDbs = mndDupDbHash(pUser->writeDbs);
|
||||||
newUser.topics = mndDupDbHash(pUser->topics);
|
newUser.topics = mndDupTopicHash(pUser->topics);
|
||||||
taosRUnLockLatch(&pUser->lock);
|
taosRUnLockLatch(&pUser->lock);
|
||||||
|
|
||||||
if (newUser.readDbs == NULL || newUser.writeDbs == NULL || newUser.topics == NULL) {
|
if (newUser.readDbs == NULL || newUser.writeDbs == NULL || newUser.topics == NULL) {
|
||||||
|
|
@ -832,6 +836,26 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
|
||||||
int32_t numOfTopics = taosHashGetSize(pUser->topics);
|
int32_t numOfTopics = taosHashGetSize(pUser->topics);
|
||||||
if (numOfRows + numOfReadDbs + numOfWriteDbs + numOfTopics >= rows) break;
|
if (numOfRows + numOfReadDbs + numOfWriteDbs + numOfTopics >= rows) break;
|
||||||
|
|
||||||
|
if (pUser->superUser) {
|
||||||
|
cols = 0;
|
||||||
|
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
|
char userName[TSDB_USER_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
|
STR_WITH_MAXSIZE_TO_VARSTR(userName, pUser->user, pShow->pMeta->pSchemas[cols].bytes);
|
||||||
|
colDataAppend(pColInfo, numOfRows, (const char *)userName, false);
|
||||||
|
|
||||||
|
char privilege[20] = {0};
|
||||||
|
STR_WITH_MAXSIZE_TO_VARSTR(privilege, "all", pShow->pMeta->pSchemas[cols].bytes);
|
||||||
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
|
colDataAppend(pColInfo, numOfRows, (const char *)privilege, false);
|
||||||
|
|
||||||
|
char objName[20] = {0};
|
||||||
|
STR_WITH_MAXSIZE_TO_VARSTR(objName, "all", pShow->pMeta->pSchemas[cols].bytes);
|
||||||
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
|
colDataAppend(pColInfo, numOfRows, (const char *)objName, false);
|
||||||
|
|
||||||
|
numOfRows++;
|
||||||
|
}
|
||||||
|
|
||||||
char *db = taosHashIterate(pUser->readDbs, NULL);
|
char *db = taosHashIterate(pUser->readDbs, NULL);
|
||||||
while (db != NULL) {
|
while (db != NULL) {
|
||||||
cols = 0;
|
cols = 0;
|
||||||
|
|
@ -902,7 +926,7 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
|
||||||
colDataAppend(pColInfo, numOfRows, (const char *)topicName, false);
|
colDataAppend(pColInfo, numOfRows, (const char *)topicName, false);
|
||||||
|
|
||||||
numOfRows++;
|
numOfRows++;
|
||||||
db = taosHashIterate(pUser->topics, topic);
|
topic = taosHashIterate(pUser->topics, topic);
|
||||||
}
|
}
|
||||||
|
|
||||||
sdbRelease(pSdb, pUser);
|
sdbRelease(pSdb, pUser);
|
||||||
|
|
|
||||||
|
|
@ -276,7 +276,7 @@ void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVg
|
||||||
}
|
}
|
||||||
|
|
||||||
if (createReq.selfIndex == -1) {
|
if (createReq.selfIndex == -1) {
|
||||||
terrno = TSDB_CODE_MND_APP_ERROR;
|
terrno = TSDB_CODE_APP_ERROR;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -376,7 +376,7 @@ static void *mndBuildAlterVnodeReplicaReq(SMnode *pMnode, SDbObj *pDb, SVgObj *p
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alterReq.selfIndex == -1) {
|
if (alterReq.selfIndex == -1) {
|
||||||
terrno = TSDB_CODE_MND_APP_ERROR;
|
terrno = TSDB_CODE_APP_ERROR;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -998,7 +998,7 @@ int32_t mndAddCreateVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVg
|
||||||
action.pCont = pReq;
|
action.pCont = pReq;
|
||||||
action.contLen = contLen;
|
action.contLen = contLen;
|
||||||
action.msgType = TDMT_DND_CREATE_VNODE;
|
action.msgType = TDMT_DND_CREATE_VNODE;
|
||||||
action.acceptableCode = TSDB_CODE_NODE_ALREADY_DEPLOYED;
|
action.acceptableCode = TSDB_CODE_VND_ALREADY_EXIST;
|
||||||
|
|
||||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||||
taosMemoryFree(pReq);
|
taosMemoryFree(pReq);
|
||||||
|
|
@ -1098,7 +1098,7 @@ int32_t mndAddDropVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgOb
|
||||||
action.pCont = pReq;
|
action.pCont = pReq;
|
||||||
action.contLen = contLen;
|
action.contLen = contLen;
|
||||||
action.msgType = TDMT_DND_DROP_VNODE;
|
action.msgType = TDMT_DND_DROP_VNODE;
|
||||||
action.acceptableCode = TSDB_CODE_NODE_NOT_DEPLOYED;
|
action.acceptableCode = TSDB_CODE_VND_NOT_EXIST;
|
||||||
|
|
||||||
if (isRedo) {
|
if (isRedo) {
|
||||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ TEST_F(MndTestAcct, 01_Create_Acct) {
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_ACCT, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_ACCT, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_MSG_NOT_PROCESSED);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_OPS_NOT_SUPPORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MndTestAcct, 02_Alter_Acct) {
|
TEST_F(MndTestAcct, 02_Alter_Acct) {
|
||||||
|
|
@ -42,7 +42,7 @@ TEST_F(MndTestAcct, 02_Alter_Acct) {
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_ACCT, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_ACCT, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_MSG_NOT_PROCESSED);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_OPS_NOT_SUPPORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MndTestAcct, 03_Drop_Acct) {
|
TEST_F(MndTestAcct, 03_Drop_Acct) {
|
||||||
|
|
@ -52,5 +52,5 @@ TEST_F(MndTestAcct, 03_Drop_Acct) {
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_ACCT, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_ACCT, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_MSG_NOT_PROCESSED);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_OPS_NOT_SUPPORT);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ class MndTestTrans2 : public ::testing::Test {
|
||||||
action.pCont = pReq;
|
action.pCont = pReq;
|
||||||
action.contLen = contLen;
|
action.contLen = contLen;
|
||||||
action.msgType = TDMT_DND_CREATE_MNODE;
|
action.msgType = TDMT_DND_CREATE_MNODE;
|
||||||
action.acceptableCode = TSDB_CODE_NODE_ALREADY_DEPLOYED;
|
action.acceptableCode = TSDB_CODE_MNODE_ALREADY_DEPLOYED;
|
||||||
mndTransAppendRedoAction(pTrans, &action);
|
mndTransAppendRedoAction(pTrans, &action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -190,7 +190,7 @@ class MndTestTrans2 : public ::testing::Test {
|
||||||
action.pCont = pReq;
|
action.pCont = pReq;
|
||||||
action.contLen = contLen;
|
action.contLen = contLen;
|
||||||
action.msgType = TDMT_DND_CREATE_MNODE;
|
action.msgType = TDMT_DND_CREATE_MNODE;
|
||||||
action.acceptableCode = TSDB_CODE_NODE_ALREADY_DEPLOYED;
|
action.acceptableCode = TSDB_CODE_MNODE_ALREADY_DEPLOYED;
|
||||||
mndTransAppendUndoAction(pTrans, &action);
|
mndTransAppendUndoAction(pTrans, &action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -415,7 +415,7 @@ static int32_t sdbWriteFileImp(SSdb *pSdb) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
code = TSDB_CODE_SDB_APP_ERROR;
|
code = TSDB_CODE_APP_ERROR;
|
||||||
taosHashCancelIterate(hash, ppRow);
|
taosHashCancelIterate(hash, ppRow);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ static SHashObj *sdbGetHash(SSdb *pSdb, int32_t type) {
|
||||||
|
|
||||||
SHashObj *hash = pSdb->hashObjs[type];
|
SHashObj *hash = pSdb->hashObjs[type];
|
||||||
if (hash == NULL) {
|
if (hash == NULL) {
|
||||||
terrno = TSDB_CODE_SDB_APP_ERROR;
|
terrno = TSDB_CODE_APP_ERROR;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -302,7 +302,7 @@ void *sdbAcquire(SSdb *pSdb, ESdbType type, const void *pKey) {
|
||||||
terrno = TSDB_CODE_SDB_OBJ_DROPPING;
|
terrno = TSDB_CODE_SDB_OBJ_DROPPING;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
terrno = TSDB_CODE_SDB_APP_ERROR;
|
terrno = TSDB_CODE_APP_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -106,14 +106,24 @@ int32_t metaGetTableTagsByUids(SMeta *pMeta, int64_t suid, SArray *uidList,
|
||||||
int32_t metaReadNext(SMetaReader *pReader);
|
int32_t metaReadNext(SMetaReader *pReader);
|
||||||
const void *metaGetTableTagVal(void *tag, int16_t type, STagVal *tagVal);
|
const void *metaGetTableTagVal(void *tag, int16_t type, STagVal *tagVal);
|
||||||
int metaGetTableNameByUid(void *meta, uint64_t uid, char *tbName);
|
int metaGetTableNameByUid(void *meta, uint64_t uid, char *tbName);
|
||||||
int metaGetTableUidByName(void *meta, char *tbName, uint64_t *uid);
|
|
||||||
int metaGetTableTypeByName(void *meta, char *tbName, ETableType *tbType);
|
int metaGetTableSzNameByUid(void *meta, uint64_t uid, char *tbName);
|
||||||
bool metaIsTableExist(SMeta *pMeta, tb_uid_t uid);
|
int metaGetTableUidByName(void *meta, char *tbName, uint64_t *uid);
|
||||||
int32_t metaGetCachedTableUidList(SMeta *pMeta, tb_uid_t suid, const uint8_t *key, int32_t keyLen, SArray *pList,
|
int metaGetTableTypeByName(void *meta, char *tbName, ETableType *tbType);
|
||||||
bool *acquired);
|
bool metaIsTableExist(SMeta *pMeta, tb_uid_t uid);
|
||||||
int32_t metaUidFilterCachePut(SMeta *pMeta, uint64_t suid, const void *pKey, int32_t keyLen, void *pPayload,
|
int32_t metaGetCachedTableUidList(SMeta *pMeta, tb_uid_t suid, const uint8_t *key, int32_t keyLen, SArray *pList,
|
||||||
int32_t payloadLen, double selectivityRatio);
|
bool *acquired);
|
||||||
int32_t metaUidCacheClear(SMeta *pMeta, uint64_t suid);
|
int32_t metaUidFilterCachePut(SMeta *pMeta, uint64_t suid, const void *pKey, int32_t keyLen, void *pPayload,
|
||||||
|
int32_t payloadLen, double selectivityRatio);
|
||||||
|
int32_t metaUidCacheClear(SMeta *pMeta, uint64_t suid);
|
||||||
|
tb_uid_t metaGetTableEntryUidByName(SMeta *pMeta, const char *name);
|
||||||
|
int64_t metaGetTbNum(SMeta *pMeta);
|
||||||
|
int64_t metaGetNtbNum(SMeta *pMeta);
|
||||||
|
typedef struct {
|
||||||
|
int64_t uid;
|
||||||
|
int64_t ctbNum;
|
||||||
|
} SMetaStbStats;
|
||||||
|
int32_t metaGetStbStats(SMeta *pMeta, int64_t uid, SMetaStbStats *pInfo);
|
||||||
|
|
||||||
typedef struct SMetaFltParam {
|
typedef struct SMetaFltParam {
|
||||||
tb_uid_t suid;
|
tb_uid_t suid;
|
||||||
|
|
@ -159,20 +169,19 @@ typedef struct STsdbReader STsdbReader;
|
||||||
|
|
||||||
int32_t tsdbSetTableList(STsdbReader *pReader, const void *pTableList, int32_t num);
|
int32_t tsdbSetTableList(STsdbReader *pReader, const void *pTableList, int32_t num);
|
||||||
int32_t tsdbReaderOpen(SVnode *pVnode, SQueryTableDataCond *pCond, void *pTableList, int32_t numOfTables,
|
int32_t tsdbReaderOpen(SVnode *pVnode, SQueryTableDataCond *pCond, void *pTableList, int32_t numOfTables,
|
||||||
STsdbReader **ppReader, const char *idstr);
|
SSDataBlock *pResBlock, STsdbReader **ppReader, const char *idstr);
|
||||||
|
|
||||||
void tsdbReaderClose(STsdbReader *pReader);
|
void tsdbReaderClose(STsdbReader *pReader);
|
||||||
bool tsdbNextDataBlock(STsdbReader *pReader);
|
bool tsdbNextDataBlock(STsdbReader *pReader);
|
||||||
bool tsdbTableNextDataBlock(STsdbReader *pReader, uint64_t uid);
|
void tsdbRetrieveDataBlockInfo(const STsdbReader *pReader, int32_t *rows, uint64_t *uid, STimeWindow *pWindow);
|
||||||
void tsdbRetrieveDataBlockInfo(const STsdbReader *pReader, int32_t *rows, uint64_t *uid, STimeWindow *pWindow);
|
int32_t tsdbRetrieveDatablockSMA(STsdbReader *pReader, SColumnDataAgg ***pBlockSMA, bool *allHave);
|
||||||
int32_t tsdbRetrieveDatablockSMA(STsdbReader *pReader, SColumnDataAgg ***pBlockStatis, bool *allHave);
|
SSDataBlock *tsdbRetrieveDataBlock(STsdbReader *pTsdbReadHandle, SArray *pColumnIdList);
|
||||||
SArray *tsdbRetrieveDataBlock(STsdbReader *pTsdbReadHandle, SArray *pColumnIdList);
|
int32_t tsdbReaderReset(STsdbReader *pReader, SQueryTableDataCond *pCond);
|
||||||
int32_t tsdbReaderReset(STsdbReader *pReader, SQueryTableDataCond *pCond);
|
int32_t tsdbGetFileBlocksDistInfo(STsdbReader *pReader, STableBlockDistInfo *pTableBlockInfo);
|
||||||
int32_t tsdbGetFileBlocksDistInfo(STsdbReader *pReader, STableBlockDistInfo *pTableBlockInfo);
|
int64_t tsdbGetNumOfRowsInMemTable(STsdbReader *pHandle);
|
||||||
int64_t tsdbGetNumOfRowsInMemTable(STsdbReader *pHandle);
|
void *tsdbGetIdx(SMeta *pMeta);
|
||||||
void *tsdbGetIdx(SMeta *pMeta);
|
void *tsdbGetIvtIdx(SMeta *pMeta);
|
||||||
void *tsdbGetIvtIdx(SMeta *pMeta);
|
uint64_t getReaderMaxVersion(STsdbReader *pReader);
|
||||||
uint64_t getReaderMaxVersion(STsdbReader *pReader);
|
|
||||||
|
|
||||||
int32_t tsdbCacherowsReaderOpen(void *pVnode, int32_t type, void *pTableIdList, int32_t numOfTables, int32_t numOfCols,
|
int32_t tsdbCacherowsReaderOpen(void *pVnode, int32_t type, void *pTableIdList, int32_t numOfTables, int32_t numOfCols,
|
||||||
uint64_t suid, void **pReader);
|
uint64_t suid, void **pReader);
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ int32_t metaCacheDrop(SMeta* pMeta, int64_t uid);
|
||||||
int32_t metaStatsCacheUpsert(SMeta* pMeta, SMetaStbStats* pInfo);
|
int32_t metaStatsCacheUpsert(SMeta* pMeta, SMetaStbStats* pInfo);
|
||||||
int32_t metaStatsCacheDrop(SMeta* pMeta, int64_t uid);
|
int32_t metaStatsCacheDrop(SMeta* pMeta, int64_t uid);
|
||||||
int32_t metaStatsCacheGet(SMeta* pMeta, int64_t uid, SMetaStbStats* pInfo);
|
int32_t metaStatsCacheGet(SMeta* pMeta, int64_t uid, SMetaStbStats* pInfo);
|
||||||
void metaUpdateStbStats(SMeta *pMeta, int64_t uid, int64_t delta);
|
void metaUpdateStbStats(SMeta* pMeta, int64_t uid, int64_t delta);
|
||||||
int32_t metaUidFilterCacheGet(SMeta* pMeta, uint64_t suid, const void* pKey, int32_t keyLen, LRUHandle** pHandle);
|
int32_t metaUidFilterCacheGet(SMeta* pMeta, uint64_t suid, const void* pKey, int32_t keyLen, LRUHandle** pHandle);
|
||||||
|
|
||||||
struct SMeta {
|
struct SMeta {
|
||||||
|
|
@ -79,7 +79,7 @@ struct SMeta {
|
||||||
char* path;
|
char* path;
|
||||||
SVnode* pVnode;
|
SVnode* pVnode;
|
||||||
TDB* pEnv;
|
TDB* pEnv;
|
||||||
TXN txn;
|
TXN* txn;
|
||||||
TTB* pTbDb;
|
TTB* pTbDb;
|
||||||
TTB* pSkmDb;
|
TTB* pSkmDb;
|
||||||
TTB* pUidIdx;
|
TTB* pUidIdx;
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ void vnodeBufPoolReset(SVBufPool* pPool);
|
||||||
|
|
||||||
// vnodeQuery.c
|
// vnodeQuery.c
|
||||||
int32_t vnodeQueryOpen(SVnode* pVnode);
|
int32_t vnodeQueryOpen(SVnode* pVnode);
|
||||||
void vnodeQueryPreClose(SVnode *pVnode);
|
void vnodeQueryPreClose(SVnode* pVnode);
|
||||||
void vnodeQueryClose(SVnode* pVnode);
|
void vnodeQueryClose(SVnode* pVnode);
|
||||||
int32_t vnodeGetTableMeta(SVnode* pVnode, SRpcMsg* pMsg, bool direct);
|
int32_t vnodeGetTableMeta(SVnode* pVnode, SRpcMsg* pMsg, bool direct);
|
||||||
int vnodeGetTableCfg(SVnode* pVnode, SRpcMsg* pMsg, bool direct);
|
int vnodeGetTableCfg(SVnode* pVnode, SRpcMsg* pMsg, bool direct);
|
||||||
|
|
@ -86,7 +86,6 @@ int32_t vnodeGetBatchMeta(SVnode* pVnode, SRpcMsg* pMsg);
|
||||||
// vnodeCommit.c
|
// vnodeCommit.c
|
||||||
int32_t vnodeBegin(SVnode* pVnode);
|
int32_t vnodeBegin(SVnode* pVnode);
|
||||||
int32_t vnodeShouldCommit(SVnode* pVnode);
|
int32_t vnodeShouldCommit(SVnode* pVnode);
|
||||||
int32_t vnodeCommit(SVnode* pVnode);
|
|
||||||
void vnodeRollback(SVnode* pVnode);
|
void vnodeRollback(SVnode* pVnode);
|
||||||
int32_t vnodeSaveInfo(const char* dir, const SVnodeInfo* pCfg);
|
int32_t vnodeSaveInfo(const char* dir, const SVnodeInfo* pCfg);
|
||||||
int32_t vnodeCommitInfo(const char* dir, const SVnodeInfo* pInfo);
|
int32_t vnodeCommitInfo(const char* dir, const SVnodeInfo* pInfo);
|
||||||
|
|
@ -100,7 +99,7 @@ int32_t vnodeSyncOpen(SVnode* pVnode, char* path);
|
||||||
int32_t vnodeSyncStart(SVnode* pVnode);
|
int32_t vnodeSyncStart(SVnode* pVnode);
|
||||||
void vnodeSyncPreClose(SVnode* pVnode);
|
void vnodeSyncPreClose(SVnode* pVnode);
|
||||||
void vnodeSyncClose(SVnode* pVnode);
|
void vnodeSyncClose(SVnode* pVnode);
|
||||||
void vnodeRedirectRpcMsg(SVnode* pVnode, SRpcMsg* pMsg);
|
void vnodeRedirectRpcMsg(SVnode* pVnode, SRpcMsg* pMsg, int32_t code);
|
||||||
bool vnodeIsLeader(SVnode* pVnode);
|
bool vnodeIsLeader(SVnode* pVnode);
|
||||||
bool vnodeIsRoleLeader(SVnode* pVnode);
|
bool vnodeIsRoleLeader(SVnode* pVnode);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ typedef struct SStreamStateWriter SStreamStateWriter;
|
||||||
typedef struct SRSmaSnapReader SRSmaSnapReader;
|
typedef struct SRSmaSnapReader SRSmaSnapReader;
|
||||||
typedef struct SRSmaSnapWriter SRSmaSnapWriter;
|
typedef struct SRSmaSnapWriter SRSmaSnapWriter;
|
||||||
typedef struct SSnapDataHdr SSnapDataHdr;
|
typedef struct SSnapDataHdr SSnapDataHdr;
|
||||||
|
typedef struct SCommitInfo SCommitInfo;
|
||||||
|
|
||||||
#define VNODE_META_DIR "meta"
|
#define VNODE_META_DIR "meta"
|
||||||
#define VNODE_TSDB_DIR "tsdb"
|
#define VNODE_TSDB_DIR "tsdb"
|
||||||
|
|
@ -100,8 +101,9 @@ typedef struct STbUidStore STbUidStore;
|
||||||
int metaOpen(SVnode* pVnode, SMeta** ppMeta, int8_t rollback);
|
int metaOpen(SVnode* pVnode, SMeta** ppMeta, int8_t rollback);
|
||||||
int metaClose(SMeta* pMeta);
|
int metaClose(SMeta* pMeta);
|
||||||
int metaBegin(SMeta* pMeta, int8_t fromSys);
|
int metaBegin(SMeta* pMeta, int8_t fromSys);
|
||||||
int metaCommit(SMeta* pMeta);
|
TXN* metaGetTxn(SMeta* pMeta);
|
||||||
int metaFinishCommit(SMeta* pMeta);
|
int metaCommit(SMeta* pMeta, TXN* txn);
|
||||||
|
int metaFinishCommit(SMeta* pMeta, TXN* txn);
|
||||||
int metaPrepareAsyncCommit(SMeta* pMeta);
|
int metaPrepareAsyncCommit(SMeta* pMeta);
|
||||||
int metaCreateSTable(SMeta* pMeta, int64_t version, SVCreateStbReq* pReq);
|
int metaCreateSTable(SMeta* pMeta, int64_t version, SVCreateStbReq* pReq);
|
||||||
int metaAlterSTable(SMeta* pMeta, int64_t version, SVCreateStbReq* pReq);
|
int metaAlterSTable(SMeta* pMeta, int64_t version, SVCreateStbReq* pReq);
|
||||||
|
|
@ -116,8 +118,6 @@ int32_t metaGetTbTSchemaEx(SMeta* pMeta, tb_uid_t suid, tb_uid_t uid, in
|
||||||
int metaGetTableEntryByName(SMetaReader* pReader, const char* name);
|
int metaGetTableEntryByName(SMetaReader* pReader, const char* name);
|
||||||
int metaAlterCache(SMeta* pMeta, int32_t nPage);
|
int metaAlterCache(SMeta* pMeta, int32_t nPage);
|
||||||
|
|
||||||
tb_uid_t metaGetTableEntryUidByName(SMeta* pMeta, const char* name);
|
|
||||||
int64_t metaGetTbNum(SMeta* pMeta);
|
|
||||||
int64_t metaGetTimeSeriesNum(SMeta* pMeta);
|
int64_t metaGetTimeSeriesNum(SMeta* pMeta);
|
||||||
SMCtbCursor* metaOpenCtbCursor(SMeta* pMeta, tb_uid_t uid, int lock);
|
SMCtbCursor* metaOpenCtbCursor(SMeta* pMeta, tb_uid_t uid, int lock);
|
||||||
void metaCloseCtbCursor(SMCtbCursor* pCtbCur, int lock);
|
void metaCloseCtbCursor(SMCtbCursor* pCtbCur, int lock);
|
||||||
|
|
@ -144,17 +144,12 @@ typedef struct SMetaInfo {
|
||||||
} SMetaInfo;
|
} SMetaInfo;
|
||||||
int32_t metaGetInfo(SMeta* pMeta, int64_t uid, SMetaInfo* pInfo, SMetaReader* pReader);
|
int32_t metaGetInfo(SMeta* pMeta, int64_t uid, SMetaInfo* pInfo, SMetaReader* pReader);
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int64_t uid;
|
|
||||||
int64_t ctbNum;
|
|
||||||
} SMetaStbStats;
|
|
||||||
int32_t metaGetStbStats(SMeta* pMeta, int64_t uid, SMetaStbStats* pInfo);
|
|
||||||
|
|
||||||
// tsdb
|
// tsdb
|
||||||
int tsdbOpen(SVnode* pVnode, STsdb** ppTsdb, const char* dir, STsdbKeepCfg* pKeepCfg, int8_t rollback);
|
int tsdbOpen(SVnode* pVnode, STsdb** ppTsdb, const char* dir, STsdbKeepCfg* pKeepCfg, int8_t rollback);
|
||||||
int tsdbClose(STsdb** pTsdb);
|
int tsdbClose(STsdb** pTsdb);
|
||||||
int32_t tsdbBegin(STsdb* pTsdb);
|
int32_t tsdbBegin(STsdb* pTsdb);
|
||||||
int32_t tsdbCommit(STsdb* pTsdb);
|
int32_t tsdbPrepareCommit(STsdb* pTsdb);
|
||||||
|
int32_t tsdbCommit(STsdb* pTsdb, SCommitInfo* pInfo);
|
||||||
int32_t tsdbFinishCommit(STsdb* pTsdb);
|
int32_t tsdbFinishCommit(STsdb* pTsdb);
|
||||||
int32_t tsdbRollbackCommit(STsdb* pTsdb);
|
int32_t tsdbRollbackCommit(STsdb* pTsdb);
|
||||||
int32_t tsdbDoRetention(STsdb* pTsdb, int64_t now);
|
int32_t tsdbDoRetention(STsdb* pTsdb, int64_t now);
|
||||||
|
|
@ -210,8 +205,8 @@ int32_t smaBegin(SSma* pSma);
|
||||||
int32_t smaSyncPreCommit(SSma* pSma);
|
int32_t smaSyncPreCommit(SSma* pSma);
|
||||||
int32_t smaSyncCommit(SSma* pSma);
|
int32_t smaSyncCommit(SSma* pSma);
|
||||||
int32_t smaSyncPostCommit(SSma* pSma);
|
int32_t smaSyncPostCommit(SSma* pSma);
|
||||||
int32_t smaPreCommit(SSma* pSma);
|
int32_t smaPrepareAsyncCommit(SSma* pSma);
|
||||||
int32_t smaCommit(SSma* pSma);
|
int32_t smaCommit(SSma* pSma, SCommitInfo* pInfo);
|
||||||
int32_t smaFinishCommit(SSma* pSma);
|
int32_t smaFinishCommit(SSma* pSma);
|
||||||
int32_t smaPostCommit(SSma* pSma);
|
int32_t smaPostCommit(SSma* pSma);
|
||||||
int32_t smaDoRetention(SSma* pSma, int64_t now);
|
int32_t smaDoRetention(SSma* pSma, int64_t now);
|
||||||
|
|
@ -413,6 +408,12 @@ struct SSnapDataHdr {
|
||||||
uint8_t data[];
|
uint8_t data[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct SCommitInfo {
|
||||||
|
SVnodeInfo info;
|
||||||
|
SVnode* pVnode;
|
||||||
|
TXN* txn;
|
||||||
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,19 @@ static FORCE_INLINE void metaFree(void *pPool, void *p) { vnodeBufPoolFree((SVB
|
||||||
|
|
||||||
// begin a meta txn
|
// begin a meta txn
|
||||||
int metaBegin(SMeta *pMeta, int8_t fromSys) {
|
int metaBegin(SMeta *pMeta, int8_t fromSys) {
|
||||||
|
void *(*xMalloc)(void *, size_t);
|
||||||
|
void (*xFree)(void *, void *);
|
||||||
|
void *xArg = NULL;
|
||||||
|
|
||||||
if (fromSys) {
|
if (fromSys) {
|
||||||
tdbTxnOpen(&pMeta->txn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED);
|
xMalloc = tdbDefaultMalloc;
|
||||||
|
xFree = tdbDefaultFree;
|
||||||
} else {
|
} else {
|
||||||
tdbTxnOpen(&pMeta->txn, 0, metaMalloc, metaFree, pMeta->pVnode->inUse, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED);
|
xMalloc = metaMalloc;
|
||||||
|
xFree = metaFree;
|
||||||
|
xArg = pMeta->pVnode->inUse;
|
||||||
}
|
}
|
||||||
if (tdbBegin(pMeta->pEnv, &pMeta->txn) < 0) {
|
if (tdbBegin(pMeta->pEnv, &pMeta->txn, xMalloc, xFree, xArg, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -33,9 +40,16 @@ int metaBegin(SMeta *pMeta, int8_t fromSys) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// commit the meta txn
|
// commit the meta txn
|
||||||
int metaCommit(SMeta *pMeta) { return tdbCommit(pMeta->pEnv, &pMeta->txn); }
|
TXN *metaGetTxn(SMeta *pMeta) { return pMeta->txn; }
|
||||||
int metaFinishCommit(SMeta *pMeta) { return tdbPostCommit(pMeta->pEnv, &pMeta->txn); }
|
int metaCommit(SMeta *pMeta, TXN *txn) { return tdbCommit(pMeta->pEnv, txn); }
|
||||||
int metaPrepareAsyncCommit(SMeta *pMeta) { return tdbPrepareAsyncCommit(pMeta->pEnv, &pMeta->txn); }
|
int metaFinishCommit(SMeta *pMeta, TXN *txn) { return tdbPostCommit(pMeta->pEnv, txn); }
|
||||||
|
int metaPrepareAsyncCommit(SMeta *pMeta) {
|
||||||
|
// return tdbPrepareAsyncCommit(pMeta->pEnv, pMeta->txn);
|
||||||
|
int code = 0;
|
||||||
|
code = tdbCommit(pMeta->pEnv, pMeta->txn);
|
||||||
|
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
// abort the meta txn
|
// abort the meta txn
|
||||||
int metaAbort(SMeta *pMeta) { return tdbAbort(pMeta->pEnv, &pMeta->txn); }
|
int metaAbort(SMeta *pMeta) { return tdbAbort(pMeta->pEnv, pMeta->txn); }
|
||||||
|
|
|
||||||
|
|
@ -223,6 +223,23 @@ int metaGetTableNameByUid(void *meta, uint64_t uid, char *tbName) {
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int metaGetTableSzNameByUid(void *meta, uint64_t uid, char *tbName) {
|
||||||
|
int code = 0;
|
||||||
|
SMetaReader mr = {0};
|
||||||
|
metaReaderInit(&mr, (SMeta *)meta, 0);
|
||||||
|
code = metaGetTableEntryByUid(&mr, uid);
|
||||||
|
if (code < 0) {
|
||||||
|
metaReaderClear(&mr);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
strncpy(tbName, mr.me.name, TSDB_TABLE_NAME_LEN);
|
||||||
|
metaReaderClear(&mr);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int metaGetTableUidByName(void *meta, char *tbName, uint64_t *uid) {
|
int metaGetTableUidByName(void *meta, char *tbName, uint64_t *uid) {
|
||||||
int code = 0;
|
int code = 0;
|
||||||
SMetaReader mr = {0};
|
SMetaReader mr = {0};
|
||||||
|
|
@ -720,6 +737,10 @@ int64_t metaGetTimeSeriesNum(SMeta *pMeta) {
|
||||||
return pMeta->pVnode->config.vndStats.numOfTimeSeries + pMeta->pVnode->config.vndStats.numOfNTimeSeries;
|
return pMeta->pVnode->config.vndStats.numOfTimeSeries + pMeta->pVnode->config.vndStats.numOfNTimeSeries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t metaGetNtbNum(SMeta *pMeta) {
|
||||||
|
return pMeta->pVnode->config.vndStats.numOfNTables;
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SMeta *pMeta;
|
SMeta *pMeta;
|
||||||
TBC *pCur;
|
TBC *pCur;
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ static int metaSaveSmaToDB(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
tEncoderClear(&coder);
|
tEncoderClear(&coder);
|
||||||
|
|
||||||
// write to table.db
|
// write to table.db
|
||||||
if (tdbTbInsert(pMeta->pTbDb, pKey, kLen, pVal, vLen, &pMeta->txn) < 0) {
|
if (tdbTbInsert(pMeta->pTbDb, pKey, kLen, pVal, vLen, pMeta->txn) < 0) {
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -131,17 +131,17 @@ _err:
|
||||||
|
|
||||||
static int metaUpdateUidIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
static int metaUpdateUidIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
SUidIdxVal uidIdxVal = {.suid = pME->smaEntry.tsma->indexUid, .version = pME->version, .skmVer = 0};
|
SUidIdxVal uidIdxVal = {.suid = pME->smaEntry.tsma->indexUid, .version = pME->version, .skmVer = 0};
|
||||||
return tdbTbInsert(pMeta->pUidIdx, &pME->uid, sizeof(tb_uid_t), &uidIdxVal, sizeof(uidIdxVal), &pMeta->txn);
|
return tdbTbInsert(pMeta->pUidIdx, &pME->uid, sizeof(tb_uid_t), &uidIdxVal, sizeof(uidIdxVal), pMeta->txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int metaUpdateNameIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
static int metaUpdateNameIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
return tdbTbInsert(pMeta->pNameIdx, pME->name, strlen(pME->name) + 1, &pME->uid, sizeof(tb_uid_t), &pMeta->txn);
|
return tdbTbInsert(pMeta->pNameIdx, pME->name, strlen(pME->name) + 1, &pME->uid, sizeof(tb_uid_t), pMeta->txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int metaUpdateSmaIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
static int metaUpdateSmaIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
SSmaIdxKey smaIdxKey = {.uid = pME->smaEntry.tsma->tableUid, .smaUid = pME->smaEntry.tsma->indexUid};
|
SSmaIdxKey smaIdxKey = {.uid = pME->smaEntry.tsma->tableUid, .smaUid = pME->smaEntry.tsma->indexUid};
|
||||||
|
|
||||||
return tdbTbInsert(pMeta->pSmaIdx, &smaIdxKey, sizeof(smaIdxKey), NULL, 0, &pMeta->txn);
|
return tdbTbInsert(pMeta->pSmaIdx, &smaIdxKey, sizeof(smaIdxKey), NULL, 0, pMeta->txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int metaHandleSmaEntry(SMeta *pMeta, const SMetaEntry *pME) {
|
static int metaHandleSmaEntry(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
|
|
|
||||||
|
|
@ -163,9 +163,9 @@ int32_t metaSnapWriterClose(SMetaSnapWriter** ppWriter, int8_t rollback) {
|
||||||
if (rollback) {
|
if (rollback) {
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
} else {
|
} else {
|
||||||
code = metaCommit(pWriter->pMeta);
|
code = metaCommit(pWriter->pMeta, pWriter->pMeta->txn);
|
||||||
if (code) goto _err;
|
if (code) goto _err;
|
||||||
code = metaFinishCommit(pWriter->pMeta);
|
code = metaFinishCommit(pWriter->pMeta, pWriter->pMeta->txn);
|
||||||
if (code) goto _err;
|
if (code) goto _err;
|
||||||
}
|
}
|
||||||
taosMemoryFree(pWriter);
|
taosMemoryFree(pWriter);
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,7 @@ int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq, SArray *tb
|
||||||
// drop all child tables
|
// drop all child tables
|
||||||
TBC *pCtbIdxc = NULL;
|
TBC *pCtbIdxc = NULL;
|
||||||
|
|
||||||
tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, &pMeta->txn);
|
tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, NULL);
|
||||||
rc = tdbTbcMoveTo(pCtbIdxc, &(SCtbIdxKey){.suid = pReq->suid, .uid = INT64_MIN}, sizeof(SCtbIdxKey), &c);
|
rc = tdbTbcMoveTo(pCtbIdxc, &(SCtbIdxKey){.suid = pReq->suid, .uid = INT64_MIN}, sizeof(SCtbIdxKey), &c);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
tdbTbcClose(pCtbIdxc);
|
tdbTbcClose(pCtbIdxc);
|
||||||
|
|
@ -295,10 +295,10 @@ int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq, SArray *tb
|
||||||
_drop_super_table:
|
_drop_super_table:
|
||||||
tdbTbGet(pMeta->pUidIdx, &pReq->suid, sizeof(tb_uid_t), &pData, &nData);
|
tdbTbGet(pMeta->pUidIdx, &pReq->suid, sizeof(tb_uid_t), &pData, &nData);
|
||||||
tdbTbDelete(pMeta->pTbDb, &(STbDbKey){.version = ((SUidIdxVal *)pData)[0].version, .uid = pReq->suid},
|
tdbTbDelete(pMeta->pTbDb, &(STbDbKey){.version = ((SUidIdxVal *)pData)[0].version, .uid = pReq->suid},
|
||||||
sizeof(STbDbKey), &pMeta->txn);
|
sizeof(STbDbKey), pMeta->txn);
|
||||||
tdbTbDelete(pMeta->pNameIdx, pReq->name, strlen(pReq->name) + 1, &pMeta->txn);
|
tdbTbDelete(pMeta->pNameIdx, pReq->name, strlen(pReq->name) + 1, pMeta->txn);
|
||||||
tdbTbDelete(pMeta->pUidIdx, &pReq->suid, sizeof(tb_uid_t), &pMeta->txn);
|
tdbTbDelete(pMeta->pUidIdx, &pReq->suid, sizeof(tb_uid_t), pMeta->txn);
|
||||||
tdbTbDelete(pMeta->pSuidIdx, &pReq->suid, sizeof(tb_uid_t), &pMeta->txn);
|
tdbTbDelete(pMeta->pSuidIdx, &pReq->suid, sizeof(tb_uid_t), pMeta->txn);
|
||||||
|
|
||||||
metaULock(pMeta);
|
metaULock(pMeta);
|
||||||
|
|
||||||
|
|
@ -321,7 +321,7 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
||||||
int32_t ret;
|
int32_t ret;
|
||||||
int32_t c = -2;
|
int32_t c = -2;
|
||||||
|
|
||||||
tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, &pMeta->txn);
|
tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL);
|
||||||
ret = tdbTbcMoveTo(pUidIdxc, &pReq->suid, sizeof(tb_uid_t), &c);
|
ret = tdbTbcMoveTo(pUidIdxc, &pReq->suid, sizeof(tb_uid_t), &c);
|
||||||
if (ret < 0 || c) {
|
if (ret < 0 || c) {
|
||||||
tdbTbcClose(pUidIdxc);
|
tdbTbcClose(pUidIdxc);
|
||||||
|
|
@ -340,7 +340,7 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
||||||
|
|
||||||
oversion = ((SUidIdxVal *)pData)[0].version;
|
oversion = ((SUidIdxVal *)pData)[0].version;
|
||||||
|
|
||||||
tdbTbcOpen(pMeta->pTbDb, &pTbDbc, &pMeta->txn);
|
tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL);
|
||||||
ret = tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = pReq->suid, .version = oversion}), sizeof(STbDbKey), &c);
|
ret = tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = pReq->suid, .version = oversion}), sizeof(STbDbKey), &c);
|
||||||
ASSERT(ret == 0 && c == 0);
|
ASSERT(ret == 0 && c == 0);
|
||||||
|
|
||||||
|
|
@ -595,7 +595,7 @@ static int metaDeleteTtlIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
STtlIdxKey ttlKey = {0};
|
STtlIdxKey ttlKey = {0};
|
||||||
metaBuildTtlIdxKey(&ttlKey, pME);
|
metaBuildTtlIdxKey(&ttlKey, pME);
|
||||||
if (ttlKey.dtime == 0) return 0;
|
if (ttlKey.dtime == 0) return 0;
|
||||||
return tdbTbDelete(pMeta->pTtlIdx, &ttlKey, sizeof(ttlKey), &pMeta->txn);
|
return tdbTbDelete(pMeta->pTtlIdx, &ttlKey, sizeof(ttlKey), pMeta->txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
|
static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
|
||||||
|
|
@ -657,7 +657,7 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
|
||||||
|
|
||||||
if (metaCreateTagIdxKey(e.ctbEntry.suid, pTagColumn->colId, pTagData, nTagData, pTagColumn->type, uid,
|
if (metaCreateTagIdxKey(e.ctbEntry.suid, pTagColumn->colId, pTagData, nTagData, pTagColumn->type, uid,
|
||||||
&pTagIdxKey, &nTagIdxKey) == 0) {
|
&pTagIdxKey, &nTagIdxKey) == 0) {
|
||||||
tdbTbDelete(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, &pMeta->txn);
|
tdbTbDelete(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, pMeta->txn);
|
||||||
}
|
}
|
||||||
metaDestroyTagIdxKey(pTagIdxKey);
|
metaDestroyTagIdxKey(pTagIdxKey);
|
||||||
}
|
}
|
||||||
|
|
@ -667,9 +667,9 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tdbTbDelete(pMeta->pTbDb, &(STbDbKey){.version = version, .uid = uid}, sizeof(STbDbKey), &pMeta->txn);
|
tdbTbDelete(pMeta->pTbDb, &(STbDbKey){.version = version, .uid = uid}, sizeof(STbDbKey), pMeta->txn);
|
||||||
tdbTbDelete(pMeta->pNameIdx, e.name, strlen(e.name) + 1, &pMeta->txn);
|
tdbTbDelete(pMeta->pNameIdx, e.name, strlen(e.name) + 1, pMeta->txn);
|
||||||
tdbTbDelete(pMeta->pUidIdx, &uid, sizeof(uid), &pMeta->txn);
|
tdbTbDelete(pMeta->pUidIdx, &uid, sizeof(uid), pMeta->txn);
|
||||||
|
|
||||||
if (e.type == TSDB_CHILD_TABLE || e.type == TSDB_NORMAL_TABLE) metaDeleteCtimeIdx(pMeta, &e);
|
if (e.type == TSDB_CHILD_TABLE || e.type == TSDB_NORMAL_TABLE) metaDeleteCtimeIdx(pMeta, &e);
|
||||||
if (e.type == TSDB_NORMAL_TABLE) metaDeleteNcolIdx(pMeta, &e);
|
if (e.type == TSDB_NORMAL_TABLE) metaDeleteNcolIdx(pMeta, &e);
|
||||||
|
|
@ -677,7 +677,7 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
|
||||||
if (e.type != TSDB_SUPER_TABLE) metaDeleteTtlIdx(pMeta, &e);
|
if (e.type != TSDB_SUPER_TABLE) metaDeleteTtlIdx(pMeta, &e);
|
||||||
|
|
||||||
if (e.type == TSDB_CHILD_TABLE) {
|
if (e.type == TSDB_CHILD_TABLE) {
|
||||||
tdbTbDelete(pMeta->pCtbIdx, &(SCtbIdxKey){.suid = e.ctbEntry.suid, .uid = uid}, sizeof(SCtbIdxKey), &pMeta->txn);
|
tdbTbDelete(pMeta->pCtbIdx, &(SCtbIdxKey){.suid = e.ctbEntry.suid, .uid = uid}, sizeof(SCtbIdxKey), pMeta->txn);
|
||||||
|
|
||||||
--pMeta->pVnode->config.vndStats.numOfCTables;
|
--pMeta->pVnode->config.vndStats.numOfCTables;
|
||||||
|
|
||||||
|
|
@ -689,7 +689,7 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
|
||||||
--pMeta->pVnode->config.vndStats.numOfNTables;
|
--pMeta->pVnode->config.vndStats.numOfNTables;
|
||||||
pMeta->pVnode->config.vndStats.numOfNTimeSeries -= e.ntbEntry.schemaRow.nCols - 1;
|
pMeta->pVnode->config.vndStats.numOfNTimeSeries -= e.ntbEntry.schemaRow.nCols - 1;
|
||||||
} else if (e.type == TSDB_SUPER_TABLE) {
|
} else if (e.type == TSDB_SUPER_TABLE) {
|
||||||
tdbTbDelete(pMeta->pSuidIdx, &e.uid, sizeof(tb_uid_t), &pMeta->txn);
|
tdbTbDelete(pMeta->pSuidIdx, &e.uid, sizeof(tb_uid_t), pMeta->txn);
|
||||||
// drop schema.db (todo)
|
// drop schema.db (todo)
|
||||||
|
|
||||||
metaStatsCacheDrop(pMeta, uid);
|
metaStatsCacheDrop(pMeta, uid);
|
||||||
|
|
@ -710,7 +710,7 @@ int metaUpdateCtimeIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
if (metaBuildCtimeIdxKey(&ctimeKey, pME) < 0) {
|
if (metaBuildCtimeIdxKey(&ctimeKey, pME) < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return tdbTbInsert(pMeta->pCtimeIdx, &ctimeKey, sizeof(ctimeKey), NULL, 0, &pMeta->txn);
|
return tdbTbInsert(pMeta->pCtimeIdx, &ctimeKey, sizeof(ctimeKey), NULL, 0, pMeta->txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
int metaDeleteCtimeIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
int metaDeleteCtimeIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
|
|
@ -718,14 +718,14 @@ int metaDeleteCtimeIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
if (metaBuildCtimeIdxKey(&ctimeKey, pME) < 0) {
|
if (metaBuildCtimeIdxKey(&ctimeKey, pME) < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return tdbTbDelete(pMeta->pCtimeIdx, &ctimeKey, sizeof(ctimeKey), &pMeta->txn);
|
return tdbTbDelete(pMeta->pCtimeIdx, &ctimeKey, sizeof(ctimeKey), pMeta->txn);
|
||||||
}
|
}
|
||||||
int metaUpdateNcolIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
int metaUpdateNcolIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
SNcolIdxKey ncolKey = {0};
|
SNcolIdxKey ncolKey = {0};
|
||||||
if (metaBuildNColIdxKey(&ncolKey, pME) < 0) {
|
if (metaBuildNColIdxKey(&ncolKey, pME) < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return tdbTbInsert(pMeta->pNcolIdx, &ncolKey, sizeof(ncolKey), NULL, 0, &pMeta->txn);
|
return tdbTbInsert(pMeta->pNcolIdx, &ncolKey, sizeof(ncolKey), NULL, 0, pMeta->txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
int metaDeleteNcolIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
int metaDeleteNcolIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
|
|
@ -733,7 +733,7 @@ int metaDeleteNcolIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
if (metaBuildNColIdxKey(&ncolKey, pME) < 0) {
|
if (metaBuildNColIdxKey(&ncolKey, pME) < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return tdbTbDelete(pMeta->pNcolIdx, &ncolKey, sizeof(ncolKey), &pMeta->txn);
|
return tdbTbDelete(pMeta->pNcolIdx, &ncolKey, sizeof(ncolKey), pMeta->txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTbReq, STableMetaRsp *pMetaRsp) {
|
static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTbReq, STableMetaRsp *pMetaRsp) {
|
||||||
|
|
@ -768,7 +768,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
|
||||||
// search uid index
|
// search uid index
|
||||||
TBC *pUidIdxc = NULL;
|
TBC *pUidIdxc = NULL;
|
||||||
|
|
||||||
tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, &pMeta->txn);
|
tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL);
|
||||||
tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c);
|
tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c);
|
||||||
ASSERT(c == 0);
|
ASSERT(c == 0);
|
||||||
|
|
||||||
|
|
@ -778,7 +778,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
|
||||||
// search table.db
|
// search table.db
|
||||||
TBC *pTbDbc = NULL;
|
TBC *pTbDbc = NULL;
|
||||||
|
|
||||||
tdbTbcOpen(pMeta->pTbDb, &pTbDbc, &pMeta->txn);
|
tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL);
|
||||||
tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c);
|
tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c);
|
||||||
ASSERT(c == 0);
|
ASSERT(c == 0);
|
||||||
tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData);
|
tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData);
|
||||||
|
|
@ -959,7 +959,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
|
||||||
// search uid index
|
// search uid index
|
||||||
TBC *pUidIdxc = NULL;
|
TBC *pUidIdxc = NULL;
|
||||||
|
|
||||||
tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, &pMeta->txn);
|
tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL);
|
||||||
tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c);
|
tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c);
|
||||||
ASSERT(c == 0);
|
ASSERT(c == 0);
|
||||||
|
|
||||||
|
|
@ -972,7 +972,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
|
||||||
SDecoder dc2 = {0};
|
SDecoder dc2 = {0};
|
||||||
|
|
||||||
/* get ctbEntry */
|
/* get ctbEntry */
|
||||||
tdbTbcOpen(pMeta->pTbDb, &pTbDbc, &pMeta->txn);
|
tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL);
|
||||||
tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c);
|
tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c);
|
||||||
ASSERT(c == 0);
|
ASSERT(c == 0);
|
||||||
tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData);
|
tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData);
|
||||||
|
|
@ -1075,7 +1075,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
|
||||||
ASSERT(ctbEntry.ctbEntry.pTags);
|
ASSERT(ctbEntry.ctbEntry.pTags);
|
||||||
SCtbIdxKey ctbIdxKey = {.suid = ctbEntry.ctbEntry.suid, .uid = uid};
|
SCtbIdxKey ctbIdxKey = {.suid = ctbEntry.ctbEntry.suid, .uid = uid};
|
||||||
tdbTbUpsert(pMeta->pCtbIdx, &ctbIdxKey, sizeof(ctbIdxKey), ctbEntry.ctbEntry.pTags,
|
tdbTbUpsert(pMeta->pCtbIdx, &ctbIdxKey, sizeof(ctbIdxKey), ctbEntry.ctbEntry.pTags,
|
||||||
((STag *)(ctbEntry.ctbEntry.pTags))->len, &pMeta->txn);
|
((STag *)(ctbEntry.ctbEntry.pTags))->len, pMeta->txn);
|
||||||
|
|
||||||
metaUidCacheClear(pMeta, ctbEntry.ctbEntry.suid);
|
metaUidCacheClear(pMeta, ctbEntry.ctbEntry.suid);
|
||||||
|
|
||||||
|
|
@ -1125,7 +1125,7 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p
|
||||||
// search uid index
|
// search uid index
|
||||||
TBC *pUidIdxc = NULL;
|
TBC *pUidIdxc = NULL;
|
||||||
|
|
||||||
tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, &pMeta->txn);
|
tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL);
|
||||||
tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c);
|
tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c);
|
||||||
ASSERT(c == 0);
|
ASSERT(c == 0);
|
||||||
|
|
||||||
|
|
@ -1135,7 +1135,7 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p
|
||||||
// search table.db
|
// search table.db
|
||||||
TBC *pTbDbc = NULL;
|
TBC *pTbDbc = NULL;
|
||||||
|
|
||||||
tdbTbcOpen(pMeta->pTbDb, &pTbDbc, &pMeta->txn);
|
tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL);
|
||||||
tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c);
|
tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c);
|
||||||
ASSERT(c == 0);
|
ASSERT(c == 0);
|
||||||
tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData);
|
tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData);
|
||||||
|
|
@ -1242,7 +1242,7 @@ static int metaSaveToTbDb(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
tEncoderClear(&coder);
|
tEncoderClear(&coder);
|
||||||
|
|
||||||
// write to table.db
|
// write to table.db
|
||||||
if (tdbTbInsert(pMeta->pTbDb, pKey, kLen, pVal, vLen, &pMeta->txn) < 0) {
|
if (tdbTbInsert(pMeta->pTbDb, pKey, kLen, pVal, vLen, pMeta->txn) < 0) {
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1265,29 +1265,29 @@ static int metaUpdateUidIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
|
|
||||||
SUidIdxVal uidIdxVal = {.suid = info.suid, .version = info.version, .skmVer = info.skmVer};
|
SUidIdxVal uidIdxVal = {.suid = info.suid, .version = info.version, .skmVer = info.skmVer};
|
||||||
|
|
||||||
return tdbTbUpsert(pMeta->pUidIdx, &pME->uid, sizeof(tb_uid_t), &uidIdxVal, sizeof(uidIdxVal), &pMeta->txn);
|
return tdbTbUpsert(pMeta->pUidIdx, &pME->uid, sizeof(tb_uid_t), &uidIdxVal, sizeof(uidIdxVal), pMeta->txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int metaUpdateSuidIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
static int metaUpdateSuidIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
return tdbTbInsert(pMeta->pSuidIdx, &pME->uid, sizeof(tb_uid_t), NULL, 0, &pMeta->txn);
|
return tdbTbInsert(pMeta->pSuidIdx, &pME->uid, sizeof(tb_uid_t), NULL, 0, pMeta->txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int metaUpdateNameIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
static int metaUpdateNameIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
return tdbTbInsert(pMeta->pNameIdx, pME->name, strlen(pME->name) + 1, &pME->uid, sizeof(tb_uid_t), &pMeta->txn);
|
return tdbTbInsert(pMeta->pNameIdx, pME->name, strlen(pME->name) + 1, &pME->uid, sizeof(tb_uid_t), pMeta->txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int metaUpdateTtlIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
static int metaUpdateTtlIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
STtlIdxKey ttlKey = {0};
|
STtlIdxKey ttlKey = {0};
|
||||||
metaBuildTtlIdxKey(&ttlKey, pME);
|
metaBuildTtlIdxKey(&ttlKey, pME);
|
||||||
if (ttlKey.dtime == 0) return 0;
|
if (ttlKey.dtime == 0) return 0;
|
||||||
return tdbTbInsert(pMeta->pTtlIdx, &ttlKey, sizeof(ttlKey), NULL, 0, &pMeta->txn);
|
return tdbTbInsert(pMeta->pTtlIdx, &ttlKey, sizeof(ttlKey), NULL, 0, pMeta->txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int metaUpdateCtbIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
static int metaUpdateCtbIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
SCtbIdxKey ctbIdxKey = {.suid = pME->ctbEntry.suid, .uid = pME->uid};
|
SCtbIdxKey ctbIdxKey = {.suid = pME->ctbEntry.suid, .uid = pME->uid};
|
||||||
|
|
||||||
return tdbTbInsert(pMeta->pCtbIdx, &ctbIdxKey, sizeof(ctbIdxKey), pME->ctbEntry.pTags,
|
return tdbTbInsert(pMeta->pCtbIdx, &ctbIdxKey, sizeof(ctbIdxKey), pME->ctbEntry.pTags,
|
||||||
((STag *)(pME->ctbEntry.pTags))->len, &pMeta->txn);
|
((STag *)(pME->ctbEntry.pTags))->len, pMeta->txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
int metaCreateTagIdxKey(tb_uid_t suid, int32_t cid, const void *pTagData, int32_t nTagData, int8_t type, tb_uid_t uid,
|
int metaCreateTagIdxKey(tb_uid_t suid, int32_t cid, const void *pTagData, int32_t nTagData, int8_t type, tb_uid_t uid,
|
||||||
|
|
@ -1379,7 +1379,7 @@ static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
tdbTbUpsert(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, NULL, 0, &pMeta->txn);
|
tdbTbUpsert(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, NULL, 0, pMeta->txn);
|
||||||
}
|
}
|
||||||
end:
|
end:
|
||||||
metaDestroyTagIdxKey(pTagIdxKey);
|
metaDestroyTagIdxKey(pTagIdxKey);
|
||||||
|
|
@ -1426,7 +1426,7 @@ static int metaSaveToSkmDb(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
tEncoderInit(&coder, pVal, vLen);
|
tEncoderInit(&coder, pVal, vLen);
|
||||||
tEncodeSSchemaWrapper(&coder, pSW);
|
tEncodeSSchemaWrapper(&coder, pSW);
|
||||||
|
|
||||||
if (tdbTbInsert(pMeta->pSkmDb, &skmDbKey, sizeof(skmDbKey), pVal, vLen, &pMeta->txn) < 0) {
|
if (tdbTbInsert(pMeta->pSkmDb, &skmDbKey, sizeof(skmDbKey), pVal, vLen, pMeta->txn) < 0) {
|
||||||
rcode = -1;
|
rcode = -1;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ static int32_t tdProcessRSmaSyncCommitImpl(SSma *pSma);
|
||||||
static int32_t tdProcessRSmaSyncPostCommitImpl(SSma *pSma);
|
static int32_t tdProcessRSmaSyncPostCommitImpl(SSma *pSma);
|
||||||
#endif
|
#endif
|
||||||
static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma);
|
static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma);
|
||||||
static int32_t tdProcessRSmaAsyncCommitImpl(SSma *pSma);
|
static int32_t tdProcessRSmaAsyncCommitImpl(SSma *pSma, SCommitInfo *pInfo);
|
||||||
static int32_t tdProcessRSmaAsyncPostCommitImpl(SSma *pSma);
|
static int32_t tdProcessRSmaAsyncPostCommitImpl(SSma *pSma);
|
||||||
static int32_t tdUpdateQTaskInfoFiles(SSma *pSma, SRSmaStat *pRSmaStat);
|
static int32_t tdUpdateQTaskInfoFiles(SSma *pSma, SRSmaStat *pRSmaStat);
|
||||||
|
|
||||||
|
|
@ -59,7 +59,7 @@ int32_t smaSyncPostCommit(SSma *pSma) { return tdProcessRSmaSyncPostCommitImpl(p
|
||||||
* @param pSma
|
* @param pSma
|
||||||
* @return int32_t
|
* @return int32_t
|
||||||
*/
|
*/
|
||||||
int32_t smaPreCommit(SSma *pSma) { return tdProcessRSmaAsyncPreCommitImpl(pSma); }
|
int32_t smaPrepareAsyncCommit(SSma *pSma) { return tdProcessRSmaAsyncPreCommitImpl(pSma); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief async commit, only applicable to Rollup SMA
|
* @brief async commit, only applicable to Rollup SMA
|
||||||
|
|
@ -67,7 +67,7 @@ int32_t smaPreCommit(SSma *pSma) { return tdProcessRSmaAsyncPreCommitImpl(pSma);
|
||||||
* @param pSma
|
* @param pSma
|
||||||
* @return int32_t
|
* @return int32_t
|
||||||
*/
|
*/
|
||||||
int32_t smaCommit(SSma *pSma) { return tdProcessRSmaAsyncCommitImpl(pSma); }
|
int32_t smaCommit(SSma *pSma, SCommitInfo *pInfo) { return tdProcessRSmaAsyncCommitImpl(pSma, pInfo); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief async commit, only applicable to Rollup SMA
|
* @brief async commit, only applicable to Rollup SMA
|
||||||
|
|
@ -127,8 +127,8 @@ _exit:
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t smaFinishCommit(SSma *pSma) {
|
int32_t smaFinishCommit(SSma *pSma) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
SVnode *pVnode = pSma->pVnode;
|
SVnode *pVnode = pSma->pVnode;
|
||||||
|
|
||||||
if (VND_RSMA1(pVnode) && (code = tsdbFinishCommit(VND_RSMA1(pVnode))) < 0) {
|
if (VND_RSMA1(pVnode) && (code = tsdbFinishCommit(VND_RSMA1(pVnode))) < 0) {
|
||||||
smaError("vgId:%d, failed to finish commit tsdb rsma1 since %s", TD_VID(pVnode), tstrerror(code));
|
smaError("vgId:%d, failed to finish commit tsdb rsma1 since %s", TD_VID(pVnode), tstrerror(code));
|
||||||
|
|
@ -378,6 +378,11 @@ static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma) {
|
||||||
taosWUnLockLatch(SMA_ENV_LOCK(pEnv));
|
taosWUnLockLatch(SMA_ENV_LOCK(pEnv));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// all rsma results are written completely
|
||||||
|
STsdb *pTsdb = NULL;
|
||||||
|
if ((pTsdb = VND_RSMA1(pSma->pVnode))) tsdbPrepareCommit(pTsdb);
|
||||||
|
if ((pTsdb = VND_RSMA2(pSma->pVnode))) tsdbPrepareCommit(pTsdb);
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -387,9 +392,9 @@ static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma) {
|
||||||
* @param pSma
|
* @param pSma
|
||||||
* @return int32_t
|
* @return int32_t
|
||||||
*/
|
*/
|
||||||
static int32_t tdProcessRSmaAsyncCommitImpl(SSma *pSma) {
|
static int32_t tdProcessRSmaAsyncCommitImpl(SSma *pSma, SCommitInfo *pInfo) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
SVnode *pVnode = pSma->pVnode;
|
SVnode *pVnode = pSma->pVnode;
|
||||||
#if 0
|
#if 0
|
||||||
SRSmaStat *pRSmaStat = (SRSmaStat *)SMA_ENV_STAT(pSmaEnv);
|
SRSmaStat *pRSmaStat = (SRSmaStat *)SMA_ENV_STAT(pSmaEnv);
|
||||||
|
|
||||||
|
|
@ -399,11 +404,11 @@ static int32_t tdProcessRSmaAsyncCommitImpl(SSma *pSma) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((code = tsdbCommit(VND_RSMA1(pVnode))) < 0) {
|
if ((code = tsdbCommit(VND_RSMA1(pVnode), pInfo)) < 0) {
|
||||||
smaError("vgId:%d, failed to commit tsdb rsma1 since %s", TD_VID(pVnode), tstrerror(code));
|
smaError("vgId:%d, failed to commit tsdb rsma1 since %s", TD_VID(pVnode), tstrerror(code));
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
if ((code = tsdbCommit(VND_RSMA2(pVnode))) < 0) {
|
if ((code = tsdbCommit(VND_RSMA2(pVnode), pInfo)) < 0) {
|
||||||
smaError("vgId:%d, failed to commit tsdb rsma2 since %s", TD_VID(pVnode), tstrerror(code));
|
smaError("vgId:%d, failed to commit tsdb rsma2 since %s", TD_VID(pVnode), tstrerror(code));
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ static void tqPushEntryFree(void* data) {
|
||||||
STQ* tqOpen(const char* path, SVnode* pVnode) {
|
STQ* tqOpen(const char* path, SVnode* pVnode) {
|
||||||
STQ* pTq = taosMemoryCalloc(1, sizeof(STQ));
|
STQ* pTq = taosMemoryCalloc(1, sizeof(STQ));
|
||||||
if (pTq == NULL) {
|
if (pTq == NULL) {
|
||||||
terrno = TSDB_CODE_TQ_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
pTq->path = strdup(path);
|
pTq->path = strdup(path);
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, SMqDataRsp* pRsp, int32_t
|
||||||
pRetrieve->precision = precision;
|
pRetrieve->precision = precision;
|
||||||
pRetrieve->compressed = 0;
|
pRetrieve->compressed = 0;
|
||||||
pRetrieve->completed = 1;
|
pRetrieve->completed = 1;
|
||||||
pRetrieve->numOfRows = htonl(pBlock->info.rows);
|
pRetrieve->numOfRows = htobe64((int64_t)pBlock->info.rows);
|
||||||
|
|
||||||
int32_t actualLen = blockEncode(pBlock, pRetrieve->data, numOfCols);
|
int32_t actualLen = blockEncode(pBlock, pRetrieve->data, numOfCols);
|
||||||
actualLen += sizeof(SRetrieveTableRsp);
|
actualLen += sizeof(SRetrieveTableRsp);
|
||||||
|
|
|
||||||
|
|
@ -108,24 +108,22 @@ int32_t tqMetaClose(STQ* pTq) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tqMetaSaveCheckInfo(STQ* pTq, const char* key, const void* value, int32_t vLen) {
|
int32_t tqMetaSaveCheckInfo(STQ* pTq, const char* key, const void* value, int32_t vLen) {
|
||||||
TXN txn;
|
TXN* txn;
|
||||||
if (tdbTxnOpen(&txn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) < 0) {
|
|
||||||
|
if (tdbBegin(pTq->pMetaDB, &txn, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) <
|
||||||
|
0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tdbBegin(pTq->pMetaDB, &txn) < 0) {
|
if (tdbTbUpsert(pTq->pCheckStore, key, strlen(key), value, vLen, txn) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tdbTbUpsert(pTq->pCheckStore, key, strlen(key), value, vLen, &txn) < 0) {
|
if (tdbCommit(pTq->pMetaDB, txn) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tdbCommit(pTq->pMetaDB, &txn) < 0) {
|
if (tdbPostCommit(pTq->pMetaDB, txn) < 0) {
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tdbPostCommit(pTq->pMetaDB, &txn) < 0) {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -133,25 +131,22 @@ int32_t tqMetaSaveCheckInfo(STQ* pTq, const char* key, const void* value, int32_
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tqMetaDeleteCheckInfo(STQ* pTq, const char* key) {
|
int32_t tqMetaDeleteCheckInfo(STQ* pTq, const char* key) {
|
||||||
TXN txn;
|
TXN* txn;
|
||||||
|
|
||||||
if (tdbTxnOpen(&txn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) < 0) {
|
if (tdbBegin(pTq->pMetaDB, &txn, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) <
|
||||||
|
0) {
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tdbBegin(pTq->pMetaDB, &txn) < 0) {
|
if (tdbTbDelete(pTq->pCheckStore, key, (int)strlen(key), txn) < 0) {
|
||||||
ASSERT(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tdbTbDelete(pTq->pCheckStore, key, (int)strlen(key), &txn) < 0) {
|
|
||||||
/*ASSERT(0);*/
|
/*ASSERT(0);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tdbCommit(pTq->pMetaDB, &txn) < 0) {
|
if (tdbCommit(pTq->pMetaDB, txn) < 0) {
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tdbPostCommit(pTq->pMetaDB, &txn) < 0) {
|
if (tdbPostCommit(pTq->pMetaDB, txn) < 0) {
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -219,25 +214,22 @@ int32_t tqMetaSaveHandle(STQ* pTq, const char* key, const STqHandle* pHandle) {
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
TXN txn;
|
TXN* txn;
|
||||||
|
|
||||||
if (tdbTxnOpen(&txn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) < 0) {
|
if (tdbBegin(pTq->pMetaDB, &txn, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) <
|
||||||
|
0) {
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tdbBegin(pTq->pMetaDB, &txn) < 0) {
|
if (tdbTbUpsert(pTq->pExecStore, key, (int)strlen(key), buf, vlen, txn) < 0) {
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tdbTbUpsert(pTq->pExecStore, key, (int)strlen(key), buf, vlen, &txn) < 0) {
|
if (tdbCommit(pTq->pMetaDB, txn) < 0) {
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tdbCommit(pTq->pMetaDB, &txn) < 0) {
|
if (tdbPostCommit(pTq->pMetaDB, txn) < 0) {
|
||||||
ASSERT(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tdbPostCommit(pTq->pMetaDB, &txn) < 0) {
|
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -247,25 +239,22 @@ int32_t tqMetaSaveHandle(STQ* pTq, const char* key, const STqHandle* pHandle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tqMetaDeleteHandle(STQ* pTq, const char* key) {
|
int32_t tqMetaDeleteHandle(STQ* pTq, const char* key) {
|
||||||
TXN txn;
|
TXN* txn;
|
||||||
|
|
||||||
if (tdbTxnOpen(&txn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) < 0) {
|
if (tdbBegin(pTq->pMetaDB, &txn, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) <
|
||||||
|
0) {
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tdbBegin(pTq->pMetaDB, &txn) < 0) {
|
if (tdbTbDelete(pTq->pExecStore, key, (int)strlen(key), txn) < 0) {
|
||||||
ASSERT(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tdbTbDelete(pTq->pExecStore, key, (int)strlen(key), &txn) < 0) {
|
|
||||||
/*ASSERT(0);*/
|
/*ASSERT(0);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tdbCommit(pTq->pMetaDB, &txn) < 0) {
|
if (tdbCommit(pTq->pMetaDB, txn) < 0) {
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tdbPostCommit(pTq->pMetaDB, &txn) < 0) {
|
if (tdbPostCommit(pTq->pMetaDB, txn) < 0) {
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ struct STqSnapWriter {
|
||||||
STQ* pTq;
|
STQ* pTq;
|
||||||
int64_t sver;
|
int64_t sver;
|
||||||
int64_t ever;
|
int64_t ever;
|
||||||
TXN txn;
|
TXN* txn;
|
||||||
};
|
};
|
||||||
|
|
||||||
int32_t tqSnapWriterOpen(STQ* pTq, int64_t sver, int64_t ever, STqSnapWriter** ppWriter) {
|
int32_t tqSnapWriterOpen(STQ* pTq, int64_t sver, int64_t ever, STqSnapWriter** ppWriter) {
|
||||||
|
|
@ -146,8 +146,10 @@ int32_t tqSnapWriterOpen(STQ* pTq, int64_t sver, int64_t ever, STqSnapWriter** p
|
||||||
pWriter->sver = sver;
|
pWriter->sver = sver;
|
||||||
pWriter->ever = ever;
|
pWriter->ever = ever;
|
||||||
|
|
||||||
if (tdbTxnOpen(&pWriter->txn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL, 0) < 0) {
|
if (tdbBegin(pTq->pMetaDB, &pWriter->txn, tdbDefaultMalloc, tdbDefaultFree, NULL, 0) < 0) {
|
||||||
ASSERT(0);
|
code = -1;
|
||||||
|
taosMemoryFree(pWriter);
|
||||||
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
*ppWriter = pWriter;
|
*ppWriter = pWriter;
|
||||||
|
|
@ -165,11 +167,11 @@ int32_t tqSnapWriterClose(STqSnapWriter** ppWriter, int8_t rollback) {
|
||||||
STQ* pTq = pWriter->pTq;
|
STQ* pTq = pWriter->pTq;
|
||||||
|
|
||||||
if (rollback) {
|
if (rollback) {
|
||||||
tdbAbort(pWriter->pTq->pMetaDB, &pWriter->txn);
|
tdbAbort(pWriter->pTq->pMetaDB, pWriter->txn);
|
||||||
} else {
|
} else {
|
||||||
code = tdbCommit(pWriter->pTq->pMetaDB, &pWriter->txn);
|
code = tdbCommit(pWriter->pTq->pMetaDB, pWriter->txn);
|
||||||
if (code) goto _err;
|
if (code) goto _err;
|
||||||
code = tdbPostCommit(pWriter->pTq->pMetaDB, &pWriter->txn);
|
code = tdbPostCommit(pWriter->pTq->pMetaDB, pWriter->txn);
|
||||||
if (code) goto _err;
|
if (code) goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ struct STqSnapWriter {
|
||||||
STQ* pTq;
|
STQ* pTq;
|
||||||
int64_t sver;
|
int64_t sver;
|
||||||
int64_t ever;
|
int64_t ever;
|
||||||
TXN txn;
|
TXN* txn;
|
||||||
};
|
};
|
||||||
|
|
||||||
int32_t tqSnapWriterOpen(STQ* pTq, int64_t sver, int64_t ever, STqSnapWriter** ppWriter) {
|
int32_t tqSnapWriterOpen(STQ* pTq, int64_t sver, int64_t ever, STqSnapWriter** ppWriter) {
|
||||||
|
|
@ -146,8 +146,10 @@ int32_t tqSnapWriterOpen(STQ* pTq, int64_t sver, int64_t ever, STqSnapWriter** p
|
||||||
pWriter->sver = sver;
|
pWriter->sver = sver;
|
||||||
pWriter->ever = ever;
|
pWriter->ever = ever;
|
||||||
|
|
||||||
if (tdbTxnOpen(&pWriter->txn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL, 0) < 0) {
|
if (tdbBegin(pTq->pMetaDB, &pWriter->txn, tdbDefaultMalloc, tdbDefaultFree, NULL, 0) < 0) {
|
||||||
ASSERT(0);
|
code = -1;
|
||||||
|
taosMemoryFree(pWriter);
|
||||||
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
*ppWriter = pWriter;
|
*ppWriter = pWriter;
|
||||||
|
|
@ -165,11 +167,12 @@ int32_t tqSnapWriterClose(STqSnapWriter** ppWriter, int8_t rollback) {
|
||||||
STQ* pTq = pWriter->pTq;
|
STQ* pTq = pWriter->pTq;
|
||||||
|
|
||||||
if (rollback) {
|
if (rollback) {
|
||||||
|
tdbAbort(pWriter->pTq->pMetaDB, pWriter->txn);
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
} else {
|
} else {
|
||||||
code = tdbCommit(pWriter->pTq->pMetaDB, &pWriter->txn);
|
code = tdbCommit(pWriter->pTq->pMetaDB, pWriter->txn);
|
||||||
if (code) goto _err;
|
if (code) goto _err;
|
||||||
code = tdbPostCommit(pWriter->pTq->pMetaDB, &pWriter->txn);
|
code = tdbPostCommit(pWriter->pTq->pMetaDB, pWriter->txn);
|
||||||
if (code) goto _err;
|
if (code) goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ struct STqSnapWriter {
|
||||||
STQ* pTq;
|
STQ* pTq;
|
||||||
int64_t sver;
|
int64_t sver;
|
||||||
int64_t ever;
|
int64_t ever;
|
||||||
TXN txn;
|
TXN* txn;
|
||||||
};
|
};
|
||||||
|
|
||||||
int32_t tqSnapWriterOpen(STQ* pTq, int64_t sver, int64_t ever, STqSnapWriter** ppWriter) {
|
int32_t tqSnapWriterOpen(STQ* pTq, int64_t sver, int64_t ever, STqSnapWriter** ppWriter) {
|
||||||
|
|
@ -146,8 +146,10 @@ int32_t tqSnapWriterOpen(STQ* pTq, int64_t sver, int64_t ever, STqSnapWriter** p
|
||||||
pWriter->sver = sver;
|
pWriter->sver = sver;
|
||||||
pWriter->ever = ever;
|
pWriter->ever = ever;
|
||||||
|
|
||||||
if (tdbTxnOpen(&pWriter->txn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL, 0) < 0) {
|
if (tdbBegin(pTq->pMetaStore, &pWriter->txn, tdbDefaultMalloc, tdbDefaultFree, NULL, 0) < 0) {
|
||||||
ASSERT(0);
|
code = -1;
|
||||||
|
taosMemoryFree(pWriter);
|
||||||
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
*ppWriter = pWriter;
|
*ppWriter = pWriter;
|
||||||
|
|
@ -165,11 +167,12 @@ int32_t tqSnapWriterClose(STqSnapWriter** ppWriter, int8_t rollback) {
|
||||||
STQ* pTq = pWriter->pTq;
|
STQ* pTq = pWriter->pTq;
|
||||||
|
|
||||||
if (rollback) {
|
if (rollback) {
|
||||||
|
tdbAbort(pWriter->pTq->pMetaStore, pWriter->txn);
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
} else {
|
} else {
|
||||||
code = tdbCommit(pWriter->pTq->pMetaStore, &pWriter->txn);
|
code = tdbCommit(pWriter->pTq->pMetaStore, pWriter->txn);
|
||||||
if (code) goto _err;
|
if (code) goto _err;
|
||||||
code = tdbPostCommit(pWriter->pTq->pMetaStore, &pWriter->txn);
|
code = tdbPostCommit(pWriter->pTq->pMetaStore, pWriter->txn);
|
||||||
if (code) goto _err;
|
if (code) goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -228,23 +228,23 @@ int32_t tsdbCacheInsertLastrow(SLRUCache *pCache, STsdb *pTsdb, tb_uid_t uid, TS
|
||||||
invalidate = true;
|
invalidate = true;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
} else { // new inserting key is greater than cached, update cached entry
|
||||||
} else {
|
SLastCol lastCol = {.ts = keyTs, .colVal = colVal};
|
||||||
SLastCol lastCol = {.ts = keyTs, .colVal = colVal};
|
if (IS_VAR_DATA_TYPE(colVal.type) && colVal.value.nData > 0) {
|
||||||
if (IS_VAR_DATA_TYPE(colVal.type) && colVal.value.nData > 0) {
|
SLastCol *pLastCol = (SLastCol *)taosArrayGet(pLast, iCol);
|
||||||
SLastCol *pLastCol = (SLastCol *)taosArrayGet(pLast, iCol);
|
taosMemoryFree(pLastCol->colVal.value.pData);
|
||||||
taosMemoryFree(pLastCol->colVal.value.pData);
|
|
||||||
|
|
||||||
lastCol.colVal.value.pData = taosMemoryMalloc(colVal.value.nData);
|
lastCol.colVal.value.pData = taosMemoryMalloc(colVal.value.nData);
|
||||||
if (lastCol.colVal.value.pData == NULL) {
|
if (lastCol.colVal.value.pData == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto _invalidate;
|
goto _invalidate;
|
||||||
|
}
|
||||||
|
memcpy(lastCol.colVal.value.pData, colVal.value.pData, colVal.value.nData);
|
||||||
}
|
}
|
||||||
memcpy(lastCol.colVal.value.pData, colVal.value.pData, colVal.value.nData);
|
|
||||||
}
|
|
||||||
|
|
||||||
taosArraySet(pLast, iCol, &lastCol);
|
taosArraySet(pLast, iCol, &lastCol);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -253,65 +253,10 @@ int32_t tsdbCacheInsertLastrow(SLRUCache *pCache, STsdb *pTsdb, tb_uid_t uid, TS
|
||||||
taosMemoryFreeClear(pTSchema);
|
taosMemoryFreeClear(pTSchema);
|
||||||
|
|
||||||
taosLRUCacheRelease(pCache, h, invalidate);
|
taosLRUCacheRelease(pCache, h, invalidate);
|
||||||
/*
|
if (invalidate) {
|
||||||
cacheRow = (STSRow *)taosLRUCacheValue(pCache, h);
|
taosLRUCacheErase(pCache, key, keyLen);
|
||||||
if (row->ts >= cacheRow->ts) {
|
|
||||||
if (row->ts == cacheRow->ts) {
|
|
||||||
STSRow *mergedRow = NULL;
|
|
||||||
SRowMerger merger = {0};
|
|
||||||
STSchema *pTSchema = metaGetTbTSchema(pTsdb->pVnode->pMeta, uid, -1, 1);
|
|
||||||
|
|
||||||
tsdbRowMergerInit(&merger, &tsdbRowFromTSRow(0, cacheRow), pTSchema);
|
|
||||||
|
|
||||||
tsdbRowMerge(&merger, &tsdbRowFromTSRow(1, row));
|
|
||||||
|
|
||||||
tsdbRowMergerGetRow(&merger, &mergedRow);
|
|
||||||
tsdbRowMergerClear(&merger);
|
|
||||||
|
|
||||||
taosMemoryFreeClear(pTSchema);
|
|
||||||
|
|
||||||
row = mergedRow;
|
|
||||||
dup = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TD_ROW_LEN(row) <= TD_ROW_LEN(cacheRow)) {
|
|
||||||
tdRowCpy(cacheRow, row);
|
|
||||||
if (!dup) {
|
|
||||||
taosMemoryFree(row);
|
|
||||||
}
|
|
||||||
|
|
||||||
taosLRUCacheRelease(pCache, h, false);
|
|
||||||
} else {
|
|
||||||
taosLRUCacheRelease(pCache, h, true);
|
|
||||||
// tsdbCacheDeleteLastrow(pCache, uid, TSKEY_MAX);
|
|
||||||
if (dup) {
|
|
||||||
cacheRow = tdRowDup(row);
|
|
||||||
} else {
|
|
||||||
cacheRow = row;
|
|
||||||
}
|
|
||||||
_taos_lru_deleter_t deleter = deleteTableCacheLastrow;
|
|
||||||
LRUStatus status = taosLRUCacheInsert(pCache, key, keyLen, cacheRow, TD_ROW_LEN(cacheRow), deleter, NULL,
|
|
||||||
TAOS_LRU_PRIORITY_LOW);
|
|
||||||
if (status != TAOS_LRU_STATUS_OK) {
|
|
||||||
code = -1;
|
|
||||||
}
|
|
||||||
// tsdbCacheInsertLastrow(pCache, uid, row, dup);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
} /*else {
|
|
||||||
if (dup) {
|
|
||||||
cacheRow = tdRowDup(row);
|
|
||||||
} else {
|
|
||||||
cacheRow = row;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
_taos_lru_deleter_t deleter = deleteTableCacheLastrow;
|
|
||||||
LRUStatus status =
|
|
||||||
taosLRUCacheInsert(pCache, key, keyLen, cacheRow, TD_ROW_LEN(cacheRow), deleter, NULL, TAOS_LRU_PRIORITY_LOW);
|
|
||||||
if (status != TAOS_LRU_STATUS_OK) {
|
|
||||||
code = -1;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
@ -349,28 +294,28 @@ int32_t tsdbCacheInsertLast(SLRUCache *pCache, tb_uid_t uid, TSDBROW *row, STsdb
|
||||||
|
|
||||||
SColVal colVal = {0};
|
SColVal colVal = {0};
|
||||||
tsdbRowGetColVal(row, pTSchema, iCol, &colVal);
|
tsdbRowGetColVal(row, pTSchema, iCol, &colVal);
|
||||||
if (!COL_VAL_IS_VALUE(&colVal)) {
|
if (COL_VAL_IS_VALUE(&colVal)) {
|
||||||
if (keyTs == tTsVal1->ts && COL_VAL_IS_VALUE(tColVal)) {
|
if (keyTs == tTsVal1->ts && COL_VAL_IS_VALUE(tColVal)) {
|
||||||
invalidate = true;
|
invalidate = true;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
} else {
|
||||||
} else {
|
SLastCol lastCol = {.ts = keyTs, .colVal = colVal};
|
||||||
SLastCol lastCol = {.ts = keyTs, .colVal = colVal};
|
if (IS_VAR_DATA_TYPE(colVal.type) && colVal.value.nData > 0) {
|
||||||
if (IS_VAR_DATA_TYPE(colVal.type) && colVal.value.nData > 0) {
|
SLastCol *pLastCol = (SLastCol *)taosArrayGet(pLast, iCol);
|
||||||
SLastCol *pLastCol = (SLastCol *)taosArrayGet(pLast, iCol);
|
taosMemoryFree(pLastCol->colVal.value.pData);
|
||||||
taosMemoryFree(pLastCol->colVal.value.pData);
|
|
||||||
|
|
||||||
lastCol.colVal.value.pData = taosMemoryMalloc(colVal.value.nData);
|
lastCol.colVal.value.pData = taosMemoryMalloc(colVal.value.nData);
|
||||||
if (lastCol.colVal.value.pData == NULL) {
|
if (lastCol.colVal.value.pData == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto _invalidate;
|
goto _invalidate;
|
||||||
|
}
|
||||||
|
memcpy(lastCol.colVal.value.pData, colVal.value.pData, colVal.value.nData);
|
||||||
}
|
}
|
||||||
memcpy(lastCol.colVal.value.pData, colVal.value.pData, colVal.value.nData);
|
|
||||||
}
|
|
||||||
|
|
||||||
taosArraySet(pLast, iCol, &lastCol);
|
taosArraySet(pLast, iCol, &lastCol);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -379,9 +324,9 @@ int32_t tsdbCacheInsertLast(SLRUCache *pCache, tb_uid_t uid, TSDBROW *row, STsdb
|
||||||
taosMemoryFreeClear(pTSchema);
|
taosMemoryFreeClear(pTSchema);
|
||||||
|
|
||||||
taosLRUCacheRelease(pCache, h, invalidate);
|
taosLRUCacheRelease(pCache, h, invalidate);
|
||||||
|
if (invalidate) {
|
||||||
// clear last cache anyway, lazy load when get last lookup
|
taosLRUCacheErase(pCache, key, keyLen);
|
||||||
// taosLRUCacheRelease(pCache, h, true);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
|
|
@ -740,7 +685,8 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow) {
|
||||||
tBlockDataReset(state->pBlockData);
|
tBlockDataReset(state->pBlockData);
|
||||||
|
|
||||||
tMapDataGetItemByIdx(&state->blockMap, state->iBlock, &block, tGetDataBlk);
|
tMapDataGetItemByIdx(&state->blockMap, state->iBlock, &block, tGetDataBlk);
|
||||||
/* code = tsdbReadBlockData(state->pDataFReader, &state->blockIdx, &block, &state->blockData, NULL, NULL); */
|
/* code = tsdbReadBlockData(state->pDataFReader, &state->blockIdx, &block, &state->blockData, NULL, NULL);
|
||||||
|
*/
|
||||||
tBlockDataReset(state->pBlockData);
|
tBlockDataReset(state->pBlockData);
|
||||||
TABLEID tid = {.suid = state->suid, .uid = state->uid};
|
TABLEID tid = {.suid = state->suid, .uid = state->uid};
|
||||||
code = tBlockDataInit(state->pBlockData, &tid, state->pTSchema, NULL, 0);
|
code = tBlockDataInit(state->pBlockData, &tid, state->pTSchema, NULL, 0);
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ typedef struct {
|
||||||
SArray *aDelData; // SArray<SDelData>
|
SArray *aDelData; // SArray<SDelData>
|
||||||
} SCommitter;
|
} SCommitter;
|
||||||
|
|
||||||
static int32_t tsdbStartCommit(STsdb *pTsdb, SCommitter *pCommitter);
|
static int32_t tsdbStartCommit(STsdb *pTsdb, SCommitter *pCommitter, SCommitInfo *pInfo);
|
||||||
static int32_t tsdbCommitData(SCommitter *pCommitter);
|
static int32_t tsdbCommitData(SCommitter *pCommitter);
|
||||||
static int32_t tsdbCommitDel(SCommitter *pCommitter);
|
static int32_t tsdbCommitDel(SCommitter *pCommitter);
|
||||||
static int32_t tsdbCommitCache(SCommitter *pCommitter);
|
static int32_t tsdbCommitCache(SCommitter *pCommitter);
|
||||||
|
|
@ -150,18 +150,28 @@ _exit:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tsdbCommit(STsdb *pTsdb) {
|
int32_t tsdbPrepareCommit(STsdb *pTsdb) {
|
||||||
|
taosThreadRwlockWrlock(&pTsdb->rwLock);
|
||||||
|
ASSERT(pTsdb->imem == NULL);
|
||||||
|
pTsdb->imem = pTsdb->mem;
|
||||||
|
pTsdb->mem = NULL;
|
||||||
|
taosThreadRwlockUnlock(&pTsdb->rwLock);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t tsdbCommit(STsdb *pTsdb, SCommitInfo *pInfo) {
|
||||||
if (!pTsdb) return 0;
|
if (!pTsdb) return 0;
|
||||||
|
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
SCommitter commith;
|
SCommitter commith;
|
||||||
SMemTable *pMemTable = pTsdb->mem;
|
SMemTable *pMemTable = pTsdb->imem;
|
||||||
|
|
||||||
// check
|
// check
|
||||||
if (pMemTable->nRow == 0 && pMemTable->nDel == 0) {
|
if (pMemTable->nRow == 0 && pMemTable->nDel == 0) {
|
||||||
taosThreadRwlockWrlock(&pTsdb->rwLock);
|
taosThreadRwlockWrlock(&pTsdb->rwLock);
|
||||||
pTsdb->mem = NULL;
|
pTsdb->imem = NULL;
|
||||||
taosThreadRwlockUnlock(&pTsdb->rwLock);
|
taosThreadRwlockUnlock(&pTsdb->rwLock);
|
||||||
|
|
||||||
tsdbUnrefMemTable(pMemTable);
|
tsdbUnrefMemTable(pMemTable);
|
||||||
|
|
@ -169,7 +179,7 @@ int32_t tsdbCommit(STsdb *pTsdb) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// start commit
|
// start commit
|
||||||
code = tsdbStartCommit(pTsdb, &commith);
|
code = tsdbStartCommit(pTsdb, &commith, pInfo);
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
|
|
||||||
// commit impl
|
// commit impl
|
||||||
|
|
@ -806,26 +816,21 @@ _exit:
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
static int32_t tsdbStartCommit(STsdb *pTsdb, SCommitter *pCommitter) {
|
static int32_t tsdbStartCommit(STsdb *pTsdb, SCommitter *pCommitter, SCommitInfo *pInfo) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
|
|
||||||
memset(pCommitter, 0, sizeof(*pCommitter));
|
memset(pCommitter, 0, sizeof(*pCommitter));
|
||||||
ASSERT(pTsdb->mem && pTsdb->imem == NULL && "last tsdb commit incomplete");
|
ASSERT(pTsdb->imem && "last tsdb commit incomplete");
|
||||||
|
|
||||||
taosThreadRwlockWrlock(&pTsdb->rwLock);
|
|
||||||
pTsdb->imem = pTsdb->mem;
|
|
||||||
pTsdb->mem = NULL;
|
|
||||||
taosThreadRwlockUnlock(&pTsdb->rwLock);
|
|
||||||
|
|
||||||
pCommitter->pTsdb = pTsdb;
|
pCommitter->pTsdb = pTsdb;
|
||||||
pCommitter->commitID = pTsdb->pVnode->state.commitID;
|
pCommitter->commitID = pInfo->info.state.commitID;
|
||||||
pCommitter->minutes = pTsdb->keepCfg.days;
|
pCommitter->minutes = pTsdb->keepCfg.days;
|
||||||
pCommitter->precision = pTsdb->keepCfg.precision;
|
pCommitter->precision = pTsdb->keepCfg.precision;
|
||||||
pCommitter->minRow = pTsdb->pVnode->config.tsdbCfg.minRows;
|
pCommitter->minRow = pInfo->info.config.tsdbCfg.minRows;
|
||||||
pCommitter->maxRow = pTsdb->pVnode->config.tsdbCfg.maxRows;
|
pCommitter->maxRow = pInfo->info.config.tsdbCfg.maxRows;
|
||||||
pCommitter->cmprAlg = pTsdb->pVnode->config.tsdbCfg.compression;
|
pCommitter->cmprAlg = pInfo->info.config.tsdbCfg.compression;
|
||||||
pCommitter->sttTrigger = pTsdb->pVnode->config.sttTrigger;
|
pCommitter->sttTrigger = pInfo->info.config.sttTrigger;
|
||||||
pCommitter->aTbDataP = tsdbMemTableGetTbDataArray(pTsdb->imem);
|
pCommitter->aTbDataP = tsdbMemTableGetTbDataArray(pTsdb->imem);
|
||||||
if (pCommitter->aTbDataP == NULL) {
|
if (pCommitter->aTbDataP == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
|
||||||
|
|
@ -82,13 +82,13 @@ typedef struct SIOCostSummary {
|
||||||
} SIOCostSummary;
|
} SIOCostSummary;
|
||||||
|
|
||||||
typedef struct SBlockLoadSuppInfo {
|
typedef struct SBlockLoadSuppInfo {
|
||||||
SArray* pColAgg;
|
SArray* pColAgg;
|
||||||
SColumnDataAgg tsColAgg;
|
SColumnDataAgg tsColAgg;
|
||||||
SColumnDataAgg** plist;
|
int16_t* colId;
|
||||||
int16_t* colIds; // column ids for loading file block data
|
int16_t* slotId;
|
||||||
int32_t numOfCols;
|
int32_t numOfCols;
|
||||||
char** buildBuf; // build string tmp buffer, todo remove it later after all string format being updated.
|
char** buildBuf; // build string tmp buffer, todo remove it later after all string format being updated.
|
||||||
bool smaValid; // the sma on all queried columns are activated
|
bool smaValid; // the sma on all queried columns are activated
|
||||||
} SBlockLoadSuppInfo;
|
} SBlockLoadSuppInfo;
|
||||||
|
|
||||||
typedef struct SLastBlockReader {
|
typedef struct SLastBlockReader {
|
||||||
|
|
@ -158,6 +158,7 @@ struct STsdbReader {
|
||||||
STsdb* pTsdb;
|
STsdb* pTsdb;
|
||||||
uint64_t suid;
|
uint64_t suid;
|
||||||
int16_t order;
|
int16_t order;
|
||||||
|
bool freeBlock;
|
||||||
STimeWindow window; // the primary query time window that applies to all queries
|
STimeWindow window; // the primary query time window that applies to all queries
|
||||||
SSDataBlock* pResBlock;
|
SSDataBlock* pResBlock;
|
||||||
int32_t capacity;
|
int32_t capacity;
|
||||||
|
|
@ -167,9 +168,11 @@ struct STsdbReader {
|
||||||
SBlockLoadSuppInfo suppInfo;
|
SBlockLoadSuppInfo suppInfo;
|
||||||
STsdbReadSnap* pReadSnap;
|
STsdbReadSnap* pReadSnap;
|
||||||
SIOCostSummary cost;
|
SIOCostSummary cost;
|
||||||
STSchema* pSchema; // the newest version schema
|
STSchema* pSchema; // the newest version schema
|
||||||
STSchema* pMemSchema; // the previous schema for in-memory data, to avoid load schema too many times
|
STSchema* pMemSchema; // the previous schema for in-memory data, to avoid load schema too many times
|
||||||
SDataFReader* pFileReader;
|
SDataFReader* pFileReader; // the file reader
|
||||||
|
SDelFReader* pDelFReader; // the del file reader
|
||||||
|
SArray* pDelIdx; // del file block index;
|
||||||
SVersionRange verRange;
|
SVersionRange verRange;
|
||||||
SBlockInfoBuf blockInfoBuf;
|
SBlockInfoBuf blockInfoBuf;
|
||||||
int32_t step;
|
int32_t step;
|
||||||
|
|
@ -194,8 +197,8 @@ static void setComposedBlockFlag(STsdbReader* pReader, bool composed);
|
||||||
static bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey, int32_t order,
|
static bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey, int32_t order,
|
||||||
SVersionRange* pVerRange);
|
SVersionRange* pVerRange);
|
||||||
|
|
||||||
static int32_t doMergeMemTableMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo* pIter, SArray* pDelList, TSDBROW* pTSRow,
|
static int32_t doMergeMemTableMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo* pIter, SArray* pDelList,
|
||||||
STsdbReader* pReader, bool* freeTSRow);
|
TSDBROW* pTSRow, STsdbReader* pReader, bool* freeTSRow);
|
||||||
static int32_t doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* pBlockScanInfo,
|
static int32_t doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* pBlockScanInfo,
|
||||||
STsdbReader* pReader, SRow** pTSRow);
|
STsdbReader* pReader, SRow** pTSRow);
|
||||||
static int32_t mergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pBlockScanInfo, int64_t key,
|
static int32_t mergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pBlockScanInfo, int64_t key,
|
||||||
|
|
@ -214,25 +217,26 @@ static bool hasDataInFileBlock(const SBlockData* pBlockData, const SFil
|
||||||
|
|
||||||
static bool outOfTimeWindow(int64_t ts, STimeWindow* pWindow) { return (ts > pWindow->ekey) || (ts < pWindow->skey); }
|
static bool outOfTimeWindow(int64_t ts, STimeWindow* pWindow) { return (ts > pWindow->ekey) || (ts < pWindow->skey); }
|
||||||
|
|
||||||
static int32_t setColumnIdSlotList(SBlockLoadSuppInfo* pSupInfo, SSDataBlock* pBlock) {
|
static int32_t setColumnIdSlotList(SBlockLoadSuppInfo* pSupInfo, SColumnInfo* pCols, const int32_t* pSlotIdList,
|
||||||
size_t numOfCols = blockDataGetNumOfCols(pBlock);
|
int32_t numOfCols) {
|
||||||
|
|
||||||
pSupInfo->smaValid = true;
|
pSupInfo->smaValid = true;
|
||||||
pSupInfo->numOfCols = numOfCols;
|
pSupInfo->numOfCols = numOfCols;
|
||||||
pSupInfo->colIds = taosMemoryMalloc(numOfCols * sizeof(int16_t));
|
pSupInfo->colId = taosMemoryMalloc(numOfCols * (sizeof(int16_t) * 2 + POINTER_BYTES));
|
||||||
pSupInfo->buildBuf = taosMemoryCalloc(numOfCols, POINTER_BYTES);
|
if (pSupInfo->colId == NULL) {
|
||||||
if (pSupInfo->buildBuf == NULL || pSupInfo->colIds == NULL) {
|
taosMemoryFree(pSupInfo->colId);
|
||||||
taosMemoryFree(pSupInfo->colIds);
|
|
||||||
taosMemoryFree(pSupInfo->buildBuf);
|
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pSupInfo->slotId = (int16_t*)((char*)pSupInfo->colId + (sizeof(int16_t) * numOfCols));
|
||||||
|
pSupInfo->buildBuf = (char**)((char*)pSupInfo->slotId + (sizeof(int16_t) * numOfCols));
|
||||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||||
SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, i);
|
pSupInfo->colId[i] = pCols[i].colId;
|
||||||
pSupInfo->colIds[i] = pCol->info.colId;
|
pSupInfo->slotId[i] = pSlotIdList[i];
|
||||||
|
|
||||||
if (IS_VAR_DATA_TYPE(pCol->info.type)) {
|
if (IS_VAR_DATA_TYPE(pCols[i].type)) {
|
||||||
pSupInfo->buildBuf[i] = taosMemoryMalloc(pCol->info.bytes);
|
pSupInfo->buildBuf[i] = taosMemoryMalloc(pCols[i].bytes);
|
||||||
|
} else {
|
||||||
|
pSupInfo->buildBuf[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -244,7 +248,7 @@ static void updateBlockSMAInfo(STSchema* pSchema, SBlockLoadSuppInfo* pSupInfo)
|
||||||
|
|
||||||
while (i < pSchema->numOfCols && j < pSupInfo->numOfCols) {
|
while (i < pSchema->numOfCols && j < pSupInfo->numOfCols) {
|
||||||
STColumn* pTCol = &pSchema->columns[i];
|
STColumn* pTCol = &pSchema->columns[i];
|
||||||
if (pTCol->colId == pSupInfo->colIds[j]) {
|
if (pTCol->colId == pSupInfo->colId[j]) {
|
||||||
if (!IS_BSMA_ON(pTCol)) {
|
if (!IS_BSMA_ON(pTCol)) {
|
||||||
pSupInfo->smaValid = false;
|
pSupInfo->smaValid = false;
|
||||||
return;
|
return;
|
||||||
|
|
@ -252,7 +256,7 @@ static void updateBlockSMAInfo(STSchema* pSchema, SBlockLoadSuppInfo* pSupInfo)
|
||||||
|
|
||||||
i += 1;
|
i += 1;
|
||||||
j += 1;
|
j += 1;
|
||||||
} else if (pTCol->colId < pSupInfo->colIds[j]) {
|
} else if (pTCol->colId < pSupInfo->colId[j]) {
|
||||||
// do nothing
|
// do nothing
|
||||||
i += 1;
|
i += 1;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -455,7 +459,7 @@ static int32_t initFilesetIterator(SFilesetIter* pIter, SArray* aDFileSet, STsdb
|
||||||
if (pLReader->pInfo == NULL) {
|
if (pLReader->pInfo == NULL) {
|
||||||
// here we ignore the first column, which is always be the primary timestamp column
|
// here we ignore the first column, which is always be the primary timestamp column
|
||||||
pLReader->pInfo =
|
pLReader->pInfo =
|
||||||
tCreateLastBlockLoadInfo(pReader->pSchema, &pReader->suppInfo.colIds[1], pReader->suppInfo.numOfCols - 1);
|
tCreateLastBlockLoadInfo(pReader->pSchema, &pReader->suppInfo.colId[1], pReader->suppInfo.numOfCols - 1);
|
||||||
if (pLReader->pInfo == NULL) {
|
if (pLReader->pInfo == NULL) {
|
||||||
tsdbDebug("init fileset iterator failed, code:%s %s", tstrerror(terrno), pReader->idStr);
|
tsdbDebug("init fileset iterator failed, code:%s %s", tstrerror(terrno), pReader->idStr);
|
||||||
return terrno;
|
return terrno;
|
||||||
|
|
@ -567,7 +571,7 @@ static SSDataBlock* createResBlock(SQueryTableDataCond* pCond, int32_t capacity)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsdbReader** ppReader, int32_t capacity,
|
static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsdbReader** ppReader, int32_t capacity,
|
||||||
const char* idstr) {
|
SSDataBlock* pResBlock, const char* idstr) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
int8_t level = 0;
|
int8_t level = 0;
|
||||||
STsdbReader* pReader = (STsdbReader*)taosMemoryCalloc(1, sizeof(*pReader));
|
STsdbReader* pReader = (STsdbReader*)taosMemoryCalloc(1, sizeof(*pReader));
|
||||||
|
|
@ -586,6 +590,7 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd
|
||||||
pReader->suid = pCond->suid;
|
pReader->suid = pCond->suid;
|
||||||
pReader->order = pCond->order;
|
pReader->order = pCond->order;
|
||||||
pReader->capacity = capacity;
|
pReader->capacity = capacity;
|
||||||
|
pReader->pResBlock = pResBlock;
|
||||||
pReader->idStr = (idstr != NULL) ? strdup(idstr) : NULL;
|
pReader->idStr = (idstr != NULL) ? strdup(idstr) : NULL;
|
||||||
pReader->verRange = getQueryVerRange(pVnode, pCond, level);
|
pReader->verRange = getQueryVerRange(pVnode, pCond, level);
|
||||||
pReader->type = pCond->type;
|
pReader->type = pCond->type;
|
||||||
|
|
@ -593,13 +598,22 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd
|
||||||
pReader->blockInfoBuf.numPerBucket = 1000; // 1000 tables per bucket
|
pReader->blockInfoBuf.numPerBucket = 1000; // 1000 tables per bucket
|
||||||
ASSERT(pCond->numOfCols > 0);
|
ASSERT(pCond->numOfCols > 0);
|
||||||
|
|
||||||
|
if (pReader->pResBlock == NULL) {
|
||||||
|
pReader->freeBlock = true;
|
||||||
|
pReader->pResBlock = createResBlock(pCond, pReader->capacity);
|
||||||
|
if (pReader->pResBlock == NULL) {
|
||||||
|
code = terrno;
|
||||||
|
goto _end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// todo refactor.
|
||||||
limitOutputBufferSize(pCond, &pReader->capacity);
|
limitOutputBufferSize(pCond, &pReader->capacity);
|
||||||
|
|
||||||
// allocate buffer in order to load data blocks from file
|
// allocate buffer in order to load data blocks from file
|
||||||
SBlockLoadSuppInfo* pSup = &pReader->suppInfo;
|
SBlockLoadSuppInfo* pSup = &pReader->suppInfo;
|
||||||
pSup->pColAgg = taosArrayInit(pCond->numOfCols, sizeof(SColumnDataAgg));
|
pSup->pColAgg = taosArrayInit(pCond->numOfCols, sizeof(SColumnDataAgg));
|
||||||
pSup->plist = taosMemoryCalloc(pCond->numOfCols, POINTER_BYTES);
|
if (pSup->pColAgg == NULL) {
|
||||||
if (pSup->pColAgg == NULL || pSup->plist == NULL) {
|
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
|
|
@ -612,13 +626,7 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
|
|
||||||
pReader->pResBlock = createResBlock(pCond, pReader->capacity);
|
setColumnIdSlotList(&pReader->suppInfo, pCond->colList, pCond->pSlotList, pCond->numOfCols);
|
||||||
if (pReader->pResBlock == NULL) {
|
|
||||||
code = terrno;
|
|
||||||
goto _end;
|
|
||||||
}
|
|
||||||
|
|
||||||
setColumnIdSlotList(&pReader->suppInfo, pReader->pResBlock);
|
|
||||||
|
|
||||||
*ppReader = pReader;
|
*ppReader = pReader;
|
||||||
return code;
|
return code;
|
||||||
|
|
@ -1043,17 +1051,16 @@ static void copyNumericCols(const SColData* pData, SFileBlockDumpInfo* pDumpInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanInfo* pBlockScanInfo) {
|
static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanInfo* pBlockScanInfo) {
|
||||||
SReaderStatus* pStatus = &pReader->status;
|
SReaderStatus* pStatus = &pReader->status;
|
||||||
SDataBlockIter* pBlockIter = &pStatus->blockIter;
|
SDataBlockIter* pBlockIter = &pStatus->blockIter;
|
||||||
|
SBlockLoadSuppInfo* pSupInfo = &pReader->suppInfo;
|
||||||
|
SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo;
|
||||||
|
|
||||||
SBlockData* pBlockData = &pStatus->fileBlockData;
|
SBlockData* pBlockData = &pStatus->fileBlockData;
|
||||||
SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(pBlockIter);
|
SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(pBlockIter);
|
||||||
SDataBlk* pBlock = getCurrentBlock(pBlockIter);
|
SDataBlk* pBlock = getCurrentBlock(pBlockIter);
|
||||||
SSDataBlock* pResBlock = pReader->pResBlock;
|
SSDataBlock* pResBlock = pReader->pResBlock;
|
||||||
int32_t numOfOutputCols = blockDataGetNumOfCols(pResBlock);
|
int32_t numOfOutputCols = pSupInfo->numOfCols;
|
||||||
|
|
||||||
SBlockLoadSuppInfo* pSupInfo = &pReader->suppInfo;
|
|
||||||
SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo;
|
|
||||||
|
|
||||||
SColVal cv = {0};
|
SColVal cv = {0};
|
||||||
int64_t st = taosGetTimestampUs();
|
int64_t st = taosGetTimestampUs();
|
||||||
|
|
@ -1089,8 +1096,8 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn
|
||||||
int32_t i = 0;
|
int32_t i = 0;
|
||||||
int32_t rowIndex = 0;
|
int32_t rowIndex = 0;
|
||||||
|
|
||||||
SColumnInfoData* pColData = taosArrayGet(pResBlock->pDataBlock, i);
|
SColumnInfoData* pColData = taosArrayGet(pResBlock->pDataBlock, pSupInfo->slotId[i]);
|
||||||
if (pColData->info.colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
if (pSupInfo->colId[i] == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
||||||
copyPrimaryTsCol(pBlockData, pDumpInfo, pColData, dumpedRows, asc);
|
copyPrimaryTsCol(pBlockData, pDumpInfo, pColData, dumpedRows, asc);
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
|
|
@ -1099,12 +1106,13 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn
|
||||||
int32_t num = pBlockData->nColData;
|
int32_t num = pBlockData->nColData;
|
||||||
while (i < numOfOutputCols && colIndex < num) {
|
while (i < numOfOutputCols && colIndex < num) {
|
||||||
rowIndex = 0;
|
rowIndex = 0;
|
||||||
pColData = taosArrayGet(pResBlock->pDataBlock, i);
|
|
||||||
|
|
||||||
SColData* pData = tBlockDataGetColDataByIdx(pBlockData, colIndex);
|
SColData* pData = tBlockDataGetColDataByIdx(pBlockData, colIndex);
|
||||||
if (pData->cid < pColData->info.colId) {
|
if (pData->cid < pSupInfo->colId[i]) {
|
||||||
colIndex += 1;
|
colIndex += 1;
|
||||||
} else if (pData->cid == pColData->info.colId) {
|
} else if (pData->cid == pSupInfo->colId[i]) {
|
||||||
|
pColData = taosArrayGet(pResBlock->pDataBlock, pSupInfo->slotId[i]);
|
||||||
|
|
||||||
if (pData->flag == HAS_NONE || pData->flag == HAS_NULL || pData->flag == (HAS_NULL | HAS_NONE)) {
|
if (pData->flag == HAS_NONE || pData->flag == HAS_NULL || pData->flag == (HAS_NULL | HAS_NONE)) {
|
||||||
colDataAppendNNULL(pColData, 0, dumpedRows);
|
colDataAppendNNULL(pColData, 0, dumpedRows);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1121,6 +1129,7 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn
|
||||||
colIndex += 1;
|
colIndex += 1;
|
||||||
i += 1;
|
i += 1;
|
||||||
} else { // the specified column does not exist in file block, fill with null data
|
} else { // the specified column does not exist in file block, fill with null data
|
||||||
|
pColData = taosArrayGet(pResBlock->pDataBlock, pSupInfo->slotId[i]);
|
||||||
colDataAppendNNULL(pColData, 0, dumpedRows);
|
colDataAppendNNULL(pColData, 0, dumpedRows);
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
|
|
@ -1128,7 +1137,7 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn
|
||||||
|
|
||||||
// fill the mis-matched columns with null value
|
// fill the mis-matched columns with null value
|
||||||
while (i < numOfOutputCols) {
|
while (i < numOfOutputCols) {
|
||||||
pColData = taosArrayGet(pResBlock->pDataBlock, i);
|
pColData = taosArrayGet(pResBlock->pDataBlock, pSupInfo->slotId[i]);
|
||||||
colDataAppendNNULL(pColData, 0, dumpedRows);
|
colDataAppendNNULL(pColData, 0, dumpedRows);
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
|
|
@ -1166,7 +1175,7 @@ static int32_t doLoadFileBlockData(STsdbReader* pReader, SDataBlockIter* pBlockI
|
||||||
tBlockDataReset(pBlockData);
|
tBlockDataReset(pBlockData);
|
||||||
TABLEID tid = {.suid = pReader->suid, .uid = uid};
|
TABLEID tid = {.suid = pReader->suid, .uid = uid};
|
||||||
int32_t code =
|
int32_t code =
|
||||||
tBlockDataInit(pBlockData, &tid, pReader->pSchema, &pReader->suppInfo.colIds[1], pReader->suppInfo.numOfCols - 1);
|
tBlockDataInit(pBlockData, &tid, pReader->pSchema, &pReader->suppInfo.colId[1], pReader->suppInfo.numOfCols - 1);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
@ -1304,7 +1313,7 @@ static int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIte
|
||||||
char* buf = taosMemoryMalloc(sizeof(SBlockOrderWrapper) * num);
|
char* buf = taosMemoryMalloc(sizeof(SBlockOrderWrapper) * num);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
cleanupBlockOrderSupporter(&sup);
|
cleanupBlockOrderSupporter(&sup);
|
||||||
return TSDB_CODE_TDB_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
sup.pDataBlockInfo[sup.numOfTables] = (SBlockOrderWrapper*)buf;
|
sup.pDataBlockInfo[sup.numOfTables] = (SBlockOrderWrapper*)buf;
|
||||||
|
|
@ -1347,7 +1356,7 @@ static int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIte
|
||||||
uint8_t ret = tMergeTreeCreate(&pTree, sup.numOfTables, &sup, fileDataBlockOrderCompar);
|
uint8_t ret = tMergeTreeCreate(&pTree, sup.numOfTables, &sup, fileDataBlockOrderCompar);
|
||||||
if (ret != TSDB_CODE_SUCCESS) {
|
if (ret != TSDB_CODE_SUCCESS) {
|
||||||
cleanupBlockOrderSupporter(&sup);
|
cleanupBlockOrderSupporter(&sup);
|
||||||
return TSDB_CODE_TDB_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t numOfTotal = 0;
|
int32_t numOfTotal = 0;
|
||||||
|
|
@ -1625,7 +1634,7 @@ static int32_t buildDataBlockFromBuf(STsdbReader* pReader, STableBlockScanInfo*
|
||||||
int64_t st = taosGetTimestampUs();
|
int64_t st = taosGetTimestampUs();
|
||||||
int32_t code = buildDataBlockFromBufImpl(pBlockScanInfo, endKey, pReader->capacity, pReader);
|
int32_t code = buildDataBlockFromBufImpl(pBlockScanInfo, endKey, pReader->capacity, pReader);
|
||||||
|
|
||||||
blockDataUpdateTsWindow(pBlock, 0);
|
blockDataUpdateTsWindow(pBlock, pReader->suppInfo.slotId[0]);
|
||||||
pBlock->info.id.uid = pBlockScanInfo->uid;
|
pBlock->info.id.uid = pBlockScanInfo->uid;
|
||||||
|
|
||||||
setComposedBlockFlag(pReader, true);
|
setComposedBlockFlag(pReader, true);
|
||||||
|
|
@ -2497,7 +2506,7 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) {
|
||||||
|
|
||||||
_end:
|
_end:
|
||||||
pResBlock->info.id.uid = (pBlockScanInfo != NULL) ? pBlockScanInfo->uid : 0;
|
pResBlock->info.id.uid = (pBlockScanInfo != NULL) ? pBlockScanInfo->uid : 0;
|
||||||
blockDataUpdateTsWindow(pResBlock, 0);
|
blockDataUpdateTsWindow(pResBlock, pReader->suppInfo.slotId[0]);
|
||||||
|
|
||||||
setComposedBlockFlag(pReader, true);
|
setComposedBlockFlag(pReader, true);
|
||||||
double el = (taosGetTimestampUs() - st) / 1000.0;
|
double el = (taosGetTimestampUs() - st) / 1000.0;
|
||||||
|
|
@ -2524,42 +2533,18 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader*
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
STsdb* pTsdb = pReader->pTsdb;
|
|
||||||
|
|
||||||
SArray* pDelData = taosArrayInit(4, sizeof(SDelData));
|
SArray* pDelData = taosArrayInit(4, sizeof(SDelData));
|
||||||
|
ASSERT(pReader->pReadSnap != NULL);
|
||||||
|
|
||||||
SDelFile* pDelFile = pReader->pReadSnap->fs.pDelFile;
|
SDelFile* pDelFile = pReader->pReadSnap->fs.pDelFile;
|
||||||
if (pDelFile) {
|
if (pDelFile && taosArrayGetSize(pReader->pDelIdx) > 0) {
|
||||||
SDelFReader* pDelFReader = NULL;
|
|
||||||
code = tsdbDelFReaderOpen(&pDelFReader, pDelFile, pTsdb);
|
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
|
||||||
goto _err;
|
|
||||||
}
|
|
||||||
|
|
||||||
SArray* aDelIdx = taosArrayInit(4, sizeof(SDelIdx));
|
|
||||||
if (aDelIdx == NULL) {
|
|
||||||
tsdbDelFReaderClose(&pDelFReader);
|
|
||||||
goto _err;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: opt the perf of read del index
|
|
||||||
code = tsdbReadDelIdx(pDelFReader, aDelIdx);
|
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
|
||||||
taosArrayDestroy(aDelIdx);
|
|
||||||
tsdbDelFReaderClose(&pDelFReader);
|
|
||||||
goto _err;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDelIdx idx = {.suid = pReader->suid, .uid = pBlockScanInfo->uid};
|
SDelIdx idx = {.suid = pReader->suid, .uid = pBlockScanInfo->uid};
|
||||||
SDelIdx* pIdx = taosArraySearch(aDelIdx, &idx, tCmprDelIdx, TD_EQ);
|
SDelIdx* pIdx = taosArraySearch(pReader->pDelIdx, &idx, tCmprDelIdx, TD_EQ);
|
||||||
|
|
||||||
if (pIdx != NULL) {
|
if (pIdx != NULL) {
|
||||||
code = tsdbReadDelData(pDelFReader, pIdx, pDelData);
|
code = tsdbReadDelData(pReader->pDelFReader, pIdx, pDelData);
|
||||||
}
|
}
|
||||||
|
|
||||||
taosArrayDestroy(aDelIdx);
|
|
||||||
tsdbDelFReaderClose(&pDelFReader);
|
|
||||||
|
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
@ -2655,6 +2640,29 @@ static int32_t moveToNextFile(STsdbReader* pReader, SBlockNumber* pBlockNum) {
|
||||||
}
|
}
|
||||||
|
|
||||||
taosArrayDestroy(pIndexList);
|
taosArrayDestroy(pIndexList);
|
||||||
|
|
||||||
|
if (pReader->pReadSnap != NULL) {
|
||||||
|
SDelFile* pDelFile = pReader->pReadSnap->fs.pDelFile;
|
||||||
|
if (pReader->pDelFReader == NULL && pDelFile != NULL) {
|
||||||
|
int32_t code = tsdbDelFReaderOpen(&pReader->pDelFReader, pDelFile, pReader->pTsdb);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
pReader->pDelIdx = taosArrayInit(4, sizeof(SDelIdx));
|
||||||
|
if (pReader->pDelIdx == NULL) {
|
||||||
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
code = tsdbReadDelIdx(pReader->pDelFReader, pReader->pDelIdx);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
taosArrayDestroy(pReader->pDelIdx);
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3553,15 +3561,14 @@ int32_t doAppendRowFromTSRow(SSDataBlock* pBlock, STsdbReader* pReader, SRow* pT
|
||||||
SColVal colVal = {0};
|
SColVal colVal = {0};
|
||||||
int32_t i = 0, j = 0;
|
int32_t i = 0, j = 0;
|
||||||
|
|
||||||
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i);
|
if (pSupInfo->colId[i] == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
||||||
if (pColInfoData->info.colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, pSupInfo->slotId[i]);
|
||||||
colDataAppend(pColInfoData, numOfRows, (const char*)&pTSRow->ts, false);
|
((int64_t*)pColData->pData)[outputRowIndex] = pTSRow->ts;
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (i < numOfCols && j < pSchema->numOfCols) {
|
while (i < pSupInfo->numOfCols && j < pSchema->numOfCols) {
|
||||||
pColInfoData = taosArrayGet(pBlock->pDataBlock, i);
|
col_id_t colId = pSupInfo->colId[i];
|
||||||
col_id_t colId = pColInfoData->info.colId;
|
|
||||||
|
|
||||||
if (colId == pSchema->columns[j].colId) {
|
if (colId == pSchema->columns[j].colId) {
|
||||||
tRowGet(pTSRow, pSchema, j, &colVal);
|
tRowGet(pTSRow, pSchema, j, &colVal);
|
||||||
|
|
@ -3569,7 +3576,9 @@ int32_t doAppendRowFromTSRow(SSDataBlock* pBlock, STsdbReader* pReader, SRow* pT
|
||||||
i += 1;
|
i += 1;
|
||||||
j += 1;
|
j += 1;
|
||||||
} else if (colId < pSchema->columns[j].colId) {
|
} else if (colId < pSchema->columns[j].colId) {
|
||||||
colDataAppendNULL(pColInfoData, numOfRows);
|
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, pSupInfo->slotId[i]);
|
||||||
|
|
||||||
|
colDataAppendNULL(pColInfoData, outputRowIndex);
|
||||||
i += 1;
|
i += 1;
|
||||||
} else if (colId > pSchema->columns[j].colId) {
|
} else if (colId > pSchema->columns[j].colId) {
|
||||||
j += 1;
|
j += 1;
|
||||||
|
|
@ -3577,9 +3586,9 @@ int32_t doAppendRowFromTSRow(SSDataBlock* pBlock, STsdbReader* pReader, SRow* pT
|
||||||
}
|
}
|
||||||
|
|
||||||
// set null value since current column does not exist in the "pSchema"
|
// set null value since current column does not exist in the "pSchema"
|
||||||
while (i < numOfCols) {
|
while (i < pSupInfo->numOfCols) {
|
||||||
pColInfoData = taosArrayGet(pBlock->pDataBlock, i);
|
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, pSupInfo->slotId[i]);
|
||||||
colDataAppendNULL(pColInfoData, numOfRows);
|
colDataAppendNULL(pColInfoData, outputRowIndex);
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3594,27 +3603,25 @@ int32_t doAppendRowFromFileBlock(SSDataBlock* pResBlock, STsdbReader* pReader, S
|
||||||
int32_t outputRowIndex = pResBlock->info.rows;
|
int32_t outputRowIndex = pResBlock->info.rows;
|
||||||
|
|
||||||
SBlockLoadSuppInfo* pSupInfo = &pReader->suppInfo;
|
SBlockLoadSuppInfo* pSupInfo = &pReader->suppInfo;
|
||||||
|
if (pReader->suppInfo.colId[i] == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
||||||
SColumnInfoData* pColData = taosArrayGet(pResBlock->pDataBlock, i);
|
SColumnInfoData* pColData = taosArrayGet(pResBlock->pDataBlock, pSupInfo->slotId[i]);
|
||||||
if (pColData->info.colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
((int64_t*)pColData->pData)[outputRowIndex] = pBlockData->aTSKEY[rowIndex];
|
||||||
colDataAppendInt64(pColData, outputRowIndex, &pBlockData->aTSKEY[rowIndex]);
|
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SColVal cv = {0};
|
SColVal cv = {0};
|
||||||
int32_t numOfInputCols = pBlockData->nColData;
|
int32_t numOfInputCols = pBlockData->nColData;
|
||||||
int32_t numOfOutputCols = pResBlock->pDataBlock->size;
|
int32_t numOfOutputCols = pSupInfo->numOfCols;
|
||||||
|
|
||||||
while (i < numOfOutputCols && j < numOfInputCols) {
|
while (i < numOfOutputCols && j < numOfInputCols) {
|
||||||
SColumnInfoData* pCol = TARRAY_GET_ELEM(pResBlock->pDataBlock, i);
|
SColData* pData = tBlockDataGetColDataByIdx(pBlockData, j);
|
||||||
SColData* pData = tBlockDataGetColDataByIdx(pBlockData, j);
|
if (pData->cid < pSupInfo->colId[i]) {
|
||||||
|
|
||||||
if (pData->cid < pCol->info.colId) {
|
|
||||||
j += 1;
|
j += 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pData->cid == pCol->info.colId) {
|
SColumnInfoData* pCol = TARRAY_GET_ELEM(pResBlock->pDataBlock, pSupInfo->slotId[i]);
|
||||||
|
if (pData->cid == pSupInfo->colId[i]) {
|
||||||
tColDataGetValue(pData, rowIndex, &cv);
|
tColDataGetValue(pData, rowIndex, &cv);
|
||||||
doCopyColVal(pCol, outputRowIndex, i, &cv, pSupInfo);
|
doCopyColVal(pCol, outputRowIndex, i, &cv, pSupInfo);
|
||||||
j += 1;
|
j += 1;
|
||||||
|
|
@ -3627,7 +3634,7 @@ int32_t doAppendRowFromFileBlock(SSDataBlock* pResBlock, STsdbReader* pReader, S
|
||||||
}
|
}
|
||||||
|
|
||||||
while (i < numOfOutputCols) {
|
while (i < numOfOutputCols) {
|
||||||
SColumnInfoData* pCol = taosArrayGet(pResBlock->pDataBlock, i);
|
SColumnInfoData* pCol = taosArrayGet(pResBlock->pDataBlock, pSupInfo->slotId[i]);
|
||||||
colDataAppendNULL(pCol, outputRowIndex);
|
colDataAppendNULL(pCol, outputRowIndex);
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
|
|
@ -3641,9 +3648,9 @@ int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t e
|
||||||
SSDataBlock* pBlock = pReader->pResBlock;
|
SSDataBlock* pBlock = pReader->pResBlock;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
// SRow* pTSRow = NULL;
|
// SRow* pTSRow = NULL;
|
||||||
TSDBROW row = {.type = -1};
|
TSDBROW row = {.type = -1};
|
||||||
bool freeTSRow = false;
|
bool freeTSRow = false;
|
||||||
tsdbGetNextRowInMem(pBlockScanInfo, pReader, &row, endKey, &freeTSRow);
|
tsdbGetNextRowInMem(pBlockScanInfo, pReader, &row, endKey, &freeTSRow);
|
||||||
if (row.type == -1) {
|
if (row.type == -1) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -3731,14 +3738,21 @@ static int32_t doOpenReaderImpl(STsdbReader* pReader) {
|
||||||
|
|
||||||
// ====================================== EXPOSED APIs ======================================
|
// ====================================== EXPOSED APIs ======================================
|
||||||
int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, void* pTableList, int32_t numOfTables,
|
int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, void* pTableList, int32_t numOfTables,
|
||||||
STsdbReader** ppReader, const char* idstr) {
|
SSDataBlock* pResBlock, STsdbReader** ppReader, const char* idstr) {
|
||||||
STimeWindow window = pCond->twindows;
|
STimeWindow window = pCond->twindows;
|
||||||
if (pCond->type == TIMEWINDOW_RANGE_EXTERNAL) {
|
if (pCond->type == TIMEWINDOW_RANGE_EXTERNAL) {
|
||||||
pCond->twindows.skey += 1;
|
pCond->twindows.skey += 1;
|
||||||
pCond->twindows.ekey -= 1;
|
pCond->twindows.ekey -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t code = tsdbReaderCreate(pVnode, pCond, ppReader, 4096, idstr);
|
int32_t capacity = 0;
|
||||||
|
if (pResBlock == NULL) {
|
||||||
|
capacity = 4096;
|
||||||
|
} else {
|
||||||
|
capacity = pResBlock->info.capacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t code = tsdbReaderCreate(pVnode, pCond, ppReader, capacity, pResBlock, idstr);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
@ -3764,7 +3778,7 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, void* pTableL
|
||||||
}
|
}
|
||||||
|
|
||||||
// here we only need one more row, so the capacity is set to be ONE.
|
// here we only need one more row, so the capacity is set to be ONE.
|
||||||
code = tsdbReaderCreate(pVnode, pCond, &pReader->innerReader[0], 1, idstr);
|
code = tsdbReaderCreate(pVnode, pCond, &pReader->innerReader[0], 1, pResBlock, idstr);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
@ -3778,7 +3792,7 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, void* pTableL
|
||||||
}
|
}
|
||||||
pCond->order = order;
|
pCond->order = order;
|
||||||
|
|
||||||
code = tsdbReaderCreate(pVnode, pCond, &pReader->innerReader[1], 1, idstr);
|
code = tsdbReaderCreate(pVnode, pCond, &pReader->innerReader[1], 1, pResBlock, idstr);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
@ -3808,7 +3822,7 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, void* pTableL
|
||||||
tsdbReaderClose(p);
|
tsdbReaderClose(p);
|
||||||
*ppReader = NULL;
|
*ppReader = NULL;
|
||||||
|
|
||||||
code = TSDB_CODE_TDB_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3883,19 +3897,21 @@ void tsdbReaderClose(STsdbReader* pReader) {
|
||||||
|
|
||||||
SBlockLoadSuppInfo* pSupInfo = &pReader->suppInfo;
|
SBlockLoadSuppInfo* pSupInfo = &pReader->suppInfo;
|
||||||
|
|
||||||
taosMemoryFreeClear(pSupInfo->plist);
|
|
||||||
taosMemoryFree(pSupInfo->colIds);
|
|
||||||
|
|
||||||
taosArrayDestroy(pSupInfo->pColAgg);
|
taosArrayDestroy(pSupInfo->pColAgg);
|
||||||
for (int32_t i = 0; i < blockDataGetNumOfCols(pReader->pResBlock); ++i) {
|
for (int32_t i = 0; i < pSupInfo->numOfCols; ++i) {
|
||||||
if (pSupInfo->buildBuf[i] != NULL) {
|
if (pSupInfo->buildBuf[i] != NULL) {
|
||||||
taosMemoryFreeClear(pSupInfo->buildBuf[i]);
|
taosMemoryFreeClear(pSupInfo->buildBuf[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pReader->freeBlock) {
|
||||||
|
pReader->pResBlock = blockDataDestroy(pReader->pResBlock);
|
||||||
|
}
|
||||||
taosMemoryFree(pSupInfo->buildBuf);
|
taosMemoryFree(pSupInfo->buildBuf);
|
||||||
tBlockDataDestroy(&pReader->status.fileBlockData);
|
tBlockDataDestroy(&pReader->status.fileBlockData);
|
||||||
|
|
||||||
|
taosMemoryFree(pSupInfo->colId);
|
||||||
|
tBlockDataDestroy(&pReader->status.fileBlockData, true);
|
||||||
cleanupDataBlockIterator(&pReader->status.blockIter);
|
cleanupDataBlockIterator(&pReader->status.blockIter);
|
||||||
|
|
||||||
size_t numOfTables = taosHashGetSize(pReader->status.pTableMap);
|
size_t numOfTables = taosHashGetSize(pReader->status.pTableMap);
|
||||||
|
|
@ -3904,12 +3920,19 @@ void tsdbReaderClose(STsdbReader* pReader) {
|
||||||
clearBlockScanInfoBuf(&pReader->blockInfoBuf);
|
clearBlockScanInfoBuf(&pReader->blockInfoBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
blockDataDestroy(pReader->pResBlock);
|
|
||||||
|
|
||||||
if (pReader->pFileReader != NULL) {
|
if (pReader->pFileReader != NULL) {
|
||||||
tsdbDataFReaderClose(&pReader->pFileReader);
|
tsdbDataFReaderClose(&pReader->pFileReader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pReader->pDelFReader != NULL) {
|
||||||
|
tsdbDelFReaderClose(&pReader->pDelFReader);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pReader->pDelIdx != NULL) {
|
||||||
|
taosArrayDestroy(pReader->pDelIdx);
|
||||||
|
pReader->pDelIdx = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
tsdbUntakeReadSnap(pReader->pTsdb, pReader->pReadSnap, pReader->idStr);
|
tsdbUntakeReadSnap(pReader->pTsdb, pReader->pReadSnap, pReader->idStr);
|
||||||
|
|
||||||
taosMemoryFree(pReader->status.uidCheckInfo.tableUidList);
|
taosMemoryFree(pReader->status.uidCheckInfo.tableUidList);
|
||||||
|
|
@ -3951,6 +3974,9 @@ static bool doTsdbNextDataBlock(STsdbReader* pReader) {
|
||||||
blockDataCleanup(pBlock);
|
blockDataCleanup(pBlock);
|
||||||
|
|
||||||
SReaderStatus* pStatus = &pReader->status;
|
SReaderStatus* pStatus = &pReader->status;
|
||||||
|
if (taosHashGetSize(pStatus->pTableMap) == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (pStatus->loadFromFile) {
|
if (pStatus->loadFromFile) {
|
||||||
int32_t code = buildBlockFromFiles(pReader);
|
int32_t code = buildBlockFromFiles(pReader);
|
||||||
|
|
@ -3968,8 +3994,6 @@ static bool doTsdbNextDataBlock(STsdbReader* pReader) {
|
||||||
buildBlockFromBufferSequentially(pReader);
|
buildBlockFromBufferSequentially(pReader);
|
||||||
return pBlock->info.rows > 0;
|
return pBlock->info.rows > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tsdbNextDataBlock(STsdbReader* pReader) {
|
bool tsdbNextDataBlock(STsdbReader* pReader) {
|
||||||
|
|
@ -4020,16 +4044,6 @@ bool tsdbNextDataBlock(STsdbReader* pReader) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tsdbTableNextDataBlock(STsdbReader* pReader, uint64_t uid) {
|
|
||||||
STableBlockScanInfo* pBlockScanInfo =
|
|
||||||
*(STableBlockScanInfo**)taosHashGet(pReader->status.pTableMap, &uid, sizeof(uid));
|
|
||||||
if (pBlockScanInfo == NULL) { // no data block for the table of given uid
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void setBlockInfo(const STsdbReader* pReader, int32_t* rows, uint64_t* uid, STimeWindow* pWindow) {
|
static void setBlockInfo(const STsdbReader* pReader, int32_t* rows, uint64_t* uid, STimeWindow* pWindow) {
|
||||||
ASSERT(pReader != NULL);
|
ASSERT(pReader != NULL);
|
||||||
*rows = pReader->pResBlock->info.rows;
|
*rows = pReader->pResBlock->info.rows;
|
||||||
|
|
@ -4051,28 +4065,27 @@ void tsdbRetrieveDataBlockInfo(const STsdbReader* pReader, int32_t* rows, uint64
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SColumnDataAgg*** pBlockStatis, bool* allHave) {
|
int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SColumnDataAgg*** pBlockSMA, bool* allHave) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
*allHave = false;
|
*allHave = false;
|
||||||
|
|
||||||
if (pReader->type == TIMEWINDOW_RANGE_EXTERNAL) {
|
if (pReader->type == TIMEWINDOW_RANGE_EXTERNAL) {
|
||||||
*pBlockStatis = NULL;
|
*pBlockSMA = NULL;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// there is no statistics data for composed block
|
// there is no statistics data for composed block
|
||||||
if (pReader->status.composedDataBlock || (!pReader->suppInfo.smaValid)) {
|
if (pReader->status.composedDataBlock || (!pReader->suppInfo.smaValid)) {
|
||||||
*pBlockStatis = NULL;
|
*pBlockSMA = NULL;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
SFileDataBlockInfo* pFBlock = getCurrentBlockInfo(&pReader->status.blockIter);
|
SFileDataBlockInfo* pFBlock = getCurrentBlockInfo(&pReader->status.blockIter);
|
||||||
|
|
||||||
SDataBlk* pBlock = getCurrentBlock(&pReader->status.blockIter);
|
|
||||||
// int64_t stime = taosGetTimestampUs();
|
|
||||||
|
|
||||||
SBlockLoadSuppInfo* pSup = &pReader->suppInfo;
|
SBlockLoadSuppInfo* pSup = &pReader->suppInfo;
|
||||||
|
|
||||||
|
ASSERT(pReader->pResBlock->info.id.uid == pFBlock->uid);
|
||||||
|
|
||||||
|
SDataBlk* pBlock = getCurrentBlock(&pReader->status.blockIter);
|
||||||
if (tDataBlkHasSma(pBlock)) {
|
if (tDataBlkHasSma(pBlock)) {
|
||||||
code = tsdbReadBlockSma(pReader->pFileReader, pBlock, pSup->pColAgg);
|
code = tsdbReadBlockSma(pReader->pFileReader, pBlock, pSup->pColAgg);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
|
@ -4081,7 +4094,7 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SColumnDataAgg*** pBlockS
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
*pBlockStatis = NULL;
|
*pBlockSMA = NULL;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4094,80 +4107,53 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SColumnDataAgg*** pBlockS
|
||||||
pTsAgg->colId = PRIMARYKEY_TIMESTAMP_COL_ID;
|
pTsAgg->colId = PRIMARYKEY_TIMESTAMP_COL_ID;
|
||||||
pTsAgg->min = pReader->pResBlock->info.window.skey;
|
pTsAgg->min = pReader->pResBlock->info.window.skey;
|
||||||
pTsAgg->max = pReader->pResBlock->info.window.ekey;
|
pTsAgg->max = pReader->pResBlock->info.window.ekey;
|
||||||
pSup->plist[0] = pTsAgg;
|
|
||||||
|
|
||||||
// update the number of NULL data rows
|
// update the number of NULL data rows
|
||||||
size_t numOfCols = blockDataGetNumOfCols(pReader->pResBlock);
|
size_t numOfCols = pSup->numOfCols;
|
||||||
|
|
||||||
int32_t i = 0, j = 0;
|
int32_t i = 0, j = 0;
|
||||||
size_t size = taosArrayGetSize(pSup->pColAgg);
|
size_t size = taosArrayGetSize(pSup->pColAgg);
|
||||||
#if 0
|
|
||||||
while (j < numOfCols && i < size) {
|
SSDataBlock* pResBlock = pReader->pResBlock;
|
||||||
SColumnDataAgg* pAgg = taosArrayGet(pSup->pColAgg, i);
|
if (pResBlock->pBlockAgg == NULL) {
|
||||||
if (pAgg->colId == pSup->colIds[j]) {
|
size_t num = taosArrayGetSize(pResBlock->pDataBlock);
|
||||||
if (IS_BSMA_ON(&(pReader->pSchema->columns[i]))) {
|
pResBlock->pBlockAgg = taosMemoryCalloc(num, sizeof(SColumnDataAgg));
|
||||||
pSup->plist[j] = pAgg;
|
|
||||||
} else {
|
|
||||||
*allHave = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
i += 1;
|
|
||||||
j += 1;
|
|
||||||
} else if (pAgg->colId < pSup->colIds[j]) {
|
|
||||||
i += 1;
|
|
||||||
} else if (pSup->colIds[j] < pAgg->colId) {
|
|
||||||
j += 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
|
|
||||||
// fill the all null data column
|
|
||||||
SArray* pNewAggList = taosArrayInit(numOfCols, sizeof(SColumnDataAgg));
|
|
||||||
|
|
||||||
while (j < numOfCols && i < size) {
|
while (j < numOfCols && i < size) {
|
||||||
SColumnDataAgg* pAgg = taosArrayGet(pSup->pColAgg, i);
|
SColumnDataAgg* pAgg = taosArrayGet(pSup->pColAgg, i);
|
||||||
if (pAgg->colId == pSup->colIds[j]) {
|
if (pAgg->colId == pSup->colId[j]) {
|
||||||
taosArrayPush(pNewAggList, pAgg);
|
pResBlock->pBlockAgg[pSup->slotId[j]] = pAgg;
|
||||||
i += 1;
|
i += 1;
|
||||||
j += 1;
|
j += 1;
|
||||||
} else if (pAgg->colId < pSup->colIds[j]) {
|
} else if (pAgg->colId < pSup->colId[j]) {
|
||||||
i += 1;
|
i += 1;
|
||||||
} else if (pSup->colIds[j] < pAgg->colId) {
|
} else if (pSup->colId[j] < pAgg->colId) {
|
||||||
if (pSup->colIds[j] == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
if (pSup->colId[j] == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
||||||
taosArrayPush(pNewAggList, &pSup->tsColAgg);
|
pResBlock->pBlockAgg[pSup->slotId[j]] = &pSup->tsColAgg;
|
||||||
} else {
|
} else {
|
||||||
// all date in this block are null
|
// all date in this block are null
|
||||||
SColumnDataAgg nullColAgg = {.colId = pSup->colIds[j], .numOfNull = pBlock->nRow};
|
SColumnDataAgg nullColAgg = {.colId = pSup->colId[j], .numOfNull = pBlock->nRow};
|
||||||
taosArrayPush(pNewAggList, &nullColAgg);
|
taosArrayPush(pSup->pColAgg, &nullColAgg);
|
||||||
|
|
||||||
|
pResBlock->pBlockAgg[pSup->slotId[j]] = taosArrayGetLast(pSup->pColAgg);
|
||||||
}
|
}
|
||||||
j += 1;
|
j += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
taosArrayClear(pSup->pColAgg);
|
*pBlockSMA = pResBlock->pBlockAgg;
|
||||||
taosArrayAddAll(pSup->pColAgg, pNewAggList);
|
|
||||||
|
|
||||||
size_t num = taosArrayGetSize(pSup->pColAgg);
|
|
||||||
for (int32_t k = 0; k < num; ++k) {
|
|
||||||
pSup->plist[k] = taosArrayGet(pSup->pColAgg, k);
|
|
||||||
}
|
|
||||||
|
|
||||||
taosArrayDestroy(pNewAggList);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
pReader->cost.smaDataLoad += 1;
|
pReader->cost.smaDataLoad += 1;
|
||||||
*pBlockStatis = pSup->plist;
|
|
||||||
|
|
||||||
tsdbDebug("vgId:%d, succeed to load block SMA for uid %" PRIu64 ", %s", 0, pFBlock->uid, pReader->idStr);
|
tsdbDebug("vgId:%d, succeed to load block SMA for uid %" PRIu64 ", %s", 0, pFBlock->uid, pReader->idStr);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SArray* doRetrieveDataBlock(STsdbReader* pReader) {
|
static SSDataBlock* doRetrieveDataBlock(STsdbReader* pReader) {
|
||||||
SReaderStatus* pStatus = &pReader->status;
|
SReaderStatus* pStatus = &pReader->status;
|
||||||
|
|
||||||
if (pStatus->composedDataBlock) {
|
if (pStatus->composedDataBlock) {
|
||||||
return pReader->pResBlock->pDataBlock;
|
return pReader->pResBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(&pStatus->blockIter);
|
SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(&pStatus->blockIter);
|
||||||
|
|
@ -4188,10 +4174,10 @@ static SArray* doRetrieveDataBlock(STsdbReader* pReader) {
|
||||||
}
|
}
|
||||||
|
|
||||||
copyBlockDataToSDataBlock(pReader, pBlockScanInfo);
|
copyBlockDataToSDataBlock(pReader, pBlockScanInfo);
|
||||||
return pReader->pResBlock->pDataBlock;
|
return pReader->pResBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
SArray* tsdbRetrieveDataBlock(STsdbReader* pReader, SArray* pIdList) {
|
SSDataBlock* tsdbRetrieveDataBlock(STsdbReader* pReader, SArray* pIdList) {
|
||||||
if (pReader->type == TIMEWINDOW_RANGE_EXTERNAL) {
|
if (pReader->type == TIMEWINDOW_RANGE_EXTERNAL) {
|
||||||
if (pReader->step == EXTERNAL_ROWS_PREV) {
|
if (pReader->step == EXTERNAL_ROWS_PREV) {
|
||||||
return doRetrieveDataBlock(pReader->innerReader[0]);
|
return doRetrieveDataBlock(pReader->innerReader[0]);
|
||||||
|
|
@ -4218,7 +4204,6 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond) {
|
||||||
|
|
||||||
// allocate buffer in order to load data blocks from file
|
// allocate buffer in order to load data blocks from file
|
||||||
memset(&pReader->suppInfo.tsColAgg, 0, sizeof(SColumnDataAgg));
|
memset(&pReader->suppInfo.tsColAgg, 0, sizeof(SColumnDataAgg));
|
||||||
memset(pReader->suppInfo.plist, 0, POINTER_BYTES);
|
|
||||||
|
|
||||||
pReader->suppInfo.tsColAgg.colId = PRIMARYKEY_TIMESTAMP_COL_ID;
|
pReader->suppInfo.tsColAgg.colId = PRIMARYKEY_TIMESTAMP_COL_ID;
|
||||||
tsdbDataFReaderClose(&pReader->pFileReader);
|
tsdbDataFReaderClose(&pReader->pFileReader);
|
||||||
|
|
|
||||||
|
|
@ -750,7 +750,7 @@ int32_t tsdbDFileSetCopy(STsdb *pTsdb, SDFileSet *pSetFrom, SDFileSet *pSetTo) {
|
||||||
// head
|
// head
|
||||||
tsdbHeadFileName(pTsdb, pSetFrom->diskId, pSetFrom->fid, pSetFrom->pHeadF, fNameFrom);
|
tsdbHeadFileName(pTsdb, pSetFrom->diskId, pSetFrom->fid, pSetFrom->pHeadF, fNameFrom);
|
||||||
tsdbHeadFileName(pTsdb, pSetTo->diskId, pSetTo->fid, pSetTo->pHeadF, fNameTo);
|
tsdbHeadFileName(pTsdb, pSetTo->diskId, pSetTo->fid, pSetTo->pHeadF, fNameTo);
|
||||||
pOutFD = taosOpenFile(fNameTo, TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC);
|
pOutFD = taosCreateFile(fNameTo, TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC);
|
||||||
if (pOutFD == NULL) {
|
if (pOutFD == NULL) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = TAOS_SYSTEM_ERROR(errno);
|
||||||
goto _err;
|
goto _err;
|
||||||
|
|
@ -771,7 +771,7 @@ int32_t tsdbDFileSetCopy(STsdb *pTsdb, SDFileSet *pSetFrom, SDFileSet *pSetTo) {
|
||||||
// data
|
// data
|
||||||
tsdbDataFileName(pTsdb, pSetFrom->diskId, pSetFrom->fid, pSetFrom->pDataF, fNameFrom);
|
tsdbDataFileName(pTsdb, pSetFrom->diskId, pSetFrom->fid, pSetFrom->pDataF, fNameFrom);
|
||||||
tsdbDataFileName(pTsdb, pSetTo->diskId, pSetTo->fid, pSetTo->pDataF, fNameTo);
|
tsdbDataFileName(pTsdb, pSetTo->diskId, pSetTo->fid, pSetTo->pDataF, fNameTo);
|
||||||
pOutFD = taosOpenFile(fNameTo, TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC);
|
pOutFD = taosCreateFile(fNameTo, TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC);
|
||||||
if (pOutFD == NULL) {
|
if (pOutFD == NULL) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = TAOS_SYSTEM_ERROR(errno);
|
||||||
goto _err;
|
goto _err;
|
||||||
|
|
@ -781,7 +781,7 @@ int32_t tsdbDFileSetCopy(STsdb *pTsdb, SDFileSet *pSetFrom, SDFileSet *pSetTo) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = TAOS_SYSTEM_ERROR(errno);
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
n = taosFSendFile(pOutFD, PInFD, 0, LOGIC_TO_FILE_OFFSET(pSetFrom->pDataF->size, szPage));
|
n = taosFSendFile(pOutFD, PInFD, 0, tsdbLogicToFileSize(pSetFrom->pDataF->size, szPage));
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = TAOS_SYSTEM_ERROR(errno);
|
||||||
goto _err;
|
goto _err;
|
||||||
|
|
@ -792,7 +792,7 @@ int32_t tsdbDFileSetCopy(STsdb *pTsdb, SDFileSet *pSetFrom, SDFileSet *pSetTo) {
|
||||||
// sma
|
// sma
|
||||||
tsdbSmaFileName(pTsdb, pSetFrom->diskId, pSetFrom->fid, pSetFrom->pSmaF, fNameFrom);
|
tsdbSmaFileName(pTsdb, pSetFrom->diskId, pSetFrom->fid, pSetFrom->pSmaF, fNameFrom);
|
||||||
tsdbSmaFileName(pTsdb, pSetTo->diskId, pSetTo->fid, pSetTo->pSmaF, fNameTo);
|
tsdbSmaFileName(pTsdb, pSetTo->diskId, pSetTo->fid, pSetTo->pSmaF, fNameTo);
|
||||||
pOutFD = taosOpenFile(fNameTo, TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC);
|
pOutFD = taosCreateFile(fNameTo, TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC);
|
||||||
if (pOutFD == NULL) {
|
if (pOutFD == NULL) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = TAOS_SYSTEM_ERROR(errno);
|
||||||
goto _err;
|
goto _err;
|
||||||
|
|
@ -814,7 +814,7 @@ int32_t tsdbDFileSetCopy(STsdb *pTsdb, SDFileSet *pSetFrom, SDFileSet *pSetTo) {
|
||||||
for (int8_t iStt = 0; iStt < pSetFrom->nSttF; iStt++) {
|
for (int8_t iStt = 0; iStt < pSetFrom->nSttF; iStt++) {
|
||||||
tsdbSttFileName(pTsdb, pSetFrom->diskId, pSetFrom->fid, pSetFrom->aSttF[iStt], fNameFrom);
|
tsdbSttFileName(pTsdb, pSetFrom->diskId, pSetFrom->fid, pSetFrom->aSttF[iStt], fNameFrom);
|
||||||
tsdbSttFileName(pTsdb, pSetTo->diskId, pSetTo->fid, pSetTo->aSttF[iStt], fNameTo);
|
tsdbSttFileName(pTsdb, pSetTo->diskId, pSetTo->fid, pSetTo->aSttF[iStt], fNameTo);
|
||||||
pOutFD = taosOpenFile(fNameTo, TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC);
|
pOutFD = taosCreateFile(fNameTo, TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC);
|
||||||
if (pOutFD == NULL) {
|
if (pOutFD == NULL) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = TAOS_SYSTEM_ERROR(errno);
|
||||||
goto _err;
|
goto _err;
|
||||||
|
|
@ -1477,9 +1477,8 @@ int32_t tsdbDelFReaderClose(SDelFReader **ppReader) {
|
||||||
}
|
}
|
||||||
taosMemoryFree(pReader);
|
taosMemoryFree(pReader);
|
||||||
}
|
}
|
||||||
*ppReader = NULL;
|
|
||||||
|
|
||||||
_exit:
|
*ppReader = NULL;
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ int32_t tMapDataToArray(SMapData *pMapData, int32_t itemSize, int32_t (*tGetItem
|
||||||
|
|
||||||
SArray *pArray = taosArrayInit(pMapData->nItem, itemSize);
|
SArray *pArray = taosArrayInit(pMapData->nItem, itemSize);
|
||||||
if (pArray == NULL) {
|
if (pArray == NULL) {
|
||||||
code = TSDB_CODE_TDB_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,14 +14,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "vnd.h"
|
#include "vnd.h"
|
||||||
|
#include "vnodeInt.h"
|
||||||
|
|
||||||
#define VND_INFO_FNAME "vnode.json"
|
#define VND_INFO_FNAME "vnode.json"
|
||||||
#define VND_INFO_FNAME_TMP "vnode_tmp.json"
|
#define VND_INFO_FNAME_TMP "vnode_tmp.json"
|
||||||
|
|
||||||
static int vnodeEncodeInfo(const SVnodeInfo *pInfo, char **ppData);
|
static int vnodeEncodeInfo(const SVnodeInfo *pInfo, char **ppData);
|
||||||
static int vnodeDecodeInfo(uint8_t *pData, SVnodeInfo *pInfo);
|
static int vnodeDecodeInfo(uint8_t *pData, SVnodeInfo *pInfo);
|
||||||
static int vnodeCommitImpl(void *arg);
|
static int vnodeCommitImpl(SCommitInfo *pInfo);
|
||||||
static void vnodeWaitCommit(SVnode *pVnode);
|
|
||||||
|
|
||||||
int vnodeBegin(SVnode *pVnode) {
|
int vnodeBegin(SVnode *pVnode) {
|
||||||
// alloc buffer pool
|
// alloc buffer pool
|
||||||
|
|
@ -107,7 +107,8 @@ int vnodeSaveInfo(const char *dir, const SVnodeInfo *pInfo) {
|
||||||
// free info binary
|
// free info binary
|
||||||
taosMemoryFree(data);
|
taosMemoryFree(data);
|
||||||
|
|
||||||
vInfo("vgId:%d, vnode info is saved, fname:%s replica:%d", pInfo->config.vgId, fname, pInfo->config.syncCfg.replicaNum);
|
vInfo("vgId:%d, vnode info is saved, fname:%s replica:%d", pInfo->config.vgId, fname,
|
||||||
|
pInfo->config.syncCfg.replicaNum);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
@ -185,29 +186,77 @@ _err:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void vnodePrepareCommit(SVnode *pVnode) {
|
||||||
|
tsem_wait(&pVnode->canCommit);
|
||||||
|
|
||||||
|
tsdbPrepareCommit(pVnode->pTsdb);
|
||||||
|
metaPrepareAsyncCommit(pVnode->pMeta);
|
||||||
|
smaPrepareAsyncCommit(pVnode->pSma);
|
||||||
|
|
||||||
|
vnodeBufPoolUnRef(pVnode->inUse);
|
||||||
|
pVnode->inUse = NULL;
|
||||||
|
}
|
||||||
|
static int32_t vnodeCommitTask(void *arg) {
|
||||||
|
int32_t code = 0;
|
||||||
|
|
||||||
|
SCommitInfo *pInfo = (SCommitInfo *)arg;
|
||||||
|
|
||||||
|
// commit
|
||||||
|
code = vnodeCommitImpl(pInfo);
|
||||||
|
if (code) goto _exit;
|
||||||
|
|
||||||
|
// end commit
|
||||||
|
tsem_post(&pInfo->pVnode->canCommit);
|
||||||
|
|
||||||
|
_exit:
|
||||||
|
taosMemoryFree(pInfo);
|
||||||
|
return code;
|
||||||
|
}
|
||||||
int vnodeAsyncCommit(SVnode *pVnode) {
|
int vnodeAsyncCommit(SVnode *pVnode) {
|
||||||
vnodeWaitCommit(pVnode);
|
int32_t code = 0;
|
||||||
|
|
||||||
// vnodeBufPoolSwitch(pVnode);
|
// prepare to commit
|
||||||
// tsdbPrepareCommit(pVnode->pTsdb);
|
vnodePrepareCommit(pVnode);
|
||||||
|
|
||||||
vnodeScheduleTask(vnodeCommitImpl, pVnode);
|
// schedule the task
|
||||||
|
pVnode->state.commitTerm = pVnode->state.applyTerm;
|
||||||
|
|
||||||
return 0;
|
SCommitInfo *pInfo = (SCommitInfo *)taosMemoryCalloc(1, sizeof(*pInfo));
|
||||||
|
if (NULL == pInfo) {
|
||||||
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
goto _exit;
|
||||||
|
}
|
||||||
|
pInfo->info.config = pVnode->config;
|
||||||
|
pInfo->info.state.committed = pVnode->state.applied;
|
||||||
|
pInfo->info.state.commitTerm = pVnode->state.applyTerm;
|
||||||
|
pInfo->info.state.commitID = pVnode->state.commitID;
|
||||||
|
pInfo->pVnode = pVnode;
|
||||||
|
pInfo->txn = metaGetTxn(pVnode->pMeta);
|
||||||
|
vnodeScheduleTask(vnodeCommitTask, pInfo);
|
||||||
|
|
||||||
|
_exit:
|
||||||
|
if (code) {
|
||||||
|
vError("vgId:%d %s failed since %s, commit id:%" PRId64, TD_VID(pVnode), __func__, tstrerror(code),
|
||||||
|
pVnode->state.commitID);
|
||||||
|
} else {
|
||||||
|
vDebug("vgId:%d %s done", TD_VID(pVnode), __func__);
|
||||||
|
}
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int vnodeSyncCommit(SVnode *pVnode) {
|
int vnodeSyncCommit(SVnode *pVnode) {
|
||||||
vnodeAsyncCommit(pVnode);
|
vnodeAsyncCommit(pVnode);
|
||||||
vnodeWaitCommit(pVnode);
|
tsem_wait(&pVnode->canCommit);
|
||||||
tsem_post(&(pVnode->canCommit));
|
tsem_post(&pVnode->canCommit);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int vnodeCommit(SVnode *pVnode) {
|
static int vnodeCommitImpl(SCommitInfo *pInfo) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
SVnodeInfo info = {0};
|
|
||||||
char dir[TSDB_FILENAME_LEN];
|
char dir[TSDB_FILENAME_LEN] = {0};
|
||||||
|
SVnode *pVnode = pInfo->pVnode;
|
||||||
|
|
||||||
vInfo("vgId:%d, start to commit, commit ID:%" PRId64 " version:%" PRId64 " term: %" PRId64, TD_VID(pVnode),
|
vInfo("vgId:%d, start to commit, commit ID:%" PRId64 " version:%" PRId64 " term: %" PRId64, TD_VID(pVnode),
|
||||||
pVnode->state.commitID, pVnode->state.applied, pVnode->state.applyTerm);
|
pVnode->state.commitID, pVnode->state.applied, pVnode->state.applyTerm);
|
||||||
|
|
@ -218,19 +267,13 @@ int vnodeCommit(SVnode *pVnode) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
pVnode->state.commitTerm = pVnode->state.applyTerm;
|
|
||||||
|
|
||||||
// save info
|
// save info
|
||||||
info.config = pVnode->config;
|
|
||||||
info.state.committed = pVnode->state.applied;
|
|
||||||
info.state.commitTerm = pVnode->state.applyTerm;
|
|
||||||
info.state.commitID = pVnode->state.commitID;
|
|
||||||
if (pVnode->pTfs) {
|
if (pVnode->pTfs) {
|
||||||
snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pVnode->pTfs), TD_DIRSEP, pVnode->path);
|
snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pVnode->pTfs), TD_DIRSEP, pVnode->path);
|
||||||
} else {
|
} else {
|
||||||
snprintf(dir, TSDB_FILENAME_LEN, "%s", pVnode->path);
|
snprintf(dir, TSDB_FILENAME_LEN, "%s", pVnode->path);
|
||||||
}
|
}
|
||||||
if (vnodeSaveInfo(dir, &info) < 0) {
|
if (vnodeSaveInfo(dir, &pInfo->info) < 0) {
|
||||||
code = terrno;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
@ -238,23 +281,12 @@ int vnodeCommit(SVnode *pVnode) {
|
||||||
// walBeginSnapshot(pVnode->pWal, pVnode->state.applied);
|
// walBeginSnapshot(pVnode->pWal, pVnode->state.applied);
|
||||||
syncBeginSnapshot(pVnode->sync, pVnode->state.applied);
|
syncBeginSnapshot(pVnode->sync, pVnode->state.applied);
|
||||||
|
|
||||||
code = smaPreCommit(pVnode->pSma);
|
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
|
||||||
|
|
||||||
vnodeBufPoolUnRef(pVnode->inUse);
|
|
||||||
pVnode->inUse = NULL;
|
|
||||||
|
|
||||||
// commit each sub-system
|
// commit each sub-system
|
||||||
if (metaCommit(pVnode->pMeta) < 0) {
|
code = tsdbCommit(pVnode->pTsdb, pInfo);
|
||||||
code = TSDB_CODE_FAILED;
|
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
|
||||||
}
|
|
||||||
|
|
||||||
code = tsdbCommit(pVnode->pTsdb);
|
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
|
|
||||||
if (VND_IS_RSMA(pVnode)) {
|
if (VND_IS_RSMA(pVnode)) {
|
||||||
code = smaCommit(pVnode->pSma);
|
code = smaCommit(pVnode->pSma, pInfo);
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -264,7 +296,7 @@ int vnodeCommit(SVnode *pVnode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// commit info
|
// commit info
|
||||||
if (vnodeCommitInfo(dir, &info) < 0) {
|
if (vnodeCommitInfo(dir, &pInfo->info) < 0) {
|
||||||
code = terrno;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
@ -277,19 +309,18 @@ int vnodeCommit(SVnode *pVnode) {
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (metaFinishCommit(pVnode->pMeta) < 0) {
|
if (metaFinishCommit(pVnode->pMeta, pInfo->txn) < 0) {
|
||||||
code = terrno;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
pVnode->state.committed = info.state.committed;
|
pVnode->state.committed = pInfo->info.state.committed;
|
||||||
|
|
||||||
if (smaPostCommit(pVnode->pSma) < 0) {
|
if (smaPostCommit(pVnode->pSma) < 0) {
|
||||||
vError("vgId:%d, failed to post-commit sma since %s", TD_VID(pVnode), tstrerror(terrno));
|
vError("vgId:%d, failed to post-commit sma since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply the commit (TODO)
|
|
||||||
// walEndSnapshot(pVnode->pWal);
|
// walEndSnapshot(pVnode->pWal);
|
||||||
syncEndSnapshot(pVnode->sync);
|
syncEndSnapshot(pVnode->sync);
|
||||||
|
|
||||||
|
|
@ -318,20 +349,6 @@ void vnodeRollback(SVnode *pVnode) {
|
||||||
(void)taosRemoveFile(tFName);
|
(void)taosRemoveFile(tFName);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vnodeCommitImpl(void *arg) {
|
|
||||||
SVnode *pVnode = (SVnode *)arg;
|
|
||||||
|
|
||||||
// metaCommit(pVnode->pMeta);
|
|
||||||
tqCommit(pVnode->pTq);
|
|
||||||
// tsdbCommit(pVnode->pTsdb, );
|
|
||||||
|
|
||||||
// vnodeBufPoolRecycle(pVnode);
|
|
||||||
tsem_post(&(pVnode->canCommit));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static FORCE_INLINE void vnodeWaitCommit(SVnode *pVnode) { tsem_wait(&pVnode->canCommit); }
|
|
||||||
|
|
||||||
static int vnodeEncodeState(const void *pObj, SJson *pJson) {
|
static int vnodeEncodeState(const void *pObj, SJson *pJson) {
|
||||||
const SVState *pState = (SVState *)pObj;
|
const SVState *pState = (SVState *)pObj;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,7 @@ void vnodePreClose(SVnode *pVnode) {
|
||||||
|
|
||||||
void vnodeClose(SVnode *pVnode) {
|
void vnodeClose(SVnode *pVnode) {
|
||||||
if (pVnode) {
|
if (pVnode) {
|
||||||
vnodeCommit(pVnode);
|
vnodeSyncCommit(pVnode);
|
||||||
vnodeSyncClose(pVnode);
|
vnodeSyncClose(pVnode);
|
||||||
vnodeQueryClose(pVnode);
|
vnodeQueryClose(pVnode);
|
||||||
walClose(pVnode->pWal);
|
walClose(pVnode->pWal);
|
||||||
|
|
|
||||||
|
|
@ -259,7 +259,7 @@ int32_t vnodeSnapWriterOpen(SVnode *pVnode, int64_t sver, int64_t ever, SVSnapWr
|
||||||
pWriter->ever = ever;
|
pWriter->ever = ever;
|
||||||
|
|
||||||
// commit it
|
// commit it
|
||||||
code = vnodeCommit(pVnode);
|
code = vnodeSyncCommit(pVnode);
|
||||||
if (code) {
|
if (code) {
|
||||||
taosMemoryFree(pWriter);
|
taosMemoryFree(pWriter);
|
||||||
goto _err;
|
goto _err;
|
||||||
|
|
|
||||||
|
|
@ -190,14 +190,15 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp
|
||||||
if (version <= pVnode->state.applied) {
|
if (version <= pVnode->state.applied) {
|
||||||
vError("vgId:%d, duplicate write request. version: %" PRId64 ", applied: %" PRId64 "", TD_VID(pVnode), version,
|
vError("vgId:%d, duplicate write request. version: %" PRId64 ", applied: %" PRId64 "", TD_VID(pVnode), version,
|
||||||
pVnode->state.applied);
|
pVnode->state.applied);
|
||||||
|
terrno = TSDB_CODE_VND_DUP_REQUEST;
|
||||||
pRsp->info.handle = NULL;
|
pRsp->info.handle = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
vDebug("vgId:%d, start to process write request %s, index:%" PRId64, TD_VID(pVnode), TMSG_INFO(pMsg->msgType),
|
vDebug("vgId:%d, start to process write request %s, index:%" PRId64, TD_VID(pVnode), TMSG_INFO(pMsg->msgType),
|
||||||
version);
|
version);
|
||||||
ASSERT(pVnode->state.applyTerm <= pMsg->info.conn.applyTerm);
|
|
||||||
|
|
||||||
|
ASSERT(pVnode->state.applyTerm <= pMsg->info.conn.applyTerm);
|
||||||
pVnode->state.applied = version;
|
pVnode->state.applied = version;
|
||||||
pVnode->state.applyTerm = pMsg->info.conn.applyTerm;
|
pVnode->state.applyTerm = pMsg->info.conn.applyTerm;
|
||||||
|
|
||||||
|
|
@ -300,7 +301,9 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp
|
||||||
vnodeProcessAlterConfigReq(pVnode, version, pReq, len, pRsp);
|
vnodeProcessAlterConfigReq(pVnode, version, pReq, len, pRsp);
|
||||||
break;
|
break;
|
||||||
case TDMT_VND_COMMIT:
|
case TDMT_VND_COMMIT:
|
||||||
goto _do_commit;
|
vnodeSyncCommit(pVnode);
|
||||||
|
vnodeBegin(pVnode);
|
||||||
|
goto _exit;
|
||||||
default:
|
default:
|
||||||
vError("vgId:%d, unprocessed msg, %d", TD_VID(pVnode), pMsg->msgType);
|
vError("vgId:%d, unprocessed msg, %d", TD_VID(pVnode), pMsg->msgType);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -318,13 +321,12 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp
|
||||||
|
|
||||||
// commit if need
|
// commit if need
|
||||||
if (vnodeShouldCommit(pVnode)) {
|
if (vnodeShouldCommit(pVnode)) {
|
||||||
_do_commit:
|
|
||||||
vInfo("vgId:%d, commit at version %" PRId64, TD_VID(pVnode), version);
|
vInfo("vgId:%d, commit at version %" PRId64, TD_VID(pVnode), version);
|
||||||
// commit current change
|
#if 0
|
||||||
if (vnodeCommit(pVnode) < 0) {
|
vnodeSyncCommit(pVnode);
|
||||||
vError("vgId:%d, failed to commit vnode since %s.", TD_VID(pVnode), tstrerror(terrno));
|
#else
|
||||||
goto _err;
|
vnodeAsyncCommit(pVnode);
|
||||||
}
|
#endif
|
||||||
|
|
||||||
// start a new one
|
// start a new one
|
||||||
if (vnodeBegin(pVnode) < 0) {
|
if (vnodeBegin(pVnode) < 0) {
|
||||||
|
|
@ -333,6 +335,7 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_exit:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
_err:
|
_err:
|
||||||
|
|
@ -353,7 +356,7 @@ int32_t vnodeProcessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg) {
|
||||||
vTrace("message in vnode query queue is processing");
|
vTrace("message in vnode query queue is processing");
|
||||||
// if ((pMsg->msgType == TDMT_SCH_QUERY) && !vnodeIsLeader(pVnode)) {
|
// if ((pMsg->msgType == TDMT_SCH_QUERY) && !vnodeIsLeader(pVnode)) {
|
||||||
if ((pMsg->msgType == TDMT_SCH_QUERY) && !syncIsReadyForRead(pVnode->sync)) {
|
if ((pMsg->msgType == TDMT_SCH_QUERY) && !syncIsReadyForRead(pVnode->sync)) {
|
||||||
vnodeRedirectRpcMsg(pVnode, pMsg);
|
vnodeRedirectRpcMsg(pVnode, pMsg, terrno);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -376,12 +379,12 @@ int32_t vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) {
|
||||||
pMsg->msgType == TDMT_VND_BATCH_META) &&
|
pMsg->msgType == TDMT_VND_BATCH_META) &&
|
||||||
!syncIsReadyForRead(pVnode->sync)) {
|
!syncIsReadyForRead(pVnode->sync)) {
|
||||||
// !vnodeIsLeader(pVnode)) {
|
// !vnodeIsLeader(pVnode)) {
|
||||||
vnodeRedirectRpcMsg(pVnode, pMsg);
|
vnodeRedirectRpcMsg(pVnode, pMsg, terrno);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pMsg->msgType == TDMT_VND_TMQ_CONSUME && !pVnode->restored) {
|
if (pMsg->msgType == TDMT_VND_TMQ_CONSUME && !pVnode->restored) {
|
||||||
vnodeRedirectRpcMsg(pVnode, pMsg);
|
vnodeRedirectRpcMsg(pVnode, pMsg, TSDB_CODE_SYN_RESTORING);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue