Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c0c94fe7
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
“c2e91fcb7517d79257e7185e56a763f3f10c8024”上不存在“source/libs/planner/inc/plannerUtil.h”
提交
c0c94fe7
编写于
2月 15, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-11818] merge 3.0
上级
d64d6890
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
216 addition
and
0 deletion
+216
-0
source/dnode/vnode/src/inc/tqInt.h
source/dnode/vnode/src/inc/tqInt.h
+216
-0
未找到文件。
source/dnode/vnode/src/inc/tqInt.h
0 → 100644
浏览文件 @
c0c94fe7
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_TQ_INT_H_
#define _TD_TQ_INT_H_
#include "meta.h"
#include "tlog.h"
#include "tq.h"
#include "trpc.h"
#ifdef __cplusplus
extern
"C"
{
#endif
extern
int32_t
tqDebugFlag
;
#define tqFatal(...) \
{ \
if (tqDebugFlag & DEBUG_FATAL) { \
taosPrintLog("TQ FATAL ", 255, __VA_ARGS__); \
} \
}
#define tqError(...) \
{ \
if (tqDebugFlag & DEBUG_ERROR) { \
taosPrintLog("TQ ERROR ", 255, __VA_ARGS__); \
} \
}
#define tqWarn(...) \
{ \
if (tqDebugFlag & DEBUG_WARN) { \
taosPrintLog("TQ WARN ", 255, __VA_ARGS__); \
} \
}
#define tqInfo(...) \
{ \
if (tqDebugFlag & DEBUG_INFO) { \
taosPrintLog("TQ ", 255, __VA_ARGS__); \
} \
}
#define tqDebug(...) \
{ \
if (tqDebugFlag & DEBUG_DEBUG) { \
taosPrintLog("TQ ", tqDebugFlag, __VA_ARGS__); \
} \
}
#define tqTrace(...) \
{ \
if (tqDebugFlag & DEBUG_TRACE) { \
taosPrintLog("TQ ", tqDebugFlag, __VA_ARGS__); \
} \
}
#define TQ_BUFFER_SIZE 8
#define TQ_BUCKET_MASK 0xFF
#define TQ_BUCKET_SIZE 256
#define TQ_PAGE_SIZE 4096
// key + offset + size
#define TQ_IDX_SIZE 24
// 4096 / 24
#define TQ_MAX_IDX_ONE_PAGE 170
// 24 * 170
#define TQ_IDX_PAGE_BODY_SIZE 4080
// 4096 - 4080
#define TQ_IDX_PAGE_HEAD_SIZE 16
#define TQ_ACTION_CONST 0
#define TQ_ACTION_INUSE 1
#define TQ_ACTION_INUSE_CONT 2
#define TQ_ACTION_INTXN 3
#define TQ_SVER 0
// TODO: inplace mode is not implemented
#define TQ_UPDATE_INPLACE 0
#define TQ_UPDATE_APPEND 1
#define TQ_DUP_INTXN_REWRITE 0
#define TQ_DUP_INTXN_REJECT 2
static
inline
bool
tqUpdateAppend
(
int32_t
tqConfigFlag
)
{
return
tqConfigFlag
&
TQ_UPDATE_APPEND
;
}
static
inline
bool
tqDupIntxnReject
(
int32_t
tqConfigFlag
)
{
return
tqConfigFlag
&
TQ_DUP_INTXN_REJECT
;
}
static
const
int8_t
TQ_CONST_DELETE
=
TQ_ACTION_CONST
;
#define TQ_DELETE_TOKEN (void*)&TQ_CONST_DELETE
typedef
enum
{
TQ_ITEM_READY
,
TQ_ITEM_PROCESS
,
TQ_ITEM_EMPTY
}
STqItemStatus
;
typedef
struct
{
int16_t
ver
;
int16_t
action
;
int32_t
checksum
;
int64_t
ssize
;
char
content
[];
}
STqSerializedHead
;
typedef
int32_t
(
*
FTqSerialize
)(
const
void
*
pObj
,
STqSerializedHead
**
ppHead
);
typedef
int32_t
(
*
FTqDeserialize
)(
void
*
self
,
const
STqSerializedHead
*
pHead
,
void
**
ppObj
);
typedef
void
(
*
FTqDelete
)(
void
*
);
typedef
struct
{
int64_t
key
;
int64_t
offset
;
int64_t
serializedSize
;
void
*
valueInUse
;
void
*
valueInTxn
;
}
STqMetaHandle
;
typedef
struct
STqMetaList
{
STqMetaHandle
handle
;
struct
STqMetaList
*
next
;
// struct STqMetaList* inTxnPrev;
// struct STqMetaList* inTxnNext;
struct
STqMetaList
*
unpersistPrev
;
struct
STqMetaList
*
unpersistNext
;
}
STqMetaList
;
typedef
struct
{
STQ
*
pTq
;
STqMetaList
*
bucket
[
TQ_BUCKET_SIZE
];
// a table head
STqMetaList
*
unpersistHead
;
// topics that are not connectted
STqMetaList
*
unconnectTopic
;
// TODO:temporaral use, to be replaced by unified tfile
int
fileFd
;
// TODO:temporaral use, to be replaced by unified tfile
int
idxFd
;
char
*
dirPath
;
int32_t
tqConfigFlag
;
FTqSerialize
pSerializer
;
FTqDeserialize
pDeserializer
;
FTqDelete
pDeleter
;
}
STqMetaStore
;
struct
STQ
{
// the collection of groups
// the handle of meta kvstore
char
*
path
;
STqCfg
*
tqConfig
;
STqMemRef
tqMemRef
;
STqMetaStore
*
tqMeta
;
SWal
*
pWal
;
SMeta
*
pMeta
;
};
typedef
struct
{
int8_t
inited
;
tmr_h
timer
;
}
STqMgmt
;
static
STqMgmt
tqMgmt
;
typedef
struct
{
int8_t
status
;
int64_t
offset
;
qTaskInfo_t
task
;
STqReadHandle
*
pReadHandle
;
}
STqTaskItem
;
// new version
typedef
struct
{
int64_t
firstOffset
;
int64_t
lastOffset
;
STqTaskItem
output
[
TQ_BUFFER_SIZE
];
}
STqBuffer
;
typedef
struct
{
char
topicName
[
TSDB_TOPIC_FNAME_LEN
];
char
*
sql
;
char
*
logicalPlan
;
char
*
physicalPlan
;
char
*
qmsg
;
int64_t
persistedOffset
;
int64_t
committedOffset
;
int64_t
currentOffset
;
STqBuffer
buffer
;
SWalReadHandle
*
pReadhandle
;
}
STqTopic
;
typedef
struct
{
int64_t
consumerId
;
int64_t
epoch
;
char
cgroup
[
TSDB_TOPIC_FNAME_LEN
];
SArray
*
topics
;
// SArray<STqTopicHandle>
}
STqConsumer
;
int32_t
tqSerializeConsumer
(
const
STqConsumer
*
,
STqSerializedHead
**
);
int32_t
tqDeserializeConsumer
(
STQ
*
,
const
STqSerializedHead
*
,
STqConsumer
**
);
static
int
FORCE_INLINE
tqQueryExecuting
(
int32_t
status
)
{
return
status
;
}
#ifdef __cplusplus
}
#endif
#endif
/*_TD_TQ_INT_H_*/
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录