Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ac0fb023
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ac0fb023
编写于
5月 04, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
drop table code
上级
8d9cc366
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
117 addition
and
31 deletion
+117
-31
include/util/tskiplist2.h
include/util/tskiplist2.h
+1
-0
source/dnode/vnode/src/inc/meta.h
source/dnode/vnode/src/inc/meta.h
+0
-2
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+9
-9
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+69
-8
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+35
-4
source/libs/tdb/inc/tdb.h
source/libs/tdb/inc/tdb.h
+1
-1
source/libs/tdb/src/db/tdbBtree.c
source/libs/tdb/src/db/tdbBtree.c
+1
-1
source/libs/tdb/src/db/tdbDb.c
source/libs/tdb/src/db/tdbDb.c
+1
-5
source/util/src/tskiplist2.c
source/util/src/tskiplist2.c
+0
-1
未找到文件。
include/util/tskiplist2.h
浏览文件 @
ac0fb023
...
...
@@ -26,6 +26,7 @@ extern "C" {
typedef
struct
SSkipList2
SSkipList2
;
typedef
struct
SSLCursor
SSLCursor
;
typedef
struct
SSLCfg
SSLCfg
;
typedef
struct
SSLNode
SSLNode
;
typedef
int32_t
(
*
tslCmprFn
)(
const
void
*
pKey1
,
int32_t
nKey1
,
const
void
*
pKey2
,
int32_t
nKey2
);
...
...
source/dnode/vnode/src/inc/meta.h
浏览文件 @
ac0fb023
...
...
@@ -103,8 +103,6 @@ typedef struct {
#if 1
// int metaCreateTable(SMeta* pMeta, STbCfg* pTbCfg, STbDdlH* pHandle);
int
metaDropTable
(
SMeta
*
pMeta
,
tb_uid_t
uid
);
SMSmaCursor
*
metaOpenSmaCursor
(
SMeta
*
pMeta
,
tb_uid_t
uid
);
void
metaCloseSmaCursor
(
SMSmaCursor
*
pSmaCur
);
int64_t
metaSmaCursorNext
(
SMSmaCursor
*
pSmaCur
);
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
ac0fb023
...
...
@@ -46,13 +46,13 @@
extern
"C"
{
#endif
typedef
struct
SVnodeInfo
SVnodeInfo
;
typedef
struct
SMeta
SMeta
;
typedef
struct
STsdb
STsdb
;
typedef
struct
STQ
STQ
;
typedef
struct
SVState
SVState
;
typedef
struct
SVBufPool
SVBufPool
;
typedef
struct
SQWorker
SQHandle
;
typedef
struct
SVnodeInfo
SVnodeInfo
;
typedef
struct
SMeta
SMeta
;
typedef
struct
STsdb
STsdb
;
typedef
struct
STQ
STQ
;
typedef
struct
SVState
SVState
;
typedef
struct
SVBufPool
SVBufPool
;
typedef
struct
SQWorker
SQHandle
;
#define VNODE_META_DIR "meta"
#define VNODE_TSDB_DIR "tsdb"
...
...
@@ -77,6 +77,7 @@ int metaCommit(SMeta* pMeta);
int
metaCreateSTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVCreateStbReq
*
pReq
);
int
metaDropSTable
(
SMeta
*
pMeta
,
int64_t
verison
,
SVDropStbReq
*
pReq
);
int
metaCreateTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVCreateTbReq
*
pReq
);
int
metaDropTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVDropTbReq
*
pReq
);
SSchemaWrapper
*
metaGetTableSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
,
bool
isinline
);
STSchema
*
metaGetTbTSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
);
int
metaGetTableEntryByName
(
SMetaReader
*
pReader
,
const
char
*
name
);
...
...
@@ -100,7 +101,7 @@ int32_t tsdbCreateTSma(STsdb* pTsdb, char* pMsg);
int32_t
tsdbInsertTSmaData
(
STsdb
*
pTsdb
,
int64_t
indexUid
,
const
char
*
msg
);
int
tsdbInsertData
(
STsdb
*
pTsdb
,
int64_t
version
,
SSubmitReq
*
pMsg
,
SSubmitRsp
*
pRsp
);
tsdbReaderT
*
tsdbQueryTables
(
SVnode
*
pVnode
,
SQueryTableDataCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
uint64_t
taskId
);
uint64_t
taskId
);
tsdbReaderT
tsdbQueryCacheLastT
(
STsdb
*
tsdb
,
SQueryTableDataCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
void
*
pMemRef
);
int32_t
tsdbGetTableGroupFromIdListT
(
STsdb
*
tsdb
,
SArray
*
pTableIdList
,
STableGroupInfo
*
pGroupInfo
);
...
...
@@ -189,7 +190,6 @@ struct STbUidStore {
#define TD_VID(PVNODE) (PVNODE)->config.vgId
static
FORCE_INLINE
bool
vnodeIsRollup
(
SVnode
*
pVnode
)
{
SRetention
*
pRetention
=
&
(
pVnode
->
config
.
tsdbCfg
.
retentions
[
0
]);
return
(
pRetention
->
freq
>
0
&&
pRetention
->
keep
>
0
);
...
...
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
ac0fb023
...
...
@@ -98,7 +98,7 @@ int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq) {
// ret = tdbDbcOpen(pMeta->pCtbIdx, &pDbc1);
// tdbDbcMoveTo(pDbc1, &pReq->suid, sizeof(pReq->suid), NULL /*cmpr*/, 0 /*TDB_FORWARD_SEARCH*/);
// tdbDbcGet(pDbc1, &pKey, &kLen, &pVal, vLen);
// tdbDbcD
rop
(pDbc1);
// tdbDbcD
elete
(pDbc1);
// // drop from pTagIdx
// // drop from pTtlIdx
// }
...
...
@@ -166,18 +166,79 @@ _err:
return
-
1
;
}
int
metaDropTable
(
SMeta
*
pMeta
,
tb_uid_t
uid
)
{
#if 0
if (metaRemoveTableFromIdx(pMeta, uid) < 0) {
// TODO: handle error
int
metaDropTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVDropTbReq
*
pReq
)
{
TDBC
*
pTbDbc
=
NULL
;
TDBC
*
pUidIdxc
=
NULL
;
TDBC
*
pNameIdxc
=
NULL
;
const
void
*
pData
;
int
nData
;
tb_uid_t
uid
;
int64_t
tver
;
SMetaEntry
me
=
{
0
};
SCoder
coder
=
{
0
};
int
c
,
ret
;
// search & delete the name idx
tdbDbcOpen
(
pMeta
->
pNameIdx
,
&
pNameIdxc
,
&
pMeta
->
txn
);
ret
=
tdbDbcMoveTo
(
pNameIdxc
,
pReq
->
name
,
strlen
(
pReq
->
name
)
+
1
,
&
c
);
if
(
ret
<
0
||
c
)
{
tdbDbcClose
(
pNameIdxc
);
terrno
=
TSDB_CODE_VND_TABLE_NOT_EXIST
;
return
-
1
;
}
if (metaRemoveTableFromIdx(pMeta, uid) < 0) {
// TODO
ret
=
tdbDbcGet
(
pNameIdxc
,
NULL
,
NULL
,
&
pData
,
&
nData
);
if
(
ret
<
0
)
{
ASSERT
(
0
);
return
-
1
;
}
#endif
uid
=
*
(
tb_uid_t
*
)
pData
;
tdbDbcDelete
(
pNameIdxc
);
tdbDbcClose
(
pNameIdxc
);
// search & delete uid idx
tdbDbcOpen
(
pMeta
->
pUidIdx
,
&
pUidIdxc
,
&
pMeta
->
txn
);
ret
=
tdbDbcMoveTo
(
pUidIdxc
,
&
uid
,
sizeof
(
uid
),
&
c
);
if
(
ret
<
0
||
c
!=
0
)
{
ASSERT
(
0
);
return
-
1
;
}
ret
=
tdbDbcGet
(
pUidIdxc
,
NULL
,
NULL
,
&
pData
,
&
nData
);
if
(
ret
<
0
)
{
ASSERT
(
0
);
return
-
1
;
}
tver
=
*
(
int64_t
*
)
pData
;
tdbDbcDelete
(
pUidIdxc
);
tdbDbcClose
(
pUidIdxc
);
// search and get meta entry
tdbDbcOpen
(
pMeta
->
pTbDb
,
&
pTbDbc
,
&
pMeta
->
txn
);
ret
=
tdbDbcMoveTo
(
pTbDbc
,
&
(
STbDbKey
){.
uid
=
uid
,
.
version
=
tver
},
sizeof
(
STbDbKey
),
&
c
);
if
(
ret
<
0
||
c
!=
0
)
{
ASSERT
(
0
);
return
-
1
;
}
ret
=
tdbDbcGet
(
pTbDbc
,
NULL
,
NULL
,
&
pData
,
&
nData
);
if
(
ret
<
0
)
{
ASSERT
(
0
);
return
-
1
;
}
// tCoderInit(&coder, TD_LITTLE_ENDIAN, pData, nData, TD_DECODER);
// ret = metaDecodeEntry(&coder, &me);
// if (ret < 0) {
// ASSERT(0);
// return -1;
// }
tCoderClear
(
&
coder
);
tdbDbcClose
(
pTbDbc
);
return
0
;
}
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
ac0fb023
...
...
@@ -445,14 +445,45 @@ static int vnodeProcessAlterTbReq(SVnode *pVnode, void *pReq, int32_t len, SRpcM
}
static
int
vnodeProcessDropTbReq
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int32_t
len
,
SRpcMsg
*
pRsp
)
{
SVDropTbReq
req
=
{
0
};
SVDropTbReq
rsp
=
{
0
};
SVDropTbBatchReq
req
=
{
0
};
SVDropTbBatchRsp
rsp
=
{
0
};
SCoder
coder
=
{
0
};
int
ret
;
pRsp
->
msgType
=
TDMT_VND_CREATE_STB_RSP
;
pRsp
->
pCont
=
NULL
;
pRsp
->
contLen
=
0
;
pRsp
->
code
=
TSDB_CODE_SUCCESS
;
// decode req
tCoderInit
(
&
coder
,
TD_LITTLE_ENDIAN
,
pReq
,
len
,
TD_DECODER
);
ret
=
tDecodeSVDropTbBatchReq
(
&
coder
,
&
req
);
if
(
ret
<
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
pRsp
->
code
=
terrno
;
goto
_exit
;
}
// process req
rsp
.
pArray
=
taosArrayInit
(
sizeof
(
SVDropTbRsp
),
req
.
nReqs
);
for
(
int
iReq
=
0
;
iReq
<
req
.
nReqs
;
iReq
++
)
{
SVDropTbReq
*
pDropTbReq
=
req
.
pReqs
+
iReq
;
SVDropTbRsp
dropTbRsp
=
{
0
};
// return rsp
/* code */
ret
=
metaDropTable
(
pVnode
->
pMeta
,
version
,
pDropTbReq
);
if
(
ret
<
0
)
{
dropTbRsp
.
code
=
TSDB_CODE_SUCCESS
;
}
else
{
dropTbRsp
.
code
=
terrno
;
}
taosArrayPush
(
rsp
.
pArray
,
&
dropTbRsp
);
}
_exit:
tCoderClear
(
&
coder
);
// encode rsp (TODO)
return
0
;
}
...
...
@@ -482,7 +513,7 @@ static int vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq, in
}
int32_t
tsdbProcessSubmitReq
(
STsdb
*
pTsdb
,
int64_t
version
,
void
*
pReq
)
{
if
(
!
pReq
)
{
if
(
!
pReq
)
{
terrno
=
TSDB_CODE_INVALID_PTR
;
return
TSDB_CODE_FAILED
;
}
...
...
source/libs/tdb/inc/tdb.h
浏览文件 @
ac0fb023
...
...
@@ -58,7 +58,7 @@ int tdbDbcGet(TDBC *pDbc, const void **ppKey, int *pkLen, const void **ppVal, in
int
tdbDbcPut
(
TDBC
*
pDbc
,
const
void
*
pKey
,
int
keyLen
,
const
void
*
pVal
,
int
valLen
);
int
tdbDbcUpdate
(
TDBC
*
pDbc
,
const
void
*
pKey
,
int
kLen
,
const
void
*
pVal
,
int
vLen
);
int
tdbDbcD
rop
(
TDBC
*
pDbc
);
int
tdbDbcD
elete
(
TDBC
*
pDbc
);
int
tdbDbcNext
(
TDBC
*
pDbc
,
void
**
ppKey
,
int
*
kLen
,
void
**
ppVal
,
int
*
vLen
);
// TXN
...
...
source/libs/tdb/src/db/tdbBtree.c
浏览文件 @
ac0fb023
...
...
@@ -1394,7 +1394,7 @@ int tdbBtcGet(SBTC *pBtc, const void **ppKey, int *kLen, const void **ppVal, int
if
(
ppVal
)
{
*
ppVal
=
(
void
*
)
pBtc
->
coder
.
pVal
;
*
k
Len
=
pBtc
->
coder
.
vLen
;
*
v
Len
=
pBtc
->
coder
.
vLen
;
}
return
0
;
...
...
source/libs/tdb/src/db/tdbDb.c
浏览文件 @
ac0fb023
...
...
@@ -136,11 +136,7 @@ int tdbDbcUpdate(TDBC *pDbc, const void *pKey, int kLen, const void *pVal, int v
return
0
;
}
int
tdbDbcDrop
(
TDBC
*
pDbc
)
{
// TODO
ASSERT
(
0
);
return
0
;
}
int
tdbDbcDelete
(
TDBC
*
pDbc
)
{
return
tdbBtcDelete
(
&
pDbc
->
btc
);
}
int
tdbDbcNext
(
TDBC
*
pDbc
,
void
**
ppKey
,
int
*
kLen
,
void
**
ppVal
,
int
*
vLen
)
{
return
tdbBtreeNext
(
&
pDbc
->
btc
,
ppKey
,
kLen
,
ppVal
,
vLen
);
...
...
source/util/src/tskiplist2.c
浏览文件 @
ac0fb023
...
...
@@ -16,7 +16,6 @@
#include "tskiplist2.h"
typedef
struct
SSLNode
SSLNode
;
struct
SSLNode
{
int8_t
level
;
SSLNode
*
forwards
[];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录