Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
a3714edf
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
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看板
提交
a3714edf
编写于
7月 15, 2020
作者:
P
Ping Xiao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into jdbcBatchInsert
上级
1ab0582b
381e7df4
变更
37
隐藏空白更改
内联
并排
Showing
37 changed file
with
3009 addition
and
1864 deletion
+3009
-1864
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+8
-0
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+1
-0
src/common/src/tdataformat.c
src/common/src/tdataformat.c
+5
-3
src/common/src/tglobal.c
src/common/src/tglobal.c
+11
-0
src/connector/jdbc/src/test/java/com/taosdata/jdbc/BatchInsertTest.java
...jdbc/src/test/java/com/taosdata/jdbc/BatchInsertTest.java
+9
-1
src/dnode/src/dnodeMgmt.c
src/dnode/src/dnodeMgmt.c
+1
-0
src/inc/taosdef.h
src/inc/taosdef.h
+4
-0
src/inc/taosmsg.h
src/inc/taosmsg.h
+2
-0
src/inc/ttokendef.h
src/inc/ttokendef.h
+111
-111
src/inc/twal.h
src/inc/twal.h
+1
-0
src/kit/taosdump/taosdump.c
src/kit/taosdump/taosdump.c
+110
-13
src/kit/taosmigrate/taosmigrateVnodeCfg.c
src/kit/taosmigrate/taosmigrateVnodeCfg.c
+8
-0
src/mnode/inc/mnodeDef.h
src/mnode/inc/mnodeDef.h
+1
-0
src/mnode/src/mnodeDb.c
src/mnode/src/mnodeDb.c
+24
-5
src/mnode/src/mnodeSdb.c
src/mnode/src/mnodeSdb.c
+5
-3
src/mnode/src/mnodeVgroup.c
src/mnode/src/mnodeVgroup.c
+1
-0
src/query/inc/qsqlparser.h
src/query/inc/qsqlparser.h
+1
-0
src/query/inc/sql.y
src/query/inc/sql.y
+3
-0
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+61
-8
src/query/src/qparserImpl.c
src/query/src/qparserImpl.c
+1
-0
src/query/src/qtokenizer.c
src/query/src/qtokenizer.c
+1
-0
src/query/src/sql.c
src/query/src/sql.c
+1137
-1118
src/tsdb/inc/tsdbMain.h
src/tsdb/inc/tsdbMain.h
+55
-21
src/tsdb/src/tsdbMemTable.c
src/tsdb/src/tsdbMemTable.c
+75
-88
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+2
-2
src/tsdb/src/tsdbRWHelper.c
src/tsdb/src/tsdbRWHelper.c
+479
-343
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+20
-11
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+10
-1
src/wal/src/walMain.c
src/wal/src/walMain.c
+73
-14
tests/pytest/crash_gen.py
tests/pytest/crash_gen.py
+149
-100
tests/pytest/util/dnodes-no-random-fail.py
tests/pytest/util/dnodes-no-random-fail.py
+500
-0
tests/pytest/util/dnodes-random-fail.py
tests/pytest/util/dnodes-random-fail.py
+2
-2
tests/script/sh/deploy.sh
tests/script/sh/deploy.sh
+15
-15
tests/script/sh/exec-no-random-fail.sh
tests/script/sh/exec-no-random-fail.sh
+113
-0
tests/script/sh/exec-random-fail.sh
tests/script/sh/exec-random-fail.sh
+1
-1
tests/script/tmp/mnodes.sim
tests/script/tmp/mnodes.sim
+7
-3
tests/test/c/createTablePerformance.c
tests/test/c/createTablePerformance.c
+2
-1
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
a3714edf
...
@@ -4962,6 +4962,7 @@ static void setCreateDBOption(SCMCreateDbMsg* pMsg, SCreateDBInfo* pCreateDb) {
...
@@ -4962,6 +4962,7 @@ static void setCreateDBOption(SCMCreateDbMsg* pMsg, SCreateDBInfo* pCreateDb) {
pMsg
->
commitTime
=
htonl
(
pCreateDb
->
commitTime
);
pMsg
->
commitTime
=
htonl
(
pCreateDb
->
commitTime
);
pMsg
->
minRowsPerFileBlock
=
htonl
(
pCreateDb
->
minRowsPerBlock
);
pMsg
->
minRowsPerFileBlock
=
htonl
(
pCreateDb
->
minRowsPerBlock
);
pMsg
->
maxRowsPerFileBlock
=
htonl
(
pCreateDb
->
maxRowsPerBlock
);
pMsg
->
maxRowsPerFileBlock
=
htonl
(
pCreateDb
->
maxRowsPerBlock
);
pMsg
->
fsyncPeriod
=
htonl
(
pCreateDb
->
fsyncPeriod
);
pMsg
->
compression
=
pCreateDb
->
compressionLevel
;
pMsg
->
compression
=
pCreateDb
->
compressionLevel
;
pMsg
->
walLevel
=
(
char
)
pCreateDb
->
walLevel
;
pMsg
->
walLevel
=
(
char
)
pCreateDb
->
walLevel
;
pMsg
->
replications
=
pCreateDb
->
replica
;
pMsg
->
replications
=
pCreateDb
->
replica
;
...
@@ -5529,6 +5530,13 @@ int32_t tscCheckCreateDbParams(SSqlCmd* pCmd, SCMCreateDbMsg* pCreate) {
...
@@ -5529,6 +5530,13 @@ int32_t tscCheckCreateDbParams(SSqlCmd* pCmd, SCMCreateDbMsg* pCreate) {
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg
);
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg
);
}
}
val
=
htonl
(
pCreate
->
fsyncPeriod
);
if
(
val
!=
-
1
&&
(
val
<
TSDB_MIN_FSYNC_PERIOD
||
val
>
TSDB_MAX_FSYNC_PERIOD
))
{
snprintf
(
msg
,
tListLen
(
msg
),
"invalid db option fsyncPeriod: %d valid range: [%d, %d]"
,
val
,
TSDB_MIN_FSYNC_PERIOD
,
TSDB_MAX_FSYNC_PERIOD
);
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg
);
}
if
(
pCreate
->
compression
!=
-
1
&&
if
(
pCreate
->
compression
!=
-
1
&&
(
pCreate
->
compression
<
TSDB_MIN_COMP_LEVEL
||
pCreate
->
compression
>
TSDB_MAX_COMP_LEVEL
))
{
(
pCreate
->
compression
<
TSDB_MIN_COMP_LEVEL
||
pCreate
->
compression
>
TSDB_MAX_COMP_LEVEL
))
{
snprintf
(
msg
,
tListLen
(
msg
),
"invalid db option compression: %d valid range: [%d, %d]"
,
pCreate
->
compression
,
snprintf
(
msg
,
tListLen
(
msg
),
"invalid db option compression: %d valid range: [%d, %d]"
,
pCreate
->
compression
,
...
...
src/common/inc/tglobal.h
浏览文件 @
a3714edf
...
@@ -80,6 +80,7 @@ extern int16_t tsCommitTime; // seconds
...
@@ -80,6 +80,7 @@ extern int16_t tsCommitTime; // seconds
extern
int32_t
tsTimePrecision
;
extern
int32_t
tsTimePrecision
;
extern
int16_t
tsCompression
;
extern
int16_t
tsCompression
;
extern
int16_t
tsWAL
;
extern
int16_t
tsWAL
;
extern
int32_t
tsFsyncPeriod
;
extern
int32_t
tsReplications
;
extern
int32_t
tsReplications
;
// balance
// balance
...
...
src/common/src/tdataformat.c
浏览文件 @
a3714edf
...
@@ -384,9 +384,11 @@ SDataCols *tdDupDataCols(SDataCols *pDataCols, bool keepData) {
...
@@ -384,9 +384,11 @@ SDataCols *tdDupDataCols(SDataCols *pDataCols, bool keepData) {
}
}
void
tdResetDataCols
(
SDataCols
*
pCols
)
{
void
tdResetDataCols
(
SDataCols
*
pCols
)
{
pCols
->
numOfRows
=
0
;
if
(
pCols
!=
NULL
)
{
for
(
int
i
=
0
;
i
<
pCols
->
maxCols
;
i
++
)
{
pCols
->
numOfRows
=
0
;
dataColReset
(
pCols
->
cols
+
i
);
for
(
int
i
=
0
;
i
<
pCols
->
maxCols
;
i
++
)
{
dataColReset
(
pCols
->
cols
+
i
);
}
}
}
}
}
...
...
src/common/src/tglobal.c
浏览文件 @
a3714edf
...
@@ -110,6 +110,7 @@ int16_t tsCommitTime = TSDB_DEFAULT_COMMIT_TIME; // seconds
...
@@ -110,6 +110,7 @@ int16_t tsCommitTime = TSDB_DEFAULT_COMMIT_TIME; // seconds
int32_t
tsTimePrecision
=
TSDB_DEFAULT_PRECISION
;
int32_t
tsTimePrecision
=
TSDB_DEFAULT_PRECISION
;
int16_t
tsCompression
=
TSDB_DEFAULT_COMP_LEVEL
;
int16_t
tsCompression
=
TSDB_DEFAULT_COMP_LEVEL
;
int16_t
tsWAL
=
TSDB_DEFAULT_WAL_LEVEL
;
int16_t
tsWAL
=
TSDB_DEFAULT_WAL_LEVEL
;
int32_t
tsFsyncPeriod
=
TSDB_DEFAULT_FSYNC_PERIOD
;
int32_t
tsReplications
=
TSDB_DEFAULT_DB_REPLICA_OPTION
;
int32_t
tsReplications
=
TSDB_DEFAULT_DB_REPLICA_OPTION
;
int32_t
tsMaxVgroupsPerDb
=
0
;
int32_t
tsMaxVgroupsPerDb
=
0
;
int32_t
tsMinTablePerVnode
=
100
;
int32_t
tsMinTablePerVnode
=
100
;
...
@@ -715,6 +716,16 @@ static void doInitGlobalConfig() {
...
@@ -715,6 +716,16 @@ static void doInitGlobalConfig() {
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"fsync"
;
cfg
.
ptr
=
&
tsFsyncPeriod
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_SHOW
;
cfg
.
minValue
=
TSDB_MIN_FSYNC_PERIOD
;
cfg
.
maxValue
=
TSDB_MAX_FSYNC_PERIOD
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"replica"
;
cfg
.
option
=
"replica"
;
cfg
.
ptr
=
&
tsReplications
;
cfg
.
ptr
=
&
tsReplications
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/BatchInsertTest.java
浏览文件 @
a3714edf
...
@@ -62,7 +62,7 @@ public class BatchInsertTest extends BaseTest {
...
@@ -62,7 +62,7 @@ public class BatchInsertTest extends BaseTest {
@Test
@Test
public
void
testBatchInsert
()
throws
SQLException
{
public
void
testBatchInsert
()
throws
SQLException
{
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
numOfTables
);
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
numOfTables
);
for
(
int
i
=
0
;
i
<
numOfTables
;
i
++)
{
for
(
int
i
=
0
;
i
<
numOfTables
;
i
++)
{
final
int
index
=
i
;
final
int
index
=
i
;
...
@@ -94,6 +94,14 @@ public class BatchInsertTest extends BaseTest {
...
@@ -94,6 +94,14 @@ public class BatchInsertTest extends BaseTest {
});
});
}
}
executorService
.
shutdown
();
try
{
executorService
.
awaitTermination
(
Long
.
MAX_VALUE
,
TimeUnit
.
NANOSECONDS
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
Statement
statement
=
connection
.
createStatement
();
Statement
statement
=
connection
.
createStatement
();
ResultSet
rs
=
statement
.
executeQuery
(
"select * from meters"
);
ResultSet
rs
=
statement
.
executeQuery
(
"select * from meters"
);
int
num
=
0
;
int
num
=
0
;
...
...
src/dnode/src/dnodeMgmt.c
浏览文件 @
a3714edf
...
@@ -401,6 +401,7 @@ static int32_t dnodeProcessCreateVnodeMsg(SRpcMsg *rpcMsg) {
...
@@ -401,6 +401,7 @@ static int32_t dnodeProcessCreateVnodeMsg(SRpcMsg *rpcMsg) {
pCreate
->
cfg
.
daysToKeep
=
htonl
(
pCreate
->
cfg
.
daysToKeep
);
pCreate
->
cfg
.
daysToKeep
=
htonl
(
pCreate
->
cfg
.
daysToKeep
);
pCreate
->
cfg
.
minRowsPerFileBlock
=
htonl
(
pCreate
->
cfg
.
minRowsPerFileBlock
);
pCreate
->
cfg
.
minRowsPerFileBlock
=
htonl
(
pCreate
->
cfg
.
minRowsPerFileBlock
);
pCreate
->
cfg
.
maxRowsPerFileBlock
=
htonl
(
pCreate
->
cfg
.
maxRowsPerFileBlock
);
pCreate
->
cfg
.
maxRowsPerFileBlock
=
htonl
(
pCreate
->
cfg
.
maxRowsPerFileBlock
);
pCreate
->
cfg
.
fsyncPeriod
=
htonl
(
pCreate
->
cfg
.
fsyncPeriod
);
pCreate
->
cfg
.
commitTime
=
htonl
(
pCreate
->
cfg
.
commitTime
);
pCreate
->
cfg
.
commitTime
=
htonl
(
pCreate
->
cfg
.
commitTime
);
for
(
int32_t
j
=
0
;
j
<
pCreate
->
cfg
.
replications
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
pCreate
->
cfg
.
replications
;
++
j
)
{
...
...
src/inc/taosdef.h
浏览文件 @
a3714edf
...
@@ -332,6 +332,10 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size);
...
@@ -332,6 +332,10 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size);
#define TSDB_MAX_WAL_LEVEL 2
#define TSDB_MAX_WAL_LEVEL 2
#define TSDB_DEFAULT_WAL_LEVEL 1
#define TSDB_DEFAULT_WAL_LEVEL 1
#define TSDB_MIN_FSYNC_PERIOD 0
#define TSDB_MAX_FSYNC_PERIOD 180000 // millisecond
#define TSDB_DEFAULT_FSYNC_PERIOD 3000 // three second
#define TSDB_MIN_DB_REPLICA_OPTION 1
#define TSDB_MIN_DB_REPLICA_OPTION 1
#define TSDB_MAX_DB_REPLICA_OPTION 3
#define TSDB_MAX_DB_REPLICA_OPTION 3
#define TSDB_DEFAULT_DB_REPLICA_OPTION 1
#define TSDB_DEFAULT_DB_REPLICA_OPTION 1
...
...
src/inc/taosmsg.h
浏览文件 @
a3714edf
...
@@ -515,6 +515,7 @@ typedef struct {
...
@@ -515,6 +515,7 @@ typedef struct {
int32_t
minRowsPerFileBlock
;
int32_t
minRowsPerFileBlock
;
int32_t
maxRowsPerFileBlock
;
int32_t
maxRowsPerFileBlock
;
int32_t
commitTime
;
int32_t
commitTime
;
int32_t
fsyncPeriod
;
uint8_t
precision
;
// time resolution
uint8_t
precision
;
// time resolution
int8_t
compression
;
int8_t
compression
;
int8_t
walLevel
;
int8_t
walLevel
;
...
@@ -608,6 +609,7 @@ typedef struct {
...
@@ -608,6 +609,7 @@ typedef struct {
int32_t
minRowsPerFileBlock
;
int32_t
minRowsPerFileBlock
;
int32_t
maxRowsPerFileBlock
;
int32_t
maxRowsPerFileBlock
;
int32_t
commitTime
;
int32_t
commitTime
;
int32_t
fsyncPeriod
;
int8_t
precision
;
int8_t
precision
;
int8_t
compression
;
int8_t
compression
;
int8_t
walLevel
;
int8_t
walLevel
;
...
...
src/inc/ttokendef.h
浏览文件 @
a3714edf
...
@@ -110,117 +110,117 @@
...
@@ -110,117 +110,117 @@
#define TK_BLOCKS 92
#define TK_BLOCKS 92
#define TK_CTIME 93
#define TK_CTIME 93
#define TK_WAL 94
#define TK_WAL 94
#define TK_
COMP
95
#define TK_
FSYNC
95
#define TK_
PRECISION
96
#define TK_
COMP
96
#define TK_
LP
97
#define TK_
PRECISION
97
#define TK_
R
P 98
#define TK_
L
P 98
#define TK_
TAGS
99
#define TK_
RP
99
#define TK_
USING
100
#define TK_
TAGS
100
#define TK_
AS
101
#define TK_
USING
101
#define TK_
COMMA
102
#define TK_
AS
102
#define TK_
NULL
103
#define TK_
COMMA
103
#define TK_
SELECT
104
#define TK_
NULL
104
#define TK_
UNION
105
#define TK_
SELECT
105
#define TK_
ALL
106
#define TK_
UNION
106
#define TK_
FROM
107
#define TK_
ALL
107
#define TK_
VARIABLE
108
#define TK_
FROM
108
#define TK_
INTERVAL
109
#define TK_
VARIABLE
109
#define TK_
FILL
110
#define TK_
INTERVAL
110
#define TK_
SLIDING
111
#define TK_
FILL
111
#define TK_
ORDER
112
#define TK_
SLIDING
112
#define TK_
BY
113
#define TK_
ORDER
113
#define TK_
ASC
114
#define TK_
BY
114
#define TK_
DESC
115
#define TK_
ASC
115
#define TK_
GROUP
116
#define TK_
DESC
116
#define TK_
HAVING
117
#define TK_
GROUP
117
#define TK_
LIMIT
118
#define TK_
HAVING
118
#define TK_
OFFSET
119
#define TK_
LIMIT
119
#define TK_
SLIMI
T 120
#define TK_
OFFSE
T 120
#define TK_S
OFFSET
121
#define TK_S
LIMIT
121
#define TK_
WHERE
122
#define TK_
SOFFSET
122
#define TK_
NOW
123
#define TK_
WHERE
123
#define TK_
RESET
124
#define TK_
NOW
124
#define TK_
QUERY
125
#define TK_
RESET
125
#define TK_
ADD
126
#define TK_
QUERY
126
#define TK_
COLUMN
127
#define TK_
ADD
127
#define TK_
TAG
128
#define TK_
COLUMN
128
#define TK_
CHANGE
129
#define TK_
TAG
129
#define TK_
SET
130
#define TK_
CHANGE
130
#define TK_
KILL
131
#define TK_
SET
131
#define TK_
CONNECTION
132
#define TK_
KILL
132
#define TK_
STREAM
133
#define TK_
CONNECTION
133
#define TK_
COLON
134
#define TK_
STREAM
134
#define TK_
ABORT
135
#define TK_
COLON
135
#define TK_A
FTER
136
#define TK_A
BORT
136
#define TK_A
TTACH
137
#define TK_A
FTER
137
#define TK_
BEFORE
138
#define TK_
ATTACH
138
#define TK_BE
GIN
139
#define TK_BE
FORE
139
#define TK_
CASCADE
140
#define TK_
BEGIN
140
#define TK_C
LUSTER
141
#define TK_C
ASCADE
141
#define TK_C
ONFLICT
142
#define TK_C
LUSTER
142
#define TK_CO
PY
143
#define TK_CO
NFLICT
143
#define TK_
DEFERRED
144
#define TK_
COPY
144
#define TK_DE
LIMITERS
145
#define TK_DE
FERRED
145
#define TK_DE
TACH
146
#define TK_DE
LIMITERS
146
#define TK_
EACH
147
#define TK_
DETACH
147
#define TK_E
ND
148
#define TK_E
ACH
148
#define TK_E
XPLAIN
149
#define TK_E
ND
149
#define TK_
FAIL
150
#define TK_
EXPLAIN
150
#define TK_F
OR
151
#define TK_F
AIL
151
#define TK_
IGNORE
152
#define TK_
FOR
152
#define TK_I
MMEDIATE
153
#define TK_I
GNORE
153
#define TK_I
NITIALLY
154
#define TK_I
MMEDIATE
154
#define TK_IN
STEAD
155
#define TK_IN
ITIALLY
155
#define TK_
MATCH
156
#define TK_
INSTEAD
156
#define TK_
KEY
157
#define TK_
MATCH
157
#define TK_
OF
158
#define TK_
KEY
158
#define TK_
RAISE
159
#define TK_
OF
159
#define TK_R
EPLACE
160
#define TK_R
AISE
160
#define TK_RE
STRICT
161
#define TK_RE
PLACE
161
#define TK_R
OW
162
#define TK_R
ESTRICT
162
#define TK_
STATEMENT
163
#define TK_
ROW
163
#define TK_
TRIGGER
164
#define TK_
STATEMENT
164
#define TK_
VIEW
165
#define TK_
TRIGGER
165
#define TK_
COUNT
166
#define TK_
VIEW
166
#define TK_
SUM
167
#define TK_
COUNT
167
#define TK_
AVG
168
#define TK_
SUM
168
#define TK_
MIN
169
#define TK_
AVG
169
#define TK_M
AX
170
#define TK_M
IN
170
#define TK_
FIRST
171
#define TK_
MAX
171
#define TK_
LAST
172
#define TK_
FIRST
172
#define TK_
TOP
173
#define TK_
LAST
173
#define TK_
BOTTOM
174
#define TK_
TOP
174
#define TK_
STDDEV
175
#define TK_
BOTTOM
175
#define TK_
PERCENTILE
176
#define TK_
STDDEV
176
#define TK_
APERCENTILE
177
#define TK_
PERCENTILE
177
#define TK_
LEASTSQUARES
178
#define TK_
APERCENTILE
178
#define TK_
HISTOGRAM
179
#define TK_
LEASTSQUARES
179
#define TK_
DIFF
180
#define TK_
HISTOGRAM
180
#define TK_
SPREAD
181
#define TK_
DIFF
181
#define TK_
TWA
182
#define TK_
SPREAD
182
#define TK_
INTERP
183
#define TK_
TWA
183
#define TK_
LAST_ROW
184
#define TK_
INTERP
184
#define TK_
RATE
185
#define TK_
LAST_ROW
185
#define TK_
IRATE
186
#define TK_
RATE
186
#define TK_
SUM_RATE
187
#define TK_
IRATE
187
#define TK_SUM_
IRATE
188
#define TK_SUM_
RATE
188
#define TK_
AVG_RATE
189
#define TK_
SUM_IRATE
189
#define TK_AVG_
IRATE
190
#define TK_AVG_
RATE
190
#define TK_
TBID
191
#define TK_
AVG_IRATE
191
#define TK_
SEMI
192
#define TK_
TBID
192
#define TK_
NONE
193
#define TK_
SEMI
193
#define TK_
PREV
194
#define TK_
NONE
194
#define TK_
LINEAR
195
#define TK_
PREV
195
#define TK_
IMPORT
196
#define TK_
LINEAR
196
#define TK_
METRIC
197
#define TK_
IMPORT
197
#define TK_
TBNAME
198
#define TK_
METRIC
198
#define TK_
JOIN
199
#define TK_
TBNAME
199
#define TK_
METRICS
200
#define TK_
JOIN
200
#define TK_
STABLE
201
#define TK_
METRICS
201
#define TK_
INSERT
202
#define TK_
STABLE
202
#define TK_IN
TO
203
#define TK_IN
SERT
203
#define TK_
VALUES
204
#define TK_
INTO
204
#define TK_VALUES 205
#define TK_SPACE 300
#define TK_SPACE 300
#define TK_COMMENT 301
#define TK_COMMENT 301
...
...
src/inc/twal.h
浏览文件 @
a3714edf
...
@@ -35,6 +35,7 @@ typedef struct {
...
@@ -35,6 +35,7 @@ typedef struct {
typedef
struct
{
typedef
struct
{
int8_t
walLevel
;
// wal level
int8_t
walLevel
;
// wal level
int32_t
fsyncPeriod
;
// millisecond
int8_t
wals
;
// number of WAL files;
int8_t
wals
;
// number of WAL files;
int8_t
keep
;
// keep the wal file when closed
int8_t
keep
;
// keep the wal file when closed
}
SWalCfg
;
}
SWalCfg
;
...
...
src/kit/taosdump/taosdump.c
浏览文件 @
a3714edf
...
@@ -179,8 +179,8 @@ static struct argp_option options[] = {
...
@@ -179,8 +179,8 @@ static struct argp_option options[] = {
{
"start-time"
,
'S'
,
"START_TIME"
,
0
,
"Start time to dump."
,
3
},
{
"start-time"
,
'S'
,
"START_TIME"
,
0
,
"Start time to dump."
,
3
},
{
"end-time"
,
'E'
,
"END_TIME"
,
0
,
"End time to dump."
,
3
},
{
"end-time"
,
'E'
,
"END_TIME"
,
0
,
"End time to dump."
,
3
},
{
"data-batch"
,
'N'
,
"DATA_BATCH"
,
0
,
"Number of data point per insert statement. Default is 1."
,
3
},
{
"data-batch"
,
'N'
,
"DATA_BATCH"
,
0
,
"Number of data point per insert statement. Default is 1."
,
3
},
{
"table-batch"
,
'
T
'
,
"TABLE_BATCH"
,
0
,
"Number of table dumpout into one output file. Default is 1."
,
3
},
{
"table-batch"
,
'
t
'
,
"TABLE_BATCH"
,
0
,
"Number of table dumpout into one output file. Default is 1."
,
3
},
{
"thread_num"
,
'
t
'
,
"THREAD_NUM"
,
0
,
"Number of thread for dump in file. Default is 5."
,
3
},
{
"thread_num"
,
'
T
'
,
"THREAD_NUM"
,
0
,
"Number of thread for dump in file. Default is 5."
,
3
},
{
"allow-sys"
,
'a'
,
0
,
0
,
"Allow to dump sys database"
,
3
},
{
"allow-sys"
,
'a'
,
0
,
0
,
"Allow to dump sys database"
,
3
},
{
0
}};
{
0
}};
...
@@ -304,10 +304,10 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
...
@@ -304,10 +304,10 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
case
'N'
:
case
'N'
:
arguments
->
data_batch
=
atoi
(
arg
);
arguments
->
data_batch
=
atoi
(
arg
);
break
;
break
;
case
'
T
'
:
case
'
t
'
:
arguments
->
table_batch
=
atoi
(
arg
);
arguments
->
table_batch
=
atoi
(
arg
);
break
;
break
;
case
'
t
'
:
case
'
T
'
:
arguments
->
thread_num
=
atoi
(
arg
);
arguments
->
thread_num
=
atoi
(
arg
);
break
;
break
;
case
OPT_ABORT
:
case
OPT_ABORT
:
...
@@ -406,7 +406,7 @@ int main(int argc, char *argv[]) {
...
@@ -406,7 +406,7 @@ int main(int argc, char *argv[]) {
printf
(
"password: %s
\n
"
,
tsArguments
.
password
);
printf
(
"password: %s
\n
"
,
tsArguments
.
password
);
printf
(
"port: %u
\n
"
,
tsArguments
.
port
);
printf
(
"port: %u
\n
"
,
tsArguments
.
port
);
printf
(
"cversion: %s
\n
"
,
tsArguments
.
cversion
);
printf
(
"cversion: %s
\n
"
,
tsArguments
.
cversion
);
printf
(
"mysqlFlag: %d"
,
tsArguments
.
mysqlFlag
);
printf
(
"mysqlFlag: %d
\n
"
,
tsArguments
.
mysqlFlag
);
printf
(
"outpath: %s
\n
"
,
tsArguments
.
outpath
);
printf
(
"outpath: %s
\n
"
,
tsArguments
.
outpath
);
printf
(
"inpath: %s
\n
"
,
tsArguments
.
inpath
);
printf
(
"inpath: %s
\n
"
,
tsArguments
.
inpath
);
printf
(
"encode: %s
\n
"
,
tsArguments
.
encode
);
printf
(
"encode: %s
\n
"
,
tsArguments
.
encode
);
...
@@ -821,7 +821,7 @@ _exit_failure:
...
@@ -821,7 +821,7 @@ _exit_failure:
return
-
1
;
return
-
1
;
}
}
int
taosGetTableDes
(
char
*
table
,
STableDef
*
tableDes
,
TAOS
*
taosCon
)
{
int
taosGetTableDes
(
char
*
table
,
STableDef
*
tableDes
,
TAOS
*
taosCon
,
bool
isSuperTable
)
{
TAOS_ROW
row
=
NULL
;
TAOS_ROW
row
=
NULL
;
TAOS_RES
*
tmpResult
=
NULL
;
TAOS_RES
*
tmpResult
=
NULL
;
int
count
=
0
;
int
count
=
0
;
...
@@ -832,6 +832,13 @@ int taosGetTableDes(char *table, STableDef *tableDes, TAOS* taosCon) {
...
@@ -832,6 +832,13 @@ int taosGetTableDes(char *table, STableDef *tableDes, TAOS* taosCon) {
return
-
1
;
return
-
1
;
}
}
char
*
tbuf
=
(
char
*
)
malloc
(
COMMAND_SIZE
);
if
(
tbuf
==
NULL
)
{
fprintf
(
stderr
,
"failed to allocate memory
\n
"
);
free
(
tempCommand
);
return
-
1
;
}
sprintf
(
tempCommand
,
"describe %s"
,
table
);
sprintf
(
tempCommand
,
"describe %s"
,
table
);
tmpResult
=
taos_query
(
taosCon
,
tempCommand
);
tmpResult
=
taos_query
(
taosCon
,
tempCommand
);
...
@@ -862,6 +869,92 @@ int taosGetTableDes(char *table, STableDef *tableDes, TAOS* taosCon) {
...
@@ -862,6 +869,92 @@ int taosGetTableDes(char *table, STableDef *tableDes, TAOS* taosCon) {
taos_free_result
(
tmpResult
);
taos_free_result
(
tmpResult
);
tmpResult
=
NULL
;
tmpResult
=
NULL
;
if
(
isSuperTable
)
{
free
(
tempCommand
);
return
count
;
}
// if chidl-table have tag, using select tagName from table to get tagValue
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
if
(
strcmp
(
tableDes
->
cols
[
i
].
note
,
"TAG"
)
!=
0
)
continue
;
sprintf
(
tempCommand
,
"select %s from %s"
,
tableDes
->
cols
[
i
].
field
,
table
);
tmpResult
=
taos_query
(
taosCon
,
tempCommand
);
code
=
taos_errno
(
tmpResult
);
if
(
code
!=
0
)
{
fprintf
(
stderr
,
"failed to run command %s
\n
"
,
tempCommand
);
free
(
tempCommand
);
taos_free_result
(
tmpResult
);
return
-
1
;
}
fields
=
taos_fetch_fields
(
tmpResult
);
row
=
taos_fetch_row
(
tmpResult
);
if
(
NULL
==
row
)
{
fprintf
(
stderr
,
" fetch failed to run command %s
\n
"
,
tempCommand
);
free
(
tempCommand
);
taos_free_result
(
tmpResult
);
return
-
1
;
}
switch
(
fields
[
0
].
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
sprintf
(
tableDes
->
cols
[
i
].
note
,
"%d"
,
((((
int
)(
*
((
char
*
)
row
[
0
])))
==
1
)
?
1
:
0
));
break
;
case
TSDB_DATA_TYPE_TINYINT
:
sprintf
(
tableDes
->
cols
[
i
].
note
,
"%d"
,
(
int
)(
*
((
char
*
)
row
[
0
])));
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
sprintf
(
tableDes
->
cols
[
i
].
note
,
"%d"
,
(
int
)(
*
((
short
*
)
row
[
0
])));
break
;
case
TSDB_DATA_TYPE_INT
:
sprintf
(
tableDes
->
cols
[
i
].
note
,
"%d"
,
*
((
int
*
)
row
[
0
]));
break
;
case
TSDB_DATA_TYPE_BIGINT
:
sprintf
(
tableDes
->
cols
[
i
].
note
,
"%"
PRId64
""
,
*
((
int64_t
*
)
row
[
0
]));
break
;
case
TSDB_DATA_TYPE_FLOAT
:
sprintf
(
tableDes
->
cols
[
i
].
note
,
"%f"
,
GET_FLOAT_VAL
(
row
[
0
]));
break
;
case
TSDB_DATA_TYPE_DOUBLE
:
sprintf
(
tableDes
->
cols
[
i
].
note
,
"%f"
,
GET_DOUBLE_VAL
(
row
[
0
]));
break
;
case
TSDB_DATA_TYPE_BINARY
:
tableDes
->
cols
[
i
].
note
[
0
]
=
'\''
;
converStringToReadable
((
char
*
)
row
[
0
],
fields
[
0
].
bytes
,
tbuf
,
COMMAND_SIZE
);
char
*
pstr
=
stpcpy
(
&
(
tableDes
->
cols
[
i
].
note
[
1
]),
tbuf
);
*
(
pstr
++
)
=
'\''
;
break
;
case
TSDB_DATA_TYPE_NCHAR
:
convertNCharToReadable
((
char
*
)
row
[
0
],
fields
[
0
].
bytes
,
tbuf
,
COMMAND_SIZE
);
sprintf
(
tableDes
->
cols
[
i
].
note
,
"
\'
%s
\'
"
,
tbuf
);
break
;
case
TSDB_DATA_TYPE_TIMESTAMP
:
sprintf
(
tableDes
->
cols
[
i
].
note
,
"%"
PRId64
""
,
*
(
int64_t
*
)
row
[
0
]);
#if 0
if (!arguments->mysqlFlag) {
sprintf(tableDes->cols[i].note, "%" PRId64 "", *(int64_t *)row[0]);
} else {
char buf[64] = "\0";
int64_t ts = *((int64_t *)row[0]);
time_t tt = (time_t)(ts / 1000);
struct tm *ptm = localtime(&tt);
strftime(buf, 64, "%y-%m-%d %H:%M:%S", ptm);
sprintf(tableDes->cols[i].note, "\'%s.%03d\'", buf, (int)(ts % 1000));
}
#endif
break
;
default:
break
;
}
taos_free_result
(
tmpResult
);
tmpResult
=
NULL
;
}
free
(
tempCommand
);
free
(
tempCommand
);
return
count
;
return
count
;
...
@@ -886,23 +979,25 @@ int32_t taosDumpTable(char *table, char *metric, struct arguments *arguments, FI
...
@@ -886,23 +979,25 @@ int32_t taosDumpTable(char *table, char *metric, struct arguments *arguments, FI
memset(tableDes, 0, sizeof(STableDef) + sizeof(SColDes) * TSDB_MAX_COLUMNS);
memset(tableDes, 0, sizeof(STableDef) + sizeof(SColDes) * TSDB_MAX_COLUMNS);
*/
*/
count
=
taosGetTableDes
(
table
,
tableDes
,
taosCon
);
count
=
taosGetTableDes
(
table
,
tableDes
,
taosCon
,
false
);
if
(
count
<
0
)
{
if
(
count
<
0
)
{
free
(
tableDes
);
free
(
tableDes
);
return
-
1
;
return
-
1
;
}
}
// create child-table using super-table
taosDumpCreateMTableClause
(
tableDes
,
metric
,
count
,
fp
);
taosDumpCreateMTableClause
(
tableDes
,
metric
,
count
,
fp
);
}
else
{
// dump table definition
}
else
{
// dump table definition
count
=
taosGetTableDes
(
table
,
tableDes
,
taosCon
);
count
=
taosGetTableDes
(
table
,
tableDes
,
taosCon
,
false
);
if
(
count
<
0
)
{
if
(
count
<
0
)
{
free
(
tableDes
);
free
(
tableDes
);
return
-
1
;
return
-
1
;
}
}
// create normal-table or super-table
taosDumpCreateTableClause
(
tableDes
,
count
,
fp
);
taosDumpCreateTableClause
(
tableDes
,
count
,
fp
);
}
}
...
@@ -1033,7 +1128,7 @@ int32_t taosDumpStable(char *table, FILE *fp, TAOS* taosCon) {
...
@@ -1033,7 +1128,7 @@ int32_t taosDumpStable(char *table, FILE *fp, TAOS* taosCon) {
exit
(
-
1
);
exit
(
-
1
);
}
}
count
=
taosGetTableDes
(
table
,
tableDes
,
taosCon
);
count
=
taosGetTableDes
(
table
,
tableDes
,
taosCon
,
true
);
if
(
count
<
0
)
{
if
(
count
<
0
)
{
free
(
tableDes
);
free
(
tableDes
);
...
@@ -1083,7 +1178,6 @@ int32_t taosDumpCreateSuperTableClause(TAOS* taosCon, char* dbName, FILE *fp)
...
@@ -1083,7 +1178,6 @@ int32_t taosDumpCreateSuperTableClause(TAOS* taosCon, char* dbName, FILE *fp)
taos_free_result
(
tmpResult
);
taos_free_result
(
tmpResult
);
exit
(
-
1
);
exit
(
-
1
);
}
}
taos_free_result
(
tmpResult
);
TAOS_FIELD
*
fields
=
taos_fetch_fields
(
tmpResult
);
TAOS_FIELD
*
fields
=
taos_fetch_fields
(
tmpResult
);
...
@@ -1291,14 +1385,16 @@ void taosDumpCreateMTableClause(STableDef *tableDes, char *metric, int numOfCols
...
@@ -1291,14 +1385,16 @@ void taosDumpCreateMTableClause(STableDef *tableDes, char *metric, int numOfCols
if
(
counter
!=
count_temp
)
{
if
(
counter
!=
count_temp
)
{
if
(
strcasecmp
(
tableDes
->
cols
[
counter
].
type
,
"binary"
)
==
0
||
if
(
strcasecmp
(
tableDes
->
cols
[
counter
].
type
,
"binary"
)
==
0
||
strcasecmp
(
tableDes
->
cols
[
counter
].
type
,
"nchar"
)
==
0
)
{
strcasecmp
(
tableDes
->
cols
[
counter
].
type
,
"nchar"
)
==
0
)
{
pstr
+=
sprintf
(
pstr
,
",
\'
%s
\'
"
,
tableDes
->
cols
[
counter
].
note
);
//pstr += sprintf(pstr, ", \'%s\'", tableDes->cols[counter].note);
pstr
+=
sprintf
(
pstr
,
", %s"
,
tableDes
->
cols
[
counter
].
note
);
}
else
{
}
else
{
pstr
+=
sprintf
(
pstr
,
", %s"
,
tableDes
->
cols
[
counter
].
note
);
pstr
+=
sprintf
(
pstr
,
", %s"
,
tableDes
->
cols
[
counter
].
note
);
}
}
}
else
{
}
else
{
if
(
strcasecmp
(
tableDes
->
cols
[
counter
].
type
,
"binary"
)
==
0
||
if
(
strcasecmp
(
tableDes
->
cols
[
counter
].
type
,
"binary"
)
==
0
||
strcasecmp
(
tableDes
->
cols
[
counter
].
type
,
"nchar"
)
==
0
)
{
strcasecmp
(
tableDes
->
cols
[
counter
].
type
,
"nchar"
)
==
0
)
{
pstr
+=
sprintf
(
pstr
,
"
\'
%s
\'
"
,
tableDes
->
cols
[
counter
].
note
);
//pstr += sprintf(pstr, "\'%s\'", tableDes->cols[counter].note);
pstr
+=
sprintf
(
pstr
,
"%s"
,
tableDes
->
cols
[
counter
].
note
);
}
else
{
}
else
{
pstr
+=
sprintf
(
pstr
,
"%s"
,
tableDes
->
cols
[
counter
].
note
);
pstr
+=
sprintf
(
pstr
,
"%s"
,
tableDes
->
cols
[
counter
].
note
);
}
}
...
@@ -1363,7 +1459,7 @@ int taosDumpTableData(FILE *fp, char *tbname, struct arguments *arguments, TAOS*
...
@@ -1363,7 +1459,7 @@ int taosDumpTableData(FILE *fp, char *tbname, struct arguments *arguments, TAOS*
return
-
1
;
return
-
1
;
}
}
numFields
=
taos_field_count
(
t
aosCon
);
numFields
=
taos_field_count
(
t
mpResult
);
assert
(
numFields
>
0
);
assert
(
numFields
>
0
);
TAOS_FIELD
*
fields
=
taos_fetch_fields
(
tmpResult
);
TAOS_FIELD
*
fields
=
taos_fetch_fields
(
tmpResult
);
tbuf
=
(
char
*
)
malloc
(
COMMAND_SIZE
);
tbuf
=
(
char
*
)
malloc
(
COMMAND_SIZE
);
...
@@ -2015,6 +2111,7 @@ int taosDumpInOneFile(TAOS * taos, FILE* fp, char* fcharset, char* encode, c
...
@@ -2015,6 +2111,7 @@ int taosDumpInOneFile(TAOS * taos, FILE* fp, char* fcharset, char* encode, c
}
}
memcpy
(
cmd
+
cmd_len
,
line
,
read_len
);
memcpy
(
cmd
+
cmd_len
,
line
,
read_len
);
cmd
[
read_len
+
cmd_len
]
=
'\0'
;
if
(
queryDB
(
taos
,
cmd
))
{
if
(
queryDB
(
taos
,
cmd
))
{
fprintf
(
stderr
,
"error sql: linenu:%d, file:%s
\n
"
,
lineNo
,
fileName
);
fprintf
(
stderr
,
"error sql: linenu:%d, file:%s
\n
"
,
lineNo
,
fileName
);
}
}
...
...
src/kit/taosmigrate/taosmigrateVnodeCfg.c
浏览文件 @
a3714edf
...
@@ -48,6 +48,7 @@ static int32_t saveVnodeCfg(SVnodeObj *pVnode, char* cfgFile)
...
@@ -48,6 +48,7 @@ static int32_t saveVnodeCfg(SVnodeObj *pVnode, char* cfgFile)
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
precision
\"
: %d,
\n
"
,
pVnode
->
tsdbCfg
.
precision
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
precision
\"
: %d,
\n
"
,
pVnode
->
tsdbCfg
.
precision
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
compression
\"
: %d,
\n
"
,
pVnode
->
tsdbCfg
.
compression
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
compression
\"
: %d,
\n
"
,
pVnode
->
tsdbCfg
.
compression
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
walLevel
\"
: %d,
\n
"
,
pVnode
->
walCfg
.
walLevel
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
walLevel
\"
: %d,
\n
"
,
pVnode
->
walCfg
.
walLevel
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
fsync
\"
: %d,
\n
"
,
pVnode
->
walCfg
.
fsyncPeriod
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
replica
\"
: %d,
\n
"
,
pVnode
->
syncCfg
.
replica
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
replica
\"
: %d,
\n
"
,
pVnode
->
syncCfg
.
replica
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
wals
\"
: %d,
\n
"
,
pVnode
->
walCfg
.
wals
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
wals
\"
: %d,
\n
"
,
pVnode
->
walCfg
.
wals
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
quorum
\"
: %d,
\n
"
,
pVnode
->
syncCfg
.
quorum
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
quorum
\"
: %d,
\n
"
,
pVnode
->
syncCfg
.
quorum
);
...
@@ -212,6 +213,13 @@ static int32_t readVnodeCfg(SVnodeObj *pVnode, char* cfgFile)
...
@@ -212,6 +213,13 @@ static int32_t readVnodeCfg(SVnodeObj *pVnode, char* cfgFile)
}
}
pVnode
->
walCfg
.
walLevel
=
(
int8_t
)
walLevel
->
valueint
;
pVnode
->
walCfg
.
walLevel
=
(
int8_t
)
walLevel
->
valueint
;
cJSON
*
fsyncPeriod
=
cJSON_GetObjectItem
(
root
,
"fsync"
);
if
(
!
fsyncPeriod
||
fsyncPeriod
->
type
!=
cJSON_Number
)
{
printf
(
"vgId:%d, failed to read vnode cfg, fsyncPeriod not found
\n
"
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
pVnode
->
walCfg
.
fsyncPeriod
=
fsyncPeriod
->
valueint
;
cJSON
*
wals
=
cJSON_GetObjectItem
(
root
,
"wals"
);
cJSON
*
wals
=
cJSON_GetObjectItem
(
root
,
"wals"
);
if
(
!
wals
||
wals
->
type
!=
cJSON_Number
)
{
if
(
!
wals
||
wals
->
type
!=
cJSON_Number
)
{
printf
(
"vgId:%d, failed to read vnode cfg, wals not found
\n
"
,
pVnode
->
vgId
);
printf
(
"vgId:%d, failed to read vnode cfg, wals not found
\n
"
,
pVnode
->
vgId
);
...
...
src/mnode/inc/mnodeDef.h
浏览文件 @
a3714edf
...
@@ -160,6 +160,7 @@ typedef struct {
...
@@ -160,6 +160,7 @@ typedef struct {
int32_t
minRowsPerFileBlock
;
int32_t
minRowsPerFileBlock
;
int32_t
maxRowsPerFileBlock
;
int32_t
maxRowsPerFileBlock
;
int32_t
commitTime
;
int32_t
commitTime
;
int32_t
fsyncPeriod
;
int8_t
precision
;
int8_t
precision
;
int8_t
compression
;
int8_t
compression
;
int8_t
walLevel
;
int8_t
walLevel
;
...
...
src/mnode/src/mnodeDb.c
浏览文件 @
a3714edf
...
@@ -287,14 +287,14 @@ static int32_t mnodeCheckDbCfg(SDbCfg *pCfg) {
...
@@ -287,14 +287,14 @@ static int32_t mnodeCheckDbCfg(SDbCfg *pCfg) {
return
TSDB_CODE_MND_INVALID_DB_OPTION
;
return
TSDB_CODE_MND_INVALID_DB_OPTION
;
}
}
if
(
pCfg
->
replications
<
TSDB_MIN_DB_REPLICA_OPTION
||
pCfg
->
replications
>
TSDB_MAX_DB_REPLICA_OPTION
)
{
if
(
pCfg
->
fsyncPeriod
<
TSDB_MIN_FSYNC_PERIOD
||
pCfg
->
fsyncPeriod
>
TSDB_MAX_FSYNC_PERIOD
)
{
mError
(
"invalid db option replications:%d valid range: [%d, %d]"
,
pCfg
->
replications
,
TSDB_MIN_DB_REPLICA_OPTION
,
mError
(
"invalid db option fsyncPeriod:%d, valid range: [%d, %d]"
,
pCfg
->
fsyncPeriod
,
TSDB_MIN_FSYNC_PERIOD
,
TSDB_MAX_FSYNC_PERIOD
);
TSDB_MAX_DB_REPLICA_OPTION
);
return
TSDB_CODE_MND_INVALID_DB_OPTION
;
return
TSDB_CODE_MND_INVALID_DB_OPTION
;
}
}
if
(
pCfg
->
walLevel
<
TSDB_MIN_WAL_LEVEL
)
{
if
(
pCfg
->
replications
<
TSDB_MIN_DB_REPLICA_OPTION
||
pCfg
->
replications
>
TSDB_MAX_DB_REPLICA_OPTION
)
{
mError
(
"invalid db option walLevel:%d must be greater than 0"
,
pCfg
->
walLevel
);
mError
(
"invalid db option replications:%d valid range: [%d, %d]"
,
pCfg
->
replications
,
TSDB_MIN_DB_REPLICA_OPTION
,
TSDB_MAX_DB_REPLICA_OPTION
);
return
TSDB_CODE_MND_INVALID_DB_OPTION
;
return
TSDB_CODE_MND_INVALID_DB_OPTION
;
}
}
...
@@ -318,6 +318,7 @@ static void mnodeSetDefaultDbCfg(SDbCfg *pCfg) {
...
@@ -318,6 +318,7 @@ static void mnodeSetDefaultDbCfg(SDbCfg *pCfg) {
if
(
pCfg
->
daysToKeep2
<
0
)
pCfg
->
daysToKeep2
=
pCfg
->
daysToKeep
;
if
(
pCfg
->
daysToKeep2
<
0
)
pCfg
->
daysToKeep2
=
pCfg
->
daysToKeep
;
if
(
pCfg
->
minRowsPerFileBlock
<
0
)
pCfg
->
minRowsPerFileBlock
=
tsMinRowsInFileBlock
;
if
(
pCfg
->
minRowsPerFileBlock
<
0
)
pCfg
->
minRowsPerFileBlock
=
tsMinRowsInFileBlock
;
if
(
pCfg
->
maxRowsPerFileBlock
<
0
)
pCfg
->
maxRowsPerFileBlock
=
tsMaxRowsInFileBlock
;
if
(
pCfg
->
maxRowsPerFileBlock
<
0
)
pCfg
->
maxRowsPerFileBlock
=
tsMaxRowsInFileBlock
;
if
(
pCfg
->
fsyncPeriod
<
0
)
pCfg
->
fsyncPeriod
=
tsFsyncPeriod
;
if
(
pCfg
->
commitTime
<
0
)
pCfg
->
commitTime
=
tsCommitTime
;
if
(
pCfg
->
commitTime
<
0
)
pCfg
->
commitTime
=
tsCommitTime
;
if
(
pCfg
->
precision
<
0
)
pCfg
->
precision
=
tsTimePrecision
;
if
(
pCfg
->
precision
<
0
)
pCfg
->
precision
=
tsTimePrecision
;
if
(
pCfg
->
compression
<
0
)
pCfg
->
compression
=
tsCompression
;
if
(
pCfg
->
compression
<
0
)
pCfg
->
compression
=
tsCompression
;
...
@@ -367,6 +368,7 @@ static int32_t mnodeCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate, void *pMs
...
@@ -367,6 +368,7 @@ static int32_t mnodeCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate, void *pMs
.
daysToKeep2
=
pCreate
->
daysToKeep2
,
.
daysToKeep2
=
pCreate
->
daysToKeep2
,
.
minRowsPerFileBlock
=
pCreate
->
minRowsPerFileBlock
,
.
minRowsPerFileBlock
=
pCreate
->
minRowsPerFileBlock
,
.
maxRowsPerFileBlock
=
pCreate
->
maxRowsPerFileBlock
,
.
maxRowsPerFileBlock
=
pCreate
->
maxRowsPerFileBlock
,
.
fsyncPeriod
=
pCreate
->
fsyncPeriod
,
.
commitTime
=
pCreate
->
commitTime
,
.
commitTime
=
pCreate
->
commitTime
,
.
precision
=
pCreate
->
precision
,
.
precision
=
pCreate
->
precision
,
.
compression
=
pCreate
->
compression
,
.
compression
=
pCreate
->
compression
,
...
@@ -559,6 +561,12 @@ static int32_t mnodeGetDbMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn
...
@@ -559,6 +561,12 @@ static int32_t mnodeGetDbMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"fsync"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
1
;
pShow
->
bytes
[
cols
]
=
1
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TINYINT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TINYINT
;
strcpy
(
pSchema
[
cols
].
name
,
"comp"
);
strcpy
(
pSchema
[
cols
].
name
,
"comp"
);
...
@@ -682,6 +690,10 @@ static int32_t mnodeRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void
...
@@ -682,6 +690,10 @@ static int32_t mnodeRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void
*
(
int8_t
*
)
pWrite
=
pDb
->
cfg
.
walLevel
;
*
(
int8_t
*
)
pWrite
=
pDb
->
cfg
.
walLevel
;
cols
++
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int32_t
*
)
pWrite
=
pDb
->
cfg
.
fsyncPeriod
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int8_t
*
)
pWrite
=
pDb
->
cfg
.
compression
;
*
(
int8_t
*
)
pWrite
=
pDb
->
cfg
.
compression
;
cols
++
;
cols
++
;
...
@@ -758,6 +770,7 @@ static int32_t mnodeProcessCreateDbMsg(SMnodeMsg *pMsg) {
...
@@ -758,6 +770,7 @@ static int32_t mnodeProcessCreateDbMsg(SMnodeMsg *pMsg) {
pCreate
->
daysToKeep1
=
htonl
(
pCreate
->
daysToKeep1
);
pCreate
->
daysToKeep1
=
htonl
(
pCreate
->
daysToKeep1
);
pCreate
->
daysToKeep2
=
htonl
(
pCreate
->
daysToKeep2
);
pCreate
->
daysToKeep2
=
htonl
(
pCreate
->
daysToKeep2
);
pCreate
->
commitTime
=
htonl
(
pCreate
->
commitTime
);
pCreate
->
commitTime
=
htonl
(
pCreate
->
commitTime
);
pCreate
->
fsyncPeriod
=
htonl
(
pCreate
->
fsyncPeriod
);
pCreate
->
minRowsPerFileBlock
=
htonl
(
pCreate
->
minRowsPerFileBlock
);
pCreate
->
minRowsPerFileBlock
=
htonl
(
pCreate
->
minRowsPerFileBlock
);
pCreate
->
maxRowsPerFileBlock
=
htonl
(
pCreate
->
maxRowsPerFileBlock
);
pCreate
->
maxRowsPerFileBlock
=
htonl
(
pCreate
->
maxRowsPerFileBlock
);
...
@@ -785,6 +798,7 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) {
...
@@ -785,6 +798,7 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) {
int32_t
minRows
=
htonl
(
pAlter
->
minRowsPerFileBlock
);
int32_t
minRows
=
htonl
(
pAlter
->
minRowsPerFileBlock
);
int32_t
maxRows
=
htonl
(
pAlter
->
maxRowsPerFileBlock
);
int32_t
maxRows
=
htonl
(
pAlter
->
maxRowsPerFileBlock
);
int32_t
commitTime
=
htonl
(
pAlter
->
commitTime
);
int32_t
commitTime
=
htonl
(
pAlter
->
commitTime
);
int32_t
fsyncPeriod
=
htonl
(
pAlter
->
fsyncPeriod
);
int8_t
compression
=
pAlter
->
compression
;
int8_t
compression
=
pAlter
->
compression
;
int8_t
walLevel
=
pAlter
->
walLevel
;
int8_t
walLevel
=
pAlter
->
walLevel
;
int8_t
replications
=
pAlter
->
replications
;
int8_t
replications
=
pAlter
->
replications
;
...
@@ -861,6 +875,11 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) {
...
@@ -861,6 +875,11 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) {
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
}
}
if
(
fsyncPeriod
>=
0
&&
fsyncPeriod
!=
pDb
->
cfg
.
fsyncPeriod
)
{
mError
(
"db:%s, can't alter fsyncPeriod option"
,
pDb
->
name
);
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
}
if
(
replications
>
0
&&
replications
!=
pDb
->
cfg
.
replications
)
{
if
(
replications
>
0
&&
replications
!=
pDb
->
cfg
.
replications
)
{
mDebug
(
"db:%s, replications:%d change to %d"
,
pDb
->
name
,
pDb
->
cfg
.
replications
,
replications
);
mDebug
(
"db:%s, replications:%d change to %d"
,
pDb
->
name
,
pDb
->
cfg
.
replications
,
replications
);
newCfg
.
replications
=
replications
;
newCfg
.
replications
=
replications
;
...
...
src/mnode/src/mnodeSdb.c
浏览文件 @
a3714edf
...
@@ -170,7 +170,7 @@ static void *sdbGetTableFromId(int32_t tableId) {
...
@@ -170,7 +170,7 @@ static void *sdbGetTableFromId(int32_t tableId) {
}
}
static
int32_t
sdbInitWal
()
{
static
int32_t
sdbInitWal
()
{
SWalCfg
walCfg
=
{.
walLevel
=
2
,
.
wals
=
2
,
.
keep
=
1
};
SWalCfg
walCfg
=
{.
walLevel
=
2
,
.
wals
=
2
,
.
keep
=
1
,
.
fsyncPeriod
=
0
};
char
temp
[
TSDB_FILENAME_LEN
];
char
temp
[
TSDB_FILENAME_LEN
];
sprintf
(
temp
,
"%s/wal"
,
tsMnodeDir
);
sprintf
(
temp
,
"%s/wal"
,
tsMnodeDir
);
tsSdbObj
.
wal
=
walOpen
(
temp
,
&
walCfg
);
tsSdbObj
.
wal
=
walOpen
(
temp
,
&
walCfg
);
...
@@ -252,13 +252,15 @@ static void sdbConfirmForward(void *ahandle, void *param, int32_t code) {
...
@@ -252,13 +252,15 @@ static void sdbConfirmForward(void *ahandle, void *param, int32_t code) {
int32_t
processedCount
=
atomic_add_fetch_32
(
&
pOper
->
processedCount
,
1
);
int32_t
processedCount
=
atomic_add_fetch_32
(
&
pOper
->
processedCount
,
1
);
if
(
processedCount
<=
1
)
{
if
(
processedCount
<=
1
)
{
if
(
pMsg
!=
NULL
)
{
if
(
pMsg
!=
NULL
)
{
sdbDebug
(
"app:%p:%p, waiting for confirm this operation, count:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
processedCount
);
sdbDebug
(
"app:%p:%p, waiting for confirm this operation, count:%d result:%s"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
processedCount
,
tstrerror
(
code
));
}
}
return
;
return
;
}
}
if
(
pMsg
!=
NULL
)
{
if
(
pMsg
!=
NULL
)
{
sdbDebug
(
"app:%p:%p, is confirmed and will do callback func"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
);
sdbDebug
(
"app:%p:%p, is confirmed and will do callback func, result:%s"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
tstrerror
(
code
));
}
}
if
(
pOper
->
cb
!=
NULL
)
{
if
(
pOper
->
cb
!=
NULL
)
{
...
...
src/mnode/src/mnodeVgroup.c
浏览文件 @
a3714edf
...
@@ -757,6 +757,7 @@ SMDCreateVnodeMsg *mnodeBuildCreateVnodeMsg(SVgObj *pVgroup) {
...
@@ -757,6 +757,7 @@ SMDCreateVnodeMsg *mnodeBuildCreateVnodeMsg(SVgObj *pVgroup) {
pCfg
->
daysToKeep2
=
htonl
(
pDb
->
cfg
.
daysToKeep2
);
pCfg
->
daysToKeep2
=
htonl
(
pDb
->
cfg
.
daysToKeep2
);
pCfg
->
minRowsPerFileBlock
=
htonl
(
pDb
->
cfg
.
minRowsPerFileBlock
);
pCfg
->
minRowsPerFileBlock
=
htonl
(
pDb
->
cfg
.
minRowsPerFileBlock
);
pCfg
->
maxRowsPerFileBlock
=
htonl
(
pDb
->
cfg
.
maxRowsPerFileBlock
);
pCfg
->
maxRowsPerFileBlock
=
htonl
(
pDb
->
cfg
.
maxRowsPerFileBlock
);
pCfg
->
fsyncPeriod
=
htonl
(
pDb
->
cfg
.
fsyncPeriod
);
pCfg
->
commitTime
=
htonl
(
pDb
->
cfg
.
commitTime
);
pCfg
->
commitTime
=
htonl
(
pDb
->
cfg
.
commitTime
);
pCfg
->
precision
=
pDb
->
cfg
.
precision
;
pCfg
->
precision
=
pDb
->
cfg
.
precision
;
pCfg
->
compression
=
pDb
->
cfg
.
compression
;
pCfg
->
compression
=
pDb
->
cfg
.
compression
;
...
...
src/query/inc/qsqlparser.h
浏览文件 @
a3714edf
...
@@ -116,6 +116,7 @@ typedef struct SCreateDBInfo {
...
@@ -116,6 +116,7 @@ typedef struct SCreateDBInfo {
int32_t
daysPerFile
;
int32_t
daysPerFile
;
int32_t
minRowsPerBlock
;
int32_t
minRowsPerBlock
;
int32_t
maxRowsPerBlock
;
int32_t
maxRowsPerBlock
;
int32_t
fsyncPeriod
;
int64_t
commitTime
;
int64_t
commitTime
;
int32_t
walLevel
;
int32_t
walLevel
;
int32_t
compressionLevel
;
int32_t
compressionLevel
;
...
...
src/query/inc/sql.y
浏览文件 @
a3714edf
...
@@ -221,6 +221,7 @@ maxrows(Y) ::= MAXROWS INTEGER(X). { Y = X; }
...
@@ -221,6 +221,7 @@ maxrows(Y) ::= MAXROWS INTEGER(X). { Y = X; }
blocks(Y) ::= BLOCKS INTEGER(X). { Y = X; }
blocks(Y) ::= BLOCKS INTEGER(X). { Y = X; }
ctime(Y) ::= CTIME INTEGER(X). { Y = X; }
ctime(Y) ::= CTIME INTEGER(X). { Y = X; }
wal(Y) ::= WAL INTEGER(X). { Y = X; }
wal(Y) ::= WAL INTEGER(X). { Y = X; }
fsync(Y) ::= FSYNC INTEGER(X). { Y = X; }
comp(Y) ::= COMP INTEGER(X). { Y = X; }
comp(Y) ::= COMP INTEGER(X). { Y = X; }
prec(Y) ::= PRECISION STRING(X). { Y = X; }
prec(Y) ::= PRECISION STRING(X). { Y = X; }
...
@@ -236,6 +237,7 @@ db_optr(Y) ::= db_optr(Z) maxrows(X). { Y = Z; Y.maxRowsPerBlock = strtod
...
@@ -236,6 +237,7 @@ db_optr(Y) ::= db_optr(Z) maxrows(X). { Y = Z; Y.maxRowsPerBlock = strtod
db_optr(Y) ::= db_optr(Z) blocks(X). { Y = Z; Y.numOfBlocks = strtol(X.z, NULL, 10); }
db_optr(Y) ::= db_optr(Z) blocks(X). { Y = Z; Y.numOfBlocks = strtol(X.z, NULL, 10); }
db_optr(Y) ::= db_optr(Z) ctime(X). { Y = Z; Y.commitTime = strtol(X.z, NULL, 10); }
db_optr(Y) ::= db_optr(Z) ctime(X). { Y = Z; Y.commitTime = strtol(X.z, NULL, 10); }
db_optr(Y) ::= db_optr(Z) wal(X). { Y = Z; Y.walLevel = strtol(X.z, NULL, 10); }
db_optr(Y) ::= db_optr(Z) wal(X). { Y = Z; Y.walLevel = strtol(X.z, NULL, 10); }
db_optr(Y) ::= db_optr(Z) fsync(X). { Y = Z; Y.fsyncPeriod = strtol(X.z, NULL, 10); }
db_optr(Y) ::= db_optr(Z) comp(X). { Y = Z; Y.compressionLevel = strtol(X.z, NULL, 10); }
db_optr(Y) ::= db_optr(Z) comp(X). { Y = Z; Y.compressionLevel = strtol(X.z, NULL, 10); }
db_optr(Y) ::= db_optr(Z) prec(X). { Y = Z; Y.precision = X; }
db_optr(Y) ::= db_optr(Z) prec(X). { Y = Z; Y.precision = X; }
db_optr(Y) ::= db_optr(Z) keep(X). { Y = Z; Y.keep = X; }
db_optr(Y) ::= db_optr(Z) keep(X). { Y = Z; Y.keep = X; }
...
@@ -249,6 +251,7 @@ alter_db_optr(Y) ::= alter_db_optr(Z) keep(X). { Y = Z; Y.keep = X; }
...
@@ -249,6 +251,7 @@ alter_db_optr(Y) ::= alter_db_optr(Z) keep(X). { Y = Z; Y.keep = X; }
alter_db_optr(Y) ::= alter_db_optr(Z) blocks(X). { Y = Z; Y.numOfBlocks = strtol(X.z, NULL, 10); }
alter_db_optr(Y) ::= alter_db_optr(Z) blocks(X). { Y = Z; Y.numOfBlocks = strtol(X.z, NULL, 10); }
alter_db_optr(Y) ::= alter_db_optr(Z) comp(X). { Y = Z; Y.compressionLevel = strtol(X.z, NULL, 10); }
alter_db_optr(Y) ::= alter_db_optr(Z) comp(X). { Y = Z; Y.compressionLevel = strtol(X.z, NULL, 10); }
alter_db_optr(Y) ::= alter_db_optr(Z) wal(X). { Y = Z; Y.walLevel = strtol(X.z, NULL, 10); }
alter_db_optr(Y) ::= alter_db_optr(Z) wal(X). { Y = Z; Y.walLevel = strtol(X.z, NULL, 10); }
alter_db_optr(Y) ::= alter_db_optr(Z) fsync(X). { Y = Z; Y.fsyncPeriod = strtod(X.z, NULL, 10); }
%type typename {TAOS_FIELD}
%type typename {TAOS_FIELD}
typename(A) ::= ids(X). {
typename(A) ::= ids(X). {
...
...
src/query/src/qExecutor.c
浏览文件 @
a3714edf
...
@@ -2202,7 +2202,13 @@ static int64_t doScanAllDataBlocks(SQueryRuntimeEnv *pRuntimeEnv) {
...
@@ -2202,7 +2202,13 @@ static int64_t doScanAllDataBlocks(SQueryRuntimeEnv *pRuntimeEnv) {
int32_t
step
=
GET_FORWARD_DIRECTION_FACTOR
(
pQuery
->
order
.
order
);
int32_t
step
=
GET_FORWARD_DIRECTION_FACTOR
(
pQuery
->
order
.
order
);
SDataBlockInfo
blockInfo
=
SDATA_BLOCK_INITIALIZER
;
SDataBlockInfo
blockInfo
=
SDATA_BLOCK_INITIALIZER
;
while
(
tsdbNextDataBlock
(
pQueryHandle
))
{
while
(
true
)
{
if
(
!
tsdbNextDataBlock
(
pQueryHandle
))
{
if
(
terrno
!=
TSDB_CODE_SUCCESS
)
{
longjmp
(
pRuntimeEnv
->
env
,
terrno
);
}
break
;
}
summary
->
totalBlocks
+=
1
;
summary
->
totalBlocks
+=
1
;
if
(
IS_QUERY_KILLED
(
GET_QINFO_ADDR
(
pRuntimeEnv
)))
{
if
(
IS_QUERY_KILLED
(
GET_QINFO_ADDR
(
pRuntimeEnv
)))
{
...
@@ -3188,6 +3194,9 @@ static void setEnvBeforeReverseScan(SQueryRuntimeEnv *pRuntimeEnv, SQueryStatusI
...
@@ -3188,6 +3194,9 @@ static void setEnvBeforeReverseScan(SQueryRuntimeEnv *pRuntimeEnv, SQueryStatusI
// add ref for table
// add ref for table
pRuntimeEnv
->
pSecQueryHandle
=
tsdbQueryTables
(
pQInfo
->
tsdb
,
&
cond
,
&
pQInfo
->
tableGroupInfo
,
pQInfo
);
pRuntimeEnv
->
pSecQueryHandle
=
tsdbQueryTables
(
pQInfo
->
tsdb
,
&
cond
,
&
pQInfo
->
tableGroupInfo
,
pQInfo
);
if
(
pRuntimeEnv
->
pSecQueryHandle
==
NULL
)
{
longjmp
(
pRuntimeEnv
->
env
,
terrno
);
}
setQueryStatus
(
pQuery
,
QUERY_NOT_COMPLETED
);
setQueryStatus
(
pQuery
,
QUERY_NOT_COMPLETED
);
switchCtxOrder
(
pRuntimeEnv
);
switchCtxOrder
(
pRuntimeEnv
);
...
@@ -3260,6 +3269,9 @@ void scanOneTableDataBlocks(SQueryRuntimeEnv *pRuntimeEnv, TSKEY start) {
...
@@ -3260,6 +3269,9 @@ void scanOneTableDataBlocks(SQueryRuntimeEnv *pRuntimeEnv, TSKEY start) {
}
}
pRuntimeEnv
->
pSecQueryHandle
=
tsdbQueryTables
(
pQInfo
->
tsdb
,
&
cond
,
&
pQInfo
->
tableGroupInfo
,
pQInfo
);
pRuntimeEnv
->
pSecQueryHandle
=
tsdbQueryTables
(
pQInfo
->
tsdb
,
&
cond
,
&
pQInfo
->
tableGroupInfo
,
pQInfo
);
if
(
pRuntimeEnv
->
pSecQueryHandle
==
NULL
)
{
longjmp
(
pRuntimeEnv
->
env
,
terrno
);
}
pRuntimeEnv
->
windowResInfo
.
curIndex
=
qstatus
.
windowIndex
;
pRuntimeEnv
->
windowResInfo
.
curIndex
=
qstatus
.
windowIndex
;
setQueryStatus
(
pQuery
,
QUERY_NOT_COMPLETED
);
setQueryStatus
(
pQuery
,
QUERY_NOT_COMPLETED
);
...
@@ -3916,7 +3928,14 @@ void skipBlocks(SQueryRuntimeEnv *pRuntimeEnv) {
...
@@ -3916,7 +3928,14 @@ void skipBlocks(SQueryRuntimeEnv *pRuntimeEnv) {
TsdbQueryHandleT
pQueryHandle
=
pRuntimeEnv
->
pQueryHandle
;
TsdbQueryHandleT
pQueryHandle
=
pRuntimeEnv
->
pQueryHandle
;
SDataBlockInfo
blockInfo
=
SDATA_BLOCK_INITIALIZER
;
SDataBlockInfo
blockInfo
=
SDATA_BLOCK_INITIALIZER
;
while
(
tsdbNextDataBlock
(
pQueryHandle
))
{
while
(
true
)
{
if
(
!
tsdbNextDataBlock
(
pQueryHandle
))
{
if
(
terrno
!=
TSDB_CODE_SUCCESS
)
{
longjmp
(
pRuntimeEnv
->
env
,
terrno
);
}
break
;
}
if
(
IS_QUERY_KILLED
(
GET_QINFO_ADDR
(
pRuntimeEnv
)))
{
if
(
IS_QUERY_KILLED
(
GET_QINFO_ADDR
(
pRuntimeEnv
)))
{
finalizeQueryResult
(
pRuntimeEnv
);
// clean up allocated resource during query
finalizeQueryResult
(
pRuntimeEnv
);
// clean up allocated resource during query
longjmp
(
pRuntimeEnv
->
env
,
TSDB_CODE_TSC_QUERY_CANCELLED
);
longjmp
(
pRuntimeEnv
->
env
,
TSDB_CODE_TSC_QUERY_CANCELLED
);
...
@@ -3960,7 +3979,14 @@ static bool skipTimeInterval(SQueryRuntimeEnv *pRuntimeEnv, TSKEY* start) {
...
@@ -3960,7 +3979,14 @@ static bool skipTimeInterval(SQueryRuntimeEnv *pRuntimeEnv, TSKEY* start) {
STableQueryInfo
*
pTableQueryInfo
=
pQuery
->
current
;
STableQueryInfo
*
pTableQueryInfo
=
pQuery
->
current
;
SDataBlockInfo
blockInfo
=
SDATA_BLOCK_INITIALIZER
;
SDataBlockInfo
blockInfo
=
SDATA_BLOCK_INITIALIZER
;
while
(
tsdbNextDataBlock
(
pRuntimeEnv
->
pQueryHandle
))
{
while
(
true
)
{
if
(
!
tsdbNextDataBlock
(
pRuntimeEnv
->
pQueryHandle
))
{
if
(
terrno
!=
TSDB_CODE_SUCCESS
)
{
longjmp
(
pRuntimeEnv
->
env
,
terrno
);
}
break
;
}
tsdbRetrieveDataBlockInfo
(
pRuntimeEnv
->
pQueryHandle
,
&
blockInfo
);
tsdbRetrieveDataBlockInfo
(
pRuntimeEnv
->
pQueryHandle
,
&
blockInfo
);
if
(
QUERY_IS_ASC_QUERY
(
pQuery
))
{
if
(
QUERY_IS_ASC_QUERY
(
pQuery
))
{
...
@@ -4059,16 +4085,16 @@ static bool skipTimeInterval(SQueryRuntimeEnv *pRuntimeEnv, TSKEY* start) {
...
@@ -4059,16 +4085,16 @@ static bool skipTimeInterval(SQueryRuntimeEnv *pRuntimeEnv, TSKEY* start) {
return
true
;
return
true
;
}
}
static
void
setupQueryHandle
(
void
*
tsdb
,
SQInfo
*
pQInfo
,
bool
isSTableQuery
)
{
static
int32_t
setupQueryHandle
(
void
*
tsdb
,
SQInfo
*
pQInfo
,
bool
isSTableQuery
)
{
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
SQuery
*
pQuery
=
pQInfo
->
runtimeEnv
.
pQuery
;
SQuery
*
pQuery
=
pQInfo
->
runtimeEnv
.
pQuery
;
if
(
onlyQueryTags
(
pQuery
))
{
if
(
onlyQueryTags
(
pQuery
))
{
return
;
return
TSDB_CODE_SUCCESS
;
}
}
if
(
isSTableQuery
&&
(
!
QUERY_IS_INTERVAL_QUERY
(
pQuery
))
&&
(
!
isFixedOutputQuery
(
pRuntimeEnv
)))
{
if
(
isSTableQuery
&&
(
!
QUERY_IS_INTERVAL_QUERY
(
pQuery
))
&&
(
!
isFixedOutputQuery
(
pRuntimeEnv
)))
{
return
;
return
TSDB_CODE_SUCCESS
;
}
}
STsdbQueryCond
cond
=
{
STsdbQueryCond
cond
=
{
...
@@ -4090,6 +4116,7 @@ static void setupQueryHandle(void* tsdb, SQInfo* pQInfo, bool isSTableQuery) {
...
@@ -4090,6 +4116,7 @@ static void setupQueryHandle(void* tsdb, SQInfo* pQInfo, bool isSTableQuery) {
cond
.
twindow
=
pCheckInfo
->
win
;
cond
.
twindow
=
pCheckInfo
->
win
;
}
}
terrno
=
TSDB_CODE_SUCCESS
;
if
(
isFirstLastRowQuery
(
pQuery
))
{
if
(
isFirstLastRowQuery
(
pQuery
))
{
pRuntimeEnv
->
pQueryHandle
=
tsdbQueryLastRow
(
tsdb
,
&
cond
,
&
pQInfo
->
tableGroupInfo
,
pQInfo
);
pRuntimeEnv
->
pQueryHandle
=
tsdbQueryLastRow
(
tsdb
,
&
cond
,
&
pQInfo
->
tableGroupInfo
,
pQInfo
);
}
else
if
(
isPointInterpoQuery
(
pQuery
))
{
}
else
if
(
isPointInterpoQuery
(
pQuery
))
{
...
@@ -4097,6 +4124,7 @@ static void setupQueryHandle(void* tsdb, SQInfo* pQInfo, bool isSTableQuery) {
...
@@ -4097,6 +4124,7 @@ static void setupQueryHandle(void* tsdb, SQInfo* pQInfo, bool isSTableQuery) {
}
else
{
}
else
{
pRuntimeEnv
->
pQueryHandle
=
tsdbQueryTables
(
tsdb
,
&
cond
,
&
pQInfo
->
tableGroupInfo
,
pQInfo
);
pRuntimeEnv
->
pQueryHandle
=
tsdbQueryTables
(
tsdb
,
&
cond
,
&
pQInfo
->
tableGroupInfo
,
pQInfo
);
}
}
return
terrno
;
}
}
static
SFillColInfo
*
taosCreateFillColInfo
(
SQuery
*
pQuery
)
{
static
SFillColInfo
*
taosCreateFillColInfo
(
SQuery
*
pQuery
)
{
...
@@ -4133,7 +4161,10 @@ int32_t doInitQInfo(SQInfo *pQInfo, STSBuf *pTsBuf, void *tsdb, int32_t vgId, bo
...
@@ -4133,7 +4161,10 @@ int32_t doInitQInfo(SQInfo *pQInfo, STSBuf *pTsBuf, void *tsdb, int32_t vgId, bo
setScanLimitationByResultBuffer
(
pQuery
);
setScanLimitationByResultBuffer
(
pQuery
);
changeExecuteScanOrder
(
pQInfo
,
false
);
changeExecuteScanOrder
(
pQInfo
,
false
);
setupQueryHandle
(
tsdb
,
pQInfo
,
isSTableQuery
);
code
=
setupQueryHandle
(
tsdb
,
pQInfo
,
isSTableQuery
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
pQInfo
->
tsdb
=
tsdb
;
pQInfo
->
tsdb
=
tsdb
;
pQInfo
->
vgId
=
vgId
;
pQInfo
->
vgId
=
vgId
;
...
@@ -4257,7 +4288,14 @@ static int64_t scanMultiTableDataBlocks(SQInfo *pQInfo) {
...
@@ -4257,7 +4288,14 @@ static int64_t scanMultiTableDataBlocks(SQInfo *pQInfo) {
int32_t
step
=
GET_FORWARD_DIRECTION_FACTOR
(
pQuery
->
order
.
order
);
int32_t
step
=
GET_FORWARD_DIRECTION_FACTOR
(
pQuery
->
order
.
order
);
while
(
tsdbNextDataBlock
(
pQueryHandle
))
{
while
(
true
)
{
if
(
!
tsdbNextDataBlock
(
pQueryHandle
))
{
if
(
terrno
!=
TSDB_CODE_SUCCESS
)
{
longjmp
(
pRuntimeEnv
->
env
,
terrno
);
}
break
;
}
summary
->
totalBlocks
+=
1
;
summary
->
totalBlocks
+=
1
;
if
(
IS_QUERY_KILLED
(
pQInfo
))
{
if
(
IS_QUERY_KILLED
(
pQInfo
))
{
...
@@ -4338,6 +4376,9 @@ static bool multiTableMultioutputHelper(SQInfo *pQInfo, int32_t index) {
...
@@ -4338,6 +4376,9 @@ static bool multiTableMultioutputHelper(SQInfo *pQInfo, int32_t index) {
pRuntimeEnv
->
pQueryHandle
=
tsdbQueryTables
(
pQInfo
->
tsdb
,
&
cond
,
&
gp
,
pQInfo
);
pRuntimeEnv
->
pQueryHandle
=
tsdbQueryTables
(
pQInfo
->
tsdb
,
&
cond
,
&
gp
,
pQInfo
);
taosArrayDestroy
(
tx
);
taosArrayDestroy
(
tx
);
taosArrayDestroy
(
g1
);
taosArrayDestroy
(
g1
);
if
(
pRuntimeEnv
->
pQueryHandle
==
NULL
)
{
longjmp
(
pRuntimeEnv
->
env
,
terrno
);
}
if
(
pRuntimeEnv
->
pTSBuf
!=
NULL
)
{
if
(
pRuntimeEnv
->
pTSBuf
!=
NULL
)
{
if
(
pRuntimeEnv
->
cur
.
vgroupIndex
==
-
1
)
{
if
(
pRuntimeEnv
->
cur
.
vgroupIndex
==
-
1
)
{
...
@@ -4405,6 +4446,12 @@ static void sequentialTableProcess(SQInfo *pQInfo) {
...
@@ -4405,6 +4446,12 @@ static void sequentialTableProcess(SQInfo *pQInfo) {
}
else
{
}
else
{
pRuntimeEnv
->
pQueryHandle
=
tsdbQueryRowsInExternalWindow
(
pQInfo
->
tsdb
,
&
cond
,
&
gp
,
pQInfo
);
pRuntimeEnv
->
pQueryHandle
=
tsdbQueryRowsInExternalWindow
(
pQInfo
->
tsdb
,
&
cond
,
&
gp
,
pQInfo
);
}
}
taosArrayDestroy
(
tx
);
taosArrayDestroy
(
g1
);
if
(
pRuntimeEnv
->
pQueryHandle
==
NULL
)
{
longjmp
(
pRuntimeEnv
->
env
,
terrno
);
}
initCtxOutputBuf
(
pRuntimeEnv
);
initCtxOutputBuf
(
pRuntimeEnv
);
...
@@ -4469,6 +4516,9 @@ static void sequentialTableProcess(SQInfo *pQInfo) {
...
@@ -4469,6 +4516,9 @@ static void sequentialTableProcess(SQInfo *pQInfo) {
pRuntimeEnv
->
pQueryHandle
=
tsdbQueryTables
(
pQInfo
->
tsdb
,
&
cond
,
&
gp
,
pQInfo
);
pRuntimeEnv
->
pQueryHandle
=
tsdbQueryTables
(
pQInfo
->
tsdb
,
&
cond
,
&
gp
,
pQInfo
);
taosArrayDestroy
(
g1
);
taosArrayDestroy
(
g1
);
taosArrayDestroy
(
tx
);
taosArrayDestroy
(
tx
);
if
(
pRuntimeEnv
->
pQueryHandle
==
NULL
)
{
longjmp
(
pRuntimeEnv
->
env
,
terrno
);
}
SArray
*
s
=
tsdbGetQueriedTableList
(
pRuntimeEnv
->
pQueryHandle
);
SArray
*
s
=
tsdbGetQueriedTableList
(
pRuntimeEnv
->
pQueryHandle
);
assert
(
taosArrayGetSize
(
s
)
>=
1
);
assert
(
taosArrayGetSize
(
s
)
>=
1
);
...
@@ -4664,6 +4714,9 @@ static void doSaveContext(SQInfo *pQInfo) {
...
@@ -4664,6 +4714,9 @@ static void doSaveContext(SQInfo *pQInfo) {
pRuntimeEnv
->
prevGroupId
=
INT32_MIN
;
pRuntimeEnv
->
prevGroupId
=
INT32_MIN
;
pRuntimeEnv
->
pSecQueryHandle
=
tsdbQueryTables
(
pQInfo
->
tsdb
,
&
cond
,
&
pQInfo
->
tableGroupInfo
,
pQInfo
);
pRuntimeEnv
->
pSecQueryHandle
=
tsdbQueryTables
(
pQInfo
->
tsdb
,
&
cond
,
&
pQInfo
->
tableGroupInfo
,
pQInfo
);
if
(
pRuntimeEnv
->
pSecQueryHandle
==
NULL
)
{
longjmp
(
pRuntimeEnv
->
env
,
terrno
);
}
setQueryStatus
(
pQuery
,
QUERY_NOT_COMPLETED
);
setQueryStatus
(
pQuery
,
QUERY_NOT_COMPLETED
);
switchCtxOrder
(
pRuntimeEnv
);
switchCtxOrder
(
pRuntimeEnv
);
...
...
src/query/src/qparserImpl.c
浏览文件 @
a3714edf
...
@@ -896,6 +896,7 @@ void setDefaultCreateDbOption(SCreateDBInfo *pDBInfo) {
...
@@ -896,6 +896,7 @@ void setDefaultCreateDbOption(SCreateDBInfo *pDBInfo) {
pDBInfo
->
compressionLevel
=
-
1
;
pDBInfo
->
compressionLevel
=
-
1
;
pDBInfo
->
walLevel
=
-
1
;
pDBInfo
->
walLevel
=
-
1
;
pDBInfo
->
fsyncPeriod
=
-
1
;
pDBInfo
->
commitTime
=
-
1
;
pDBInfo
->
commitTime
=
-
1
;
pDBInfo
->
maxTablesPerVnode
=
-
1
;
pDBInfo
->
maxTablesPerVnode
=
-
1
;
...
...
src/query/src/qtokenizer.c
浏览文件 @
a3714edf
...
@@ -124,6 +124,7 @@ static SKeyword keywordTable[] = {
...
@@ -124,6 +124,7 @@ static SKeyword keywordTable[] = {
{
"CACHE"
,
TK_CACHE
},
{
"CACHE"
,
TK_CACHE
},
{
"CTIME"
,
TK_CTIME
},
{
"CTIME"
,
TK_CTIME
},
{
"WAL"
,
TK_WAL
},
{
"WAL"
,
TK_WAL
},
{
"FSYNC"
,
TK_FSYNC
},
{
"COMP"
,
TK_COMP
},
{
"COMP"
,
TK_COMP
},
{
"PRECISION"
,
TK_PRECISION
},
{
"PRECISION"
,
TK_PRECISION
},
{
"LP"
,
TK_LP
},
{
"LP"
,
TK_LP
},
...
...
src/query/src/sql.c
浏览文件 @
a3714edf
...
@@ -25,11 +25,11 @@
...
@@ -25,11 +25,11 @@
#include <stdio.h>
#include <stdio.h>
/************ Begin %include sections from the grammar ************************/
/************ Begin %include sections from the grammar ************************/
#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include <assert.h>
#include <stdbool.h>
#include "qsqlparser.h"
#include "qsqlparser.h"
#include "tcmdtype.h"
#include "tcmdtype.h"
#include "tstoken.h"
#include "tstoken.h"
...
@@ -97,26 +97,26 @@
...
@@ -97,26 +97,26 @@
#endif
#endif
/************* Begin control #defines *****************************************/
/************* Begin control #defines *****************************************/
#define YYCODETYPE unsigned short int
#define YYCODETYPE unsigned short int
#define YYNOCODE 27
0
#define YYNOCODE 27
2
#define YYACTIONTYPE unsigned short int
#define YYACTIONTYPE unsigned short int
#define ParseTOKENTYPE SSQLToken
#define ParseTOKENTYPE SSQLToken
typedef
union
{
typedef
union
{
int
yyinit
;
int
yyinit
;
ParseTOKENTYPE
yy0
;
ParseTOKENTYPE
yy0
;
int
yy150
;
SSubclauseInfo
*
yy25
;
SQuerySQL
*
yy190
;
tSQLExpr
*
yy66
;
SCreateAcctSQL
yy
219
;
SCreateAcctSQL
yy
73
;
tSQLExprList
*
yy260
;
int
yy82
;
S
SubclauseInfo
*
yy263
;
S
QuerySQL
*
yy150
;
int64_t
yy279
;
SCreateDBInfo
yy158
;
SLimitVal
yy284
;
TAOS_FIELD
yy181
;
tVariantList
*
yy322
;
SLimitVal
yy188
;
TAOS_FIELD
yy325
;
tSQLExprList
*
yy224
;
tFieldList
*
yy369
;
int64_t
yy271
;
SCreateDBInfo
yy374
;
tVariant
yy312
;
SCreateTableSQL
*
yy
408
;
SCreateTableSQL
*
yy
374
;
t
SQLExpr
*
yy500
;
t
FieldList
*
yy449
;
tVariant
yy518
;
tVariant
List
*
yy494
;
}
YYMINORTYPE
;
}
YYMINORTYPE
;
#ifndef YYSTACKDEPTH
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
#define YYSTACKDEPTH 100
...
@@ -126,17 +126,17 @@ typedef union {
...
@@ -126,17 +126,17 @@ typedef union {
#define ParseARG_FETCH SSqlInfo* pInfo = yypParser->pInfo
#define ParseARG_FETCH SSqlInfo* pInfo = yypParser->pInfo
#define ParseARG_STORE yypParser->pInfo = pInfo
#define ParseARG_STORE yypParser->pInfo = pInfo
#define YYFALLBACK 1
#define YYFALLBACK 1
#define YYNSTATE 24
1
#define YYNSTATE 24
2
#define YYNRULE 22
0
#define YYNRULE 22
3
#define YYNTOKEN 20
5
#define YYNTOKEN 20
6
#define YY_MAX_SHIFT 24
0
#define YY_MAX_SHIFT 24
1
#define YY_MIN_SHIFTREDUCE
397
#define YY_MIN_SHIFTREDUCE
401
#define YY_MAX_SHIFTREDUCE 6
16
#define YY_MAX_SHIFTREDUCE 6
23
#define YY_ERROR_ACTION 6
17
#define YY_ERROR_ACTION 6
24
#define YY_ACCEPT_ACTION 6
18
#define YY_ACCEPT_ACTION 6
25
#define YY_NO_ACTION 6
19
#define YY_NO_ACTION 6
26
#define YY_MIN_REDUCE 62
0
#define YY_MIN_REDUCE 62
7
#define YY_MAX_REDUCE 8
3
9
#define YY_MAX_REDUCE 8
4
9
/************* End control #defines *******************************************/
/************* End control #defines *******************************************/
/* Define the yytestcase() macro to be a no-op if is not already defined
/* Define the yytestcase() macro to be a no-op if is not already defined
...
@@ -202,216 +202,217 @@ typedef union {
...
@@ -202,216 +202,217 @@ typedef union {
** yy_default[] Default action for each state.
** yy_default[] Default action for each state.
**
**
*********** Begin parsing tables **********************************************/
*********** Begin parsing tables **********************************************/
#define YY_ACTTAB_COUNT (54
1
)
#define YY_ACTTAB_COUNT (54
7
)
static
const
YYACTIONTYPE
yy_action
[]
=
{
static
const
YYACTIONTYPE
yy_action
[]
=
{
/* 0 */
7
18
,
438
,
717
,
11
,
716
,
134
,
618
,
240
,
719
,
439
,
/* 0 */
7
27
,
442
,
726
,
11
,
725
,
625
,
241
,
508
,
728
,
443
,
/* 10 */
7
21
,
720
,
758
,
41
,
43
,
21
,
35
,
36
,
153
,
238
,
/* 10 */
7
30
,
731
,
729
,
41
,
43
,
524
,
35
,
36
,
521
,
134
,
/* 20 */
135
,
29
,
135
,
438
,
197
,
39
,
37
,
40
,
38
,
158
,
/* 20 */
522
,
29
,
523
,
442
,
197
,
39
,
37
,
40
,
38
,
153
,
/* 30 */
827
,
439
,
826
,
34
,
33
,
139
,
135
,
32
,
31
,
30
,
/* 30 */
239
,
443
,
219
,
34
,
33
,
217
,
216
,
32
,
31
,
30
,
/* 40 */
41
,
43
,
7
47
,
35
,
36
,
157
,
827
,
166
,
29
,
733
,
/* 40 */
41
,
43
,
7
57
,
35
,
36
,
139
,
170
,
171
,
29
,
135
,
/* 50 */
103
,
197
,
39
,
37
,
40
,
38
,
182
,
21
,
103
,
99
,
/* 50 */
21
,
197
,
39
,
37
,
40
,
38
,
182
,
833
,
158
,
837
,
/* 60 */
34
,
33
,
7
55
,
155
,
32
,
31
,
30
,
398
,
399
,
400
,
/* 60 */
34
,
33
,
7
44
,
768
,
32
,
31
,
30
,
402
,
403
,
404
,
/* 70 */
40
1
,
402
,
403
,
404
,
405
,
406
,
407
,
408
,
409
,
239
,
/* 70 */
40
5
,
406
,
407
,
408
,
409
,
410
,
411
,
412
,
413
,
240
,
/* 80 */
438
,
736
,
41
,
43
,
103
,
35
,
36
,
103
,
439
,
168
,
/* 80 */
41
,
43
,
846
,
35
,
36
,
742
,
60
,
135
,
29
,
135
,
/* 90 */
2
9
,
732
,
21
,
197
,
39
,
37
,
40
,
38
,
32
,
31
,
/* 90 */
2
1
,
197
,
39
,
37
,
40
,
38
,
157
,
837
,
27
,
836
,
/* 100 */
3
0
,
56
,
34
,
33
,
747
,
781
,
32
,
31
,
30
,
43
,
/* 100 */
3
4
,
33
,
56
,
228
,
32
,
31
,
30
,
103
,
43
,
8
,
/* 110 */
185
,
35
,
36
,
782
,
823
,
192
,
29
,
21
,
154
,
197
,
/* 110 */
35
,
36
,
61
,
113
,
765
,
29
,
757
,
525
,
197
,
39
,
/* 120 */
3
9
,
37
,
40
,
38
,
167
,
572
,
733
,
8
,
34
,
33
,
/* 120 */
3
7
,
40
,
38
,
166
,
537
,
743
,
579
,
34
,
33
,
18
,
/* 130 */
61
,
113
,
32
,
31
,
30
,
659
,
35
,
36
,
126
,
59
,
/* 130 */
154
,
32
,
31
,
30
,
16
,
234
,
208
,
233
,
207
,
206
,
/* 140 */
194
,
29
,
58
,
17
,
197
,
39
,
37
,
40
,
38
,
215
,
/* 140 */
205
,
232
,
204
,
231
,
230
,
229
,
203
,
723
,
168
,
711
,
/* 150 */
26
,
733
,
169
,
34
,
33
,
214
,
213
,
32
,
31
,
30
,
/* 150 */
712
,
713
,
714
,
715
,
716
,
717
,
718
,
719
,
720
,
721
,
/* 160 */
16
,
233
,
208
,
232
,
207
,
206
,
205
,
231
,
204
,
230
,
/* 160 */
722
,
35
,
36
,
792
,
103
,
192
,
29
,
175
,
155
,
197
,
/* 170 */
229
,
203
,
714
,
219
,
703
,
704
,
705
,
706
,
707
,
708
,
/* 170 */
39
,
37
,
40
,
38
,
179
,
178
,
21
,
581
,
34
,
33
,
/* 180 */
709
,
710
,
711
,
712
,
713
,
162
,
585
,
50
,
60
,
576
,
/* 180 */
442
,
12
,
32
,
31
,
30
,
162
,
592
,
746
,
443
,
583
,
/* 190 */
175
,
579
,
165
,
582
,
234
,
162
,
585
,
179
,
178
,
576
,
/* 190 */
17
,
586
,
76
,
589
,
103
,
162
,
592
,
26
,
228
,
583
,
/* 200 */
27
,
579
,
734
,
582
,
51
,
162
,
585
,
12
,
98
,
576
,
/* 200 */
148
,
586
,
99
,
589
,
103
,
21
,
88
,
87
,
142
,
167
,
/* 210 */
736
,
579
,
736
,
582
,
228
,
26
,
21
,
159
,
160
,
34
,
/* 210 */
165
,
743
,
169
,
582
,
147
,
214
,
213
,
159
,
160
,
50
,
/* 220 */
33
,
196
,
836
,
32
,
31
,
30
,
148
,
159
,
160
,
7
6
,
/* 220 */
791
,
196
,
74
,
78
,
83
,
86
,
77
,
159
,
160
,
74
6
,
/* 230 */
822
,
533
,
88
,
87
,
142
,
228
,
668
,
159
,
160
,
12
6
,
/* 230 */
235
,
540
,
80
,
162
,
592
,
17
,
51
,
583
,
215
,
58
6
,
/* 240 */
147
,
553
,
554
,
39
,
37
,
40
,
38
,
821
,
220
,
544
,
/* 240 */
743
,
589
,
26
,
39
,
37
,
40
,
38
,
832
,
194
,
746
,
/* 250 */
733
,
34
,
33
,
46
,
501
,
32
,
31
,
30
,
517
,
525
,
/* 250 */
58
,
34
,
33
,
47
,
185
,
32
,
31
,
30
,
666
,
831
,
/* 260 */
17
,
514
,
151
,
515
,
152
,
516
,
184
,
26
,
16
,
233
,
/* 260 */
59
,
126
,
181
,
560
,
561
,
159
,
160
,
16
,
234
,
150
,
/* 270 */
140
,
232
,
237
,
236
,
95
,
231
,
660
,
230
,
229
,
126
,
/* 270 */
233
,
21
,
48
,
585
,
232
,
588
,
231
,
230
,
229
,
34
,
/* 280 */
530
,
42
,
217
,
216
,
578
,
18
,
581
,
181
,
161
,
170
,
/* 280 */
33
,
745
,
42
,
32
,
31
,
30
,
116
,
117
,
68
,
64
,
/* 290 */
171
,
42
,
584
,
577
,
150
,
580
,
74
,
78
,
83
,
86
,
/* 290 */
67
,
151
,
42
,
591
,
32
,
31
,
30
,
130
,
128
,
91
,
/* 300 */
77
,
42
,
584
,
574
,
545
,
602
,
80
,
583
,
14
,
13
,
/* 300 */
90
,
89
,
675
,
591
,
220
,
126
,
743
,
98
,
590
,
238
,
/* 310 */
141
,
586
,
584
,
143
,
507
,
13
,
47
,
583
,
46
,
73
,
/* 310 */
237
,
95
,
667
,
152
,
26
,
126
,
532
,
584
,
590
,
587
,
/* 320 */
72
,
116
,
117
,
68
,
64
,
67
,
3
,
583
,
130
,
128
,
/* 320 */
551
,
161
,
552
,
184
,
46
,
609
,
14
,
593
,
514
,
13
,
/* 330 */
91
,
90
,
89
,
506
,
201
,
48
,
144
,
22
,
22
,
575
,
/* 330 */
42
,
13
,
46
,
513
,
201
,
73
,
72
,
22
,
22
,
10
,
/* 340 */
521
,
519
,
522
,
520
,
10
,
9
,
85
,
84
,
145
,
146
,
/* 340 */
9
,
591
,
528
,
526
,
529
,
527
,
85
,
84
,
802
,
140
,
/* 350 */
1
37
,
133
,
138
,
735
,
136
,
792
,
791
,
163
,
788
,
518
,
/* 350 */
1
41
,
143
,
801
,
144
,
163
,
145
,
590
,
146
,
798
,
137
,
/* 360 */
787
,
164
,
757
,
727
,
218
,
100
,
749
,
774
,
773
,
114
,
/* 360 */
3
,
133
,
138
,
136
,
797
,
164
,
759
,
737
,
218
,
767
,
/* 370 */
26
,
115
,
112
,
670
,
202
,
131
,
24
,
211
,
667
,
212
,
/* 370 */
100
,
784
,
783
,
114
,
112
,
115
,
677
,
202
,
131
,
24
,
/* 380 */
835
,
70
,
834
,
832
,
118
,
688
,
25
,
183
,
23
,
132
,
/* 380 */
211
,
674
,
212
,
845
,
70
,
844
,
26
,
842
,
118
,
93
,
/* 390 */
6
57
,
79
,
93
,
540
,
655
,
186
,
81
,
82
,
653
,
652
,
/* 390 */
6
95
,
25
,
547
,
23
,
186
,
132
,
664
,
79
,
662
,
81
,
/* 400 */
172
,
190
,
127
,
746
,
650
,
649
,
648
,
647
,
646
,
638
,
/* 400 */
82
,
660
,
659
,
172
,
190
,
127
,
657
,
656
,
655
,
654
,
/* 410 */
129
,
644
,
642
,
52
,
640
,
44
,
49
,
195
,
761
,
762
,
/* 410 */
653
,
645
,
129
,
651
,
649
,
647
,
52
,
49
,
756
,
771
,
/* 420 */
775
,
191
,
193
,
189
,
187
,
28
,
210
,
75
,
221
,
222
,
/* 420 */
104
,
772
,
44
,
785
,
195
,
193
,
191
,
189
,
187
,
28
,
/* 430 */
2
23
,
224
,
225
,
199
,
226
,
227
,
235
,
53
,
616
,
174
,
/* 430 */
2
10
,
75
,
221
,
222
,
223
,
224
,
225
,
226
,
199
,
227
,
/* 440 */
615
,
149
,
62
,
173
,
65
,
176
,
177
,
614
,
180
,
65
1
,
/* 440 */
236
,
53
,
623
,
174
,
173
,
622
,
62
,
177
,
149
,
62
1
,
/* 450 */
607
,
184
,
92
,
527
,
645
,
541
,
120
,
689
,
121
,
122
,
/* 450 */
183
,
65
,
176
,
614
,
658
,
180
,
92
,
94
,
652
,
121
,
/* 460 */
1
19
,
123
,
125
,
124
,
94
,
104
,
1
,
731
,
105
,
111
,
/* 460 */
1
25
,
534
,
120
,
696
,
741
,
119
,
110
,
107
,
105
,
106
,
/* 470 */
1
08
,
106
,
107
,
109
,
110
,
2
,
55
,
57
,
101
,
156
,
/* 470 */
1
22
,
108
,
123
,
2
,
111
,
109
,
124
,
1
,
184
,
57
,
/* 480 */
188
,
5
,
546
,
102
,
19
,
6
,
587
,
20
,
4
,
15
,
/* 480 */
55
,
548
,
156
,
101
,
188
,
5
,
553
,
102
,
6
,
63
,
/* 490 */
63
,
7
,
198
,
478
,
200
,
475
,
473
,
472
,
471
,
46
9
,
/* 490 */
594
,
19
,
4
,
20
,
15
,
198
,
7
,
200
,
483
,
47
9
,
/* 500 */
4
42
,
209
,
66
,
45
,
69
,
71
,
22
,
503
,
502
,
500
,
/* 500 */
4
77
,
476
,
475
,
473
,
446
,
209
,
66
,
45
,
69
,
71
,
/* 510 */
54
,
463
,
461
,
453
,
459
,
455
,
457
,
451
,
449
,
477
,
/* 510 */
22
,
510
,
509
,
507
,
54
,
467
,
465
,
457
,
463
,
459
,
/* 520 */
4
76
,
474
,
470
,
468
,
46
,
440
,
96
,
413
,
411
,
620
,
/* 520 */
4
61
,
455
,
453
,
482
,
481
,
480
,
478
,
474
,
472
,
46
,
/* 530 */
619
,
619
,
619
,
619
,
619
,
619
,
619
,
619
,
619
,
619
,
/* 530 */
444
,
417
,
415
,
627
,
626
,
626
,
626
,
626
,
626
,
626
,
/* 540 */
97
,
/* 540 */
626
,
626
,
626
,
626
,
626
,
96
,
97
,
};
};
static
const
YYCODETYPE
yy_lookahead
[]
=
{
static
const
YYCODETYPE
yy_lookahead
[]
=
{
/* 0 */
22
5
,
1
,
227
,
258
,
229
,
258
,
206
,
207
,
233
,
9
,
/* 0 */
22
6
,
1
,
228
,
260
,
230
,
207
,
208
,
5
,
234
,
9
,
/* 10 */
23
5
,
236
,
209
,
13
,
14
,
209
,
16
,
17
,
208
,
209
,
/* 10 */
23
6
,
237
,
238
,
13
,
14
,
2
,
16
,
17
,
5
,
260
,
/* 20 */
258
,
21
,
258
,
1
,
24
,
25
,
26
,
27
,
28
,
267
,
/* 20 */
7
,
21
,
9
,
1
,
24
,
25
,
26
,
27
,
28
,
209
,
/* 30 */
2
68
,
9
,
268
,
33
,
34
,
258
,
258
,
37
,
38
,
39
,
/* 30 */
2
10
,
9
,
210
,
33
,
34
,
33
,
34
,
37
,
38
,
39
,
/* 40 */
13
,
14
,
24
2
,
16
,
17
,
267
,
268
,
241
,
21
,
243
,
/* 40 */
13
,
14
,
24
4
,
16
,
17
,
260
,
33
,
34
,
21
,
260
,
/* 50 */
2
09
,
24
,
25
,
26
,
27
,
28
,
256
,
209
,
209
,
209
,
/* 50 */
2
10
,
24
,
25
,
26
,
27
,
28
,
258
,
260
,
269
,
270
,
/* 60 */
33
,
34
,
2
59
,
226
,
37
,
38
,
39
,
45
,
46
,
47
,
/* 60 */
33
,
34
,
2
40
,
210
,
37
,
38
,
39
,
45
,
46
,
47
,
/* 70 */
48
,
49
,
50
,
51
,
52
,
53
,
54
,
55
,
56
,
57
,
/* 70 */
48
,
49
,
50
,
51
,
52
,
53
,
54
,
55
,
56
,
57
,
/* 80 */
1
,
244
,
13
,
14
,
209
,
16
,
17
,
209
,
9
,
63
,
/* 80 */
13
,
14
,
246
,
16
,
17
,
245
,
247
,
260
,
21
,
260
,
/* 90 */
21
,
243
,
209
,
24
,
25
,
26
,
27
,
28
,
37
,
38
,
/* 90 */
210
,
24
,
25
,
26
,
27
,
28
,
269
,
270
,
259
,
270
,
/* 100 */
39
,
101
,
33
,
34
,
242
,
264
,
37
,
38
,
39
,
14
,
/* 100 */
33
,
34
,
102
,
78
,
37
,
38
,
39
,
210
,
14
,
98
,
/* 110 */
260
,
16
,
17
,
264
,
258
,
266
,
21
,
209
,
256
,
24
,
/* 110 */
16
,
17
,
101
,
102
,
261
,
21
,
244
,
104
,
24
,
25
,
/* 120 */
25
,
26
,
27
,
28
,
241
,
98
,
243
,
97
,
33
,
34
,
/* 120 */
26
,
27
,
28
,
243
,
103
,
245
,
99
,
33
,
34
,
108
,
/* 130 */
100
,
101
,
37
,
38
,
39
,
213
,
16
,
17
,
216
,
264
,
/* 130 */
258
,
37
,
38
,
39
,
85
,
86
,
87
,
88
,
89
,
90
,
/* 140 */
262
,
21
,
264
,
97
,
24
,
25
,
26
,
27
,
28
,
241
,
/* 140 */
91
,
92
,
93
,
94
,
95
,
96
,
97
,
226
,
63
,
228
,
/* 150 */
104
,
243
,
126
,
33
,
34
,
129
,
130
,
37
,
38
,
39
,
/* 150 */
229
,
230
,
231
,
232
,
233
,
234
,
235
,
236
,
237
,
238
,
/* 160 */
85
,
86
,
87
,
88
,
89
,
90
,
91
,
92
,
93
,
94
,
/* 160 */
239
,
16
,
17
,
266
,
210
,
268
,
21
,
126
,
227
,
24
,
/* 170 */
95
,
96
,
225
,
209
,
227
,
228
,
229
,
230
,
231
,
232
,
/* 170 */
25
,
26
,
27
,
28
,
133
,
134
,
210
,
1
,
33
,
34
,
/* 180 */
233
,
234
,
235
,
236
,
237
,
1
,
2
,
102
,
245
,
5
,
/* 180 */
1
,
44
,
37
,
38
,
39
,
1
,
2
,
246
,
9
,
5
,
/* 190 */
125
,
7
,
226
,
9
,
226
,
1
,
2
,
132
,
133
,
5
,
/* 190 */
98
,
7
,
72
,
9
,
210
,
1
,
2
,
105
,
78
,
5
,
/* 200 */
257
,
7
,
238
,
9
,
119
,
1
,
2
,
44
,
97
,
5
,
/* 200 */
63
,
7
,
210
,
9
,
210
,
210
,
69
,
70
,
71
,
243
,
/* 210 */
244
,
7
,
244
,
9
,
78
,
104
,
209
,
33
,
34
,
33
,
/* 210 */
227
,
245
,
127
,
37
,
77
,
130
,
131
,
33
,
34
,
103
,
/* 220 */
34
,
37
,
244
,
37
,
38
,
39
,
63
,
33
,
34
,
72
,
/* 220 */
266
,
37
,
64
,
65
,
66
,
67
,
68
,
33
,
34
,
246
,
/* 230 */
258
,
37
,
69
,
70
,
71
,
78
,
213
,
33
,
34
,
216
,
/* 230 */
227
,
37
,
74
,
1
,
2
,
98
,
120
,
5
,
243
,
7
,
/* 240 */
77
,
114
,
115
,
25
,
26
,
27
,
28
,
258
,
241
,
98
,
/* 240 */
245
,
9
,
105
,
25
,
26
,
27
,
28
,
260
,
264
,
246
,
/* 250 */
243
,
33
,
34
,
102
,
5
,
37
,
38
,
39
,
2
,
98
,
/* 250 */
266
,
33
,
34
,
103
,
262
,
37
,
38
,
39
,
214
,
260
,
/* 260 */
97
,
5
,
258
,
7
,
258
,
9
,
105
,
104
,
85
,
86
,
/* 260 */
266
,
217
,
125
,
115
,
116
,
33
,
34
,
85
,
86
,
132
,
/* 270 */
258
,
88
,
60
,
61
,
62
,
92
,
213
,
94
,
95
,
216
,
/* 270 */
88
,
210
,
122
,
5
,
92
,
7
,
94
,
95
,
96
,
33
,
/* 280 */
102
,
97
,
33
,
34
,
5
,
107
,
7
,
124
,
59
,
33
,
/* 280 */
34
,
246
,
98
,
37
,
38
,
39
,
64
,
65
,
66
,
67
,
/* 290 */
34
,
97
,
108
,
5
,
131
,
7
,
64
,
65
,
66
,
67
,
/* 290 */
68
,
260
,
98
,
109
,
37
,
38
,
39
,
64
,
65
,
66
,
/* 300 */
68
,
97
,
108
,
1
,
98
,
98
,
74
,
123
,
102
,
102
,
/* 300 */
67
,
68
,
214
,
109
,
243
,
217
,
245
,
98
,
124
,
60
,
/* 310 */
258
,
98
,
108
,
258
,
98
,
102
,
102
,
123
,
102
,
127
,
/* 310 */
61
,
62
,
214
,
260
,
105
,
217
,
99
,
5
,
124
,
7
,
/* 320 */
128
,
64
,
65
,
66
,
67
,
68
,
97
,
123
,
64
,
65
,
/* 320 */
99
,
59
,
99
,
106
,
103
,
99
,
103
,
99
,
99
,
103
,
/* 330 */
66
,
67
,
68
,
98
,
98
,
121
,
258
,
102
,
102
,
37
,
/* 330 */
98
,
103
,
103
,
99
,
99
,
128
,
129
,
103
,
103
,
128
,
/* 340 */
5
,
5
,
7
,
7
,
127
,
128
,
72
,
73
,
258
,
258
,
/* 340 */
129
,
109
,
5
,
5
,
7
,
7
,
72
,
73
,
241
,
260
,
/* 350 */
258
,
258
,
258
,
244
,
258
,
239
,
239
,
239
,
239
,
103
,
/* 350 */
260
,
260
,
241
,
260
,
241
,
260
,
124
,
260
,
241
,
260
,
/* 360 */
239
,
239
,
209
,
240
,
239
,
209
,
242
,
265
,
265
,
209
,
/* 360 */
98
,
260
,
260
,
260
,
241
,
241
,
244
,
242
,
241
,
210
,
/* 370 */
104
,
209
,
246
,
209
,
209
,
209
,
209
,
209
,
209
,
209
,
/* 370 */
210
,
267
,
267
,
210
,
248
,
210
,
210
,
210
,
210
,
210
,
/* 380 */
209
,
209
,
209
,
209
,
209
,
209
,
209
,
242
,
209
,
209
,
/* 380 */
210
,
210
,
210
,
210
,
210
,
210
,
105
,
210
,
210
,
59
,
/* 390 */
209
,
209
,
59
,
108
,
209
,
261
,
209
,
209
,
209
,
209
,
/* 390 */
210
,
210
,
109
,
210
,
263
,
210
,
210
,
210
,
210
,
210
,
/* 400 */
209
,
261
,
209
,
255
,
209
,
209
,
209
,
209
,
209
,
209
,
/* 400 */
210
,
210
,
210
,
210
,
263
,
210
,
210
,
210
,
210
,
210
,
/* 410 */
209
,
209
,
209
,
118
,
209
,
117
,
120
,
112
,
210
,
210
,
/* 410 */
210
,
210
,
210
,
210
,
210
,
210
,
119
,
121
,
257
,
211
,
/* 420 */
210
,
111
,
116
,
110
,
109
,
122
,
75
,
84
,
83
,
49
,
/* 420 */
256
,
211
,
118
,
211
,
113
,
117
,
112
,
111
,
110
,
123
,
/* 430 */
80
,
82
,
53
,
210
,
81
,
79
,
75
,
210
,
5
,
5
,
/* 430 */
75
,
84
,
83
,
49
,
80
,
82
,
53
,
81
,
211
,
79
,
/* 440 */
5
,
210
,
214
,
134
,
214
,
134
,
5
,
5
,
125
,
210
,
/* 440 */
75
,
211
,
5
,
5
,
135
,
5
,
215
,
5
,
211
,
5
,
/* 450 */
87
,
105
,
211
,
98
,
210
,
98
,
222
,
224
,
218
,
221
,
/* 450 */
244
,
215
,
135
,
87
,
211
,
126
,
212
,
212
,
211
,
219
,
/* 460 */
223
,
219
,
217
,
220
,
211
,
254
,
215
,
242
,
253
,
247
,
/* 460 */
218
,
99
,
223
,
225
,
244
,
224
,
250
,
253
,
255
,
254
,
/* 470 */
250
,
252
,
251
,
249
,
248
,
212
,
106
,
102
,
97
,
1
,
/* 470 */
222
,
252
,
220
,
213
,
249
,
251
,
221
,
216
,
106
,
103
,
/* 480 */
97
,
113
,
98
,
97
,
102
,
113
,
98
,
102
,
97
,
97
,
/* 480 */
107
,
99
,
1
,
98
,
98
,
114
,
99
,
98
,
114
,
72
,
/* 490 */
72
,
97
,
99
,
9
,
99
,
5
,
5
,
5
,
5
,
5
,
/* 490 */
99
,
103
,
98
,
103
,
98
,
100
,
98
,
100
,
9
,
5
,
/* 500 */
76
,
15
,
72
,
16
,
128
,
128
,
102
,
5
,
5
,
98
,
/* 500 */
5
,
5
,
5
,
5
,
76
,
15
,
72
,
16
,
129
,
129
,
/* 510 */
97
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
/* 510 */
103
,
5
,
5
,
99
,
98
,
5
,
5
,
5
,
5
,
5
,
/* 520 */
5
,
5
,
5
,
5
,
102
,
76
,
21
,
59
,
58
,
0
,
/* 520 */
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
103
,
/* 530 */
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
/* 530 */
76
,
59
,
58
,
0
,
271
,
271
,
271
,
271
,
271
,
271
,
/* 540 */
21
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
/* 540 */
271
,
271
,
271
,
271
,
271
,
21
,
21
,
271
,
271
,
271
,
/* 550 */
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
/* 550 */
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
/* 560 */
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
/* 560 */
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
/* 570 */
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
/* 570 */
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
/* 580 */
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
/* 580 */
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
/* 590 */
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
/* 590 */
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
/* 600 */
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
/* 600 */
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
/* 610 */
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
/* 610 */
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
/* 620 */
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
/* 620 */
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
/* 630 */
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
/* 630 */
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
/* 640 */
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
/* 640 */
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
/* 650 */
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
/* 650 */
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
/* 660 */
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
/* 660 */
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
/* 670 */
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
/* 670 */
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
/* 680 */
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
/* 680 */
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
/* 690 */
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
/* 690 */
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
/* 700 */
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
/* 700 */
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
/* 710 */
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
/* 710 */
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
/* 720 */
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
/* 720 */
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
/* 730 */
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
269
,
/* 730 */
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
/* 740 */
269
,
269
,
269
,
269
,
269
,
269
,
/* 740 */
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
271
,
/* 750 */
271
,
271
,
271
,
};
};
#define YY_SHIFT_COUNT (24
0
)
#define YY_SHIFT_COUNT (24
1
)
#define YY_SHIFT_MIN (0)
#define YY_SHIFT_MIN (0)
#define YY_SHIFT_MAX (5
29
)
#define YY_SHIFT_MAX (5
33
)
static
const
unsigned
short
int
yy_shift_ofst
[]
=
{
static
const
unsigned
short
int
yy_shift_ofst
[]
=
{
/* 0 */
1
63
,
75
,
183
,
184
,
204
,
79
,
79
,
79
,
79
,
79
,
/* 0 */
1
37
,
49
,
182
,
184
,
232
,
179
,
179
,
179
,
179
,
1
79
,
/* 10 */
79
,
0
,
22
,
204
,
256
,
256
,
256
,
46
,
79
,
79
,
/* 10 */
179
,
0
,
22
,
232
,
13
,
13
,
13
,
92
,
179
,
1
79
,
/* 20 */
79
,
79
,
79
,
157
,
136
,
136
,
541
,
194
,
204
,
204
,
/* 20 */
179
,
179
,
179
,
120
,
25
,
25
,
547
,
194
,
232
,
232
,
/* 30 */
2
04
,
204
,
204
,
204
,
204
,
204
,
204
,
204
,
204
,
204
,
/* 30 */
2
32
,
232
,
232
,
232
,
232
,
232
,
232
,
232
,
232
,
232
,
/* 40 */
2
04
,
204
,
204
,
204
,
204
,
256
,
256
,
249
,
249
,
249
,
/* 40 */
2
32
,
232
,
232
,
232
,
232
,
13
,
13
,
2
,
2
,
2
,
/* 50 */
249
,
249
,
249
,
30
,
249
,
111
,
79
,
79
,
127
,
127
,
/* 50 */
2
,
2
,
2
,
11
,
2
,
209
,
179
,
179
,
148
,
148
,
/* 60 */
178
,
79
,
79
,
79
,
79
,
79
,
79
,
79
,
79
,
79
,
/* 60 */
21
,
179
,
179
,
179
,
179
,
179
,
179
,
179
,
179
,
1
79
,
/* 70 */
79
,
79
,
79
,
79
,
79
,
79
,
79
,
79
,
79
,
79
,
/* 70 */
179
,
179
,
179
,
179
,
179
,
179
,
179
,
179
,
179
,
1
79
,
/* 80 */
79
,
79
,
79
,
79
,
79
,
79
,
79
,
79
,
79
,
79
,
/* 80 */
179
,
179
,
179
,
179
,
179
,
179
,
179
,
179
,
179
,
1
79
,
/* 90 */
79
,
79
,
79
,
79
,
79
,
79
,
79
,
79
,
266
,
333
,
/* 90 */
179
,
179
,
179
,
179
,
179
,
179
,
179
,
179
,
281
,
330
,
/* 100 */
33
3
,
285
,
285
,
333
,
295
,
296
,
298
,
305
,
306
,
310
,
/* 100 */
33
0
,
283
,
283
,
330
,
297
,
296
,
304
,
311
,
308
,
314
,
/* 110 */
31
3
,
315
,
303
,
266
,
333
,
333
,
351
,
351
,
333
,
343
,
/* 110 */
31
6
,
318
,
306
,
281
,
330
,
330
,
355
,
355
,
330
,
347
,
/* 120 */
34
5
,
380
,
350
,
349
,
379
,
353
,
356
,
333
,
361
,
333
,
/* 120 */
34
9
,
384
,
354
,
353
,
383
,
356
,
360
,
330
,
365
,
330
,
/* 130 */
36
1
,
541
,
541
,
27
,
69
,
69
,
69
,
95
,
120
,
218
,
/* 130 */
36
5
,
547
,
547
,
27
,
67
,
67
,
67
,
94
,
145
,
218
,
/* 140 */
218
,
218
,
232
,
186
,
186
,
186
,
186
,
257
,
264
,
26
,
/* 140 */
218
,
218
,
158
,
246
,
246
,
246
,
246
,
222
,
233
,
85
,
/* 150 */
65
,
61
,
61
,
212
,
161
,
151
,
206
,
207
,
213
,
279
,
/* 150 */
41
,
257
,
257
,
249
,
217
,
221
,
223
,
226
,
228
,
268
,
/* 160 */
288
,
302
,
229
,
214
,
85
,
216
,
235
,
236
,
192
,
217
,
/* 160 */
312
,
176
,
262
,
150
,
116
,
229
,
234
,
235
,
207
,
211
,
/* 170 */
33
5
,
336
,
274
,
433
,
309
,
434
,
435
,
311
,
441
,
442
,
/* 170 */
33
7
,
338
,
274
,
437
,
309
,
438
,
440
,
317
,
442
,
444
,
/* 180 */
36
3
,
323
,
346
,
355
,
370
,
375
,
357
,
381
,
478
,
383
,
/* 180 */
36
6
,
329
,
372
,
362
,
373
,
376
,
382
,
385
,
481
,
386
,
/* 190 */
38
4
,
386
,
382
,
368
,
385
,
372
,
388
,
391
,
392
,
393
,
/* 190 */
38
7
,
389
,
388
,
371
,
390
,
374
,
391
,
394
,
396
,
395
,
/* 200 */
39
4
,
395
,
418
,
484
,
490
,
491
,
492
,
493
,
494
,
424
,
/* 200 */
39
8
,
397
,
417
,
489
,
494
,
495
,
496
,
497
,
498
,
428
,
/* 210 */
4
86
,
430
,
487
,
376
,
377
,
404
,
502
,
503
,
411
,
413
,
/* 210 */
4
90
,
434
,
491
,
379
,
380
,
407
,
506
,
507
,
414
,
416
,
/* 220 */
40
4
,
506
,
507
,
508
,
509
,
510
,
511
,
512
,
513
,
514
,
/* 220 */
40
7
,
510
,
511
,
512
,
513
,
514
,
515
,
516
,
517
,
518
,
/* 230 */
51
5
,
516
,
517
,
518
,
422
,
449
,
505
,
519
,
468
,
470
,
/* 230 */
51
9
,
520
,
521
,
522
,
523
,
426
,
454
,
524
,
525
,
472
,
/* 240 */
529
,
/* 240 */
474
,
533
,
};
};
#define YY_REDUCE_COUNT (132)
#define YY_REDUCE_COUNT (132)
#define YY_REDUCE_MIN (-25
5
)
#define YY_REDUCE_MIN (-25
7
)
#define YY_REDUCE_MAX (26
3
)
#define YY_REDUCE_MAX (26
1
)
static
const
short
yy_reduce_ofst
[]
=
{
static
const
short
yy_reduce_ofst
[]
=
{
/* 0 */
-
20
0
,
-
53
,
-
225
,
-
238
,
-
222
,
-
151
,
-
122
,
-
194
,
-
117
,
-
92
,
/* 0 */
-
20
2
,
-
79
,
-
226
,
-
211
,
-
173
,
-
103
,
-
16
,
-
120
,
-
34
,
-
5
,
/* 10 */
7
,
-
197
,
-
190
,
-
236
,
-
163
,
-
34
,
-
32
,
-
138
,
-
150
,
-
159
,
/* 10 */
61
,
-
147
,
-
180
,
-
171
,
-
59
,
-
17
,
3
,
-
128
,
-
8
,
-
46
,
/* 20 */
-
125
,
-
36
,
-
152
,
-
78
,
23
,
63
,
-
57
,
-
255
,
-
253
,
-
223
,
/* 20 */
-
6
,
-
178
,
-
160
,
44
,
88
,
98
,
-
161
,
-
257
,
-
241
,
-
215
,
/* 30 */
-
144
,
-
28
,
-
11
,
4
,
6
,
12
,
52
,
55
,
78
,
90
,
/* 30 */
-
203
,
-
13
,
-
1
,
31
,
53
,
89
,
90
,
91
,
93
,
95
,
/* 40 */
9
1
,
92
,
93
,
94
,
96
,
-
22
,
109
,
116
,
117
,
118
,
/* 40 */
9
7
,
99
,
101
,
102
,
103
,
-
164
,
35
,
107
,
111
,
113
,
/* 50 */
11
9
,
121
,
122
,
123
,
125
,
124
,
153
,
156
,
102
,
103
,
/* 50 */
11
7
,
123
,
124
,
125
,
127
,
122
,
159
,
160
,
104
,
105
,
/* 60 */
126
,
16
0
,
162
,
164
,
165
,
166
,
167
,
168
,
169
,
170
,
/* 60 */
126
,
16
3
,
165
,
166
,
167
,
168
,
169
,
170
,
171
,
172
,
/* 70 */
17
1
,
172
,
173
,
174
,
175
,
176
,
177
,
179
,
180
,
181
,
/* 70 */
17
3
,
174
,
175
,
177
,
178
,
180
,
181
,
183
,
185
,
186
,
/* 80 */
18
2
,
185
,
187
,
188
,
189
,
190
,
191
,
193
,
195
,
196
,
/* 80 */
18
7
,
188
,
189
,
190
,
191
,
192
,
193
,
195
,
196
,
197
,
/* 90 */
19
7
,
198
,
199
,
200
,
201
,
202
,
203
,
205
,
145
,
208
,
/* 90 */
19
8
,
199
,
200
,
201
,
202
,
203
,
204
,
205
,
206
,
208
,
/* 100 */
2
09
,
134
,
140
,
210
,
148
,
211
,
215
,
219
,
221
,
220
,
/* 100 */
2
10
,
131
,
141
,
212
,
161
,
164
,
213
,
215
,
214
,
219
,
/* 110 */
224
,
2
26
,
222
,
225
,
223
,
227
,
228
,
230
,
231
,
233
,
/* 110 */
224
,
2
16
,
225
,
220
,
227
,
230
,
231
,
236
,
237
,
238
,
/* 120 */
2
37
,
234
,
240
,
238
,
242
,
243
,
245
,
239
,
241
,
244
,
/* 120 */
2
41
,
239
,
240
,
248
,
252
,
255
,
242
,
243
,
244
,
247
,
/* 130 */
2
53
,
251
,
263
,
/* 130 */
2
45
,
261
,
260
,
};
};
static
const
YYACTIONTYPE
yy_default
[]
=
{
static
const
YYACTIONTYPE
yy_default
[]
=
{
/* 0 */
6
17
,
669
,
658
,
829
,
829
,
617
,
617
,
617
,
617
,
617
,
/* 0 */
6
24
,
676
,
665
,
839
,
839
,
624
,
624
,
624
,
624
,
624
,
/* 10 */
6
17
,
759
,
635
,
829
,
617
,
617
,
617
,
617
,
617
,
617
,
/* 10 */
6
24
,
769
,
642
,
839
,
624
,
624
,
624
,
624
,
624
,
624
,
/* 20 */
6
17
,
617
,
617
,
671
,
671
,
671
,
754
,
617
,
617
,
617
,
/* 20 */
6
24
,
624
,
624
,
678
,
678
,
678
,
764
,
624
,
624
,
624
,
/* 30 */
6
17
,
617
,
617
,
617
,
617
,
617
,
617
,
617
,
617
,
617
,
/* 30 */
6
24
,
624
,
624
,
624
,
624
,
624
,
624
,
624
,
624
,
624
,
/* 40 */
6
17
,
617
,
617
,
617
,
617
,
617
,
617
,
617
,
617
,
617
,
/* 40 */
6
24
,
624
,
624
,
624
,
624
,
624
,
624
,
624
,
624
,
624
,
/* 50 */
6
17
,
617
,
617
,
617
,
617
,
617
,
617
,
617
,
778
,
77
8
,
/* 50 */
6
24
,
624
,
624
,
624
,
624
,
624
,
624
,
624
,
788
,
78
8
,
/* 60 */
7
52
,
617
,
617
,
617
,
617
,
617
,
617
,
617
,
617
,
617
,
/* 60 */
7
62
,
624
,
624
,
624
,
624
,
624
,
624
,
624
,
624
,
624
,
/* 70 */
6
17
,
617
,
617
,
617
,
617
,
617
,
617
,
617
,
617
,
656
,
/* 70 */
6
24
,
624
,
624
,
624
,
624
,
624
,
624
,
624
,
624
,
663
,
/* 80 */
6
17
,
654
,
617
,
617
,
617
,
617
,
617
,
617
,
617
,
617
,
/* 80 */
6
24
,
661
,
624
,
624
,
624
,
624
,
624
,
624
,
624
,
624
,
/* 90 */
6
17
,
617
,
617
,
617
,
617
,
643
,
617
,
617
,
617
,
637
,
/* 90 */
6
24
,
624
,
624
,
624
,
624
,
650
,
624
,
624
,
624
,
644
,
/* 100 */
6
37
,
617
,
617
,
637
,
785
,
789
,
783
,
771
,
779
,
77
0
,
/* 100 */
6
44
,
624
,
624
,
644
,
795
,
799
,
793
,
781
,
789
,
78
0
,
/* 110 */
7
66
,
765
,
793
,
617
,
637
,
637
,
666
,
666
,
637
,
687
,
/* 110 */
7
76
,
775
,
803
,
624
,
644
,
644
,
673
,
673
,
644
,
694
,
/* 120 */
6
85
,
683
,
675
,
681
,
677
,
679
,
673
,
637
,
664
,
637
,
/* 120 */
6
92
,
690
,
682
,
688
,
684
,
686
,
680
,
644
,
671
,
644
,
/* 130 */
6
64
,
702
,
715
,
617
,
794
,
828
,
784
,
812
,
811
,
82
4
,
/* 130 */
6
71
,
710
,
724
,
624
,
804
,
838
,
794
,
822
,
821
,
83
4
,
/* 140 */
8
18
,
817
,
617
,
816
,
815
,
814
,
813
,
617
,
617
,
617
,
/* 140 */
8
28
,
827
,
624
,
826
,
825
,
824
,
823
,
624
,
624
,
624
,
/* 150 */
6
17
,
820
,
819
,
617
,
617
,
617
,
617
,
617
,
617
,
617
,
/* 150 */
6
24
,
830
,
829
,
624
,
624
,
624
,
624
,
624
,
624
,
624
,
/* 160 */
6
17
,
617
,
796
,
790
,
786
,
617
,
617
,
617
,
617
,
617
,
/* 160 */
6
24
,
624
,
806
,
800
,
796
,
624
,
624
,
624
,
624
,
624
,
/* 170 */
6
17
,
617
,
617
,
617
,
617
,
617
,
617
,
617
,
617
,
617
,
/* 170 */
6
24
,
624
,
624
,
624
,
624
,
624
,
624
,
624
,
624
,
624
,
/* 180 */
6
17
,
617
,
751
,
617
,
617
,
760
,
617
,
617
,
617
,
617
,
/* 180 */
6
24
,
624
,
761
,
624
,
624
,
770
,
624
,
624
,
624
,
624
,
/* 190 */
6
17
,
617
,
780
,
617
,
772
,
617
,
617
,
617
,
617
,
617
,
/* 190 */
6
24
,
624
,
790
,
624
,
782
,
624
,
624
,
624
,
624
,
624
,
/* 200 */
6
17
,
728
,
617
,
617
,
617
,
617
,
617
,
617
,
617
,
617
,
/* 200 */
6
24
,
738
,
624
,
624
,
624
,
624
,
624
,
624
,
624
,
624
,
/* 210 */
6
17
,
617
,
617
,
617
,
617
,
833
,
617
,
617
,
617
,
72
2
,
/* 210 */
6
24
,
624
,
624
,
624
,
624
,
843
,
624
,
624
,
624
,
73
2
,
/* 220 */
8
31
,
617
,
617
,
617
,
617
,
617
,
617
,
617
,
617
,
617
,
/* 220 */
8
41
,
624
,
624
,
624
,
624
,
624
,
624
,
624
,
624
,
624
,
/* 230 */
6
17
,
617
,
617
,
617
,
690
,
617
,
641
,
639
,
617
,
633
,
/* 230 */
6
24
,
624
,
624
,
624
,
624
,
697
,
624
,
648
,
646
,
624
,
/* 240 */
6
17
,
/* 240 */
6
40
,
624
,
};
};
/********** End of lemon-generated parsing tables *****************************/
/********** End of lemon-generated parsing tables *****************************/
...
@@ -526,6 +527,7 @@ static const YYCODETYPE yyFallback[] = {
...
@@ -526,6 +527,7 @@ static const YYCODETYPE yyFallback[] = {
0
,
/* BLOCKS => nothing */
0
,
/* BLOCKS => nothing */
0
,
/* CTIME => nothing */
0
,
/* CTIME => nothing */
0
,
/* WAL => nothing */
0
,
/* WAL => nothing */
0
,
/* FSYNC => nothing */
0
,
/* COMP => nothing */
0
,
/* COMP => nothing */
0
,
/* PRECISION => nothing */
0
,
/* PRECISION => nothing */
0
,
/* LP => nothing */
0
,
/* LP => nothing */
...
@@ -817,180 +819,182 @@ static const char *const yyTokenName[] = {
...
@@ -817,180 +819,182 @@ static const char *const yyTokenName[] = {
/* 92 */
"BLOCKS"
,
/* 92 */
"BLOCKS"
,
/* 93 */
"CTIME"
,
/* 93 */
"CTIME"
,
/* 94 */
"WAL"
,
/* 94 */
"WAL"
,
/* 95 */
"COMP"
,
/* 95 */
"FSYNC"
,
/* 96 */
"PRECISION"
,
/* 96 */
"COMP"
,
/* 97 */
"LP"
,
/* 97 */
"PRECISION"
,
/* 98 */
"RP"
,
/* 98 */
"LP"
,
/* 99 */
"TAGS"
,
/* 99 */
"RP"
,
/* 100 */
"USING"
,
/* 100 */
"TAGS"
,
/* 101 */
"AS"
,
/* 101 */
"USING"
,
/* 102 */
"COMMA"
,
/* 102 */
"AS"
,
/* 103 */
"NULL"
,
/* 103 */
"COMMA"
,
/* 104 */
"SELECT"
,
/* 104 */
"NULL"
,
/* 105 */
"UNION"
,
/* 105 */
"SELECT"
,
/* 106 */
"ALL"
,
/* 106 */
"UNION"
,
/* 107 */
"FROM"
,
/* 107 */
"ALL"
,
/* 108 */
"VARIABLE"
,
/* 108 */
"FROM"
,
/* 109 */
"INTERVAL"
,
/* 109 */
"VARIABLE"
,
/* 110 */
"FILL"
,
/* 110 */
"INTERVAL"
,
/* 111 */
"SLIDING"
,
/* 111 */
"FILL"
,
/* 112 */
"ORDER"
,
/* 112 */
"SLIDING"
,
/* 113 */
"BY"
,
/* 113 */
"ORDER"
,
/* 114 */
"ASC"
,
/* 114 */
"BY"
,
/* 115 */
"DESC"
,
/* 115 */
"ASC"
,
/* 116 */
"GROUP"
,
/* 116 */
"DESC"
,
/* 117 */
"HAVING"
,
/* 117 */
"GROUP"
,
/* 118 */
"LIMIT"
,
/* 118 */
"HAVING"
,
/* 119 */
"OFFSET"
,
/* 119 */
"LIMIT"
,
/* 120 */
"SLIMIT"
,
/* 120 */
"OFFSET"
,
/* 121 */
"SOFFSET"
,
/* 121 */
"SLIMIT"
,
/* 122 */
"WHERE"
,
/* 122 */
"SOFFSET"
,
/* 123 */
"NOW"
,
/* 123 */
"WHERE"
,
/* 124 */
"RESET"
,
/* 124 */
"NOW"
,
/* 125 */
"QUERY"
,
/* 125 */
"RESET"
,
/* 126 */
"ADD"
,
/* 126 */
"QUERY"
,
/* 127 */
"COLUMN"
,
/* 127 */
"ADD"
,
/* 128 */
"TAG"
,
/* 128 */
"COLUMN"
,
/* 129 */
"CHANGE"
,
/* 129 */
"TAG"
,
/* 130 */
"SET"
,
/* 130 */
"CHANGE"
,
/* 131 */
"KILL"
,
/* 131 */
"SET"
,
/* 132 */
"CONNECTION"
,
/* 132 */
"KILL"
,
/* 133 */
"STREAM"
,
/* 133 */
"CONNECTION"
,
/* 134 */
"COLON"
,
/* 134 */
"STREAM"
,
/* 135 */
"ABORT"
,
/* 135 */
"COLON"
,
/* 136 */
"AFTER"
,
/* 136 */
"ABORT"
,
/* 137 */
"ATTACH"
,
/* 137 */
"AFTER"
,
/* 138 */
"BEFORE"
,
/* 138 */
"ATTACH"
,
/* 139 */
"BEGIN"
,
/* 139 */
"BEFORE"
,
/* 140 */
"CASCADE"
,
/* 140 */
"BEGIN"
,
/* 141 */
"CLUSTER"
,
/* 141 */
"CASCADE"
,
/* 142 */
"CONFLICT"
,
/* 142 */
"CLUSTER"
,
/* 143 */
"COPY"
,
/* 143 */
"CONFLICT"
,
/* 144 */
"DEFERRED"
,
/* 144 */
"COPY"
,
/* 145 */
"DELIMITERS"
,
/* 145 */
"DEFERRED"
,
/* 146 */
"DETACH"
,
/* 146 */
"DELIMITERS"
,
/* 147 */
"EACH"
,
/* 147 */
"DETACH"
,
/* 148 */
"END"
,
/* 148 */
"EACH"
,
/* 149 */
"EXPLAIN"
,
/* 149 */
"END"
,
/* 150 */
"FAIL"
,
/* 150 */
"EXPLAIN"
,
/* 151 */
"FOR"
,
/* 151 */
"FAIL"
,
/* 152 */
"IGNORE"
,
/* 152 */
"FOR"
,
/* 153 */
"IMMEDIATE"
,
/* 153 */
"IGNORE"
,
/* 154 */
"INITIALLY"
,
/* 154 */
"IMMEDIATE"
,
/* 155 */
"INSTEAD"
,
/* 155 */
"INITIALLY"
,
/* 156 */
"MATCH"
,
/* 156 */
"INSTEAD"
,
/* 157 */
"KEY"
,
/* 157 */
"MATCH"
,
/* 158 */
"OF"
,
/* 158 */
"KEY"
,
/* 159 */
"RAISE"
,
/* 159 */
"OF"
,
/* 160 */
"REPLACE"
,
/* 160 */
"RAISE"
,
/* 161 */
"RESTRICT"
,
/* 161 */
"REPLACE"
,
/* 162 */
"ROW"
,
/* 162 */
"RESTRICT"
,
/* 163 */
"STATEMENT"
,
/* 163 */
"ROW"
,
/* 164 */
"TRIGGER"
,
/* 164 */
"STATEMENT"
,
/* 165 */
"VIEW"
,
/* 165 */
"TRIGGER"
,
/* 166 */
"COUNT"
,
/* 166 */
"VIEW"
,
/* 167 */
"SUM"
,
/* 167 */
"COUNT"
,
/* 168 */
"AVG"
,
/* 168 */
"SUM"
,
/* 169 */
"MIN"
,
/* 169 */
"AVG"
,
/* 170 */
"MAX"
,
/* 170 */
"MIN"
,
/* 171 */
"FIRST"
,
/* 171 */
"MAX"
,
/* 172 */
"LAST"
,
/* 172 */
"FIRST"
,
/* 173 */
"TOP"
,
/* 173 */
"LAST"
,
/* 174 */
"BOTTOM"
,
/* 174 */
"TOP"
,
/* 175 */
"STDDEV"
,
/* 175 */
"BOTTOM"
,
/* 176 */
"PERCENTILE"
,
/* 176 */
"STDDEV"
,
/* 177 */
"APERCENTILE"
,
/* 177 */
"PERCENTILE"
,
/* 178 */
"LEASTSQUARES"
,
/* 178 */
"APERCENTILE"
,
/* 179 */
"HISTOGRAM"
,
/* 179 */
"LEASTSQUARES"
,
/* 180 */
"DIFF"
,
/* 180 */
"HISTOGRAM"
,
/* 181 */
"SPREAD"
,
/* 181 */
"DIFF"
,
/* 182 */
"TWA"
,
/* 182 */
"SPREAD"
,
/* 183 */
"INTERP"
,
/* 183 */
"TWA"
,
/* 184 */
"LAST_ROW"
,
/* 184 */
"INTERP"
,
/* 185 */
"RATE"
,
/* 185 */
"LAST_ROW"
,
/* 186 */
"IRATE"
,
/* 186 */
"RATE"
,
/* 187 */
"SUM_RATE"
,
/* 187 */
"IRATE"
,
/* 188 */
"SUM_IRATE"
,
/* 188 */
"SUM_RATE"
,
/* 189 */
"AVG_RATE"
,
/* 189 */
"SUM_IRATE"
,
/* 190 */
"AVG_IRATE"
,
/* 190 */
"AVG_RATE"
,
/* 191 */
"TBID"
,
/* 191 */
"AVG_IRATE"
,
/* 192 */
"SEMI"
,
/* 192 */
"TBID"
,
/* 193 */
"NONE"
,
/* 193 */
"SEMI"
,
/* 194 */
"PREV"
,
/* 194 */
"NONE"
,
/* 195 */
"LINEAR"
,
/* 195 */
"PREV"
,
/* 196 */
"IMPORT"
,
/* 196 */
"LINEAR"
,
/* 197 */
"METRIC"
,
/* 197 */
"IMPORT"
,
/* 198 */
"TBNAME"
,
/* 198 */
"METRIC"
,
/* 199 */
"JOIN"
,
/* 199 */
"TBNAME"
,
/* 200 */
"METRICS"
,
/* 200 */
"JOIN"
,
/* 201 */
"STABLE"
,
/* 201 */
"METRICS"
,
/* 202 */
"INSERT"
,
/* 202 */
"STABLE"
,
/* 203 */
"INTO"
,
/* 203 */
"INSERT"
,
/* 204 */
"VALUES"
,
/* 204 */
"INTO"
,
/* 205 */
"error"
,
/* 205 */
"VALUES"
,
/* 206 */
"program"
,
/* 206 */
"error"
,
/* 207 */
"cmd"
,
/* 207 */
"program"
,
/* 208 */
"dbPrefix"
,
/* 208 */
"cmd"
,
/* 209 */
"ids"
,
/* 209 */
"dbPrefix"
,
/* 210 */
"cpxName"
,
/* 210 */
"ids"
,
/* 211 */
"ifexists"
,
/* 211 */
"cpxName"
,
/* 212 */
"alter_db_optr"
,
/* 212 */
"ifexists"
,
/* 213 */
"acct_optr"
,
/* 213 */
"alter_db_optr"
,
/* 214 */
"ifnotexists"
,
/* 214 */
"acct_optr"
,
/* 215 */
"db_optr"
,
/* 215 */
"ifnotexists"
,
/* 216 */
"pps"
,
/* 216 */
"db_optr"
,
/* 217 */
"tseries"
,
/* 217 */
"pps"
,
/* 218 */
"dbs"
,
/* 218 */
"tseries"
,
/* 219 */
"streams"
,
/* 219 */
"dbs"
,
/* 220 */
"storage"
,
/* 220 */
"streams"
,
/* 221 */
"qtime"
,
/* 221 */
"storage"
,
/* 222 */
"users"
,
/* 222 */
"qtime"
,
/* 223 */
"conns"
,
/* 223 */
"users"
,
/* 224 */
"state"
,
/* 224 */
"conns"
,
/* 225 */
"keep"
,
/* 225 */
"state"
,
/* 226 */
"tagitemlist"
,
/* 226 */
"keep"
,
/* 227 */
"tables"
,
/* 227 */
"tagitemlist"
,
/* 228 */
"cache"
,
/* 228 */
"tables"
,
/* 229 */
"replica"
,
/* 229 */
"cache"
,
/* 230 */
"days"
,
/* 230 */
"replica"
,
/* 231 */
"minrows"
,
/* 231 */
"days"
,
/* 232 */
"maxrows"
,
/* 232 */
"minrows"
,
/* 233 */
"blocks"
,
/* 233 */
"maxrows"
,
/* 234 */
"ctime"
,
/* 234 */
"blocks"
,
/* 235 */
"wal"
,
/* 235 */
"ctime"
,
/* 236 */
"comp"
,
/* 236 */
"wal"
,
/* 237 */
"prec"
,
/* 237 */
"fsync"
,
/* 238 */
"typename"
,
/* 238 */
"comp"
,
/* 239 */
"signed"
,
/* 239 */
"prec"
,
/* 240 */
"create_table_args"
,
/* 240 */
"typename"
,
/* 241 */
"columnlist"
,
/* 241 */
"signed"
,
/* 242 */
"select"
,
/* 242 */
"create_table_args"
,
/* 243 */
"column"
,
/* 243 */
"columnlist"
,
/* 244 */
"tagitem"
,
/* 244 */
"select"
,
/* 245 */
"selcollist"
,
/* 245 */
"column"
,
/* 246 */
"from"
,
/* 246 */
"tagitem"
,
/* 247 */
"where_opt"
,
/* 247 */
"selcollist"
,
/* 248 */
"interval_opt"
,
/* 248 */
"from"
,
/* 249 */
"fill_opt"
,
/* 249 */
"where_opt"
,
/* 250 */
"sliding_opt"
,
/* 250 */
"interval_opt"
,
/* 251 */
"groupby_opt"
,
/* 251 */
"fill_opt"
,
/* 252 */
"orderby_opt"
,
/* 252 */
"sliding_opt"
,
/* 253 */
"having_opt"
,
/* 253 */
"groupby_opt"
,
/* 254 */
"slimit_opt"
,
/* 254 */
"orderby_opt"
,
/* 255 */
"limit_opt"
,
/* 255 */
"having_opt"
,
/* 256 */
"union"
,
/* 256 */
"slimit_opt"
,
/* 257 */
"sclp"
,
/* 257 */
"limit_opt"
,
/* 258 */
"expr"
,
/* 258 */
"union"
,
/* 259 */
"as"
,
/* 259 */
"sclp"
,
/* 260 */
"tablelist"
,
/* 260 */
"expr"
,
/* 261 */
"tmvar"
,
/* 261 */
"as"
,
/* 262 */
"sortlist"
,
/* 262 */
"tablelist"
,
/* 263 */
"sortitem"
,
/* 263 */
"tmvar"
,
/* 264 */
"item"
,
/* 264 */
"sortlist"
,
/* 265 */
"sortorder"
,
/* 265 */
"sortitem"
,
/* 266 */
"grouplist"
,
/* 266 */
"item"
,
/* 267 */
"exprlist"
,
/* 267 */
"sortorder"
,
/* 268 */
"expritem"
,
/* 268 */
"grouplist"
,
/* 269 */
"exprlist"
,
/* 270 */
"expritem"
,
};
};
#endif
/* defined(YYCOVERAGE) || !defined(NDEBUG) */
#endif
/* defined(YYCOVERAGE) || !defined(NDEBUG) */
...
@@ -1078,146 +1082,149 @@ static const char *const yyRuleName[] = {
...
@@ -1078,146 +1082,149 @@ static const char *const yyRuleName[] = {
/* 77 */
"blocks ::= BLOCKS INTEGER"
,
/* 77 */
"blocks ::= BLOCKS INTEGER"
,
/* 78 */
"ctime ::= CTIME INTEGER"
,
/* 78 */
"ctime ::= CTIME INTEGER"
,
/* 79 */
"wal ::= WAL INTEGER"
,
/* 79 */
"wal ::= WAL INTEGER"
,
/* 80 */
"comp ::= COMP INTEGER"
,
/* 80 */
"fsync ::= FSYNC INTEGER"
,
/* 81 */
"prec ::= PRECISION STRING"
,
/* 81 */
"comp ::= COMP INTEGER"
,
/* 82 */
"db_optr ::="
,
/* 82 */
"prec ::= PRECISION STRING"
,
/* 83 */
"db_optr ::= db_optr tables"
,
/* 83 */
"db_optr ::="
,
/* 84 */
"db_optr ::= db_optr cache"
,
/* 84 */
"db_optr ::= db_optr tables"
,
/* 85 */
"db_optr ::= db_optr replica"
,
/* 85 */
"db_optr ::= db_optr cache"
,
/* 86 */
"db_optr ::= db_optr days"
,
/* 86 */
"db_optr ::= db_optr replica"
,
/* 87 */
"db_optr ::= db_optr minrows"
,
/* 87 */
"db_optr ::= db_optr days"
,
/* 88 */
"db_optr ::= db_optr maxrows"
,
/* 88 */
"db_optr ::= db_optr minrows"
,
/* 89 */
"db_optr ::= db_optr blocks"
,
/* 89 */
"db_optr ::= db_optr maxrows"
,
/* 90 */
"db_optr ::= db_optr ctime"
,
/* 90 */
"db_optr ::= db_optr blocks"
,
/* 91 */
"db_optr ::= db_optr wal"
,
/* 91 */
"db_optr ::= db_optr ctime"
,
/* 92 */
"db_optr ::= db_optr comp"
,
/* 92 */
"db_optr ::= db_optr wal"
,
/* 93 */
"db_optr ::= db_optr prec"
,
/* 93 */
"db_optr ::= db_optr fsync"
,
/* 94 */
"db_optr ::= db_optr keep"
,
/* 94 */
"db_optr ::= db_optr comp"
,
/* 95 */
"alter_db_optr ::="
,
/* 95 */
"db_optr ::= db_optr prec"
,
/* 96 */
"alter_db_optr ::= alter_db_optr replica"
,
/* 96 */
"db_optr ::= db_optr keep"
,
/* 97 */
"alter_db_optr ::= alter_db_optr tables"
,
/* 97 */
"alter_db_optr ::="
,
/* 98 */
"alter_db_optr ::= alter_db_optr keep"
,
/* 98 */
"alter_db_optr ::= alter_db_optr replica"
,
/* 99 */
"alter_db_optr ::= alter_db_optr blocks"
,
/* 99 */
"alter_db_optr ::= alter_db_optr tables"
,
/* 100 */
"alter_db_optr ::= alter_db_optr comp"
,
/* 100 */
"alter_db_optr ::= alter_db_optr keep"
,
/* 101 */
"alter_db_optr ::= alter_db_optr wal"
,
/* 101 */
"alter_db_optr ::= alter_db_optr blocks"
,
/* 102 */
"typename ::= ids"
,
/* 102 */
"alter_db_optr ::= alter_db_optr comp"
,
/* 103 */
"typename ::= ids LP signed RP"
,
/* 103 */
"alter_db_optr ::= alter_db_optr wal"
,
/* 104 */
"signed ::= INTEGER"
,
/* 104 */
"alter_db_optr ::= alter_db_optr fsync"
,
/* 105 */
"signed ::= PLUS INTEGER"
,
/* 105 */
"typename ::= ids"
,
/* 106 */
"signed ::= MINUS INTEGER"
,
/* 106 */
"typename ::= ids LP signed RP"
,
/* 107 */
"cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args"
,
/* 107 */
"signed ::= INTEGER"
,
/* 108 */
"create_table_args ::= LP columnlist RP"
,
/* 108 */
"signed ::= PLUS INTEGER"
,
/* 109 */
"create_table_args ::= LP columnlist RP TAGS LP columnlist RP"
,
/* 109 */
"signed ::= MINUS INTEGER"
,
/* 110 */
"create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP"
,
/* 110 */
"cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args"
,
/* 111 */
"create_table_args ::= AS select"
,
/* 111 */
"create_table_args ::= LP columnlist RP"
,
/* 112 */
"columnlist ::= columnlist COMMA column"
,
/* 112 */
"create_table_args ::= LP columnlist RP TAGS LP columnlist RP"
,
/* 113 */
"columnlist ::= column"
,
/* 113 */
"create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP"
,
/* 114 */
"column ::= ids typename"
,
/* 114 */
"create_table_args ::= AS select"
,
/* 115 */
"tagitemlist ::= tagitemlist COMMA tagitem"
,
/* 115 */
"columnlist ::= columnlist COMMA column"
,
/* 116 */
"tagitemlist ::= tagitem"
,
/* 116 */
"columnlist ::= column"
,
/* 117 */
"tagitem ::= INTEGER"
,
/* 117 */
"column ::= ids typename"
,
/* 118 */
"tagitem ::= FLOAT"
,
/* 118 */
"tagitemlist ::= tagitemlist COMMA tagitem"
,
/* 119 */
"tagitem ::= STRING"
,
/* 119 */
"tagitemlist ::= tagitem"
,
/* 120 */
"tagitem ::= BOOL"
,
/* 120 */
"tagitem ::= INTEGER"
,
/* 121 */
"tagitem ::= NULL"
,
/* 121 */
"tagitem ::= FLOAT"
,
/* 122 */
"tagitem ::= MINUS INTEGER"
,
/* 122 */
"tagitem ::= STRING"
,
/* 123 */
"tagitem ::= MINUS FLOAT"
,
/* 123 */
"tagitem ::= BOOL"
,
/* 124 */
"tagitem ::= PLUS INTEGER"
,
/* 124 */
"tagitem ::= NULL"
,
/* 125 */
"tagitem ::= PLUS FLOAT"
,
/* 125 */
"tagitem ::= MINUS INTEGER"
,
/* 126 */
"select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt"
,
/* 126 */
"tagitem ::= MINUS FLOAT"
,
/* 127 */
"union ::= select"
,
/* 127 */
"tagitem ::= PLUS INTEGER"
,
/* 128 */
"union ::= LP union RP"
,
/* 128 */
"tagitem ::= PLUS FLOAT"
,
/* 129 */
"union ::= union UNION ALL select"
,
/* 129 */
"select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt"
,
/* 130 */
"union ::= union UNION ALL LP select RP"
,
/* 130 */
"union ::= select"
,
/* 131 */
"cmd ::= union"
,
/* 131 */
"union ::= LP union RP"
,
/* 132 */
"select ::= SELECT selcollist"
,
/* 132 */
"union ::= union UNION ALL select"
,
/* 133 */
"sclp ::= selcollist COMMA"
,
/* 133 */
"union ::= union UNION ALL LP select RP"
,
/* 134 */
"sclp ::="
,
/* 134 */
"cmd ::= union"
,
/* 135 */
"selcollist ::= sclp expr as"
,
/* 135 */
"select ::= SELECT selcollist"
,
/* 136 */
"selcollist ::= sclp STAR"
,
/* 136 */
"sclp ::= selcollist COMMA"
,
/* 137 */
"as ::= AS ids"
,
/* 137 */
"sclp ::="
,
/* 138 */
"as ::= ids"
,
/* 138 */
"selcollist ::= sclp expr as"
,
/* 139 */
"as ::="
,
/* 139 */
"selcollist ::= sclp STAR"
,
/* 140 */
"from ::= FROM tablelist"
,
/* 140 */
"as ::= AS ids"
,
/* 141 */
"tablelist ::= ids cpxName"
,
/* 141 */
"as ::= ids"
,
/* 142 */
"tablelist ::= tablelist COMMA ids cpxName"
,
/* 142 */
"as ::="
,
/* 143 */
"tmvar ::= VARIABLE"
,
/* 143 */
"from ::= FROM tablelist"
,
/* 144 */
"interval_opt ::= INTERVAL LP tmvar RP"
,
/* 144 */
"tablelist ::= ids cpxName"
,
/* 145 */
"interval_opt ::="
,
/* 145 */
"tablelist ::= tablelist COMMA ids cpxName"
,
/* 146 */
"fill_opt ::="
,
/* 146 */
"tmvar ::= VARIABLE"
,
/* 147 */
"fill_opt ::= FILL LP ID COMMA tagitemlist RP"
,
/* 147 */
"interval_opt ::= INTERVAL LP tmvar RP"
,
/* 148 */
"fill_opt ::= FILL LP ID RP"
,
/* 148 */
"interval_opt ::="
,
/* 149 */
"sliding_opt ::= SLIDING LP tmvar RP"
,
/* 149 */
"fill_opt ::="
,
/* 150 */
"sliding_opt ::="
,
/* 150 */
"fill_opt ::= FILL LP ID COMMA tagitemlist RP"
,
/* 151 */
"orderby_opt ::="
,
/* 151 */
"fill_opt ::= FILL LP ID RP"
,
/* 152 */
"orderby_opt ::= ORDER BY sortlist"
,
/* 152 */
"sliding_opt ::= SLIDING LP tmvar RP"
,
/* 153 */
"sortlist ::= sortlist COMMA item sortorder"
,
/* 153 */
"sliding_opt ::="
,
/* 154 */
"sortlist ::= item sortorder"
,
/* 154 */
"orderby_opt ::="
,
/* 155 */
"item ::= ids cpxName"
,
/* 155 */
"orderby_opt ::= ORDER BY sortlist"
,
/* 156 */
"sortorder ::= ASC"
,
/* 156 */
"sortlist ::= sortlist COMMA item sortorder"
,
/* 157 */
"sortorder ::= DESC"
,
/* 157 */
"sortlist ::= item sortorder"
,
/* 158 */
"sortorder ::="
,
/* 158 */
"item ::= ids cpxName"
,
/* 159 */
"groupby_opt ::="
,
/* 159 */
"sortorder ::= ASC"
,
/* 160 */
"groupby_opt ::= GROUP BY grouplist"
,
/* 160 */
"sortorder ::= DESC"
,
/* 161 */
"grouplist ::= grouplist COMMA item"
,
/* 161 */
"sortorder ::="
,
/* 162 */
"grouplist ::= item"
,
/* 162 */
"groupby_opt ::="
,
/* 163 */
"having_opt ::="
,
/* 163 */
"groupby_opt ::= GROUP BY grouplist"
,
/* 164 */
"having_opt ::= HAVING expr"
,
/* 164 */
"grouplist ::= grouplist COMMA item"
,
/* 165 */
"limit_opt ::="
,
/* 165 */
"grouplist ::= item"
,
/* 166 */
"limit_opt ::= LIMIT signed"
,
/* 166 */
"having_opt ::="
,
/* 167 */
"limit_opt ::= LIMIT signed OFFSET signed"
,
/* 167 */
"having_opt ::= HAVING expr"
,
/* 168 */
"limit_opt ::= LIMIT signed COMMA signed"
,
/* 168 */
"limit_opt ::="
,
/* 169 */
"slimit_opt ::="
,
/* 169 */
"limit_opt ::= LIMIT signed"
,
/* 170 */
"slimit_opt ::= SLIMIT signed"
,
/* 170 */
"limit_opt ::= LIMIT signed OFFSET signed"
,
/* 171 */
"slimit_opt ::= SLIMIT signed SOFFSET signed"
,
/* 171 */
"limit_opt ::= LIMIT signed COMMA signed"
,
/* 172 */
"slimit_opt ::= SLIMIT signed COMMA signed"
,
/* 172 */
"slimit_opt ::="
,
/* 173 */
"where_opt ::="
,
/* 173 */
"slimit_opt ::= SLIMIT signed"
,
/* 174 */
"where_opt ::= WHERE expr"
,
/* 174 */
"slimit_opt ::= SLIMIT signed SOFFSET signed"
,
/* 175 */
"expr ::= LP expr RP"
,
/* 175 */
"slimit_opt ::= SLIMIT signed COMMA signed"
,
/* 176 */
"expr ::= ID"
,
/* 176 */
"where_opt ::="
,
/* 177 */
"expr ::= ID DOT ID"
,
/* 177 */
"where_opt ::= WHERE expr"
,
/* 178 */
"expr ::= ID DOT STAR"
,
/* 178 */
"expr ::= LP expr RP"
,
/* 179 */
"expr ::= INTEGER"
,
/* 179 */
"expr ::= ID"
,
/* 180 */
"expr ::= MINUS INTEGER"
,
/* 180 */
"expr ::= ID DOT ID"
,
/* 181 */
"expr ::= PLUS INTEGER"
,
/* 181 */
"expr ::= ID DOT STAR"
,
/* 182 */
"expr ::= FLOAT"
,
/* 182 */
"expr ::= INTEGER"
,
/* 183 */
"expr ::= MINUS FLOAT"
,
/* 183 */
"expr ::= MINUS INTEGER"
,
/* 184 */
"expr ::= PLUS FLOAT"
,
/* 184 */
"expr ::= PLUS INTEGER"
,
/* 185 */
"expr ::= STRING"
,
/* 185 */
"expr ::= FLOAT"
,
/* 186 */
"expr ::= NOW"
,
/* 186 */
"expr ::= MINUS FLOAT"
,
/* 187 */
"expr ::= VARIABLE"
,
/* 187 */
"expr ::= PLUS FLOAT"
,
/* 188 */
"expr ::= BOOL"
,
/* 188 */
"expr ::= STRING"
,
/* 189 */
"expr ::= ID LP exprlist RP"
,
/* 189 */
"expr ::= NOW"
,
/* 190 */
"expr ::= ID LP STAR RP"
,
/* 190 */
"expr ::= VARIABLE"
,
/* 191 */
"expr ::= expr AND expr"
,
/* 191 */
"expr ::= BOOL"
,
/* 192 */
"expr ::= expr OR expr"
,
/* 192 */
"expr ::= ID LP exprlist RP"
,
/* 193 */
"expr ::= expr LT expr"
,
/* 193 */
"expr ::= ID LP STAR RP"
,
/* 194 */
"expr ::= expr GT expr"
,
/* 194 */
"expr ::= expr AND expr"
,
/* 195 */
"expr ::= expr LE expr"
,
/* 195 */
"expr ::= expr OR expr"
,
/* 196 */
"expr ::= expr GE expr"
,
/* 196 */
"expr ::= expr LT expr"
,
/* 197 */
"expr ::= expr NE expr"
,
/* 197 */
"expr ::= expr GT expr"
,
/* 198 */
"expr ::= expr EQ expr"
,
/* 198 */
"expr ::= expr LE expr"
,
/* 199 */
"expr ::= expr PLUS expr"
,
/* 199 */
"expr ::= expr GE expr"
,
/* 200 */
"expr ::= expr MINUS expr"
,
/* 200 */
"expr ::= expr NE expr"
,
/* 201 */
"expr ::= expr STAR expr"
,
/* 201 */
"expr ::= expr EQ expr"
,
/* 202 */
"expr ::= expr SLASH expr"
,
/* 202 */
"expr ::= expr PLUS expr"
,
/* 203 */
"expr ::= expr REM expr"
,
/* 203 */
"expr ::= expr MINUS expr"
,
/* 204 */
"expr ::= expr LIKE expr"
,
/* 204 */
"expr ::= expr STAR expr"
,
/* 205 */
"expr ::= expr IN LP exprlist RP"
,
/* 205 */
"expr ::= expr SLASH expr"
,
/* 206 */
"exprlist ::= exprlist COMMA expritem"
,
/* 206 */
"expr ::= expr REM expr"
,
/* 207 */
"exprlist ::= expritem"
,
/* 207 */
"expr ::= expr LIKE expr"
,
/* 208 */
"expritem ::= expr"
,
/* 208 */
"expr ::= expr IN LP exprlist RP"
,
/* 209 */
"expritem ::="
,
/* 209 */
"exprlist ::= exprlist COMMA expritem"
,
/* 210 */
"cmd ::= RESET QUERY CACHE"
,
/* 210 */
"exprlist ::= expritem"
,
/* 211 */
"cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist"
,
/* 211 */
"expritem ::= expr"
,
/* 212 */
"cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids"
,
/* 212 */
"expritem ::="
,
/* 213 */
"cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist"
,
/* 213 */
"cmd ::= RESET QUERY CACHE"
,
/* 214 */
"cmd ::= ALTER TABLE ids cpxName DROP TAG ids"
,
/* 214 */
"cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist"
,
/* 215 */
"cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids"
,
/* 215 */
"cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids"
,
/* 216 */
"cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem"
,
/* 216 */
"cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist"
,
/* 217 */
"cmd ::= KILL CONNECTION INTEGER"
,
/* 217 */
"cmd ::= ALTER TABLE ids cpxName DROP TAG ids"
,
/* 218 */
"cmd ::= KILL STREAM INTEGER COLON INTEGER"
,
/* 218 */
"cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids"
,
/* 219 */
"cmd ::= KILL QUERY INTEGER COLON INTEGER"
,
/* 219 */
"cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem"
,
/* 220 */
"cmd ::= KILL CONNECTION INTEGER"
,
/* 221 */
"cmd ::= KILL STREAM INTEGER COLON INTEGER"
,
/* 222 */
"cmd ::= KILL QUERY INTEGER COLON INTEGER"
,
};
};
#endif
/* NDEBUG */
#endif
/* NDEBUG */
...
@@ -1338,50 +1345,50 @@ static void yy_destructor(
...
@@ -1338,50 +1345,50 @@ static void yy_destructor(
** inside the C code.
** inside the C code.
*/
*/
/********* Begin destructor definitions ***************************************/
/********* Begin destructor definitions ***************************************/
case
22
5
:
/* keep */
case
22
6
:
/* keep */
case
22
6
:
/* tagitemlist */
case
22
7
:
/* tagitemlist */
case
2
49
:
/* fill_opt */
case
2
51
:
/* fill_opt */
case
25
1
:
/* groupby_opt */
case
25
3
:
/* groupby_opt */
case
25
2
:
/* orderby_opt */
case
25
4
:
/* orderby_opt */
case
26
2
:
/* sortlist */
case
26
4
:
/* sortlist */
case
26
6
:
/* grouplist */
case
26
8
:
/* grouplist */
{
{
tVariantListDestroy
((
yypminor
->
yy
322
));
tVariantListDestroy
((
yypminor
->
yy
494
));
}
}
break
;
break
;
case
24
1
:
/* columnlist */
case
24
3
:
/* columnlist */
{
{
tFieldListDestroy
((
yypminor
->
yy
36
9
));
tFieldListDestroy
((
yypminor
->
yy
44
9
));
}
}
break
;
break
;
case
24
2
:
/* select */
case
24
4
:
/* select */
{
{
doDestroyQuerySql
((
yypminor
->
yy1
9
0
));
doDestroyQuerySql
((
yypminor
->
yy1
5
0
));
}
}
break
;
break
;
case
24
5
:
/* selcollist */
case
24
7
:
/* selcollist */
case
25
7
:
/* sclp */
case
25
9
:
/* sclp */
case
26
7
:
/* exprlist */
case
26
9
:
/* exprlist */
{
{
tSQLExprListDestroy
((
yypminor
->
yy2
60
));
tSQLExprListDestroy
((
yypminor
->
yy2
24
));
}
}
break
;
break
;
case
24
7
:
/* where_opt */
case
24
9
:
/* where_opt */
case
25
3
:
/* having_opt */
case
25
5
:
/* having_opt */
case
2
58
:
/* expr */
case
2
60
:
/* expr */
case
2
68
:
/* expritem */
case
2
70
:
/* expritem */
{
{
tSQLExprDestroy
((
yypminor
->
yy
500
));
tSQLExprDestroy
((
yypminor
->
yy
66
));
}
}
break
;
break
;
case
25
6
:
/* union */
case
25
8
:
/* union */
{
{
destroyAllSelectClause
((
yypminor
->
yy2
63
));
destroyAllSelectClause
((
yypminor
->
yy2
5
));
}
}
break
;
break
;
case
26
3
:
/* sortitem */
case
26
5
:
/* sortitem */
{
{
tVariantDestroy
(
&
(
yypminor
->
yy
518
));
tVariantDestroy
(
&
(
yypminor
->
yy
312
));
}
}
break
;
break
;
/********* End destructor definitions *****************************************/
/********* End destructor definitions *****************************************/
...
@@ -1675,226 +1682,229 @@ static const struct {
...
@@ -1675,226 +1682,229 @@ static const struct {
YYCODETYPE
lhs
;
/* Symbol on the left-hand side of the rule */
YYCODETYPE
lhs
;
/* Symbol on the left-hand side of the rule */
signed
char
nrhs
;
/* Negative of the number of RHS symbols in the rule */
signed
char
nrhs
;
/* Negative of the number of RHS symbols in the rule */
}
yyRuleInfo
[]
=
{
}
yyRuleInfo
[]
=
{
{
206
,
-
1
},
/* (0) program ::= cmd */
{
207
,
-
1
},
/* (0) program ::= cmd */
{
207
,
-
2
},
/* (1) cmd ::= SHOW DATABASES */
{
208
,
-
2
},
/* (1) cmd ::= SHOW DATABASES */
{
207
,
-
2
},
/* (2) cmd ::= SHOW MNODES */
{
208
,
-
2
},
/* (2) cmd ::= SHOW MNODES */
{
207
,
-
2
},
/* (3) cmd ::= SHOW DNODES */
{
208
,
-
2
},
/* (3) cmd ::= SHOW DNODES */
{
207
,
-
2
},
/* (4) cmd ::= SHOW ACCOUNTS */
{
208
,
-
2
},
/* (4) cmd ::= SHOW ACCOUNTS */
{
207
,
-
2
},
/* (5) cmd ::= SHOW USERS */
{
208
,
-
2
},
/* (5) cmd ::= SHOW USERS */
{
207
,
-
2
},
/* (6) cmd ::= SHOW MODULES */
{
208
,
-
2
},
/* (6) cmd ::= SHOW MODULES */
{
207
,
-
2
},
/* (7) cmd ::= SHOW QUERIES */
{
208
,
-
2
},
/* (7) cmd ::= SHOW QUERIES */
{
207
,
-
2
},
/* (8) cmd ::= SHOW CONNECTIONS */
{
208
,
-
2
},
/* (8) cmd ::= SHOW CONNECTIONS */
{
207
,
-
2
},
/* (9) cmd ::= SHOW STREAMS */
{
208
,
-
2
},
/* (9) cmd ::= SHOW STREAMS */
{
207
,
-
2
},
/* (10) cmd ::= SHOW CONFIGS */
{
208
,
-
2
},
/* (10) cmd ::= SHOW CONFIGS */
{
207
,
-
2
},
/* (11) cmd ::= SHOW SCORES */
{
208
,
-
2
},
/* (11) cmd ::= SHOW SCORES */
{
207
,
-
2
},
/* (12) cmd ::= SHOW GRANTS */
{
208
,
-
2
},
/* (12) cmd ::= SHOW GRANTS */
{
207
,
-
2
},
/* (13) cmd ::= SHOW VNODES */
{
208
,
-
2
},
/* (13) cmd ::= SHOW VNODES */
{
207
,
-
3
},
/* (14) cmd ::= SHOW VNODES IPTOKEN */
{
208
,
-
3
},
/* (14) cmd ::= SHOW VNODES IPTOKEN */
{
208
,
0
},
/* (15) dbPrefix ::= */
{
209
,
0
},
/* (15) dbPrefix ::= */
{
208
,
-
2
},
/* (16) dbPrefix ::= ids DOT */
{
209
,
-
2
},
/* (16) dbPrefix ::= ids DOT */
{
210
,
0
},
/* (17) cpxName ::= */
{
211
,
0
},
/* (17) cpxName ::= */
{
210
,
-
2
},
/* (18) cpxName ::= DOT ids */
{
211
,
-
2
},
/* (18) cpxName ::= DOT ids */
{
207
,
-
3
},
/* (19) cmd ::= SHOW dbPrefix TABLES */
{
208
,
-
3
},
/* (19) cmd ::= SHOW dbPrefix TABLES */
{
207
,
-
5
},
/* (20) cmd ::= SHOW dbPrefix TABLES LIKE ids */
{
208
,
-
5
},
/* (20) cmd ::= SHOW dbPrefix TABLES LIKE ids */
{
207
,
-
3
},
/* (21) cmd ::= SHOW dbPrefix STABLES */
{
208
,
-
3
},
/* (21) cmd ::= SHOW dbPrefix STABLES */
{
207
,
-
5
},
/* (22) cmd ::= SHOW dbPrefix STABLES LIKE ids */
{
208
,
-
5
},
/* (22) cmd ::= SHOW dbPrefix STABLES LIKE ids */
{
207
,
-
3
},
/* (23) cmd ::= SHOW dbPrefix VGROUPS */
{
208
,
-
3
},
/* (23) cmd ::= SHOW dbPrefix VGROUPS */
{
207
,
-
4
},
/* (24) cmd ::= SHOW dbPrefix VGROUPS ids */
{
208
,
-
4
},
/* (24) cmd ::= SHOW dbPrefix VGROUPS ids */
{
207
,
-
5
},
/* (25) cmd ::= DROP TABLE ifexists ids cpxName */
{
208
,
-
5
},
/* (25) cmd ::= DROP TABLE ifexists ids cpxName */
{
207
,
-
4
},
/* (26) cmd ::= DROP DATABASE ifexists ids */
{
208
,
-
4
},
/* (26) cmd ::= DROP DATABASE ifexists ids */
{
207
,
-
3
},
/* (27) cmd ::= DROP DNODE ids */
{
208
,
-
3
},
/* (27) cmd ::= DROP DNODE ids */
{
207
,
-
3
},
/* (28) cmd ::= DROP USER ids */
{
208
,
-
3
},
/* (28) cmd ::= DROP USER ids */
{
207
,
-
3
},
/* (29) cmd ::= DROP ACCOUNT ids */
{
208
,
-
3
},
/* (29) cmd ::= DROP ACCOUNT ids */
{
207
,
-
2
},
/* (30) cmd ::= USE ids */
{
208
,
-
2
},
/* (30) cmd ::= USE ids */
{
207
,
-
3
},
/* (31) cmd ::= DESCRIBE ids cpxName */
{
208
,
-
3
},
/* (31) cmd ::= DESCRIBE ids cpxName */
{
207
,
-
5
},
/* (32) cmd ::= ALTER USER ids PASS ids */
{
208
,
-
5
},
/* (32) cmd ::= ALTER USER ids PASS ids */
{
207
,
-
5
},
/* (33) cmd ::= ALTER USER ids PRIVILEGE ids */
{
208
,
-
5
},
/* (33) cmd ::= ALTER USER ids PRIVILEGE ids */
{
207
,
-
4
},
/* (34) cmd ::= ALTER DNODE ids ids */
{
208
,
-
4
},
/* (34) cmd ::= ALTER DNODE ids ids */
{
207
,
-
5
},
/* (35) cmd ::= ALTER DNODE ids ids ids */
{
208
,
-
5
},
/* (35) cmd ::= ALTER DNODE ids ids ids */
{
207
,
-
3
},
/* (36) cmd ::= ALTER LOCAL ids */
{
208
,
-
3
},
/* (36) cmd ::= ALTER LOCAL ids */
{
207
,
-
4
},
/* (37) cmd ::= ALTER LOCAL ids ids */
{
208
,
-
4
},
/* (37) cmd ::= ALTER LOCAL ids ids */
{
207
,
-
4
},
/* (38) cmd ::= ALTER DATABASE ids alter_db_optr */
{
208
,
-
4
},
/* (38) cmd ::= ALTER DATABASE ids alter_db_optr */
{
207
,
-
4
},
/* (39) cmd ::= ALTER ACCOUNT ids acct_optr */
{
208
,
-
4
},
/* (39) cmd ::= ALTER ACCOUNT ids acct_optr */
{
207
,
-
6
},
/* (40) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
{
208
,
-
6
},
/* (40) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
{
209
,
-
1
},
/* (41) ids ::= ID */
{
210
,
-
1
},
/* (41) ids ::= ID */
{
209
,
-
1
},
/* (42) ids ::= STRING */
{
210
,
-
1
},
/* (42) ids ::= STRING */
{
211
,
-
2
},
/* (43) ifexists ::= IF EXISTS */
{
212
,
-
2
},
/* (43) ifexists ::= IF EXISTS */
{
211
,
0
},
/* (44) ifexists ::= */
{
212
,
0
},
/* (44) ifexists ::= */
{
214
,
-
3
},
/* (45) ifnotexists ::= IF NOT EXISTS */
{
215
,
-
3
},
/* (45) ifnotexists ::= IF NOT EXISTS */
{
214
,
0
},
/* (46) ifnotexists ::= */
{
215
,
0
},
/* (46) ifnotexists ::= */
{
207
,
-
3
},
/* (47) cmd ::= CREATE DNODE ids */
{
208
,
-
3
},
/* (47) cmd ::= CREATE DNODE ids */
{
207
,
-
6
},
/* (48) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
{
208
,
-
6
},
/* (48) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
{
207
,
-
5
},
/* (49) cmd ::= CREATE DATABASE ifnotexists ids db_optr */
{
208
,
-
5
},
/* (49) cmd ::= CREATE DATABASE ifnotexists ids db_optr */
{
207
,
-
5
},
/* (50) cmd ::= CREATE USER ids PASS ids */
{
208
,
-
5
},
/* (50) cmd ::= CREATE USER ids PASS ids */
{
216
,
0
},
/* (51) pps ::= */
{
217
,
0
},
/* (51) pps ::= */
{
216
,
-
2
},
/* (52) pps ::= PPS INTEGER */
{
217
,
-
2
},
/* (52) pps ::= PPS INTEGER */
{
217
,
0
},
/* (53) tseries ::= */
{
218
,
0
},
/* (53) tseries ::= */
{
217
,
-
2
},
/* (54) tseries ::= TSERIES INTEGER */
{
218
,
-
2
},
/* (54) tseries ::= TSERIES INTEGER */
{
218
,
0
},
/* (55) dbs ::= */
{
219
,
0
},
/* (55) dbs ::= */
{
218
,
-
2
},
/* (56) dbs ::= DBS INTEGER */
{
219
,
-
2
},
/* (56) dbs ::= DBS INTEGER */
{
219
,
0
},
/* (57) streams ::= */
{
220
,
0
},
/* (57) streams ::= */
{
219
,
-
2
},
/* (58) streams ::= STREAMS INTEGER */
{
220
,
-
2
},
/* (58) streams ::= STREAMS INTEGER */
{
220
,
0
},
/* (59) storage ::= */
{
221
,
0
},
/* (59) storage ::= */
{
220
,
-
2
},
/* (60) storage ::= STORAGE INTEGER */
{
221
,
-
2
},
/* (60) storage ::= STORAGE INTEGER */
{
221
,
0
},
/* (61) qtime ::= */
{
222
,
0
},
/* (61) qtime ::= */
{
221
,
-
2
},
/* (62) qtime ::= QTIME INTEGER */
{
222
,
-
2
},
/* (62) qtime ::= QTIME INTEGER */
{
222
,
0
},
/* (63) users ::= */
{
223
,
0
},
/* (63) users ::= */
{
222
,
-
2
},
/* (64) users ::= USERS INTEGER */
{
223
,
-
2
},
/* (64) users ::= USERS INTEGER */
{
223
,
0
},
/* (65) conns ::= */
{
224
,
0
},
/* (65) conns ::= */
{
223
,
-
2
},
/* (66) conns ::= CONNS INTEGER */
{
224
,
-
2
},
/* (66) conns ::= CONNS INTEGER */
{
224
,
0
},
/* (67) state ::= */
{
225
,
0
},
/* (67) state ::= */
{
224
,
-
2
},
/* (68) state ::= STATE ids */
{
225
,
-
2
},
/* (68) state ::= STATE ids */
{
213
,
-
9
},
/* (69) acct_optr ::= pps tseries storage streams qtime dbs users conns state */
{
214
,
-
9
},
/* (69) acct_optr ::= pps tseries storage streams qtime dbs users conns state */
{
225
,
-
2
},
/* (70) keep ::= KEEP tagitemlist */
{
226
,
-
2
},
/* (70) keep ::= KEEP tagitemlist */
{
227
,
-
2
},
/* (71) tables ::= MAXTABLES INTEGER */
{
228
,
-
2
},
/* (71) tables ::= MAXTABLES INTEGER */
{
228
,
-
2
},
/* (72) cache ::= CACHE INTEGER */
{
229
,
-
2
},
/* (72) cache ::= CACHE INTEGER */
{
229
,
-
2
},
/* (73) replica ::= REPLICA INTEGER */
{
230
,
-
2
},
/* (73) replica ::= REPLICA INTEGER */
{
230
,
-
2
},
/* (74) days ::= DAYS INTEGER */
{
231
,
-
2
},
/* (74) days ::= DAYS INTEGER */
{
231
,
-
2
},
/* (75) minrows ::= MINROWS INTEGER */
{
232
,
-
2
},
/* (75) minrows ::= MINROWS INTEGER */
{
232
,
-
2
},
/* (76) maxrows ::= MAXROWS INTEGER */
{
233
,
-
2
},
/* (76) maxrows ::= MAXROWS INTEGER */
{
233
,
-
2
},
/* (77) blocks ::= BLOCKS INTEGER */
{
234
,
-
2
},
/* (77) blocks ::= BLOCKS INTEGER */
{
234
,
-
2
},
/* (78) ctime ::= CTIME INTEGER */
{
235
,
-
2
},
/* (78) ctime ::= CTIME INTEGER */
{
235
,
-
2
},
/* (79) wal ::= WAL INTEGER */
{
236
,
-
2
},
/* (79) wal ::= WAL INTEGER */
{
236
,
-
2
},
/* (80) comp ::= COMP INTEGER */
{
237
,
-
2
},
/* (80) fsync ::= FSYNC INTEGER */
{
237
,
-
2
},
/* (81) prec ::= PRECISION STRING */
{
238
,
-
2
},
/* (81) comp ::= COMP INTEGER */
{
215
,
0
},
/* (82) db_optr ::= */
{
239
,
-
2
},
/* (82) prec ::= PRECISION STRING */
{
215
,
-
2
},
/* (83) db_optr ::= db_optr tables */
{
216
,
0
},
/* (83) db_optr ::= */
{
215
,
-
2
},
/* (84) db_optr ::= db_optr cache */
{
216
,
-
2
},
/* (84) db_optr ::= db_optr tables */
{
215
,
-
2
},
/* (85) db_optr ::= db_optr replica */
{
216
,
-
2
},
/* (85) db_optr ::= db_optr cache */
{
215
,
-
2
},
/* (86) db_optr ::= db_optr days */
{
216
,
-
2
},
/* (86) db_optr ::= db_optr replica */
{
215
,
-
2
},
/* (87) db_optr ::= db_optr minrows */
{
216
,
-
2
},
/* (87) db_optr ::= db_optr days */
{
215
,
-
2
},
/* (88) db_optr ::= db_optr maxrows */
{
216
,
-
2
},
/* (88) db_optr ::= db_optr minrows */
{
215
,
-
2
},
/* (89) db_optr ::= db_optr blocks */
{
216
,
-
2
},
/* (89) db_optr ::= db_optr maxrows */
{
215
,
-
2
},
/* (90) db_optr ::= db_optr ctime */
{
216
,
-
2
},
/* (90) db_optr ::= db_optr blocks */
{
215
,
-
2
},
/* (91) db_optr ::= db_optr wal */
{
216
,
-
2
},
/* (91) db_optr ::= db_optr ctime */
{
215
,
-
2
},
/* (92) db_optr ::= db_optr comp */
{
216
,
-
2
},
/* (92) db_optr ::= db_optr wal */
{
215
,
-
2
},
/* (93) db_optr ::= db_optr prec */
{
216
,
-
2
},
/* (93) db_optr ::= db_optr fsync */
{
215
,
-
2
},
/* (94) db_optr ::= db_optr keep */
{
216
,
-
2
},
/* (94) db_optr ::= db_optr comp */
{
212
,
0
},
/* (95) alter_db_optr ::= */
{
216
,
-
2
},
/* (95) db_optr ::= db_optr prec */
{
212
,
-
2
},
/* (96) alter_db_optr ::= alter_db_optr replica */
{
216
,
-
2
},
/* (96) db_optr ::= db_optr keep */
{
212
,
-
2
},
/* (97) alter_db_optr ::= alter_db_optr tables */
{
213
,
0
},
/* (97) alter_db_optr ::= */
{
212
,
-
2
},
/* (98) alter_db_optr ::= alter_db_optr keep */
{
213
,
-
2
},
/* (98) alter_db_optr ::= alter_db_optr replica */
{
212
,
-
2
},
/* (99) alter_db_optr ::= alter_db_optr blocks */
{
213
,
-
2
},
/* (99) alter_db_optr ::= alter_db_optr tables */
{
212
,
-
2
},
/* (100) alter_db_optr ::= alter_db_optr comp */
{
213
,
-
2
},
/* (100) alter_db_optr ::= alter_db_optr keep */
{
212
,
-
2
},
/* (101) alter_db_optr ::= alter_db_optr wal */
{
213
,
-
2
},
/* (101) alter_db_optr ::= alter_db_optr blocks */
{
238
,
-
1
},
/* (102) typename ::= ids */
{
213
,
-
2
},
/* (102) alter_db_optr ::= alter_db_optr comp */
{
238
,
-
4
},
/* (103) typename ::= ids LP signed RP */
{
213
,
-
2
},
/* (103) alter_db_optr ::= alter_db_optr wal */
{
239
,
-
1
},
/* (104) signed ::= INTEGER */
{
213
,
-
2
},
/* (104) alter_db_optr ::= alter_db_optr fsync */
{
239
,
-
2
},
/* (105) signed ::= PLUS INTEGER */
{
240
,
-
1
},
/* (105) typename ::= ids */
{
239
,
-
2
},
/* (106) signed ::= MINUS INTEGER */
{
240
,
-
4
},
/* (106) typename ::= ids LP signed RP */
{
207
,
-
6
},
/* (107) cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args */
{
241
,
-
1
},
/* (107) signed ::= INTEGER */
{
240
,
-
3
},
/* (108) create_table_args ::= LP columnlist RP */
{
241
,
-
2
},
/* (108) signed ::= PLUS INTEGER */
{
240
,
-
7
},
/* (109) create_table_args ::= LP columnlist RP TAGS LP columnlist RP */
{
241
,
-
2
},
/* (109) signed ::= MINUS INTEGER */
{
240
,
-
7
},
/* (110) create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP */
{
208
,
-
6
},
/* (110) cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args */
{
240
,
-
2
},
/* (111) create_table_args ::= AS select */
{
242
,
-
3
},
/* (111) create_table_args ::= LP columnlist RP */
{
241
,
-
3
},
/* (112) columnlist ::= columnlist COMMA column */
{
242
,
-
7
},
/* (112) create_table_args ::= LP columnlist RP TAGS LP columnlist RP */
{
241
,
-
1
},
/* (113) columnlist ::= column */
{
242
,
-
7
},
/* (113) create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP */
{
243
,
-
2
},
/* (114) column ::= ids typename */
{
242
,
-
2
},
/* (114) create_table_args ::= AS select */
{
226
,
-
3
},
/* (115) tagitemlist ::= tagitemlist COMMA tagitem */
{
243
,
-
3
},
/* (115) columnlist ::= columnlist COMMA column */
{
226
,
-
1
},
/* (116) tagitemlist ::= tagitem */
{
243
,
-
1
},
/* (116) columnlist ::= column */
{
244
,
-
1
},
/* (117) tagitem ::= INTEGER */
{
245
,
-
2
},
/* (117) column ::= ids typename */
{
244
,
-
1
},
/* (118) tagitem ::= FLOAT */
{
227
,
-
3
},
/* (118) tagitemlist ::= tagitemlist COMMA tagitem */
{
244
,
-
1
},
/* (119) tagitem ::= STRING */
{
227
,
-
1
},
/* (119) tagitemlist ::= tagitem */
{
244
,
-
1
},
/* (120) tagitem ::= BOOL */
{
246
,
-
1
},
/* (120) tagitem ::= INTEGER */
{
244
,
-
1
},
/* (121) tagitem ::= NULL */
{
246
,
-
1
},
/* (121) tagitem ::= FLOAT */
{
244
,
-
2
},
/* (122) tagitem ::= MINUS INTEGER */
{
246
,
-
1
},
/* (122) tagitem ::= STRING */
{
244
,
-
2
},
/* (123) tagitem ::= MINUS FLOAT */
{
246
,
-
1
},
/* (123) tagitem ::= BOOL */
{
244
,
-
2
},
/* (124) tagitem ::= PLUS INTEGER */
{
246
,
-
1
},
/* (124) tagitem ::= NULL */
{
244
,
-
2
},
/* (125) tagitem ::= PLUS FLOAT */
{
246
,
-
2
},
/* (125) tagitem ::= MINUS INTEGER */
{
242
,
-
12
},
/* (126) select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */
{
246
,
-
2
},
/* (126) tagitem ::= MINUS FLOAT */
{
256
,
-
1
},
/* (127) union ::= select */
{
246
,
-
2
},
/* (127) tagitem ::= PLUS INTEGER */
{
256
,
-
3
},
/* (128) union ::= LP union RP */
{
246
,
-
2
},
/* (128) tagitem ::= PLUS FLOAT */
{
256
,
-
4
},
/* (129) union ::= union UNION ALL select */
{
244
,
-
12
},
/* (129) select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */
{
256
,
-
6
},
/* (130) union ::= union UNION ALL LP select RP */
{
258
,
-
1
},
/* (130) union ::= select */
{
207
,
-
1
},
/* (131) cmd ::= union */
{
258
,
-
3
},
/* (131) union ::= LP union RP */
{
242
,
-
2
},
/* (132) select ::= SELECT selcollist */
{
258
,
-
4
},
/* (132) union ::= union UNION ALL select */
{
257
,
-
2
},
/* (133) sclp ::= selcollist COMMA */
{
258
,
-
6
},
/* (133) union ::= union UNION ALL LP select RP */
{
257
,
0
},
/* (134) sclp ::= */
{
208
,
-
1
},
/* (134) cmd ::= union */
{
245
,
-
3
},
/* (135) selcollist ::= sclp expr as */
{
244
,
-
2
},
/* (135) select ::= SELECT selcollist */
{
245
,
-
2
},
/* (136) selcollist ::= sclp STAR */
{
259
,
-
2
},
/* (136) sclp ::= selcollist COMMA */
{
259
,
-
2
},
/* (137) as ::= AS ids */
{
259
,
0
},
/* (137) sclp ::= */
{
259
,
-
1
},
/* (138) as ::= ids */
{
247
,
-
3
},
/* (138) selcollist ::= sclp expr as */
{
259
,
0
},
/* (139) as ::= */
{
247
,
-
2
},
/* (139) selcollist ::= sclp STAR */
{
246
,
-
2
},
/* (140) from ::= FROM tablelist */
{
261
,
-
2
},
/* (140) as ::= AS ids */
{
260
,
-
2
},
/* (141) tablelist ::= ids cpxName */
{
261
,
-
1
},
/* (141) as ::= ids */
{
260
,
-
4
},
/* (142) tablelist ::= tablelist COMMA ids cpxName */
{
261
,
0
},
/* (142) as ::= */
{
261
,
-
1
},
/* (143) tmvar ::= VARIABLE */
{
248
,
-
2
},
/* (143) from ::= FROM tablelist */
{
248
,
-
4
},
/* (144) interval_opt ::= INTERVAL LP tmvar RP */
{
262
,
-
2
},
/* (144) tablelist ::= ids cpxName */
{
248
,
0
},
/* (145) interval_opt ::= */
{
262
,
-
4
},
/* (145) tablelist ::= tablelist COMMA ids cpxName */
{
249
,
0
},
/* (146) fill_opt ::= */
{
263
,
-
1
},
/* (146) tmvar ::= VARIABLE */
{
249
,
-
6
},
/* (147) fill_opt ::= FILL LP ID COMMA tagitemlist RP */
{
250
,
-
4
},
/* (147) interval_opt ::= INTERVAL LP tmvar RP */
{
249
,
-
4
},
/* (148) fill_opt ::= FILL LP ID RP */
{
250
,
0
},
/* (148) interval_opt ::= */
{
250
,
-
4
},
/* (149) sliding_opt ::= SLIDING LP tmvar RP */
{
251
,
0
},
/* (149) fill_opt ::= */
{
250
,
0
},
/* (150) sliding_opt ::= */
{
251
,
-
6
},
/* (150) fill_opt ::= FILL LP ID COMMA tagitemlist RP */
{
252
,
0
},
/* (151) orderby_opt ::= */
{
251
,
-
4
},
/* (151) fill_opt ::= FILL LP ID RP */
{
252
,
-
3
},
/* (152) orderby_opt ::= ORDER BY sortlist */
{
252
,
-
4
},
/* (152) sliding_opt ::= SLIDING LP tmvar RP */
{
262
,
-
4
},
/* (153) sortlist ::= sortlist COMMA item sortorder */
{
252
,
0
},
/* (153) sliding_opt ::= */
{
262
,
-
2
},
/* (154) sortlist ::= item sortorder */
{
254
,
0
},
/* (154) orderby_opt ::= */
{
264
,
-
2
},
/* (155) item ::= ids cpxName */
{
254
,
-
3
},
/* (155) orderby_opt ::= ORDER BY sortlist */
{
265
,
-
1
},
/* (156) sortorder ::= ASC */
{
264
,
-
4
},
/* (156) sortlist ::= sortlist COMMA item sortorder */
{
265
,
-
1
},
/* (157) sortorder ::= DESC */
{
264
,
-
2
},
/* (157) sortlist ::= item sortorder */
{
265
,
0
},
/* (158) sortorder ::= */
{
266
,
-
2
},
/* (158) item ::= ids cpxName */
{
251
,
0
},
/* (159) groupby_opt ::= */
{
267
,
-
1
},
/* (159) sortorder ::= ASC */
{
251
,
-
3
},
/* (160) groupby_opt ::= GROUP BY grouplist */
{
267
,
-
1
},
/* (160) sortorder ::= DESC */
{
266
,
-
3
},
/* (161) grouplist ::= grouplist COMMA item */
{
267
,
0
},
/* (161) sortorder ::= */
{
266
,
-
1
},
/* (162) grouplist ::= item */
{
253
,
0
},
/* (162) groupby_opt ::= */
{
253
,
0
},
/* (163) having_opt ::= */
{
253
,
-
3
},
/* (163) groupby_opt ::= GROUP BY grouplist */
{
253
,
-
2
},
/* (164) having_opt ::= HAVING expr */
{
268
,
-
3
},
/* (164) grouplist ::= grouplist COMMA item */
{
255
,
0
},
/* (165) limit_opt ::= */
{
268
,
-
1
},
/* (165) grouplist ::= item */
{
255
,
-
2
},
/* (166) limit_opt ::= LIMIT signed */
{
255
,
0
},
/* (166) having_opt ::= */
{
255
,
-
4
},
/* (167) limit_opt ::= LIMIT signed OFFSET signed */
{
255
,
-
2
},
/* (167) having_opt ::= HAVING expr */
{
255
,
-
4
},
/* (168) limit_opt ::= LIMIT signed COMMA signed */
{
257
,
0
},
/* (168) limit_opt ::= */
{
254
,
0
},
/* (169) slimit_opt ::= */
{
257
,
-
2
},
/* (169) limit_opt ::= LIMIT signed */
{
254
,
-
2
},
/* (170) slimit_opt ::= SLIMIT signed */
{
257
,
-
4
},
/* (170) limit_opt ::= LIMIT signed OFFSET signed */
{
254
,
-
4
},
/* (171) slimit_opt ::= SLIMIT signed SOFFSET signed */
{
257
,
-
4
},
/* (171) limit_opt ::= LIMIT signed COMMA signed */
{
254
,
-
4
},
/* (172) slimit_opt ::= SLIMIT signed COMMA signed */
{
256
,
0
},
/* (172) slimit_opt ::= */
{
247
,
0
},
/* (173) where_opt ::= */
{
256
,
-
2
},
/* (173) slimit_opt ::= SLIMIT signed */
{
247
,
-
2
},
/* (174) where_opt ::= WHERE expr */
{
256
,
-
4
},
/* (174) slimit_opt ::= SLIMIT signed SOFFSET signed */
{
258
,
-
3
},
/* (175) expr ::= LP expr RP */
{
256
,
-
4
},
/* (175) slimit_opt ::= SLIMIT signed COMMA signed */
{
258
,
-
1
},
/* (176) expr ::= ID */
{
249
,
0
},
/* (176) where_opt ::= */
{
258
,
-
3
},
/* (177) expr ::= ID DOT ID */
{
249
,
-
2
},
/* (177) where_opt ::= WHERE expr */
{
258
,
-
3
},
/* (178) expr ::= ID DOT STAR */
{
260
,
-
3
},
/* (178) expr ::= LP expr RP */
{
258
,
-
1
},
/* (179) expr ::= INTEGER */
{
260
,
-
1
},
/* (179) expr ::= ID */
{
258
,
-
2
},
/* (180) expr ::= MINUS INTEGER */
{
260
,
-
3
},
/* (180) expr ::= ID DOT ID */
{
258
,
-
2
},
/* (181) expr ::= PLUS INTEGER */
{
260
,
-
3
},
/* (181) expr ::= ID DOT STAR */
{
258
,
-
1
},
/* (182) expr ::= FLOAT */
{
260
,
-
1
},
/* (182) expr ::= INTEGER */
{
258
,
-
2
},
/* (183) expr ::= MINUS FLOAT */
{
260
,
-
2
},
/* (183) expr ::= MINUS INTEGER */
{
258
,
-
2
},
/* (184) expr ::= PLUS FLOAT */
{
260
,
-
2
},
/* (184) expr ::= PLUS INTEGER */
{
258
,
-
1
},
/* (185) expr ::= STRING */
{
260
,
-
1
},
/* (185) expr ::= FLOAT */
{
258
,
-
1
},
/* (186) expr ::= NOW */
{
260
,
-
2
},
/* (186) expr ::= MINUS FLOAT */
{
258
,
-
1
},
/* (187) expr ::= VARIABLE */
{
260
,
-
2
},
/* (187) expr ::= PLUS FLOAT */
{
258
,
-
1
},
/* (188) expr ::= BOOL */
{
260
,
-
1
},
/* (188) expr ::= STRING */
{
258
,
-
4
},
/* (189) expr ::= ID LP exprlist RP */
{
260
,
-
1
},
/* (189) expr ::= NOW */
{
258
,
-
4
},
/* (190) expr ::= ID LP STAR RP */
{
260
,
-
1
},
/* (190) expr ::= VARIABLE */
{
258
,
-
3
},
/* (191) expr ::= expr AND expr */
{
260
,
-
1
},
/* (191) expr ::= BOOL */
{
258
,
-
3
},
/* (192) expr ::= expr OR expr */
{
260
,
-
4
},
/* (192) expr ::= ID LP exprlist RP */
{
258
,
-
3
},
/* (193) expr ::= expr LT expr */
{
260
,
-
4
},
/* (193) expr ::= ID LP STAR RP */
{
258
,
-
3
},
/* (194) expr ::= expr GT expr */
{
260
,
-
3
},
/* (194) expr ::= expr AND expr */
{
258
,
-
3
},
/* (195) expr ::= expr LE expr */
{
260
,
-
3
},
/* (195) expr ::= expr OR expr */
{
258
,
-
3
},
/* (196) expr ::= expr GE expr */
{
260
,
-
3
},
/* (196) expr ::= expr LT expr */
{
258
,
-
3
},
/* (197) expr ::= expr NE expr */
{
260
,
-
3
},
/* (197) expr ::= expr GT expr */
{
258
,
-
3
},
/* (198) expr ::= expr EQ expr */
{
260
,
-
3
},
/* (198) expr ::= expr LE expr */
{
258
,
-
3
},
/* (199) expr ::= expr PLUS expr */
{
260
,
-
3
},
/* (199) expr ::= expr GE expr */
{
258
,
-
3
},
/* (200) expr ::= expr MINUS expr */
{
260
,
-
3
},
/* (200) expr ::= expr NE expr */
{
258
,
-
3
},
/* (201) expr ::= expr STAR expr */
{
260
,
-
3
},
/* (201) expr ::= expr EQ expr */
{
258
,
-
3
},
/* (202) expr ::= expr SLASH expr */
{
260
,
-
3
},
/* (202) expr ::= expr PLUS expr */
{
258
,
-
3
},
/* (203) expr ::= expr REM expr */
{
260
,
-
3
},
/* (203) expr ::= expr MINUS expr */
{
258
,
-
3
},
/* (204) expr ::= expr LIKE expr */
{
260
,
-
3
},
/* (204) expr ::= expr STAR expr */
{
258
,
-
5
},
/* (205) expr ::= expr IN LP exprlist RP */
{
260
,
-
3
},
/* (205) expr ::= expr SLASH expr */
{
267
,
-
3
},
/* (206) exprlist ::= exprlist COMMA expritem */
{
260
,
-
3
},
/* (206) expr ::= expr REM expr */
{
267
,
-
1
},
/* (207) exprlist ::= expritem */
{
260
,
-
3
},
/* (207) expr ::= expr LIKE expr */
{
268
,
-
1
},
/* (208) expritem ::= expr */
{
260
,
-
5
},
/* (208) expr ::= expr IN LP exprlist RP */
{
268
,
0
},
/* (209) expritem ::= */
{
269
,
-
3
},
/* (209) exprlist ::= exprlist COMMA expritem */
{
207
,
-
3
},
/* (210) cmd ::= RESET QUERY CACHE */
{
269
,
-
1
},
/* (210) exprlist ::= expritem */
{
207
,
-
7
},
/* (211) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
{
270
,
-
1
},
/* (211) expritem ::= expr */
{
207
,
-
7
},
/* (212) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
{
270
,
0
},
/* (212) expritem ::= */
{
207
,
-
7
},
/* (213) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
{
208
,
-
3
},
/* (213) cmd ::= RESET QUERY CACHE */
{
207
,
-
7
},
/* (214) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
{
208
,
-
7
},
/* (214) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
{
207
,
-
8
},
/* (215) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
{
208
,
-
7
},
/* (215) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
{
207
,
-
9
},
/* (216) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
{
208
,
-
7
},
/* (216) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
{
207
,
-
3
},
/* (217) cmd ::= KILL CONNECTION INTEGER */
{
208
,
-
7
},
/* (217) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
{
207
,
-
5
},
/* (218) cmd ::= KILL STREAM INTEGER COLON INTEGER */
{
208
,
-
8
},
/* (218) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
{
207
,
-
5
},
/* (219) cmd ::= KILL QUERY INTEGER COLON INTEGER */
{
208
,
-
9
},
/* (219) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
{
208
,
-
3
},
/* (220) cmd ::= KILL CONNECTION INTEGER */
{
208
,
-
5
},
/* (221) cmd ::= KILL STREAM INTEGER COLON INTEGER */
{
208
,
-
5
},
/* (222) cmd ::= KILL QUERY INTEGER COLON INTEGER */
};
};
static
void
yy_accept
(
yyParser
*
);
/* Forward Declaration */
static
void
yy_accept
(
yyParser
*
);
/* Forward Declaration */
...
@@ -2114,13 +2124,13 @@ static void yy_reduce(
...
@@ -2114,13 +2124,13 @@ static void yy_reduce(
{
setDCLSQLElems
(
pInfo
,
TSDB_SQL_CFG_LOCAL
,
2
,
&
yymsp
[
-
1
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
);
}
{
setDCLSQLElems
(
pInfo
,
TSDB_SQL_CFG_LOCAL
,
2
,
&
yymsp
[
-
1
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
);
}
break
;
break
;
case
38
:
/* cmd ::= ALTER DATABASE ids alter_db_optr */
case
38
:
/* cmd ::= ALTER DATABASE ids alter_db_optr */
{
SSQLToken
t
=
{
0
};
setCreateDBSQL
(
pInfo
,
TSDB_SQL_ALTER_DB
,
&
yymsp
[
-
1
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy
374
,
&
t
);}
{
SSQLToken
t
=
{
0
};
setCreateDBSQL
(
pInfo
,
TSDB_SQL_ALTER_DB
,
&
yymsp
[
-
1
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy
158
,
&
t
);}
break
;
break
;
case
39
:
/* cmd ::= ALTER ACCOUNT ids acct_optr */
case
39
:
/* cmd ::= ALTER ACCOUNT ids acct_optr */
{
setCreateAcctSQL
(
pInfo
,
TSDB_SQL_ALTER_ACCT
,
&
yymsp
[
-
1
].
minor
.
yy0
,
NULL
,
&
yymsp
[
0
].
minor
.
yy
219
);}
{
setCreateAcctSQL
(
pInfo
,
TSDB_SQL_ALTER_ACCT
,
&
yymsp
[
-
1
].
minor
.
yy0
,
NULL
,
&
yymsp
[
0
].
minor
.
yy
73
);}
break
;
break
;
case
40
:
/* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
case
40
:
/* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
{
setCreateAcctSQL
(
pInfo
,
TSDB_SQL_ALTER_ACCT
,
&
yymsp
[
-
3
].
minor
.
yy0
,
&
yymsp
[
-
1
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy
219
);}
{
setCreateAcctSQL
(
pInfo
,
TSDB_SQL_ALTER_ACCT
,
&
yymsp
[
-
3
].
minor
.
yy0
,
&
yymsp
[
-
1
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy
73
);}
break
;
break
;
case
41
:
/* ids ::= ID */
case
41
:
/* ids ::= ID */
case
42
:
/* ids ::= STRING */
yytestcase
(
yyruleno
==
42
);
case
42
:
/* ids ::= STRING */
yytestcase
(
yyruleno
==
42
);
...
@@ -2141,10 +2151,10 @@ static void yy_reduce(
...
@@ -2141,10 +2151,10 @@ static void yy_reduce(
{
setDCLSQLElems
(
pInfo
,
TSDB_SQL_CREATE_DNODE
,
1
,
&
yymsp
[
0
].
minor
.
yy0
);}
{
setDCLSQLElems
(
pInfo
,
TSDB_SQL_CREATE_DNODE
,
1
,
&
yymsp
[
0
].
minor
.
yy0
);}
break
;
break
;
case
48
:
/* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
case
48
:
/* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
{
setCreateAcctSQL
(
pInfo
,
TSDB_SQL_CREATE_ACCT
,
&
yymsp
[
-
3
].
minor
.
yy0
,
&
yymsp
[
-
1
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy
219
);}
{
setCreateAcctSQL
(
pInfo
,
TSDB_SQL_CREATE_ACCT
,
&
yymsp
[
-
3
].
minor
.
yy0
,
&
yymsp
[
-
1
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy
73
);}
break
;
break
;
case
49
:
/* cmd ::= CREATE DATABASE ifnotexists ids db_optr */
case
49
:
/* cmd ::= CREATE DATABASE ifnotexists ids db_optr */
{
setCreateDBSQL
(
pInfo
,
TSDB_SQL_CREATE_DB
,
&
yymsp
[
-
1
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy
374
,
&
yymsp
[
-
2
].
minor
.
yy0
);}
{
setCreateDBSQL
(
pInfo
,
TSDB_SQL_CREATE_DB
,
&
yymsp
[
-
1
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy
158
,
&
yymsp
[
-
2
].
minor
.
yy0
);}
break
;
break
;
case
50
:
/* cmd ::= CREATE USER ids PASS ids */
case
50
:
/* cmd ::= CREATE USER ids PASS ids */
{
setCreateUserSQL
(
pInfo
,
&
yymsp
[
-
2
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
);}
{
setCreateUserSQL
(
pInfo
,
&
yymsp
[
-
2
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
);}
...
@@ -2173,20 +2183,20 @@ static void yy_reduce(
...
@@ -2173,20 +2183,20 @@ static void yy_reduce(
break
;
break
;
case
69
:
/* acct_optr ::= pps tseries storage streams qtime dbs users conns state */
case
69
:
/* acct_optr ::= pps tseries storage streams qtime dbs users conns state */
{
{
yylhsminor
.
yy
219
.
maxUsers
=
(
yymsp
[
-
2
].
minor
.
yy0
.
n
>
0
)
?
atoi
(
yymsp
[
-
2
].
minor
.
yy0
.
z
)
:-
1
;
yylhsminor
.
yy
73
.
maxUsers
=
(
yymsp
[
-
2
].
minor
.
yy0
.
n
>
0
)
?
atoi
(
yymsp
[
-
2
].
minor
.
yy0
.
z
)
:-
1
;
yylhsminor
.
yy
219
.
maxDbs
=
(
yymsp
[
-
3
].
minor
.
yy0
.
n
>
0
)
?
atoi
(
yymsp
[
-
3
].
minor
.
yy0
.
z
)
:-
1
;
yylhsminor
.
yy
73
.
maxDbs
=
(
yymsp
[
-
3
].
minor
.
yy0
.
n
>
0
)
?
atoi
(
yymsp
[
-
3
].
minor
.
yy0
.
z
)
:-
1
;
yylhsminor
.
yy
219
.
maxTimeSeries
=
(
yymsp
[
-
7
].
minor
.
yy0
.
n
>
0
)
?
atoi
(
yymsp
[
-
7
].
minor
.
yy0
.
z
)
:-
1
;
yylhsminor
.
yy
73
.
maxTimeSeries
=
(
yymsp
[
-
7
].
minor
.
yy0
.
n
>
0
)
?
atoi
(
yymsp
[
-
7
].
minor
.
yy0
.
z
)
:-
1
;
yylhsminor
.
yy
219
.
maxStreams
=
(
yymsp
[
-
5
].
minor
.
yy0
.
n
>
0
)
?
atoi
(
yymsp
[
-
5
].
minor
.
yy0
.
z
)
:-
1
;
yylhsminor
.
yy
73
.
maxStreams
=
(
yymsp
[
-
5
].
minor
.
yy0
.
n
>
0
)
?
atoi
(
yymsp
[
-
5
].
minor
.
yy0
.
z
)
:-
1
;
yylhsminor
.
yy
219
.
maxPointsPerSecond
=
(
yymsp
[
-
8
].
minor
.
yy0
.
n
>
0
)
?
atoi
(
yymsp
[
-
8
].
minor
.
yy0
.
z
)
:-
1
;
yylhsminor
.
yy
73
.
maxPointsPerSecond
=
(
yymsp
[
-
8
].
minor
.
yy0
.
n
>
0
)
?
atoi
(
yymsp
[
-
8
].
minor
.
yy0
.
z
)
:-
1
;
yylhsminor
.
yy
219
.
maxStorage
=
(
yymsp
[
-
6
].
minor
.
yy0
.
n
>
0
)
?
strtoll
(
yymsp
[
-
6
].
minor
.
yy0
.
z
,
NULL
,
10
)
:-
1
;
yylhsminor
.
yy
73
.
maxStorage
=
(
yymsp
[
-
6
].
minor
.
yy0
.
n
>
0
)
?
strtoll
(
yymsp
[
-
6
].
minor
.
yy0
.
z
,
NULL
,
10
)
:-
1
;
yylhsminor
.
yy
219
.
maxQueryTime
=
(
yymsp
[
-
4
].
minor
.
yy0
.
n
>
0
)
?
strtoll
(
yymsp
[
-
4
].
minor
.
yy0
.
z
,
NULL
,
10
)
:-
1
;
yylhsminor
.
yy
73
.
maxQueryTime
=
(
yymsp
[
-
4
].
minor
.
yy0
.
n
>
0
)
?
strtoll
(
yymsp
[
-
4
].
minor
.
yy0
.
z
,
NULL
,
10
)
:-
1
;
yylhsminor
.
yy
219
.
maxConnections
=
(
yymsp
[
-
1
].
minor
.
yy0
.
n
>
0
)
?
atoi
(
yymsp
[
-
1
].
minor
.
yy0
.
z
)
:-
1
;
yylhsminor
.
yy
73
.
maxConnections
=
(
yymsp
[
-
1
].
minor
.
yy0
.
n
>
0
)
?
atoi
(
yymsp
[
-
1
].
minor
.
yy0
.
z
)
:-
1
;
yylhsminor
.
yy
219
.
stat
=
yymsp
[
0
].
minor
.
yy0
;
yylhsminor
.
yy
73
.
stat
=
yymsp
[
0
].
minor
.
yy0
;
}
}
yymsp
[
-
8
].
minor
.
yy
219
=
yylhsminor
.
yy219
;
yymsp
[
-
8
].
minor
.
yy
73
=
yylhsminor
.
yy73
;
break
;
break
;
case
70
:
/* keep ::= KEEP tagitemlist */
case
70
:
/* keep ::= KEEP tagitemlist */
{
yymsp
[
-
1
].
minor
.
yy
322
=
yymsp
[
0
].
minor
.
yy322
;
}
{
yymsp
[
-
1
].
minor
.
yy
494
=
yymsp
[
0
].
minor
.
yy494
;
}
break
;
break
;
case
71
:
/* tables ::= MAXTABLES INTEGER */
case
71
:
/* tables ::= MAXTABLES INTEGER */
case
72
:
/* cache ::= CACHE INTEGER */
yytestcase
(
yyruleno
==
72
);
case
72
:
/* cache ::= CACHE INTEGER */
yytestcase
(
yyruleno
==
72
);
...
@@ -2197,496 +2207,505 @@ static void yy_reduce(
...
@@ -2197,496 +2207,505 @@ static void yy_reduce(
case
77
:
/* blocks ::= BLOCKS INTEGER */
yytestcase
(
yyruleno
==
77
);
case
77
:
/* blocks ::= BLOCKS INTEGER */
yytestcase
(
yyruleno
==
77
);
case
78
:
/* ctime ::= CTIME INTEGER */
yytestcase
(
yyruleno
==
78
);
case
78
:
/* ctime ::= CTIME INTEGER */
yytestcase
(
yyruleno
==
78
);
case
79
:
/* wal ::= WAL INTEGER */
yytestcase
(
yyruleno
==
79
);
case
79
:
/* wal ::= WAL INTEGER */
yytestcase
(
yyruleno
==
79
);
case
80
:
/* comp ::= COMP INTEGER */
yytestcase
(
yyruleno
==
80
);
case
80
:
/* fsync ::= FSYNC INTEGER */
yytestcase
(
yyruleno
==
80
);
case
81
:
/* prec ::= PRECISION STRING */
yytestcase
(
yyruleno
==
81
);
case
81
:
/* comp ::= COMP INTEGER */
yytestcase
(
yyruleno
==
81
);
case
82
:
/* prec ::= PRECISION STRING */
yytestcase
(
yyruleno
==
82
);
{
yymsp
[
-
1
].
minor
.
yy0
=
yymsp
[
0
].
minor
.
yy0
;
}
{
yymsp
[
-
1
].
minor
.
yy0
=
yymsp
[
0
].
minor
.
yy0
;
}
break
;
break
;
case
82
:
/* db_optr ::= */
case
83
:
/* db_optr ::= */
{
setDefaultCreateDbOption
(
&
yymsp
[
1
].
minor
.
yy374
);}
{
setDefaultCreateDbOption
(
&
yymsp
[
1
].
minor
.
yy158
);}
break
;
case
84
:
/* db_optr ::= db_optr tables */
case
99
:
/* alter_db_optr ::= alter_db_optr tables */
yytestcase
(
yyruleno
==
99
);
{
yylhsminor
.
yy158
=
yymsp
[
-
1
].
minor
.
yy158
;
yylhsminor
.
yy158
.
maxTablesPerVnode
=
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);
}
yymsp
[
-
1
].
minor
.
yy158
=
yylhsminor
.
yy158
;
break
;
case
85
:
/* db_optr ::= db_optr cache */
{
yylhsminor
.
yy158
=
yymsp
[
-
1
].
minor
.
yy158
;
yylhsminor
.
yy158
.
cacheBlockSize
=
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);
}
yymsp
[
-
1
].
minor
.
yy158
=
yylhsminor
.
yy158
;
break
;
break
;
case
8
3
:
/* db_optr ::= db_optr tables
*/
case
8
6
:
/* db_optr ::= db_optr replica
*/
case
9
7
:
/* alter_db_optr ::= alter_db_optr tables */
yytestcase
(
yyruleno
==
97
);
case
9
8
:
/* alter_db_optr ::= alter_db_optr replica */
yytestcase
(
yyruleno
==
98
);
{
yylhsminor
.
yy
374
=
yymsp
[
-
1
].
minor
.
yy374
;
yylhsminor
.
yy374
.
maxTablesPerVnode
=
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);
}
{
yylhsminor
.
yy
158
=
yymsp
[
-
1
].
minor
.
yy158
;
yylhsminor
.
yy158
.
replica
=
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);
}
yymsp
[
-
1
].
minor
.
yy
374
=
yylhsminor
.
yy374
;
yymsp
[
-
1
].
minor
.
yy
158
=
yylhsminor
.
yy158
;
break
;
break
;
case
8
4
:
/* db_optr ::= db_optr cache
*/
case
8
7
:
/* db_optr ::= db_optr days
*/
{
yylhsminor
.
yy
374
=
yymsp
[
-
1
].
minor
.
yy374
;
yylhsminor
.
yy374
.
cacheBlockSiz
e
=
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);
}
{
yylhsminor
.
yy
158
=
yymsp
[
-
1
].
minor
.
yy158
;
yylhsminor
.
yy158
.
daysPerFil
e
=
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);
}
yymsp
[
-
1
].
minor
.
yy
374
=
yylhsminor
.
yy374
;
yymsp
[
-
1
].
minor
.
yy
158
=
yylhsminor
.
yy158
;
break
;
break
;
case
85
:
/* db_optr ::= db_optr replica */
case
88
:
/* db_optr ::= db_optr minrows */
case
96
:
/* alter_db_optr ::= alter_db_optr replica */
yytestcase
(
yyruleno
==
96
);
{
yylhsminor
.
yy158
=
yymsp
[
-
1
].
minor
.
yy158
;
yylhsminor
.
yy158
.
minRowsPerBlock
=
strtod
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
);
}
{
yylhsminor
.
yy374
=
yymsp
[
-
1
].
minor
.
yy374
;
yylhsminor
.
yy374
.
replica
=
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);
}
yymsp
[
-
1
].
minor
.
yy158
=
yylhsminor
.
yy158
;
yymsp
[
-
1
].
minor
.
yy374
=
yylhsminor
.
yy374
;
break
;
break
;
case
8
6
:
/* db_optr ::= db_optr day
s */
case
8
9
:
/* db_optr ::= db_optr maxrow
s */
{
yylhsminor
.
yy
374
=
yymsp
[
-
1
].
minor
.
yy374
;
yylhsminor
.
yy374
.
daysPerFile
=
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);
}
{
yylhsminor
.
yy
158
=
yymsp
[
-
1
].
minor
.
yy158
;
yylhsminor
.
yy158
.
maxRowsPerBlock
=
strtod
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
);
}
yymsp
[
-
1
].
minor
.
yy
374
=
yylhsminor
.
yy374
;
yymsp
[
-
1
].
minor
.
yy
158
=
yylhsminor
.
yy158
;
break
;
break
;
case
87
:
/* db_optr ::= db_optr minrows */
case
90
:
/* db_optr ::= db_optr blocks */
{
yylhsminor
.
yy374
=
yymsp
[
-
1
].
minor
.
yy374
;
yylhsminor
.
yy374
.
minRowsPerBlock
=
strtod
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
);
}
case
101
:
/* alter_db_optr ::= alter_db_optr blocks */
yytestcase
(
yyruleno
==
101
);
yymsp
[
-
1
].
minor
.
yy374
=
yylhsminor
.
yy374
;
{
yylhsminor
.
yy158
=
yymsp
[
-
1
].
minor
.
yy158
;
yylhsminor
.
yy158
.
numOfBlocks
=
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);
}
yymsp
[
-
1
].
minor
.
yy158
=
yylhsminor
.
yy158
;
break
;
break
;
case
88
:
/* db_optr ::= db_optr maxrows
*/
case
91
:
/* db_optr ::= db_optr ctime
*/
{
yylhsminor
.
yy
374
=
yymsp
[
-
1
].
minor
.
yy374
;
yylhsminor
.
yy374
.
maxRowsPerBlock
=
strtod
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
);
}
{
yylhsminor
.
yy
158
=
yymsp
[
-
1
].
minor
.
yy158
;
yylhsminor
.
yy158
.
commitTime
=
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);
}
yymsp
[
-
1
].
minor
.
yy
374
=
yylhsminor
.
yy374
;
yymsp
[
-
1
].
minor
.
yy
158
=
yylhsminor
.
yy158
;
break
;
break
;
case
89
:
/* db_optr ::= db_optr blocks
*/
case
92
:
/* db_optr ::= db_optr wal
*/
case
99
:
/* alter_db_optr ::= alter_db_optr blocks */
yytestcase
(
yyruleno
==
99
);
case
103
:
/* alter_db_optr ::= alter_db_optr wal */
yytestcase
(
yyruleno
==
103
);
{
yylhsminor
.
yy
374
=
yymsp
[
-
1
].
minor
.
yy374
;
yylhsminor
.
yy374
.
numOfBlocks
=
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);
}
{
yylhsminor
.
yy
158
=
yymsp
[
-
1
].
minor
.
yy158
;
yylhsminor
.
yy158
.
walLevel
=
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);
}
yymsp
[
-
1
].
minor
.
yy
374
=
yylhsminor
.
yy374
;
yymsp
[
-
1
].
minor
.
yy
158
=
yylhsminor
.
yy158
;
break
;
break
;
case
9
0
:
/* db_optr ::= db_optr ctime
*/
case
9
3
:
/* db_optr ::= db_optr fsync
*/
{
yylhsminor
.
yy
374
=
yymsp
[
-
1
].
minor
.
yy374
;
yylhsminor
.
yy374
.
commitTime
=
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);
}
{
yylhsminor
.
yy
158
=
yymsp
[
-
1
].
minor
.
yy158
;
yylhsminor
.
yy158
.
fsyncPeriod
=
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);
}
yymsp
[
-
1
].
minor
.
yy
374
=
yylhsminor
.
yy374
;
yymsp
[
-
1
].
minor
.
yy
158
=
yylhsminor
.
yy158
;
break
;
break
;
case
9
1
:
/* db_optr ::= db_optr wal
*/
case
9
4
:
/* db_optr ::= db_optr comp
*/
case
10
1
:
/* alter_db_optr ::= alter_db_optr wal */
yytestcase
(
yyruleno
==
101
);
case
10
2
:
/* alter_db_optr ::= alter_db_optr comp */
yytestcase
(
yyruleno
==
102
);
{
yylhsminor
.
yy
374
=
yymsp
[
-
1
].
minor
.
yy374
;
yylhsminor
.
yy374
.
wal
Level
=
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);
}
{
yylhsminor
.
yy
158
=
yymsp
[
-
1
].
minor
.
yy158
;
yylhsminor
.
yy158
.
compression
Level
=
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);
}
yymsp
[
-
1
].
minor
.
yy
374
=
yylhsminor
.
yy374
;
yymsp
[
-
1
].
minor
.
yy
158
=
yylhsminor
.
yy158
;
break
;
break
;
case
92
:
/* db_optr ::= db_optr comp */
case
95
:
/* db_optr ::= db_optr prec */
case
100
:
/* alter_db_optr ::= alter_db_optr comp */
yytestcase
(
yyruleno
==
100
);
{
yylhsminor
.
yy158
=
yymsp
[
-
1
].
minor
.
yy158
;
yylhsminor
.
yy158
.
precision
=
yymsp
[
0
].
minor
.
yy0
;
}
{
yylhsminor
.
yy374
=
yymsp
[
-
1
].
minor
.
yy374
;
yylhsminor
.
yy374
.
compressionLevel
=
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);
}
yymsp
[
-
1
].
minor
.
yy158
=
yylhsminor
.
yy158
;
yymsp
[
-
1
].
minor
.
yy374
=
yylhsminor
.
yy374
;
break
;
break
;
case
93
:
/* db_optr ::= db_optr prec */
case
96
:
/* db_optr ::= db_optr keep */
{
yylhsminor
.
yy374
=
yymsp
[
-
1
].
minor
.
yy374
;
yylhsminor
.
yy374
.
precision
=
yymsp
[
0
].
minor
.
yy0
;
}
case
100
:
/* alter_db_optr ::= alter_db_optr keep */
yytestcase
(
yyruleno
==
100
);
yymsp
[
-
1
].
minor
.
yy374
=
yylhsminor
.
yy374
;
{
yylhsminor
.
yy158
=
yymsp
[
-
1
].
minor
.
yy158
;
yylhsminor
.
yy158
.
keep
=
yymsp
[
0
].
minor
.
yy494
;
}
yymsp
[
-
1
].
minor
.
yy158
=
yylhsminor
.
yy158
;
break
;
break
;
case
94
:
/* db_optr ::= db_optr keep */
case
97
:
/* alter_db_optr ::= */
case
98
:
/* alter_db_optr ::= alter_db_optr keep */
yytestcase
(
yyruleno
==
98
);
{
setDefaultCreateDbOption
(
&
yymsp
[
1
].
minor
.
yy158
);}
{
yylhsminor
.
yy374
=
yymsp
[
-
1
].
minor
.
yy374
;
yylhsminor
.
yy374
.
keep
=
yymsp
[
0
].
minor
.
yy322
;
}
yymsp
[
-
1
].
minor
.
yy374
=
yylhsminor
.
yy374
;
break
;
break
;
case
95
:
/* alter_db_optr ::= */
case
104
:
/* alter_db_optr ::= alter_db_optr fsync */
{
setDefaultCreateDbOption
(
&
yymsp
[
1
].
minor
.
yy374
);}
{
yylhsminor
.
yy158
=
yymsp
[
-
1
].
minor
.
yy158
;
yylhsminor
.
yy158
.
fsyncPeriod
=
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);
}
yymsp
[
-
1
].
minor
.
yy158
=
yylhsminor
.
yy158
;
break
;
break
;
case
10
2
:
/* typename ::= ids */
case
10
5
:
/* typename ::= ids */
{
{
yymsp
[
0
].
minor
.
yy0
.
type
=
0
;
yymsp
[
0
].
minor
.
yy0
.
type
=
0
;
tSQLSetColumnType
(
&
yylhsminor
.
yy
325
,
&
yymsp
[
0
].
minor
.
yy0
);
tSQLSetColumnType
(
&
yylhsminor
.
yy
181
,
&
yymsp
[
0
].
minor
.
yy0
);
}
}
yymsp
[
0
].
minor
.
yy
325
=
yylhsminor
.
yy325
;
yymsp
[
0
].
minor
.
yy
181
=
yylhsminor
.
yy181
;
break
;
break
;
case
10
3
:
/* typename ::= ids LP signed RP */
case
10
6
:
/* typename ::= ids LP signed RP */
{
{
if
(
yymsp
[
-
1
].
minor
.
yy27
9
<=
0
)
{
if
(
yymsp
[
-
1
].
minor
.
yy27
1
<=
0
)
{
yymsp
[
-
3
].
minor
.
yy0
.
type
=
0
;
yymsp
[
-
3
].
minor
.
yy0
.
type
=
0
;
tSQLSetColumnType
(
&
yylhsminor
.
yy
325
,
&
yymsp
[
-
3
].
minor
.
yy0
);
tSQLSetColumnType
(
&
yylhsminor
.
yy
181
,
&
yymsp
[
-
3
].
minor
.
yy0
);
}
else
{
}
else
{
yymsp
[
-
3
].
minor
.
yy0
.
type
=
-
yymsp
[
-
1
].
minor
.
yy27
9
;
// negative value of name length
yymsp
[
-
3
].
minor
.
yy0
.
type
=
-
yymsp
[
-
1
].
minor
.
yy27
1
;
// negative value of name length
tSQLSetColumnType
(
&
yylhsminor
.
yy
325
,
&
yymsp
[
-
3
].
minor
.
yy0
);
tSQLSetColumnType
(
&
yylhsminor
.
yy
181
,
&
yymsp
[
-
3
].
minor
.
yy0
);
}
}
}
}
yymsp
[
-
3
].
minor
.
yy
325
=
yylhsminor
.
yy325
;
yymsp
[
-
3
].
minor
.
yy
181
=
yylhsminor
.
yy181
;
break
;
break
;
case
10
4
:
/* signed ::= INTEGER */
case
10
7
:
/* signed ::= INTEGER */
{
yylhsminor
.
yy27
9
=
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);
}
{
yylhsminor
.
yy27
1
=
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);
}
yymsp
[
0
].
minor
.
yy27
9
=
yylhsminor
.
yy279
;
yymsp
[
0
].
minor
.
yy27
1
=
yylhsminor
.
yy271
;
break
;
break
;
case
10
5
:
/* signed ::= PLUS INTEGER */
case
10
8
:
/* signed ::= PLUS INTEGER */
{
yymsp
[
-
1
].
minor
.
yy27
9
=
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);
}
{
yymsp
[
-
1
].
minor
.
yy27
1
=
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);
}
break
;
break
;
case
10
6
:
/* signed ::= MINUS INTEGER */
case
10
9
:
/* signed ::= MINUS INTEGER */
{
yymsp
[
-
1
].
minor
.
yy27
9
=
-
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);}
{
yymsp
[
-
1
].
minor
.
yy27
1
=
-
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);}
break
;
break
;
case
1
07
:
/* cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args */
case
1
10
:
/* cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args */
{
{
yymsp
[
-
2
].
minor
.
yy0
.
n
+=
yymsp
[
-
1
].
minor
.
yy0
.
n
;
yymsp
[
-
2
].
minor
.
yy0
.
n
+=
yymsp
[
-
1
].
minor
.
yy0
.
n
;
setCreatedTableName
(
pInfo
,
&
yymsp
[
-
2
].
minor
.
yy0
,
&
yymsp
[
-
3
].
minor
.
yy0
);
setCreatedTableName
(
pInfo
,
&
yymsp
[
-
2
].
minor
.
yy0
,
&
yymsp
[
-
3
].
minor
.
yy0
);
}
}
break
;
break
;
case
1
08
:
/* create_table_args ::= LP columnlist RP */
case
1
11
:
/* create_table_args ::= LP columnlist RP */
{
{
yymsp
[
-
2
].
minor
.
yy
408
=
tSetCreateSQLElems
(
yymsp
[
-
1
].
minor
.
yy36
9
,
NULL
,
NULL
,
NULL
,
NULL
,
TSQL_CREATE_TABLE
);
yymsp
[
-
2
].
minor
.
yy
374
=
tSetCreateSQLElems
(
yymsp
[
-
1
].
minor
.
yy44
9
,
NULL
,
NULL
,
NULL
,
NULL
,
TSQL_CREATE_TABLE
);
setSQLInfo
(
pInfo
,
yymsp
[
-
2
].
minor
.
yy
408
,
NULL
,
TSDB_SQL_CREATE_TABLE
);
setSQLInfo
(
pInfo
,
yymsp
[
-
2
].
minor
.
yy
374
,
NULL
,
TSDB_SQL_CREATE_TABLE
);
}
}
break
;
break
;
case
1
09
:
/* create_table_args ::= LP columnlist RP TAGS LP columnlist RP */
case
1
12
:
/* create_table_args ::= LP columnlist RP TAGS LP columnlist RP */
{
{
yymsp
[
-
6
].
minor
.
yy
408
=
tSetCreateSQLElems
(
yymsp
[
-
5
].
minor
.
yy369
,
yymsp
[
-
1
].
minor
.
yy36
9
,
NULL
,
NULL
,
NULL
,
TSQL_CREATE_STABLE
);
yymsp
[
-
6
].
minor
.
yy
374
=
tSetCreateSQLElems
(
yymsp
[
-
5
].
minor
.
yy449
,
yymsp
[
-
1
].
minor
.
yy44
9
,
NULL
,
NULL
,
NULL
,
TSQL_CREATE_STABLE
);
setSQLInfo
(
pInfo
,
yymsp
[
-
6
].
minor
.
yy
408
,
NULL
,
TSDB_SQL_CREATE_TABLE
);
setSQLInfo
(
pInfo
,
yymsp
[
-
6
].
minor
.
yy
374
,
NULL
,
TSDB_SQL_CREATE_TABLE
);
}
}
break
;
break
;
case
11
0
:
/* create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP */
case
11
3
:
/* create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP */
{
{
yymsp
[
-
5
].
minor
.
yy0
.
n
+=
yymsp
[
-
4
].
minor
.
yy0
.
n
;
yymsp
[
-
5
].
minor
.
yy0
.
n
+=
yymsp
[
-
4
].
minor
.
yy0
.
n
;
yymsp
[
-
6
].
minor
.
yy
408
=
tSetCreateSQLElems
(
NULL
,
NULL
,
&
yymsp
[
-
5
].
minor
.
yy0
,
yymsp
[
-
1
].
minor
.
yy322
,
NULL
,
TSQL_CREATE_TABLE_FROM_STABLE
);
yymsp
[
-
6
].
minor
.
yy
374
=
tSetCreateSQLElems
(
NULL
,
NULL
,
&
yymsp
[
-
5
].
minor
.
yy0
,
yymsp
[
-
1
].
minor
.
yy494
,
NULL
,
TSQL_CREATE_TABLE_FROM_STABLE
);
setSQLInfo
(
pInfo
,
yymsp
[
-
6
].
minor
.
yy
408
,
NULL
,
TSDB_SQL_CREATE_TABLE
);
setSQLInfo
(
pInfo
,
yymsp
[
-
6
].
minor
.
yy
374
,
NULL
,
TSDB_SQL_CREATE_TABLE
);
}
}
break
;
break
;
case
11
1
:
/* create_table_args ::= AS select */
case
11
4
:
/* create_table_args ::= AS select */
{
{
yymsp
[
-
1
].
minor
.
yy
408
=
tSetCreateSQLElems
(
NULL
,
NULL
,
NULL
,
NULL
,
yymsp
[
0
].
minor
.
yy19
0
,
TSQL_CREATE_STREAM
);
yymsp
[
-
1
].
minor
.
yy
374
=
tSetCreateSQLElems
(
NULL
,
NULL
,
NULL
,
NULL
,
yymsp
[
0
].
minor
.
yy15
0
,
TSQL_CREATE_STREAM
);
setSQLInfo
(
pInfo
,
yymsp
[
-
1
].
minor
.
yy
408
,
NULL
,
TSDB_SQL_CREATE_TABLE
);
setSQLInfo
(
pInfo
,
yymsp
[
-
1
].
minor
.
yy
374
,
NULL
,
TSDB_SQL_CREATE_TABLE
);
}
}
break
;
break
;
case
11
2
:
/* columnlist ::= columnlist COMMA column */
case
11
5
:
/* columnlist ::= columnlist COMMA column */
{
yylhsminor
.
yy
369
=
tFieldListAppend
(
yymsp
[
-
2
].
minor
.
yy369
,
&
yymsp
[
0
].
minor
.
yy325
);
}
{
yylhsminor
.
yy
449
=
tFieldListAppend
(
yymsp
[
-
2
].
minor
.
yy449
,
&
yymsp
[
0
].
minor
.
yy181
);
}
yymsp
[
-
2
].
minor
.
yy
369
=
yylhsminor
.
yy36
9
;
yymsp
[
-
2
].
minor
.
yy
449
=
yylhsminor
.
yy44
9
;
break
;
break
;
case
11
3
:
/* columnlist ::= column */
case
11
6
:
/* columnlist ::= column */
{
yylhsminor
.
yy
369
=
tFieldListAppend
(
NULL
,
&
yymsp
[
0
].
minor
.
yy325
);}
{
yylhsminor
.
yy
449
=
tFieldListAppend
(
NULL
,
&
yymsp
[
0
].
minor
.
yy181
);}
yymsp
[
0
].
minor
.
yy
369
=
yylhsminor
.
yy36
9
;
yymsp
[
0
].
minor
.
yy
449
=
yylhsminor
.
yy44
9
;
break
;
break
;
case
11
4
:
/* column ::= ids typename */
case
11
7
:
/* column ::= ids typename */
{
{
tSQLSetColumnInfo
(
&
yylhsminor
.
yy
325
,
&
yymsp
[
-
1
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy325
);
tSQLSetColumnInfo
(
&
yylhsminor
.
yy
181
,
&
yymsp
[
-
1
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy181
);
}
}
yymsp
[
-
1
].
minor
.
yy
325
=
yylhsminor
.
yy325
;
yymsp
[
-
1
].
minor
.
yy
181
=
yylhsminor
.
yy181
;
break
;
break
;
case
11
5
:
/* tagitemlist ::= tagitemlist COMMA tagitem */
case
11
8
:
/* tagitemlist ::= tagitemlist COMMA tagitem */
{
yylhsminor
.
yy
322
=
tVariantListAppend
(
yymsp
[
-
2
].
minor
.
yy322
,
&
yymsp
[
0
].
minor
.
yy518
,
-
1
);
}
{
yylhsminor
.
yy
494
=
tVariantListAppend
(
yymsp
[
-
2
].
minor
.
yy494
,
&
yymsp
[
0
].
minor
.
yy312
,
-
1
);
}
yymsp
[
-
2
].
minor
.
yy
322
=
yylhsminor
.
yy322
;
yymsp
[
-
2
].
minor
.
yy
494
=
yylhsminor
.
yy494
;
break
;
break
;
case
11
6
:
/* tagitemlist ::= tagitem */
case
11
9
:
/* tagitemlist ::= tagitem */
{
yylhsminor
.
yy
322
=
tVariantListAppend
(
NULL
,
&
yymsp
[
0
].
minor
.
yy518
,
-
1
);
}
{
yylhsminor
.
yy
494
=
tVariantListAppend
(
NULL
,
&
yymsp
[
0
].
minor
.
yy312
,
-
1
);
}
yymsp
[
0
].
minor
.
yy
322
=
yylhsminor
.
yy322
;
yymsp
[
0
].
minor
.
yy
494
=
yylhsminor
.
yy494
;
break
;
break
;
case
1
17
:
/* tagitem ::= INTEGER */
case
1
20
:
/* tagitem ::= INTEGER */
case
1
18
:
/* tagitem ::= FLOAT */
yytestcase
(
yyruleno
==
118
);
case
1
21
:
/* tagitem ::= FLOAT */
yytestcase
(
yyruleno
==
121
);
case
1
19
:
/* tagitem ::= STRING */
yytestcase
(
yyruleno
==
119
);
case
1
22
:
/* tagitem ::= STRING */
yytestcase
(
yyruleno
==
122
);
case
12
0
:
/* tagitem ::= BOOL */
yytestcase
(
yyruleno
==
120
);
case
12
3
:
/* tagitem ::= BOOL */
yytestcase
(
yyruleno
==
123
);
{
toTSDBType
(
yymsp
[
0
].
minor
.
yy0
.
type
);
tVariantCreate
(
&
yylhsminor
.
yy
518
,
&
yymsp
[
0
].
minor
.
yy0
);
}
{
toTSDBType
(
yymsp
[
0
].
minor
.
yy0
.
type
);
tVariantCreate
(
&
yylhsminor
.
yy
312
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
0
].
minor
.
yy
518
=
yylhsminor
.
yy518
;
yymsp
[
0
].
minor
.
yy
312
=
yylhsminor
.
yy312
;
break
;
break
;
case
12
1
:
/* tagitem ::= NULL */
case
12
4
:
/* tagitem ::= NULL */
{
yymsp
[
0
].
minor
.
yy0
.
type
=
0
;
tVariantCreate
(
&
yylhsminor
.
yy
518
,
&
yymsp
[
0
].
minor
.
yy0
);
}
{
yymsp
[
0
].
minor
.
yy0
.
type
=
0
;
tVariantCreate
(
&
yylhsminor
.
yy
312
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
0
].
minor
.
yy
518
=
yylhsminor
.
yy518
;
yymsp
[
0
].
minor
.
yy
312
=
yylhsminor
.
yy312
;
break
;
break
;
case
12
2
:
/* tagitem ::= MINUS INTEGER */
case
12
5
:
/* tagitem ::= MINUS INTEGER */
case
12
3
:
/* tagitem ::= MINUS FLOAT */
yytestcase
(
yyruleno
==
123
);
case
12
6
:
/* tagitem ::= MINUS FLOAT */
yytestcase
(
yyruleno
==
126
);
case
12
4
:
/* tagitem ::= PLUS INTEGER */
yytestcase
(
yyruleno
==
124
);
case
12
7
:
/* tagitem ::= PLUS INTEGER */
yytestcase
(
yyruleno
==
127
);
case
12
5
:
/* tagitem ::= PLUS FLOAT */
yytestcase
(
yyruleno
==
125
);
case
12
8
:
/* tagitem ::= PLUS FLOAT */
yytestcase
(
yyruleno
==
128
);
{
{
yymsp
[
-
1
].
minor
.
yy0
.
n
+=
yymsp
[
0
].
minor
.
yy0
.
n
;
yymsp
[
-
1
].
minor
.
yy0
.
n
+=
yymsp
[
0
].
minor
.
yy0
.
n
;
yymsp
[
-
1
].
minor
.
yy0
.
type
=
yymsp
[
0
].
minor
.
yy0
.
type
;
yymsp
[
-
1
].
minor
.
yy0
.
type
=
yymsp
[
0
].
minor
.
yy0
.
type
;
toTSDBType
(
yymsp
[
-
1
].
minor
.
yy0
.
type
);
toTSDBType
(
yymsp
[
-
1
].
minor
.
yy0
.
type
);
tVariantCreate
(
&
yylhsminor
.
yy
518
,
&
yymsp
[
-
1
].
minor
.
yy0
);
tVariantCreate
(
&
yylhsminor
.
yy
312
,
&
yymsp
[
-
1
].
minor
.
yy0
);
}
}
yymsp
[
-
1
].
minor
.
yy
518
=
yylhsminor
.
yy518
;
yymsp
[
-
1
].
minor
.
yy
312
=
yylhsminor
.
yy312
;
break
;
break
;
case
12
6
:
/* select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */
case
12
9
:
/* select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */
{
{
yylhsminor
.
yy1
90
=
tSetQuerySQLElems
(
&
yymsp
[
-
11
].
minor
.
yy0
,
yymsp
[
-
10
].
minor
.
yy260
,
yymsp
[
-
9
].
minor
.
yy322
,
yymsp
[
-
8
].
minor
.
yy500
,
yymsp
[
-
4
].
minor
.
yy322
,
yymsp
[
-
3
].
minor
.
yy322
,
&
yymsp
[
-
7
].
minor
.
yy0
,
&
yymsp
[
-
5
].
minor
.
yy0
,
yymsp
[
-
6
].
minor
.
yy322
,
&
yymsp
[
0
].
minor
.
yy284
,
&
yymsp
[
-
1
].
minor
.
yy284
);
yylhsminor
.
yy1
50
=
tSetQuerySQLElems
(
&
yymsp
[
-
11
].
minor
.
yy0
,
yymsp
[
-
10
].
minor
.
yy224
,
yymsp
[
-
9
].
minor
.
yy494
,
yymsp
[
-
8
].
minor
.
yy66
,
yymsp
[
-
4
].
minor
.
yy494
,
yymsp
[
-
3
].
minor
.
yy494
,
&
yymsp
[
-
7
].
minor
.
yy0
,
&
yymsp
[
-
5
].
minor
.
yy0
,
yymsp
[
-
6
].
minor
.
yy494
,
&
yymsp
[
0
].
minor
.
yy188
,
&
yymsp
[
-
1
].
minor
.
yy188
);
}
}
yymsp
[
-
11
].
minor
.
yy1
90
=
yylhsminor
.
yy19
0
;
yymsp
[
-
11
].
minor
.
yy1
50
=
yylhsminor
.
yy15
0
;
break
;
break
;
case
1
27
:
/* union ::= select */
case
1
30
:
/* union ::= select */
{
yylhsminor
.
yy2
63
=
setSubclause
(
NULL
,
yymsp
[
0
].
minor
.
yy19
0
);
}
{
yylhsminor
.
yy2
5
=
setSubclause
(
NULL
,
yymsp
[
0
].
minor
.
yy15
0
);
}
yymsp
[
0
].
minor
.
yy2
63
=
yylhsminor
.
yy263
;
yymsp
[
0
].
minor
.
yy2
5
=
yylhsminor
.
yy25
;
break
;
break
;
case
1
28
:
/* union ::= LP union RP */
case
1
31
:
/* union ::= LP union RP */
{
yymsp
[
-
2
].
minor
.
yy2
63
=
yymsp
[
-
1
].
minor
.
yy263
;
}
{
yymsp
[
-
2
].
minor
.
yy2
5
=
yymsp
[
-
1
].
minor
.
yy25
;
}
break
;
break
;
case
1
29
:
/* union ::= union UNION ALL select */
case
1
32
:
/* union ::= union UNION ALL select */
{
yylhsminor
.
yy2
63
=
appendSelectClause
(
yymsp
[
-
3
].
minor
.
yy263
,
yymsp
[
0
].
minor
.
yy19
0
);
}
{
yylhsminor
.
yy2
5
=
appendSelectClause
(
yymsp
[
-
3
].
minor
.
yy25
,
yymsp
[
0
].
minor
.
yy15
0
);
}
yymsp
[
-
3
].
minor
.
yy2
63
=
yylhsminor
.
yy263
;
yymsp
[
-
3
].
minor
.
yy2
5
=
yylhsminor
.
yy25
;
break
;
break
;
case
13
0
:
/* union ::= union UNION ALL LP select RP */
case
13
3
:
/* union ::= union UNION ALL LP select RP */
{
yylhsminor
.
yy2
63
=
appendSelectClause
(
yymsp
[
-
5
].
minor
.
yy263
,
yymsp
[
-
1
].
minor
.
yy19
0
);
}
{
yylhsminor
.
yy2
5
=
appendSelectClause
(
yymsp
[
-
5
].
minor
.
yy25
,
yymsp
[
-
1
].
minor
.
yy15
0
);
}
yymsp
[
-
5
].
minor
.
yy2
63
=
yylhsminor
.
yy263
;
yymsp
[
-
5
].
minor
.
yy2
5
=
yylhsminor
.
yy25
;
break
;
break
;
case
13
1
:
/* cmd ::= union */
case
13
4
:
/* cmd ::= union */
{
setSQLInfo
(
pInfo
,
yymsp
[
0
].
minor
.
yy2
63
,
NULL
,
TSDB_SQL_SELECT
);
}
{
setSQLInfo
(
pInfo
,
yymsp
[
0
].
minor
.
yy2
5
,
NULL
,
TSDB_SQL_SELECT
);
}
break
;
break
;
case
13
2
:
/* select ::= SELECT selcollist */
case
13
5
:
/* select ::= SELECT selcollist */
{
{
yylhsminor
.
yy1
90
=
tSetQuerySQLElems
(
&
yymsp
[
-
1
].
minor
.
yy0
,
yymsp
[
0
].
minor
.
yy260
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
yylhsminor
.
yy1
50
=
tSetQuerySQLElems
(
&
yymsp
[
-
1
].
minor
.
yy0
,
yymsp
[
0
].
minor
.
yy224
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
}
}
yymsp
[
-
1
].
minor
.
yy1
90
=
yylhsminor
.
yy19
0
;
yymsp
[
-
1
].
minor
.
yy1
50
=
yylhsminor
.
yy15
0
;
break
;
break
;
case
13
3
:
/* sclp ::= selcollist COMMA */
case
13
6
:
/* sclp ::= selcollist COMMA */
{
yylhsminor
.
yy2
60
=
yymsp
[
-
1
].
minor
.
yy260
;}
{
yylhsminor
.
yy2
24
=
yymsp
[
-
1
].
minor
.
yy224
;}
yymsp
[
-
1
].
minor
.
yy2
60
=
yylhsminor
.
yy260
;
yymsp
[
-
1
].
minor
.
yy2
24
=
yylhsminor
.
yy224
;
break
;
break
;
case
13
4
:
/* sclp ::= */
case
13
7
:
/* sclp ::= */
{
yymsp
[
1
].
minor
.
yy2
60
=
0
;}
{
yymsp
[
1
].
minor
.
yy2
24
=
0
;}
break
;
break
;
case
13
5
:
/* selcollist ::= sclp expr as */
case
13
8
:
/* selcollist ::= sclp expr as */
{
{
yylhsminor
.
yy2
60
=
tSQLExprListAppend
(
yymsp
[
-
2
].
minor
.
yy260
,
yymsp
[
-
1
].
minor
.
yy500
,
yymsp
[
0
].
minor
.
yy0
.
n
?&
yymsp
[
0
].
minor
.
yy0
:
0
);
yylhsminor
.
yy2
24
=
tSQLExprListAppend
(
yymsp
[
-
2
].
minor
.
yy224
,
yymsp
[
-
1
].
minor
.
yy66
,
yymsp
[
0
].
minor
.
yy0
.
n
?&
yymsp
[
0
].
minor
.
yy0
:
0
);
}
}
yymsp
[
-
2
].
minor
.
yy2
60
=
yylhsminor
.
yy260
;
yymsp
[
-
2
].
minor
.
yy2
24
=
yylhsminor
.
yy224
;
break
;
break
;
case
13
6
:
/* selcollist ::= sclp STAR */
case
13
9
:
/* selcollist ::= sclp STAR */
{
{
tSQLExpr
*
pNode
=
tSQLExprIdValueCreate
(
NULL
,
TK_ALL
);
tSQLExpr
*
pNode
=
tSQLExprIdValueCreate
(
NULL
,
TK_ALL
);
yylhsminor
.
yy2
60
=
tSQLExprListAppend
(
yymsp
[
-
1
].
minor
.
yy260
,
pNode
,
0
);
yylhsminor
.
yy2
24
=
tSQLExprListAppend
(
yymsp
[
-
1
].
minor
.
yy224
,
pNode
,
0
);
}
}
yymsp
[
-
1
].
minor
.
yy2
60
=
yylhsminor
.
yy260
;
yymsp
[
-
1
].
minor
.
yy2
24
=
yylhsminor
.
yy224
;
break
;
break
;
case
1
37
:
/* as ::= AS ids */
case
1
40
:
/* as ::= AS ids */
{
yymsp
[
-
1
].
minor
.
yy0
=
yymsp
[
0
].
minor
.
yy0
;
}
{
yymsp
[
-
1
].
minor
.
yy0
=
yymsp
[
0
].
minor
.
yy0
;
}
break
;
break
;
case
1
38
:
/* as ::= ids */
case
1
41
:
/* as ::= ids */
{
yylhsminor
.
yy0
=
yymsp
[
0
].
minor
.
yy0
;
}
{
yylhsminor
.
yy0
=
yymsp
[
0
].
minor
.
yy0
;
}
yymsp
[
0
].
minor
.
yy0
=
yylhsminor
.
yy0
;
yymsp
[
0
].
minor
.
yy0
=
yylhsminor
.
yy0
;
break
;
break
;
case
1
39
:
/* as ::= */
case
1
42
:
/* as ::= */
{
yymsp
[
1
].
minor
.
yy0
.
n
=
0
;
}
{
yymsp
[
1
].
minor
.
yy0
.
n
=
0
;
}
break
;
break
;
case
14
0
:
/* from ::= FROM tablelist */
case
14
3
:
/* from ::= FROM tablelist */
{
yymsp
[
-
1
].
minor
.
yy
322
=
yymsp
[
0
].
minor
.
yy322
;}
{
yymsp
[
-
1
].
minor
.
yy
494
=
yymsp
[
0
].
minor
.
yy494
;}
break
;
break
;
case
14
1
:
/* tablelist ::= ids cpxName */
case
14
4
:
/* tablelist ::= ids cpxName */
{
toTSDBType
(
yymsp
[
-
1
].
minor
.
yy0
.
type
);
yymsp
[
-
1
].
minor
.
yy0
.
n
+=
yymsp
[
0
].
minor
.
yy0
.
n
;
yylhsminor
.
yy
322
=
tVariantListAppendToken
(
NULL
,
&
yymsp
[
-
1
].
minor
.
yy0
,
-
1
);}
{
toTSDBType
(
yymsp
[
-
1
].
minor
.
yy0
.
type
);
yymsp
[
-
1
].
minor
.
yy0
.
n
+=
yymsp
[
0
].
minor
.
yy0
.
n
;
yylhsminor
.
yy
494
=
tVariantListAppendToken
(
NULL
,
&
yymsp
[
-
1
].
minor
.
yy0
,
-
1
);}
yymsp
[
-
1
].
minor
.
yy
322
=
yylhsminor
.
yy322
;
yymsp
[
-
1
].
minor
.
yy
494
=
yylhsminor
.
yy494
;
break
;
break
;
case
14
2
:
/* tablelist ::= tablelist COMMA ids cpxName */
case
14
5
:
/* tablelist ::= tablelist COMMA ids cpxName */
{
toTSDBType
(
yymsp
[
-
1
].
minor
.
yy0
.
type
);
yymsp
[
-
1
].
minor
.
yy0
.
n
+=
yymsp
[
0
].
minor
.
yy0
.
n
;
yylhsminor
.
yy
322
=
tVariantListAppendToken
(
yymsp
[
-
3
].
minor
.
yy322
,
&
yymsp
[
-
1
].
minor
.
yy0
,
-
1
);
}
{
toTSDBType
(
yymsp
[
-
1
].
minor
.
yy0
.
type
);
yymsp
[
-
1
].
minor
.
yy0
.
n
+=
yymsp
[
0
].
minor
.
yy0
.
n
;
yylhsminor
.
yy
494
=
tVariantListAppendToken
(
yymsp
[
-
3
].
minor
.
yy494
,
&
yymsp
[
-
1
].
minor
.
yy0
,
-
1
);
}
yymsp
[
-
3
].
minor
.
yy
322
=
yylhsminor
.
yy322
;
yymsp
[
-
3
].
minor
.
yy
494
=
yylhsminor
.
yy494
;
break
;
break
;
case
14
3
:
/* tmvar ::= VARIABLE */
case
14
6
:
/* tmvar ::= VARIABLE */
{
yylhsminor
.
yy0
=
yymsp
[
0
].
minor
.
yy0
;}
{
yylhsminor
.
yy0
=
yymsp
[
0
].
minor
.
yy0
;}
yymsp
[
0
].
minor
.
yy0
=
yylhsminor
.
yy0
;
yymsp
[
0
].
minor
.
yy0
=
yylhsminor
.
yy0
;
break
;
break
;
case
14
4
:
/* interval_opt ::= INTERVAL LP tmvar RP */
case
14
7
:
/* interval_opt ::= INTERVAL LP tmvar RP */
case
1
49
:
/* sliding_opt ::= SLIDING LP tmvar RP */
yytestcase
(
yyruleno
==
149
);
case
1
52
:
/* sliding_opt ::= SLIDING LP tmvar RP */
yytestcase
(
yyruleno
==
152
);
{
yymsp
[
-
3
].
minor
.
yy0
=
yymsp
[
-
1
].
minor
.
yy0
;
}
{
yymsp
[
-
3
].
minor
.
yy0
=
yymsp
[
-
1
].
minor
.
yy0
;
}
break
;
break
;
case
14
5
:
/* interval_opt ::= */
case
14
8
:
/* interval_opt ::= */
case
15
0
:
/* sliding_opt ::= */
yytestcase
(
yyruleno
==
150
);
case
15
3
:
/* sliding_opt ::= */
yytestcase
(
yyruleno
==
153
);
{
yymsp
[
1
].
minor
.
yy0
.
n
=
0
;
yymsp
[
1
].
minor
.
yy0
.
z
=
NULL
;
yymsp
[
1
].
minor
.
yy0
.
type
=
0
;
}
{
yymsp
[
1
].
minor
.
yy0
.
n
=
0
;
yymsp
[
1
].
minor
.
yy0
.
z
=
NULL
;
yymsp
[
1
].
minor
.
yy0
.
type
=
0
;
}
break
;
break
;
case
14
6
:
/* fill_opt ::= */
case
14
9
:
/* fill_opt ::= */
{
yymsp
[
1
].
minor
.
yy
322
=
0
;
}
{
yymsp
[
1
].
minor
.
yy
494
=
0
;
}
break
;
break
;
case
1
47
:
/* fill_opt ::= FILL LP ID COMMA tagitemlist RP */
case
1
50
:
/* fill_opt ::= FILL LP ID COMMA tagitemlist RP */
{
{
tVariant
A
=
{
0
};
tVariant
A
=
{
0
};
toTSDBType
(
yymsp
[
-
3
].
minor
.
yy0
.
type
);
toTSDBType
(
yymsp
[
-
3
].
minor
.
yy0
.
type
);
tVariantCreate
(
&
A
,
&
yymsp
[
-
3
].
minor
.
yy0
);
tVariantCreate
(
&
A
,
&
yymsp
[
-
3
].
minor
.
yy0
);
tVariantListInsert
(
yymsp
[
-
1
].
minor
.
yy
322
,
&
A
,
-
1
,
0
);
tVariantListInsert
(
yymsp
[
-
1
].
minor
.
yy
494
,
&
A
,
-
1
,
0
);
yymsp
[
-
5
].
minor
.
yy
322
=
yymsp
[
-
1
].
minor
.
yy322
;
yymsp
[
-
5
].
minor
.
yy
494
=
yymsp
[
-
1
].
minor
.
yy494
;
}
}
break
;
break
;
case
1
48
:
/* fill_opt ::= FILL LP ID RP */
case
1
51
:
/* fill_opt ::= FILL LP ID RP */
{
{
toTSDBType
(
yymsp
[
-
1
].
minor
.
yy0
.
type
);
toTSDBType
(
yymsp
[
-
1
].
minor
.
yy0
.
type
);
yymsp
[
-
3
].
minor
.
yy
322
=
tVariantListAppendToken
(
NULL
,
&
yymsp
[
-
1
].
minor
.
yy0
,
-
1
);
yymsp
[
-
3
].
minor
.
yy
494
=
tVariantListAppendToken
(
NULL
,
&
yymsp
[
-
1
].
minor
.
yy0
,
-
1
);
}
}
break
;
break
;
case
15
1
:
/* orderby_opt ::= */
case
15
4
:
/* orderby_opt ::= */
case
1
59
:
/* groupby_opt ::= */
yytestcase
(
yyruleno
==
159
);
case
1
62
:
/* groupby_opt ::= */
yytestcase
(
yyruleno
==
162
);
{
yymsp
[
1
].
minor
.
yy
322
=
0
;}
{
yymsp
[
1
].
minor
.
yy
494
=
0
;}
break
;
break
;
case
15
2
:
/* orderby_opt ::= ORDER BY sortlist */
case
15
5
:
/* orderby_opt ::= ORDER BY sortlist */
case
16
0
:
/* groupby_opt ::= GROUP BY grouplist */
yytestcase
(
yyruleno
==
160
);
case
16
3
:
/* groupby_opt ::= GROUP BY grouplist */
yytestcase
(
yyruleno
==
163
);
{
yymsp
[
-
2
].
minor
.
yy
322
=
yymsp
[
0
].
minor
.
yy322
;}
{
yymsp
[
-
2
].
minor
.
yy
494
=
yymsp
[
0
].
minor
.
yy494
;}
break
;
break
;
case
15
3
:
/* sortlist ::= sortlist COMMA item sortorder */
case
15
6
:
/* sortlist ::= sortlist COMMA item sortorder */
{
{
yylhsminor
.
yy
322
=
tVariantListAppend
(
yymsp
[
-
3
].
minor
.
yy322
,
&
yymsp
[
-
1
].
minor
.
yy518
,
yymsp
[
0
].
minor
.
yy150
);
yylhsminor
.
yy
494
=
tVariantListAppend
(
yymsp
[
-
3
].
minor
.
yy494
,
&
yymsp
[
-
1
].
minor
.
yy312
,
yymsp
[
0
].
minor
.
yy82
);
}
}
yymsp
[
-
3
].
minor
.
yy
322
=
yylhsminor
.
yy322
;
yymsp
[
-
3
].
minor
.
yy
494
=
yylhsminor
.
yy494
;
break
;
break
;
case
15
4
:
/* sortlist ::= item sortorder */
case
15
7
:
/* sortlist ::= item sortorder */
{
{
yylhsminor
.
yy
322
=
tVariantListAppend
(
NULL
,
&
yymsp
[
-
1
].
minor
.
yy518
,
yymsp
[
0
].
minor
.
yy150
);
yylhsminor
.
yy
494
=
tVariantListAppend
(
NULL
,
&
yymsp
[
-
1
].
minor
.
yy312
,
yymsp
[
0
].
minor
.
yy82
);
}
}
yymsp
[
-
1
].
minor
.
yy
322
=
yylhsminor
.
yy322
;
yymsp
[
-
1
].
minor
.
yy
494
=
yylhsminor
.
yy494
;
break
;
break
;
case
15
5
:
/* item ::= ids cpxName */
case
15
8
:
/* item ::= ids cpxName */
{
{
toTSDBType
(
yymsp
[
-
1
].
minor
.
yy0
.
type
);
toTSDBType
(
yymsp
[
-
1
].
minor
.
yy0
.
type
);
yymsp
[
-
1
].
minor
.
yy0
.
n
+=
yymsp
[
0
].
minor
.
yy0
.
n
;
yymsp
[
-
1
].
minor
.
yy0
.
n
+=
yymsp
[
0
].
minor
.
yy0
.
n
;
tVariantCreate
(
&
yylhsminor
.
yy
518
,
&
yymsp
[
-
1
].
minor
.
yy0
);
tVariantCreate
(
&
yylhsminor
.
yy
312
,
&
yymsp
[
-
1
].
minor
.
yy0
);
}
}
yymsp
[
-
1
].
minor
.
yy
518
=
yylhsminor
.
yy518
;
yymsp
[
-
1
].
minor
.
yy
312
=
yylhsminor
.
yy312
;
break
;
break
;
case
15
6
:
/* sortorder ::= ASC */
case
15
9
:
/* sortorder ::= ASC */
{
yymsp
[
0
].
minor
.
yy
150
=
TSDB_ORDER_ASC
;
}
{
yymsp
[
0
].
minor
.
yy
82
=
TSDB_ORDER_ASC
;
}
break
;
break
;
case
1
57
:
/* sortorder ::= DESC */
case
1
60
:
/* sortorder ::= DESC */
{
yymsp
[
0
].
minor
.
yy
150
=
TSDB_ORDER_DESC
;}
{
yymsp
[
0
].
minor
.
yy
82
=
TSDB_ORDER_DESC
;}
break
;
break
;
case
1
58
:
/* sortorder ::= */
case
1
61
:
/* sortorder ::= */
{
yymsp
[
1
].
minor
.
yy
150
=
TSDB_ORDER_ASC
;}
{
yymsp
[
1
].
minor
.
yy
82
=
TSDB_ORDER_ASC
;}
break
;
break
;
case
16
1
:
/* grouplist ::= grouplist COMMA item */
case
16
4
:
/* grouplist ::= grouplist COMMA item */
{
{
yylhsminor
.
yy
322
=
tVariantListAppend
(
yymsp
[
-
2
].
minor
.
yy322
,
&
yymsp
[
0
].
minor
.
yy518
,
-
1
);
yylhsminor
.
yy
494
=
tVariantListAppend
(
yymsp
[
-
2
].
minor
.
yy494
,
&
yymsp
[
0
].
minor
.
yy312
,
-
1
);
}
}
yymsp
[
-
2
].
minor
.
yy
322
=
yylhsminor
.
yy322
;
yymsp
[
-
2
].
minor
.
yy
494
=
yylhsminor
.
yy494
;
break
;
break
;
case
16
2
:
/* grouplist ::= item */
case
16
5
:
/* grouplist ::= item */
{
{
yylhsminor
.
yy
322
=
tVariantListAppend
(
NULL
,
&
yymsp
[
0
].
minor
.
yy518
,
-
1
);
yylhsminor
.
yy
494
=
tVariantListAppend
(
NULL
,
&
yymsp
[
0
].
minor
.
yy312
,
-
1
);
}
}
yymsp
[
0
].
minor
.
yy
322
=
yylhsminor
.
yy322
;
yymsp
[
0
].
minor
.
yy
494
=
yylhsminor
.
yy494
;
break
;
break
;
case
16
3
:
/* having_opt ::= */
case
16
6
:
/* having_opt ::= */
case
17
3
:
/* where_opt ::= */
yytestcase
(
yyruleno
==
173
);
case
17
6
:
/* where_opt ::= */
yytestcase
(
yyruleno
==
176
);
case
2
09
:
/* expritem ::= */
yytestcase
(
yyruleno
==
209
);
case
2
12
:
/* expritem ::= */
yytestcase
(
yyruleno
==
212
);
{
yymsp
[
1
].
minor
.
yy
500
=
0
;}
{
yymsp
[
1
].
minor
.
yy
66
=
0
;}
break
;
break
;
case
16
4
:
/* having_opt ::= HAVING expr */
case
16
7
:
/* having_opt ::= HAVING expr */
case
17
4
:
/* where_opt ::= WHERE expr */
yytestcase
(
yyruleno
==
174
);
case
17
7
:
/* where_opt ::= WHERE expr */
yytestcase
(
yyruleno
==
177
);
{
yymsp
[
-
1
].
minor
.
yy
500
=
yymsp
[
0
].
minor
.
yy500
;}
{
yymsp
[
-
1
].
minor
.
yy
66
=
yymsp
[
0
].
minor
.
yy66
;}
break
;
break
;
case
16
5
:
/* limit_opt ::= */
case
16
8
:
/* limit_opt ::= */
case
1
69
:
/* slimit_opt ::= */
yytestcase
(
yyruleno
==
169
);
case
1
72
:
/* slimit_opt ::= */
yytestcase
(
yyruleno
==
172
);
{
yymsp
[
1
].
minor
.
yy
284
.
limit
=
-
1
;
yymsp
[
1
].
minor
.
yy284
.
offset
=
0
;}
{
yymsp
[
1
].
minor
.
yy
188
.
limit
=
-
1
;
yymsp
[
1
].
minor
.
yy188
.
offset
=
0
;}
break
;
break
;
case
16
6
:
/* limit_opt ::= LIMIT signed */
case
16
9
:
/* limit_opt ::= LIMIT signed */
case
17
0
:
/* slimit_opt ::= SLIMIT signed */
yytestcase
(
yyruleno
==
170
);
case
17
3
:
/* slimit_opt ::= SLIMIT signed */
yytestcase
(
yyruleno
==
173
);
{
yymsp
[
-
1
].
minor
.
yy
284
.
limit
=
yymsp
[
0
].
minor
.
yy279
;
yymsp
[
-
1
].
minor
.
yy284
.
offset
=
0
;}
{
yymsp
[
-
1
].
minor
.
yy
188
.
limit
=
yymsp
[
0
].
minor
.
yy271
;
yymsp
[
-
1
].
minor
.
yy188
.
offset
=
0
;}
break
;
break
;
case
1
67
:
/* limit_opt ::= LIMIT signed OFFSET signed */
case
1
70
:
/* limit_opt ::= LIMIT signed OFFSET signed */
case
17
1
:
/* slimit_opt ::= SLIMIT signed SOFFSET signed */
yytestcase
(
yyruleno
==
171
);
case
17
4
:
/* slimit_opt ::= SLIMIT signed SOFFSET signed */
yytestcase
(
yyruleno
==
174
);
{
yymsp
[
-
3
].
minor
.
yy
284
.
limit
=
yymsp
[
-
2
].
minor
.
yy279
;
yymsp
[
-
3
].
minor
.
yy284
.
offset
=
yymsp
[
0
].
minor
.
yy279
;}
{
yymsp
[
-
3
].
minor
.
yy
188
.
limit
=
yymsp
[
-
2
].
minor
.
yy271
;
yymsp
[
-
3
].
minor
.
yy188
.
offset
=
yymsp
[
0
].
minor
.
yy271
;}
break
;
break
;
case
1
68
:
/* limit_opt ::= LIMIT signed COMMA signed */
case
1
71
:
/* limit_opt ::= LIMIT signed COMMA signed */
case
17
2
:
/* slimit_opt ::= SLIMIT signed COMMA signed */
yytestcase
(
yyruleno
==
172
);
case
17
5
:
/* slimit_opt ::= SLIMIT signed COMMA signed */
yytestcase
(
yyruleno
==
175
);
{
yymsp
[
-
3
].
minor
.
yy
284
.
limit
=
yymsp
[
0
].
minor
.
yy279
;
yymsp
[
-
3
].
minor
.
yy284
.
offset
=
yymsp
[
-
2
].
minor
.
yy279
;}
{
yymsp
[
-
3
].
minor
.
yy
188
.
limit
=
yymsp
[
0
].
minor
.
yy271
;
yymsp
[
-
3
].
minor
.
yy188
.
offset
=
yymsp
[
-
2
].
minor
.
yy271
;}
break
;
break
;
case
17
5
:
/* expr ::= LP expr RP */
case
17
8
:
/* expr ::= LP expr RP */
{
yymsp
[
-
2
].
minor
.
yy
500
=
yymsp
[
-
1
].
minor
.
yy500
;
}
{
yymsp
[
-
2
].
minor
.
yy
66
=
yymsp
[
-
1
].
minor
.
yy66
;
}
break
;
break
;
case
17
6
:
/* expr ::= ID */
case
17
9
:
/* expr ::= ID */
{
yylhsminor
.
yy
500
=
tSQLExprIdValueCreate
(
&
yymsp
[
0
].
minor
.
yy0
,
TK_ID
);}
{
yylhsminor
.
yy
66
=
tSQLExprIdValueCreate
(
&
yymsp
[
0
].
minor
.
yy0
,
TK_ID
);}
yymsp
[
0
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
0
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
1
77
:
/* expr ::= ID DOT ID */
case
1
80
:
/* expr ::= ID DOT ID */
{
yymsp
[
-
2
].
minor
.
yy0
.
n
+=
(
1
+
yymsp
[
0
].
minor
.
yy0
.
n
);
yylhsminor
.
yy
500
=
tSQLExprIdValueCreate
(
&
yymsp
[
-
2
].
minor
.
yy0
,
TK_ID
);}
{
yymsp
[
-
2
].
minor
.
yy0
.
n
+=
(
1
+
yymsp
[
0
].
minor
.
yy0
.
n
);
yylhsminor
.
yy
66
=
tSQLExprIdValueCreate
(
&
yymsp
[
-
2
].
minor
.
yy0
,
TK_ID
);}
yymsp
[
-
2
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
-
2
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
1
78
:
/* expr ::= ID DOT STAR */
case
1
81
:
/* expr ::= ID DOT STAR */
{
yymsp
[
-
2
].
minor
.
yy0
.
n
+=
(
1
+
yymsp
[
0
].
minor
.
yy0
.
n
);
yylhsminor
.
yy
500
=
tSQLExprIdValueCreate
(
&
yymsp
[
-
2
].
minor
.
yy0
,
TK_ALL
);}
{
yymsp
[
-
2
].
minor
.
yy0
.
n
+=
(
1
+
yymsp
[
0
].
minor
.
yy0
.
n
);
yylhsminor
.
yy
66
=
tSQLExprIdValueCreate
(
&
yymsp
[
-
2
].
minor
.
yy0
,
TK_ALL
);}
yymsp
[
-
2
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
-
2
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
1
79
:
/* expr ::= INTEGER */
case
1
82
:
/* expr ::= INTEGER */
{
yylhsminor
.
yy
500
=
tSQLExprIdValueCreate
(
&
yymsp
[
0
].
minor
.
yy0
,
TK_INTEGER
);}
{
yylhsminor
.
yy
66
=
tSQLExprIdValueCreate
(
&
yymsp
[
0
].
minor
.
yy0
,
TK_INTEGER
);}
yymsp
[
0
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
0
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
18
0
:
/* expr ::= MINUS INTEGER */
case
18
3
:
/* expr ::= MINUS INTEGER */
case
18
1
:
/* expr ::= PLUS INTEGER */
yytestcase
(
yyruleno
==
181
);
case
18
4
:
/* expr ::= PLUS INTEGER */
yytestcase
(
yyruleno
==
184
);
{
yymsp
[
-
1
].
minor
.
yy0
.
n
+=
yymsp
[
0
].
minor
.
yy0
.
n
;
yymsp
[
-
1
].
minor
.
yy0
.
type
=
TK_INTEGER
;
yylhsminor
.
yy
500
=
tSQLExprIdValueCreate
(
&
yymsp
[
-
1
].
minor
.
yy0
,
TK_INTEGER
);}
{
yymsp
[
-
1
].
minor
.
yy0
.
n
+=
yymsp
[
0
].
minor
.
yy0
.
n
;
yymsp
[
-
1
].
minor
.
yy0
.
type
=
TK_INTEGER
;
yylhsminor
.
yy
66
=
tSQLExprIdValueCreate
(
&
yymsp
[
-
1
].
minor
.
yy0
,
TK_INTEGER
);}
yymsp
[
-
1
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
-
1
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
18
2
:
/* expr ::= FLOAT */
case
18
5
:
/* expr ::= FLOAT */
{
yylhsminor
.
yy
500
=
tSQLExprIdValueCreate
(
&
yymsp
[
0
].
minor
.
yy0
,
TK_FLOAT
);}
{
yylhsminor
.
yy
66
=
tSQLExprIdValueCreate
(
&
yymsp
[
0
].
minor
.
yy0
,
TK_FLOAT
);}
yymsp
[
0
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
0
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
18
3
:
/* expr ::= MINUS FLOAT */
case
18
6
:
/* expr ::= MINUS FLOAT */
case
18
4
:
/* expr ::= PLUS FLOAT */
yytestcase
(
yyruleno
==
184
);
case
18
7
:
/* expr ::= PLUS FLOAT */
yytestcase
(
yyruleno
==
187
);
{
yymsp
[
-
1
].
minor
.
yy0
.
n
+=
yymsp
[
0
].
minor
.
yy0
.
n
;
yymsp
[
-
1
].
minor
.
yy0
.
type
=
TK_FLOAT
;
yylhsminor
.
yy
500
=
tSQLExprIdValueCreate
(
&
yymsp
[
-
1
].
minor
.
yy0
,
TK_FLOAT
);}
{
yymsp
[
-
1
].
minor
.
yy0
.
n
+=
yymsp
[
0
].
minor
.
yy0
.
n
;
yymsp
[
-
1
].
minor
.
yy0
.
type
=
TK_FLOAT
;
yylhsminor
.
yy
66
=
tSQLExprIdValueCreate
(
&
yymsp
[
-
1
].
minor
.
yy0
,
TK_FLOAT
);}
yymsp
[
-
1
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
-
1
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
18
5
:
/* expr ::= STRING */
case
18
8
:
/* expr ::= STRING */
{
yylhsminor
.
yy
500
=
tSQLExprIdValueCreate
(
&
yymsp
[
0
].
minor
.
yy0
,
TK_STRING
);}
{
yylhsminor
.
yy
66
=
tSQLExprIdValueCreate
(
&
yymsp
[
0
].
minor
.
yy0
,
TK_STRING
);}
yymsp
[
0
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
0
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
18
6
:
/* expr ::= NOW */
case
18
9
:
/* expr ::= NOW */
{
yylhsminor
.
yy
500
=
tSQLExprIdValueCreate
(
&
yymsp
[
0
].
minor
.
yy0
,
TK_NOW
);
}
{
yylhsminor
.
yy
66
=
tSQLExprIdValueCreate
(
&
yymsp
[
0
].
minor
.
yy0
,
TK_NOW
);
}
yymsp
[
0
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
0
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
1
87
:
/* expr ::= VARIABLE */
case
1
90
:
/* expr ::= VARIABLE */
{
yylhsminor
.
yy
500
=
tSQLExprIdValueCreate
(
&
yymsp
[
0
].
minor
.
yy0
,
TK_VARIABLE
);}
{
yylhsminor
.
yy
66
=
tSQLExprIdValueCreate
(
&
yymsp
[
0
].
minor
.
yy0
,
TK_VARIABLE
);}
yymsp
[
0
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
0
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
1
88
:
/* expr ::= BOOL */
case
1
91
:
/* expr ::= BOOL */
{
yylhsminor
.
yy
500
=
tSQLExprIdValueCreate
(
&
yymsp
[
0
].
minor
.
yy0
,
TK_BOOL
);}
{
yylhsminor
.
yy
66
=
tSQLExprIdValueCreate
(
&
yymsp
[
0
].
minor
.
yy0
,
TK_BOOL
);}
yymsp
[
0
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
0
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
1
89
:
/* expr ::= ID LP exprlist RP */
case
1
92
:
/* expr ::= ID LP exprlist RP */
{
{
yylhsminor
.
yy
500
=
tSQLExprCreateFunction
(
yymsp
[
-
1
].
minor
.
yy260
,
&
yymsp
[
-
3
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
,
yymsp
[
-
3
].
minor
.
yy0
.
type
);
yylhsminor
.
yy
66
=
tSQLExprCreateFunction
(
yymsp
[
-
1
].
minor
.
yy224
,
&
yymsp
[
-
3
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
,
yymsp
[
-
3
].
minor
.
yy0
.
type
);
}
}
yymsp
[
-
3
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
-
3
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
19
0
:
/* expr ::= ID LP STAR RP */
case
19
3
:
/* expr ::= ID LP STAR RP */
{
{
yylhsminor
.
yy
500
=
tSQLExprCreateFunction
(
NULL
,
&
yymsp
[
-
3
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
,
yymsp
[
-
3
].
minor
.
yy0
.
type
);
yylhsminor
.
yy
66
=
tSQLExprCreateFunction
(
NULL
,
&
yymsp
[
-
3
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
,
yymsp
[
-
3
].
minor
.
yy0
.
type
);
}
}
yymsp
[
-
3
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
-
3
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
19
1
:
/* expr ::= expr AND expr */
case
19
4
:
/* expr ::= expr AND expr */
{
yylhsminor
.
yy
500
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy500
,
yymsp
[
0
].
minor
.
yy500
,
TK_AND
);}
{
yylhsminor
.
yy
66
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy66
,
yymsp
[
0
].
minor
.
yy66
,
TK_AND
);}
yymsp
[
-
2
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
-
2
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
19
2
:
/* expr ::= expr OR expr */
case
19
5
:
/* expr ::= expr OR expr */
{
yylhsminor
.
yy
500
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy500
,
yymsp
[
0
].
minor
.
yy500
,
TK_OR
);
}
{
yylhsminor
.
yy
66
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy66
,
yymsp
[
0
].
minor
.
yy66
,
TK_OR
);
}
yymsp
[
-
2
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
-
2
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
19
3
:
/* expr ::= expr LT expr */
case
19
6
:
/* expr ::= expr LT expr */
{
yylhsminor
.
yy
500
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy500
,
yymsp
[
0
].
minor
.
yy500
,
TK_LT
);}
{
yylhsminor
.
yy
66
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy66
,
yymsp
[
0
].
minor
.
yy66
,
TK_LT
);}
yymsp
[
-
2
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
-
2
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
19
4
:
/* expr ::= expr GT expr */
case
19
7
:
/* expr ::= expr GT expr */
{
yylhsminor
.
yy
500
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy500
,
yymsp
[
0
].
minor
.
yy500
,
TK_GT
);}
{
yylhsminor
.
yy
66
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy66
,
yymsp
[
0
].
minor
.
yy66
,
TK_GT
);}
yymsp
[
-
2
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
-
2
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
19
5
:
/* expr ::= expr LE expr */
case
19
8
:
/* expr ::= expr LE expr */
{
yylhsminor
.
yy
500
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy500
,
yymsp
[
0
].
minor
.
yy500
,
TK_LE
);}
{
yylhsminor
.
yy
66
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy66
,
yymsp
[
0
].
minor
.
yy66
,
TK_LE
);}
yymsp
[
-
2
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
-
2
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
19
6
:
/* expr ::= expr GE expr */
case
19
9
:
/* expr ::= expr GE expr */
{
yylhsminor
.
yy
500
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy500
,
yymsp
[
0
].
minor
.
yy500
,
TK_GE
);}
{
yylhsminor
.
yy
66
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy66
,
yymsp
[
0
].
minor
.
yy66
,
TK_GE
);}
yymsp
[
-
2
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
-
2
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
197
:
/* expr ::= expr NE expr */
case
200
:
/* expr ::= expr NE expr */
{
yylhsminor
.
yy
500
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy500
,
yymsp
[
0
].
minor
.
yy500
,
TK_NE
);}
{
yylhsminor
.
yy
66
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy66
,
yymsp
[
0
].
minor
.
yy66
,
TK_NE
);}
yymsp
[
-
2
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
-
2
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
198
:
/* expr ::= expr EQ expr */
case
201
:
/* expr ::= expr EQ expr */
{
yylhsminor
.
yy
500
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy500
,
yymsp
[
0
].
minor
.
yy500
,
TK_EQ
);}
{
yylhsminor
.
yy
66
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy66
,
yymsp
[
0
].
minor
.
yy66
,
TK_EQ
);}
yymsp
[
-
2
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
-
2
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
199
:
/* expr ::= expr PLUS expr */
case
202
:
/* expr ::= expr PLUS expr */
{
yylhsminor
.
yy
500
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy500
,
yymsp
[
0
].
minor
.
yy500
,
TK_PLUS
);
}
{
yylhsminor
.
yy
66
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy66
,
yymsp
[
0
].
minor
.
yy66
,
TK_PLUS
);
}
yymsp
[
-
2
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
-
2
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
20
0
:
/* expr ::= expr MINUS expr */
case
20
3
:
/* expr ::= expr MINUS expr */
{
yylhsminor
.
yy
500
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy500
,
yymsp
[
0
].
minor
.
yy500
,
TK_MINUS
);
}
{
yylhsminor
.
yy
66
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy66
,
yymsp
[
0
].
minor
.
yy66
,
TK_MINUS
);
}
yymsp
[
-
2
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
-
2
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
20
1
:
/* expr ::= expr STAR expr */
case
20
4
:
/* expr ::= expr STAR expr */
{
yylhsminor
.
yy
500
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy500
,
yymsp
[
0
].
minor
.
yy500
,
TK_STAR
);
}
{
yylhsminor
.
yy
66
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy66
,
yymsp
[
0
].
minor
.
yy66
,
TK_STAR
);
}
yymsp
[
-
2
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
-
2
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
20
2
:
/* expr ::= expr SLASH expr */
case
20
5
:
/* expr ::= expr SLASH expr */
{
yylhsminor
.
yy
500
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy500
,
yymsp
[
0
].
minor
.
yy500
,
TK_DIVIDE
);}
{
yylhsminor
.
yy
66
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy66
,
yymsp
[
0
].
minor
.
yy66
,
TK_DIVIDE
);}
yymsp
[
-
2
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
-
2
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
20
3
:
/* expr ::= expr REM expr */
case
20
6
:
/* expr ::= expr REM expr */
{
yylhsminor
.
yy
500
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy500
,
yymsp
[
0
].
minor
.
yy500
,
TK_REM
);
}
{
yylhsminor
.
yy
66
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy66
,
yymsp
[
0
].
minor
.
yy66
,
TK_REM
);
}
yymsp
[
-
2
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
-
2
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
20
4
:
/* expr ::= expr LIKE expr */
case
20
7
:
/* expr ::= expr LIKE expr */
{
yylhsminor
.
yy
500
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy500
,
yymsp
[
0
].
minor
.
yy500
,
TK_LIKE
);
}
{
yylhsminor
.
yy
66
=
tSQLExprCreate
(
yymsp
[
-
2
].
minor
.
yy66
,
yymsp
[
0
].
minor
.
yy66
,
TK_LIKE
);
}
yymsp
[
-
2
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
-
2
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
20
5
:
/* expr ::= expr IN LP exprlist RP */
case
20
8
:
/* expr ::= expr IN LP exprlist RP */
{
yylhsminor
.
yy
500
=
tSQLExprCreate
(
yymsp
[
-
4
].
minor
.
yy500
,
(
tSQLExpr
*
)
yymsp
[
-
1
].
minor
.
yy260
,
TK_IN
);
}
{
yylhsminor
.
yy
66
=
tSQLExprCreate
(
yymsp
[
-
4
].
minor
.
yy66
,
(
tSQLExpr
*
)
yymsp
[
-
1
].
minor
.
yy224
,
TK_IN
);
}
yymsp
[
-
4
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
-
4
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
20
6
:
/* exprlist ::= exprlist COMMA expritem */
case
20
9
:
/* exprlist ::= exprlist COMMA expritem */
{
yylhsminor
.
yy2
60
=
tSQLExprListAppend
(
yymsp
[
-
2
].
minor
.
yy260
,
yymsp
[
0
].
minor
.
yy500
,
0
);}
{
yylhsminor
.
yy2
24
=
tSQLExprListAppend
(
yymsp
[
-
2
].
minor
.
yy224
,
yymsp
[
0
].
minor
.
yy66
,
0
);}
yymsp
[
-
2
].
minor
.
yy2
60
=
yylhsminor
.
yy260
;
yymsp
[
-
2
].
minor
.
yy2
24
=
yylhsminor
.
yy224
;
break
;
break
;
case
2
07
:
/* exprlist ::= expritem */
case
2
10
:
/* exprlist ::= expritem */
{
yylhsminor
.
yy2
60
=
tSQLExprListAppend
(
0
,
yymsp
[
0
].
minor
.
yy500
,
0
);}
{
yylhsminor
.
yy2
24
=
tSQLExprListAppend
(
0
,
yymsp
[
0
].
minor
.
yy66
,
0
);}
yymsp
[
0
].
minor
.
yy2
60
=
yylhsminor
.
yy260
;
yymsp
[
0
].
minor
.
yy2
24
=
yylhsminor
.
yy224
;
break
;
break
;
case
2
08
:
/* expritem ::= expr */
case
2
11
:
/* expritem ::= expr */
{
yylhsminor
.
yy
500
=
yymsp
[
0
].
minor
.
yy500
;}
{
yylhsminor
.
yy
66
=
yymsp
[
0
].
minor
.
yy66
;}
yymsp
[
0
].
minor
.
yy
500
=
yylhsminor
.
yy500
;
yymsp
[
0
].
minor
.
yy
66
=
yylhsminor
.
yy66
;
break
;
break
;
case
21
0
:
/* cmd ::= RESET QUERY CACHE */
case
21
3
:
/* cmd ::= RESET QUERY CACHE */
{
setDCLSQLElems
(
pInfo
,
TSDB_SQL_RESET_CACHE
,
0
);}
{
setDCLSQLElems
(
pInfo
,
TSDB_SQL_RESET_CACHE
,
0
);}
break
;
break
;
case
21
1
:
/* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
case
21
4
:
/* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
{
{
yymsp
[
-
4
].
minor
.
yy0
.
n
+=
yymsp
[
-
3
].
minor
.
yy0
.
n
;
yymsp
[
-
4
].
minor
.
yy0
.
n
+=
yymsp
[
-
3
].
minor
.
yy0
.
n
;
SAlterTableSQL
*
pAlterTable
=
tAlterTableSQLElems
(
&
yymsp
[
-
4
].
minor
.
yy0
,
yymsp
[
0
].
minor
.
yy
36
9
,
NULL
,
TSDB_ALTER_TABLE_ADD_COLUMN
);
SAlterTableSQL
*
pAlterTable
=
tAlterTableSQLElems
(
&
yymsp
[
-
4
].
minor
.
yy0
,
yymsp
[
0
].
minor
.
yy
44
9
,
NULL
,
TSDB_ALTER_TABLE_ADD_COLUMN
);
setSQLInfo
(
pInfo
,
pAlterTable
,
NULL
,
TSDB_SQL_ALTER_TABLE
);
setSQLInfo
(
pInfo
,
pAlterTable
,
NULL
,
TSDB_SQL_ALTER_TABLE
);
}
}
break
;
break
;
case
21
2
:
/* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
case
21
5
:
/* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
{
{
yymsp
[
-
4
].
minor
.
yy0
.
n
+=
yymsp
[
-
3
].
minor
.
yy0
.
n
;
yymsp
[
-
4
].
minor
.
yy0
.
n
+=
yymsp
[
-
3
].
minor
.
yy0
.
n
;
...
@@ -2697,14 +2716,14 @@ static void yy_reduce(
...
@@ -2697,14 +2716,14 @@ static void yy_reduce(
setSQLInfo
(
pInfo
,
pAlterTable
,
NULL
,
TSDB_SQL_ALTER_TABLE
);
setSQLInfo
(
pInfo
,
pAlterTable
,
NULL
,
TSDB_SQL_ALTER_TABLE
);
}
}
break
;
break
;
case
21
3
:
/* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
case
21
6
:
/* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
{
{
yymsp
[
-
4
].
minor
.
yy0
.
n
+=
yymsp
[
-
3
].
minor
.
yy0
.
n
;
yymsp
[
-
4
].
minor
.
yy0
.
n
+=
yymsp
[
-
3
].
minor
.
yy0
.
n
;
SAlterTableSQL
*
pAlterTable
=
tAlterTableSQLElems
(
&
yymsp
[
-
4
].
minor
.
yy0
,
yymsp
[
0
].
minor
.
yy
36
9
,
NULL
,
TSDB_ALTER_TABLE_ADD_TAG_COLUMN
);
SAlterTableSQL
*
pAlterTable
=
tAlterTableSQLElems
(
&
yymsp
[
-
4
].
minor
.
yy0
,
yymsp
[
0
].
minor
.
yy
44
9
,
NULL
,
TSDB_ALTER_TABLE_ADD_TAG_COLUMN
);
setSQLInfo
(
pInfo
,
pAlterTable
,
NULL
,
TSDB_SQL_ALTER_TABLE
);
setSQLInfo
(
pInfo
,
pAlterTable
,
NULL
,
TSDB_SQL_ALTER_TABLE
);
}
}
break
;
break
;
case
21
4
:
/* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
case
21
7
:
/* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
{
{
yymsp
[
-
4
].
minor
.
yy0
.
n
+=
yymsp
[
-
3
].
minor
.
yy0
.
n
;
yymsp
[
-
4
].
minor
.
yy0
.
n
+=
yymsp
[
-
3
].
minor
.
yy0
.
n
;
...
@@ -2715,7 +2734,7 @@ static void yy_reduce(
...
@@ -2715,7 +2734,7 @@ static void yy_reduce(
setSQLInfo
(
pInfo
,
pAlterTable
,
NULL
,
TSDB_SQL_ALTER_TABLE
);
setSQLInfo
(
pInfo
,
pAlterTable
,
NULL
,
TSDB_SQL_ALTER_TABLE
);
}
}
break
;
break
;
case
21
5
:
/* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
case
21
8
:
/* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
{
{
yymsp
[
-
5
].
minor
.
yy0
.
n
+=
yymsp
[
-
4
].
minor
.
yy0
.
n
;
yymsp
[
-
5
].
minor
.
yy0
.
n
+=
yymsp
[
-
4
].
minor
.
yy0
.
n
;
...
@@ -2729,25 +2748,25 @@ static void yy_reduce(
...
@@ -2729,25 +2748,25 @@ static void yy_reduce(
setSQLInfo
(
pInfo
,
pAlterTable
,
NULL
,
TSDB_SQL_ALTER_TABLE
);
setSQLInfo
(
pInfo
,
pAlterTable
,
NULL
,
TSDB_SQL_ALTER_TABLE
);
}
}
break
;
break
;
case
21
6
:
/* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
case
21
9
:
/* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
{
{
yymsp
[
-
6
].
minor
.
yy0
.
n
+=
yymsp
[
-
5
].
minor
.
yy0
.
n
;
yymsp
[
-
6
].
minor
.
yy0
.
n
+=
yymsp
[
-
5
].
minor
.
yy0
.
n
;
toTSDBType
(
yymsp
[
-
2
].
minor
.
yy0
.
type
);
toTSDBType
(
yymsp
[
-
2
].
minor
.
yy0
.
type
);
tVariantList
*
A
=
tVariantListAppendToken
(
NULL
,
&
yymsp
[
-
2
].
minor
.
yy0
,
-
1
);
tVariantList
*
A
=
tVariantListAppendToken
(
NULL
,
&
yymsp
[
-
2
].
minor
.
yy0
,
-
1
);
A
=
tVariantListAppend
(
A
,
&
yymsp
[
0
].
minor
.
yy
518
,
-
1
);
A
=
tVariantListAppend
(
A
,
&
yymsp
[
0
].
minor
.
yy
312
,
-
1
);
SAlterTableSQL
*
pAlterTable
=
tAlterTableSQLElems
(
&
yymsp
[
-
6
].
minor
.
yy0
,
NULL
,
A
,
TSDB_ALTER_TABLE_UPDATE_TAG_VAL
);
SAlterTableSQL
*
pAlterTable
=
tAlterTableSQLElems
(
&
yymsp
[
-
6
].
minor
.
yy0
,
NULL
,
A
,
TSDB_ALTER_TABLE_UPDATE_TAG_VAL
);
setSQLInfo
(
pInfo
,
pAlterTable
,
NULL
,
TSDB_SQL_ALTER_TABLE
);
setSQLInfo
(
pInfo
,
pAlterTable
,
NULL
,
TSDB_SQL_ALTER_TABLE
);
}
}
break
;
break
;
case
2
17
:
/* cmd ::= KILL CONNECTION INTEGER */
case
2
20
:
/* cmd ::= KILL CONNECTION INTEGER */
{
setKillSQL
(
pInfo
,
TSDB_SQL_KILL_CONNECTION
,
&
yymsp
[
0
].
minor
.
yy0
);}
{
setKillSQL
(
pInfo
,
TSDB_SQL_KILL_CONNECTION
,
&
yymsp
[
0
].
minor
.
yy0
);}
break
;
break
;
case
2
18
:
/* cmd ::= KILL STREAM INTEGER COLON INTEGER */
case
2
21
:
/* cmd ::= KILL STREAM INTEGER COLON INTEGER */
{
yymsp
[
-
2
].
minor
.
yy0
.
n
+=
(
yymsp
[
-
1
].
minor
.
yy0
.
n
+
yymsp
[
0
].
minor
.
yy0
.
n
);
setKillSQL
(
pInfo
,
TSDB_SQL_KILL_STREAM
,
&
yymsp
[
-
2
].
minor
.
yy0
);}
{
yymsp
[
-
2
].
minor
.
yy0
.
n
+=
(
yymsp
[
-
1
].
minor
.
yy0
.
n
+
yymsp
[
0
].
minor
.
yy0
.
n
);
setKillSQL
(
pInfo
,
TSDB_SQL_KILL_STREAM
,
&
yymsp
[
-
2
].
minor
.
yy0
);}
break
;
break
;
case
2
19
:
/* cmd ::= KILL QUERY INTEGER COLON INTEGER */
case
2
22
:
/* cmd ::= KILL QUERY INTEGER COLON INTEGER */
{
yymsp
[
-
2
].
minor
.
yy0
.
n
+=
(
yymsp
[
-
1
].
minor
.
yy0
.
n
+
yymsp
[
0
].
minor
.
yy0
.
n
);
setKillSQL
(
pInfo
,
TSDB_SQL_KILL_QUERY
,
&
yymsp
[
-
2
].
minor
.
yy0
);}
{
yymsp
[
-
2
].
minor
.
yy0
.
n
+=
(
yymsp
[
-
1
].
minor
.
yy0
.
n
+
yymsp
[
0
].
minor
.
yy0
.
n
);
setKillSQL
(
pInfo
,
TSDB_SQL_KILL_QUERY
,
&
yymsp
[
-
2
].
minor
.
yy0
);}
break
;
break
;
default:
default:
...
...
src/tsdb/inc/tsdbMain.h
浏览文件 @
a3714edf
...
@@ -96,6 +96,11 @@ typedef struct {
...
@@ -96,6 +96,11 @@ typedef struct {
}
STsdbBufPool
;
}
STsdbBufPool
;
// ------------------ tsdbMemTable.c
// ------------------ tsdbMemTable.c
typedef
struct
{
STable
*
pTable
;
SSkipListIterator
*
pIter
;
}
SCommitIter
;
typedef
struct
{
typedef
struct
{
uint64_t
uid
;
uint64_t
uid
;
TSKEY
keyFirst
;
TSKEY
keyFirst
;
...
@@ -206,10 +211,10 @@ typedef struct {
...
@@ -206,10 +211,10 @@ typedef struct {
int64_t
offset
:
63
;
int64_t
offset
:
63
;
int32_t
algorithm
:
8
;
int32_t
algorithm
:
8
;
int32_t
numOfRows
:
24
;
int32_t
numOfRows
:
24
;
int32_t
sversion
;
int32_t
len
;
int32_t
len
;
int32_t
keyLen
;
// key column length, keyOffset = offset+sizeof(SCompData)+sizeof(SCompCol)*numOfCols
int16_t
numOfSubBlocks
;
int16_t
numOfSubBlocks
;
int16_t
numOfCols
;
int16_t
numOfCols
;
// not including timestamp column
TSKEY
keyFirst
;
TSKEY
keyFirst
;
TSKEY
keyLast
;
TSKEY
keyLast
;
}
SCompBlock
;
}
SCompBlock
;
...
@@ -377,6 +382,24 @@ int tsdbUnRefMemTable(STsdbRepo* pRepo, SMemTable* pMemTable);
...
@@ -377,6 +382,24 @@ int tsdbUnRefMemTable(STsdbRepo* pRepo, SMemTable* pMemTable);
int
tsdbTakeMemSnapshot
(
STsdbRepo
*
pRepo
,
SMemTable
**
pMem
,
SMemTable
**
pIMem
);
int
tsdbTakeMemSnapshot
(
STsdbRepo
*
pRepo
,
SMemTable
**
pMem
,
SMemTable
**
pIMem
);
void
*
tsdbAllocBytes
(
STsdbRepo
*
pRepo
,
int
bytes
);
void
*
tsdbAllocBytes
(
STsdbRepo
*
pRepo
,
int
bytes
);
int
tsdbAsyncCommit
(
STsdbRepo
*
pRepo
);
int
tsdbAsyncCommit
(
STsdbRepo
*
pRepo
);
int
tsdbLoadDataFromCache
(
STable
*
pTable
,
SSkipListIterator
*
pIter
,
TSKEY
maxKey
,
int
maxRowsToRead
,
SDataCols
*
pCols
,
TSKEY
*
filterKeys
,
int
nFilterKeys
);
static
FORCE_INLINE
SDataRow
tsdbNextIterRow
(
SSkipListIterator
*
pIter
)
{
if
(
pIter
==
NULL
)
return
NULL
;
SSkipListNode
*
node
=
tSkipListIterGet
(
pIter
);
if
(
node
==
NULL
)
return
NULL
;
return
SL_GET_NODE_DATA
(
node
);
}
static
FORCE_INLINE
TSKEY
tsdbNextIterKey
(
SSkipListIterator
*
pIter
)
{
SDataRow
row
=
tsdbNextIterRow
(
pIter
);
if
(
row
==
NULL
)
return
-
1
;
return
dataRowKey
(
row
);
}
// ------------------ tsdbFile.c
// ------------------ tsdbFile.c
#define TSDB_KEY_FILEID(key, daysPerFile, precision) ((key) / tsMsPerDay[(precision)] / (daysPerFile))
#define TSDB_KEY_FILEID(key, daysPerFile, precision) ((key) / tsMsPerDay[(precision)] / (daysPerFile))
...
@@ -421,25 +444,36 @@ void tsdbRemoveFileGroup(STsdbRepo* pRepo, SFileGroup* pFGroup);
...
@@ -421,25 +444,36 @@ void tsdbRemoveFileGroup(STsdbRepo* pRepo, SFileGroup* pFGroup);
#define helperType(h) (h)->type
#define helperType(h) (h)->type
#define helperRepo(h) (h)->pRepo
#define helperRepo(h) (h)->pRepo
#define helperState(h) (h)->state
#define helperState(h) (h)->state
#define TSDB_NLAST_FILE_OPENED(h) ((h)->files.nLastF.fd > 0)
int
tsdbInitReadHelper
(
SRWHelper
*
pHelper
,
STsdbRepo
*
pRepo
);
int
tsdbInitWriteHelper
(
SRWHelper
*
pHelper
,
STsdbRepo
*
pRepo
);
int
tsdbInitReadHelper
(
SRWHelper
*
pHelper
,
STsdbRepo
*
pRepo
);
void
tsdbDestroyHelper
(
SRWHelper
*
pHelper
);
int
tsdbInitWriteHelper
(
SRWHelper
*
pHelper
,
STsdbRepo
*
pRepo
);
void
tsdbResetHelper
(
SRWHelper
*
pHelper
);
void
tsdbDestroyHelper
(
SRWHelper
*
pHelper
);
int
tsdbSetAndOpenHelperFile
(
SRWHelper
*
pHelper
,
SFileGroup
*
pGroup
);
void
tsdbResetHelper
(
SRWHelper
*
pHelper
);
int
tsdbCloseHelperFile
(
SRWHelper
*
pHelper
,
bool
hasError
);
int
tsdbSetAndOpenHelperFile
(
SRWHelper
*
pHelper
,
SFileGroup
*
pGroup
);
void
tsdbSetHelperTable
(
SRWHelper
*
pHelper
,
STable
*
pTable
,
STsdbRepo
*
pRepo
);
int
tsdbCloseHelperFile
(
SRWHelper
*
pHelper
,
bool
hasError
);
int
tsdbWriteDataBlock
(
SRWHelper
*
pHelper
,
SDataCols
*
pDataCols
);
void
tsdbSetHelperTable
(
SRWHelper
*
pHelper
,
STable
*
pTable
,
STsdbRepo
*
pRepo
);
int
tsdbMoveLastBlockIfNeccessary
(
SRWHelper
*
pHelper
);
int
tsdbCommitTableData
(
SRWHelper
*
pHelper
,
SCommitIter
*
pCommitIter
,
SDataCols
*
pDataCols
,
TSKEY
maxKey
);
int
tsdbWriteCompInfo
(
SRWHelper
*
pHelper
);
int
tsdbMoveLastBlockIfNeccessary
(
SRWHelper
*
pHelper
);
int
tsdbWriteCompIdx
(
SRWHelper
*
pHelper
);
int
tsdbWriteCompInfo
(
SRWHelper
*
pHelper
);
int
tsdbLoadCompIdx
(
SRWHelper
*
pHelper
,
void
*
target
);
int
tsdbWriteCompIdx
(
SRWHelper
*
pHelper
);
int
tsdbLoadCompInfo
(
SRWHelper
*
pHelper
,
void
*
target
);
int
tsdbLoadCompIdx
(
SRWHelper
*
pHelper
,
void
*
target
);
int
tsdbLoadCompData
(
SRWHelper
*
phelper
,
SCompBlock
*
pcompblock
,
void
*
target
);
int
tsdbLoadCompInfo
(
SRWHelper
*
pHelper
,
void
*
target
);
void
tsdbGetDataStatis
(
SRWHelper
*
pHelper
,
SDataStatis
*
pStatis
,
int
numOfCols
);
int
tsdbLoadCompData
(
SRWHelper
*
phelper
,
SCompBlock
*
pcompblock
,
void
*
target
);
int
tsdbLoadBlockDataCols
(
SRWHelper
*
pHelper
,
SCompBlock
*
pCompBlock
,
SCompInfo
*
pCompInfo
,
int16_t
*
colIds
,
void
tsdbGetDataStatis
(
SRWHelper
*
pHelper
,
SDataStatis
*
pStatis
,
int
numOfCols
);
int
numOfColIds
);
int
tsdbLoadBlockDataCols
(
SRWHelper
*
pHelper
,
SCompBlock
*
pCompBlock
,
SCompInfo
*
pCompInfo
,
int16_t
*
colIds
,
int
tsdbLoadBlockData
(
SRWHelper
*
pHelper
,
SCompBlock
*
pCompBlock
,
SCompInfo
*
pCompInfo
);
int
numOfColIds
);
int
tsdbLoadBlockData
(
SRWHelper
*
pHelper
,
SCompBlock
*
pCompBlock
,
SCompInfo
*
pCompInfo
);
static
FORCE_INLINE
int
compTSKEY
(
const
void
*
key1
,
const
void
*
key2
)
{
if
(
*
(
TSKEY
*
)
key1
>
*
(
TSKEY
*
)
key2
)
{
return
1
;
}
else
if
(
*
(
TSKEY
*
)
key1
==
*
(
TSKEY
*
)
key2
)
{
return
0
;
}
else
{
return
-
1
;
}
}
// ------------------ tsdbMain.c
// ------------------ tsdbMain.c
#define REPO_ID(r) (r)->config.tsdbId
#define REPO_ID(r) (r)->config.tsdbId
...
...
src/tsdb/src/tsdbMemTable.c
浏览文件 @
a3714edf
...
@@ -18,11 +18,6 @@
...
@@ -18,11 +18,6 @@
#define TSDB_DATA_SKIPLIST_LEVEL 5
#define TSDB_DATA_SKIPLIST_LEVEL 5
typedef
struct
{
STable
*
pTable
;
SSkipListIterator
*
pIter
;
}
SCommitIter
;
static
FORCE_INLINE
STsdbBufBlock
*
tsdbGetCurrBufBlock
(
STsdbRepo
*
pRepo
);
static
FORCE_INLINE
STsdbBufBlock
*
tsdbGetCurrBufBlock
(
STsdbRepo
*
pRepo
);
static
void
tsdbFreeBytes
(
STsdbRepo
*
pRepo
,
void
*
ptr
,
int
bytes
);
static
void
tsdbFreeBytes
(
STsdbRepo
*
pRepo
,
void
*
ptr
,
int
bytes
);
...
@@ -34,14 +29,11 @@ static char * tsdbGetTsTupleKey(const void *data);
...
@@ -34,14 +29,11 @@ static char * tsdbGetTsTupleKey(const void *data);
static
void
*
tsdbCommitData
(
void
*
arg
);
static
void
*
tsdbCommitData
(
void
*
arg
);
static
int
tsdbCommitMeta
(
STsdbRepo
*
pRepo
);
static
int
tsdbCommitMeta
(
STsdbRepo
*
pRepo
);
static
void
tsdbEndCommit
(
STsdbRepo
*
pRepo
);
static
void
tsdbEndCommit
(
STsdbRepo
*
pRepo
);
static
TSKEY
tsdbNextIterKey
(
SCommitIter
*
pIter
);
static
int
tsdbHasDataToCommit
(
SCommitIter
*
iters
,
int
nIters
,
TSKEY
minKey
,
TSKEY
maxKey
);
static
int
tsdbHasDataToCommit
(
SCommitIter
*
iters
,
int
nIters
,
TSKEY
minKey
,
TSKEY
maxKey
);
static
int
tsdbCommitToFile
(
STsdbRepo
*
pRepo
,
int
fid
,
SCommitIter
*
iters
,
SRWHelper
*
pHelper
,
SDataCols
*
pDataCols
);
static
int
tsdbCommitToFile
(
STsdbRepo
*
pRepo
,
int
fid
,
SCommitIter
*
iters
,
SRWHelper
*
pHelper
,
SDataCols
*
pDataCols
);
static
void
tsdbGetFidKeyRange
(
int
daysPerFile
,
int8_t
precision
,
int
fileId
,
TSKEY
*
minKey
,
TSKEY
*
maxKey
);
static
void
tsdbGetFidKeyRange
(
int
daysPerFile
,
int8_t
precision
,
int
fileId
,
TSKEY
*
minKey
,
TSKEY
*
maxKey
);
static
SCommitIter
*
tsdbCreateTableIters
(
STsdbRepo
*
pRepo
);
static
SCommitIter
*
tsdbCreateCommitIters
(
STsdbRepo
*
pRepo
);
static
void
tsdbDestroyTableIters
(
SCommitIter
*
iters
,
int
maxTables
);
static
void
tsdbDestroyCommitIters
(
SCommitIter
*
iters
,
int
maxTables
);
static
int
tsdbReadRowsFromCache
(
STsdbMeta
*
pMeta
,
STable
*
pTable
,
SSkipListIterator
*
pIter
,
TSKEY
maxKey
,
int
maxRowsToRead
,
SDataCols
*
pCols
);
// ---------------- INTERNAL FUNCTIONS ----------------
// ---------------- INTERNAL FUNCTIONS ----------------
int
tsdbInsertRowToMem
(
STsdbRepo
*
pRepo
,
SDataRow
row
,
STable
*
pTable
)
{
int
tsdbInsertRowToMem
(
STsdbRepo
*
pRepo
,
SDataRow
row
,
STable
*
pTable
)
{
...
@@ -252,6 +244,66 @@ int tsdbAsyncCommit(STsdbRepo *pRepo) {
...
@@ -252,6 +244,66 @@ int tsdbAsyncCommit(STsdbRepo *pRepo) {
return
0
;
return
0
;
}
}
int
tsdbLoadDataFromCache
(
STable
*
pTable
,
SSkipListIterator
*
pIter
,
TSKEY
maxKey
,
int
maxRowsToRead
,
SDataCols
*
pCols
,
TSKEY
*
filterKeys
,
int
nFilterKeys
)
{
ASSERT
(
maxRowsToRead
>
0
&&
nFilterKeys
>=
0
);
if
(
pIter
==
NULL
)
return
0
;
STSchema
*
pSchema
=
NULL
;
int
numOfRows
=
0
;
TSKEY
keyNext
=
0
;
int
filterIter
=
0
;
if
(
nFilterKeys
!=
0
)
{
// for filter purpose
ASSERT
(
filterKeys
!=
NULL
);
keyNext
=
tsdbNextIterKey
(
pIter
);
if
(
keyNext
<
0
||
keyNext
>
maxKey
)
return
numOfRows
;
void
*
ptr
=
taosbsearch
((
void
*
)(
&
keyNext
),
(
void
*
)
filterKeys
,
nFilterKeys
,
sizeof
(
TSKEY
),
compTSKEY
,
TD_GE
);
filterIter
=
(
ptr
==
NULL
)
?
nFilterKeys
:
(
POINTER_DISTANCE
(
ptr
,
filterKeys
)
/
sizeof
(
TSKEY
));
}
do
{
if
(
numOfRows
>=
maxRowsToRead
)
break
;
SDataRow
row
=
tsdbNextIterRow
(
pIter
);
if
(
row
==
NULL
)
break
;
keyNext
=
dataRowKey
(
row
);
if
(
keyNext
<
0
||
keyNext
>
maxKey
)
break
;
bool
keyFiltered
=
false
;
if
(
nFilterKeys
!=
0
)
{
while
(
true
)
{
if
(
filterIter
>=
nFilterKeys
)
break
;
if
(
keyNext
==
filterKeys
[
filterIter
])
{
keyFiltered
=
true
;
filterIter
++
;
break
;
}
else
if
(
keyNext
<
filterKeys
[
filterIter
])
{
break
;
}
else
{
filterIter
++
;
}
}
}
if
(
!
keyFiltered
)
{
if
(
pCols
)
{
if
(
pSchema
==
NULL
||
schemaVersion
(
pSchema
)
!=
dataRowVersion
(
row
))
{
pSchema
=
tsdbGetTableSchemaImpl
(
pTable
,
false
,
false
,
dataRowVersion
(
row
));
if
(
pSchema
==
NULL
)
{
ASSERT
(
0
);
}
}
tdAppendDataRowToDataCol
(
row
,
pSchema
,
pCols
);
}
numOfRows
++
;
}
}
while
(
tSkipListIterNext
(
pIter
));
return
numOfRows
;
}
// ---------------- LOCAL FUNCTIONS ----------------
// ---------------- LOCAL FUNCTIONS ----------------
static
FORCE_INLINE
STsdbBufBlock
*
tsdbGetCurrBufBlock
(
STsdbRepo
*
pRepo
)
{
static
FORCE_INLINE
STsdbBufBlock
*
tsdbGetCurrBufBlock
(
STsdbRepo
*
pRepo
)
{
ASSERT
(
pRepo
!=
NULL
);
ASSERT
(
pRepo
!=
NULL
);
...
@@ -378,7 +430,7 @@ static void *tsdbCommitData(void *arg) {
...
@@ -378,7 +430,7 @@ static void *tsdbCommitData(void *arg) {
// Create the iterator to read from cache
// Create the iterator to read from cache
if
(
pMem
->
numOfRows
>
0
)
{
if
(
pMem
->
numOfRows
>
0
)
{
iters
=
tsdbCreate
Table
Iters
(
pRepo
);
iters
=
tsdbCreate
Commit
Iters
(
pRepo
);
if
(
iters
==
NULL
)
{
if
(
iters
==
NULL
)
{
tsdbError
(
"vgId:%d failed to create commit iterator since %s"
,
REPO_ID
(
pRepo
),
tstrerror
(
terrno
));
tsdbError
(
"vgId:%d failed to create commit iterator since %s"
,
REPO_ID
(
pRepo
),
tstrerror
(
terrno
));
goto
_exit
;
goto
_exit
;
...
@@ -418,7 +470,7 @@ static void *tsdbCommitData(void *arg) {
...
@@ -418,7 +470,7 @@ static void *tsdbCommitData(void *arg) {
_exit:
_exit:
tdFreeDataCols
(
pDataCols
);
tdFreeDataCols
(
pDataCols
);
tsdbDestroy
Table
Iters
(
iters
,
pCfg
->
maxTables
);
tsdbDestroy
Commit
Iters
(
iters
,
pCfg
->
maxTables
);
tsdbDestroyHelper
(
&
whelper
);
tsdbDestroyHelper
(
&
whelper
);
tsdbEndCommit
(
pRepo
);
tsdbEndCommit
(
pRepo
);
tsdbInfo
(
"vgId:%d commit over"
,
pRepo
->
config
.
tsdbId
);
tsdbInfo
(
"vgId:%d commit over"
,
pRepo
->
config
.
tsdbId
);
...
@@ -479,19 +531,9 @@ static void tsdbEndCommit(STsdbRepo *pRepo) {
...
@@ -479,19 +531,9 @@ static void tsdbEndCommit(STsdbRepo *pRepo) {
if
(
pRepo
->
appH
.
notifyStatus
)
pRepo
->
appH
.
notifyStatus
(
pRepo
->
appH
.
appH
,
TSDB_STATUS_COMMIT_OVER
);
if
(
pRepo
->
appH
.
notifyStatus
)
pRepo
->
appH
.
notifyStatus
(
pRepo
->
appH
.
appH
,
TSDB_STATUS_COMMIT_OVER
);
}
}
static
TSKEY
tsdbNextIterKey
(
SCommitIter
*
pIter
)
{
if
(
pIter
==
NULL
)
return
-
1
;
SSkipListNode
*
node
=
tSkipListIterGet
(
pIter
->
pIter
);
if
(
node
==
NULL
)
return
-
1
;
SDataRow
row
=
SL_GET_NODE_DATA
(
node
);
return
dataRowKey
(
row
);
}
static
int
tsdbHasDataToCommit
(
SCommitIter
*
iters
,
int
nIters
,
TSKEY
minKey
,
TSKEY
maxKey
)
{
static
int
tsdbHasDataToCommit
(
SCommitIter
*
iters
,
int
nIters
,
TSKEY
minKey
,
TSKEY
maxKey
)
{
for
(
int
i
=
0
;
i
<
nIters
;
i
++
)
{
for
(
int
i
=
0
;
i
<
nIters
;
i
++
)
{
TSKEY
nextKey
=
tsdbNextIterKey
(
iters
+
i
);
TSKEY
nextKey
=
tsdbNextIterKey
(
(
iters
+
i
)
->
pIter
);
if
(
nextKey
>
0
&&
(
nextKey
>=
minKey
&&
nextKey
<=
maxKey
))
return
1
;
if
(
nextKey
>
0
&&
(
nextKey
>=
minKey
&&
nextKey
<=
maxKey
))
return
1
;
}
}
return
0
;
return
0
;
...
@@ -504,7 +546,6 @@ static void tsdbGetFidKeyRange(int daysPerFile, int8_t precision, int fileId, TS
...
@@ -504,7 +546,6 @@ static void tsdbGetFidKeyRange(int daysPerFile, int8_t precision, int fileId, TS
static
int
tsdbCommitToFile
(
STsdbRepo
*
pRepo
,
int
fid
,
SCommitIter
*
iters
,
SRWHelper
*
pHelper
,
SDataCols
*
pDataCols
)
{
static
int
tsdbCommitToFile
(
STsdbRepo
*
pRepo
,
int
fid
,
SCommitIter
*
iters
,
SRWHelper
*
pHelper
,
SDataCols
*
pDataCols
)
{
char
*
dataDir
=
NULL
;
char
*
dataDir
=
NULL
;
STsdbMeta
*
pMeta
=
pRepo
->
tsdbMeta
;
STsdbCfg
*
pCfg
=
&
pRepo
->
config
;
STsdbCfg
*
pCfg
=
&
pRepo
->
config
;
STsdbFileH
*
pFileH
=
pRepo
->
tsdbFileH
;
STsdbFileH
*
pFileH
=
pRepo
->
tsdbFileH
;
SFileGroup
*
pGroup
=
NULL
;
SFileGroup
*
pGroup
=
NULL
;
...
@@ -549,33 +590,13 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SCommitIter *iters, SRWHe
...
@@ -549,33 +590,13 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SCommitIter *iters, SRWHe
if
(
pIter
->
pIter
!=
NULL
)
{
if
(
pIter
->
pIter
!=
NULL
)
{
tdInitDataCols
(
pDataCols
,
tsdbGetTableSchemaImpl
(
pIter
->
pTable
,
false
,
false
,
-
1
));
tdInitDataCols
(
pDataCols
,
tsdbGetTableSchemaImpl
(
pIter
->
pTable
,
false
,
false
,
-
1
));
int
maxRowsToRead
=
pCfg
->
maxRowsPerFileBlock
*
4
/
5
;
if
(
tsdbCommitTableData
(
pHelper
,
pIter
,
pDataCols
,
maxKey
)
<
0
)
{
int
nLoop
=
0
;
taosRUnLockLatch
(
&
(
pIter
->
pTable
->
latch
));
while
(
true
)
{
tsdbError
(
"vgId:%d failed to write data of table %s tid %d uid %"
PRIu64
" since %s"
,
REPO_ID
(
pRepo
),
int
rowsRead
=
tsdbReadRowsFromCache
(
pMeta
,
pIter
->
pTable
,
pIter
->
pIter
,
maxKey
,
maxRowsToRead
,
pDataCols
);
TABLE_CHAR_NAME
(
pIter
->
pTable
),
TABLE_TID
(
pIter
->
pTable
),
TABLE_UID
(
pIter
->
pTable
),
ASSERT
(
rowsRead
>=
0
);
tstrerror
(
terrno
));
if
(
pDataCols
->
numOfRows
==
0
)
break
;
goto
_err
;
nLoop
++
;
ASSERT
(
dataColsKeyFirst
(
pDataCols
)
>=
minKey
&&
dataColsKeyFirst
(
pDataCols
)
<=
maxKey
);
ASSERT
(
dataColsKeyLast
(
pDataCols
)
>=
minKey
&&
dataColsKeyLast
(
pDataCols
)
<=
maxKey
);
int
rowsWritten
=
tsdbWriteDataBlock
(
pHelper
,
pDataCols
);
ASSERT
(
rowsWritten
!=
0
);
if
(
rowsWritten
<
0
)
{
taosRUnLockLatch
(
&
(
pIter
->
pTable
->
latch
));
tsdbError
(
"vgId:%d failed to write data block to table %s tid %d uid %"
PRIu64
" since %s"
,
REPO_ID
(
pRepo
),
TABLE_CHAR_NAME
(
pIter
->
pTable
),
TABLE_TID
(
pIter
->
pTable
),
TABLE_UID
(
pIter
->
pTable
),
tstrerror
(
terrno
));
goto
_err
;
}
ASSERT
(
rowsWritten
<=
pDataCols
->
numOfRows
);
tdPopDataColsPoints
(
pDataCols
,
rowsWritten
);
maxRowsToRead
=
pCfg
->
maxRowsPerFileBlock
*
4
/
5
-
pDataCols
->
numOfRows
;
}
}
ASSERT
(
pDataCols
->
numOfRows
==
0
);
}
}
taosRUnLockLatch
(
&
(
pIter
->
pTable
->
latch
));
taosRUnLockLatch
(
&
(
pIter
->
pTable
->
latch
));
...
@@ -615,7 +636,7 @@ _err:
...
@@ -615,7 +636,7 @@ _err:
return
-
1
;
return
-
1
;
}
}
static
SCommitIter
*
tsdbCreate
Table
Iters
(
STsdbRepo
*
pRepo
)
{
static
SCommitIter
*
tsdbCreate
Commit
Iters
(
STsdbRepo
*
pRepo
)
{
STsdbCfg
*
pCfg
=
&
(
pRepo
->
config
);
STsdbCfg
*
pCfg
=
&
(
pRepo
->
config
);
SMemTable
*
pMem
=
pRepo
->
imem
;
SMemTable
*
pMem
=
pRepo
->
imem
;
STsdbMeta
*
pMeta
=
pRepo
->
tsdbMeta
;
STsdbMeta
*
pMeta
=
pRepo
->
tsdbMeta
;
...
@@ -645,21 +666,18 @@ static SCommitIter *tsdbCreateTableIters(STsdbRepo *pRepo) {
...
@@ -645,21 +666,18 @@ static SCommitIter *tsdbCreateTableIters(STsdbRepo *pRepo) {
goto
_err
;
goto
_err
;
}
}
if
(
!
tSkipListIterNext
(
iters
[
i
].
pIter
))
{
tSkipListIterNext
(
iters
[
i
].
pIter
);
terrno
=
TSDB_CODE_TDB_NO_TABLE_DATA_IN_MEM
;
goto
_err
;
}
}
}
}
}
return
iters
;
return
iters
;
_err:
_err:
tsdbDestroy
Table
Iters
(
iters
,
pCfg
->
maxTables
);
tsdbDestroy
Commit
Iters
(
iters
,
pCfg
->
maxTables
);
return
NULL
;
return
NULL
;
}
}
static
void
tsdbDestroy
Table
Iters
(
SCommitIter
*
iters
,
int
maxTables
)
{
static
void
tsdbDestroy
Commit
Iters
(
SCommitIter
*
iters
,
int
maxTables
)
{
if
(
iters
==
NULL
)
return
;
if
(
iters
==
NULL
)
return
;
for
(
int
i
=
1
;
i
<
maxTables
;
i
++
)
{
for
(
int
i
=
1
;
i
<
maxTables
;
i
++
)
{
...
@@ -670,35 +688,4 @@ static void tsdbDestroyTableIters(SCommitIter *iters, int maxTables) {
...
@@ -670,35 +688,4 @@ static void tsdbDestroyTableIters(SCommitIter *iters, int maxTables) {
}
}
free
(
iters
);
free
(
iters
);
}
static
int
tsdbReadRowsFromCache
(
STsdbMeta
*
pMeta
,
STable
*
pTable
,
SSkipListIterator
*
pIter
,
TSKEY
maxKey
,
int
maxRowsToRead
,
SDataCols
*
pCols
)
{
ASSERT
(
maxRowsToRead
>
0
);
if
(
pIter
==
NULL
)
return
0
;
STSchema
*
pSchema
=
NULL
;
int
numOfRows
=
0
;
do
{
if
(
numOfRows
>=
maxRowsToRead
)
break
;
SSkipListNode
*
node
=
tSkipListIterGet
(
pIter
);
if
(
node
==
NULL
)
break
;
SDataRow
row
=
SL_GET_NODE_DATA
(
node
);
if
(
dataRowKey
(
row
)
>
maxKey
)
break
;
if
(
pSchema
==
NULL
||
schemaVersion
(
pSchema
)
!=
dataRowVersion
(
row
))
{
pSchema
=
tsdbGetTableSchemaImpl
(
pTable
,
true
,
false
,
dataRowVersion
(
row
));
if
(
pSchema
==
NULL
)
{
// TODO: deal with the error here
ASSERT
(
0
);
}
}
tdAppendDataRowToDataCol
(
row
,
pSchema
,
pCols
);
numOfRows
++
;
}
while
(
tSkipListIterNext
(
pIter
));
return
numOfRows
;
}
}
\ No newline at end of file
src/tsdb/src/tsdbMeta.c
浏览文件 @
a3714edf
...
@@ -727,7 +727,7 @@ static STable *tsdbNewTable(STableCfg *pCfg, bool isSuper) {
...
@@ -727,7 +727,7 @@ static STable *tsdbNewTable(STableCfg *pCfg, bool isSuper) {
T_REF_INC
(
pTable
);
T_REF_INC
(
pTable
);
tsdb
Debug
(
"table %s tid %d uid %"
PRIu64
" is created"
,
TABLE_CHAR_NAME
(
pTable
),
TABLE_TID
(
pTable
),
tsdb
Trace
(
"table %s tid %d uid %"
PRIu64
" is created"
,
TABLE_CHAR_NAME
(
pTable
),
TABLE_TID
(
pTable
),
TABLE_UID
(
pTable
));
TABLE_UID
(
pTable
));
return
pTable
;
return
pTable
;
...
@@ -740,7 +740,7 @@ _err:
...
@@ -740,7 +740,7 @@ _err:
static
void
tsdbFreeTable
(
STable
*
pTable
)
{
static
void
tsdbFreeTable
(
STable
*
pTable
)
{
if
(
pTable
)
{
if
(
pTable
)
{
if
(
pTable
->
name
!=
NULL
)
if
(
pTable
->
name
!=
NULL
)
tsdb
Debug
(
"table %s tid %d uid %"
PRIu64
" is destroy
ed"
,
TABLE_CHAR_NAME
(
pTable
),
TABLE_TID
(
pTable
),
tsdb
Trace
(
"table %s tid %d uid %"
PRIu64
" is fre
ed"
,
TABLE_CHAR_NAME
(
pTable
),
TABLE_TID
(
pTable
),
TABLE_UID
(
pTable
));
TABLE_UID
(
pTable
));
tfree
(
TABLE_NAME
(
pTable
));
tfree
(
TABLE_NAME
(
pTable
));
if
(
TABLE_TYPE
(
pTable
)
!=
TSDB_CHILD_TABLE
)
{
if
(
TABLE_TYPE
(
pTable
)
!=
TSDB_CHILD_TABLE
)
{
...
...
src/tsdb/src/tsdbRWHelper.c
浏览文件 @
a3714edf
...
@@ -22,39 +22,44 @@
...
@@ -22,39 +22,44 @@
#include "tfile.h"
#include "tfile.h"
#define TSDB_GET_COMPCOL_LEN(nCols) (sizeof(SCompData) + sizeof(SCompCol) * (nCols) + sizeof(TSCKSUM))
#define TSDB_GET_COMPCOL_LEN(nCols) (sizeof(SCompData) + sizeof(SCompCol) * (nCols) + sizeof(TSCKSUM))
#define TSDB_KEY_COL_OFFSET 0
static
bool
tsdbShouldCreateNewLast
(
SRWHelper
*
pHelper
);
#define TSDB_GET_COMPBLOCK_IDX(h, b) (POINTER_DISTANCE(b, (h)->pCompInfo->blocks)/sizeof(SCompBlock))
static
int
tsdbWriteBlockToFile
(
SRWHelper
*
pHelper
,
SFile
*
pFile
,
SDataCols
*
pDataCols
,
int
rowsToWrite
,
SCompBlock
*
pCompBlock
,
bool
isLast
,
bool
isSuperBlock
);
static
bool
tsdbShouldCreateNewLast
(
SRWHelper
*
pHelper
);
static
int
compareKeyBlock
(
const
void
*
arg1
,
const
void
*
arg2
);
static
int
tsdbWriteBlockToFile
(
SRWHelper
*
pHelper
,
SFile
*
pFile
,
SDataCols
*
pDataCols
,
SCompBlock
*
pCompBlock
,
static
int
tsdbMergeDataWithBlock
(
SRWHelper
*
pHelper
,
int
blkIdx
,
SDataCols
*
pDataCols
);
bool
isLast
,
bool
isSuperBlock
);
static
int
compTSKEY
(
const
void
*
key1
,
const
void
*
key2
);
static
int
compareKeyBlock
(
const
void
*
arg1
,
const
void
*
arg2
);
static
int
tsdbAdjustInfoSizeIfNeeded
(
SRWHelper
*
pHelper
,
size_t
esize
);
static
int
tsdbAdjustInfoSizeIfNeeded
(
SRWHelper
*
pHelper
,
size_t
esize
);
static
int
tsdbInsertSuperBlock
(
SRWHelper
*
pHelper
,
SCompBlock
*
pCompBlock
,
int
blkIdx
);
static
int
tsdbInsertSuperBlock
(
SRWHelper
*
pHelper
,
SCompBlock
*
pCompBlock
,
int
blkIdx
);
static
int
tsdbAddSubBlock
(
SRWHelper
*
pHelper
,
SCompBlock
*
pCompBlock
,
int
blkIdx
,
int
rowsAdded
);
static
int
tsdbAddSubBlock
(
SRWHelper
*
pHelper
,
SCompBlock
*
pCompBlock
,
int
blkIdx
,
int
rowsAdded
);
static
int
tsdbUpdateSuperBlock
(
SRWHelper
*
pHelper
,
SCompBlock
*
pCompBlock
,
int
blkIdx
);
static
int
tsdbUpdateSuperBlock
(
SRWHelper
*
pHelper
,
SCompBlock
*
pCompBlock
,
int
blkIdx
);
static
int
tsdbGetRowsInRange
(
SDataCols
*
pDataCols
,
TSKEY
minKey
,
TSKEY
maxKey
);
static
void
tsdbResetHelperFileImpl
(
SRWHelper
*
pHelper
);
static
void
tsdbResetHelperFileImpl
(
SRWHelper
*
pHelper
);
static
int
tsdbInitHelperFile
(
SRWHelper
*
pHelper
);
static
int
tsdbInitHelperFile
(
SRWHelper
*
pHelper
);
static
void
tsdbDestroyHelperFile
(
SRWHelper
*
pHelper
);
static
void
tsdbDestroyHelperFile
(
SRWHelper
*
pHelper
);
static
void
tsdbResetHelperTableImpl
(
SRWHelper
*
pHelper
);
static
void
tsdbResetHelperTableImpl
(
SRWHelper
*
pHelper
);
static
void
tsdbResetHelperTable
(
SRWHelper
*
pHelper
);
static
void
tsdbResetHelperTable
(
SRWHelper
*
pHelper
);
static
void
tsdbInitHelperTable
(
SRWHelper
*
pHelper
);
static
void
tsdbInitHelperTable
(
SRWHelper
*
pHelper
);
static
void
tsdbDestroyHelperTable
(
SRWHelper
*
pHelper
);
static
void
tsdbDestroyHelperTable
(
SRWHelper
*
pHelper
);
static
void
tsdbResetHelperBlockImpl
(
SRWHelper
*
pHelper
);
static
void
tsdbResetHelperBlockImpl
(
SRWHelper
*
pHelper
);
static
void
tsdbResetHelperBlock
(
SRWHelper
*
pHelper
);
static
void
tsdbResetHelperBlock
(
SRWHelper
*
pHelper
);
static
int
tsdbInitHelperBlock
(
SRWHelper
*
pHelper
);
static
int
tsdbInitHelperBlock
(
SRWHelper
*
pHelper
);
static
int
tsdbInitHelper
(
SRWHelper
*
pHelper
,
STsdbRepo
*
pRepo
,
tsdb_rw_helper_t
type
);
static
int
tsdbInitHelper
(
SRWHelper
*
pHelper
,
STsdbRepo
*
pRepo
,
tsdb_rw_helper_t
type
);
static
int
tsdbCheckAndDecodeColumnData
(
SDataCol
*
pDataCol
,
char
*
content
,
int32_t
len
,
int8_t
comp
,
int
numOfRows
,
static
int
tsdbCheckAndDecodeColumnData
(
SDataCol
*
pDataCol
,
char
*
content
,
int32_t
len
,
int8_t
comp
,
int
numOfRows
,
int
maxPoints
,
char
*
buffer
,
int
bufferSize
);
int
maxPoints
,
char
*
buffer
,
int
bufferSize
);
static
int
tsdbLoadBlockDataColsImpl
(
SRWHelper
*
pHelper
,
SCompBlock
*
pCompBlock
,
SDataCols
*
pDataCols
,
int16_t
*
colIds
,
static
int
tsdbLoadBlockDataColsImpl
(
SRWHelper
*
pHelper
,
SCompBlock
*
pCompBlock
,
SDataCols
*
pDataCols
,
int16_t
*
colIds
,
int
numOfColIds
);
int
numOfColIds
);
static
int
tsdbLoadBlockDataImpl
(
SRWHelper
*
pHelper
,
SCompBlock
*
pCompBlock
,
SDataCols
*
pDataCols
);
static
int
tsdbLoadBlockDataImpl
(
SRWHelper
*
pHelper
,
SCompBlock
*
pCompBlock
,
SDataCols
*
pDataCols
);
static
int
tsdbEncodeSCompIdx
(
void
**
buf
,
SCompIdx
*
pIdx
);
static
int
tsdbEncodeSCompIdx
(
void
**
buf
,
SCompIdx
*
pIdx
);
static
void
*
tsdbDecodeSCompIdx
(
void
*
buf
,
SCompIdx
*
pIdx
);
static
void
*
tsdbDecodeSCompIdx
(
void
*
buf
,
SCompIdx
*
pIdx
);
static
int
tsdbProcessAppendCommit
(
SRWHelper
*
pHelper
,
SCommitIter
*
pCommitIter
,
SDataCols
*
pDataCols
,
TSKEY
maxKey
);
static
void
tsdbDestroyHelperBlock
(
SRWHelper
*
pHelper
);
static
void
tsdbDestroyHelperBlock
(
SRWHelper
*
pHelper
);
static
int
tsdbLoadColData
(
SRWHelper
*
pHelper
,
SFile
*
pFile
,
SCompBlock
*
pCompBlock
,
SCompCol
*
pCompCol
,
static
int
tsdbLoadColData
(
SRWHelper
*
pHelper
,
SFile
*
pFile
,
SCompBlock
*
pCompBlock
,
SCompCol
*
pCompCol
,
SDataCol
*
pDataCol
);
SDataCol
*
pDataCol
);
static
int
tsdbWriteBlockToProperFile
(
SRWHelper
*
pHelper
,
SDataCols
*
pDataCols
,
SCompBlock
*
pCompBlock
);
static
int
tsdbProcessMergeCommit
(
SRWHelper
*
pHelper
,
SCommitIter
*
pCommitIter
,
SDataCols
*
pDataCols
,
TSKEY
maxKey
,
int
*
blkIdx
);
static
int
tsdbLoadAndMergeFromCache
(
SDataCols
*
pDataCols
,
int
*
iter
,
SCommitIter
*
pCommitIter
,
SDataCols
*
pTarget
,
TSKEY
maxKey
,
int
maxRows
);
// ---------------------- INTERNAL FUNCTIONS ----------------------
// ---------------------- INTERNAL FUNCTIONS ----------------------
int
tsdbInitReadHelper
(
SRWHelper
*
pHelper
,
STsdbRepo
*
pRepo
)
{
int
tsdbInitReadHelper
(
SRWHelper
*
pHelper
,
STsdbRepo
*
pRepo
)
{
...
@@ -225,84 +230,41 @@ void tsdbSetHelperTable(SRWHelper *pHelper, STable *pTable, STsdbRepo *pRepo) {
...
@@ -225,84 +230,41 @@ void tsdbSetHelperTable(SRWHelper *pHelper, STable *pTable, STsdbRepo *pRepo) {
tdInitDataCols
(
pHelper
->
pDataCols
[
1
],
pSchema
);
tdInitDataCols
(
pHelper
->
pDataCols
[
1
],
pSchema
);
SCompIdx
*
pIdx
=
pHelper
->
pCompIdx
+
pTable
->
tableId
.
tid
;
SCompIdx
*
pIdx
=
pHelper
->
pCompIdx
+
pTable
->
tableId
.
tid
;
if
(
pIdx
->
offset
>
0
&&
pIdx
->
hasLast
)
{
if
(
pIdx
->
offset
>
0
)
{
pHelper
->
hasOldLastBlock
=
true
;
if
(
pIdx
->
uid
!=
TABLE_UID
(
pTable
))
{
memset
((
void
*
)
pIdx
,
0
,
sizeof
(
SCompIdx
));
}
else
{
if
(
pIdx
->
hasLast
)
pHelper
->
hasOldLastBlock
=
true
;
}
}
}
helperSetState
(
pHelper
,
TSDB_HELPER_TABLE_SET
);
helperSetState
(
pHelper
,
TSDB_HELPER_TABLE_SET
);
ASSERT
(
pHelper
->
state
==
((
TSDB_HELPER_TABLE_SET
<<
1
)
-
1
));
ASSERT
(
pHelper
->
state
==
((
TSDB_HELPER_TABLE_SET
<<
1
)
-
1
));
}
}
/**
int
tsdbCommitTableData
(
SRWHelper
*
pHelper
,
SCommitIter
*
pCommitIter
,
SDataCols
*
pDataCols
,
TSKEY
maxKey
)
{
* Write part of of points from pDataCols to file
*
* @return: number of points written to file successfully
* -1 for failure
*/
int
tsdbWriteDataBlock
(
SRWHelper
*
pHelper
,
SDataCols
*
pDataCols
)
{
ASSERT
(
helperType
(
pHelper
)
==
TSDB_WRITE_HELPER
);
ASSERT
(
helperType
(
pHelper
)
==
TSDB_WRITE_HELPER
);
ASSERT
(
pDataCols
->
numOfRows
>
0
);
SCompBlock
compBlock
;
SCompIdx
*
pIdx
=
&
(
pHelper
->
pCompIdx
[
TABLE_TID
(
pCommitIter
->
pTable
)]);
int
rowsToWrite
=
0
;
int
blkIdx
=
0
;
TSKEY
keyFirst
=
dataColsKeyFirst
(
pDataCols
);
STsdbCfg
*
pCfg
=
&
pHelper
->
pRepo
->
config
;
ASSERT
(
pIdx
->
offset
==
0
||
pIdx
->
uid
==
TABLE_UID
(
pCommitIter
->
pTable
));
if
(
tsdbLoadCompInfo
(
pHelper
,
NULL
)
<
0
)
return
-
1
;
ASSERT
(
helperHasState
(
pHelper
,
TSDB_HELPER_IDX_LOAD
));
while
(
true
)
{
SCompIdx
*
pIdx
=
pHelper
->
pCompIdx
+
pHelper
->
tableInfo
.
tid
;
// for change purpose
ASSERT
(
blkIdx
<=
pIdx
->
numOfBlocks
);
TSKEY
keyFirst
=
tsdbNextIterKey
(
pCommitIter
->
pIter
);
if
(
keyFirst
<
0
||
keyFirst
>
maxKey
)
break
;
// iter over
// Load the SCompInfo part if neccessary
if
(
pIdx
->
len
<=
0
||
keyFirst
>
pIdx
->
maxKey
)
{
ASSERT
(
helperHasState
(
pHelper
,
TSDB_HELPER_TABLE_SET
));
if
(
tsdbProcessAppendCommit
(
pHelper
,
pCommitIter
,
pDataCols
,
maxKey
)
<
0
)
return
-
1
;
if
(
tsdbLoadCompInfo
(
pHelper
,
NULL
)
<
0
)
goto
_err
;
blkIdx
=
pIdx
->
numOfBlocks
;
if
(
pIdx
->
offset
==
0
||
(
!
pIdx
->
hasLast
&&
keyFirst
>
pIdx
->
maxKey
))
{
// Just append as a super block
ASSERT
(
pHelper
->
hasOldLastBlock
==
false
);
rowsToWrite
=
pDataCols
->
numOfRows
;
SFile
*
pWFile
=
NULL
;
bool
isLast
=
false
;
if
(
rowsToWrite
>=
pCfg
->
minRowsPerFileBlock
)
{
pWFile
=
&
(
pHelper
->
files
.
dataF
);
}
else
{
}
else
{
isLast
=
true
;
if
(
tsdbProcessMergeCommit
(
pHelper
,
pCommitIter
,
pDataCols
,
maxKey
,
&
blkIdx
)
<
0
)
return
-
1
;
pWFile
=
(
pHelper
->
files
.
nLastF
.
fd
>
0
)
?
&
(
pHelper
->
files
.
nLastF
)
:
&
(
pHelper
->
files
.
lastF
);
}
if
(
tsdbWriteBlockToFile
(
pHelper
,
pWFile
,
pDataCols
,
rowsToWrite
,
&
compBlock
,
isLast
,
true
)
<
0
)
goto
_err
;
if
(
tsdbInsertSuperBlock
(
pHelper
,
&
compBlock
,
pIdx
->
numOfBlocks
)
<
0
)
goto
_err
;
}
else
{
// (Has old data) AND ((has last block) OR (key overlap)), need to merge the block
SCompBlock
*
pCompBlock
=
taosbsearch
((
void
*
)(
&
keyFirst
),
(
void
*
)(
pHelper
->
pCompInfo
->
blocks
),
pIdx
->
numOfBlocks
,
sizeof
(
SCompBlock
),
compareKeyBlock
,
TD_GE
);
int
blkIdx
=
(
pCompBlock
==
NULL
)
?
(
pIdx
->
numOfBlocks
-
1
)
:
(
pCompBlock
-
pHelper
->
pCompInfo
->
blocks
);
if
(
pCompBlock
==
NULL
)
{
// No key overlap, must has last block, just merge with the last block
ASSERT
(
pIdx
->
hasLast
&&
pHelper
->
pCompInfo
->
blocks
[
pIdx
->
numOfBlocks
-
1
].
last
);
rowsToWrite
=
tsdbMergeDataWithBlock
(
pHelper
,
blkIdx
,
pDataCols
);
if
(
rowsToWrite
<
0
)
goto
_err
;
}
else
{
// Has key overlap
if
(
compareKeyBlock
((
void
*
)(
&
keyFirst
),
(
void
*
)
pCompBlock
)
==
0
)
{
// Key overlap with the block, must merge with the block
rowsToWrite
=
tsdbMergeDataWithBlock
(
pHelper
,
blkIdx
,
pDataCols
);
if
(
rowsToWrite
<
0
)
goto
_err
;
}
else
{
// Save as a super block in the middle
rowsToWrite
=
tsdbGetRowsInRange
(
pDataCols
,
0
,
pCompBlock
->
keyFirst
-
1
);
ASSERT
(
rowsToWrite
>
0
);
if
(
tsdbWriteBlockToFile
(
pHelper
,
&
(
pHelper
->
files
.
dataF
),
pDataCols
,
rowsToWrite
,
&
compBlock
,
false
,
true
)
<
0
)
goto
_err
;
if
(
tsdbInsertSuperBlock
(
pHelper
,
&
compBlock
,
blkIdx
)
<
0
)
goto
_err
;
}
}
}
}
}
return
rowsToWrite
;
return
0
;
_err:
return
-
1
;
}
}
int
tsdbMoveLastBlockIfNeccessary
(
SRWHelper
*
pHelper
)
{
int
tsdbMoveLastBlockIfNeccessary
(
SRWHelper
*
pHelper
)
{
...
@@ -310,29 +272,42 @@ int tsdbMoveLastBlockIfNeccessary(SRWHelper *pHelper) {
...
@@ -310,29 +272,42 @@ int tsdbMoveLastBlockIfNeccessary(SRWHelper *pHelper) {
ASSERT
(
helperType
(
pHelper
)
==
TSDB_WRITE_HELPER
);
ASSERT
(
helperType
(
pHelper
)
==
TSDB_WRITE_HELPER
);
SCompIdx
*
pIdx
=
pHelper
->
pCompIdx
+
pHelper
->
tableInfo
.
tid
;
SCompIdx
*
pIdx
=
pHelper
->
pCompIdx
+
pHelper
->
tableInfo
.
tid
;
SCompBlock
compBlock
;
SCompBlock
compBlock
=
{
0
}
;
if
(
(
pHelper
->
files
.
nLastF
.
fd
>
0
)
&&
(
pHelper
->
hasOldLastBlock
))
{
if
(
TSDB_NLAST_FILE_OPENED
(
pHelper
)
&&
(
pHelper
->
hasOldLastBlock
))
{
if
(
tsdbLoadCompInfo
(
pHelper
,
NULL
)
<
0
)
return
-
1
;
if
(
tsdbLoadCompInfo
(
pHelper
,
NULL
)
<
0
)
return
-
1
;
SCompBlock
*
pCompBlock
=
pHelper
->
pCompInfo
->
blocks
+
pIdx
->
numOfBlocks
-
1
;
SCompBlock
*
pCompBlock
=
blockAtIdx
(
pHelper
,
pIdx
->
numOfBlocks
-
1
)
;
ASSERT
(
pCompBlock
->
last
);
ASSERT
(
pCompBlock
->
last
);
if
(
pCompBlock
->
numOfSubBlocks
>
1
)
{
if
(
pCompBlock
->
numOfSubBlocks
>
1
)
{
if
(
tsdbLoadBlockData
(
pHelper
,
blockAtIdx
(
pHelper
,
pIdx
->
numOfBlocks
-
1
)
,
NULL
)
<
0
)
return
-
1
;
if
(
tsdbLoadBlockData
(
pHelper
,
pCompBlock
,
NULL
)
<
0
)
return
-
1
;
ASSERT
(
pHelper
->
pDataCols
[
0
]
->
numOfRows
>
0
&&
pHelper
->
pDataCols
[
0
]
->
numOfRows
<
pCfg
->
minRowsPerFileBlock
);
ASSERT
(
pHelper
->
pDataCols
[
0
]
->
numOfRows
==
pCompBlock
->
numOfRows
&&
if
(
tsdbWriteBlockToFile
(
pHelper
,
&
(
pHelper
->
files
.
nLastF
),
pHelper
->
pDataCols
[
0
],
pHelper
->
pDataCols
[
0
]
->
numOfRows
<
pCfg
->
minRowsPerFileBlock
);
pHelper
->
pDataCols
[
0
]
->
numOfRows
,
&
compBlock
,
true
,
true
)
<
0
)
if
(
tsdbWriteBlockToFile
(
pHelper
,
&
(
pHelper
->
files
.
nLastF
),
pHelper
->
pDataCols
[
0
]
,
&
compBlock
,
true
,
true
)
<
0
)
return
-
1
;
return
-
1
;
if
(
tsdbUpdateSuperBlock
(
pHelper
,
&
compBlock
,
pIdx
->
numOfBlocks
-
1
)
<
0
)
return
-
1
;
if
(
tsdbUpdateSuperBlock
(
pHelper
,
&
compBlock
,
pIdx
->
numOfBlocks
-
1
)
<
0
)
return
-
1
;
}
else
{
}
else
{
if
(
lseek
(
pHelper
->
files
.
lastF
.
fd
,
pCompBlock
->
offset
,
SEEK_SET
)
<
0
)
return
-
1
;
if
(
lseek
(
pHelper
->
files
.
lastF
.
fd
,
pCompBlock
->
offset
,
SEEK_SET
)
<
0
)
{
tsdbError
(
"vgId:%d failed to lseek file %s since %s"
,
REPO_ID
(
pHelper
->
pRepo
),
pHelper
->
files
.
lastF
.
fname
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
pCompBlock
->
offset
=
lseek
(
pHelper
->
files
.
nLastF
.
fd
,
0
,
SEEK_END
);
pCompBlock
->
offset
=
lseek
(
pHelper
->
files
.
nLastF
.
fd
,
0
,
SEEK_END
);
if
(
pCompBlock
->
offset
<
0
)
return
-
1
;
if
(
pCompBlock
->
offset
<
0
)
{
tsdbError
(
"vgId:%d failed to lseek file %s since %s"
,
REPO_ID
(
pHelper
->
pRepo
),
pHelper
->
files
.
nLastF
.
fname
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
if
(
tsendfile
(
pHelper
->
files
.
nLastF
.
fd
,
pHelper
->
files
.
lastF
.
fd
,
NULL
,
pCompBlock
->
len
)
<
pCompBlock
->
len
)
if
(
tsendfile
(
pHelper
->
files
.
nLastF
.
fd
,
pHelper
->
files
.
lastF
.
fd
,
NULL
,
pCompBlock
->
len
)
<
pCompBlock
->
len
)
{
tsdbError
(
"vgId:%d failed to sendfile from file %s to file %s since %s"
,
REPO_ID
(
pHelper
->
pRepo
),
pHelper
->
files
.
lastF
.
fname
,
pHelper
->
files
.
nLastF
.
fname
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
return
-
1
;
}
}
}
pHelper
->
hasOldLastBlock
=
false
;
pHelper
->
hasOldLastBlock
=
false
;
...
@@ -365,27 +340,30 @@ int tsdbWriteCompInfo(SRWHelper *pHelper) {
...
@@ -365,27 +340,30 @@ int tsdbWriteCompInfo(SRWHelper *pHelper) {
}
}
}
}
}
else
{
}
else
{
pHelper
->
pCompInfo
->
delimiter
=
TSDB_FILE_DELIMITER
;
if
(
pIdx
->
len
>
0
)
{
pHelper
->
pCompInfo
->
uid
=
pHelper
->
tableInfo
.
uid
;
pHelper
->
pCompInfo
->
delimiter
=
TSDB_FILE_DELIMITER
;
pHelper
->
pCompInfo
->
checksum
=
0
;
pHelper
->
pCompInfo
->
uid
=
pHelper
->
tableInfo
.
uid
;
ASSERT
((
pIdx
->
len
-
sizeof
(
SCompInfo
)
-
sizeof
(
TSCKSUM
))
%
sizeof
(
SCompBlock
)
==
0
);
pHelper
->
pCompInfo
->
checksum
=
0
;
taosCalcChecksumAppend
(
0
,
(
uint8_t
*
)
pHelper
->
pCompInfo
,
pIdx
->
len
);
ASSERT
(
pIdx
->
len
>
sizeof
(
SCompInfo
)
+
sizeof
(
TSCKSUM
)
&&
offset
=
lseek
(
pHelper
->
files
.
nHeadF
.
fd
,
0
,
SEEK_END
);
(
pIdx
->
len
-
sizeof
(
SCompInfo
)
-
sizeof
(
TSCKSUM
))
%
sizeof
(
SCompBlock
)
==
0
);
if
(
offset
<
0
)
{
taosCalcChecksumAppend
(
0
,
(
uint8_t
*
)
pHelper
->
pCompInfo
,
pIdx
->
len
);
tsdbError
(
"vgId:%d failed to lseek file %s since %s"
,
REPO_ID
(
pHelper
->
pRepo
),
pHelper
->
files
.
nHeadF
.
fname
,
offset
=
lseek
(
pHelper
->
files
.
nHeadF
.
fd
,
0
,
SEEK_END
);
strerror
(
errno
));
if
(
offset
<
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
tsdbError
(
"vgId:%d failed to lseek file %s since %s"
,
REPO_ID
(
pHelper
->
pRepo
),
pHelper
->
files
.
nHeadF
.
fname
,
return
-
1
;
strerror
(
errno
));
}
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
pIdx
->
offset
=
offset
;
return
-
1
;
pIdx
->
uid
=
pHelper
->
tableInfo
.
uid
;
}
ASSERT
(
pIdx
->
offset
>=
TSDB_FILE_HEAD_SIZE
);
pIdx
->
offset
=
offset
;
pIdx
->
uid
=
pHelper
->
tableInfo
.
uid
;
ASSERT
(
pIdx
->
offset
>=
TSDB_FILE_HEAD_SIZE
);
if
(
twrite
(
pHelper
->
files
.
nHeadF
.
fd
,
(
void
*
)(
pHelper
->
pCompInfo
),
pIdx
->
len
)
<
pIdx
->
len
)
{
if
(
twrite
(
pHelper
->
files
.
nHeadF
.
fd
,
(
void
*
)(
pHelper
->
pCompInfo
),
pIdx
->
len
)
<
pIdx
->
len
)
{
tsdbError
(
"vgId:%d failed to write %d bytes to file %s since %s"
,
REPO_ID
(
pHelper
->
pRepo
),
pIdx
->
len
,
tsdbError
(
"vgId:%d failed to write %d bytes to file %s since %s"
,
REPO_ID
(
pHelper
->
pRepo
),
pIdx
->
len
,
pHelper
->
files
.
nHeadF
.
fname
,
strerror
(
errno
));
pHelper
->
files
.
nHeadF
.
fname
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
return
-
1
;
}
}
}
}
}
...
@@ -397,7 +375,12 @@ int tsdbWriteCompIdx(SRWHelper *pHelper) {
...
@@ -397,7 +375,12 @@ int tsdbWriteCompIdx(SRWHelper *pHelper) {
ASSERT
(
helperType
(
pHelper
)
==
TSDB_WRITE_HELPER
);
ASSERT
(
helperType
(
pHelper
)
==
TSDB_WRITE_HELPER
);
off_t
offset
=
lseek
(
pHelper
->
files
.
nHeadF
.
fd
,
0
,
SEEK_END
);
off_t
offset
=
lseek
(
pHelper
->
files
.
nHeadF
.
fd
,
0
,
SEEK_END
);
if
(
offset
<
0
)
return
-
1
;
if
(
offset
<
0
)
{
tsdbError
(
"vgId:%d failed to lseek file %s to end since %s"
,
REPO_ID
(
pHelper
->
pRepo
),
pHelper
->
files
.
nHeadF
.
fname
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
SFile
*
pFile
=
&
(
pHelper
->
files
.
nHeadF
);
SFile
*
pFile
=
&
(
pHelper
->
files
.
nHeadF
);
pFile
->
info
.
offset
=
offset
;
pFile
->
info
.
offset
=
offset
;
...
@@ -409,6 +392,10 @@ int tsdbWriteCompIdx(SRWHelper *pHelper) {
...
@@ -409,6 +392,10 @@ int tsdbWriteCompIdx(SRWHelper *pHelper) {
int
drift
=
POINTER_DISTANCE
(
buf
,
pHelper
->
pBuffer
);
int
drift
=
POINTER_DISTANCE
(
buf
,
pHelper
->
pBuffer
);
if
(
tsizeof
(
pHelper
->
pBuffer
)
-
drift
<
128
)
{
if
(
tsizeof
(
pHelper
->
pBuffer
)
-
drift
<
128
)
{
pHelper
->
pBuffer
=
trealloc
(
pHelper
->
pBuffer
,
tsizeof
(
pHelper
->
pBuffer
)
*
2
);
pHelper
->
pBuffer
=
trealloc
(
pHelper
->
pBuffer
,
tsizeof
(
pHelper
->
pBuffer
)
*
2
);
if
(
pHelper
->
pBuffer
==
NULL
)
{
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
return
-
1
;
}
}
}
buf
=
POINTER_SHIFT
(
pHelper
->
pBuffer
,
drift
);
buf
=
POINTER_SHIFT
(
pHelper
->
pBuffer
,
drift
);
taosEncodeVariantU32
(
&
buf
,
i
);
taosEncodeVariantU32
(
&
buf
,
i
);
...
@@ -419,7 +406,12 @@ int tsdbWriteCompIdx(SRWHelper *pHelper) {
...
@@ -419,7 +406,12 @@ int tsdbWriteCompIdx(SRWHelper *pHelper) {
int
tsize
=
(
char
*
)
buf
-
(
char
*
)
pHelper
->
pBuffer
+
sizeof
(
TSCKSUM
);
int
tsize
=
(
char
*
)
buf
-
(
char
*
)
pHelper
->
pBuffer
+
sizeof
(
TSCKSUM
);
taosCalcChecksumAppend
(
0
,
(
uint8_t
*
)
pHelper
->
pBuffer
,
tsize
);
taosCalcChecksumAppend
(
0
,
(
uint8_t
*
)
pHelper
->
pBuffer
,
tsize
);
if
(
twrite
(
pHelper
->
files
.
nHeadF
.
fd
,
(
void
*
)
pHelper
->
pBuffer
,
tsize
)
<
tsize
)
return
-
1
;
if
(
twrite
(
pHelper
->
files
.
nHeadF
.
fd
,
(
void
*
)
pHelper
->
pBuffer
,
tsize
)
<
tsize
)
{
tsdbError
(
"vgId:%d failed to write %d bytes to file %s since %s"
,
REPO_ID
(
pHelper
->
pRepo
),
tsize
,
pHelper
->
files
.
nHeadF
.
fname
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
pFile
->
info
.
len
=
tsize
;
pFile
->
info
.
len
=
tsize
;
return
0
;
return
0
;
}
}
...
@@ -496,11 +488,29 @@ int tsdbLoadCompInfo(SRWHelper *pHelper, void *target) {
...
@@ -496,11 +488,29 @@ int tsdbLoadCompInfo(SRWHelper *pHelper, void *target) {
if
(
!
helperHasState
(
pHelper
,
TSDB_HELPER_INFO_LOAD
))
{
if
(
!
helperHasState
(
pHelper
,
TSDB_HELPER_INFO_LOAD
))
{
if
(
pIdx
->
offset
>
0
)
{
if
(
pIdx
->
offset
>
0
)
{
if
(
lseek
(
fd
,
pIdx
->
offset
,
SEEK_SET
)
<
0
)
return
-
1
;
ASSERT
(
pIdx
->
uid
==
pHelper
->
tableInfo
.
uid
);
if
(
lseek
(
fd
,
pIdx
->
offset
,
SEEK_SET
)
<
0
)
{
tsdbError
(
"vgId:%d failed to lseek file %s since %s"
,
REPO_ID
(
pHelper
->
pRepo
),
pHelper
->
files
.
headF
.
fname
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
pHelper
->
pCompInfo
=
trealloc
((
void
*
)
pHelper
->
pCompInfo
,
pIdx
->
len
);
pHelper
->
pCompInfo
=
trealloc
((
void
*
)
pHelper
->
pCompInfo
,
pIdx
->
len
);
if
(
tread
(
fd
,
(
void
*
)(
pHelper
->
pCompInfo
),
pIdx
->
len
)
<
pIdx
->
len
)
return
-
1
;
if
(
tread
(
fd
,
(
void
*
)(
pHelper
->
pCompInfo
),
pIdx
->
len
)
<
pIdx
->
len
)
{
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)
pHelper
->
pCompInfo
,
pIdx
->
len
))
return
-
1
;
tsdbError
(
"vgId:%d failed to read %d bytes from file %s since %s"
,
REPO_ID
(
pHelper
->
pRepo
),
pIdx
->
len
,
pHelper
->
files
.
headF
.
fname
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)
pHelper
->
pCompInfo
,
pIdx
->
len
))
{
tsdbError
(
"vgId:%d file %s SCompInfo part is corrupted, tid %d uid %"
PRIu64
,
REPO_ID
(
pHelper
->
pRepo
),
pHelper
->
files
.
headF
.
fname
,
pHelper
->
tableInfo
.
tid
,
pHelper
->
tableInfo
.
uid
);
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
return
-
1
;
}
ASSERT
(
pIdx
->
uid
==
pHelper
->
pCompInfo
->
uid
);
}
}
helperSetState
(
pHelper
,
TSDB_HELPER_INFO_LOAD
);
helperSetState
(
pHelper
,
TSDB_HELPER_INFO_LOAD
);
...
@@ -628,13 +638,14 @@ static bool tsdbShouldCreateNewLast(SRWHelper *pHelper) {
...
@@ -628,13 +638,14 @@ static bool tsdbShouldCreateNewLast(SRWHelper *pHelper) {
return
false
;
return
false
;
}
}
static
int
tsdbWriteBlockToFile
(
SRWHelper
*
pHelper
,
SFile
*
pFile
,
SDataCols
*
pDataCols
,
int
rowsToWrite
,
static
int
tsdbWriteBlockToFile
(
SRWHelper
*
pHelper
,
SFile
*
pFile
,
SDataCols
*
pDataCols
,
SCompBlock
*
pCompBlock
,
SCompBlock
*
pCompBlock
,
bool
isLast
,
bool
isSuperBlock
)
{
bool
isLast
,
bool
isSuperBlock
)
{
STsdbCfg
*
pCfg
=
&
(
pHelper
->
pRepo
->
config
);
STsdbCfg
*
pCfg
=
&
(
pHelper
->
pRepo
->
config
);
SCompData
*
pCompData
=
(
SCompData
*
)(
pHelper
->
pBuffer
);
SCompData
*
pCompData
=
(
SCompData
*
)(
pHelper
->
pBuffer
);
int64_t
offset
=
0
;
int64_t
offset
=
0
;
int
rowsToWrite
=
pDataCols
->
numOfRows
;
ASSERT
(
rowsToWrite
>
0
&&
rowsToWrite
<=
p
DataCols
->
numOfRows
&&
rowsToWrite
<=
p
Cfg
->
maxRowsPerFileBlock
);
ASSERT
(
rowsToWrite
>
0
&&
rowsToWrite
<=
pCfg
->
maxRowsPerFileBlock
);
ASSERT
(
isLast
?
rowsToWrite
<
pCfg
->
minRowsPerFileBlock
:
true
);
ASSERT
(
isLast
?
rowsToWrite
<
pCfg
->
minRowsPerFileBlock
:
true
);
offset
=
lseek
(
pFile
->
fd
,
0
,
SEEK_END
);
offset
=
lseek
(
pFile
->
fd
,
0
,
SEEK_END
);
...
@@ -646,7 +657,7 @@ static int tsdbWriteBlockToFile(SRWHelper *pHelper, SFile *pFile, SDataCols *pDa
...
@@ -646,7 +657,7 @@ static int tsdbWriteBlockToFile(SRWHelper *pHelper, SFile *pFile, SDataCols *pDa
}
}
int
nColsNotAllNull
=
0
;
int
nColsNotAllNull
=
0
;
for
(
int
ncol
=
0
;
ncol
<
pDataCols
->
numOfCols
;
ncol
++
)
{
for
(
int
ncol
=
1
;
ncol
<
pDataCols
->
numOfCols
;
ncol
++
)
{
// ncol from 1, we skip the timestamp column
SDataCol
*
pDataCol
=
pDataCols
->
cols
+
ncol
;
SDataCol
*
pDataCol
=
pDataCols
->
cols
+
ncol
;
SCompCol
*
pCompCol
=
pCompData
->
cols
+
nColsNotAllNull
;
SCompCol
*
pCompCol
=
pCompData
->
cols
+
nColsNotAllNull
;
...
@@ -658,7 +669,7 @@ static int tsdbWriteBlockToFile(SRWHelper *pHelper, SFile *pFile, SDataCols *pDa
...
@@ -658,7 +669,7 @@ static int tsdbWriteBlockToFile(SRWHelper *pHelper, SFile *pFile, SDataCols *pDa
pCompCol
->
colId
=
pDataCol
->
colId
;
pCompCol
->
colId
=
pDataCol
->
colId
;
pCompCol
->
type
=
pDataCol
->
type
;
pCompCol
->
type
=
pDataCol
->
type
;
if
(
tDataTypeDesc
[
pDataCol
->
type
].
getStatisFunc
&&
ncol
!=
0
)
{
if
(
tDataTypeDesc
[
pDataCol
->
type
].
getStatisFunc
)
{
(
*
tDataTypeDesc
[
pDataCol
->
type
].
getStatisFunc
)(
(
*
tDataTypeDesc
[
pDataCol
->
type
].
getStatisFunc
)(
(
TSKEY
*
)(
pDataCols
->
cols
[
0
].
pData
),
pDataCol
->
pData
,
rowsToWrite
,
&
(
pCompCol
->
min
),
&
(
pCompCol
->
max
),
(
TSKEY
*
)(
pDataCols
->
cols
[
0
].
pData
),
pDataCol
->
pData
,
rowsToWrite
,
&
(
pCompCol
->
min
),
&
(
pCompCol
->
max
),
&
(
pCompCol
->
sum
),
&
(
pCompCol
->
minIndex
),
&
(
pCompCol
->
maxIndex
),
&
(
pCompCol
->
numOfNull
));
&
(
pCompCol
->
sum
),
&
(
pCompCol
->
minIndex
),
&
(
pCompCol
->
maxIndex
),
&
(
pCompCol
->
numOfNull
));
...
@@ -666,24 +677,24 @@ static int tsdbWriteBlockToFile(SRWHelper *pHelper, SFile *pFile, SDataCols *pDa
...
@@ -666,24 +677,24 @@ static int tsdbWriteBlockToFile(SRWHelper *pHelper, SFile *pFile, SDataCols *pDa
nColsNotAllNull
++
;
nColsNotAllNull
++
;
}
}
ASSERT
(
nColsNotAllNull
>
0
&&
nColsNotAllNull
<=
pDataCols
->
numOfCols
);
ASSERT
(
nColsNotAllNull
>
=
0
&&
nColsNotAllNull
<=
pDataCols
->
numOfCols
);
// Compress the data if neccessary
// Compress the data if neccessary
int
tcol
=
0
;
int
tcol
=
0
;
int32_t
toffset
=
0
;
int32_t
toffset
=
0
;
int32_t
tsize
=
TSDB_GET_COMPCOL_LEN
(
nColsNotAllNull
);
int32_t
tsize
=
TSDB_GET_COMPCOL_LEN
(
nColsNotAllNull
);
int32_t
lsize
=
tsize
;
int32_t
lsize
=
tsize
;
int32_t
keyLen
=
0
;
for
(
int
ncol
=
0
;
ncol
<
pDataCols
->
numOfCols
;
ncol
++
)
{
for
(
int
ncol
=
0
;
ncol
<
pDataCols
->
numOfCols
;
ncol
++
)
{
if
(
tcol
>=
nColsNotAllNull
)
break
;
if
(
tcol
>=
nColsNotAllNull
)
break
;
SDataCol
*
pDataCol
=
pDataCols
->
cols
+
ncol
;
SDataCol
*
pDataCol
=
pDataCols
->
cols
+
ncol
;
SCompCol
*
pCompCol
=
pCompData
->
cols
+
tcol
;
SCompCol
*
pCompCol
=
pCompData
->
cols
+
tcol
;
if
(
pDataCol
->
colId
!=
pCompCol
->
colId
)
continue
;
if
(
ncol
!=
0
&&
(
pDataCol
->
colId
!=
pCompCol
->
colId
))
continue
;
void
*
tptr
=
(
void
*
)((
char
*
)
pCompData
+
lsize
);
void
*
tptr
=
POINTER_SHIFT
(
pCompData
,
lsize
);
pCompCol
->
offset
=
toffset
;
int32_t
flen
=
0
;
// final length
int32_t
tlen
=
dataColGetNEleLen
(
pDataCol
,
rowsToWrite
);
int32_t
tlen
=
dataColGetNEleLen
(
pDataCol
,
rowsToWrite
);
if
(
pCfg
->
compression
)
{
if
(
pCfg
->
compression
)
{
...
@@ -695,22 +706,29 @@ static int tsdbWriteBlockToFile(SRWHelper *pHelper, SFile *pFile, SDataCols *pDa
...
@@ -695,22 +706,29 @@ static int tsdbWriteBlockToFile(SRWHelper *pHelper, SFile *pFile, SDataCols *pDa
}
}
}
}
pCompCol
->
len
=
(
*
(
tDataTypeDesc
[
pDataCol
->
type
].
compFunc
))((
char
*
)
pDataCol
->
pData
,
tlen
,
rowsToWrite
,
tptr
,
f
len
=
(
*
(
tDataTypeDesc
[
pDataCol
->
type
].
compFunc
))((
char
*
)
pDataCol
->
pData
,
tlen
,
rowsToWrite
,
tptr
,
tsizeof
(
pHelper
->
pBuffer
)
-
lsize
,
pCfg
->
compression
,
tsizeof
(
pHelper
->
pBuffer
)
-
lsize
,
pCfg
->
compression
,
pHelper
->
compBuffer
,
tsizeof
(
pHelper
->
compBuffer
));
pHelper
->
compBuffer
,
tsizeof
(
pHelper
->
compBuffer
));
}
else
{
}
else
{
pCompCol
->
len
=
tlen
;
f
len
=
tlen
;
memcpy
(
tptr
,
pDataCol
->
pData
,
pCompCol
->
len
);
memcpy
(
tptr
,
pDataCol
->
pData
,
f
len
);
}
}
// Add checksum
// Add checksum
ASSERT
(
pCompCol
->
len
>
0
);
ASSERT
(
flen
>
0
);
pCompCol
->
len
+=
sizeof
(
TSCKSUM
);
flen
+=
sizeof
(
TSCKSUM
);
taosCalcChecksumAppend
(
0
,
(
uint8_t
*
)
tptr
,
pCompCol
->
len
);
taosCalcChecksumAppend
(
0
,
(
uint8_t
*
)
tptr
,
flen
);
if
(
ncol
!=
0
)
{
pCompCol
->
offset
=
toffset
;
pCompCol
->
len
=
flen
;
tcol
++
;
}
else
{
keyLen
=
flen
;
}
toffset
+=
pCompCol
->
len
;
toffset
+=
flen
;
lsize
+=
pCompCol
->
len
;
lsize
+=
flen
;
tcol
++
;
}
}
pCompData
->
delimiter
=
TSDB_FILE_DELIMITER
;
pCompData
->
delimiter
=
TSDB_FILE_DELIMITER
;
...
@@ -732,14 +750,14 @@ static int tsdbWriteBlockToFile(SRWHelper *pHelper, SFile *pFile, SDataCols *pDa
...
@@ -732,14 +750,14 @@ static int tsdbWriteBlockToFile(SRWHelper *pHelper, SFile *pFile, SDataCols *pDa
pCompBlock
->
offset
=
offset
;
pCompBlock
->
offset
=
offset
;
pCompBlock
->
algorithm
=
pCfg
->
compression
;
pCompBlock
->
algorithm
=
pCfg
->
compression
;
pCompBlock
->
numOfRows
=
rowsToWrite
;
pCompBlock
->
numOfRows
=
rowsToWrite
;
pCompBlock
->
sversion
=
pHelper
->
tableInfo
.
sversion
;
pCompBlock
->
len
=
lsize
;
pCompBlock
->
len
=
(
int32_t
)
lsize
;
pCompBlock
->
keyLen
=
keyLen
;
pCompBlock
->
numOfSubBlocks
=
isSuperBlock
?
1
:
0
;
pCompBlock
->
numOfSubBlocks
=
isSuperBlock
?
1
:
0
;
pCompBlock
->
numOfCols
=
nColsNotAllNull
;
pCompBlock
->
numOfCols
=
nColsNotAllNull
;
pCompBlock
->
keyFirst
=
dataColsKeyFirst
(
pDataCols
);
pCompBlock
->
keyFirst
=
dataColsKeyFirst
(
pDataCols
);
pCompBlock
->
keyLast
=
dataColsKeyAt
(
pDataCols
,
rowsToWrite
-
1
);
pCompBlock
->
keyLast
=
dataColsKeyAt
(
pDataCols
,
rowsToWrite
-
1
);
tsdb
Trace
(
"vgId:%d tid:%d a block of data is written to file %s, offset %"
PRId64
tsdb
Debug
(
"vgId:%d tid:%d a block of data is written to file %s, offset %"
PRId64
" numOfRows %d len %d numOfCols %"
PRId16
" keyFirst %"
PRId64
" keyLast %"
PRId64
,
" numOfRows %d len %d numOfCols %"
PRId16
" keyFirst %"
PRId64
" keyLast %"
PRId64
,
REPO_ID
(
helperRepo
(
pHelper
)),
pHelper
->
tableInfo
.
tid
,
pFile
->
fname
,
(
int64_t
)(
pCompBlock
->
offset
),
REPO_ID
(
helperRepo
(
pHelper
)),
pHelper
->
tableInfo
.
tid
,
pFile
->
fname
,
(
int64_t
)(
pCompBlock
->
offset
),
(
int
)(
pCompBlock
->
numOfRows
),
pCompBlock
->
len
,
pCompBlock
->
numOfCols
,
pCompBlock
->
keyFirst
,
(
int
)(
pCompBlock
->
numOfRows
),
pCompBlock
->
len
,
pCompBlock
->
numOfCols
,
pCompBlock
->
keyFirst
,
...
@@ -764,136 +782,6 @@ static int compareKeyBlock(const void *arg1, const void *arg2) {
...
@@ -764,136 +782,6 @@ static int compareKeyBlock(const void *arg1, const void *arg2) {
return
0
;
return
0
;
}
}
static
int
tsdbMergeDataWithBlock
(
SRWHelper
*
pHelper
,
int
blkIdx
,
SDataCols
*
pDataCols
)
{
// TODO: set pHelper->hasOldBlock
int
rowsWritten
=
0
;
SCompBlock
compBlock
=
{
0
};
STsdbCfg
*
pCfg
=
&
pHelper
->
pRepo
->
config
;
ASSERT
(
pDataCols
->
numOfRows
>
0
);
TSKEY
keyFirst
=
dataColsKeyFirst
(
pDataCols
);
SCompIdx
*
pIdx
=
pHelper
->
pCompIdx
+
pHelper
->
tableInfo
.
tid
;
ASSERT
(
blkIdx
<
pIdx
->
numOfBlocks
);
// SCompBlock *pCompBlock = pHelper->pCompInfo->blocks + blkIdx;
ASSERT
(
blockAtIdx
(
pHelper
,
blkIdx
)
->
numOfSubBlocks
>=
1
);
ASSERT
(
keyFirst
>=
blockAtIdx
(
pHelper
,
blkIdx
)
->
keyFirst
);
// ASSERT(compareKeyBlock((void *)&keyFirst, (void *)pCompBlock) == 0);
if
(
keyFirst
>
blockAtIdx
(
pHelper
,
blkIdx
)
->
keyLast
)
{
// Merge with the last block by append
ASSERT
(
blockAtIdx
(
pHelper
,
blkIdx
)
->
numOfRows
<
pCfg
->
minRowsPerFileBlock
&&
blkIdx
==
pIdx
->
numOfBlocks
-
1
);
int
defaultRowsToWrite
=
pCfg
->
maxRowsPerFileBlock
*
4
/
5
;
// TODO: make a interface
rowsWritten
=
MIN
((
defaultRowsToWrite
-
blockAtIdx
(
pHelper
,
blkIdx
)
->
numOfRows
),
pDataCols
->
numOfRows
);
if
((
blockAtIdx
(
pHelper
,
blkIdx
)
->
numOfSubBlocks
<
TSDB_MAX_SUBBLOCKS
)
&&
(
blockAtIdx
(
pHelper
,
blkIdx
)
->
numOfRows
+
rowsWritten
<
pCfg
->
minRowsPerFileBlock
)
&&
(
pHelper
->
files
.
nLastF
.
fd
)
<
0
)
{
if
(
tsdbWriteBlockToFile
(
pHelper
,
&
(
pHelper
->
files
.
lastF
),
pDataCols
,
rowsWritten
,
&
compBlock
,
true
,
false
)
<
0
)
goto
_err
;
if
(
tsdbAddSubBlock
(
pHelper
,
&
compBlock
,
blkIdx
,
rowsWritten
)
<
0
)
goto
_err
;
}
else
{
// Load
if
(
tsdbLoadBlockData
(
pHelper
,
blockAtIdx
(
pHelper
,
blkIdx
),
NULL
)
<
0
)
goto
_err
;
ASSERT
(
pHelper
->
pDataCols
[
0
]
->
numOfRows
<=
blockAtIdx
(
pHelper
,
blkIdx
)
->
numOfRows
);
// Merge
if
(
tdMergeDataCols
(
pHelper
->
pDataCols
[
0
],
pDataCols
,
rowsWritten
)
<
0
)
goto
_err
;
// Write
SFile
*
pWFile
=
NULL
;
bool
isLast
=
false
;
if
(
pHelper
->
pDataCols
[
0
]
->
numOfRows
>=
pCfg
->
minRowsPerFileBlock
)
{
pWFile
=
&
(
pHelper
->
files
.
dataF
);
}
else
{
isLast
=
true
;
pWFile
=
(
pHelper
->
files
.
nLastF
.
fd
>
0
)
?
&
(
pHelper
->
files
.
nLastF
)
:
&
(
pHelper
->
files
.
lastF
);
}
if
(
tsdbWriteBlockToFile
(
pHelper
,
pWFile
,
pHelper
->
pDataCols
[
0
],
pHelper
->
pDataCols
[
0
]
->
numOfRows
,
&
compBlock
,
isLast
,
true
)
<
0
)
goto
_err
;
if
(
tsdbUpdateSuperBlock
(
pHelper
,
&
compBlock
,
blkIdx
)
<
0
)
goto
_err
;
}
ASSERT
(
pHelper
->
hasOldLastBlock
);
pHelper
->
hasOldLastBlock
=
false
;
}
else
{
// Key must overlap with the block
ASSERT
(
keyFirst
<=
blockAtIdx
(
pHelper
,
blkIdx
)
->
keyLast
);
TSKEY
keyLimit
=
(
blkIdx
==
pIdx
->
numOfBlocks
-
1
)
?
INT64_MAX
:
blockAtIdx
(
pHelper
,
blkIdx
+
1
)
->
keyFirst
-
1
;
// rows1: number of rows must merge in this block
int
rows1
=
tsdbGetRowsInRange
(
pDataCols
,
blockAtIdx
(
pHelper
,
blkIdx
)
->
keyFirst
,
blockAtIdx
(
pHelper
,
blkIdx
)
->
keyLast
);
// rows2: max number of rows the block can have more
int
rows2
=
pCfg
->
maxRowsPerFileBlock
-
blockAtIdx
(
pHelper
,
blkIdx
)
->
numOfRows
;
// rows3: number of rows between this block and the next block
int
rows3
=
tsdbGetRowsInRange
(
pDataCols
,
blockAtIdx
(
pHelper
,
blkIdx
)
->
keyFirst
,
keyLimit
);
ASSERT
(
rows3
>=
rows1
);
if
((
rows2
>=
rows1
)
&&
(
blockAtIdx
(
pHelper
,
blkIdx
)
->
numOfSubBlocks
<
TSDB_MAX_SUBBLOCKS
)
&&
((
!
blockAtIdx
(
pHelper
,
blkIdx
)
->
last
)
||
((
rows1
+
blockAtIdx
(
pHelper
,
blkIdx
)
->
numOfRows
<
pCfg
->
minRowsPerFileBlock
)
&&
(
pHelper
->
files
.
nLastF
.
fd
<
0
))))
{
rowsWritten
=
rows1
;
bool
isLast
=
false
;
SFile
*
pFile
=
NULL
;
if
(
blockAtIdx
(
pHelper
,
blkIdx
)
->
last
)
{
isLast
=
true
;
pFile
=
&
(
pHelper
->
files
.
lastF
);
}
else
{
pFile
=
&
(
pHelper
->
files
.
dataF
);
}
if
(
tsdbWriteBlockToFile
(
pHelper
,
pFile
,
pDataCols
,
rows1
,
&
compBlock
,
isLast
,
false
)
<
0
)
goto
_err
;
if
(
tsdbAddSubBlock
(
pHelper
,
&
compBlock
,
blkIdx
,
rowsWritten
)
<
0
)
goto
_err
;
}
else
{
// Load-Merge-Write
// Load
if
(
tsdbLoadBlockData
(
pHelper
,
blockAtIdx
(
pHelper
,
blkIdx
),
NULL
)
<
0
)
goto
_err
;
if
(
blockAtIdx
(
pHelper
,
blkIdx
)
->
last
)
pHelper
->
hasOldLastBlock
=
false
;
rowsWritten
=
rows3
;
int
iter1
=
0
;
// iter over pHelper->pDataCols[0]
int
iter2
=
0
;
// iter over pDataCols
int
round
=
0
;
// tdResetDataCols(pHelper->pDataCols[1]);
while
(
true
)
{
if
(
iter1
>=
pHelper
->
pDataCols
[
0
]
->
numOfRows
&&
iter2
>=
rows3
)
break
;
tdMergeTwoDataCols
(
pHelper
->
pDataCols
[
1
],
pHelper
->
pDataCols
[
0
],
&
iter1
,
pHelper
->
pDataCols
[
0
]
->
numOfRows
,
pDataCols
,
&
iter2
,
rowsWritten
,
pCfg
->
maxRowsPerFileBlock
*
4
/
5
);
ASSERT
(
pHelper
->
pDataCols
[
1
]
->
numOfRows
>
0
);
if
(
tsdbWriteBlockToFile
(
pHelper
,
&
(
pHelper
->
files
.
dataF
),
pHelper
->
pDataCols
[
1
],
pHelper
->
pDataCols
[
1
]
->
numOfRows
,
&
compBlock
,
false
,
true
)
<
0
)
goto
_err
;
if
(
round
==
0
)
{
tsdbUpdateSuperBlock
(
pHelper
,
&
compBlock
,
blkIdx
);
}
else
{
tsdbInsertSuperBlock
(
pHelper
,
&
compBlock
,
blkIdx
);
}
round
++
;
blkIdx
++
;
}
}
}
return
rowsWritten
;
_err:
return
-
1
;
}
static
int
compTSKEY
(
const
void
*
key1
,
const
void
*
key2
)
{
if
(
*
(
TSKEY
*
)
key1
>
*
(
TSKEY
*
)
key2
)
{
return
1
;
}
else
if
(
*
(
TSKEY
*
)
key1
==
*
(
TSKEY
*
)
key2
)
{
return
0
;
}
else
{
return
-
1
;
}
}
static
int
tsdbAdjustInfoSizeIfNeeded
(
SRWHelper
*
pHelper
,
size_t
esize
)
{
static
int
tsdbAdjustInfoSizeIfNeeded
(
SRWHelper
*
pHelper
,
size_t
esize
)
{
if
(
tsizeof
((
void
*
)
pHelper
->
pCompInfo
)
<=
esize
)
{
if
(
tsizeof
((
void
*
)
pHelper
->
pCompInfo
)
<=
esize
)
{
size_t
tsize
=
esize
+
sizeof
(
SCompBlock
)
*
16
;
size_t
tsize
=
esize
+
sizeof
(
SCompBlock
)
*
16
;
...
@@ -911,7 +799,7 @@ static int tsdbInsertSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int
...
@@ -911,7 +799,7 @@ static int tsdbInsertSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int
ASSERT
(
pCompBlock
->
numOfSubBlocks
==
1
);
ASSERT
(
pCompBlock
->
numOfSubBlocks
==
1
);
// Adjust memory if no more room
// Adjust memory if no more room
if
(
pIdx
->
len
==
0
)
pIdx
->
len
=
sizeof
(
SComp
Data
)
+
sizeof
(
TSCKSUM
);
if
(
pIdx
->
len
==
0
)
pIdx
->
len
=
sizeof
(
SComp
Info
)
+
sizeof
(
TSCKSUM
);
if
(
tsdbAdjustInfoSizeIfNeeded
(
pHelper
,
pIdx
->
len
+
sizeof
(
SCompInfo
))
<
0
)
goto
_err
;
if
(
tsdbAdjustInfoSizeIfNeeded
(
pHelper
,
pIdx
->
len
+
sizeof
(
SCompInfo
))
<
0
)
goto
_err
;
// Change the offset
// Change the offset
...
@@ -925,22 +813,22 @@ static int tsdbInsertSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int
...
@@ -925,22 +813,22 @@ static int tsdbInsertSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int
if
(
tsize
>
0
)
{
if
(
tsize
>
0
)
{
ASSERT
(
sizeof
(
SCompInfo
)
+
sizeof
(
SCompBlock
)
*
(
blkIdx
+
1
)
<
tsizeof
(
pHelper
->
pCompInfo
));
ASSERT
(
sizeof
(
SCompInfo
)
+
sizeof
(
SCompBlock
)
*
(
blkIdx
+
1
)
<
tsizeof
(
pHelper
->
pCompInfo
));
ASSERT
(
sizeof
(
SCompInfo
)
+
sizeof
(
SCompBlock
)
*
(
blkIdx
+
1
)
+
tsize
<=
tsizeof
(
pHelper
->
pCompInfo
));
ASSERT
(
sizeof
(
SCompInfo
)
+
sizeof
(
SCompBlock
)
*
(
blkIdx
+
1
)
+
tsize
<=
tsizeof
(
pHelper
->
pCompInfo
));
memmove
(
(
void
*
)((
char
*
)
pHelper
->
pCompInfo
+
sizeof
(
SCompInfo
)
+
sizeof
(
SCompBlock
)
*
(
blkIdx
+
1
)),
memmove
(
POINTER_SHIFT
(
pHelper
->
pCompInfo
,
sizeof
(
SCompInfo
)
+
sizeof
(
SCompBlock
)
*
(
blkIdx
+
1
)),
(
void
*
)((
char
*
)
pHelper
->
pCompInfo
+
sizeof
(
SCompInfo
)
+
sizeof
(
SCompBlock
)
*
blkIdx
),
tsize
);
POINTER_SHIFT
(
pHelper
->
pCompInfo
,
sizeof
(
SCompInfo
)
+
sizeof
(
SCompBlock
)
*
blkIdx
),
tsize
);
}
}
pHelper
->
pCompInfo
->
blocks
[
blkIdx
]
=
*
pCompBlock
;
pHelper
->
pCompInfo
->
blocks
[
blkIdx
]
=
*
pCompBlock
;
pIdx
->
numOfBlocks
++
;
pIdx
->
numOfBlocks
++
;
pIdx
->
len
+=
sizeof
(
SCompBlock
);
pIdx
->
len
+=
sizeof
(
SCompBlock
);
ASSERT
(
pIdx
->
len
<=
tsizeof
(
pHelper
->
pCompInfo
));
ASSERT
(
pIdx
->
len
<=
tsizeof
(
pHelper
->
pCompInfo
));
pIdx
->
maxKey
=
pHelper
->
pCompInfo
->
blocks
[
pIdx
->
numOfBlocks
-
1
].
keyLast
;
pIdx
->
maxKey
=
blockAtIdx
(
pHelper
,
pIdx
->
numOfBlocks
-
1
)
->
keyLast
;
pIdx
->
hasLast
=
pHelper
->
pCompInfo
->
blocks
[
pIdx
->
numOfBlocks
-
1
].
last
;
pIdx
->
hasLast
=
blockAtIdx
(
pHelper
,
pIdx
->
numOfBlocks
-
1
)
->
last
;
if
(
pIdx
->
numOfBlocks
>
1
)
{
if
(
pIdx
->
numOfBlocks
>
1
)
{
ASSERT
(
pHelper
->
pCompInfo
->
blocks
[
0
].
keyLast
<
pHelper
->
pCompInfo
->
blocks
[
1
].
keyFirst
);
ASSERT
(
pHelper
->
pCompInfo
->
blocks
[
0
].
keyLast
<
pHelper
->
pCompInfo
->
blocks
[
1
].
keyFirst
);
}
}
tsdb
Trace
(
"vgId:%d tid:%d a super block is inserted at index %d"
,
REPO_ID
(
pHelper
->
pRepo
),
pHelper
->
tableInfo
.
tid
,
tsdb
Debug
(
"vgId:%d tid:%d a super block is inserted at index %d"
,
REPO_ID
(
pHelper
->
pRepo
),
pHelper
->
tableInfo
.
tid
,
blkIdx
);
blkIdx
);
return
0
;
return
0
;
...
@@ -1048,8 +936,8 @@ static int tsdbUpdateSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int
...
@@ -1048,8 +936,8 @@ static int tsdbUpdateSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int
if
(
pSCompBlock
->
numOfSubBlocks
>
1
)
{
if
(
pSCompBlock
->
numOfSubBlocks
>
1
)
{
size_t
tsize
=
pIdx
->
len
-
(
pSCompBlock
->
offset
+
pSCompBlock
->
len
);
size_t
tsize
=
pIdx
->
len
-
(
pSCompBlock
->
offset
+
pSCompBlock
->
len
);
if
(
tsize
>
0
)
{
if
(
tsize
>
0
)
{
memmove
(
(
void
*
)((
char
*
)(
pHelper
->
pCompInfo
)
+
pSCompBlock
->
offset
),
memmove
(
POINTER_SHIFT
(
pHelper
->
pCompInfo
,
pSCompBlock
->
offset
),
(
void
*
)((
char
*
)(
pHelper
->
pCompInfo
)
+
pSCompBlock
->
offset
+
pSCompBlock
->
len
),
tsize
);
POINTER_SHIFT
(
pHelper
->
pCompInfo
,
pSCompBlock
->
offset
+
pSCompBlock
->
len
),
tsize
);
}
}
for
(
int
i
=
blkIdx
+
1
;
i
<
pIdx
->
numOfBlocks
;
i
++
)
{
for
(
int
i
=
blkIdx
+
1
;
i
<
pIdx
->
numOfBlocks
;
i
++
)
{
...
@@ -1062,8 +950,8 @@ static int tsdbUpdateSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int
...
@@ -1062,8 +950,8 @@ static int tsdbUpdateSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int
*
pSCompBlock
=
*
pCompBlock
;
*
pSCompBlock
=
*
pCompBlock
;
pIdx
->
maxKey
=
pHelper
->
pCompInfo
->
blocks
[
pIdx
->
numOfBlocks
-
1
].
keyLast
;
pIdx
->
maxKey
=
blockAtIdx
(
pHelper
,
pIdx
->
numOfBlocks
-
1
)
->
keyLast
;
pIdx
->
hasLast
=
pHelper
->
pCompInfo
->
blocks
[
pIdx
->
numOfBlocks
-
1
].
last
;
pIdx
->
hasLast
=
blockAtIdx
(
pHelper
,
pIdx
->
numOfBlocks
-
1
)
->
last
;
tsdbDebug
(
"vgId:%d tid:%d a super block is updated at index %d"
,
REPO_ID
(
pHelper
->
pRepo
),
pHelper
->
tableInfo
.
tid
,
tsdbDebug
(
"vgId:%d tid:%d a super block is updated at index %d"
,
REPO_ID
(
pHelper
->
pRepo
),
pHelper
->
tableInfo
.
tid
,
blkIdx
);
blkIdx
);
...
@@ -1071,30 +959,6 @@ static int tsdbUpdateSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int
...
@@ -1071,30 +959,6 @@ static int tsdbUpdateSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int
return
0
;
return
0
;
}
}
// Get the number of rows in range [minKey, maxKey]
static
int
tsdbGetRowsInRange
(
SDataCols
*
pDataCols
,
TSKEY
minKey
,
TSKEY
maxKey
)
{
if
(
pDataCols
->
numOfRows
==
0
)
return
0
;
ASSERT
(
minKey
<=
maxKey
);
TSKEY
keyFirst
=
dataColsKeyFirst
(
pDataCols
);
TSKEY
keyLast
=
dataColsKeyLast
(
pDataCols
);
ASSERT
(
keyFirst
<=
keyLast
);
if
(
minKey
>
keyLast
||
maxKey
<
keyFirst
)
return
0
;
void
*
ptr1
=
taosbsearch
((
void
*
)
&
minKey
,
(
void
*
)
pDataCols
->
cols
[
0
].
pData
,
pDataCols
->
numOfRows
,
sizeof
(
TSKEY
),
compTSKEY
,
TD_GE
);
ASSERT
(
ptr1
!=
NULL
);
void
*
ptr2
=
taosbsearch
((
void
*
)
&
maxKey
,
(
void
*
)
pDataCols
->
cols
[
0
].
pData
,
pDataCols
->
numOfRows
,
sizeof
(
TSKEY
),
compTSKEY
,
TD_LE
);
ASSERT
(
ptr2
!=
NULL
);
if
((
TSKEY
*
)
ptr2
-
(
TSKEY
*
)
ptr1
<
0
)
return
0
;
return
((
TSKEY
*
)
ptr2
-
(
TSKEY
*
)
ptr1
)
+
1
;
}
static
void
tsdbResetHelperFileImpl
(
SRWHelper
*
pHelper
)
{
static
void
tsdbResetHelperFileImpl
(
SRWHelper
*
pHelper
)
{
memset
((
void
*
)
&
pHelper
->
files
,
0
,
sizeof
(
pHelper
->
files
));
memset
((
void
*
)
&
pHelper
->
files
,
0
,
sizeof
(
pHelper
->
files
));
pHelper
->
files
.
fid
=
-
1
;
pHelper
->
files
.
fid
=
-
1
;
...
@@ -1250,7 +1114,8 @@ static int tsdbLoadColData(SRWHelper *pHelper, SFile *pFile, SCompBlock *pCompBl
...
@@ -1250,7 +1114,8 @@ static int tsdbLoadColData(SRWHelper *pHelper, SFile *pFile, SCompBlock *pCompBl
return
-
1
;
return
-
1
;
}
}
if
(
lseek
(
pFile
->
fd
,
pCompCol
->
offset
,
SEEK_SET
)
<
0
)
{
int64_t
offset
=
pCompBlock
->
offset
+
TSDB_GET_COMPCOL_LEN
(
pCompBlock
->
numOfCols
)
+
pCompCol
->
offset
;
if
(
lseek
(
pFile
->
fd
,
offset
,
SEEK_SET
)
<
0
)
{
tsdbError
(
"vgId:%d failed to lseek file %s since %s"
,
REPO_ID
(
pHelper
->
pRepo
),
pFile
->
fname
,
strerror
(
errno
));
tsdbError
(
"vgId:%d failed to lseek file %s since %s"
,
REPO_ID
(
pHelper
->
pRepo
),
pFile
->
fname
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
return
-
1
;
...
@@ -1276,10 +1141,15 @@ static int tsdbLoadColData(SRWHelper *pHelper, SFile *pFile, SCompBlock *pCompBl
...
@@ -1276,10 +1141,15 @@ static int tsdbLoadColData(SRWHelper *pHelper, SFile *pFile, SCompBlock *pCompBl
static
int
tsdbLoadBlockDataColsImpl
(
SRWHelper
*
pHelper
,
SCompBlock
*
pCompBlock
,
SDataCols
*
pDataCols
,
int16_t
*
colIds
,
int
numOfColIds
)
{
static
int
tsdbLoadBlockDataColsImpl
(
SRWHelper
*
pHelper
,
SCompBlock
*
pCompBlock
,
SDataCols
*
pDataCols
,
int16_t
*
colIds
,
int
numOfColIds
)
{
ASSERT
(
pCompBlock
->
numOfSubBlocks
<=
1
);
ASSERT
(
pCompBlock
->
numOfSubBlocks
<=
1
);
ASSERT
(
colIds
[
0
]
==
0
);
SFile
*
pFile
=
(
pCompBlock
->
last
)
?
&
(
pHelper
->
files
.
lastF
)
:
&
(
pHelper
->
files
.
dataF
);
SFile
*
pFile
=
(
pCompBlock
->
last
)
?
&
(
pHelper
->
files
.
lastF
)
:
&
(
pHelper
->
files
.
dataF
);
SCompCol
compCol
=
{
0
};
if
(
tsdbLoadCompData
(
pHelper
,
pCompBlock
,
NULL
)
<
0
)
goto
_err
;
// If only load timestamp column, no need to load SCompData part
if
(
numOfColIds
>
1
&&
tsdbLoadCompData
(
pHelper
,
pCompBlock
,
NULL
)
<
0
)
goto
_err
;
pDataCols
->
numOfRows
=
pCompBlock
->
numOfRows
;
int
dcol
=
0
;
int
dcol
=
0
;
int
ccol
=
0
;
int
ccol
=
0
;
...
@@ -1298,23 +1168,31 @@ static int tsdbLoadBlockDataColsImpl(SRWHelper *pHelper, SCompBlock *pCompBlock,
...
@@ -1298,23 +1168,31 @@ static int tsdbLoadBlockDataColsImpl(SRWHelper *pHelper, SCompBlock *pCompBlock,
ASSERT
(
pDataCol
->
colId
==
colId
);
ASSERT
(
pDataCol
->
colId
==
colId
);
while
(
ccol
<
pCompBlock
->
numOfCols
)
{
if
(
colId
==
0
)
{
// load the key row
pCompCol
=
&
pHelper
->
pCompData
->
cols
[
ccol
];
compCol
.
colId
=
colId
;
if
(
pCompCol
->
colId
>=
colId
)
break
;
compCol
.
len
=
pCompBlock
->
keyLen
;
ccol
++
;
compCol
.
type
=
pDataCol
->
type
;
}
compCol
.
offset
=
TSDB_KEY_COL_OFFSET
;
pCompCol
=
&
compCol
;
}
else
{
// load non-key rows
while
(
ccol
<
pCompBlock
->
numOfCols
)
{
pCompCol
=
&
pHelper
->
pCompData
->
cols
[
ccol
];
if
(
pCompCol
->
colId
>=
colId
)
break
;
ccol
++
;
}
if
(
ccol
>=
pCompBlock
->
numOfCols
||
pCompCol
->
colId
>
colId
)
{
if
(
ccol
>=
pCompBlock
->
numOfCols
||
pCompCol
->
colId
>
colId
)
{
dataColSetNEleNull
(
pDataCol
,
pCompBlock
->
numOfRows
,
pDataCols
->
maxPoints
);
dataColSetNEleNull
(
pDataCol
,
pCompBlock
->
numOfRows
,
pDataCols
->
maxPoints
);
dcol
++
;
dcol
++
;
continue
;
continue
;
}
}
ASSERT
(
pCompCol
->
colId
==
pDataCol
->
colId
);
ASSERT
(
pCompCol
->
colId
==
pDataCol
->
colId
);
}
if
(
tsdbLoadColData
(
pHelper
,
pFile
,
pCompBlock
,
pCompCol
,
pDataCol
)
<
0
)
goto
_err
;
if
(
tsdbLoadColData
(
pHelper
,
pFile
,
pCompBlock
,
pCompCol
,
pDataCol
)
<
0
)
goto
_err
;
dcol
++
;
dcol
++
;
ccol
++
;
if
(
colId
!=
0
)
ccol
++
;
}
}
return
0
;
return
0
;
...
@@ -1362,8 +1240,8 @@ static int tsdbLoadBlockDataImpl(SRWHelper *pHelper, SCompBlock *pCompBlock, SDa
...
@@ -1362,8 +1240,8 @@ static int tsdbLoadBlockDataImpl(SRWHelper *pHelper, SCompBlock *pCompBlock, SDa
pDataCols
->
numOfRows
=
pCompBlock
->
numOfRows
;
pDataCols
->
numOfRows
=
pCompBlock
->
numOfRows
;
// Recover the data
// Recover the data
int
ccol
=
0
;
int
ccol
=
0
;
// loop iter for SCompCol object
int
dcol
=
0
;
int
dcol
=
0
;
// loop iter for SDataCols object
while
(
dcol
<
pDataCols
->
numOfCols
)
{
while
(
dcol
<
pDataCols
->
numOfCols
)
{
SDataCol
*
pDataCol
=
&
(
pDataCols
->
cols
[
dcol
]);
SDataCol
*
pDataCol
=
&
(
pDataCols
->
cols
[
dcol
]);
if
(
ccol
>=
pCompData
->
numOfCols
)
{
if
(
ccol
>=
pCompData
->
numOfCols
)
{
...
@@ -1373,12 +1251,23 @@ static int tsdbLoadBlockDataImpl(SRWHelper *pHelper, SCompBlock *pCompBlock, SDa
...
@@ -1373,12 +1251,23 @@ static int tsdbLoadBlockDataImpl(SRWHelper *pHelper, SCompBlock *pCompBlock, SDa
continue
;
continue
;
}
}
SCompCol
*
pCompCol
=
&
(
pCompData
->
cols
[
ccol
]);
int16_t
tcolId
=
0
;
int32_t
toffset
=
TSDB_KEY_COL_OFFSET
;
int32_t
tlen
=
pCompBlock
->
keyLen
;
if
(
dcol
!=
0
)
{
SCompCol
*
pCompCol
=
&
(
pCompData
->
cols
[
ccol
]);
tcolId
=
pCompCol
->
colId
;
toffset
=
pCompCol
->
offset
;
tlen
=
pCompCol
->
len
;
}
else
{
ASSERT
(
pDataCol
->
colId
==
tcolId
);
}
if
(
pCompCol
->
colId
==
pDataCol
->
colId
)
{
if
(
t
colId
==
pDataCol
->
colId
)
{
if
(
pCompBlock
->
algorithm
==
TWO_STAGE_COMP
)
{
if
(
pCompBlock
->
algorithm
==
TWO_STAGE_COMP
)
{
int
zsize
=
pDataCol
->
bytes
*
pCompBlock
->
numOfRows
+
COMP_OVERFLOW_BYTES
;
int
zsize
=
pDataCol
->
bytes
*
pCompBlock
->
numOfRows
+
COMP_OVERFLOW_BYTES
;
if
(
p
CompCol
->
type
==
TSDB_DATA_TYPE_BINARY
||
pComp
Col
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
p
DataCol
->
type
==
TSDB_DATA_TYPE_BINARY
||
pData
Col
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
zsize
+=
(
sizeof
(
VarDataLenT
)
*
pCompBlock
->
numOfRows
);
zsize
+=
(
sizeof
(
VarDataLenT
)
*
pCompBlock
->
numOfRows
);
}
}
pHelper
->
compBuffer
=
trealloc
(
pHelper
->
compBuffer
,
zsize
);
pHelper
->
compBuffer
=
trealloc
(
pHelper
->
compBuffer
,
zsize
);
...
@@ -1387,16 +1276,16 @@ static int tsdbLoadBlockDataImpl(SRWHelper *pHelper, SCompBlock *pCompBlock, SDa
...
@@ -1387,16 +1276,16 @@ static int tsdbLoadBlockDataImpl(SRWHelper *pHelper, SCompBlock *pCompBlock, SDa
goto
_err
;
goto
_err
;
}
}
}
}
if
(
tsdbCheckAndDecodeColumnData
(
pDataCol
,
(
char
*
)
pCompData
+
tsize
+
pCompCol
->
offset
,
pCompCol
->
len
,
if
(
tsdbCheckAndDecodeColumnData
(
pDataCol
,
(
char
*
)
pCompData
+
tsize
+
toffset
,
tlen
,
pCompBlock
->
algorithm
,
pCompBlock
->
algorithm
,
pCompBlock
->
numOfRows
,
pDataCols
->
maxPoints
,
pCompBlock
->
numOfRows
,
pDataCols
->
maxPoints
,
pHelper
->
compBuffer
,
pHelper
->
compBuffer
,
tsizeof
(
pHelper
->
compBuffer
))
<
0
)
{
tsizeof
(
pHelper
->
compBuffer
))
<
0
)
{
tsdbError
(
"vgId:%d file %s is broken at column %d
offset %"
PRId64
,
REPO_ID
(
pHelper
->
pRepo
),
pFile
->
fname
,
tsdbError
(
"vgId:%d file %s is broken at column %d
block offset %"
PRId64
" column offset %d"
,
pCompCol
->
colId
,
(
int64_t
)
pCompCol
->
offset
);
REPO_ID
(
pHelper
->
pRepo
),
pFile
->
fname
,
tcolId
,
(
int64_t
)
pCompBlock
->
offset
,
t
offset
);
goto
_err
;
goto
_err
;
}
}
if
(
dcol
!=
0
)
ccol
++
;
dcol
++
;
dcol
++
;
ccol
++
;
}
else
if
(
tcolId
<
pDataCol
->
colId
)
{
}
else
if
(
pCompCol
->
colId
<
pDataCol
->
colId
)
{
ccol
++
;
ccol
++
;
}
else
{
}
else
{
// Set current column as NULL and forward
// Set current column as NULL and forward
...
@@ -1442,3 +1331,250 @@ static void *tsdbDecodeSCompIdx(void *buf, SCompIdx *pIdx) {
...
@@ -1442,3 +1331,250 @@ static void *tsdbDecodeSCompIdx(void *buf, SCompIdx *pIdx) {
return
buf
;
return
buf
;
}
}
static
int
tsdbProcessAppendCommit
(
SRWHelper
*
pHelper
,
SCommitIter
*
pCommitIter
,
SDataCols
*
pDataCols
,
TSKEY
maxKey
)
{
STsdbCfg
*
pCfg
=
&
(
pHelper
->
pRepo
->
config
);
STable
*
pTable
=
pCommitIter
->
pTable
;
SCompIdx
*
pIdx
=
pHelper
->
pCompIdx
+
TABLE_TID
(
pTable
);
TSKEY
keyFirst
=
tsdbNextIterKey
(
pCommitIter
->
pIter
);
int
defaultRowsInBlock
=
pCfg
->
maxRowsPerFileBlock
*
4
/
5
;
SCompBlock
compBlock
=
{
0
};
ASSERT
(
pIdx
->
len
<=
0
||
keyFirst
>
pIdx
->
maxKey
);
if
(
pIdx
->
hasLast
)
{
// append to with last block
ASSERT
(
pIdx
->
len
>
0
);
SCompBlock
*
pCompBlock
=
blockAtIdx
(
pHelper
,
pIdx
->
numOfBlocks
-
1
);
ASSERT
(
pCompBlock
->
last
&&
pCompBlock
->
numOfRows
<
pCfg
->
minRowsPerFileBlock
);
tdResetDataCols
(
pDataCols
);
int
rowsRead
=
tsdbLoadDataFromCache
(
pTable
,
pCommitIter
->
pIter
,
maxKey
,
defaultRowsInBlock
-
pCompBlock
->
numOfRows
,
pDataCols
,
NULL
,
0
);
ASSERT
(
rowsRead
>
0
&&
rowsRead
==
pDataCols
->
numOfRows
);
if
(
rowsRead
+
pCompBlock
->
numOfRows
<
pCfg
->
minRowsPerFileBlock
&&
pCompBlock
->
numOfSubBlocks
<
TSDB_MAX_SUBBLOCKS
&&
!
TSDB_NLAST_FILE_OPENED
(
pHelper
))
{
if
(
tsdbWriteBlockToFile
(
pHelper
,
&
(
pHelper
->
files
.
lastF
),
pDataCols
,
&
compBlock
,
true
,
false
)
<
0
)
return
-
1
;
if
(
tsdbAddSubBlock
(
pHelper
,
&
compBlock
,
pIdx
->
numOfBlocks
-
1
,
rowsRead
)
<
0
)
return
-
1
;
}
else
{
if
(
tsdbLoadBlockData
(
pHelper
,
pCompBlock
,
NULL
)
<
0
)
return
-
1
;
ASSERT
(
pHelper
->
pDataCols
[
0
]
->
numOfRows
==
pCompBlock
->
numOfRows
);
if
(
tdMergeDataCols
(
pHelper
->
pDataCols
[
0
],
pDataCols
,
pDataCols
->
numOfRows
)
<
0
)
return
-
1
;
ASSERT
(
pHelper
->
pDataCols
[
0
]
->
numOfRows
==
pCompBlock
->
numOfRows
+
pDataCols
->
numOfRows
);
if
(
tsdbWriteBlockToProperFile
(
pHelper
,
pHelper
->
pDataCols
[
0
],
&
compBlock
)
<
0
)
return
-
1
;
if
(
tsdbUpdateSuperBlock
(
pHelper
,
&
compBlock
,
pIdx
->
numOfBlocks
-
1
)
<
0
)
return
-
1
;
}
if
(
pHelper
->
hasOldLastBlock
)
pHelper
->
hasOldLastBlock
=
false
;
}
else
{
ASSERT
(
!
pHelper
->
hasOldLastBlock
);
tdResetDataCols
(
pDataCols
);
int
rowsRead
=
tsdbLoadDataFromCache
(
pTable
,
pCommitIter
->
pIter
,
maxKey
,
defaultRowsInBlock
,
pDataCols
,
NULL
,
0
);
ASSERT
(
rowsRead
>
0
&&
rowsRead
==
pDataCols
->
numOfRows
);
if
(
tsdbWriteBlockToProperFile
(
pHelper
,
pDataCols
,
&
compBlock
)
<
0
)
return
-
1
;
if
(
tsdbInsertSuperBlock
(
pHelper
,
&
compBlock
,
pIdx
->
numOfBlocks
)
<
0
)
return
-
1
;
}
return
0
;
}
static
int
tsdbProcessMergeCommit
(
SRWHelper
*
pHelper
,
SCommitIter
*
pCommitIter
,
SDataCols
*
pDataCols
,
TSKEY
maxKey
,
int
*
blkIdx
)
{
STsdbCfg
*
pCfg
=
&
(
pHelper
->
pRepo
->
config
);
STable
*
pTable
=
pCommitIter
->
pTable
;
SCompIdx
*
pIdx
=
pHelper
->
pCompIdx
+
TABLE_TID
(
pTable
);
SCompBlock
compBlock
=
{
0
};
TSKEY
keyFirst
=
tsdbNextIterKey
(
pCommitIter
->
pIter
);
int
defaultRowsInBlock
=
pCfg
->
maxRowsPerFileBlock
*
4
/
5
;
SDataCols
*
pDataCols0
=
pHelper
->
pDataCols
[
0
];
SSkipListIterator
slIter
=
{
0
};
ASSERT
(
keyFirst
<=
pIdx
->
maxKey
);
SCompBlock
*
pCompBlock
=
taosbsearch
((
void
*
)(
&
keyFirst
),
(
void
*
)
blockAtIdx
(
pHelper
,
*
blkIdx
),
pIdx
->
numOfBlocks
-
*
blkIdx
,
sizeof
(
SCompBlock
),
compareKeyBlock
,
TD_GE
);
ASSERT
(
pCompBlock
!=
NULL
);
int
tblkIdx
=
TSDB_GET_COMPBLOCK_IDX
(
pHelper
,
pCompBlock
);
if
(
pCompBlock
->
last
)
{
ASSERT
(
pCompBlock
->
numOfRows
<
pCfg
->
minRowsPerFileBlock
&&
tblkIdx
==
pIdx
->
numOfBlocks
-
1
);
int16_t
colId
=
0
;
slIter
=
*
(
pCommitIter
->
pIter
);
if
(
tsdbLoadBlockDataCols
(
pHelper
,
pCompBlock
,
NULL
,
&
colId
,
1
)
<
0
)
return
-
1
;
ASSERT
(
pDataCols0
->
numOfRows
==
pCompBlock
->
numOfRows
);
int
rows1
=
defaultRowsInBlock
-
pCompBlock
->
numOfRows
;
int
rows2
=
tsdbLoadDataFromCache
(
pTable
,
&
slIter
,
maxKey
,
rows1
,
NULL
,
pDataCols0
->
cols
[
0
].
pData
,
pDataCols0
->
numOfRows
);
if
(
rows2
==
0
)
{
// all data filtered out
*
(
pCommitIter
->
pIter
)
=
slIter
;
}
else
{
if
(
rows1
+
rows2
<
pCfg
->
minRowsPerFileBlock
&&
pCompBlock
->
numOfSubBlocks
<
TSDB_MAX_SUBBLOCKS
&&
!
TSDB_NLAST_FILE_OPENED
(
pHelper
))
{
tdResetDataCols
(
pDataCols
);
int
rowsRead
=
tsdbLoadDataFromCache
(
pTable
,
pCommitIter
->
pIter
,
maxKey
,
rows1
,
pDataCols
,
pDataCols0
->
cols
[
0
].
pData
,
pDataCols0
->
numOfRows
);
ASSERT
(
rowsRead
==
rows2
&&
rowsRead
==
pDataCols
->
numOfRows
);
if
(
tsdbWriteBlockToFile
(
pHelper
,
&
(
pHelper
->
files
.
lastF
),
pDataCols
,
&
compBlock
,
true
,
false
)
<
0
)
return
-
1
;
if
(
tsdbAddSubBlock
(
pHelper
,
&
compBlock
,
tblkIdx
,
rowsRead
)
<
0
)
return
-
1
;
tblkIdx
++
;
}
else
{
if
(
tsdbLoadBlockData
(
pHelper
,
pCompBlock
,
NULL
)
<
0
)
return
-
1
;
int
round
=
0
;
int
dIter
=
0
;
while
(
true
)
{
tdResetDataCols
(
pDataCols
);
int
rowsRead
=
tsdbLoadAndMergeFromCache
(
pDataCols0
,
&
dIter
,
pCommitIter
,
pDataCols
,
maxKey
,
defaultRowsInBlock
);
if
(
rowsRead
==
0
)
break
;
if
(
tsdbWriteBlockToProperFile
(
pHelper
,
pDataCols
,
&
compBlock
)
<
0
)
return
-
1
;
if
(
round
==
0
)
{
if
(
tsdbUpdateSuperBlock
(
pHelper
,
&
compBlock
,
tblkIdx
)
<
0
)
return
-
1
;
}
else
{
if
(
tsdbInsertSuperBlock
(
pHelper
,
&
compBlock
,
tblkIdx
)
<
0
)
return
-
1
;
}
tblkIdx
++
;
round
++
;
}
}
if
(
pHelper
->
hasOldLastBlock
)
pHelper
->
hasOldLastBlock
=
false
;
}
}
else
{
TSKEY
keyLimit
=
(
tblkIdx
==
pIdx
->
numOfBlocks
-
1
)
?
maxKey
:
(
pCompBlock
[
1
].
keyFirst
-
1
);
TSKEY
blkKeyFirst
=
pCompBlock
->
keyFirst
;
TSKEY
blkKeyLast
=
pCompBlock
->
keyLast
;
if
(
keyFirst
<
blkKeyFirst
)
{
while
(
true
)
{
tdResetDataCols
(
pDataCols
);
int
rowsRead
=
tsdbLoadDataFromCache
(
pTable
,
pCommitIter
->
pIter
,
blkKeyFirst
-
1
,
defaultRowsInBlock
,
pDataCols
,
NULL
,
0
);
if
(
rowsRead
==
0
)
break
;
ASSERT
(
rowsRead
==
pDataCols
->
numOfRows
);
if
(
tsdbWriteBlockToFile
(
pHelper
,
&
(
pHelper
->
files
.
dataF
),
pDataCols
,
&
compBlock
,
false
,
true
)
<
0
)
return
-
1
;
if
(
tsdbInsertSuperBlock
(
pHelper
,
&
compBlock
,
tblkIdx
)
<
0
)
return
-
1
;
tblkIdx
++
;
}
}
else
{
ASSERT
(
keyFirst
<=
blkKeyLast
);
int16_t
colId
=
0
;
if
(
tsdbLoadBlockDataCols
(
pHelper
,
pCompBlock
,
NULL
,
&
colId
,
1
)
<
0
)
return
-
1
;
ASSERT
(
pDataCols0
->
numOfRows
==
pCompBlock
->
numOfRows
);
slIter
=
*
(
pCommitIter
->
pIter
);
int
rows1
=
(
pCfg
->
maxRowsPerFileBlock
-
pCompBlock
->
numOfRows
);
int
rows2
=
tsdbLoadDataFromCache
(
pTable
,
&
slIter
,
blkKeyLast
,
INT_MAX
,
NULL
,
pDataCols0
->
cols
[
0
].
pData
,
pDataCols0
->
numOfRows
);
if
(
rows2
==
0
)
{
// all filtered out
*
(
pCommitIter
->
pIter
)
=
slIter
;
}
else
{
int
rows3
=
tsdbLoadDataFromCache
(
pTable
,
&
slIter
,
keyLimit
,
INT_MAX
,
NULL
,
NULL
,
0
)
+
rows2
;
ASSERT
(
rows3
>=
rows2
);
if
(
pCompBlock
->
numOfSubBlocks
<
TSDB_MAX_SUBBLOCKS
&&
rows1
>=
rows2
)
{
int
rows
=
(
rows1
>=
rows3
)
?
rows3
:
rows2
;
tdResetDataCols
(
pDataCols
);
int
rowsRead
=
tsdbLoadDataFromCache
(
pTable
,
pCommitIter
->
pIter
,
keyLimit
,
rows
,
pDataCols
,
pDataCols0
->
cols
[
0
].
pData
,
pDataCols0
->
numOfRows
);
ASSERT
(
rowsRead
==
rows
&&
rowsRead
==
pDataCols
->
numOfRows
);
if
(
tsdbWriteBlockToFile
(
pHelper
,
&
(
pHelper
->
files
.
dataF
),
pDataCols
,
&
compBlock
,
false
,
false
)
<
0
)
return
-
1
;
if
(
tsdbAddSubBlock
(
pHelper
,
&
compBlock
,
tblkIdx
,
rowsRead
)
<
0
)
return
-
1
;
tblkIdx
++
;
}
else
{
if
(
tsdbLoadBlockData
(
pHelper
,
pCompBlock
,
NULL
)
<
0
)
return
-
1
;
int
round
=
0
;
int
dIter
=
0
;
while
(
true
)
{
int
rowsRead
=
tsdbLoadAndMergeFromCache
(
pDataCols0
,
&
dIter
,
pCommitIter
,
pDataCols
,
keyLimit
,
defaultRowsInBlock
);
if
(
rowsRead
==
0
)
break
;
if
(
tsdbWriteBlockToFile
(
pHelper
,
&
(
pHelper
->
files
.
dataF
),
pDataCols
,
&
compBlock
,
false
,
true
)
<
0
)
return
-
1
;
if
(
round
==
0
)
{
if
(
tsdbUpdateSuperBlock
(
pHelper
,
&
compBlock
,
tblkIdx
)
<
0
)
return
-
1
;
}
else
{
if
(
tsdbInsertSuperBlock
(
pHelper
,
&
compBlock
,
tblkIdx
)
<
0
)
return
-
1
;
}
round
++
;
tblkIdx
++
;
}
}
}
}
}
*
blkIdx
=
tblkIdx
;
return
0
;
}
static
int
tsdbLoadAndMergeFromCache
(
SDataCols
*
pDataCols
,
int
*
iter
,
SCommitIter
*
pCommitIter
,
SDataCols
*
pTarget
,
TSKEY
maxKey
,
int
maxRows
)
{
int
numOfRows
=
0
;
TSKEY
key1
=
INT64_MAX
;
TSKEY
key2
=
INT64_MAX
;
STSchema
*
pSchema
=
NULL
;
ASSERT
(
maxRows
>
0
&&
dataColsKeyLast
(
pDataCols
)
<=
maxKey
);
tdResetDataCols
(
pTarget
);
while
(
true
)
{
key1
=
(
*
iter
>=
pDataCols
->
numOfRows
)
?
INT64_MAX
:
dataColsKeyAt
(
pDataCols
,
*
iter
);
SDataRow
row
=
tsdbNextIterRow
(
pCommitIter
->
pIter
);
key2
=
(
row
==
NULL
||
dataRowKey
(
row
)
>
maxKey
)
?
INT64_MAX
:
dataRowKey
(
row
);
if
(
key1
==
INT64_MAX
&&
key2
==
INT64_MAX
)
break
;
if
(
key1
<=
key2
)
{
for
(
int
i
=
0
;
i
<
pDataCols
->
numOfCols
;
i
++
)
{
dataColAppendVal
(
pTarget
->
cols
+
i
,
tdGetColDataOfRow
(
pDataCols
->
cols
+
i
,
*
iter
),
pTarget
->
numOfRows
,
pTarget
->
maxPoints
);
}
pTarget
->
numOfRows
++
;
(
*
iter
)
++
;
if
(
key1
==
key2
)
tSkipListIterNext
(
pCommitIter
->
pIter
);
}
else
{
if
(
pSchema
==
NULL
||
schemaVersion
(
pSchema
)
!=
dataRowVersion
(
row
))
{
pSchema
=
tsdbGetTableSchemaImpl
(
pCommitIter
->
pTable
,
false
,
false
,
dataRowVersion
(
row
));
ASSERT
(
pSchema
!=
NULL
);
}
tdAppendDataRowToDataCol
(
row
,
pSchema
,
pTarget
);
tSkipListIterNext
(
pCommitIter
->
pIter
);
}
numOfRows
++
;
if
(
numOfRows
>=
maxRows
)
break
;
ASSERT
(
numOfRows
==
pTarget
->
numOfRows
&&
numOfRows
<=
pTarget
->
maxPoints
);
}
return
numOfRows
;
}
static
int
tsdbWriteBlockToProperFile
(
SRWHelper
*
pHelper
,
SDataCols
*
pDataCols
,
SCompBlock
*
pCompBlock
)
{
STsdbCfg
*
pCfg
=
&
(
pHelper
->
pRepo
->
config
);
SFile
*
pFile
=
NULL
;
bool
isLast
=
false
;
ASSERT
(
pDataCols
->
numOfRows
>
0
);
if
(
pDataCols
->
numOfRows
>=
pCfg
->
minRowsPerFileBlock
)
{
pFile
=
&
(
pHelper
->
files
.
dataF
);
}
else
{
isLast
=
true
;
pFile
=
TSDB_NLAST_FILE_OPENED
(
pHelper
)
?
&
(
pHelper
->
files
.
nLastF
)
:
&
(
pHelper
->
files
.
lastF
);
}
ASSERT
(
pFile
->
fd
>
0
);
if
(
tsdbWriteBlockToFile
(
pHelper
,
pFile
,
pDataCols
,
pCompBlock
,
isLast
,
true
)
<
0
)
return
-
1
;
return
0
;
}
\ No newline at end of file
src/tsdb/src/tsdbRead.c
浏览文件 @
a3714edf
...
@@ -179,7 +179,10 @@ TsdbQueryHandleT* tsdbQueryTables(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, STab
...
@@ -179,7 +179,10 @@ TsdbQueryHandleT* tsdbQueryTables(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, STab
pQueryHandle
->
outputCapacity
=
((
STsdbRepo
*
)
tsdb
)
->
config
.
maxRowsPerFileBlock
;
pQueryHandle
->
outputCapacity
=
((
STsdbRepo
*
)
tsdb
)
->
config
.
maxRowsPerFileBlock
;
pQueryHandle
->
allocSize
=
0
;
pQueryHandle
->
allocSize
=
0
;
tsdbInitReadHelper
(
&
pQueryHandle
->
rhelper
,
(
STsdbRepo
*
)
tsdb
);
if
(
tsdbInitReadHelper
(
&
pQueryHandle
->
rhelper
,
(
STsdbRepo
*
)
tsdb
)
!=
0
)
{
free
(
pQueryHandle
);
return
NULL
;
}
tsdbTakeMemSnapshot
(
pQueryHandle
->
pTsdb
,
&
pQueryHandle
->
mem
,
&
pQueryHandle
->
imem
);
tsdbTakeMemSnapshot
(
pQueryHandle
->
pTsdb
,
&
pQueryHandle
->
mem
,
&
pQueryHandle
->
imem
);
size_t
sizeOfGroup
=
taosArrayGetSize
(
groupList
->
pGroupList
);
size_t
sizeOfGroup
=
taosArrayGetSize
(
groupList
->
pGroupList
);
...
@@ -238,11 +241,11 @@ TsdbQueryHandleT* tsdbQueryTables(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, STab
...
@@ -238,11 +241,11 @@ TsdbQueryHandleT* tsdbQueryTables(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, STab
TsdbQueryHandleT
tsdbQueryLastRow
(
TSDB_REPO_T
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
,
void
*
qinfo
)
{
TsdbQueryHandleT
tsdbQueryLastRow
(
TSDB_REPO_T
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
,
void
*
qinfo
)
{
STsdbQueryHandle
*
pQueryHandle
=
(
STsdbQueryHandle
*
)
tsdbQueryTables
(
tsdb
,
pCond
,
groupList
,
qinfo
);
STsdbQueryHandle
*
pQueryHandle
=
(
STsdbQueryHandle
*
)
tsdbQueryTables
(
tsdb
,
pCond
,
groupList
,
qinfo
);
if
(
pQueryHandle
!=
NULL
)
{
pQueryHandle
->
type
=
TSDB_QUERY_TYPE_LAST
;
pQueryHandle
->
type
=
TSDB_QUERY_TYPE_LAST
;
pQueryHandle
->
order
=
TSDB_ORDER_DESC
;
pQueryHandle
->
order
=
TSDB_ORDER_DESC
;
changeQueryHandleForLastrowQuery
(
pQueryHandle
);
changeQueryHandleForLastrowQuery
(
pQueryHandle
);
}
return
pQueryHandle
;
return
pQueryHandle
;
}
}
...
@@ -264,9 +267,10 @@ SArray* tsdbGetQueriedTableList(TsdbQueryHandleT *pHandle) {
...
@@ -264,9 +267,10 @@ SArray* tsdbGetQueriedTableList(TsdbQueryHandleT *pHandle) {
TsdbQueryHandleT
tsdbQueryRowsInExternalWindow
(
TSDB_REPO_T
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
,
void
*
qinfo
)
{
TsdbQueryHandleT
tsdbQueryRowsInExternalWindow
(
TSDB_REPO_T
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
,
void
*
qinfo
)
{
STsdbQueryHandle
*
pQueryHandle
=
(
STsdbQueryHandle
*
)
tsdbQueryTables
(
tsdb
,
pCond
,
groupList
,
qinfo
);
STsdbQueryHandle
*
pQueryHandle
=
(
STsdbQueryHandle
*
)
tsdbQueryTables
(
tsdb
,
pCond
,
groupList
,
qinfo
);
if
(
pQueryHandle
!=
NULL
)
{
pQueryHandle
->
type
=
TSDB_QUERY_TYPE_EXTERNAL
;
pQueryHandle
->
type
=
TSDB_QUERY_TYPE_EXTERNAL
;
changeQueryHandleForInterpQuery
(
pQueryHandle
);
changeQueryHandleForInterpQuery
(
pQueryHandle
);
}
return
pQueryHandle
;
return
pQueryHandle
;
}
}
...
@@ -1522,7 +1526,10 @@ bool tsdbNextDataBlock(TsdbQueryHandleT* pHandle) {
...
@@ -1522,7 +1526,10 @@ bool tsdbNextDataBlock(TsdbQueryHandleT* pHandle) {
pSecQueryHandle
->
activeIndex
=
0
;
pSecQueryHandle
->
activeIndex
=
0
;
pSecQueryHandle
->
outputCapacity
=
((
STsdbRepo
*
)
pSecQueryHandle
->
pTsdb
)
->
config
.
maxRowsPerFileBlock
;
pSecQueryHandle
->
outputCapacity
=
((
STsdbRepo
*
)
pSecQueryHandle
->
pTsdb
)
->
config
.
maxRowsPerFileBlock
;
tsdbInitReadHelper
(
&
pSecQueryHandle
->
rhelper
,
(
STsdbRepo
*
)
pSecQueryHandle
->
pTsdb
);
if
(
tsdbInitReadHelper
(
&
pSecQueryHandle
->
rhelper
,
(
STsdbRepo
*
)
pSecQueryHandle
->
pTsdb
)
!=
0
)
{
free
(
pSecQueryHandle
);
return
false
;
}
tsdbTakeMemSnapshot
(
pSecQueryHandle
->
pTsdb
,
&
pSecQueryHandle
->
mem
,
&
pSecQueryHandle
->
imem
);
tsdbTakeMemSnapshot
(
pSecQueryHandle
->
pTsdb
,
&
pSecQueryHandle
->
mem
,
&
pSecQueryHandle
->
imem
);
// allocate buffer in order to load data blocks from file
// allocate buffer in order to load data blocks from file
...
@@ -1606,7 +1613,9 @@ bool tsdbNextDataBlock(TsdbQueryHandleT* pHandle) {
...
@@ -1606,7 +1613,9 @@ bool tsdbNextDataBlock(TsdbQueryHandleT* pHandle) {
}
}
// TODO: opt by consider the scan order
// TODO: opt by consider the scan order
return
doHasDataInBuffer
(
pQueryHandle
);
bool
ret
=
doHasDataInBuffer
(
pQueryHandle
);
terrno
=
TSDB_CODE_SUCCESS
;
return
ret
;
}
}
void
changeQueryHandleForLastrowQuery
(
TsdbQueryHandleT
pqHandle
)
{
void
changeQueryHandleForLastrowQuery
(
TsdbQueryHandleT
pqHandle
)
{
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
a3714edf
...
@@ -69,6 +69,7 @@ int32_t vnodeInitResources() {
...
@@ -69,6 +69,7 @@ int32_t vnodeInitResources() {
}
}
void
vnodeCleanupResources
()
{
void
vnodeCleanupResources
()
{
if
(
tsDnodeVnodesHash
!=
NULL
)
{
if
(
tsDnodeVnodesHash
!=
NULL
)
{
taosHashCleanup
(
tsDnodeVnodesHash
);
taosHashCleanup
(
tsDnodeVnodesHash
);
tsDnodeVnodesHash
=
NULL
;
tsDnodeVnodesHash
=
NULL
;
...
@@ -137,7 +138,7 @@ int32_t vnodeCreate(SMDCreateVnodeMsg *pVnodeCfg) {
...
@@ -137,7 +138,7 @@ int32_t vnodeCreate(SMDCreateVnodeMsg *pVnodeCfg) {
return
TSDB_CODE_VND_INIT_FAILED
;
return
TSDB_CODE_VND_INIT_FAILED
;
}
}
vInfo
(
"vgId:%d, vnode is created,
clog:%d"
,
pVnodeCfg
->
cfg
.
vgId
,
pVnodeCfg
->
cfg
.
walLevel
);
vInfo
(
"vgId:%d, vnode is created,
walLevel:%d fsyncPeriod:%d"
,
pVnodeCfg
->
cfg
.
vgId
,
pVnodeCfg
->
cfg
.
walLevel
,
pVnodeCfg
->
cfg
.
fsyncPeriod
);
code
=
vnodeOpen
(
pVnodeCfg
->
cfg
.
vgId
,
rootDir
);
code
=
vnodeOpen
(
pVnodeCfg
->
cfg
.
vgId
,
rootDir
);
return
code
;
return
code
;
...
@@ -618,6 +619,7 @@ static int32_t vnodeSaveCfg(SMDCreateVnodeMsg *pVnodeCfg) {
...
@@ -618,6 +619,7 @@ static int32_t vnodeSaveCfg(SMDCreateVnodeMsg *pVnodeCfg) {
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
precision
\"
: %d,
\n
"
,
pVnodeCfg
->
cfg
.
precision
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
precision
\"
: %d,
\n
"
,
pVnodeCfg
->
cfg
.
precision
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
compression
\"
: %d,
\n
"
,
pVnodeCfg
->
cfg
.
compression
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
compression
\"
: %d,
\n
"
,
pVnodeCfg
->
cfg
.
compression
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
walLevel
\"
: %d,
\n
"
,
pVnodeCfg
->
cfg
.
walLevel
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
walLevel
\"
: %d,
\n
"
,
pVnodeCfg
->
cfg
.
walLevel
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
fsync
\"
: %d,
\n
"
,
pVnodeCfg
->
cfg
.
fsyncPeriod
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
replica
\"
: %d,
\n
"
,
pVnodeCfg
->
cfg
.
replications
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
replica
\"
: %d,
\n
"
,
pVnodeCfg
->
cfg
.
replications
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
wals
\"
: %d,
\n
"
,
pVnodeCfg
->
cfg
.
wals
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
wals
\"
: %d,
\n
"
,
pVnodeCfg
->
cfg
.
wals
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
quorum
\"
: %d,
\n
"
,
pVnodeCfg
->
cfg
.
quorum
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
quorum
\"
: %d,
\n
"
,
pVnodeCfg
->
cfg
.
quorum
);
...
@@ -782,6 +784,13 @@ static int32_t vnodeReadCfg(SVnodeObj *pVnode) {
...
@@ -782,6 +784,13 @@ static int32_t vnodeReadCfg(SVnodeObj *pVnode) {
}
}
pVnode
->
walCfg
.
walLevel
=
(
int8_t
)
walLevel
->
valueint
;
pVnode
->
walCfg
.
walLevel
=
(
int8_t
)
walLevel
->
valueint
;
cJSON
*
fsyncPeriod
=
cJSON_GetObjectItem
(
root
,
"fsync"
);
if
(
!
walLevel
||
walLevel
->
type
!=
cJSON_Number
)
{
vError
(
"vgId:%d, failed to read vnode cfg, fsyncPeriod not found"
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
pVnode
->
walCfg
.
fsyncPeriod
=
fsyncPeriod
->
valueint
;
cJSON
*
wals
=
cJSON_GetObjectItem
(
root
,
"wals"
);
cJSON
*
wals
=
cJSON_GetObjectItem
(
root
,
"wals"
);
if
(
!
wals
||
wals
->
type
!=
cJSON_Number
)
{
if
(
!
wals
||
wals
->
type
!=
cJSON_Number
)
{
vError
(
"vgId:%d, failed to read vnode cfg, wals not found"
,
pVnode
->
vgId
);
vError
(
"vgId:%d, failed to read vnode cfg, wals not found"
,
pVnode
->
vgId
);
...
...
src/wal/src/walMain.c
浏览文件 @
a3714edf
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include "tlog.h"
#include "tlog.h"
#include "tchecksum.h"
#include "tchecksum.h"
#include "tutil.h"
#include "tutil.h"
#include "ttimer.h"
#include "taoserror.h"
#include "taoserror.h"
#include "twal.h"
#include "twal.h"
#include "tqueue.h"
#include "tqueue.h"
...
@@ -44,6 +45,9 @@ typedef struct {
...
@@ -44,6 +45,9 @@ typedef struct {
int
fd
;
int
fd
;
int
keep
;
int
keep
;
int
level
;
int
level
;
int32_t
fsyncPeriod
;
void
*
timer
;
void
*
signature
;
int
max
;
// maximum number of wal files
int
max
;
// maximum number of wal files
uint32_t
id
;
// increase continuously
uint32_t
id
;
// increase continuously
int
num
;
// number of wal files
int
num
;
// number of wal files
...
@@ -52,10 +56,23 @@ typedef struct {
...
@@ -52,10 +56,23 @@ typedef struct {
pthread_mutex_t
mutex
;
pthread_mutex_t
mutex
;
}
SWal
;
}
SWal
;
static
void
*
walTmrCtrl
=
NULL
;
static
int
tsWalNum
=
0
;
static
pthread_once_t
walModuleInit
=
PTHREAD_ONCE_INIT
;
static
uint32_t
walSignature
=
0xFAFBFDFE
;
static
uint32_t
walSignature
=
0xFAFBFDFE
;
static
int
walHandleExistingFiles
(
const
char
*
path
);
static
int
walHandleExistingFiles
(
const
char
*
path
);
static
int
walRestoreWalFile
(
SWal
*
pWal
,
void
*
pVnode
,
FWalWrite
writeFp
);
static
int
walRestoreWalFile
(
SWal
*
pWal
,
void
*
pVnode
,
FWalWrite
writeFp
);
static
int
walRemoveWalFiles
(
const
char
*
path
);
static
int
walRemoveWalFiles
(
const
char
*
path
);
static
void
walProcessFsyncTimer
(
void
*
param
,
void
*
tmrId
);
static
void
walRelease
(
SWal
*
pWal
);
static
void
walModuleInitFunc
()
{
walTmrCtrl
=
taosTmrInit
(
1000
,
100
,
300000
,
"WAL"
);
if
(
walTmrCtrl
==
NULL
)
walModuleInit
=
PTHREAD_ONCE_INIT
;
else
wDebug
(
"WAL module is initialized"
);
}
void
*
walOpen
(
const
char
*
path
,
const
SWalCfg
*
pCfg
)
{
void
*
walOpen
(
const
char
*
path
,
const
SWalCfg
*
pCfg
)
{
SWal
*
pWal
=
calloc
(
sizeof
(
SWal
),
1
);
SWal
*
pWal
=
calloc
(
sizeof
(
SWal
),
1
);
...
@@ -64,20 +81,38 @@ void *walOpen(const char *path, const SWalCfg *pCfg) {
...
@@ -64,20 +81,38 @@ void *walOpen(const char *path, const SWalCfg *pCfg) {
return
NULL
;
return
NULL
;
}
}
pthread_once
(
&
walModuleInit
,
walModuleInitFunc
);
if
(
walTmrCtrl
==
NULL
)
{
free
(
pWal
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
NULL
;
}
atomic_add_fetch_32
(
&
tsWalNum
,
1
);
pWal
->
fd
=
-
1
;
pWal
->
fd
=
-
1
;
pWal
->
max
=
pCfg
->
wals
;
pWal
->
max
=
pCfg
->
wals
;
pWal
->
id
=
0
;
pWal
->
id
=
0
;
pWal
->
num
=
0
;
pWal
->
num
=
0
;
pWal
->
level
=
pCfg
->
walLevel
;
pWal
->
level
=
pCfg
->
walLevel
;
pWal
->
keep
=
pCfg
->
keep
;
pWal
->
keep
=
pCfg
->
keep
;
pWal
->
fsyncPeriod
=
pCfg
->
fsyncPeriod
;
pWal
->
signature
=
pWal
;
tstrncpy
(
pWal
->
path
,
path
,
sizeof
(
pWal
->
path
));
tstrncpy
(
pWal
->
path
,
path
,
sizeof
(
pWal
->
path
));
pthread_mutex_init
(
&
pWal
->
mutex
,
NULL
);
pthread_mutex_init
(
&
pWal
->
mutex
,
NULL
);
if
(
pWal
->
fsyncPeriod
>
0
&&
pWal
->
level
==
TAOS_WAL_FSYNC
)
{
pWal
->
timer
=
taosTmrStart
(
walProcessFsyncTimer
,
pWal
->
fsyncPeriod
,
pWal
,
walTmrCtrl
);
if
(
pWal
->
timer
==
NULL
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
walRelease
(
pWal
);
return
NULL
;
}
}
if
(
tmkdir
(
path
,
0755
)
!=
0
)
{
if
(
tmkdir
(
path
,
0755
)
!=
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
wError
(
"wal:%s, failed to create directory(%s)"
,
path
,
strerror
(
errno
));
wError
(
"wal:%s, failed to create directory(%s)"
,
path
,
strerror
(
errno
));
pthread_mutex_destroy
(
&
pWal
->
mutex
);
walRelease
(
pWal
);
free
(
pWal
);
pWal
=
NULL
;
pWal
=
NULL
;
}
}
...
@@ -89,12 +124,11 @@ void *walOpen(const char *path, const SWalCfg *pCfg) {
...
@@ -89,12 +124,11 @@ void *walOpen(const char *path, const SWalCfg *pCfg) {
if
(
pWal
&&
pWal
->
fd
<
0
)
{
if
(
pWal
&&
pWal
->
fd
<
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
wError
(
"wal:%s, failed to open(%s)"
,
path
,
strerror
(
errno
));
wError
(
"wal:%s, failed to open(%s)"
,
path
,
strerror
(
errno
));
pthread_mutex_destroy
(
&
pWal
->
mutex
);
walRelease
(
pWal
);
free
(
pWal
);
pWal
=
NULL
;
pWal
=
NULL
;
}
}
if
(
pWal
)
wDebug
(
"wal:%s, it is open, level:%d
"
,
path
,
pWal
->
level
);
if
(
pWal
)
wDebug
(
"wal:%s, it is open, level:%d
fsyncPeriod:%d"
,
path
,
pWal
->
level
,
pWal
->
fsyncPeriod
);
return
pWal
;
return
pWal
;
}
}
...
@@ -102,7 +136,8 @@ void walClose(void *handle) {
...
@@ -102,7 +136,8 @@ void walClose(void *handle) {
if
(
handle
==
NULL
)
return
;
if
(
handle
==
NULL
)
return
;
SWal
*
pWal
=
handle
;
SWal
*
pWal
=
handle
;
close
(
pWal
->
fd
);
tclose
(
pWal
->
fd
);
if
(
pWal
->
timer
)
taosTmrStopA
(
&
pWal
->
timer
);
if
(
pWal
->
keep
==
0
)
{
if
(
pWal
->
keep
==
0
)
{
// remove all files in the directory
// remove all files in the directory
...
@@ -118,9 +153,7 @@ void walClose(void *handle) {
...
@@ -118,9 +153,7 @@ void walClose(void *handle) {
wDebug
(
"wal:%s, it is closed and kept"
,
pWal
->
name
);
wDebug
(
"wal:%s, it is closed and kept"
,
pWal
->
name
);
}
}
pthread_mutex_destroy
(
&
pWal
->
mutex
);
walRelease
(
pWal
);
free
(
pWal
);
}
}
int
walRenew
(
void
*
handle
)
{
int
walRenew
(
void
*
handle
)
{
...
@@ -194,9 +227,9 @@ int walWrite(void *handle, SWalHead *pHead) {
...
@@ -194,9 +227,9 @@ int walWrite(void *handle, SWalHead *pHead) {
void
walFsync
(
void
*
handle
)
{
void
walFsync
(
void
*
handle
)
{
SWal
*
pWal
=
handle
;
SWal
*
pWal
=
handle
;
if
(
pWal
==
NULL
)
return
;
if
(
pWal
==
NULL
||
pWal
->
level
!=
TAOS_WAL_FSYNC
||
pWal
->
fd
<
0
)
return
;
if
(
pWal
->
level
==
TAOS_WAL_FSYNC
&&
pWal
->
fd
>=
0
)
{
if
(
pWal
->
fsyncPeriod
==
0
)
{
if
(
fsync
(
pWal
->
fd
)
<
0
)
{
if
(
fsync
(
pWal
->
fd
)
<
0
)
{
wError
(
"wal:%s, fsync failed(%s)"
,
pWal
->
name
,
strerror
(
errno
));
wError
(
"wal:%s, fsync failed(%s)"
,
pWal
->
name
,
strerror
(
errno
));
}
}
...
@@ -303,6 +336,20 @@ int walGetWalFile(void *handle, char *name, uint32_t *index) {
...
@@ -303,6 +336,20 @@ int walGetWalFile(void *handle, char *name, uint32_t *index) {
return
code
;
return
code
;
}
}
static
void
walRelease
(
SWal
*
pWal
)
{
pthread_mutex_destroy
(
&
pWal
->
mutex
);
pWal
->
signature
=
NULL
;
free
(
pWal
);
if
(
atomic_sub_fetch_32
(
&
tsWalNum
,
1
)
==
0
)
{
if
(
walTmrCtrl
)
taosTmrCleanUp
(
walTmrCtrl
);
walTmrCtrl
=
NULL
;
walModuleInit
=
PTHREAD_ONCE_INIT
;
wDebug
(
"WAL module is cleaned up"
);
}
}
static
int
walRestoreWalFile
(
SWal
*
pWal
,
void
*
pVnode
,
FWalWrite
writeFp
)
{
static
int
walRestoreWalFile
(
SWal
*
pWal
,
void
*
pVnode
,
FWalWrite
writeFp
)
{
char
*
name
=
pWal
->
name
;
char
*
name
=
pWal
->
name
;
...
@@ -433,3 +480,15 @@ static int walRemoveWalFiles(const char *path) {
...
@@ -433,3 +480,15 @@ static int walRemoveWalFiles(const char *path) {
return
terrno
;
return
terrno
;
}
}
static
void
walProcessFsyncTimer
(
void
*
param
,
void
*
tmrId
)
{
SWal
*
pWal
=
param
;
if
(
pWal
->
signature
!=
pWal
)
return
;
if
(
pWal
->
fd
<
0
)
return
;
if
(
fsync
(
pWal
->
fd
)
<
0
)
{
wError
(
"wal:%s, fsync failed(%s)"
,
pWal
->
name
,
strerror
(
errno
));
}
pWal
->
timer
=
taosTmrStart
(
walProcessFsyncTimer
,
pWal
->
fsyncPeriod
,
pWal
,
walTmrCtrl
);
}
tests/pytest/crash_gen.py
浏览文件 @
a3714edf
...
@@ -84,8 +84,17 @@ class WorkerThread:
...
@@ -84,8 +84,17 @@ class WorkerThread:
# Let us have a DB connection of our own
# Let us have a DB connection of our own
if
(
gConfig
.
per_thread_db_connection
):
# type: ignore
if
(
gConfig
.
per_thread_db_connection
):
# type: ignore
# print("connector_type = {}".format(gConfig.connector_type))
# print("connector_type = {}".format(gConfig.connector_type))
self
.
_dbConn
=
DbConn
.
createNative
()
if
(
if
gConfig
.
connector_type
==
'native'
:
gConfig
.
connector_type
==
'native'
)
else
DbConn
.
createRest
()
self
.
_dbConn
=
DbConn
.
createNative
()
elif
gConfig
.
connector_type
==
'rest'
:
self
.
_dbConn
=
DbConn
.
createRest
()
elif
gConfig
.
connector_type
==
'mixed'
:
if
Dice
.
throw
(
2
)
==
0
:
# 1/2 chance
self
.
_dbConn
=
DbConn
.
createNative
()
else
:
self
.
_dbConn
=
DbConn
.
createRest
()
else
:
raise
RuntimeError
(
"Unexpected connector type: {}"
.
format
(
gConfig
.
connector_type
))
self
.
_dbInUse
=
False
# if "use db" was executed already
self
.
_dbInUse
=
False
# if "use db" was executed already
...
@@ -130,22 +139,15 @@ class WorkerThread:
...
@@ -130,22 +139,15 @@ class WorkerThread:
while
True
:
while
True
:
tc
=
self
.
_tc
# Thread Coordinator, the overall master
tc
=
self
.
_tc
# Thread Coordinator, the overall master
tc
.
crossStepBarrier
()
# shared barrier first, INCLUDING the last one
tc
.
crossStepBarrier
()
# shared barrier first, INCLUDING the last one
logger
.
debug
(
logger
.
debug
(
"[TRD] Worker thread [{}] exited barrier..."
.
format
(
self
.
_tid
))
"[TRD] Worker thread [{}] exited barrier..."
.
format
(
self
.
_tid
))
self
.
crossStepGate
()
# then per-thread gate, after being tapped
self
.
crossStepGate
()
# then per-thread gate, after being tapped
logger
.
debug
(
logger
.
debug
(
"[TRD] Worker thread [{}] exited step gate..."
.
format
(
self
.
_tid
))
"[TRD] Worker thread [{}] exited step gate..."
.
format
(
self
.
_tid
))
if
not
self
.
_tc
.
isRunning
():
if
not
self
.
_tc
.
isRunning
():
logger
.
debug
(
logger
.
debug
(
"[TRD] Thread Coordinator not running any more, worker thread now stopping..."
)
"[TRD] Thread Coordinator not running any more, worker thread now stopping..."
)
break
break
# Fetch a task from the Thread Coordinator
# Fetch a task from the Thread Coordinator
logger
.
debug
(
logger
.
debug
(
"[TRD] Worker thread [{}] about to fetch task"
.
format
(
self
.
_tid
))
"[TRD] Worker thread [{}] about to fetch task"
.
format
(
self
.
_tid
))
task
=
tc
.
fetchTask
()
task
=
tc
.
fetchTask
()
# Execute such a task
# Execute such a task
...
@@ -154,9 +156,7 @@ class WorkerThread:
...
@@ -154,9 +156,7 @@ class WorkerThread:
self
.
_tid
,
task
.
__class__
.
__name__
))
self
.
_tid
,
task
.
__class__
.
__name__
))
task
.
execute
(
self
)
task
.
execute
(
self
)
tc
.
saveExecutedTask
(
task
)
tc
.
saveExecutedTask
(
task
)
logger
.
debug
(
logger
.
debug
(
"[TRD] Worker thread [{}] finished executing task"
.
format
(
self
.
_tid
))
"[TRD] Worker thread [{}] finished executing task"
.
format
(
self
.
_tid
))
self
.
_dbInUse
=
False
# there may be changes between steps
self
.
_dbInUse
=
False
# there may be changes between steps
...
@@ -255,101 +255,124 @@ class ThreadCoordinator:
...
@@ -255,101 +255,124 @@ class ThreadCoordinator:
self
.
_runStatus
=
MainExec
.
STATUS_STOPPING
self
.
_runStatus
=
MainExec
.
STATUS_STOPPING
self
.
_execStats
.
registerFailure
(
"User Interruption"
)
self
.
_execStats
.
registerFailure
(
"User Interruption"
)
def
_runShouldEnd
(
self
,
transitionFailed
,
hasAbortedTask
):
maxSteps
=
gConfig
.
max_steps
# type: ignore
if
self
.
_curStep
>=
(
maxSteps
-
1
):
# maxStep==10, last curStep should be 9
return
True
if
self
.
_runStatus
!=
MainExec
.
STATUS_RUNNING
:
return
True
if
transitionFailed
:
return
True
if
hasAbortedTask
:
return
True
return
False
def
_hasAbortedTask
(
self
):
# from execution of previous step
for
task
in
self
.
_executedTasks
:
if
task
.
isAborted
():
# print("Task aborted: {}".format(task))
# hasAbortedTask = True
return
True
return
False
def
_releaseAllWorkerThreads
(
self
,
transitionFailed
):
self
.
_curStep
+=
1
# we are about to get into next step. TODO: race condition here!
# Now not all threads had time to go to sleep
logger
.
debug
(
"--
\r\n\n
--> Step {} starts with main thread waking up"
.
format
(
self
.
_curStep
))
# A new TE for the new step
self
.
_te
=
None
# set to empty first, to signal worker thread to stop
if
not
transitionFailed
:
# only if not failed
self
.
_te
=
TaskExecutor
(
self
.
_curStep
)
logger
.
debug
(
"[TRD] Main thread waking up at step {}, tapping worker threads"
.
format
(
self
.
_curStep
))
# Now not all threads had time to go to sleep
# Worker threads will wake up at this point, and each execute it's own task
self
.
tapAllThreads
()
# release all worker thread from their "gate"
def
_syncAtBarrier
(
self
):
# Now main thread (that's us) is ready to enter a step
# let other threads go past the pool barrier, but wait at the
# thread gate
logger
.
debug
(
"[TRD] Main thread about to cross the barrier"
)
self
.
crossStepBarrier
()
self
.
_stepBarrier
.
reset
()
# Other worker threads should now be at the "gate"
logger
.
debug
(
"[TRD] Main thread finished crossing the barrier"
)
def
_doTransition
(
self
):
transitionFailed
=
False
try
:
sm
=
self
.
_dbManager
.
getStateMachine
()
logger
.
debug
(
"[STT] starting transitions"
)
# at end of step, transiton the DB state
sm
.
transition
(
self
.
_executedTasks
)
logger
.
debug
(
"[STT] transition ended"
)
# Due to limitation (or maybe not) of the Python library,
# we cannot share connections across threads
if
sm
.
hasDatabase
():
for
t
in
self
.
_pool
.
threadList
:
logger
.
debug
(
"[DB] use db for all worker threads"
)
t
.
useDb
()
# t.execSql("use db") # main thread executing "use
# db" on behalf of every worker thread
except
taos
.
error
.
ProgrammingError
as
err
:
if
(
err
.
msg
==
'network unavailable'
):
# broken DB connection
logger
.
info
(
"DB connection broken, execution failed"
)
traceback
.
print_stack
()
transitionFailed
=
True
self
.
_te
=
None
# Not running any more
self
.
_execStats
.
registerFailure
(
"Broken DB Connection"
)
# continue # don't do that, need to tap all threads at
# end, and maybe signal them to stop
else
:
raise
self
.
resetExecutedTasks
()
# clear the tasks after we are done
# Get ready for next step
logger
.
debug
(
"<-- Step {} finished, trasition failed = {}"
.
format
(
self
.
_curStep
,
transitionFailed
))
return
transitionFailed
def
run
(
self
):
def
run
(
self
):
self
.
_pool
.
createAndStartThreads
(
self
)
self
.
_pool
.
createAndStartThreads
(
self
)
# Coordinate all threads step by step
# Coordinate all threads step by step
self
.
_curStep
=
-
1
# not started yet
self
.
_curStep
=
-
1
# not started yet
maxSteps
=
gConfig
.
max_steps
# type: ignore
self
.
_execStats
.
startExec
()
# start the stop watch
self
.
_execStats
.
startExec
()
# start the stop watch
transitionFailed
=
False
transitionFailed
=
False
hasAbortedTask
=
False
hasAbortedTask
=
False
while
(
self
.
_curStep
<
maxSteps
-
1
and
while
not
self
.
_runShouldEnd
(
transitionFailed
,
hasAbortedTask
):
(
not
transitionFailed
)
and
if
not
gConfig
.
debug
:
# print this only if we are not in debug mode
(
self
.
_runStatus
==
MainExec
.
STATUS_RUNNING
)
and
(
not
hasAbortedTask
)):
# maxStep==10, last curStep should be 9
if
not
gConfig
.
debug
:
# print this only if we are not in debug mode
print
(
"."
,
end
=
""
,
flush
=
True
)
print
(
"."
,
end
=
""
,
flush
=
True
)
logger
.
debug
(
"[TRD] Main thread going to sleep"
)
self
.
_syncAtBarrier
()
# For now just cross the barrier
# Now main thread (that's us) is ready to enter a step
# let other threads go past the pool barrier, but wait at the
# thread gate
self
.
crossStepBarrier
()
self
.
_stepBarrier
.
reset
()
# Other worker threads should now be at the "gate"
# At this point, all threads should be pass the overall "barrier" and before the per-thread "gate"
# At this point, all threads should be pass the overall "barrier" and before the per-thread "gate"
# We use this period to do house keeping work, when all worker
# We use this period to do house keeping work, when all worker
# threads are QUIET.
# threads are QUIET.
hasAbortedTask
=
False
hasAbortedTask
=
self
.
_hasAbortedTask
()
# from previous step
for
task
in
self
.
_executedTasks
:
if
hasAbortedTask
:
if
task
.
isAborted
():
logger
.
info
(
"Aborted task encountered, exiting test program"
)
print
(
"Task aborted: {}"
.
format
(
task
))
hasAbortedTask
=
True
break
if
hasAbortedTask
:
# do transition only if tasks are error free
self
.
_execStats
.
registerFailure
(
"Aborted Task Encountered"
)
self
.
_execStats
.
registerFailure
(
"Aborted Task Encountered"
)
else
:
break
# do transition only if tasks are error free
try
:
sm
=
self
.
_dbManager
.
getStateMachine
()
logger
.
debug
(
"[STT] starting transitions"
)
# at end of step, transiton the DB state
sm
.
transition
(
self
.
_executedTasks
)
logger
.
debug
(
"[STT] transition ended"
)
# Due to limitation (or maybe not) of the Python library,
# we cannot share connections across threads
if
sm
.
hasDatabase
():
for
t
in
self
.
_pool
.
threadList
:
logger
.
debug
(
"[DB] use db for all worker threads"
)
t
.
useDb
()
# t.execSql("use db") # main thread executing "use
# db" on behalf of every worker thread
except
taos
.
error
.
ProgrammingError
as
err
:
if
(
err
.
msg
==
'network unavailable'
):
# broken DB connection
logger
.
info
(
"DB connection broken, execution failed"
)
traceback
.
print_stack
()
transitionFailed
=
True
self
.
_te
=
None
# Not running any more
self
.
_execStats
.
registerFailure
(
"Broken DB Connection"
)
# continue # don't do that, need to tap all threads at
# end, and maybe signal them to stop
else
:
raise
# finally:
# pass
self
.
resetExecutedTasks
()
# clear the tasks after we are done
# Ending previous step
transitionFailed
=
self
.
_doTransition
()
# To start, we end step -1 first
# Then we move on to the next step
self
.
_releaseAllWorkerThreads
(
transitionFailed
)
# Get ready for next step
if
hasAbortedTask
or
transitionFailed
:
# abnormal ending, workers waiting at "gate"
logger
.
debug
(
"<-- Step {} finished"
.
format
(
self
.
_curStep
))
logger
.
debug
(
"Abnormal ending of main thraed"
)
self
.
_curStep
+=
1
# we are about to get into next step. TODO: race condition here!
else
:
# regular ending, workers waiting at "barrier"
# Now not all threads had time to go to sleep
logger
.
debug
(
"Regular ending, main thread waiting for all worker threads to stop..."
)
logger
.
debug
(
self
.
_syncAtBarrier
()
"
\r\n\n
--> Step {} starts with main thread waking up"
.
format
(
self
.
_curStep
))
# A new TE for the new step
self
.
_te
=
None
# No more executor, time to end
if
not
transitionFailed
:
# only if not failed
logger
.
debug
(
"Main thread tapping all threads one last time..."
)
self
.
_te
=
TaskExecutor
(
self
.
_curStep
)
self
.
tapAllThreads
()
# Let the threads run one last time
logger
.
debug
(
"[TRD] Main thread waking up at step {}, tapping worker threads"
.
format
(
self
.
_curStep
))
# Now not all threads had time to go to sleep
# Worker threads will wake up at this point, and each execute it's
# own task
self
.
tapAllThreads
()
logger
.
debug
(
"Main thread ready to finish up..."
)
if
not
transitionFailed
:
# only in regular situations
self
.
crossStepBarrier
()
# Cross it one last time, after all threads finish
self
.
_stepBarrier
.
reset
()
logger
.
debug
(
"Main thread in exclusive zone..."
)
self
.
_te
=
None
# No more executor, time to end
logger
.
debug
(
"Main thread tapping all threads one last time..."
)
self
.
tapAllThreads
()
# Let the threads run one last time
logger
.
debug
(
"
\r\n\n
--> Main thread ready to finish up..."
)
logger
.
debug
(
"Main thread joining all threads"
)
logger
.
debug
(
"Main thread joining all threads"
)
self
.
_pool
.
joinAll
()
# Get all threads to finish
self
.
_pool
.
joinAll
()
# Get all threads to finish
logger
.
info
(
"
\n
All worker threads finished"
)
logger
.
info
(
"
\n
All worker threads finished"
)
...
@@ -514,7 +537,7 @@ class LinearQueue():
...
@@ -514,7 +537,7 @@ class LinearQueue():
class
DbConn
:
class
DbConn
:
TYPE_NATIVE
=
"native-c"
TYPE_NATIVE
=
"native-c"
TYPE_REST
=
"rest-api"
TYPE_REST
=
"rest-api"
TYPE_INVALID
=
"invalid"
TYPE_INVALID
=
"invalid"
@
classmethod
@
classmethod
...
@@ -620,9 +643,13 @@ class DbConnRest(DbConn):
...
@@ -620,9 +643,13 @@ class DbConnRest(DbConn):
self
.
isOpen
=
False
self
.
isOpen
=
False
def
_doSql
(
self
,
sql
):
def
_doSql
(
self
,
sql
):
r
=
requests
.
post
(
self
.
_url
,
try
:
data
=
sql
,
r
=
requests
.
post
(
self
.
_url
,
auth
=
HTTPBasicAuth
(
'root'
,
'taosdata'
))
data
=
sql
,
auth
=
HTTPBasicAuth
(
'root'
,
'taosdata'
))
except
:
print
(
"REST API Failure (TODO: more info here)"
)
raise
rj
=
r
.
json
()
rj
=
r
.
json
()
# Sanity check for the "Json Result"
# Sanity check for the "Json Result"
if
(
'status'
not
in
rj
):
if
(
'status'
not
in
rj
):
...
@@ -717,7 +744,7 @@ class MyTDSql:
...
@@ -717,7 +744,7 @@ class MyTDSql:
class
DbConnNative
(
DbConn
):
class
DbConnNative
(
DbConn
):
def
__init__
(
self
):
def
__init__
(
self
):
super
().
__init__
()
super
().
__init__
()
self
.
_type
=
self
.
TYPE_
REST
self
.
_type
=
self
.
TYPE_
NATIVE
self
.
_conn
=
None
self
.
_conn
=
None
self
.
_cursor
=
None
self
.
_cursor
=
None
...
@@ -2254,8 +2281,9 @@ class ClientManager:
...
@@ -2254,8 +2281,9 @@ class ClientManager:
def
sigIntHandler
(
self
,
signalNumber
,
frame
):
def
sigIntHandler
(
self
,
signalNumber
,
frame
):
if
self
.
_status
!=
MainExec
.
STATUS_RUNNING
:
if
self
.
_status
!=
MainExec
.
STATUS_RUNNING
:
print
(
"Ignoring repeated SIGINT..."
)
print
(
"Repeated SIGINT received, forced exit..."
)
return
# do nothing if it's already not running
# return # do nothing if it's already not running
sys
.
exit
(
-
1
)
self
.
_status
=
MainExec
.
STATUS_STOPPING
# immediately set our status
self
.
_status
=
MainExec
.
STATUS_STOPPING
# immediately set our status
print
(
"Terminating program..."
)
print
(
"Terminating program..."
)
...
@@ -2394,6 +2422,27 @@ def main():
...
@@ -2394,6 +2422,27 @@ def main():
'''
))
'''
))
# parser.add_argument('-a', '--auto-start-service', action='store_true',
# help='Automatically start/stop the TDengine service (default: false)')
# parser.add_argument('-c', '--connector-type', action='store', default='native', type=str,
# help='Connector type to use: native, rest, or mixed (default: 10)')
# parser.add_argument('-d', '--debug', action='store_true',
# help='Turn on DEBUG mode for more logging (default: false)')
# parser.add_argument('-e', '--run-tdengine', action='store_true',
# help='Run TDengine service in foreground (default: false)')
# parser.add_argument('-l', '--larger-data', action='store_true',
# help='Write larger amount of data during write operations (default: false)')
# parser.add_argument('-p', '--per-thread-db-connection', action='store_true',
# help='Use a single shared db connection (default: false)')
# parser.add_argument('-r', '--record-ops', action='store_true',
# help='Use a pair of always-fsynced fils to record operations performing + performed, for power-off tests (default: false)')
# parser.add_argument('-s', '--max-steps', action='store', default=1000, type=int,
# help='Maximum number of steps to run (default: 100)')
# parser.add_argument('-t', '--num-threads', action='store', default=5, type=int,
# help='Number of threads to run (default: 10)')
# parser.add_argument('-x', '--continue-on-exception', action='store_true',
# help='Continue execution after encountering unexpected/disallowed errors/exceptions (default: false)')
parser
.
add_argument
(
parser
.
add_argument
(
'-a'
,
'-a'
,
'--auto-start-service'
,
'--auto-start-service'
,
...
...
tests/pytest/util/dnodes-no-random-fail.py
0 → 100644
浏览文件 @
a3714edf
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
import
os
import
os.path
import
subprocess
from
util.log
import
*
class
TDSimClient
:
def
__init__
(
self
):
self
.
testCluster
=
False
self
.
cfgDict
=
{
"numOfLogLines"
:
"100000000"
,
"numOfThreadsPerCore"
:
"2.0"
,
"locale"
:
"en_US.UTF-8"
,
"charset"
:
"UTF-8"
,
"asyncLog"
:
"0"
,
"anyIp"
:
"0"
,
"sdbDebugFlag"
:
"135"
,
"rpcDebugFlag"
:
"135"
,
"tmrDebugFlag"
:
"131"
,
"cDebugFlag"
:
"135"
,
"udebugFlag"
:
"135"
,
"jnidebugFlag"
:
"135"
,
"qdebugFlag"
:
"135"
,
}
def
init
(
self
,
path
):
self
.
__init__
()
self
.
path
=
path
def
getLogDir
(
self
):
self
.
logDir
=
"%s/sim/psim/log"
%
(
self
.
path
)
return
self
.
logDir
def
getCfgDir
(
self
):
self
.
cfgDir
=
"%s/sim/psim/cfg"
%
(
self
.
path
)
return
self
.
cfgDir
def
setTestCluster
(
self
,
value
):
self
.
testCluster
=
value
def
addExtraCfg
(
self
,
option
,
value
):
self
.
cfgDict
.
update
({
option
:
value
})
def
cfg
(
self
,
option
,
value
):
cmd
=
"echo '%s %s' >> %s"
%
(
option
,
value
,
self
.
cfgPath
)
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
def
deploy
(
self
):
self
.
logDir
=
"%s/sim/psim/log"
%
(
self
.
path
)
self
.
cfgDir
=
"%s/sim/psim/cfg"
%
(
self
.
path
)
self
.
cfgPath
=
"%s/sim/psim/cfg/taos.cfg"
%
(
self
.
path
)
cmd
=
"rm -rf "
+
self
.
logDir
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
cmd
=
"mkdir -p "
+
self
.
logDir
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
cmd
=
"rm -rf "
+
self
.
cfgDir
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
cmd
=
"mkdir -p "
+
self
.
cfgDir
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
cmd
=
"touch "
+
self
.
cfgPath
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
if
self
.
testCluster
:
self
.
cfg
(
"masterIp"
,
"192.168.0.1"
)
self
.
cfg
(
"secondIp"
,
"192.168.0.2"
)
self
.
cfg
(
"logDir"
,
self
.
logDir
)
for
key
,
value
in
self
.
cfgDict
.
items
():
self
.
cfg
(
key
,
value
)
tdLog
.
debug
(
"psim is deployed and configured by %s"
%
(
self
.
cfgPath
))
class
TDDnode
:
def
__init__
(
self
,
index
):
self
.
index
=
index
self
.
running
=
0
self
.
deployed
=
0
self
.
testCluster
=
False
self
.
valgrind
=
0
def
init
(
self
,
path
):
self
.
path
=
path
def
setTestCluster
(
self
,
value
):
self
.
testCluster
=
value
def
setValgrind
(
self
,
value
):
self
.
valgrind
=
value
def
getDataSize
(
self
):
totalSize
=
0
if
(
self
.
deployed
==
1
):
for
dirpath
,
dirnames
,
filenames
in
os
.
walk
(
self
.
dataDir
):
for
f
in
filenames
:
fp
=
os
.
path
.
join
(
dirpath
,
f
)
if
not
os
.
path
.
islink
(
fp
):
totalSize
=
totalSize
+
os
.
path
.
getsize
(
fp
)
return
totalSize
def
deploy
(
self
):
self
.
logDir
=
"%s/sim/dnode%d/log"
%
(
self
.
path
,
self
.
index
)
self
.
dataDir
=
"%s/sim/dnode%d/data"
%
(
self
.
path
,
self
.
index
)
self
.
cfgDir
=
"%s/sim/dnode%d/cfg"
%
(
self
.
path
,
self
.
index
)
self
.
cfgPath
=
"%s/sim/dnode%d/cfg/taos.cfg"
%
(
self
.
path
,
self
.
index
)
cmd
=
"rm -rf "
+
self
.
dataDir
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
cmd
=
"rm -rf "
+
self
.
logDir
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
cmd
=
"rm -rf "
+
self
.
cfgDir
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
cmd
=
"mkdir -p "
+
self
.
dataDir
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
cmd
=
"mkdir -p "
+
self
.
logDir
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
cmd
=
"mkdir -p "
+
self
.
cfgDir
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
cmd
=
"touch "
+
self
.
cfgPath
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
if
self
.
testCluster
:
self
.
startIP
()
if
self
.
testCluster
:
self
.
cfg
(
"masterIp"
,
"192.168.0.1"
)
self
.
cfg
(
"secondIp"
,
"192.168.0.2"
)
self
.
cfg
(
"publicIp"
,
"192.168.0.%d"
%
(
self
.
index
))
self
.
cfg
(
"internalIp"
,
"192.168.0.%d"
%
(
self
.
index
))
self
.
cfg
(
"privateIp"
,
"192.168.0.%d"
%
(
self
.
index
))
self
.
cfg
(
"dataDir"
,
self
.
dataDir
)
self
.
cfg
(
"logDir"
,
self
.
logDir
)
self
.
cfg
(
"numOfLogLines"
,
"100000000"
)
self
.
cfg
(
"mnodeEqualVnodeNum"
,
"0"
)
self
.
cfg
(
"walLevel"
,
"1"
)
self
.
cfg
(
"statusInterval"
,
"1"
)
self
.
cfg
(
"numOfTotalVnodes"
,
"64"
)
self
.
cfg
(
"numOfMnodes"
,
"3"
)
self
.
cfg
(
"numOfThreadsPerCore"
,
"2.0"
)
self
.
cfg
(
"monitor"
,
"0"
)
self
.
cfg
(
"maxVnodeConnections"
,
"30000"
)
self
.
cfg
(
"maxMgmtConnections"
,
"30000"
)
self
.
cfg
(
"maxMeterConnections"
,
"30000"
)
self
.
cfg
(
"maxShellConns"
,
"30000"
)
self
.
cfg
(
"locale"
,
"en_US.UTF-8"
)
self
.
cfg
(
"charset"
,
"UTF-8"
)
self
.
cfg
(
"asyncLog"
,
"0"
)
self
.
cfg
(
"anyIp"
,
"0"
)
self
.
cfg
(
"dDebugFlag"
,
"135"
)
self
.
cfg
(
"mDebugFlag"
,
"135"
)
self
.
cfg
(
"sdbDebugFlag"
,
"135"
)
self
.
cfg
(
"rpcDebugFlag"
,
"135"
)
self
.
cfg
(
"tmrDebugFlag"
,
"131"
)
self
.
cfg
(
"cDebugFlag"
,
"135"
)
self
.
cfg
(
"httpDebugFlag"
,
"135"
)
self
.
cfg
(
"monitorDebugFlag"
,
"135"
)
self
.
cfg
(
"udebugFlag"
,
"135"
)
self
.
cfg
(
"jnidebugFlag"
,
"135"
)
self
.
cfg
(
"qdebugFlag"
,
"135"
)
self
.
deployed
=
1
tdLog
.
debug
(
"dnode:%d is deployed and configured by %s"
%
(
self
.
index
,
self
.
cfgPath
))
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
return
buildPath
def
start
(
self
):
buildPath
=
self
.
getBuildPath
()
if
(
buildPath
==
""
):
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/taosd"
if
self
.
deployed
==
0
:
tdLog
.
exit
(
"dnode:%d is not deployed"
%
(
self
.
index
))
if
self
.
valgrind
==
0
:
cmd
=
"nohup %s -c %s --random-file-fail-factor 0 > /dev/null 2>&1 & "
%
(
binPath
,
self
.
cfgDir
)
else
:
valgrindCmdline
=
"valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes"
cmd
=
"nohup %s %s -c %s 2>&1 & "
%
(
valgrindCmdline
,
binPath
,
self
.
cfgDir
)
print
(
cmd
)
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
self
.
running
=
1
tdLog
.
debug
(
"dnode:%d is running with %s "
%
(
self
.
index
,
cmd
))
tdLog
.
debug
(
"wait 5 seconds for the dnode:%d to start."
%
(
self
.
index
))
time
.
sleep
(
5
)
def
stop
(
self
):
if
self
.
valgrind
==
0
:
toBeKilled
=
"taosd"
else
:
toBeKilled
=
"valgrind.bin"
if
self
.
running
!=
0
:
psCmd
=
"ps -ef|grep -w %s| grep -v grep | awk '{print $2}'"
%
toBeKilled
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
).
decode
(
"utf-8"
)
while
(
processID
):
killCmd
=
"kill -INT %s > /dev/null 2>&1"
%
processID
os
.
system
(
killCmd
)
time
.
sleep
(
1
)
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
).
decode
(
"utf-8"
)
for
port
in
range
(
6030
,
6041
):
fuserCmd
=
"fuser -k -n tcp %d"
%
port
os
.
system
(
fuserCmd
)
if
self
.
valgrind
:
time
.
sleep
(
2
)
self
.
running
=
0
tdLog
.
debug
(
"dnode:%d is stopped by kill -INT"
%
(
self
.
index
))
def
forcestop
(
self
):
if
self
.
valgrind
==
0
:
toBeKilled
=
"taosd"
else
:
toBeKilled
=
"valgrind.bin"
if
self
.
running
!=
0
:
psCmd
=
"ps -ef|grep -w %s| grep -v grep | awk '{print $2}'"
%
toBeKilled
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
).
decode
(
"utf-8"
)
while
(
processID
):
killCmd
=
"kill -KILL %s > /dev/null 2>&1"
%
processID
os
.
system
(
killCmd
)
time
.
sleep
(
1
)
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
).
decode
(
"utf-8"
)
for
port
in
range
(
6030
,
6041
):
fuserCmd
=
"fuser -k -n tcp %d"
%
port
os
.
system
(
fuserCmd
)
if
self
.
valgrind
:
time
.
sleep
(
2
)
self
.
running
=
0
tdLog
.
debug
(
"dnode:%d is stopped by kill -KILL"
%
(
self
.
index
))
def
startIP
(
self
):
cmd
=
"sudo ifconfig lo:%d 192.168.0.%d up"
%
(
self
.
index
,
self
.
index
)
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
def
stopIP
(
self
):
cmd
=
"sudo ifconfig lo:%d 192.168.0.%d down"
%
(
self
.
index
,
self
.
index
)
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
def
cfg
(
self
,
option
,
value
):
cmd
=
"echo '%s %s' >> %s"
%
(
option
,
value
,
self
.
cfgPath
)
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
def
getDnodeRootDir
(
self
,
index
):
dnodeRootDir
=
"%s/sim/psim/dnode%d"
%
(
self
.
path
,
index
)
return
dnodeRootDir
def
getDnodesRootDir
(
self
):
dnodesRootDir
=
"%s/sim/psim"
%
(
self
.
path
)
return
dnodesRootDir
class
TDDnodes
:
def
__init__
(
self
):
self
.
dnodes
=
[]
self
.
dnodes
.
append
(
TDDnode
(
1
))
self
.
dnodes
.
append
(
TDDnode
(
2
))
self
.
dnodes
.
append
(
TDDnode
(
3
))
self
.
dnodes
.
append
(
TDDnode
(
4
))
self
.
dnodes
.
append
(
TDDnode
(
5
))
self
.
dnodes
.
append
(
TDDnode
(
6
))
self
.
dnodes
.
append
(
TDDnode
(
7
))
self
.
dnodes
.
append
(
TDDnode
(
8
))
self
.
dnodes
.
append
(
TDDnode
(
9
))
self
.
dnodes
.
append
(
TDDnode
(
10
))
self
.
simDeployed
=
False
def
init
(
self
,
path
):
psCmd
=
"ps -ef|grep -w taosd| grep -v grep | awk '{print $2}'"
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
).
decode
(
"utf-8"
)
while
(
processID
):
killCmd
=
"kill -KILL %s > /dev/null 2>&1"
%
processID
os
.
system
(
killCmd
)
time
.
sleep
(
1
)
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
).
decode
(
"utf-8"
)
psCmd
=
"ps -ef|grep -w valgrind.bin| grep -v grep | awk '{print $2}'"
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
).
decode
(
"utf-8"
)
while
(
processID
):
killCmd
=
"kill -KILL %s > /dev/null 2>&1"
%
processID
os
.
system
(
killCmd
)
time
.
sleep
(
1
)
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
).
decode
(
"utf-8"
)
binPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
binPath
=
binPath
+
"/../../../debug/"
tdLog
.
debug
(
"binPath %s"
%
(
binPath
))
binPath
=
os
.
path
.
realpath
(
binPath
)
tdLog
.
debug
(
"binPath real path %s"
%
(
binPath
))
# cmd = "sudo cp %s/build/lib/libtaos.so /usr/local/lib/taos/" % (binPath)
# tdLog.debug(cmd)
# os.system(cmd)
# cmd = "sudo cp %s/build/bin/taos /usr/local/bin/taos/" % (binPath)
# if os.system(cmd) != 0 :
# tdLog.exit(cmd)
# tdLog.debug("execute %s" % (cmd))
# cmd = "sudo cp %s/build/bin/taosd /usr/local/bin/taos/" % (binPath)
# if os.system(cmd) != 0 :
# tdLog.exit(cmd)
# tdLog.debug("execute %s" % (cmd))
if
path
==
""
:
# self.path = os.path.expanduser('~')
self
.
path
=
os
.
path
.
abspath
(
binPath
+
"../../"
)
else
:
self
.
path
=
os
.
path
.
realpath
(
path
)
for
i
in
range
(
len
(
self
.
dnodes
)):
self
.
dnodes
[
i
].
init
(
self
.
path
)
self
.
sim
=
TDSimClient
()
self
.
sim
.
init
(
self
.
path
)
def
setTestCluster
(
self
,
value
):
self
.
testCluster
=
value
def
setValgrind
(
self
,
value
):
self
.
valgrind
=
value
def
deploy
(
self
,
index
):
self
.
sim
.
setTestCluster
(
self
.
testCluster
)
if
(
self
.
simDeployed
==
False
):
self
.
sim
.
deploy
()
self
.
simDeployed
=
True
self
.
check
(
index
)
self
.
dnodes
[
index
-
1
].
setTestCluster
(
self
.
testCluster
)
self
.
dnodes
[
index
-
1
].
setValgrind
(
self
.
valgrind
)
self
.
dnodes
[
index
-
1
].
deploy
()
def
cfg
(
self
,
index
,
option
,
value
):
self
.
check
(
index
)
self
.
dnodes
[
index
-
1
].
cfg
(
option
,
value
)
def
start
(
self
,
index
):
self
.
check
(
index
)
self
.
dnodes
[
index
-
1
].
start
()
def
stop
(
self
,
index
):
self
.
check
(
index
)
self
.
dnodes
[
index
-
1
].
stop
()
def
getDataSize
(
self
,
index
):
self
.
check
(
index
)
return
self
.
dnodes
[
index
-
1
].
getDataSize
()
def
forcestop
(
self
,
index
):
self
.
check
(
index
)
self
.
dnodes
[
index
-
1
].
forcestop
()
def
startIP
(
self
,
index
):
self
.
check
(
index
)
if
self
.
testCluster
:
self
.
dnodes
[
index
-
1
].
startIP
()
def
stopIP
(
self
,
index
):
self
.
check
(
index
)
if
self
.
dnodes
[
index
-
1
].
testCluster
:
self
.
dnodes
[
index
-
1
].
stopIP
()
def
check
(
self
,
index
):
if
index
<
1
or
index
>
10
:
tdLog
.
exit
(
"index:%d should on a scale of [1, 10]"
%
(
index
))
def
stopAll
(
self
):
tdLog
.
info
(
"stop all dnodes"
)
for
i
in
range
(
len
(
self
.
dnodes
)):
self
.
dnodes
[
i
].
stop
()
psCmd
=
"ps -ef | grep -w taosd | grep 'root' | grep -v grep | awk '{print $2}'"
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
).
decode
(
"utf-8"
)
if
processID
:
cmd
=
"sudo systemctl stop taosd"
os
.
system
(
cmd
)
# if os.system(cmd) != 0 :
# tdLog.exit(cmd)
psCmd
=
"ps -ef|grep -w taosd| grep -v grep | awk '{print $2}'"
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
).
decode
(
"utf-8"
)
while
(
processID
):
killCmd
=
"kill -KILL %s > /dev/null 2>&1"
%
processID
os
.
system
(
killCmd
)
time
.
sleep
(
1
)
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
).
decode
(
"utf-8"
)
psCmd
=
"ps -ef|grep -w valgrind.bin| grep -v grep | awk '{print $2}'"
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
).
decode
(
"utf-8"
)
while
(
processID
):
killCmd
=
"kill -KILL %s > /dev/null 2>&1"
%
processID
os
.
system
(
killCmd
)
time
.
sleep
(
1
)
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
).
decode
(
"utf-8"
)
# if os.system(cmd) != 0 :
# tdLog.exit(cmd)
def
getDnodesRootDir
(
self
):
dnodesRootDir
=
"%s/sim"
%
(
self
.
path
)
return
dnodesRootDir
def
getSimCfgPath
(
self
):
return
self
.
sim
.
getCfgDir
()
def
getSimLogPath
(
self
):
return
self
.
sim
.
getLogDir
()
def
addSimExtraCfg
(
self
,
option
,
value
):
self
.
sim
.
addExtraCfg
(
option
,
value
)
tdDnodes
=
TDDnodes
()
tests/pytest/util/dnodes-random-fail.py
浏览文件 @
a3714edf
...
@@ -235,12 +235,12 @@ class TDDnode:
...
@@ -235,12 +235,12 @@ class TDDnode:
tdLog
.
exit
(
"dnode:%d is not deployed"
%
(
self
.
index
))
tdLog
.
exit
(
"dnode:%d is not deployed"
%
(
self
.
index
))
if
self
.
valgrind
==
0
:
if
self
.
valgrind
==
0
:
cmd
=
"nohup %s -c %s > /dev/null 2>&1 & "
%
(
cmd
=
"nohup %s -c %s
--alloc-random-fail --random-file-fail-factor 5
> /dev/null 2>&1 & "
%
(
binPath
,
self
.
cfgDir
)
binPath
,
self
.
cfgDir
)
else
:
else
:
valgrindCmdline
=
"valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes"
valgrindCmdline
=
"valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes"
cmd
=
"nohup %s %s -c %s
--random-file-fail-factor 5
2>&1 & "
%
(
cmd
=
"nohup %s %s -c %s 2>&1 & "
%
(
valgrindCmdline
,
binPath
,
self
.
cfgDir
)
valgrindCmdline
,
binPath
,
self
.
cfgDir
)
print
(
cmd
)
print
(
cmd
)
...
...
tests/script/sh/deploy.sh
浏览文件 @
a3714edf
...
@@ -111,29 +111,29 @@ echo "serverPort ${NODE}" >> $TAOS_CFG
...
@@ -111,29 +111,29 @@ echo "serverPort ${NODE}" >> $TAOS_CFG
echo
"dataDir
$DATA_DIR
"
>>
$TAOS_CFG
echo
"dataDir
$DATA_DIR
"
>>
$TAOS_CFG
echo
"logDir
$LOG_DIR
"
>>
$TAOS_CFG
echo
"logDir
$LOG_DIR
"
>>
$TAOS_CFG
echo
"debugFlag 131"
>>
$TAOS_CFG
echo
"debugFlag 131"
>>
$TAOS_CFG
echo
"mDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"mDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"sdbDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"sdbDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"dDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"dDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"vDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"vDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"tsdbDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"tsdbDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"cDebugFlag 135"
>>
$TAOS_CFG
echo
"cDebugFlag 135"
>>
$TAOS_CFG
echo
"jnidebugFlag 13
5
"
>>
$TAOS_CFG
echo
"jnidebugFlag 13
1
"
>>
$TAOS_CFG
echo
"odbcdebugFlag 13
5
"
>>
$TAOS_CFG
echo
"odbcdebugFlag 13
1
"
>>
$TAOS_CFG
echo
"httpDebugFlag 1
35
"
>>
$TAOS_CFG
echo
"httpDebugFlag 1
43
"
>>
$TAOS_CFG
echo
"monitorDebugFlag 131"
>>
$TAOS_CFG
echo
"monitorDebugFlag 131"
>>
$TAOS_CFG
echo
"mqttDebugFlag 131"
>>
$TAOS_CFG
echo
"mqttDebugFlag 131"
>>
$TAOS_CFG
echo
"qdebugFlag 13
5
"
>>
$TAOS_CFG
echo
"qdebugFlag 13
1
"
>>
$TAOS_CFG
echo
"rpcDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"rpcDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"tmrDebugFlag 131"
>>
$TAOS_CFG
echo
"tmrDebugFlag 131"
>>
$TAOS_CFG
echo
"udebugFlag 13
5
"
>>
$TAOS_CFG
echo
"udebugFlag 13
1
"
>>
$TAOS_CFG
echo
"sdebugFlag 13
5
"
>>
$TAOS_CFG
echo
"sdebugFlag 13
1
"
>>
$TAOS_CFG
echo
"wdebugFlag 13
5
"
>>
$TAOS_CFG
echo
"wdebugFlag 13
1
"
>>
$TAOS_CFG
echo
"monitor 0"
>>
$TAOS_CFG
echo
"monitor 0"
>>
$TAOS_CFG
echo
"monitorInterval 1"
>>
$TAOS_CFG
echo
"monitorInterval 1"
>>
$TAOS_CFG
echo
"http 0"
>>
$TAOS_CFG
echo
"http 0"
>>
$TAOS_CFG
echo
"numOfThreadsPerCore 2.0"
>>
$TAOS_CFG
echo
"numOfThreadsPerCore 2.0"
>>
$TAOS_CFG
echo
"defaultPass taosdata"
>>
$TAOS_CFG
echo
"defaultPass taosdata"
>>
$TAOS_CFG
echo
"numOfLogLines
1
0000000"
>>
$TAOS_CFG
echo
"numOfLogLines
2
0000000"
>>
$TAOS_CFG
echo
"mnodeEqualVnodeNum 0"
>>
$TAOS_CFG
echo
"mnodeEqualVnodeNum 0"
>>
$TAOS_CFG
echo
"clog 2"
>>
$TAOS_CFG
echo
"clog 2"
>>
$TAOS_CFG
echo
"statusInterval 1"
>>
$TAOS_CFG
echo
"statusInterval 1"
>>
$TAOS_CFG
...
@@ -145,6 +145,6 @@ echo "tableIncStepPerVnode 10000" >> $TAOS_CFG
...
@@ -145,6 +145,6 @@ echo "tableIncStepPerVnode 10000" >> $TAOS_CFG
echo
"asyncLog 0"
>>
$TAOS_CFG
echo
"asyncLog 0"
>>
$TAOS_CFG
echo
"numOfMnodes 1"
>>
$TAOS_CFG
echo
"numOfMnodes 1"
>>
$TAOS_CFG
echo
"locale en_US.UTF-8"
>>
$TAOS_CFG
echo
"locale en_US.UTF-8"
>>
$TAOS_CFG
echo
"
anyIp
0"
>>
$TAOS_CFG
echo
"
fsync
0"
>>
$TAOS_CFG
tests/script/sh/exec-no-random-fail.sh
0 → 100755
浏览文件 @
a3714edf
#!/bin/bash
# if [ $# != 4 || $# != 5 ]; then
# echo "argument list need input : "
# echo " -n nodeName"
# echo " -s start/stop"
# echo " -c clear"
# exit 1
# fi
NODE_NAME
=
EXEC_OPTON
=
CLEAR_OPTION
=
"false"
while
getopts
"n:s:u:x:ct"
arg
do
case
$arg
in
n
)
NODE_NAME
=
$OPTARG
;;
s
)
EXEC_OPTON
=
$OPTARG
;;
c
)
CLEAR_OPTION
=
"clear"
;;
t
)
SHELL_OPTION
=
"true"
;;
u
)
USERS
=
$OPTARG
;;
x
)
SIGNAL
=
$OPTARG
;;
?
)
echo
"unkown argument"
;;
esac
done
SCRIPT_DIR
=
`
dirname
$0
`
cd
$SCRIPT_DIR
/../
SCRIPT_DIR
=
`
pwd
`
IN_TDINTERNAL
=
"community"
if
[[
"
$SCRIPT_DIR
"
==
*
"
$IN_TDINTERNAL
"
*
]]
;
then
cd
../../..
else
cd
../../
fi
TAOS_DIR
=
`
pwd
`
TAOSD_DIR
=
`
find
.
-name
"taosd"
|grep bin|head
-n1
`
if
[[
"
$TAOSD_DIR
"
==
*
"
$IN_TDINTERNAL
"
*
]]
;
then
BIN_DIR
=
`
find
.
-name
"taosd"
|grep bin|head
-n1
|cut
-d
'/'
--fields
=
2,3
`
else
BIN_DIR
=
`
find
.
-name
"taosd"
|grep bin|head
-n1
|cut
-d
'/'
--fields
=
2
`
fi
BUILD_DIR
=
$TAOS_DIR
/
$BIN_DIR
/build
SIM_DIR
=
$TAOS_DIR
/sim
NODE_DIR
=
$SIM_DIR
/
$NODE_NAME
EXE_DIR
=
$BUILD_DIR
/bin
CFG_DIR
=
$NODE_DIR
/cfg
LOG_DIR
=
$NODE_DIR
/log
DATA_DIR
=
$NODE_DIR
/data
MGMT_DIR
=
$NODE_DIR
/data/mgmt
TSDB_DIR
=
$NODE_DIR
/data/tsdb
TAOS_CFG
=
$NODE_DIR
/cfg/taos.cfg
echo
------------
$EXEC_OPTON
$NODE_NAME
TAOS_FLAG
=
$SIM_DIR
/tsim/flag
if
[
-f
"
$TAOS_FLAG
"
]
;
then
EXE_DIR
=
/usr/local/bin/taos
fi
if
[
"
$CLEAR_OPTION
"
=
"clear"
]
;
then
echo rm
-rf
$MGMT_DIR
$TSDB_DIR
rm
-rf
$TSDB_DIR
rm
-rf
$MGMT_DIR
fi
if
[
"
$EXEC_OPTON
"
=
"start"
]
;
then
echo
"ExcuteCmd:"
$EXE_DIR
/taosd
-c
$CFG_DIR
if
[
"
$SHELL_OPTION
"
=
"true"
]
;
then
nohup
valgrind
--log-file
=
${
LOG_DIR
}
/valgrind.log
--tool
=
memcheck
--leak-check
=
full
--show-reachable
=
no
--track-origins
=
yes
--show-leak-kinds
=
all
-v
--workaround-gcc296-bugs
=
yes
$EXE_DIR
/taosd
-c
$CFG_DIR
>
/dev/null 2>&1 &
else
nohup
$EXE_DIR
/taosd
-c
$CFG_DIR
--random-file-fail-factor
0
>
/dev/null 2>&1 &
fi
else
#relative path
RCFG_DIR
=
sim/
$NODE_NAME
/cfg
PID
=
`
ps
-ef
|grep taosd |
grep
$RCFG_DIR
|
grep
-v
grep
|
awk
'{print $2}'
`
while
[
-n
"
$PID
"
]
do
if
[
"
$SIGNAL
"
=
"SIGINT"
]
;
then
echo
try to
kill
by signal SIGINT
kill
-SIGINT
$PID
else
echo
try to
kill
by signal SIGKILL
kill
-9
$PID
fi
sleep
1
PID
=
`
ps
-ef
|grep taosd |
grep
$RCFG_DIR
|
grep
-v
grep
|
awk
'{print $2}'
`
done
fi
tests/script/sh/exec-random-fail.sh
浏览文件 @
a3714edf
...
@@ -90,7 +90,7 @@ if [ "$EXEC_OPTON" = "start" ]; then
...
@@ -90,7 +90,7 @@ if [ "$EXEC_OPTON" = "start" ]; then
if
[
"
$SHELL_OPTION
"
=
"true"
]
;
then
if
[
"
$SHELL_OPTION
"
=
"true"
]
;
then
nohup
valgrind
--log-file
=
${
LOG_DIR
}
/valgrind.log
--tool
=
memcheck
--leak-check
=
full
--show-reachable
=
no
--track-origins
=
yes
--show-leak-kinds
=
all
-v
--workaround-gcc296-bugs
=
yes
$EXE_DIR
/taosd
-c
$CFG_DIR
>
/dev/null 2>&1 &
nohup
valgrind
--log-file
=
${
LOG_DIR
}
/valgrind.log
--tool
=
memcheck
--leak-check
=
full
--show-reachable
=
no
--track-origins
=
yes
--show-leak-kinds
=
all
-v
--workaround-gcc296-bugs
=
yes
$EXE_DIR
/taosd
-c
$CFG_DIR
>
/dev/null 2>&1 &
else
else
nohup
$EXE_DIR
/taosd
-c
$CFG_DIR
--random-file-fail-factor
5
>
/dev/null 2>&1 &
nohup
$EXE_DIR
/taosd
-c
$CFG_DIR
--
alloc-random-fail
--
random-file-fail-factor
5
>
/dev/null 2>&1 &
fi
fi
else
else
...
...
tests/script/tmp/mnodes.sim
浏览文件 @
a3714edf
...
@@ -52,9 +52,9 @@ system sh/cfg.sh -n dnode1 -c qdebugFlag -v 131
...
@@ -52,9 +52,9 @@ system sh/cfg.sh -n dnode1 -c qdebugFlag -v 131
system sh/cfg.sh -n dnode2 -c qdebugFlag -v 131
system sh/cfg.sh -n dnode2 -c qdebugFlag -v 131
system sh/cfg.sh -n dnode3 -c qdebugFlag -v 131
system sh/cfg.sh -n dnode3 -c qdebugFlag -v 131
system sh/cfg.sh -n dnode1 -c cDebugFlag -v 13
1
system sh/cfg.sh -n dnode1 -c cDebugFlag -v 13
5
system sh/cfg.sh -n dnode2 -c cDebugFlag -v 13
1
system sh/cfg.sh -n dnode2 -c cDebugFlag -v 13
5
system sh/cfg.sh -n dnode3 -c cDebugFlag -v 13
1
system sh/cfg.sh -n dnode3 -c cDebugFlag -v 13
5
system sh/cfg.sh -n dnode1 -c udebugFlag -v 131
system sh/cfg.sh -n dnode1 -c udebugFlag -v 131
system sh/cfg.sh -n dnode2 -c udebugFlag -v 131
system sh/cfg.sh -n dnode2 -c udebugFlag -v 131
...
@@ -64,6 +64,10 @@ system sh/cfg.sh -n dnode1 -c wdebugFlag -v 131
...
@@ -64,6 +64,10 @@ system sh/cfg.sh -n dnode1 -c wdebugFlag -v 131
system sh/cfg.sh -n dnode2 -c wdebugFlag -v 131
system sh/cfg.sh -n dnode2 -c wdebugFlag -v 131
system sh/cfg.sh -n dnode3 -c wdebugFlag -v 131
system sh/cfg.sh -n dnode3 -c wdebugFlag -v 131
system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 1000000
system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 1000000
system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 1000000
print ============== deploy
print ============== deploy
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode1 -s start
...
...
tests/test/c/createTablePerformance.c
浏览文件 @
a3714edf
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "os.h"
#include "os.h"
#include "taoserror.h"
#include "taos.h"
#include "taos.h"
#include "tulog.h"
#include "tulog.h"
#include "ttime.h"
#include "ttime.h"
...
@@ -154,7 +155,7 @@ void *threadFunc(void *param) {
...
@@ -154,7 +155,7 @@ void *threadFunc(void *param) {
TAOS_RES
*
pSql
=
taos_query
(
con
,
qstr
);
TAOS_RES
*
pSql
=
taos_query
(
con
,
qstr
);
code
=
taos_errno
(
pSql
);
code
=
taos_errno
(
pSql
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
pError
(
"failed to create table %s%d, reason:%s"
,
stableName
,
t
,
t
aos_errstr
(
con
));
pError
(
"failed to create table %s%d, reason:%s"
,
stableName
,
t
,
t
strerror
(
code
));
}
}
taos_free_result
(
pSql
);
taos_free_result
(
pSql
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录