Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_44632607
TDengine
提交
de06d004
T
TDengine
项目概览
weixin_44632607
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
de06d004
编写于
2月 12, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '2.0' of
https://github.com/taosdata/TDengine
into 2.0
上级
1a2b98c5
dbdb9338
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
303 addition
and
276 deletion
+303
-276
src/inc/taoserror.h
src/inc/taoserror.h
+141
-117
src/inc/taosmsg.h
src/inc/taosmsg.h
+0
-1
src/modules/http/src/httpResp.c
src/modules/http/src/httpResp.c
+1
-3
src/rpc/src/tstring.c
src/rpc/src/tstring.c
+0
-123
src/util/src/terror.c
src/util/src/terror.c
+73
-0
src/vnode/tsdb/inc/tsdbCache.h
src/vnode/tsdb/inc/tsdbCache.h
+2
-2
src/vnode/tsdb/inc/tsdbMeta.h
src/vnode/tsdb/inc/tsdbMeta.h
+7
-1
src/vnode/tsdb/src/tsdb.c
src/vnode/tsdb/src/tsdb.c
+40
-27
src/vnode/tsdb/src/tsdbCache.c
src/vnode/tsdb/src/tsdbCache.c
+15
-0
src/vnode/tsdb/src/tsdbMeta.c
src/vnode/tsdb/src/tsdbMeta.c
+24
-2
未找到文件。
src/inc/taoserror.h
浏览文件 @
de06d004
...
...
@@ -20,124 +20,148 @@
extern
"C"
{
#endif
#define TSDB_CODE_SUCCESS 0
#define TSDB_CODE_ACTION_IN_PROGRESS 1
#ifdef TAOS_ERROR_C
#define TAOS_DEFINE_ERROR(name, mod, code, msg) {.val = (0x80000000 | ((mod)<<16) | (code)), .str=(msg)},
#else
#define TAOS_DEFINE_ERROR(name, mod, code, msg) const int32_t name = (0x80000000 | ((mod)<<16) | (code));
#endif
#define TAOS_SYSTEM_ERROR(code) (0x80ff0000 | (code))
#define TAOS_SUCCEEDED(err) ((err) >= 0)
#define TAOS_FAILED(err) ((err) < 0)
const
char
*
tstrerror
(
int32_t
err
);
#define TSDB_CODE_LAST_SESSION_NOT_FINISHED 5
#define TSDB_CODE_INVALID_SESSION_ID 6
#define TSDB_CODE_INVALID_TRAN_ID 7
#define TSDB_CODE_INVALID_MSG_TYPE 8
#define TSDB_CODE_ALREADY_PROCESSED 9
#define TSDB_CODE_AUTH_FAILURE 10
#define TSDB_CODE_WRONG_MSG_SIZE 11
#define TSDB_CODE_UNEXPECTED_RESPONSE 12
#define TSDB_CODE_INVALID_RESPONSE_TYPE 13
#define TSDB_CODE_NO_RESOURCE 14
#define TSDB_CODE_INVALID_TIME_STAMP 15
#define TSDB_CODE_MISMATCHED_METER_ID 16
#define TSDB_CODE_ACTION_TRANS_NOT_FINISHED 17
#define TSDB_CODE_ACTION_NOT_ONLINE 18
#define TSDB_CODE_ACTION_SEND_FAILD 19
#define TSDB_CODE_NOT_ACTIVE_SESSION 20
#define TSDB_CODE_INVALID_VNODE_ID 21
#define TSDB_CODE_APP_ERROR 22
#define TSDB_CODE_INVALID_IE 23
#define TSDB_CODE_INVALID_VALUE 24
#define TSDB_CODE_REDIRECT 25
#define TSDB_CODE_ALREADY_THERE 26
#define TSDB_CODE_INVALID_METER_ID 27
#define TSDB_CODE_INVALID_SQL 28
#define TSDB_CODE_NETWORK_UNAVAIL 29
#define TSDB_CODE_INVALID_MSG_LEN 30
#define TSDB_CODE_INVALID_DB 31
#define TSDB_CODE_INVALID_TABLE 32
#define TSDB_CODE_DB_ALREADY_EXIST 33
#define TSDB_CODE_TABLE_ALREADY_EXIST 34
#define TSDB_CODE_INVALID_USER 35
#define TSDB_CODE_INVALID_ACCT 36
#define TSDB_CODE_INVALID_PASS 37
#define TSDB_CODE_DB_NOT_SELECTED 38
#define TSDB_CODE_MEMORY_CORRUPTED 39
#define TSDB_CODE_USER_ALREADY_EXIST 40
#define TSDB_CODE_NO_RIGHTS 41
#define TSDB_CODE_DISCONNECTED 42
#define TSDB_CODE_NO_MASTER 43
#define TSDB_CODE_NOT_CONFIGURED 44
#define TSDB_CODE_INVALID_OPTION 45
#define TSDB_CODE_NODE_OFFLINE 46
#define TSDB_CODE_SYNC_REQUIRED 47
#define TSDB_CODE_NO_ENOUGH_DNODES 48
#define TSDB_CODE_UNSYNCED 49
#define TSDB_CODE_TOO_SLOW 50
#define TSDB_CODE_OTHERS 51
#define TSDB_CODE_NO_REMOVE_MASTER 52
#define TSDB_CODE_WRONG_SCHEMA 53
#define TSDB_CODE_NOT_ACTIVE_VNODE 54
#define TSDB_CODE_TOO_MANY_USERS 55
#define TSDB_CODE_TOO_MANY_DATABSES 56
#define TSDB_CODE_TOO_MANY_TABLES 57
#define TSDB_CODE_TOO_MANY_DNODES 58
#define TSDB_CODE_TOO_MANY_ACCTS 59
#define TSDB_CODE_ACCT_ALREADY_EXIST 60
#define TSDB_CODE_DNODE_ALREADY_EXIST 61
#define TSDB_CODE_SDB_ERROR 62
#define TSDB_CODE_METRICMETA_EXPIRED 63 // local cached metric-meta expired causes error in metric query
#define TSDB_CODE_NOT_READY 64 // peer is not ready to process data
#define TSDB_CODE_MAX_SESSIONS 65 // too many sessions
#define TSDB_CODE_MAX_CONNECTIONS 66 // too many connections
#define TSDB_CODE_SESSION_ALREADY_EXIST 67
#define TSDB_CODE_NO_QSUMMARY 68
#define TSDB_CODE_SERV_OUT_OF_MEMORY 69
#define TSDB_CODE_INVALID_QHANDLE 70
#define TSDB_CODE_RELATED_TABLES_EXIST 71
#define TSDB_CODE_MONITOR_DB_FORBEIDDEN 72
#define TSDB_CODE_NO_DISK_PERMISSIONS 73
#define TSDB_CODE_VG_INIT_FAILED 74
#define TSDB_CODE_DATA_ALREADY_IMPORTED 75
#define TSDB_CODE_OPS_NOT_SUPPORT 76
#define TSDB_CODE_INVALID_QUERY_ID 77
#define TSDB_CODE_INVALID_STREAM_ID 78
#define TSDB_CODE_INVALID_CONNECTION 79
#define TSDB_CODE_ACTION_NOT_BALANCED 80
#define TSDB_CODE_CLI_OUT_OF_MEMORY 81
#define TSDB_CODE_DATA_OVERFLOW 82
#define TSDB_CODE_QUERY_CANCELLED 83
#define TSDB_CODE_GRANT_TIMESERIES_LIMITED 84
#define TSDB_CODE_GRANT_EXPIRED 85
#define TSDB_CODE_CLI_NO_DISKSPACE 86
#define TSDB_CODE_FILE_CORRUPTED 87
#define TSDB_CODE_INVALID_CLIENT_VERSION 88
#define TSDB_CODE_INVALID_ACCT_PARAMETER 89
#define TSDB_CODE_NOT_ENOUGH_TIME_SERIES 90
#define TSDB_CODE_NO_WRITE_ACCESS 91
#define TSDB_CODE_NO_READ_ACCESS 92
#define TSDB_CODE_GRANT_DB_LIMITED 93
#define TSDB_CODE_GRANT_USER_LIMITED 94
#define TSDB_CODE_GRANT_CONN_LIMITED 95
#define TSDB_CODE_GRANT_STREAM_LIMITED 96
#define TSDB_CODE_GRANT_SPEED_LIMITED 97
#define TSDB_CODE_GRANT_STORAGE_LIMITED 98
#define TSDB_CODE_GRANT_QUERYTIME_LIMITED 99
#define TSDB_CODE_GRANT_ACCT_LIMITED 100
#define TSDB_CODE_GRANT_DNODE_LIMITED 101
#define TSDB_CODE_GRANT_CPU_LIMITED 102
#define TSDB_CODE_SESSION_NOT_READY 103 // table NOT in ready state
#define TSDB_CODE_BATCH_SIZE_TOO_BIG 104
#define TSDB_CODE_TIMESTAMP_OUT_OF_RANGE 105
#define TSDB_CODE_INVALID_QUERY_MSG 106 // failed to validate the sql expression msg by vnode
#define TSDB_CODE_SORTED_RES_TOO_MANY 107 // too many result for ordered super table projection query
#define TSDB_CODE_FILE_BLOCK_TS_DISORDERED 108 // time stamp in file block is disordered
#define TSDB_CODE_INVALID_COMMIT_LOG 109 // commit log init failed
#define TSDB_CODE_SERV_NO_DISKSPACE 110
#define TSDB_CODE_NOT_SUPER_TABLE 111 // operation only available for super table
#define TSDB_CODE_DUPLICATE_TAGS 112 // tags value for join not unique
#define TSDB_CODE_INVALID_SUBMIT_MSG 113
#define TSDB_CODE_NOT_ACTIVE_TABLE 114
#define TSDB_CODE_INVALID_TABLE_ID 115
#define TSDB_CODE_INVALID_VNODE_STATUS 116
#define TSDB_CODE_FAILED_TO_LOCK_RESOURCES 117
#define TSDB_CODE_TABLE_ID_MISMATCH 118
#define TSDB_CODE_QUERY_CACHE_ERASED 119
int32_t
*
taosGetErrno
();
#define terrno (*taosGetErrno())
#define TSDB_CODE_SUCCESS 0
#ifdef TAOS_ERROR_C
static
STaosError
errors
[]
=
{
{.
val
=
0
,
.
str
=
"success"
},
#endif
TAOS_DEFINE_ERROR
(
TSDB_CODE_ACTION_IN_PROGRESS
,
0
,
1
,
"action in progress"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_LAST_SESSION_NOT_FINISHED
,
0
,
5
,
"last session not finished"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_SESSION_ID
,
0
,
6
,
"invalid session id"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_TRAN_ID
,
0
,
7
,
"invalid transaction id"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_MSG_TYPE
,
0
,
8
,
"invalid message type"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ALREADY_PROCESSED
,
0
,
9
,
"already processed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_AUTH_FAILURE
,
0
,
10
,
"auth failure"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_WRONG_MSG_SIZE
,
0
,
11
,
"wrong message size"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_UNEXPECTED_RESPONSE
,
0
,
12
,
"unexpected response"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_RESPONSE_TYPE
,
0
,
13
,
"invalid response type"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_NO_RESOURCE
,
0
,
14
,
"no resource"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_TIME_STAMP
,
0
,
15
,
"invalid timestamp"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MISMATCHED_METER_ID
,
0
,
16
,
"mismatched meter id"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ACTION_TRANS_NOT_FINISHED
,
0
,
17
,
"action transaction not finished"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ACTION_NOT_ONLINE
,
0
,
18
,
"action not online"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ACTION_SEND_FAILD
,
0
,
19
,
"action send failed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_NOT_ACTIVE_SESSION
,
0
,
20
,
"not active session"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_VNODE_ID
,
0
,
21
,
"invalid vnode id"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_APP_ERROR
,
0
,
22
,
"app error"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_IE
,
0
,
23
,
"invalid ie"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_VALUE
,
0
,
24
,
"invalid value"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_REDIRECT
,
0
,
25
,
"redirect"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ALREADY_THERE
,
0
,
26
,
"already there"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_METER_ID
,
0
,
27
,
"invalid meter id"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_SQL
,
0
,
28
,
"invalid sql"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_NETWORK_UNAVAIL
,
0
,
29
,
"network unavailable"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_MSG_LEN
,
0
,
30
,
"invalid message length"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_DB
,
0
,
31
,
"invalid database"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_TABLE
,
0
,
32
,
"invalid table"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DB_ALREADY_EXIST
,
0
,
33
,
"database aleady exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TABLE_ALREADY_EXIST
,
0
,
34
,
"table already exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_USER
,
0
,
35
,
"invalid user"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_ACCT
,
0
,
36
,
"invalid account"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_PASS
,
0
,
37
,
"invalid password"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DB_NOT_SELECTED
,
0
,
38
,
"do not selected"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MEMORY_CORRUPTED
,
0
,
39
,
"memory corrupted"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_USER_ALREADY_EXIST
,
0
,
40
,
"user already exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_NO_RIGHTS
,
0
,
41
,
"no rights"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DISCONNECTED
,
0
,
42
,
"disconnected"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_NO_MASTER
,
0
,
43
,
"no master"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_NOT_CONFIGURED
,
0
,
44
,
"not configured"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_OPTION
,
0
,
45
,
"invalid option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_NODE_OFFLINE
,
0
,
46
,
"node offline"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_SYNC_REQUIRED
,
0
,
47
,
"sync required"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_NO_ENOUGH_DNODES
,
0
,
48
,
"no enough dnodes"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_UNSYNCED
,
0
,
49
,
"unsyned"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TOO_SLOW
,
0
,
50
,
"too slow"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_OTHERS
,
0
,
51
,
"others"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_NO_REMOVE_MASTER
,
0
,
52
,
"no remove master"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_WRONG_SCHEMA
,
0
,
53
,
"wrong schema"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_NOT_ACTIVE_VNODE
,
0
,
54
,
"not active vnode"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TOO_MANY_USERS
,
0
,
55
,
"too many users"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TOO_MANY_DATABASES
,
0
,
56
,
"too many databases"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TOO_MANY_TABLES
,
0
,
57
,
"too many tables"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TOO_MANY_DNODES
,
0
,
58
,
"too many dnodes"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TOO_MANY_ACCTS
,
0
,
59
,
"too many accounts"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ACCT_ALREADY_EXIST
,
0
,
60
,
"accounts already exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DNODE_ALREADY_EXIST
,
0
,
61
,
"dnode already exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_SDB_ERROR
,
0
,
62
,
"sdb error"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_METRICMETA_EXPIRED
,
0
,
63
,
"metricmeta expired"
)
// local cached metric-meta expired causes error in metric query
TAOS_DEFINE_ERROR
(
TSDB_CODE_NOT_READY
,
0
,
64
,
"not ready"
)
// peer is not ready to process data
TAOS_DEFINE_ERROR
(
TSDB_CODE_MAX_SESSIONS
,
0
,
65
,
"max sessions"
)
// too many sessions
TAOS_DEFINE_ERROR
(
TSDB_CODE_MAX_CONNECTIONS
,
0
,
66
,
"max connections"
)
// too many connections
TAOS_DEFINE_ERROR
(
TSDB_CODE_SESSION_ALREADY_EXIST
,
0
,
67
,
"session already exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_NO_QSUMMARY
,
0
,
68
,
"no qsummery"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_SERV_OUT_OF_MEMORY
,
0
,
69
,
"server out of memory"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_QHANDLE
,
0
,
70
,
"invalid handle"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_RELATED_TABLES_EXIST
,
0
,
71
,
"related tables exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MONITOR_DB_FORBIDDEN
,
0
,
72
,
"monitor db forbidden"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_NO_DISK_PERMISSIONS
,
0
,
73
,
"no disk permissions"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VG_INIT_FAILED
,
0
,
74
,
"vg init failed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DATA_ALREADY_IMPORTED
,
0
,
75
,
"data already imported"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_OPS_NOT_SUPPORT
,
0
,
76
,
"ops not support"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_QUERY_ID
,
0
,
77
,
"invalid query id"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_STREAM_ID
,
0
,
78
,
"invalid stream id"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_CONNECTION
,
0
,
79
,
"invalid connection"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ACTION_NOT_BALANCED
,
0
,
80
,
"action not balanced"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_CLI_OUT_OF_MEMORY
,
0
,
81
,
"client out of memory"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DATA_OVERFLOW
,
0
,
82
,
"data overflow"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_QUERY_CANCELLED
,
0
,
83
,
"query cancelled"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_GRANT_TIMESERIES_LIMITED
,
0
,
84
,
"grant timeseries limited"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_GRANT_EXPIRED
,
0
,
85
,
"grant expired"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_CLI_NO_DISKSPACE
,
0
,
86
,
"client no disk space"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_FILE_CORRUPTED
,
0
,
87
,
"file corrupted"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_CLIENT_VERSION
,
0
,
88
,
"invalid client version"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_ACCT_PARAMETER
,
0
,
89
,
"invalid account parameter"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_NOT_ENOUGH_TIME_SERIES
,
0
,
90
,
"not enough time series"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_NO_WRITE_ACCESS
,
0
,
91
,
"no write access"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_NO_READ_ACCESS
,
0
,
92
,
"no read access"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_GRANT_DB_LIMITED
,
0
,
93
,
"grant db limited"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_GRANT_USER_LIMITED
,
0
,
94
,
"grant user limited"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_GRANT_CONN_LIMITED
,
0
,
95
,
"grant conn limited"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_GRANT_STREAM_LIMITED
,
0
,
96
,
"grant stream limited"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_GRANT_SPEED_LIMITED
,
0
,
97
,
"grant speed limited"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_GRANT_STORAGE_LIMITED
,
0
,
98
,
"grant storage limited"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_GRANT_QUERYTIME_LIMITED
,
0
,
99
,
"grant query time limited"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_GRANT_ACCT_LIMITED
,
0
,
100
,
"grant account limited"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_GRANT_DNODE_LIMITED
,
0
,
101
,
"grant dnode limited"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_GRANT_CPU_LIMITED
,
0
,
102
,
"grant cpu limited"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_SESSION_NOT_READY
,
0
,
103
,
"session not ready"
)
// table NOT in ready state
TAOS_DEFINE_ERROR
(
TSDB_CODE_BATCH_SIZE_TOO_BIG
,
0
,
104
,
"batch size too big"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TIMESTAMP_OUT_OF_RANGE
,
0
,
105
,
"timestamp out of range"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_QUERY_MSG
,
0
,
106
,
"invalid query message"
)
// failed to validate the sql expression msg by vnode
TAOS_DEFINE_ERROR
(
TSDB_CODE_SORTED_RES_TOO_MANY
,
0
,
107
,
"sorted res too many"
)
// too many result for ordered super table projection query
TAOS_DEFINE_ERROR
(
TSDB_CODE_FILE_BLOCK_TS_DISORDERED
,
0
,
108
,
"file block ts disordered"
)
// time stamp in file block is disordered
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_COMMIT_LOG
,
0
,
109
,
"invalid commit log"
)
// commit log init failed
TAOS_DEFINE_ERROR
(
TSDB_CODE_SERV_NO_DISKSPACE
,
0
,
110
,
"server no diskspace"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_NOT_SUPER_TABLE
,
0
,
111
,
"no super table"
)
// operation only available for super table
TAOS_DEFINE_ERROR
(
TSDB_CODE_DUPLICATE_TAGS
,
0
,
112
,
"duplicate tags"
)
// tags value for join not unique
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_SUBMIT_MSG
,
0
,
113
,
"invalid submit message"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_NOT_ACTIVE_TABLE
,
0
,
114
,
"not active table"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_TABLE_ID
,
0
,
115
,
"invalid table id"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_VNODE_STATUS
,
0
,
116
,
"invalid vnode status"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_FAILED_TO_LOCK_RESOURCES
,
0
,
117
,
"failed to lock resources"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TABLE_ID_MISMATCH
,
0
,
118
,
"table id mismatch"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_QUERY_CACHE_ERASED
,
0
,
119
,
"query cache erased"
)
#ifdef TAOS_ERROR_C
};
#endif
#define TSDB_CODE_MAX_ERROR_CODE 120
...
...
src/inc/taosmsg.h
浏览文件 @
de06d004
...
...
@@ -199,7 +199,6 @@ typedef enum {
#define TSDB_COL_JOIN 0x2U
extern
char
*
taosMsg
[];
extern
char
*
tsError
[];
#pragma pack(push, 1)
...
...
src/modules/http/src/httpResp.c
浏览文件 @
de06d004
...
...
@@ -20,8 +20,6 @@
#include "httpJson.h"
#include "taosmsg.h"
extern
char
*
tsError
[];
const
char
*
httpKeepAliveStr
[]
=
{
""
,
"Connection: Keep-Alive
\r\n
"
,
"Connection: Close
\r\n
"
};
const
char
*
httpVersionStr
[]
=
{
"HTTP/1.0"
,
"HTTP/1.1"
,
"HTTP/1.2"
};
...
...
@@ -184,7 +182,7 @@ void httpSendErrorResp(HttpContext *pContext, int errNo) { httpSendErrorRespWith
void
httpSendTaosdErrorResp
(
HttpContext
*
pContext
,
int
errCode
)
{
int
httpCode
=
400
;
httpSendErrorRespImp
(
pContext
,
httpCode
,
"Bad Request"
,
errCode
,
ts
Error
[
errCode
]
);
httpSendErrorRespImp
(
pContext
,
httpCode
,
"Bad Request"
,
errCode
,
ts
trerror
(
errCode
)
);
}
void
httpSendTaosdInvalidSqlErrorResp
(
HttpContext
*
pContext
,
char
*
errMsg
)
{
...
...
src/rpc/src/tstring.c
浏览文件 @
de06d004
...
...
@@ -122,126 +122,3 @@ char *taosMsg[] = {"null",
"alter-acct"
,
"alter-acct-rsp"
,
"invalid"
};
char
*
tsError
[]
=
{
"success"
,
"in progress"
,
""
,
""
,
""
,
"last session not finished"
,
// 5
"invalid session ID"
,
"invalid tran ID"
,
"invalid msg type"
,
"alredy processed"
,
"authentication failure"
,
// 10
"wrong msg size"
,
"unexpected response"
,
"invalid response type"
,
"no resource"
,
"server-client date time unsynced"
,
// 15
"mismatched meter ID"
,
"transcation not finished"
,
"not online"
,
"send failed"
,
"not active session"
,
// 20
"invalid vnode id"
,
"App error"
,
"invalid IE"
,
"invalid value"
,
"service not available"
,
// 25
"already there"
,
"invalid meter ID"
,
"invalid SQL"
,
"failed to connect to server"
,
"invalid msg len"
,
// 30
"invalid DB"
,
"invalid table"
,
"DB already there"
,
"table already there"
,
"invalid user name"
,
// 35
"invalid acct name"
,
"invalid password"
,
"DB not selected"
,
"memory corrupted"
,
"user name exists"
,
// 40
"not authorized"
,
"login disconnected, login again"
,
"mgmt master node not available"
,
"not configured"
,
"invalid option"
,
// 45
"node offline"
,
"sync required"
,
"more dnodes are needed"
,
"node in unsynced state"
,
"too slow"
,
// 50
"others"
,
"can't remove dnode which is master"
,
"wrong schema"
,
"vnode not active(not created yet or dropped already)"
,
"num of users execeed maxUsers"
,
//55
"num of databases execeed maxDbs"
,
"num of tables execeed maxTables"
,
"num of dnodes execeed maxDnodes"
,
"num of accounts execeed maxAccts"
,
"accout name exists"
,
// 60
"dnode ip exists"
,
"sdb error"
,
"metric meta expired"
,
"not ready"
,
"too many sessions on server"
,
// 65
"too many sessions from app"
,
"session to dest is already there"
,
"query list not there, please show again"
,
"server out of memory"
,
"invalid query handle"
,
// 70
"tables related to metric exist"
,
"can't drop monitor database or tables"
,
"no disk permissions"
,
"vgroup init failed"
,
"data is already imported"
,
// 75
"not supported operation"
,
"invalid query id string"
,
"invalid stream id string"
,
"invalid connection string"
,
"dnode not balanced"
,
// 80
"client out of memory"
,
"data value overflow"
,
"query cancelled"
,
"grant timeseries limited"
,
"grant expired"
,
// 85
"client no disk space"
,
"DB file corrupted"
,
"version of client and server not match"
,
"invalid account parameter"
,
"no enough available time series"
,
//90
"storage credit is used up"
,
"query credit is used up"
,
"grant database limited"
,
"grant user limited"
,
"grant connection limited"
,
//95
"grant stream limited"
,
"grant writing speed limited"
,
"grant storage limited"
,
"grant query time limited"
,
"grant account limited"
,
// 100
"grant dnode limited"
,
"grant cpu core limited"
,
"session not ready"
,
"batch size too big"
,
"timestamp out of range"
,
//105
"invalid query message"
,
"too many results from vnodes for sort"
,
"timestamp disordered in file block"
,
"invalid commit log"
,
"no disk space on server"
,
//110
"only super table has metric meta info"
,
"tags value not unique for join"
,
"invalid submit message"
,
"not active table(not created yet or dropped already)"
,
"invalid table id"
,
// 115
"invalid vnode status"
,
"failed to lock resources"
,
"table id/uid mismatch"
,
"client query cache erased"
,
// 119
};
src/util/src/terror.c
0 → 100644
浏览文件 @
de06d004
/*
* Copyright (c) 2020 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <pthread.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#define TAOS_ERROR_C
typedef
struct
{
int32_t
val
;
const
char
*
str
;
}
STaosError
;
#include "taoserror.h"
static
_Thread_local
int32_t
tsErrno
;
int32_t
*
taosGetErrno
()
{
return
&
tsErrno
;
}
static
int
tsCompareTaosError
(
const
void
*
a
,
const
void
*
b
)
{
const
STaosError
*
x
=
(
const
STaosError
*
)
a
;
const
STaosError
*
y
=
(
const
STaosError
*
)
b
;
return
x
->
val
-
y
->
val
;
}
static
pthread_once_t
tsErrorInit
=
PTHREAD_ONCE_INIT
;
static
void
tsSortError
()
{
qsort
(
errors
,
sizeof
(
errors
)
/
sizeof
(
errors
[
0
]),
sizeof
(
errors
[
0
]),
tsCompareTaosError
);
}
const
char
*
tstrerror
(
int32_t
err
)
{
pthread_once
(
&
tsErrorInit
,
tsSortError
);
// this is a system errno
if
((
err
&
0x00ff0000
)
==
0x00ff0000
)
{
return
strerror
(
err
&
0x0000ffff
);
}
int
s
=
0
,
e
=
sizeof
(
errors
)
/
sizeof
(
errors
[
0
]);
while
(
s
<
e
)
{
int
mid
=
(
s
+
e
)
/
2
;
if
(
err
>
errors
[
mid
].
val
)
{
s
=
mid
+
1
;
}
else
if
(
err
<
errors
[
mid
].
val
)
{
e
=
mid
;
}
else
if
(
err
==
errors
[
mid
].
val
)
{
return
errors
[
mid
].
str
;
}
break
;
}
return
""
;
}
src/vnode/tsdb/inc/tsdbCache.h
浏览文件 @
de06d004
...
...
@@ -24,7 +24,7 @@ typedef struct {
typedef
struct
STSDBCache
{
// Number of blocks the cache is allocated
int32_t
numOfBlocks
;
S
DList
*
cacheList
;
S
TSDBCacheBlock
*
cacheList
;
void
*
current
;
}
SCacheHandle
;
...
...
@@ -36,6 +36,6 @@ typedef struct STSDBCache {
#define TSDB_NEXT_CACHE_BLOCK(pBlock) ((pBlock)->next)
#define TSDB_PREV_CACHE_BLOCK(pBlock) ((pBlock)->prev)
S
TSDBCache
*
tsdbCreateCache
(
);
S
CacheHandle
*
tsdbCreateCache
(
int32_t
numOfBlocks
);
#endif // _TD_TSDBCACHE_H_
src/vnode/tsdb/inc/tsdbMeta.h
浏览文件 @
de06d004
...
...
@@ -81,4 +81,10 @@ SVSchema *tsdbGetTableSchema(STable *pTable);
#define TSDB_NUM_OF_TABLES(pHandle) ((pHandle)->numOfTables)
#define TSDB_NUM_OF_SUPER_TABLES(pHandle) ((pHandle)->numOfSuperTables)
#define TSDB_TABLE_OF_ID(pHandle, id) ((pHandle)->pTables)[id]
#define TSDB_GET_TABLE_OF_NAME(pHandle, name)
/* TODO */
\ No newline at end of file
#define TSDB_GET_TABLE_OF_NAME(pHandle, name)
/* TODO */
// Create a new meta handle with configuration
SMetaHandle
*
tsdbCreateMetaHandle
(
int32_t
numOfTables
);
// Recover the meta handle from the file
SMetaHandle
*
tsdbOpenMetaHandle
(
int
fd
);
src/vnode/tsdb/src/tsdb.c
浏览文件 @
de06d004
#include <stdint.h>
#include <pthread.h>
#include <stdlib.h>
#include "tsdb.h"
#include "disk.h"
//
#include "disk.h"
#include "tsdbMeta.h"
#include "tsdbCache.h"
...
...
@@ -17,34 +18,10 @@ typedef struct STSDBRepo
// The cache Handle
SCacheHandle
*
pCacheHandle
;
/* Disk tier handle for multi-tier storage
*
* The handle is responsible for dealing with object-oriented
* storage.
*/
// Disk tier handle for multi-tier storage
SDiskTier
*
pDiskTier
;
/* Cache block list
*/
SCacheBlock
*
pCacheBloclList
;
/* Map from tableId-->STable
*/
STable
*
pTableList
;
/* Map from tableName->tableId
* TODO: may use dict
*/
void
*
pTableDict
;
/* Map from super tableName->table
* TODO: may use dict
*/
void
*
pSTableDict
;
/* File Store
*/
// File Store
void
*
pFileStore
;
pthread_mutext_t
tsdbMutex
;
...
...
@@ -53,3 +30,39 @@ typedef struct STSDBRepo
#define TSDB_GET_TABLE_BY_ID(pRepo, sid) (((STSDBRepo *)pRepo)->pTableList)[sid]
#define TSDB_GET_TABLE_BY_NAME(pRepo, name)
// Check the correctness of the TSDB configuration
static
int32_t
tsdbCheckCfg
(
STSDBCfg
*
pCfg
)
{
// TODO
return
0
;
}
tsdb_repo_t
*
tsdbCreateRepo
(
STSDBCfg
*
pCfg
,
int32_t
*
error
)
{
int32_t
err
=
0
;
err
=
tsdbCheckCfg
(
pCfg
);
if
(
err
!=
0
)
{
// TODO: deal with the error here
}
STSDBRepo
*
pRepo
=
(
STSDBRepo
*
)
malloc
(
sizeof
(
STSDBRepo
));
if
(
pRepo
==
NULL
)
{
// TODO: deal with error
}
// TODO: Initailize pMetahandle
pRepo
->
pMetaHandle
=
tsdbCreateMetaHandle
(
pCfg
->
maxTables
);
if
(
pRepo
->
pMetaHandle
==
NULL
)
{
// TODO: deal with error
free
(
pRepo
);
return
NULL
;
}
// TODO: Initialize cache handle
pRepo
->
pCacheHandle
=
tsdbCreateCache
(
5
);
if
(
pRepo
->
pCacheHandle
==
NULL
)
{
// TODO: free the object and return error
return
NULL
;
}
return
(
tsdb_repo_t
*
)
pRepo
;
}
\ No newline at end of file
src/vnode/tsdb/src/tsdbCache.c
浏览文件 @
de06d004
#include <stdlib.h>
#include "tsdbCache.h"
SCacheHandle
*
tsdbCreateCache
(
int32_t
numOfBlocks
)
{
SCacheHandle
*
pCacheHandle
=
(
SCacheHandle
*
)
malloc
(
sizeof
(
SCacheHandle
));
if
(
pCacheHandle
==
NULL
)
{
// TODO : deal with the error
return
NULL
;
}
return
pCacheHandle
;
}
\ No newline at end of file
src/vnode/tsdb/src/tsdbMeta.c
浏览文件 @
de06d004
#include <stdlib.h>
#include "tsdb.h"
#include "tsdbMeta.h"
SVSchema
*
tsdbGetTableSchema
(
STable
*
pTable
)
{
SMetaHandle
*
tsdbCreateMetaHandle
(
int32_t
numOfTables
)
{
SMetaHandle
*
pMetahandle
=
(
SMetaHandle
*
)
malloc
(
sizeof
(
SMetaHandle
));
if
(
pMetahandle
==
NULL
)
{
return
NULL
;
}
pMetahandle
->
numOfTables
=
0
;
pMetahandle
->
numOfSuperTables
=
0
;
pMetahandle
->
pTables
=
calloc
(
sizeof
(
STable
*
)
*
numOfTables
);
if
(
pMetahandle
->
pTables
==
NULL
)
{
free
(
pMetahandle
);
return
NULL
;
}
}
// TODO : initialize the map
// pMetahandle->pNameTableMap = ;
if
(
pMetahandle
->
pNameTableMap
==
NULL
)
{
free
(
pMetahandle
->
pTables
);
free
(
pMetahandle
);
return
NULL
;
}
return
pMetahandle
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录