Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
222db126
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1191
Star
22018
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看板
提交
222db126
编写于
3月 26, 2022
作者:
wafwerar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-13758]<fix>: redefine memory api.
上级
20e1ebfe
变更
297
展开全部
隐藏空白更改
内联
并排
Showing
297 changed file
with
3410 addition
and
3258 deletion
+3410
-3258
include/common/tcommon.h
include/common/tcommon.h
+7
-7
include/common/tdataformat.h
include/common/tdataformat.h
+4
-4
include/common/tmsg.h
include/common/tmsg.h
+13
-13
include/libs/transport/trpc.h
include/libs/transport/trpc.h
+1
-1
include/os/osMemory.h
include/os/osMemory.h
+19
-6
include/util/tcoding.h
include/util/tcoding.h
+2
-2
include/util/tencode.h
include/util/tencode.h
+1
-1
include/util/tfreelist.h
include/util/tfreelist.h
+2
-2
include/util/tlist.h
include/util/tlist.h
+1
-1
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+17
-17
source/client/src/clientHb.c
source/client/src/clientHb.c
+12
-12
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+16
-16
source/client/src/clientMsgHandler.c
source/client/src/clientMsgHandler.c
+15
-15
source/client/src/tmq.c
source/client/src/tmq.c
+37
-37
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+35
-35
source/common/src/tdataformat.c
source/common/src/tdataformat.c
+27
-27
source/common/src/tmsg.c
source/common/src/tmsg.c
+29
-29
source/common/src/tname.c
source/common/src/tname.c
+3
-3
source/common/src/trow.c
source/common/src/trow.c
+1
-1
source/common/src/ttszip.c
source/common/src/ttszip.c
+22
-22
source/common/src/tvariant.c
source/common/src/tvariant.c
+21
-21
source/common/test/commonTests.cpp
source/common/test/commonTests.cpp
+13
-13
source/dnode/bnode/src/bnode.c
source/dnode/bnode/src/bnode.c
+2
-2
source/dnode/mgmt/bnode/src/bmInt.c
source/dnode/mgmt/bnode/src/bmInt.c
+3
-3
source/dnode/mgmt/container/src/dndExec.c
source/dnode/mgmt/container/src/dndExec.c
+3
-3
source/dnode/mgmt/container/src/dndFile.c
source/dnode/mgmt/container/src/dndFile.c
+4
-4
source/dnode/mgmt/container/src/dndObj.c
source/dnode/mgmt/container/src/dndObj.c
+8
-8
source/dnode/mgmt/dnode/src/dmFile.c
source/dnode/mgmt/dnode/src/dmFile.c
+4
-4
source/dnode/mgmt/dnode/src/dmInt.c
source/dnode/mgmt/dnode/src/dmInt.c
+2
-2
source/dnode/mgmt/mnode/src/mmFile.c
source/dnode/mgmt/mnode/src/mmFile.c
+4
-4
source/dnode/mgmt/mnode/src/mmInt.c
source/dnode/mgmt/mnode/src/mmInt.c
+3
-3
source/dnode/mgmt/qnode/src/qmInt.c
source/dnode/mgmt/qnode/src/qmInt.c
+3
-3
source/dnode/mgmt/snode/src/smInt.c
source/dnode/mgmt/snode/src/smInt.c
+3
-3
source/dnode/mgmt/snode/src/smWorker.c
source/dnode/mgmt/snode/src/smWorker.c
+1
-1
source/dnode/mgmt/test/sut/inc/sut.h
source/dnode/mgmt/test/sut/inc/sut.h
+1
-1
source/dnode/mgmt/test/sut/src/client.cpp
source/dnode/mgmt/test/sut/src/client.cpp
+2
-2
source/dnode/mgmt/vnode/src/vmFile.c
source/dnode/mgmt/vnode/src/vmFile.c
+7
-7
source/dnode/mgmt/vnode/src/vmInt.c
source/dnode/mgmt/vnode/src/vmInt.c
+12
-12
source/dnode/mgmt/vnode/src/vmWorker.c
source/dnode/mgmt/vnode/src/vmWorker.c
+1
-1
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+6
-6
source/dnode/mnode/impl/src/mndAcct.c
source/dnode/mnode/impl/src/mndAcct.c
+1
-1
source/dnode/mnode/impl/src/mndBnode.c
source/dnode/mnode/impl/src/mndBnode.c
+7
-7
source/dnode/mnode/impl/src/mndCluster.c
source/dnode/mnode/impl/src/mndCluster.c
+1
-1
source/dnode/mnode/impl/src/mndConsumer.c
source/dnode/mnode/impl/src/mndConsumer.c
+6
-6
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+8
-8
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+1
-1
source/dnode/mnode/impl/src/mndFunc.c
source/dnode/mnode/impl/src/mndFunc.c
+9
-9
source/dnode/mnode/impl/src/mndInfoSchema.c
source/dnode/mnode/impl/src/mndInfoSchema.c
+3
-3
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+9
-9
source/dnode/mnode/impl/src/mndOffset.c
source/dnode/mnode/impl/src/mndOffset.c
+5
-5
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+7
-7
source/dnode/mnode/impl/src/mndQnode.c
source/dnode/mnode/impl/src/mndQnode.c
+8
-8
source/dnode/mnode/impl/src/mndScheduler.c
source/dnode/mnode/impl/src/mndScheduler.c
+2
-2
source/dnode/mnode/impl/src/mndShow.c
source/dnode/mnode/impl/src/mndShow.c
+1
-1
source/dnode/mnode/impl/src/mndSma.c
source/dnode/mnode/impl/src/mndSma.c
+17
-17
source/dnode/mnode/impl/src/mndSnode.c
source/dnode/mnode/impl/src/mndSnode.c
+7
-7
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+35
-35
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+5
-5
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+19
-19
source/dnode/mnode/impl/src/mndTelem.c
source/dnode/mnode/impl/src/mndTelem.c
+1
-1
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+10
-10
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+13
-13
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+1
-1
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+5
-5
source/dnode/mnode/impl/src/mnode.c
source/dnode/mnode/impl/src/mnode.c
+4
-4
source/dnode/mnode/impl/test/trans/trans.cpp
source/dnode/mnode/impl/test/trans/trans.cpp
+2
-2
source/dnode/mnode/sdb/src/sdb.c
source/dnode/mnode/sdb/src/sdb.c
+5
-5
source/dnode/mnode/sdb/src/sdbFile.c
source/dnode/mnode/sdb/src/sdbFile.c
+3
-3
source/dnode/mnode/sdb/src/sdbRaw.c
source/dnode/mnode/sdb/src/sdbRaw.c
+2
-2
source/dnode/mnode/sdb/src/sdbRow.c
source/dnode/mnode/sdb/src/sdbRow.c
+2
-2
source/dnode/qnode/src/qnode.c
source/dnode/qnode/src/qnode.c
+3
-3
source/dnode/snode/src/snode.c
source/dnode/snode/src/snode.c
+9
-9
source/dnode/vnode/src/inc/tsdbMemory.h
source/dnode/vnode/src/inc/tsdbMemory.h
+3
-3
source/dnode/vnode/src/meta/metaBDBImpl.c
source/dnode/vnode/src/meta/metaBDBImpl.c
+28
-28
source/dnode/vnode/src/meta/metaMain.c
source/dnode/vnode/src/meta/metaMain.c
+3
-3
source/dnode/vnode/src/meta/metaTDBImpl.c
source/dnode/vnode/src/meta/metaTDBImpl.c
+1
-1
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+16
-16
source/dnode/vnode/src/tq/tqMetaStore.c
source/dnode/vnode/src/tq/tqMetaStore.c
+23
-23
source/dnode/vnode/src/tq/tqOffset.c
source/dnode/vnode/src/tq/tqOffset.c
+1
-1
source/dnode/vnode/src/tq/tqPush.c
source/dnode/vnode/src/tq/tqPush.c
+6
-6
source/dnode/vnode/src/tq/tqRead.c
source/dnode/vnode/src/tq/tqRead.c
+3
-3
source/dnode/vnode/src/tsdb/tsdbBDBImpl.c
source/dnode/vnode/src/tsdb/tsdbBDBImpl.c
+2
-2
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+7
-7
source/dnode/vnode/src/tsdb/tsdbFS.c
source/dnode/vnode/src/tsdb/tsdbFS.c
+12
-12
source/dnode/vnode/src/tsdb/tsdbFile.c
source/dnode/vnode/src/tsdb/tsdbFile.c
+7
-7
source/dnode/vnode/src/tsdb/tsdbMain.c
source/dnode/vnode/src/tsdb/tsdbMain.c
+15
-15
source/dnode/vnode/src/tsdb/tsdbMemTable.c
source/dnode/vnode/src/tsdb/tsdbMemTable.c
+13
-13
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+33
-33
source/dnode/vnode/src/tsdb/tsdbSma.c
source/dnode/vnode/src/tsdb/tsdbSma.c
+15
-15
source/dnode/vnode/src/vnd/vnodeArenaMAImpl.c
source/dnode/vnode/src/vnd/vnodeArenaMAImpl.c
+5
-5
source/dnode/vnode/src/vnd/vnodeBufferPool.c
source/dnode/vnode/src/vnd/vnodeBufferPool.c
+6
-6
source/dnode/vnode/src/vnd/vnodeCommit.c
source/dnode/vnode/src/vnd/vnodeCommit.c
+1
-1
source/dnode/vnode/src/vnd/vnodeMain.c
source/dnode/vnode/src/vnd/vnodeMain.c
+3
-3
source/dnode/vnode/src/vnd/vnodeMgr.c
source/dnode/vnode/src/vnd/vnodeMgr.c
+3
-3
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+9
-9
source/dnode/vnode/src/vnd/vnodeWrite.c
source/dnode/vnode/src/vnd/vnodeWrite.c
+12
-12
source/dnode/vnode/test/tqMetaTest.cpp
source/dnode/vnode/test/tqMetaTest.cpp
+9
-9
source/dnode/vnode/test/tsdbSmaTest.cpp
source/dnode/vnode/test/tsdbSmaTest.cpp
+15
-15
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+55
-55
source/libs/catalog/test/catalogTests.cpp
source/libs/catalog/test/catalogTests.cpp
+33
-33
source/libs/executor/src/dataDispatcher.c
source/libs/executor/src/dataDispatcher.c
+5
-5
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+15
-15
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+178
-178
source/libs/executor/src/tlinearhash.c
source/libs/executor/src/tlinearhash.c
+8
-8
source/libs/executor/src/tsimplehash.c
source/libs/executor/src/tsimplehash.c
+7
-7
source/libs/executor/src/tsort.c
source/libs/executor/src/tsort.c
+7
-7
source/libs/executor/test/executorTests.cpp
source/libs/executor/test/executorTests.cpp
+31
-31
source/libs/executor/test/sortTests.cpp
source/libs/executor/test/sortTests.cpp
+7
-7
source/libs/function/CMakeLists.txt
source/libs/function/CMakeLists.txt
+2
-0
source/libs/function/src/taggfunction.c
source/libs/function/src/taggfunction.c
+6
-6
source/libs/function/src/texpr.c
source/libs/function/src/texpr.c
+15
-15
source/libs/function/src/tfill.c
source/libs/function/src/tfill.c
+14
-14
source/libs/function/src/thistogram.c
source/libs/function/src/thistogram.c
+8
-8
source/libs/function/src/tpercentile.c
source/libs/function/src/tpercentile.c
+9
-9
source/libs/function/src/tscript.c
source/libs/function/src/tscript.c
+6
-6
source/libs/function/src/tudf.c
source/libs/function/src/tudf.c
+39
-39
source/libs/function/src/udfd.c
source/libs/function/src/udfd.c
+41
-41
source/libs/function/test/runUdf.c
source/libs/function/test/runUdf.c
+5
-4
source/libs/function/test/udf1.c
source/libs/function/test/udf1.c
+3
-2
source/libs/index/src/index.c
source/libs/index/src/index.c
+23
-23
source/libs/index/src/index_cache.c
source/libs/index/src/index_cache.c
+14
-14
source/libs/index/src/index_comm.c
source/libs/index/src/index_comm.c
+1
-1
source/libs/index/src/index_fst.c
source/libs/index/src/index_fst.c
+39
-39
source/libs/index/src/index_fst_automation.c
source/libs/index/src/index_fst_automation.c
+10
-10
source/libs/index/src/index_fst_counting_writer.c
source/libs/index/src/index_fst_counting_writer.c
+10
-10
source/libs/index/src/index_fst_node.c
source/libs/index/src/index_fst_node.c
+3
-3
source/libs/index/src/index_fst_registry.c
source/libs/index/src/index_fst_registry.c
+5
-5
source/libs/index/src/index_fst_util.c
source/libs/index/src/index_fst_util.c
+7
-7
source/libs/index/src/index_tfile.c
source/libs/index/src/index_tfile.c
+26
-26
source/libs/index/src/index_util.c
source/libs/index/src/index_util.c
+5
-5
source/libs/index/test/fstTest.cc
source/libs/index/test/fstTest.cc
+4
-4
source/libs/index/test/fstUT.cc
source/libs/index/test/fstUT.cc
+2
-2
source/libs/index/test/indexTests.cc
source/libs/index/test/indexTests.cc
+7
-7
source/libs/monitor/src/monitor.c
source/libs/monitor/src/monitor.c
+3
-3
source/libs/nodes/src/nodesCloneFuncs.c
source/libs/nodes/src/nodesCloneFuncs.c
+3
-3
source/libs/nodes/src/nodesCodeFuncs.c
source/libs/nodes/src/nodesCodeFuncs.c
+1
-1
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+15
-15
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+1
-1
source/libs/parser/src/parAstParser.c
source/libs/parser/src/parAstParser.c
+3
-3
source/libs/parser/src/parInsert.c
source/libs/parser/src/parInsert.c
+8
-8
source/libs/parser/src/parInsertData.c
source/libs/parser/src/parInsertData.c
+20
-20
source/libs/parser/src/parTokenizer.c
source/libs/parser/src/parTokenizer.c
+2
-2
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+62
-62
source/libs/parser/src/parUtil.c
source/libs/parser/src/parUtil.c
+1
-1
source/libs/parser/src/parser.c
source/libs/parser/src/parser.c
+4
-4
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+4
-4
source/libs/parser/test/mockCatalogService.cpp
source/libs/parser/test/mockCatalogService.cpp
+2
-2
source/libs/parser/test/mockCatalogService.h
source/libs/parser/test/mockCatalogService.h
+1
-1
source/libs/parser/test/parserAstTest.cpp
source/libs/parser/test/parserAstTest.cpp
+1
-1
source/libs/planner/src/planScaleOut.c
source/libs/planner/src/planScaleOut.c
+1
-1
source/libs/planner/src/planSpliter.c
source/libs/planner/src/planSpliter.c
+1
-1
source/libs/planner/test/plannerTest.cpp
source/libs/planner/test/plannerTest.cpp
+1
-1
source/libs/qcom/src/querymsg.c
source/libs/qcom/src/querymsg.c
+3
-3
source/libs/qcom/test/queryTest.cpp
source/libs/qcom/test/queryTest.cpp
+5
-5
source/libs/qworker/src/qworker.c
source/libs/qworker/src/qworker.c
+7
-7
source/libs/qworker/src/qworkerMsg.c
source/libs/qworker/src/qworkerMsg.c
+2
-2
source/libs/qworker/test/qworkerTests.cpp
source/libs/qworker/test/qworkerTests.cpp
+6
-6
source/libs/scalar/inc/filterInt.h
source/libs/scalar/inc/filterInt.h
+1
-1
source/libs/scalar/src/filter.c
source/libs/scalar/src/filter.c
+77
-77
source/libs/scalar/src/scalar.c
source/libs/scalar/src/scalar.c
+17
-17
source/libs/scalar/src/sclfunc.c
source/libs/scalar/src/sclfunc.c
+13
-13
source/libs/scalar/src/sclvector.c
source/libs/scalar/src/sclvector.c
+26
-26
source/libs/scalar/test/filter/filterTests.cpp
source/libs/scalar/test/filter/filterTests.cpp
+24
-24
source/libs/scalar/test/scalar/scalarTests.cpp
source/libs/scalar/test/scalar/scalarTests.cpp
+6
-6
source/libs/scheduler/src/scheduler.c
source/libs/scheduler/src/scheduler.c
+23
-23
source/libs/scheduler/test/schedulerTests.cpp
source/libs/scheduler/test/schedulerTests.cpp
+24
-24
source/libs/stream/src/tstream.c
source/libs/stream/src/tstream.c
+4
-4
source/libs/sync/src/syncEnv.c
source/libs/sync/src/syncEnv.c
+1
-1
source/libs/sync/src/syncIO.c
source/libs/sync/src/syncIO.c
+1
-1
source/libs/sync/src/syncIndexMgr.c
source/libs/sync/src/syncIndexMgr.c
+8
-8
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+8
-8
source/libs/sync/src/syncMessage.c
source/libs/sync/src/syncMessage.c
+80
-80
source/libs/sync/src/syncRaftEntry.c
source/libs/sync/src/syncRaftEntry.c
+10
-10
source/libs/sync/src/syncRaftLog.c
source/libs/sync/src/syncRaftLog.c
+14
-14
source/libs/sync/src/syncRaftStore.c
source/libs/sync/src/syncRaftStore.c
+7
-7
source/libs/sync/src/syncReplication.c
source/libs/sync/src/syncReplication.c
+1
-1
source/libs/sync/src/syncUtil.c
source/libs/sync/src/syncUtil.c
+5
-5
source/libs/sync/src/syncVoteMgr.c
source/libs/sync/src/syncVoteMgr.c
+16
-16
source/libs/sync/test/syncAppendEntriesReplyTest.cpp
source/libs/sync/test/syncAppendEntriesReplyTest.cpp
+3
-3
source/libs/sync/test/syncAppendEntriesTest.cpp
source/libs/sync/test/syncAppendEntriesTest.cpp
+4
-4
source/libs/sync/test/syncClientRequestTest.cpp
source/libs/sync/test/syncClientRequestTest.cpp
+4
-4
source/libs/sync/test/syncElectTest.cpp
source/libs/sync/test/syncElectTest.cpp
+1
-1
source/libs/sync/test/syncElectTest2.cpp
source/libs/sync/test/syncElectTest2.cpp
+1
-1
source/libs/sync/test/syncElectTest3.cpp
source/libs/sync/test/syncElectTest3.cpp
+1
-1
source/libs/sync/test/syncEncodeTest.cpp
source/libs/sync/test/syncEncodeTest.cpp
+6
-6
source/libs/sync/test/syncEnqTest.cpp
source/libs/sync/test/syncEnqTest.cpp
+1
-1
source/libs/sync/test/syncEntryTest.cpp
source/libs/sync/test/syncEntryTest.cpp
+1
-1
source/libs/sync/test/syncIOSendMsgTest.cpp
source/libs/sync/test/syncIOSendMsgTest.cpp
+1
-1
source/libs/sync/test/syncIndexMgrTest.cpp
source/libs/sync/test/syncIndexMgrTest.cpp
+5
-5
source/libs/sync/test/syncInitTest.cpp
source/libs/sync/test/syncInitTest.cpp
+1
-1
source/libs/sync/test/syncLogStoreTest.cpp
source/libs/sync/test/syncLogStoreTest.cpp
+1
-1
source/libs/sync/test/syncPingReplyTest.cpp
source/libs/sync/test/syncPingReplyTest.cpp
+4
-4
source/libs/sync/test/syncPingSelfTest.cpp
source/libs/sync/test/syncPingSelfTest.cpp
+1
-1
source/libs/sync/test/syncPingTest.cpp
source/libs/sync/test/syncPingTest.cpp
+4
-4
source/libs/sync/test/syncPingTimerTest.cpp
source/libs/sync/test/syncPingTimerTest.cpp
+1
-1
source/libs/sync/test/syncPingTimerTest2.cpp
source/libs/sync/test/syncPingTimerTest2.cpp
+1
-1
source/libs/sync/test/syncRaftStoreTest.cpp
source/libs/sync/test/syncRaftStoreTest.cpp
+1
-1
source/libs/sync/test/syncRefTest.cpp
source/libs/sync/test/syncRefTest.cpp
+2
-2
source/libs/sync/test/syncReplicateLoadTest.cpp
source/libs/sync/test/syncReplicateLoadTest.cpp
+4
-4
source/libs/sync/test/syncReplicateTest.cpp
source/libs/sync/test/syncReplicateTest.cpp
+4
-4
source/libs/sync/test/syncReplicateTest2.cpp
source/libs/sync/test/syncReplicateTest2.cpp
+5
-5
source/libs/sync/test/syncReplicateTest3.cpp
source/libs/sync/test/syncReplicateTest3.cpp
+5
-5
source/libs/sync/test/syncRequestVoteReplyTest.cpp
source/libs/sync/test/syncRequestVoteReplyTest.cpp
+3
-3
source/libs/sync/test/syncRequestVoteTest.cpp
source/libs/sync/test/syncRequestVoteTest.cpp
+3
-3
source/libs/sync/test/syncTimeoutTest.cpp
source/libs/sync/test/syncTimeoutTest.cpp
+4
-4
source/libs/sync/test/syncVotesGrantedTest.cpp
source/libs/sync/test/syncVotesGrantedTest.cpp
+7
-7
source/libs/sync/test/syncVotesRespondTest.cpp
source/libs/sync/test/syncVotesRespondTest.cpp
+7
-7
source/libs/sync/test/syncWriteTest.cpp
source/libs/sync/test/syncWriteTest.cpp
+4
-4
source/libs/tdb/src/db/tdbBtree.c
source/libs/tdb/src/db/tdbBtree.c
+3
-3
source/libs/tdb/src/db/tdbDb.c
source/libs/tdb/src/db/tdbDb.c
+1
-1
source/libs/tdb/src/db/tdbEnv.c
source/libs/tdb/src/db/tdbEnv.c
+1
-1
source/libs/tdb/src/db/tdbPCache.c
source/libs/tdb/src/db/tdbPCache.c
+5
-5
source/libs/tdb/src/db/tdbPager.c
source/libs/tdb/src/db/tdbPager.c
+1
-1
source/libs/tfs/src/tfs.c
source/libs/tfs/src/tfs.c
+10
-10
source/libs/tfs/src/tfsDisk.c
source/libs/tfs/src/tfsDisk.c
+4
-4
source/libs/tfs/test/tfsTest.cpp
source/libs/tfs/test/tfsTest.cpp
+1
-1
source/libs/transport/inc/transComm.h
source/libs/transport/inc/transComm.h
+2
-2
source/libs/transport/src/rpcCache.c
source/libs/transport/src/rpcCache.c
+9
-9
source/libs/transport/src/rpcMain.c
source/libs/transport/src/rpcMain.c
+16
-16
source/libs/transport/src/rpcTcp.c
source/libs/transport/src/rpcTcp.c
+25
-25
source/libs/transport/src/rpcUdp.c
source/libs/transport/src/rpcUdp.c
+5
-5
source/libs/transport/src/thttp.c
source/libs/transport/src/thttp.c
+4
-4
source/libs/transport/src/trans.c
source/libs/transport/src/trans.c
+5
-5
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+25
-25
source/libs/transport/src/transComm.c
source/libs/transport/src/transComm.c
+21
-21
source/libs/transport/src/transSrv.c
source/libs/transport/src/transSrv.c
+37
-37
source/libs/transport/test/rclient.c
source/libs/transport/test/rclient.c
+1
-1
source/libs/transport/test/rsclient.c
source/libs/transport/test/rsclient.c
+1
-1
source/libs/transport/test/syncClient.c
source/libs/transport/test/syncClient.c
+1
-1
source/libs/transport/test/transportTests.cpp
source/libs/transport/test/transportTests.cpp
+25
-25
source/libs/transport/test/uv.c
source/libs/transport/test/uv.c
+21
-21
source/libs/wal/src/walMeta.c
source/libs/wal/src/walMeta.c
+9
-9
source/libs/wal/src/walMgmt.c
source/libs/wal/src/walMgmt.c
+6
-6
source/libs/wal/src/walRead.c
source/libs/wal/src/walRead.c
+9
-9
source/libs/wal/test/walMetaTest.cpp
source/libs/wal/test/walMetaTest.cpp
+9
-9
source/os/src/osFile.c
source/os/src/osFile.c
+2
-2
source/os/src/osLocale.c
source/os/src/osLocale.c
+2
-2
source/os/src/osMemory.c
source/os/src/osMemory.c
+136
-0
source/os/src/osSemaphore.c
source/os/src/osSemaphore.c
+2
-2
source/os/src/osSocket.c
source/os/src/osSocket.c
+8
-8
source/os/src/osString.c
source/os/src/osString.c
+5
-6
source/os/src/osSysinfo.c
source/os/src/osSysinfo.c
+9
-9
source/util/src/talgo.c
source/util/src/talgo.c
+6
-6
source/util/src/tarray.c
source/util/src/tarray.c
+7
-7
source/util/src/tbase64.c
source/util/src/tbase64.c
+3
-3
source/util/src/tbuffer.c
source/util/src/tbuffer.c
+1
-1
source/util/src/tcache.c
source/util/src/tcache.c
+19
-19
source/util/src/tcompare.c
source/util/src/tcompare.c
+12
-12
source/util/src/tconfig.c
source/util/src/tconfig.c
+10
-10
source/util/src/tcrc32c.c
source/util/src/tcrc32c.c
+3
-3
source/util/src/tdes.c
source/util/src/tdes.c
+3
-3
source/util/src/tencode.c
source/util/src/tencode.c
+5
-5
source/util/src/tfunctional.c
source/util/src/tfunctional.c
+3
-3
source/util/src/thash.c
source/util/src/thash.c
+18
-18
source/util/src/theap.c
source/util/src/theap.c
+2
-2
source/util/src/tidpool.c
source/util/src/tidpool.c
+7
-7
source/util/src/tjson.c
source/util/src/tjson.c
+1
-1
source/util/src/tlist.c
source/util/src/tlist.c
+5
-5
source/util/src/tlog.c
source/util/src/tlog.c
+6
-6
source/util/src/tlosertree.c
source/util/src/tlosertree.c
+2
-2
source/util/src/tmallocator.c
source/util/src/tmallocator.c
+3
-3
source/util/src/tmempool.c
source/util/src/tmempool.c
+9
-9
source/util/src/tpagedbuf.c
source/util/src/tpagedbuf.c
+15
-15
source/util/src/tprocess.c
source/util/src/tprocess.c
+7
-7
source/util/src/tqueue.c
source/util/src/tqueue.c
+9
-9
source/util/src/tref.c
source/util/src/tref.c
+9
-9
source/util/src/tsched.c
source/util/src/tsched.c
+6
-6
source/util/src/tskiplist.c
source/util/src/tskiplist.c
+9
-9
source/util/src/tstrbuild.c
source/util/src/tstrbuild.c
+2
-2
source/util/src/tthread.c
source/util/src/tthread.c
+3
-3
source/util/src/ttimer.c
source/util/src/ttimer.c
+9
-9
source/util/src/tutil.c
source/util/src/tutil.c
+3
-3
source/util/src/tworker.c
source/util/src/tworker.c
+4
-4
source/util/test/hashTest.cpp
source/util/test/hashTest.cpp
+4
-4
source/util/test/skiplistTest.cpp
source/util/test/skiplistTest.cpp
+15
-15
source/util/test/stringTest.cpp
source/util/test/stringTest.cpp
+8
-8
source/util/test/trefTest.c
source/util/test/trefTest.c
+9
-9
tests/script/api/batchprepare.c
tests/script/api/batchprepare.c
+235
-235
tests/script/api/stmtBatchTest.c
tests/script/api/stmtBatchTest.c
+284
-284
tests/script/api/stmtTest.c
tests/script/api/stmtTest.c
+1
-1
tests/script/api/stmt_function.c
tests/script/api/stmt_function.c
+33
-33
tests/script/http/httpTest.c
tests/script/http/httpTest.c
+6
-6
tests/script/http/httpTestSqlUtc.c
tests/script/http/httpTestSqlUtc.c
+6
-6
tests/script/http/httpTestSqlt.c
tests/script/http/httpTestSqlt.c
+6
-6
tests/script/sh/sum_double.c
tests/script/sh/sum_double.c
+2
-2
tests/test/c/create_table.c
tests/test/c/create_table.c
+4
-4
tests/test/c/tmqDemo.c
tests/test/c/tmqDemo.c
+8
-8
tests/tsim/src/simParse.c
tests/tsim/src/simParse.c
+4
-4
tests/tsim/src/simSystem.c
tests/tsim/src/simSystem.c
+6
-6
tools/shell/src/backup/shellCheck.c
tools/shell/src/backup/shellCheck.c
+6
-6
tools/shell/src/backup/shellDarwin.c
tools/shell/src/backup/shellDarwin.c
+8
-8
tools/shell/src/backup/shellImport.c
tools/shell/src/backup/shellImport.c
+12
-12
tools/shell/src/backup/shellWindows.c
tools/shell/src/backup/shellWindows.c
+8
-8
tools/shell/src/shellCommand.c
tools/shell/src/shellCommand.c
+5
-5
tools/shell/src/shellEngine.c
tools/shell/src/shellEngine.c
+9
-9
tools/shell/src/shellMain.c
tools/shell/src/shellMain.c
+8
-8
tools/shell/src/tnettest.c
tools/shell/src/tnettest.c
+9
-9
未找到文件。
include/common/tcommon.h
浏览文件 @
222db126
...
...
@@ -104,16 +104,16 @@ static FORCE_INLINE void blockDestroyInner(SSDataBlock* pBlock) {
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
SColumnInfoData
*
pColInfoData
=
(
SColumnInfoData
*
)
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
if
(
IS_VAR_DATA_TYPE
(
pColInfoData
->
info
.
type
))
{
t
free
(
pColInfoData
->
varmeta
.
offset
);
t
aosMemoryFreeClear
(
pColInfoData
->
varmeta
.
offset
);
}
else
{
t
free
(
pColInfoData
->
nullbitmap
);
t
aosMemoryFreeClear
(
pColInfoData
->
nullbitmap
);
}
t
free
(
pColInfoData
->
pData
);
t
aosMemoryFreeClear
(
pColInfoData
->
pData
);
}
taosArrayDestroy
(
pBlock
->
pDataBlock
);
t
free
(
pBlock
->
pBlockAgg
);
t
aosMemoryFreeClear
(
pBlock
->
pBlockAgg
);
}
static
FORCE_INLINE
void
tDeleteSSDataBlock
(
SSDataBlock
*
pBlock
)
{
blockDestroyInner
(
pBlock
);
}
...
...
@@ -147,7 +147,7 @@ static FORCE_INLINE void* tDecodeSMqPollRsp(void* buf, SMqPollRsp* pRsp) {
buf
=
taosDecodeFixedI32
(
buf
,
&
pRsp
->
skipLogNum
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pRsp
->
numOfTopics
);
if
(
pRsp
->
numOfTopics
==
0
)
return
buf
;
pRsp
->
schema
=
(
SSchemaWrapper
*
)
c
alloc
(
1
,
sizeof
(
SSchemaWrapper
));
pRsp
->
schema
=
(
SSchemaWrapper
*
)
taosMemoryC
alloc
(
1
,
sizeof
(
SSchemaWrapper
));
if
(
pRsp
->
schema
==
NULL
)
return
NULL
;
buf
=
tDecodeSSchemaWrapper
(
buf
,
pRsp
->
schema
);
buf
=
taosDecodeFixedI32
(
buf
,
&
sz
);
...
...
@@ -163,9 +163,9 @@ static FORCE_INLINE void* tDecodeSMqPollRsp(void* buf, SMqPollRsp* pRsp) {
static
FORCE_INLINE
void
tDeleteSMqConsumeRsp
(
SMqPollRsp
*
pRsp
)
{
if
(
pRsp
->
schema
)
{
if
(
pRsp
->
schema
->
nCols
)
{
t
free
(
pRsp
->
schema
->
pSchema
);
t
aosMemoryFreeClear
(
pRsp
->
schema
->
pSchema
);
}
f
ree
(
pRsp
->
schema
);
taosMemoryF
ree
(
pRsp
->
schema
);
}
taosArrayDestroyEx
(
pRsp
->
pBlockData
,
(
void
(
*
)(
void
*
))
blockDestroyInner
);
pRsp
->
pBlockData
=
NULL
;
...
...
include/common/tdataformat.h
浏览文件 @
222db126
...
...
@@ -93,7 +93,7 @@ typedef struct {
#define schemaFLen(s) ((s)->flen)
#define schemaVLen(s) ((s)->vlen)
#define schemaColAt(s, i) ((s)->columns + i)
#define tdFreeSchema(s) t
free
((s))
#define tdFreeSchema(s) t
aosMemoryFreeClear
((s))
STSchema
*
tdDupSchema
(
const
STSchema
*
pSchema
);
int32_t
tdEncodeSchema
(
void
**
buf
,
STSchema
*
pSchema
);
...
...
@@ -493,7 +493,7 @@ typedef struct {
#define kvRowCpy(dst, r) memcpy((dst), (r), kvRowLen(r))
#define kvRowColVal(r, colIdx) POINTER_SHIFT(kvRowValues(r), (colIdx)->offset)
#define kvRowColIdxAt(r, i) (kvRowColIdx(r) + (i))
#define kvRowFree(r) t
free
(r)
#define kvRowFree(r) t
aosMemoryFreeClear
(r)
#define kvRowEnd(r) POINTER_SHIFT(r, kvRowLen(r))
#define kvRowValLen(r) (kvRowLen(r) - TD_KV_ROW_HEAD_SIZE - sizeof(SColIdx) * kvRowNCols(r))
#define kvRowTKey(r) (*(TKEY *)(kvRowValues(r)))
...
...
@@ -593,7 +593,7 @@ SKVRow tdGetKVRowFromBuilder(SKVRowBuilder *pBuilder);
static
FORCE_INLINE
int32_t
tdAddColToKVRow
(
SKVRowBuilder
*
pBuilder
,
int16_t
colId
,
int8_t
type
,
const
void
*
value
)
{
if
(
pBuilder
->
nCols
>=
pBuilder
->
tCols
)
{
pBuilder
->
tCols
*=
2
;
SColIdx
*
pColIdx
=
(
SColIdx
*
)
r
ealloc
((
void
*
)(
pBuilder
->
pColIdx
),
sizeof
(
SColIdx
)
*
pBuilder
->
tCols
);
SColIdx
*
pColIdx
=
(
SColIdx
*
)
taosMemoryR
ealloc
((
void
*
)(
pBuilder
->
pColIdx
),
sizeof
(
SColIdx
)
*
pBuilder
->
tCols
);
if
(
pColIdx
==
NULL
)
return
-
1
;
pBuilder
->
pColIdx
=
pColIdx
;
}
...
...
@@ -608,7 +608,7 @@ static FORCE_INLINE int32_t tdAddColToKVRow(SKVRowBuilder *pBuilder, int16_t col
while
(
tlen
>
pBuilder
->
alloc
-
pBuilder
->
size
)
{
pBuilder
->
alloc
*=
2
;
}
void
*
buf
=
r
ealloc
(
pBuilder
->
buf
,
pBuilder
->
alloc
);
void
*
buf
=
taosMemoryR
ealloc
(
pBuilder
->
buf
,
pBuilder
->
alloc
);
if
(
buf
==
NULL
)
return
-
1
;
pBuilder
->
buf
=
buf
;
}
...
...
include/common/tmsg.h
浏览文件 @
222db126
...
...
@@ -1309,7 +1309,7 @@ typedef struct {
}
SMqRebSubscribe
;
static
FORCE_INLINE
SMqRebSubscribe
*
tNewSMqRebSubscribe
(
const
char
*
key
)
{
SMqRebSubscribe
*
pRebSub
=
(
SMqRebSubscribe
*
)
c
alloc
(
1
,
sizeof
(
SMqRebSubscribe
));
SMqRebSubscribe
*
pRebSub
=
(
SMqRebSubscribe
*
)
taosMemoryC
alloc
(
1
,
sizeof
(
SMqRebSubscribe
));
if
(
pRebSub
==
NULL
)
{
goto
_err
;
}
...
...
@@ -1331,7 +1331,7 @@ _err:
taosArrayDestroy
(
pRebSub
->
lostConsumers
);
taosArrayDestroy
(
pRebSub
->
removedConsumers
);
taosArrayDestroy
(
pRebSub
->
newConsumers
);
t
free
(
pRebSub
);
t
aosMemoryFreeClear
(
pRebSub
);
return
NULL
;
}
...
...
@@ -1632,7 +1632,7 @@ static FORCE_INLINE void tFreeReqKvHash(SHashObj* info) {
void
*
pIter
=
taosHashIterate
(
info
,
NULL
);
while
(
pIter
!=
NULL
)
{
SKv
*
kv
=
(
SKv
*
)
pIter
;
t
free
(
kv
->
value
);
t
aosMemoryFreeClear
(
kv
->
value
);
pIter
=
taosHashIterate
(
info
,
pIter
);
}
}
...
...
@@ -1655,13 +1655,13 @@ static FORCE_INLINE void tFreeClientHbBatchReq(void* pReq, bool deep) {
}
else
{
taosArrayDestroy
(
req
->
reqs
);
}
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
}
static
FORCE_INLINE
void
tFreeClientKv
(
void
*
pKv
)
{
SKv
*
kv
=
(
SKv
*
)
pKv
;
if
(
kv
)
{
t
free
(
kv
->
value
);
t
aosMemoryFreeClear
(
kv
->
value
);
}
}
...
...
@@ -1688,7 +1688,7 @@ static FORCE_INLINE int32_t tEncodeSKv(SCoder* pEncoder, const SKv* pKv) {
static
FORCE_INLINE
int32_t
tDecodeSKv
(
SCoder
*
pDecoder
,
SKv
*
pKv
)
{
if
(
tDecodeI32
(
pDecoder
,
&
pKv
->
key
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pKv
->
valueLen
)
<
0
)
return
-
1
;
pKv
->
value
=
m
alloc
(
pKv
->
valueLen
+
1
);
pKv
->
value
=
taosMemoryM
alloc
(
pKv
->
valueLen
+
1
);
if
(
pKv
->
value
==
NULL
)
return
-
1
;
if
(
tDecodeCStrTo
(
pDecoder
,
(
char
*
)
pKv
->
value
)
<
0
)
return
-
1
;
return
0
;
...
...
@@ -1942,7 +1942,7 @@ static FORCE_INLINE int32_t tEncodeSSchemaWrapper(void** buf, const SSchemaWrapp
static
FORCE_INLINE
void
*
tDecodeSSchemaWrapper
(
void
*
buf
,
SSchemaWrapper
*
pSW
)
{
buf
=
taosDecodeFixedU32
(
buf
,
&
pSW
->
nCols
);
pSW
->
pSchema
=
(
SSchema
*
)
c
alloc
(
pSW
->
nCols
,
sizeof
(
SSchema
));
pSW
->
pSchema
=
(
SSchema
*
)
taosMemoryC
alloc
(
pSW
->
nCols
,
sizeof
(
SSchema
));
if
(
pSW
->
pSchema
==
NULL
)
{
return
NULL
;
}
...
...
@@ -2077,8 +2077,8 @@ typedef struct {
static
FORCE_INLINE
void
tdDestroyTSma
(
STSma
*
pSma
)
{
if
(
pSma
)
{
t
free
(
pSma
->
expr
);
t
free
(
pSma
->
tagsFilter
);
t
aosMemoryFreeClear
(
pSma
->
expr
);
t
aosMemoryFreeClear
(
pSma
->
tagsFilter
);
}
}
...
...
@@ -2088,14 +2088,14 @@ static FORCE_INLINE void tdDestroyTSmaWrapper(STSmaWrapper* pSW) {
for
(
uint32_t
i
=
0
;
i
<
pSW
->
number
;
++
i
)
{
tdDestroyTSma
(
pSW
->
tSma
+
i
);
}
t
free
(
pSW
->
tSma
);
t
aosMemoryFreeClear
(
pSW
->
tSma
);
}
}
}
static
FORCE_INLINE
void
tdFreeTSmaWrapper
(
STSmaWrapper
*
pSW
)
{
tdDestroyTSmaWrapper
(
pSW
);
t
free
(
pSW
);
t
aosMemoryFreeClear
(
pSW
);
}
static
FORCE_INLINE
int32_t
tEncodeTSma
(
void
**
buf
,
const
STSma
*
pSma
)
{
...
...
@@ -2173,7 +2173,7 @@ static FORCE_INLINE void* tDecodeTSma(void* buf, STSma* pSma) {
static
FORCE_INLINE
void
*
tDecodeTSmaWrapper
(
void
*
buf
,
STSmaWrapper
*
pSW
)
{
buf
=
taosDecodeFixedU32
(
buf
,
&
pSW
->
number
);
pSW
->
tSma
=
(
STSma
*
)
c
alloc
(
pSW
->
number
,
sizeof
(
STSma
));
pSW
->
tSma
=
(
STSma
*
)
taosMemoryC
alloc
(
pSW
->
number
,
sizeof
(
STSma
));
if
(
pSW
->
tSma
==
NULL
)
{
return
NULL
;
}
...
...
@@ -2183,7 +2183,7 @@ static FORCE_INLINE void* tDecodeTSmaWrapper(void* buf, STSmaWrapper* pSW) {
for
(
uint32_t
j
=
i
;
j
>=
0
;
--
i
)
{
tdDestroyTSma
(
pSW
->
tSma
+
j
);
}
f
ree
(
pSW
->
tSma
);
taosMemoryF
ree
(
pSW
->
tSma
);
return
NULL
;
}
}
...
...
include/libs/transport/trpc.h
浏览文件 @
222db126
...
...
@@ -83,7 +83,7 @@ typedef struct SRpcInit {
typedef
struct
{
void
*
val
;
int32_t
len
;
void
(
*
free
)(
void
*
arg
);
void
(
*
free
Func
)(
const
void
*
arg
);
}
SRpcCtxVal
;
typedef
struct
{
...
...
include/os/osMemory.h
浏览文件 @
222db126
...
...
@@ -20,12 +20,25 @@
extern
"C"
{
#endif
#define tfree(x) \
do { \
if (x) { \
free((void *)(x)); \
(x) = 0; \
} \
// If the error is in a third-party library, place this header file under the third-party library header file.
// When you want to use this feature, you should find or add the same function in the following sectio
#ifndef ALLOW_FORBID_FUNC
#define malloc MALLOC_FUNC_TAOS_FORBID
#define calloc CALLOC_FUNC_TAOS_FORBID
#define realloc REALLOC_FUNC_TAOS_FORBID
#define free FREE_FUNC_TAOS_FORBID
#endif
void
*
taosMemoryMalloc
(
int32_t
size
);
void
*
taosMemoryCalloc
(
int32_t
num
,
int32_t
size
);
void
*
taosMemoryRealloc
(
void
*
ptr
,
int32_t
size
);
void
taosMemoryFree
(
const
void
*
ptr
);
int32_t
taosMemorySize
(
void
*
ptr
);
#define taosMemoryFreeClear(ptr) \
do { \
taosMemoryFree(ptr); \
(ptr)=NULL; \
} while (0)
#ifdef __cplusplus
...
...
include/util/tcoding.h
浏览文件 @
222db126
...
...
@@ -351,7 +351,7 @@ static FORCE_INLINE void *taosDecodeString(const void *buf, char **value) {
uint64_t
size
=
0
;
buf
=
taosDecodeVariantU64
(
buf
,
&
size
);
*
value
=
(
char
*
)
m
alloc
((
size_t
)
size
+
1
);
*
value
=
(
char
*
)
taosMemoryM
alloc
((
size_t
)
size
+
1
);
if
(
*
value
==
NULL
)
return
NULL
;
memcpy
(
*
value
,
buf
,
(
size_t
)
size
);
...
...
@@ -386,7 +386,7 @@ static FORCE_INLINE int32_t taosEncodeBinary(void **buf, const void *value, int3
}
static
FORCE_INLINE
void
*
taosDecodeBinary
(
const
void
*
buf
,
void
**
value
,
int32_t
valueLen
)
{
*
value
=
m
alloc
((
size_t
)
valueLen
);
*
value
=
taosMemoryM
alloc
((
size_t
)
valueLen
);
if
(
*
value
==
NULL
)
return
NULL
;
memcpy
(
*
value
,
buf
,
(
size_t
)
valueLen
);
...
...
include/util/tencode.h
浏览文件 @
222db126
...
...
@@ -406,7 +406,7 @@ static FORCE_INLINE int32_t tDecodeBinaryAlloc(SCoder* pDecoder, void** val, uin
if
(
tDecodeU64v
(
pDecoder
,
len
)
<
0
)
return
-
1
;
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
pDecoder
,
*
len
))
return
-
1
;
*
val
=
m
alloc
(
*
len
);
*
val
=
taosMemoryM
alloc
(
*
len
);
if
(
*
val
==
NULL
)
return
-
1
;
memcpy
(
*
val
,
TD_CODER_CURRENT
(
pDecoder
),
*
len
);
...
...
include/util/tfreelist.h
浏览文件 @
222db126
...
...
@@ -31,7 +31,7 @@ typedef TD_SLIST(SFreeListNode) SFreeList;
#define TFL_MALLOC(PTR, TYPE, SIZE, LIST) \
do { \
void *ptr =
m
alloc((SIZE) + sizeof(struct SFreeListNode)); \
void *ptr =
taosMemoryM
alloc((SIZE) + sizeof(struct SFreeListNode)); \
if (ptr) { \
TD_SLIST_PUSH((LIST), (struct SFreeListNode *)ptr); \
ptr = ((struct SFreeListNode *)ptr)->payload; \
...
...
@@ -49,7 +49,7 @@ static FORCE_INLINE void tFreeListClear(SFreeList *pFL) {
pNode
=
TD_SLIST_HEAD
(
pFL
);
if
(
pNode
==
NULL
)
break
;
TD_SLIST_POP
(
pFL
);
f
ree
(
pNode
);
taosMemoryF
ree
(
pNode
);
}
}
...
...
include/util/tlist.h
浏览文件 @
222db126
...
...
@@ -216,7 +216,7 @@ typedef struct {
#define listNEles(l) TD_DLIST_NELES(l)
#define listEleSize(l) ((l)->eleSize)
#define isListEmpty(l) (TD_DLIST_NELES(l) == 0)
#define listNodeFree(n)
f
ree(n)
#define listNodeFree(n)
taosMemoryF
ree(n)
void
tdListInit
(
SList
*
list
,
int32_t
eleSize
);
void
tdListEmpty
(
SList
*
list
);
...
...
source/client/src/clientEnv.c
浏览文件 @
222db126
...
...
@@ -115,11 +115,11 @@ void destroyTscObj(void *pObj) {
atomic_sub_fetch_64
(
&
pTscObj
->
pAppInfo
->
numOfConns
,
1
);
tscDebug
(
"connObj 0x%"
PRIx64
" destroyed, totalConn:%"
PRId64
,
pTscObj
->
id
,
pTscObj
->
pAppInfo
->
numOfConns
);
taosThreadMutexDestroy
(
&
pTscObj
->
mutex
);
t
free
(
pTscObj
);
t
aosMemoryFreeClear
(
pTscObj
);
}
void
*
createTscObj
(
const
char
*
user
,
const
char
*
auth
,
const
char
*
db
,
SAppInstInfo
*
pAppInfo
)
{
STscObj
*
pObj
=
(
STscObj
*
)
c
alloc
(
1
,
sizeof
(
STscObj
));
STscObj
*
pObj
=
(
STscObj
*
)
taosMemoryC
alloc
(
1
,
sizeof
(
STscObj
));
if
(
NULL
==
pObj
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
NULL
;
...
...
@@ -143,7 +143,7 @@ void *createTscObj(const char *user, const char *auth, const char *db, SAppInstI
void
*
createRequest
(
STscObj
*
pObj
,
__taos_async_fn_t
fp
,
void
*
param
,
int32_t
type
)
{
assert
(
pObj
!=
NULL
);
SRequestObj
*
pRequest
=
(
SRequestObj
*
)
c
alloc
(
1
,
sizeof
(
SRequestObj
));
SRequestObj
*
pRequest
=
(
SRequestObj
*
)
taosMemoryC
alloc
(
1
,
sizeof
(
SRequestObj
));
if
(
NULL
==
pRequest
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
NULL
;
...
...
@@ -156,7 +156,7 @@ void *createRequest(STscObj *pObj, __taos_async_fn_t fp, void *param, int32_t ty
pRequest
->
type
=
type
;
pRequest
->
pTscObj
=
pObj
;
pRequest
->
body
.
fp
=
fp
;
// not used it yet
pRequest
->
msgBuf
=
c
alloc
(
1
,
ERROR_MSG_BUF_DEFAULT_SIZE
);
pRequest
->
msgBuf
=
taosMemoryC
alloc
(
1
,
ERROR_MSG_BUF_DEFAULT_SIZE
);
tsem_init
(
&
pRequest
->
body
.
rspSem
,
0
,
0
);
registerRequest
(
pRequest
);
...
...
@@ -164,17 +164,17 @@ void *createRequest(STscObj *pObj, __taos_async_fn_t fp, void *param, int32_t ty
}
static
void
doFreeReqResultInfo
(
SReqResultInfo
*
pResInfo
)
{
t
free
(
pResInfo
->
pRspMsg
);
t
free
(
pResInfo
->
length
);
t
free
(
pResInfo
->
row
);
t
free
(
pResInfo
->
pCol
);
t
free
(
pResInfo
->
fields
);
t
aosMemoryFreeClear
(
pResInfo
->
pRspMsg
);
t
aosMemoryFreeClear
(
pResInfo
->
length
);
t
aosMemoryFreeClear
(
pResInfo
->
row
);
t
aosMemoryFreeClear
(
pResInfo
->
pCol
);
t
aosMemoryFreeClear
(
pResInfo
->
fields
);
if
(
pResInfo
->
convertBuf
!=
NULL
)
{
for
(
int32_t
i
=
0
;
i
<
pResInfo
->
numOfCols
;
++
i
)
{
t
free
(
pResInfo
->
convertBuf
[
i
]);
t
aosMemoryFreeClear
(
pResInfo
->
convertBuf
[
i
]);
}
t
free
(
pResInfo
->
convertBuf
);
t
aosMemoryFreeClear
(
pResInfo
->
convertBuf
);
}
}
...
...
@@ -184,10 +184,10 @@ static void doDestroyRequest(void *p) {
assert
(
RID_VALID
(
pRequest
->
self
));
t
free
(
pRequest
->
msgBuf
);
t
free
(
pRequest
->
sqlstr
);
t
free
(
pRequest
->
pInfo
);
t
free
(
pRequest
->
pDb
);
t
aosMemoryFreeClear
(
pRequest
->
msgBuf
);
t
aosMemoryFreeClear
(
pRequest
->
sqlstr
);
t
aosMemoryFreeClear
(
pRequest
->
pInfo
);
t
aosMemoryFreeClear
(
pRequest
->
pDb
);
doFreeReqResultInfo
(
&
pRequest
->
body
.
resInfo
);
qDestroyQueryPlan
(
pRequest
->
body
.
pDag
);
...
...
@@ -197,7 +197,7 @@ static void doDestroyRequest(void *p) {
}
deregisterRequest
(
pRequest
);
t
free
(
pRequest
);
t
aosMemoryFreeClear
(
pRequest
);
}
void
destroyRequest
(
SRequestObj
*
pRequest
)
{
...
...
@@ -356,7 +356,7 @@ int taos_options_imp(TSDB_OPTION option, const char *str) {
tscInfo("charset:%s is not valid in locale, charset remains:%s", charset, tsCharset);
}
f
ree(charset);
taosMemoryF
ree(charset);
} else { // it may be windows system
tscInfo("charset remains:%s", tsCharset);
}
...
...
source/client/src/clientHb.c
浏览文件 @
222db126
...
...
@@ -166,7 +166,7 @@ static int32_t hbQueryHbRspHandle(SAppHbMgr *pAppHbMgr, SClientHbRsp *pRsp) {
static
int32_t
hbAsyncCallBack
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
static
int32_t
emptyRspNum
=
0
;
if
(
code
!=
0
)
{
t
free
(
param
);
t
aosMemoryFreeClear
(
param
);
return
-
1
;
}
...
...
@@ -179,12 +179,12 @@ static int32_t hbAsyncCallBack(void *param, const SDataBuf *pMsg, int32_t code)
SAppInstInfo
**
pInst
=
taosHashGet
(
appInfo
.
pInstMap
,
key
,
strlen
(
key
));
if
(
pInst
==
NULL
||
NULL
==
*
pInst
)
{
tscError
(
"cluster not exist, key:%s"
,
key
);
t
free
(
param
);
t
aosMemoryFreeClear
(
param
);
tFreeClientHbBatchRsp
(
&
pRsp
);
return
-
1
;
}
t
free
(
param
);
t
aosMemoryFreeClear
(
param
);
if
(
rspNum
)
{
tscDebug
(
"hb got %d rsp, %d empty rsp received before"
,
rspNum
,
...
...
@@ -317,7 +317,7 @@ void hbFreeReq(void *req) {
}
SClientHbBatchReq
*
hbGatherAllInfo
(
SAppHbMgr
*
pAppHbMgr
)
{
SClientHbBatchReq
*
pBatchReq
=
c
alloc
(
1
,
sizeof
(
SClientHbBatchReq
));
SClientHbBatchReq
*
pBatchReq
=
taosMemoryC
alloc
(
1
,
sizeof
(
SClientHbBatchReq
));
if
(
pBatchReq
==
NULL
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
NULL
;
...
...
@@ -346,7 +346,7 @@ SClientHbBatchReq *hbGatherAllInfo(SAppHbMgr *pAppHbMgr) {
if
(
code
)
{
taosArrayDestroyEx
(
pBatchReq
->
reqs
,
hbFreeReq
);
t
free
(
pBatchReq
);
t
aosMemoryFreeClear
(
pBatchReq
);
}
return
pBatchReq
;
...
...
@@ -387,7 +387,7 @@ static void *hbThreadFunc(void *param) {
continue
;
}
int
tlen
=
tSerializeSClientHbBatchReq
(
NULL
,
0
,
pReq
);
void
*
buf
=
m
alloc
(
tlen
);
void
*
buf
=
taosMemoryM
alloc
(
tlen
);
if
(
buf
==
NULL
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
tFreeClientHbBatchReq
(
pReq
,
false
);
...
...
@@ -396,13 +396,13 @@ static void *hbThreadFunc(void *param) {
}
tSerializeSClientHbBatchReq
(
buf
,
tlen
,
pReq
);
SMsgSendInfo
*
pInfo
=
c
alloc
(
1
,
sizeof
(
SMsgSendInfo
));
SMsgSendInfo
*
pInfo
=
taosMemoryC
alloc
(
1
,
sizeof
(
SMsgSendInfo
));
if
(
pInfo
==
NULL
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
tFreeClientHbBatchReq
(
pReq
,
false
);
hbClearReqInfo
(
pAppHbMgr
);
f
ree
(
buf
);
taosMemoryF
ree
(
buf
);
break
;
}
pInfo
->
fp
=
hbAsyncCallBack
;
...
...
@@ -458,7 +458,7 @@ static void hbStopThread() {
SAppHbMgr
*
appHbMgrInit
(
SAppInstInfo
*
pAppInstInfo
,
char
*
key
)
{
hbMgrInit
();
SAppHbMgr
*
pAppHbMgr
=
m
alloc
(
sizeof
(
SAppHbMgr
));
SAppHbMgr
*
pAppHbMgr
=
taosMemoryM
alloc
(
sizeof
(
SAppHbMgr
));
if
(
pAppHbMgr
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
...
...
@@ -478,7 +478,7 @@ SAppHbMgr *appHbMgrInit(SAppInstInfo *pAppInstInfo, char *key) {
if
(
pAppHbMgr
->
activeInfo
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
f
ree
(
pAppHbMgr
);
taosMemoryF
ree
(
pAppHbMgr
);
return
NULL
;
}
...
...
@@ -488,7 +488,7 @@ SAppHbMgr *appHbMgrInit(SAppInstInfo *pAppInstInfo, char *key) {
if
(
pAppHbMgr
->
connInfo
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
f
ree
(
pAppHbMgr
);
taosMemoryF
ree
(
pAppHbMgr
);
return
NULL
;
}
...
...
@@ -580,7 +580,7 @@ int hbRegisterConn(SAppHbMgr *pAppHbMgr, int32_t connId, int64_t clusterId, int3
switch
(
hbType
)
{
case
HEARTBEAT_TYPE_QUERY
:
{
int64_t
*
pClusterId
=
m
alloc
(
sizeof
(
int64_t
));
int64_t
*
pClusterId
=
taosMemoryM
alloc
(
sizeof
(
int64_t
));
*
pClusterId
=
clusterId
;
info
.
param
=
pClusterId
;
...
...
source/client/src/clientImpl.c
浏览文件 @
222db126
...
...
@@ -100,7 +100,7 @@ TAOS* taos_connect_internal(const char* ip, const char* user, const char* pass,
pInst
=
taosHashGet
(
appInfo
.
pInstMap
,
key
,
strlen
(
key
));
SAppInstInfo
*
p
=
NULL
;
if
(
pInst
==
NULL
)
{
p
=
c
alloc
(
1
,
sizeof
(
struct
SAppInstInfo
));
p
=
taosMemoryC
alloc
(
1
,
sizeof
(
struct
SAppInstInfo
));
p
->
mgmtEp
=
epSet
;
p
->
pTransporter
=
openTransporter
(
user
,
secretEncrypt
,
tsNumOfCores
);
p
->
pAppHbMgr
=
appHbMgrInit
(
p
,
key
);
...
...
@@ -111,7 +111,7 @@ TAOS* taos_connect_internal(const char* ip, const char* user, const char* pass,
taosThreadMutexUnlock
(
&
appInfo
.
mutex
);
t
free
(
key
);
t
aosMemoryFreeClear
(
key
);
return
taosConnectImpl
(
user
,
&
secretEncrypt
[
0
],
localDb
,
NULL
,
NULL
,
*
pInst
);
}
...
...
@@ -122,7 +122,7 @@ int32_t buildRequest(STscObj* pTscObj, const char* sql, int sqlLen, SRequestObj*
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
(
*
pRequest
)
->
sqlstr
=
m
alloc
(
sqlLen
+
1
);
(
*
pRequest
)
->
sqlstr
=
taosMemoryM
alloc
(
sqlLen
+
1
);
if
((
*
pRequest
)
->
sqlstr
==
NULL
)
{
tscError
(
"0x%"
PRIx64
" failed to prepare sql string buffer"
,
(
*
pRequest
)
->
self
);
(
*
pRequest
)
->
msgBuf
=
strdup
(
"failed to prepare sql string buffer"
);
...
...
@@ -212,7 +212,7 @@ void setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32_t
assert
(
pSchema
!=
NULL
&&
numOfCols
>
0
);
pResInfo
->
numOfCols
=
numOfCols
;
pResInfo
->
fields
=
c
alloc
(
numOfCols
,
sizeof
(
pSchema
[
0
]));
pResInfo
->
fields
=
taosMemoryC
alloc
(
numOfCols
,
sizeof
(
pSchema
[
0
]));
for
(
int32_t
i
=
0
;
i
<
pResInfo
->
numOfCols
;
++
i
)
{
pResInfo
->
fields
[
i
].
bytes
=
pSchema
[
i
].
bytes
;
...
...
@@ -421,7 +421,7 @@ STscObj* taosConnectImpl(const char* user, const char* auth, const char* db, __t
}
static
SMsgSendInfo
*
buildConnectMsg
(
SRequestObj
*
pRequest
)
{
SMsgSendInfo
*
pMsgSendInfo
=
c
alloc
(
1
,
sizeof
(
SMsgSendInfo
));
SMsgSendInfo
*
pMsgSendInfo
=
taosMemoryC
alloc
(
1
,
sizeof
(
SMsgSendInfo
));
if
(
pMsgSendInfo
==
NULL
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
NULL
;
...
...
@@ -441,14 +441,14 @@ static SMsgSendInfo* buildConnectMsg(SRequestObj* pRequest) {
if
(
db
!=
NULL
)
{
tstrncpy
(
connectReq
.
db
,
db
,
sizeof
(
connectReq
.
db
));
}
t
free
(
db
);
t
aosMemoryFreeClear
(
db
);
connectReq
.
pid
=
htonl
(
appInfo
.
pid
);
connectReq
.
startTime
=
htobe64
(
appInfo
.
startTime
);
tstrncpy
(
connectReq
.
app
,
appInfo
.
appName
,
sizeof
(
connectReq
.
app
));
int32_t
contLen
=
tSerializeSConnectReq
(
NULL
,
0
,
&
connectReq
);
void
*
pReq
=
m
alloc
(
contLen
);
void
*
pReq
=
taosMemoryM
alloc
(
contLen
);
tSerializeSConnectReq
(
pReq
,
contLen
,
&
connectReq
);
pMsgSendInfo
->
msgInfo
.
len
=
contLen
;
...
...
@@ -458,8 +458,8 @@ static SMsgSendInfo* buildConnectMsg(SRequestObj* pRequest) {
static
void
destroySendMsgInfo
(
SMsgSendInfo
*
pMsgBody
)
{
assert
(
pMsgBody
!=
NULL
);
t
free
(
pMsgBody
->
msgInfo
.
pData
);
t
free
(
pMsgBody
);
t
aosMemoryFreeClear
(
pMsgBody
->
msgInfo
.
pData
);
t
aosMemoryFreeClear
(
pMsgBody
);
}
bool
persistConnForSpecificMsg
(
void
*
parenct
,
tmsg_t
msgType
)
{
return
msgType
==
TDMT_VND_QUERY_RSP
||
msgType
==
TDMT_VND_FETCH_RSP
||
msgType
==
TDMT_VND_RES_READY_RSP
||
msgType
==
TDMT_VND_QUERY_HEARTBEAT_RSP
;
...
...
@@ -500,7 +500,7 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) {
SDataBuf
buf
=
{.
len
=
pMsg
->
contLen
,
.
pData
=
NULL
,
.
handle
=
pMsg
->
handle
};
if
(
pMsg
->
contLen
>
0
)
{
buf
.
pData
=
c
alloc
(
1
,
pMsg
->
contLen
);
buf
.
pData
=
taosMemoryC
alloc
(
1
,
pMsg
->
contLen
);
if
(
buf
.
pData
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
pMsg
->
code
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -592,7 +592,7 @@ void* doFetchRow(SRequestObj* pRequest) {
}
SVgroupInfo
*
pVgroupInfo
=
taosArrayGet
(
pShowReqInfo
->
pArray
,
pShowReqInfo
->
currentIndex
);
SVShowTablesReq
*
pShowReq
=
c
alloc
(
1
,
sizeof
(
SVShowTablesReq
));
SVShowTablesReq
*
pShowReq
=
taosMemoryC
alloc
(
1
,
sizeof
(
SVShowTablesReq
));
pShowReq
->
head
.
vgId
=
htonl
(
pVgroupInfo
->
vgId
);
pRequest
->
body
.
requestMsg
.
len
=
sizeof
(
SVShowTablesReq
);
...
...
@@ -670,10 +670,10 @@ _return:
static
int32_t
doPrepareResPtr
(
SReqResultInfo
*
pResInfo
)
{
if
(
pResInfo
->
row
==
NULL
)
{
pResInfo
->
row
=
c
alloc
(
pResInfo
->
numOfCols
,
POINTER_BYTES
);
pResInfo
->
pCol
=
c
alloc
(
pResInfo
->
numOfCols
,
sizeof
(
SResultColumn
));
pResInfo
->
length
=
c
alloc
(
pResInfo
->
numOfCols
,
sizeof
(
int32_t
));
pResInfo
->
convertBuf
=
c
alloc
(
pResInfo
->
numOfCols
,
POINTER_BYTES
);
pResInfo
->
row
=
taosMemoryC
alloc
(
pResInfo
->
numOfCols
,
POINTER_BYTES
);
pResInfo
->
pCol
=
taosMemoryC
alloc
(
pResInfo
->
numOfCols
,
sizeof
(
SResultColumn
));
pResInfo
->
length
=
taosMemoryC
alloc
(
pResInfo
->
numOfCols
,
sizeof
(
int32_t
));
pResInfo
->
convertBuf
=
taosMemoryC
alloc
(
pResInfo
->
numOfCols
,
POINTER_BYTES
);
if
(
pResInfo
->
row
==
NULL
||
pResInfo
->
pCol
==
NULL
||
pResInfo
->
length
==
NULL
||
pResInfo
->
convertBuf
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -681,7 +681,7 @@ static int32_t doPrepareResPtr(SReqResultInfo* pResInfo) {
for
(
int32_t
i
=
0
;
i
<
pResInfo
->
numOfCols
;
++
i
)
{
if
(
pResInfo
->
fields
[
i
].
type
==
TSDB_DATA_TYPE_NCHAR
)
{
pResInfo
->
convertBuf
[
i
]
=
c
alloc
(
1
,
NCHAR_WIDTH_TO_BYTES
(
pResInfo
->
fields
[
i
].
bytes
));
pResInfo
->
convertBuf
[
i
]
=
taosMemoryC
alloc
(
1
,
NCHAR_WIDTH_TO_BYTES
(
pResInfo
->
fields
[
i
].
bytes
));
}
}
}
...
...
source/client/src/clientMsgHandler.c
浏览文件 @
222db126
...
...
@@ -32,7 +32,7 @@ int32_t genericRspCallback(void* param, const SDataBuf* pMsg, int32_t code) {
SRequestObj
*
pRequest
=
param
;
setErrno
(
pRequest
,
code
);
f
ree
(
pMsg
->
pData
);
taosMemoryF
ree
(
pMsg
->
pData
);
tsem_post
(
&
pRequest
->
body
.
rspSem
);
return
code
;
}
...
...
@@ -40,7 +40,7 @@ int32_t genericRspCallback(void* param, const SDataBuf* pMsg, int32_t code) {
int32_t
processConnectRsp
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
SRequestObj
*
pRequest
=
param
;
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
f
ree
(
pMsg
->
pData
);
taosMemoryF
ree
(
pMsg
->
pData
);
setErrno
(
pRequest
,
code
);
tsem_post
(
&
pRequest
->
body
.
rspSem
);
return
code
;
...
...
@@ -77,13 +77,13 @@ int32_t processConnectRsp(void* param, const SDataBuf* pMsg, int32_t code) {
tscDebug
(
"0x%"
PRIx64
" clusterId:%"
PRId64
", totalConn:%"
PRId64
,
pRequest
->
requestId
,
connectRsp
.
clusterId
,
pTscObj
->
pAppInfo
->
numOfConns
);
f
ree
(
pMsg
->
pData
);
taosMemoryF
ree
(
pMsg
->
pData
);
tsem_post
(
&
pRequest
->
body
.
rspSem
);
return
0
;
}
SMsgSendInfo
*
buildMsgInfoImpl
(
SRequestObj
*
pRequest
)
{
SMsgSendInfo
*
pMsgSendInfo
=
c
alloc
(
1
,
sizeof
(
SMsgSendInfo
));
SMsgSendInfo
*
pMsgSendInfo
=
taosMemoryC
alloc
(
1
,
sizeof
(
SMsgSendInfo
));
pMsgSendInfo
->
requestObjRefId
=
pRequest
->
self
;
pMsgSendInfo
->
requestId
=
pRequest
->
requestId
;
...
...
@@ -96,13 +96,13 @@ SMsgSendInfo* buildMsgInfoImpl(SRequestObj *pRequest) {
retrieveReq
.
showId
=
pRequest
->
body
.
showInfo
.
execId
;
int32_t
contLen
=
tSerializeSRetrieveTableReq
(
NULL
,
0
,
&
retrieveReq
);
void
*
pReq
=
m
alloc
(
contLen
);
void
*
pReq
=
taosMemoryM
alloc
(
contLen
);
tSerializeSRetrieveTableReq
(
pReq
,
contLen
,
&
retrieveReq
);
pMsgSendInfo
->
msgInfo
.
pData
=
pReq
;
pMsgSendInfo
->
msgInfo
.
len
=
contLen
;
pMsgSendInfo
->
msgInfo
.
handle
=
NULL
;
}
else
{
SVShowTablesFetchReq
*
pFetchMsg
=
c
alloc
(
1
,
sizeof
(
SVShowTablesFetchReq
));
SVShowTablesFetchReq
*
pFetchMsg
=
taosMemoryC
alloc
(
1
,
sizeof
(
SVShowTablesFetchReq
));
if
(
pFetchMsg
==
NULL
)
{
return
NULL
;
}
...
...
@@ -135,12 +135,12 @@ int32_t processShowRsp(void* param, const SDataBuf* pMsg, int32_t code) {
tDeserializeSShowRsp
(
pMsg
->
pData
,
pMsg
->
len
,
&
showRsp
);
STableMetaRsp
*
pMetaMsg
=
&
showRsp
.
tableMeta
;
t
free
(
pRequest
->
body
.
resInfo
.
pRspMsg
);
t
aosMemoryFreeClear
(
pRequest
->
body
.
resInfo
.
pRspMsg
);
pRequest
->
body
.
resInfo
.
pRspMsg
=
pMsg
->
pData
;
SReqResultInfo
*
pResInfo
=
&
pRequest
->
body
.
resInfo
;
if
(
pResInfo
->
fields
==
NULL
)
{
TAOS_FIELD
*
pFields
=
c
alloc
(
pMetaMsg
->
numOfColumns
,
sizeof
(
TAOS_FIELD
));
TAOS_FIELD
*
pFields
=
taosMemoryC
alloc
(
pMetaMsg
->
numOfColumns
,
sizeof
(
TAOS_FIELD
));
for
(
int32_t
i
=
0
;
i
<
pMetaMsg
->
numOfColumns
;
++
i
)
{
SSchema
*
pSchema
=
&
pMetaMsg
->
pSchemas
[
i
];
tstrncpy
(
pFields
[
i
].
name
,
pSchema
->
name
,
tListLen
(
pFields
[
i
].
name
));
...
...
@@ -171,7 +171,7 @@ int32_t processShowRsp(void* param, const SDataBuf* pMsg, int32_t code) {
int32_t
processRetrieveMnodeRsp
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
SRequestObj
*
pRequest
=
param
;
SReqResultInfo
*
pResInfo
=
&
pRequest
->
body
.
resInfo
;
t
free
(
pResInfo
->
pRspMsg
);
t
aosMemoryFreeClear
(
pResInfo
->
pRspMsg
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
setErrno
(
pRequest
,
code
);
...
...
@@ -204,7 +204,7 @@ int32_t processRetrieveVndRsp(void* param, const SDataBuf* pMsg, int32_t code) {
SRequestObj
*
pRequest
=
param
;
SReqResultInfo
*
pResInfo
=
&
pRequest
->
body
.
resInfo
;
t
free
(
pResInfo
->
pRspMsg
);
t
aosMemoryFreeClear
(
pResInfo
->
pRspMsg
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
setErrno
(
pRequest
,
code
);
...
...
@@ -237,7 +237,7 @@ int32_t processRetrieveVndRsp(void* param, const SDataBuf* pMsg, int32_t code) {
int32_t
processCreateDbRsp
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
// todo rsp with the vnode id list
SRequestObj
*
pRequest
=
param
;
f
ree
(
pMsg
->
pData
);
taosMemoryF
ree
(
pMsg
->
pData
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
setErrno
(
pRequest
,
code
);
}
...
...
@@ -266,7 +266,7 @@ int32_t processUseDbRsp(void* param, const SDataBuf* pMsg, int32_t code) {
}
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
f
ree
(
pMsg
->
pData
);
taosMemoryF
ree
(
pMsg
->
pData
);
setErrno
(
pRequest
,
code
);
tsem_post
(
&
pRequest
->
body
.
rspSem
);
return
code
;
...
...
@@ -284,7 +284,7 @@ int32_t processUseDbRsp(void* param, const SDataBuf* pMsg, int32_t code) {
if
(
code
!=
0
)
{
terrno
=
code
;
if
(
output
.
dbVgroup
)
taosHashCleanup
(
output
.
dbVgroup
->
vgHash
);
t
free
(
output
.
dbVgroup
);
t
aosMemoryFreeClear
(
output
.
dbVgroup
);
tscError
(
"failed to build use db output since %s"
,
terrstr
());
}
else
{
...
...
@@ -304,7 +304,7 @@ int32_t processUseDbRsp(void* param, const SDataBuf* pMsg, int32_t code) {
tNameGetDbName
(
&
name
,
db
);
setConnectionDB
(
pRequest
->
pTscObj
,
db
);
f
ree
(
pMsg
->
pData
);
taosMemoryF
ree
(
pMsg
->
pData
);
tsem_post
(
&
pRequest
->
body
.
rspSem
);
return
0
;
}
...
...
@@ -313,7 +313,7 @@ int32_t processCreateTableRsp(void* param, const SDataBuf* pMsg, int32_t code) {
assert
(
pMsg
!=
NULL
&&
param
!=
NULL
);
SRequestObj
*
pRequest
=
param
;
f
ree
(
pMsg
->
pData
);
taosMemoryF
ree
(
pMsg
->
pData
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
setErrno
(
pRequest
,
code
);
tsem_post
(
&
pRequest
->
body
.
rspSem
);
...
...
source/client/src/tmq.c
浏览文件 @
222db126
...
...
@@ -136,14 +136,14 @@ typedef struct {
}
SMqCommitCbParam
;
tmq_conf_t
*
tmq_conf_new
()
{
tmq_conf_t
*
conf
=
c
alloc
(
1
,
sizeof
(
tmq_conf_t
));
tmq_conf_t
*
conf
=
taosMemoryC
alloc
(
1
,
sizeof
(
tmq_conf_t
));
conf
->
auto_commit
=
false
;
conf
->
resetOffset
=
TMQ_CONF__RESET_OFFSET__EARLIEAST
;
return
conf
;
}
void
tmq_conf_destroy
(
tmq_conf_t
*
conf
)
{
if
(
conf
)
f
ree
(
conf
);
if
(
conf
)
taosMemoryF
ree
(
conf
);
}
tmq_conf_res_t
tmq_conf_set
(
tmq_conf_t
*
conf
,
const
char
*
key
,
const
char
*
value
)
{
...
...
@@ -184,7 +184,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
}
tmq_list_t
*
tmq_list_new
()
{
tmq_list_t
*
ptr
=
m
alloc
(
sizeof
(
tmq_list_t
)
+
8
*
sizeof
(
char
*
));
tmq_list_t
*
ptr
=
taosMemoryM
alloc
(
sizeof
(
tmq_list_t
)
+
8
*
sizeof
(
char
*
));
if
(
ptr
==
NULL
)
{
return
ptr
;
}
...
...
@@ -254,7 +254,7 @@ tmq_resp_err_t tmq_unsubscribe(tmq_t* tmq) {
}
tmq_t
*
tmq_consumer_new
(
void
*
conn
,
tmq_conf_t
*
conf
,
char
*
errstr
,
int32_t
errstrLen
)
{
tmq_t
*
pTmq
=
c
alloc
(
sizeof
(
tmq_t
),
1
);
tmq_t
*
pTmq
=
taosMemoryC
alloc
(
sizeof
(
tmq_t
),
1
);
if
(
pTmq
==
NULL
)
{
return
NULL
;
}
...
...
@@ -317,7 +317,7 @@ tmq_resp_err_t tmq_commit(tmq_t* tmq, const tmq_topic_vgroup_list_t* offsets, in
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
NULL
,
0
,
TD_ENCODER
);
tEncodeSMqCMCommitOffsetReq
(
&
encoder
,
&
req
);
int32_t
tlen
=
encoder
.
pos
;
void
*
buf
=
m
alloc
(
tlen
);
void
*
buf
=
taosMemoryM
alloc
(
tlen
);
if
(
buf
==
NULL
)
{
tCoderClear
(
&
encoder
);
return
-
1
;
...
...
@@ -333,7 +333,7 @@ tmq_resp_err_t tmq_commit(tmq_t* tmq, const tmq_topic_vgroup_list_t* offsets, in
tscError
(
"failed to malloc request"
);
}
SMqCommitCbParam
*
pParam
=
m
alloc
(
sizeof
(
SMqCommitCbParam
));
SMqCommitCbParam
*
pParam
=
taosMemoryM
alloc
(
sizeof
(
SMqCommitCbParam
));
if
(
pParam
==
NULL
)
{
return
-
1
;
}
...
...
@@ -361,7 +361,7 @@ tmq_resp_err_t tmq_commit(tmq_t* tmq, const tmq_topic_vgroup_list_t* offsets, in
}
tsem_destroy
(
&
pParam
->
rspSem
);
f
ree
(
pParam
);
taosMemoryF
ree
(
pParam
);
if
(
pArray
)
{
taosArrayDestroy
(
pArray
);
...
...
@@ -394,7 +394,7 @@ tmq_resp_err_t tmq_subscribe(tmq_t* tmq, tmq_list_t* topic_list) {
tNameSetDbName
(
&
name
,
tmq
->
pTscObj
->
acctId
,
dbName
,
strlen
(
dbName
));
tNameFromString
(
&
name
,
topicName
,
T_NAME_TABLE
);
char
*
topicFname
=
c
alloc
(
1
,
TSDB_TOPIC_FNAME_LEN
);
char
*
topicFname
=
taosMemoryC
alloc
(
1
,
TSDB_TOPIC_FNAME_LEN
);
if
(
topicFname
==
NULL
)
{
goto
_return
;
}
...
...
@@ -405,11 +405,11 @@ tmq_resp_err_t tmq_subscribe(tmq_t* tmq, tmq_list_t* topic_list) {
topic
.
vgs
=
taosArrayInit
(
0
,
sizeof
(
SMqClientVg
));
taosArrayPush
(
tmq
->
clientTopics
,
&
topic
);
taosArrayPush
(
req
.
topicNames
,
&
topicFname
);
f
ree
(
dbName
);
taosMemoryF
ree
(
dbName
);
}
int
tlen
=
tSerializeSCMSubscribeReq
(
NULL
,
&
req
);
void
*
buf
=
m
alloc
(
tlen
);
void
*
buf
=
taosMemoryM
alloc
(
tlen
);
if
(
buf
==
NULL
)
{
goto
_return
;
}
...
...
@@ -508,7 +508,7 @@ TAOS_RES* tmq_create_stream(TAOS* taos, const char* streamName, const char* tbNa
strcpy
(
req
.
outputSTbName
,
tbName
);
int
tlen
=
tSerializeSCMCreateStreamReq
(
NULL
,
0
,
&
req
);
void
*
buf
=
m
alloc
(
tlen
);
void
*
buf
=
taosMemoryM
alloc
(
tlen
);
if
(
buf
==
NULL
)
{
goto
_return
;
}
...
...
@@ -532,7 +532,7 @@ TAOS_RES* tmq_create_stream(TAOS* taos, const char* streamName, const char* tbNa
tsem_wait
(
&
pRequest
->
body
.
rspSem
);
_return:
t
free
(
astStr
);
t
aosMemoryFreeClear
(
astStr
);
qDestroyQuery
(
pQueryNode
);
/*if (sendInfo != NULL) {*/
/*destroySendMsgInfo(sendInfo);*/
...
...
@@ -594,7 +594,7 @@ TAOS_RES* tmq_create_topic(TAOS* taos, const char* topicName, const char* sql, i
tNameExtractFullName
(
&
name
,
req
.
name
);
int
tlen
=
tSerializeSCMCreateTopicReq
(
NULL
,
0
,
&
req
);
void
*
buf
=
m
alloc
(
tlen
);
void
*
buf
=
taosMemoryM
alloc
(
tlen
);
if
(
buf
==
NULL
)
{
goto
_return
;
}
...
...
@@ -618,7 +618,7 @@ TAOS_RES* tmq_create_topic(TAOS* taos, const char* topicName, const char* sql, i
tsem_wait
(
&
pRequest
->
body
.
rspSem
);
_return:
t
free
(
astStr
);
t
aosMemoryFreeClear
(
astStr
);
qDestroyQuery
(
pQueryNode
);
/*if (sendInfo != NULL) {*/
/*destroySendMsgInfo(sendInfo);*/
...
...
@@ -757,7 +757,7 @@ int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) {
#if 0
if (pParam->sync == 1) {
/**pParam->msg =
m
alloc(sizeof(tmq_message_t));*/
/**pParam->msg =
taosMemoryM
alloc(sizeof(tmq_message_t));*/
*pParam->msg = taosAllocateQitem(sizeof(tmq_message_t));
if (*pParam->msg) {
memcpy(*pParam->msg, pMsg->pData, sizeof(SMqRspHead));
...
...
@@ -774,7 +774,7 @@ int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) {
}
#endif
/*SMqConsumeRsp* pRsp =
c
alloc(1, sizeof(SMqConsumeRsp));*/
/*SMqConsumeRsp* pRsp =
taosMemoryC
alloc(1, sizeof(SMqConsumeRsp));*/
tmq_message_t
*
pRsp
=
taosAllocateQitem
(
sizeof
(
tmq_message_t
));
if
(
pRsp
==
NULL
)
{
goto
WRITE_QUEUE_FAIL
;
...
...
@@ -884,7 +884,7 @@ END:
int32_t
tmqAskEp
(
tmq_t
*
tmq
,
bool
sync
)
{
int32_t
tlen
=
sizeof
(
SMqCMGetSubEpReq
);
SMqCMGetSubEpReq
*
req
=
m
alloc
(
tlen
);
SMqCMGetSubEpReq
*
req
=
taosMemoryM
alloc
(
tlen
);
if
(
req
==
NULL
)
{
tscError
(
"failed to malloc get subscribe ep buf"
);
return
-
1
;
...
...
@@ -893,21 +893,21 @@ int32_t tmqAskEp(tmq_t* tmq, bool sync) {
req
->
epoch
=
htonl
(
tmq
->
epoch
);
strcpy
(
req
->
cgroup
,
tmq
->
groupId
);
SMqAskEpCbParam
*
pParam
=
m
alloc
(
sizeof
(
SMqAskEpCbParam
));
SMqAskEpCbParam
*
pParam
=
taosMemoryM
alloc
(
sizeof
(
SMqAskEpCbParam
));
if
(
pParam
==
NULL
)
{
tscError
(
"failed to malloc subscribe param"
);
f
ree
(
req
);
taosMemoryF
ree
(
req
);
return
-
1
;
}
pParam
->
tmq
=
tmq
;
pParam
->
sync
=
sync
;
tsem_init
(
&
pParam
->
rspSem
,
0
,
0
);
SMsgSendInfo
*
sendInfo
=
m
alloc
(
sizeof
(
SMsgSendInfo
));
SMsgSendInfo
*
sendInfo
=
taosMemoryM
alloc
(
sizeof
(
SMsgSendInfo
));
if
(
sendInfo
==
NULL
)
{
tsem_destroy
(
&
pParam
->
rspSem
);
f
ree
(
pParam
);
f
ree
(
req
);
taosMemoryF
ree
(
pParam
);
taosMemoryF
ree
(
req
);
return
-
1
;
}
...
...
@@ -967,7 +967,7 @@ SMqPollReq* tmqBuildConsumeReqImpl(tmq_t* tmq, int64_t blockingTime, SMqClientTo
reqOffset
=
tmq
->
resetOffsetCfg
;
}
SMqPollReq
*
pReq
=
m
alloc
(
sizeof
(
SMqPollReq
));
SMqPollReq
*
pReq
=
taosMemoryM
alloc
(
sizeof
(
SMqPollReq
));
if
(
pReq
==
NULL
)
{
return
NULL
;
}
...
...
@@ -1003,7 +1003,7 @@ tmq_message_t* tmqSyncPollImpl(tmq_t* tmq, int64_t blockingTime) {
return NULL;
}
SMqPollCbParam* pParam =
m
alloc(sizeof(SMqPollCbParam));
SMqPollCbParam* pParam =
taosMemoryM
alloc(sizeof(SMqPollCbParam));
if (pParam == NULL) {
atomic_store_32(&pVg->vgStatus, TMQ_VG_STATUS__IDLE);
// TODO: out of mem
...
...
@@ -1016,7 +1016,7 @@ tmq_message_t* tmqSyncPollImpl(tmq_t* tmq, int64_t blockingTime) {
pParam->msg = &msg;
tsem_init(&pParam->rspSem, 0, 0);
SMsgSendInfo* sendInfo =
m
alloc(sizeof(SMsgSendInfo));
SMsgSendInfo* sendInfo =
taosMemoryM
alloc(sizeof(SMsgSendInfo));
if (sendInfo == NULL) {
return NULL;
}
...
...
@@ -1071,9 +1071,9 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t blockingTime) {
tsem_post
(
&
tmq
->
rspSem
);
return
-
1
;
}
SMqPollCbParam
*
pParam
=
m
alloc
(
sizeof
(
SMqPollCbParam
));
SMqPollCbParam
*
pParam
=
taosMemoryM
alloc
(
sizeof
(
SMqPollCbParam
));
if
(
pParam
==
NULL
)
{
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
atomic_store_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
);
tsem_post
(
&
tmq
->
rspSem
);
return
-
1
;
...
...
@@ -1083,10 +1083,10 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t blockingTime) {
pParam
->
epoch
=
tmq
->
epoch
;
pParam
->
sync
=
0
;
SMsgSendInfo
*
sendInfo
=
m
alloc
(
sizeof
(
SMsgSendInfo
));
SMsgSendInfo
*
sendInfo
=
taosMemoryM
alloc
(
sizeof
(
SMsgSendInfo
));
if
(
sendInfo
==
NULL
)
{
f
ree
(
pReq
);
f
ree
(
pParam
);
taosMemoryF
ree
(
pReq
);
taosMemoryF
ree
(
pParam
);
atomic_store_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
);
tsem_post
(
&
tmq
->
rspSem
);
return
-
1
;
...
...
@@ -1258,7 +1258,7 @@ tmq_message_t* tmq_consumer_poll(tmq_t* tmq, int64_t blocking_time) {
return NULL;
}
SMqPollCbParam* param =
m
alloc(sizeof(SMqPollCbParam));
SMqPollCbParam* param =
taosMemoryM
alloc(sizeof(SMqPollCbParam));
if (param == NULL) {
ASSERT(false);
taosMsleep(blocking_time);
...
...
@@ -1289,7 +1289,7 @@ tmq_message_t* tmq_consumer_poll(tmq_t* tmq, int64_t blocking_time) {
tsem_wait(¶m->rspSem);
tsem_destroy(¶m->rspSem);
f
ree(param);
taosMemoryF
ree(param);
if (tmq_message == NULL) {
if (beginVgIdx == pTopic->nextVgIdx) {
...
...
@@ -1331,7 +1331,7 @@ tmq_resp_err_t tmq_commit(tmq_t* tmq, const tmq_topic_vgroup_list_t* tmq_topic_v
SRequestObj* pRequest = createRequest(tmq->pTscObj, NULL, NULL, TDMT_VND_CONSUME);
pRequest->body.requestMsg = (SDataBuf){.pData = pReq, .len = sizeof(SMqConsumeReq)};
SMqCommitCbParam* pParam =
m
alloc(sizeof(SMqCommitCbParam));
SMqCommitCbParam* pParam =
taosMemoryM
alloc(sizeof(SMqCommitCbParam));
if (pParam == NULL) {
continue;
}
...
...
@@ -1360,7 +1360,7 @@ void tmq_message_destroy(tmq_message_t* tmq_message) {
if
(
tmq_message
==
NULL
)
return
;
SMqPollRsp
*
pRsp
=
&
tmq_message
->
msg
;
tDeleteSMqConsumeRsp
(
pRsp
);
/*
f
ree(tmq_message);*/
/*
taosMemoryF
ree(tmq_message);*/
taosFreeQitem
(
tmq_message
);
}
...
...
@@ -1403,7 +1403,7 @@ char* tmq_get_topic_name(tmq_message_t* message) { return "not implemented yet";
#if 0
tmq_t* tmqCreateConsumerImpl(TAOS* conn, tmq_conf_t* conf) {
tmq_t* pTmq =
m
alloc(sizeof(tmq_t));
tmq_t* pTmq =
taosMemoryM
alloc(sizeof(tmq_t));
if (pTmq == NULL) {
return NULL;
}
...
...
@@ -1417,7 +1417,7 @@ tmq_t* tmqCreateConsumerImpl(TAOS* conn, tmq_conf_t* conf) {
static void destroySendMsgInfo(SMsgSendInfo* pMsgBody) {
assert(pMsgBody != NULL);
t
free
(pMsgBody->msgInfo.pData);
t
free
(pMsgBody);
t
aosMemoryFreeClear
(pMsgBody->msgInfo.pData);
t
aosMemoryFreeClear
(pMsgBody);
}
#endif
source/common/src/tdatablock.c
浏览文件 @
222db126
...
...
@@ -115,7 +115,7 @@ int32_t colDataAppend(SColumnInfoData* pColumnInfoData, uint32_t currentRow, con
newSize
=
newSize
*
1
.
5
;
}
char
*
buf
=
r
ealloc
(
pColumnInfoData
->
pData
,
newSize
);
char
*
buf
=
taosMemoryR
ealloc
(
pColumnInfoData
->
pData
,
newSize
);
if
(
buf
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
...
...
@@ -178,7 +178,7 @@ static void doBitmapMerge(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, c
uint32_t
total
=
numOfRow1
+
numOfRow2
;
if
(
BitmapLen
(
numOfRow1
)
<
BitmapLen
(
total
))
{
char
*
tmp
=
r
ealloc
(
pColumnInfoData
->
nullbitmap
,
BitmapLen
(
total
));
char
*
tmp
=
taosMemoryR
ealloc
(
pColumnInfoData
->
nullbitmap
,
BitmapLen
(
total
));
uint32_t
extend
=
BitmapLen
(
total
)
-
BitmapLen
(
numOfRow1
);
memset
(
tmp
+
BitmapLen
(
numOfRow1
),
0
,
extend
);
pColumnInfoData
->
nullbitmap
=
tmp
;
...
...
@@ -218,7 +218,7 @@ int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, uint32_t numOfRow1, co
if
(
IS_VAR_DATA_TYPE
(
pColumnInfoData
->
info
.
type
))
{
// Handle the bitmap
char
*
p
=
r
ealloc
(
pColumnInfoData
->
varmeta
.
offset
,
sizeof
(
int32_t
)
*
(
numOfRow1
+
numOfRow2
));
char
*
p
=
taosMemoryR
ealloc
(
pColumnInfoData
->
varmeta
.
offset
,
sizeof
(
int32_t
)
*
(
numOfRow1
+
numOfRow2
));
if
(
p
==
NULL
)
{
// TODO
}
...
...
@@ -232,7 +232,7 @@ int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, uint32_t numOfRow1, co
uint32_t
len
=
pSource
->
varmeta
.
length
;
uint32_t
oldLen
=
pColumnInfoData
->
varmeta
.
length
;
if
(
pColumnInfoData
->
varmeta
.
allocLen
<
len
+
oldLen
)
{
char
*
tmp
=
r
ealloc
(
pColumnInfoData
->
pData
,
len
+
oldLen
);
char
*
tmp
=
taosMemoryR
ealloc
(
pColumnInfoData
->
pData
,
len
+
oldLen
);
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_VND_OUT_OF_MEMORY
;
}
...
...
@@ -247,7 +247,7 @@ int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, uint32_t numOfRow1, co
doBitmapMerge
(
pColumnInfoData
,
numOfRow1
,
pSource
,
numOfRow2
);
int32_t
newSize
=
(
numOfRow1
+
numOfRow2
)
*
pColumnInfoData
->
info
.
bytes
;
char
*
tmp
=
r
ealloc
(
pColumnInfoData
->
pData
,
newSize
);
char
*
tmp
=
taosMemoryR
ealloc
(
pColumnInfoData
->
pData
,
newSize
);
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_VND_OUT_OF_MEMORY
;
}
...
...
@@ -268,7 +268,7 @@ int32_t colDataAssign(SColumnInfoData* pColumnInfoData, const SColumnInfoData* p
if
(
IS_VAR_DATA_TYPE
(
pColumnInfoData
->
info
.
type
))
{
// Handle the bitmap
char
*
p
=
r
ealloc
(
pColumnInfoData
->
varmeta
.
offset
,
sizeof
(
int32_t
)
*
numOfRows
);
char
*
p
=
taosMemoryR
ealloc
(
pColumnInfoData
->
varmeta
.
offset
,
sizeof
(
int32_t
)
*
numOfRows
);
if
(
p
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
...
...
@@ -277,7 +277,7 @@ int32_t colDataAssign(SColumnInfoData* pColumnInfoData, const SColumnInfoData* p
memcpy
(
pColumnInfoData
->
varmeta
.
offset
,
pSource
->
varmeta
.
offset
,
sizeof
(
int32_t
)
*
numOfRows
);
if
(
pColumnInfoData
->
varmeta
.
allocLen
<
pSource
->
varmeta
.
length
)
{
char
*
tmp
=
r
ealloc
(
pColumnInfoData
->
pData
,
pSource
->
varmeta
.
length
);
char
*
tmp
=
taosMemoryR
ealloc
(
pColumnInfoData
->
pData
,
pSource
->
varmeta
.
length
);
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
...
...
@@ -289,7 +289,7 @@ int32_t colDataAssign(SColumnInfoData* pColumnInfoData, const SColumnInfoData* p
memcpy
(
pColumnInfoData
->
pData
,
pSource
->
pData
,
pSource
->
varmeta
.
length
);
pColumnInfoData
->
varmeta
.
length
=
pSource
->
varmeta
.
length
;
}
else
{
char
*
tmp
=
r
ealloc
(
pColumnInfoData
->
nullbitmap
,
BitmapLen
(
numOfRows
));
char
*
tmp
=
taosMemoryR
ealloc
(
pColumnInfoData
->
nullbitmap
,
BitmapLen
(
numOfRows
));
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
...
...
@@ -298,7 +298,7 @@ int32_t colDataAssign(SColumnInfoData* pColumnInfoData, const SColumnInfoData* p
memcpy
(
pColumnInfoData
->
nullbitmap
,
pSource
->
nullbitmap
,
BitmapLen
(
numOfRows
));
int32_t
newSize
=
numOfRows
*
pColumnInfoData
->
info
.
bytes
;
tmp
=
r
ealloc
(
pColumnInfoData
->
pData
,
newSize
);
tmp
=
taosMemoryR
ealloc
(
pColumnInfoData
->
pData
,
newSize
);
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
...
...
@@ -349,7 +349,7 @@ int32_t blockDataMerge(SSDataBlock* pDest, const SSDataBlock* pSrc) {
uint32_t
newLen
=
colDataGetLength
(
pCol1
,
pSrc
->
info
.
rows
);
int32_t
newSize
=
oldLen
+
newLen
;
char
*
tmp
=
r
ealloc
(
pCol2
->
pData
,
newSize
);
char
*
tmp
=
taosMemoryR
ealloc
(
pCol2
->
pData
,
newSize
);
if
(
tmp
!=
NULL
)
{
pCol2
->
pData
=
tmp
;
colDataMergeCol
(
pCol2
,
pDest
->
info
.
rows
,
pCol1
,
pSrc
->
info
.
rows
);
...
...
@@ -453,7 +453,7 @@ SSDataBlock* blockDataExtractBlock(SSDataBlock* pBlock, int32_t startIndex, int3
return
NULL
;
}
SSDataBlock
*
pDst
=
c
alloc
(
1
,
sizeof
(
SSDataBlock
));
SSDataBlock
*
pDst
=
taosMemoryC
alloc
(
1
,
sizeof
(
SSDataBlock
));
if
(
pDst
==
NULL
)
{
return
NULL
;
}
...
...
@@ -470,10 +470,10 @@ SSDataBlock* blockDataExtractBlock(SSDataBlock* pBlock, int32_t startIndex, int3
if
(
IS_VAR_DATA_TYPE
(
pSrcCol
->
info
.
type
))
{
SVarColAttr
*
pAttr
=
&
colInfo
.
varmeta
;
pAttr
->
offset
=
c
alloc
(
rowCount
,
sizeof
(
int32_t
));
pAttr
->
offset
=
taosMemoryC
alloc
(
rowCount
,
sizeof
(
int32_t
));
}
else
{
colInfo
.
nullbitmap
=
c
alloc
(
1
,
BitmapLen
(
rowCount
));
colInfo
.
pData
=
c
alloc
(
rowCount
,
colInfo
.
info
.
bytes
);
colInfo
.
nullbitmap
=
taosMemoryC
alloc
(
1
,
BitmapLen
(
rowCount
));
colInfo
.
pData
=
taosMemoryC
alloc
(
rowCount
,
colInfo
.
info
.
bytes
);
}
taosArrayPush
(
pDst
->
pDataBlock
,
&
colInfo
);
...
...
@@ -562,7 +562,7 @@ int32_t blockDataFromBuf(SSDataBlock* pBlock, const char* buf) {
if
(
IS_VAR_DATA_TYPE
(
pCol
->
info
.
type
))
{
if
(
pCol
->
varmeta
.
allocLen
<
colLength
)
{
char
*
tmp
=
r
ealloc
(
pCol
->
pData
,
colLength
);
char
*
tmp
=
taosMemoryR
ealloc
(
pCol
->
pData
,
colLength
);
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
...
...
@@ -610,7 +610,7 @@ size_t blockDataGetSerialMetaSize(const SSDataBlock* pBlock) {
}
SSchema
*
blockDataExtractSchema
(
const
SSDataBlock
*
pBlock
,
int32_t
*
numOfCols
)
{
SSchema
*
pSchema
=
c
alloc
(
pBlock
->
info
.
numOfCols
,
sizeof
(
SSchema
));
SSchema
*
pSchema
=
taosMemoryC
alloc
(
pBlock
->
info
.
numOfCols
,
sizeof
(
SSchema
));
for
(
int32_t
i
=
0
;
i
<
pBlock
->
info
.
numOfCols
;
++
i
)
{
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
pSchema
[
i
].
bytes
=
pColInfoData
->
info
.
bytes
;
...
...
@@ -819,7 +819,7 @@ static SColumnInfoData* createHelpColInfoData(const SSDataBlock* pDataBlock) {
int32_t
rows
=
pDataBlock
->
info
.
rows
;
int32_t
numOfCols
=
pDataBlock
->
info
.
numOfCols
;
SColumnInfoData
*
pCols
=
c
alloc
(
numOfCols
,
sizeof
(
SColumnInfoData
));
SColumnInfoData
*
pCols
=
taosMemoryC
alloc
(
numOfCols
,
sizeof
(
SColumnInfoData
));
if
(
pCols
==
NULL
)
{
return
NULL
;
}
...
...
@@ -829,14 +829,14 @@ static SColumnInfoData* createHelpColInfoData(const SSDataBlock* pDataBlock) {
pCols
[
i
].
info
=
pColInfoData
->
info
;
if
(
IS_VAR_DATA_TYPE
(
pCols
[
i
].
info
.
type
))
{
pCols
[
i
].
varmeta
.
offset
=
c
alloc
(
rows
,
sizeof
(
int32_t
));
pCols
[
i
].
pData
=
c
alloc
(
1
,
pColInfoData
->
varmeta
.
length
);
pCols
[
i
].
varmeta
.
offset
=
taosMemoryC
alloc
(
rows
,
sizeof
(
int32_t
));
pCols
[
i
].
pData
=
taosMemoryC
alloc
(
1
,
pColInfoData
->
varmeta
.
length
);
pCols
[
i
].
varmeta
.
length
=
pColInfoData
->
varmeta
.
length
;
pCols
[
i
].
varmeta
.
allocLen
=
pCols
[
i
].
varmeta
.
length
;
}
else
{
pCols
[
i
].
nullbitmap
=
c
alloc
(
1
,
BitmapLen
(
rows
));
pCols
[
i
].
pData
=
c
alloc
(
rows
,
pCols
[
i
].
info
.
bytes
);
pCols
[
i
].
nullbitmap
=
taosMemoryC
alloc
(
1
,
BitmapLen
(
rows
));
pCols
[
i
].
pData
=
taosMemoryC
alloc
(
rows
,
pCols
[
i
].
info
.
bytes
);
}
}
...
...
@@ -851,22 +851,22 @@ static void copyBackToBlock(SSDataBlock* pDataBlock, SColumnInfoData* pCols) {
pColInfoData
->
info
=
pCols
[
i
].
info
;
if
(
IS_VAR_DATA_TYPE
(
pColInfoData
->
info
.
type
))
{
t
free
(
pColInfoData
->
varmeta
.
offset
);
t
aosMemoryFreeClear
(
pColInfoData
->
varmeta
.
offset
);
pColInfoData
->
varmeta
=
pCols
[
i
].
varmeta
;
}
else
{
t
free
(
pColInfoData
->
nullbitmap
);
t
aosMemoryFreeClear
(
pColInfoData
->
nullbitmap
);
pColInfoData
->
nullbitmap
=
pCols
[
i
].
nullbitmap
;
}
t
free
(
pColInfoData
->
pData
);
t
aosMemoryFreeClear
(
pColInfoData
->
pData
);
pColInfoData
->
pData
=
pCols
[
i
].
pData
;
}
t
free
(
pCols
);
t
aosMemoryFreeClear
(
pCols
);
}
static
int32_t
*
createTupleIndex
(
size_t
rows
)
{
int32_t
*
index
=
c
alloc
(
rows
,
sizeof
(
int32_t
));
int32_t
*
index
=
taosMemoryC
alloc
(
rows
,
sizeof
(
int32_t
));
if
(
index
==
NULL
)
{
return
NULL
;
}
...
...
@@ -878,7 +878,7 @@ static int32_t* createTupleIndex(size_t rows) {
return
index
;
}
static
void
destroyTupleIndex
(
int32_t
*
index
)
{
t
free
(
index
);
}
static
void
destroyTupleIndex
(
int32_t
*
index
)
{
t
aosMemoryFreeClear
(
index
);
}
static
__compar_fn_t
getComparFn
(
int32_t
type
,
int32_t
order
)
{
switch
(
type
)
{
...
...
@@ -1019,8 +1019,8 @@ SHelper* createTupleIndex_rv(int32_t numOfRows, SArray* pOrderInfo, SSDataBlock*
size_t
len
=
sortValLengthPerRow
*
pBlock
->
info
.
rows
;
char
*
buf
=
c
alloc
(
1
,
len
);
SHelper
*
phelper
=
c
alloc
(
numOfRows
,
sizeof
(
SHelper
));
char
*
buf
=
taosMemoryC
alloc
(
1
,
len
);
SHelper
*
phelper
=
taosMemoryC
alloc
(
numOfRows
,
sizeof
(
SHelper
));
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
phelper
[
i
].
index
=
i
;
phelper
[
i
].
pData
=
buf
+
sortValLengthPerRow
*
i
;
...
...
@@ -1163,7 +1163,7 @@ int32_t blockDataEnsureColumnCapacity(SColumnInfoData* pColumn, uint32_t numOfRo
}
if
(
IS_VAR_DATA_TYPE
(
pColumn
->
info
.
type
))
{
char
*
tmp
=
r
ealloc
(
pColumn
->
varmeta
.
offset
,
sizeof
(
int32_t
)
*
numOfRows
);
char
*
tmp
=
taosMemoryR
ealloc
(
pColumn
->
varmeta
.
offset
,
sizeof
(
int32_t
)
*
numOfRows
);
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
...
...
@@ -1173,9 +1173,9 @@ int32_t blockDataEnsureColumnCapacity(SColumnInfoData* pColumn, uint32_t numOfRo
pColumn
->
varmeta
.
length
=
0
;
pColumn
->
varmeta
.
allocLen
=
0
;
t
free
(
pColumn
->
pData
);
t
aosMemoryFreeClear
(
pColumn
->
pData
);
}
else
{
char
*
tmp
=
r
ealloc
(
pColumn
->
nullbitmap
,
BitmapLen
(
numOfRows
));
char
*
tmp
=
taosMemoryR
ealloc
(
pColumn
->
nullbitmap
,
BitmapLen
(
numOfRows
));
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
...
...
@@ -1183,7 +1183,7 @@ int32_t blockDataEnsureColumnCapacity(SColumnInfoData* pColumn, uint32_t numOfRo
pColumn
->
nullbitmap
=
tmp
;
memset
(
pColumn
->
nullbitmap
,
0
,
BitmapLen
(
numOfRows
));
assert
(
pColumn
->
info
.
bytes
);
tmp
=
r
ealloc
(
pColumn
->
pData
,
numOfRows
*
pColumn
->
info
.
bytes
);
tmp
=
taosMemoryR
ealloc
(
pColumn
->
pData
,
numOfRows
*
pColumn
->
info
.
bytes
);
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
...
...
@@ -1214,14 +1214,14 @@ void* blockDataDestroy(SSDataBlock* pBlock) {
}
blockDestroyInner
(
pBlock
);
t
free
(
pBlock
);
t
aosMemoryFreeClear
(
pBlock
);
return
NULL
;
}
SSDataBlock
*
createOneDataBlock
(
const
SSDataBlock
*
pDataBlock
)
{
int32_t
numOfCols
=
pDataBlock
->
info
.
numOfCols
;
SSDataBlock
*
pBlock
=
c
alloc
(
1
,
sizeof
(
SSDataBlock
));
SSDataBlock
*
pBlock
=
taosMemoryC
alloc
(
1
,
sizeof
(
SSDataBlock
));
pBlock
->
pDataBlock
=
taosArrayInit
(
numOfCols
,
sizeof
(
SColumnInfoData
));
pBlock
->
info
.
numOfCols
=
numOfCols
;
...
...
source/common/src/tdataformat.c
浏览文件 @
222db126
...
...
@@ -37,7 +37,7 @@ int tdAllocMemForCol(SDataCol *pCol, int maxPoints) {
#endif
if
(
pCol
->
spaceSize
<
spaceNeeded
)
{
void
*
ptr
=
r
ealloc
(
pCol
->
pData
,
spaceNeeded
);
void
*
ptr
=
taosMemoryR
ealloc
(
pCol
->
pData
,
spaceNeeded
);
if
(
ptr
==
NULL
)
{
uDebug
(
"malloc failure, size:%"
PRId64
" failed, reason:%s"
,
(
int64_t
)
spaceNeeded
,
strerror
(
errno
));
return
-
1
;
...
...
@@ -66,7 +66,7 @@ int tdAllocMemForCol(SDataCol *pCol, int maxPoints) {
*/
STSchema
*
tdDupSchema
(
const
STSchema
*
pSchema
)
{
int
tlen
=
sizeof
(
STSchema
)
+
sizeof
(
STColumn
)
*
schemaNCols
(
pSchema
);
STSchema
*
tSchema
=
(
STSchema
*
)
m
alloc
(
tlen
);
STSchema
*
tSchema
=
(
STSchema
*
)
taosMemoryM
alloc
(
tlen
);
if
(
tSchema
==
NULL
)
return
NULL
;
memcpy
((
void
*
)
tSchema
,
(
void
*
)
pSchema
,
tlen
);
...
...
@@ -127,7 +127,7 @@ int tdInitTSchemaBuilder(STSchemaBuilder *pBuilder, int32_t version) {
if
(
pBuilder
==
NULL
)
return
-
1
;
pBuilder
->
tCols
=
256
;
pBuilder
->
columns
=
(
STColumn
*
)
m
alloc
(
sizeof
(
STColumn
)
*
pBuilder
->
tCols
);
pBuilder
->
columns
=
(
STColumn
*
)
taosMemoryM
alloc
(
sizeof
(
STColumn
)
*
pBuilder
->
tCols
);
if
(
pBuilder
->
columns
==
NULL
)
return
-
1
;
tdResetTSchemaBuilder
(
pBuilder
,
version
);
...
...
@@ -136,7 +136,7 @@ int tdInitTSchemaBuilder(STSchemaBuilder *pBuilder, int32_t version) {
void
tdDestroyTSchemaBuilder
(
STSchemaBuilder
*
pBuilder
)
{
if
(
pBuilder
)
{
t
free
(
pBuilder
->
columns
);
t
aosMemoryFreeClear
(
pBuilder
->
columns
);
}
}
...
...
@@ -153,7 +153,7 @@ int tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, int16_t colId, int1
if
(
pBuilder
->
nCols
>=
pBuilder
->
tCols
)
{
pBuilder
->
tCols
*=
2
;
STColumn
*
columns
=
(
STColumn
*
)
r
ealloc
(
pBuilder
->
columns
,
sizeof
(
STColumn
)
*
pBuilder
->
tCols
);
STColumn
*
columns
=
(
STColumn
*
)
taosMemoryR
ealloc
(
pBuilder
->
columns
,
sizeof
(
STColumn
)
*
pBuilder
->
tCols
);
if
(
columns
==
NULL
)
return
-
1
;
pBuilder
->
columns
=
columns
;
}
...
...
@@ -191,7 +191,7 @@ STSchema *tdGetSchemaFromBuilder(STSchemaBuilder *pBuilder) {
int
tlen
=
sizeof
(
STSchema
)
+
sizeof
(
STColumn
)
*
pBuilder
->
nCols
;
STSchema
*
pSchema
=
(
STSchema
*
)
m
alloc
(
tlen
);
STSchema
*
pSchema
=
(
STSchema
*
)
taosMemoryM
alloc
(
tlen
);
if
(
pSchema
==
NULL
)
return
NULL
;
schemaVersion
(
pSchema
)
=
pBuilder
->
version
;
...
...
@@ -221,7 +221,7 @@ void tdInitDataRow(SDataRow row, STSchema *pSchema) {
SDataRow tdNewDataRowFromSchema(STSchema *pSchema) {
int32_t size = dataRowMaxBytesFromSchema(pSchema);
SDataRow row =
m
alloc(size);
SDataRow row =
taosMemoryM
alloc(size);
if (row == NULL) return NULL;
tdInitDataRow(row, pSchema);
...
...
@@ -232,11 +232,11 @@ SDataRow tdNewDataRowFromSchema(STSchema *pSchema) {
* Free the SDataRow object
*/
void tdFreeDataRow(SDataRow row) {
if (row)
f
ree(row);
if (row)
taosMemoryF
ree(row);
}
SDataRow tdDataRowDup(SDataRow row) {
SDataRow trow =
m
alloc(dataRowLen(row));
SDataRow trow =
taosMemoryM
alloc(dataRowLen(row));
if (trow == NULL) return NULL;
dataRowCpy(trow, row);
...
...
@@ -244,7 +244,7 @@ SDataRow tdDataRowDup(SDataRow row) {
}
SMemRow tdMemRowDup(SMemRow row) {
SMemRow trow =
m
alloc(memRowTLen(row));
SMemRow trow =
taosMemoryM
alloc(memRowTLen(row));
if (trow == NULL) return NULL;
memRowCpy(trow, row);
...
...
@@ -348,7 +348,7 @@ void *dataColSetOffset(SDataCol *pCol, int nEle) {
}
SDataCols
*
tdNewDataCols
(
int
maxCols
,
int
maxRows
)
{
SDataCols
*
pCols
=
(
SDataCols
*
)
c
alloc
(
1
,
sizeof
(
SDataCols
));
SDataCols
*
pCols
=
(
SDataCols
*
)
taosMemoryC
alloc
(
1
,
sizeof
(
SDataCols
));
if
(
pCols
==
NULL
)
{
uDebug
(
"malloc failure, size:%"
PRId64
" failed, reason:%s"
,
(
int64_t
)
sizeof
(
SDataCols
),
strerror
(
errno
));
return
NULL
;
...
...
@@ -360,7 +360,7 @@ SDataCols *tdNewDataCols(int maxCols, int maxRows) {
pCols
->
numOfCols
=
0
;
if
(
maxCols
>
0
)
{
pCols
->
cols
=
(
SDataCol
*
)
c
alloc
(
maxCols
,
sizeof
(
SDataCol
));
pCols
->
cols
=
(
SDataCol
*
)
taosMemoryC
alloc
(
maxCols
,
sizeof
(
SDataCol
));
if
(
pCols
->
cols
==
NULL
)
{
uDebug
(
"malloc failure, size:%"
PRId64
" failed, reason:%s"
,
(
int64_t
)
sizeof
(
SDataCol
)
*
maxCols
,
strerror
(
errno
));
...
...
@@ -384,7 +384,7 @@ int tdInitDataCols(SDataCols *pCols, STSchema *pSchema) {
int
oldMaxCols
=
pCols
->
maxCols
;
if
(
schemaNCols
(
pSchema
)
>
oldMaxCols
)
{
pCols
->
maxCols
=
schemaNCols
(
pSchema
);
void
*
ptr
=
(
SDataCol
*
)
r
ealloc
(
pCols
->
cols
,
sizeof
(
SDataCol
)
*
pCols
->
maxCols
);
void
*
ptr
=
(
SDataCol
*
)
taosMemoryR
ealloc
(
pCols
->
cols
,
sizeof
(
SDataCol
)
*
pCols
->
maxCols
);
if
(
ptr
==
NULL
)
return
-
1
;
pCols
->
cols
=
ptr
;
for
(
i
=
oldMaxCols
;
i
<
pCols
->
maxCols
;
i
++
)
{
...
...
@@ -411,12 +411,12 @@ SDataCols *tdFreeDataCols(SDataCols *pCols) {
int
maxCols
=
pCols
->
maxCols
;
for
(
i
=
0
;
i
<
maxCols
;
i
++
)
{
SDataCol
*
pCol
=
&
pCols
->
cols
[
i
];
t
free
(
pCol
->
pData
);
t
aosMemoryFreeClear
(
pCol
->
pData
);
}
f
ree
(
pCols
->
cols
);
taosMemoryF
ree
(
pCols
->
cols
);
pCols
->
cols
=
NULL
;
}
f
ree
(
pCols
);
taosMemoryF
ree
(
pCols
);
}
return
NULL
;
}
...
...
@@ -641,7 +641,7 @@ static void tdMergeTwoDataCols(SDataCols *target, SDataCols *src1, int *iter1, i
#endif
SKVRow
tdKVRowDup
(
SKVRow
row
)
{
SKVRow
trow
=
m
alloc
(
kvRowLen
(
row
));
SKVRow
trow
=
taosMemoryM
alloc
(
kvRowLen
(
row
));
if
(
trow
==
NULL
)
return
NULL
;
kvRowCpy
(
trow
,
row
);
...
...
@@ -674,7 +674,7 @@ int tdSetKVRowDataOfCol(SKVRow *orow, int16_t colId, int8_t type, void *value) {
int
oRowCols
=
kvRowNCols
(
row
);
ASSERT
(
diff
>
0
);
nrow
=
m
alloc
(
nRowLen
);
nrow
=
taosMemoryM
alloc
(
nRowLen
);
if
(
nrow
==
NULL
)
return
-
1
;
kvRowSetLen
(
nrow
,
nRowLen
);
...
...
@@ -692,7 +692,7 @@ int tdSetKVRowDataOfCol(SKVRow *orow, int16_t colId, int8_t type, void *value) {
tdSortKVRowByColIdx
(
nrow
);
*
orow
=
nrow
;
f
ree
(
row
);
taosMemoryF
ree
(
row
);
}
else
{
ASSERT
(((
SColIdx
*
)
ptr
)
->
colId
==
colId
);
if
(
IS_VAR_DATA_TYPE
(
type
))
{
...
...
@@ -703,7 +703,7 @@ int tdSetKVRowDataOfCol(SKVRow *orow, int16_t colId, int8_t type, void *value) {
}
else
{
// need to reallocate the memory
int16_t
nlen
=
kvRowLen
(
row
)
+
(
varDataTLen
(
value
)
-
varDataTLen
(
pOldVal
));
ASSERT
(
nlen
>
0
);
nrow
=
m
alloc
(
nlen
);
nrow
=
taosMemoryM
alloc
(
nlen
);
if
(
nrow
==
NULL
)
return
-
1
;
kvRowSetLen
(
nrow
,
nlen
);
...
...
@@ -728,7 +728,7 @@ int tdSetKVRowDataOfCol(SKVRow *orow, int16_t colId, int8_t type, void *value) {
}
*
orow
=
nrow
;
f
ree
(
row
);
taosMemoryF
ree
(
row
);
}
}
else
{
memcpy
(
kvRowColVal
(
row
,
(
SColIdx
*
)
ptr
),
value
,
TYPE_BYTES
[
type
]);
...
...
@@ -757,21 +757,21 @@ void *tdDecodeKVRow(void *buf, SKVRow *row) {
int
tdInitKVRowBuilder
(
SKVRowBuilder
*
pBuilder
)
{
pBuilder
->
tCols
=
128
;
pBuilder
->
nCols
=
0
;
pBuilder
->
pColIdx
=
(
SColIdx
*
)
m
alloc
(
sizeof
(
SColIdx
)
*
pBuilder
->
tCols
);
pBuilder
->
pColIdx
=
(
SColIdx
*
)
taosMemoryM
alloc
(
sizeof
(
SColIdx
)
*
pBuilder
->
tCols
);
if
(
pBuilder
->
pColIdx
==
NULL
)
return
-
1
;
pBuilder
->
alloc
=
1024
;
pBuilder
->
size
=
0
;
pBuilder
->
buf
=
m
alloc
(
pBuilder
->
alloc
);
pBuilder
->
buf
=
taosMemoryM
alloc
(
pBuilder
->
alloc
);
if
(
pBuilder
->
buf
==
NULL
)
{
f
ree
(
pBuilder
->
pColIdx
);
taosMemoryF
ree
(
pBuilder
->
pColIdx
);
return
-
1
;
}
return
0
;
}
void
tdDestroyKVRowBuilder
(
SKVRowBuilder
*
pBuilder
)
{
t
free
(
pBuilder
->
pColIdx
);
t
free
(
pBuilder
->
buf
);
t
aosMemoryFreeClear
(
pBuilder
->
pColIdx
);
t
aosMemoryFreeClear
(
pBuilder
->
buf
);
}
void
tdResetKVRowBuilder
(
SKVRowBuilder
*
pBuilder
)
{
...
...
@@ -785,7 +785,7 @@ SKVRow tdGetKVRowFromBuilder(SKVRowBuilder *pBuilder) {
tlen
+=
TD_KV_ROW_HEAD_SIZE
;
SKVRow
row
=
m
alloc
(
tlen
);
SKVRow
row
=
taosMemoryM
alloc
(
tlen
);
if
(
row
==
NULL
)
return
NULL
;
kvRowSetNCols
(
row
,
pBuilder
->
nCols
);
...
...
source/common/src/tmsg.c
浏览文件 @
222db126
...
...
@@ -371,7 +371,7 @@ void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) {
case
TD_SUPER_TABLE
:
buf
=
taosDecodeFixedI64
(
buf
,
&
(
pReq
->
stbCfg
.
suid
));
buf
=
taosDecodeFixedU32
(
buf
,
&
(
pReq
->
stbCfg
.
nCols
));
pReq
->
stbCfg
.
pSchema
=
(
SSchema
*
)
m
alloc
(
pReq
->
stbCfg
.
nCols
*
sizeof
(
SSchema
));
pReq
->
stbCfg
.
pSchema
=
(
SSchema
*
)
taosMemoryM
alloc
(
pReq
->
stbCfg
.
nCols
*
sizeof
(
SSchema
));
for
(
uint32_t
i
=
0
;
i
<
pReq
->
stbCfg
.
nCols
;
i
++
)
{
buf
=
taosDecodeFixedI8
(
buf
,
&
(
pReq
->
stbCfg
.
pSchema
[
i
].
type
));
buf
=
taosDecodeFixedI32
(
buf
,
&
(
pReq
->
stbCfg
.
pSchema
[
i
].
colId
));
...
...
@@ -379,7 +379,7 @@ void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) {
buf
=
taosDecodeStringTo
(
buf
,
pReq
->
stbCfg
.
pSchema
[
i
].
name
);
}
buf
=
taosDecodeFixedU32
(
buf
,
&
pReq
->
stbCfg
.
nTagCols
);
pReq
->
stbCfg
.
pTagSchema
=
(
SSchema
*
)
m
alloc
(
pReq
->
stbCfg
.
nTagCols
*
sizeof
(
SSchema
));
pReq
->
stbCfg
.
pTagSchema
=
(
SSchema
*
)
taosMemoryM
alloc
(
pReq
->
stbCfg
.
nTagCols
*
sizeof
(
SSchema
));
for
(
uint32_t
i
=
0
;
i
<
pReq
->
stbCfg
.
nTagCols
;
i
++
)
{
buf
=
taosDecodeFixedI8
(
buf
,
&
(
pReq
->
stbCfg
.
pTagSchema
[
i
].
type
));
buf
=
taosDecodeFixedI32
(
buf
,
&
pReq
->
stbCfg
.
pTagSchema
[
i
].
colId
);
...
...
@@ -388,7 +388,7 @@ void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) {
}
buf
=
taosDecodeFixedI16
(
buf
,
&
(
pReq
->
stbCfg
.
nBSmaCols
));
if
(
pReq
->
stbCfg
.
nBSmaCols
>
0
)
{
pReq
->
stbCfg
.
pBSmaCols
=
(
col_id_t
*
)
m
alloc
(
pReq
->
stbCfg
.
nBSmaCols
*
sizeof
(
col_id_t
));
pReq
->
stbCfg
.
pBSmaCols
=
(
col_id_t
*
)
taosMemoryM
alloc
(
pReq
->
stbCfg
.
nBSmaCols
*
sizeof
(
col_id_t
));
for
(
col_id_t
i
=
0
;
i
<
pReq
->
stbCfg
.
nBSmaCols
;
++
i
)
{
buf
=
taosDecodeFixedI16
(
buf
,
pReq
->
stbCfg
.
pBSmaCols
+
i
);
}
...
...
@@ -396,7 +396,7 @@ void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) {
pReq
->
stbCfg
.
pBSmaCols
=
NULL
;
}
if
(
pReq
->
rollup
)
{
pReq
->
stbCfg
.
pRSmaParam
=
(
SRSmaParam
*
)
m
alloc
(
sizeof
(
SRSmaParam
));
pReq
->
stbCfg
.
pRSmaParam
=
(
SRSmaParam
*
)
taosMemoryM
alloc
(
sizeof
(
SRSmaParam
));
SRSmaParam
*
param
=
pReq
->
stbCfg
.
pRSmaParam
;
buf
=
taosDecodeFixedU32
(
buf
,
(
uint32_t
*
)
&
param
->
xFilesFactor
);
buf
=
taosDecodeFixedI8
(
buf
,
&
param
->
delayUnit
);
...
...
@@ -419,7 +419,7 @@ void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) {
break
;
case
TD_NORMAL_TABLE
:
buf
=
taosDecodeFixedU32
(
buf
,
&
pReq
->
ntbCfg
.
nCols
);
pReq
->
ntbCfg
.
pSchema
=
(
SSchema
*
)
m
alloc
(
pReq
->
ntbCfg
.
nCols
*
sizeof
(
SSchema
));
pReq
->
ntbCfg
.
pSchema
=
(
SSchema
*
)
taosMemoryM
alloc
(
pReq
->
ntbCfg
.
nCols
*
sizeof
(
SSchema
));
for
(
uint32_t
i
=
0
;
i
<
pReq
->
ntbCfg
.
nCols
;
i
++
)
{
buf
=
taosDecodeFixedI8
(
buf
,
&
pReq
->
ntbCfg
.
pSchema
[
i
].
type
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pReq
->
ntbCfg
.
pSchema
[
i
].
colId
);
...
...
@@ -428,7 +428,7 @@ void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) {
}
buf
=
taosDecodeFixedI16
(
buf
,
&
(
pReq
->
ntbCfg
.
nBSmaCols
));
if
(
pReq
->
ntbCfg
.
nBSmaCols
>
0
)
{
pReq
->
ntbCfg
.
pBSmaCols
=
(
col_id_t
*
)
m
alloc
(
pReq
->
ntbCfg
.
nBSmaCols
*
sizeof
(
col_id_t
));
pReq
->
ntbCfg
.
pBSmaCols
=
(
col_id_t
*
)
taosMemoryM
alloc
(
pReq
->
ntbCfg
.
nBSmaCols
*
sizeof
(
col_id_t
));
for
(
col_id_t
i
=
0
;
i
<
pReq
->
ntbCfg
.
nBSmaCols
;
++
i
)
{
buf
=
taosDecodeFixedI16
(
buf
,
pReq
->
ntbCfg
.
pBSmaCols
+
i
);
}
...
...
@@ -436,7 +436,7 @@ void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) {
pReq
->
ntbCfg
.
pBSmaCols
=
NULL
;
}
if
(
pReq
->
rollup
)
{
pReq
->
ntbCfg
.
pRSmaParam
=
(
SRSmaParam
*
)
m
alloc
(
sizeof
(
SRSmaParam
));
pReq
->
ntbCfg
.
pRSmaParam
=
(
SRSmaParam
*
)
taosMemoryM
alloc
(
sizeof
(
SRSmaParam
));
SRSmaParam
*
param
=
pReq
->
ntbCfg
.
pRSmaParam
;
buf
=
taosDecodeFixedU32
(
buf
,
(
uint32_t
*
)
&
param
->
xFilesFactor
);
buf
=
taosDecodeFixedI8
(
buf
,
&
param
->
delayUnit
);
...
...
@@ -608,7 +608,7 @@ int32_t tDeserializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pR
}
if
(
pReq
->
commentLen
>
0
)
{
pReq
->
comment
=
m
alloc
(
pReq
->
commentLen
);
pReq
->
comment
=
taosMemoryM
alloc
(
pReq
->
commentLen
);
if
(
pReq
->
comment
==
NULL
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
comment
)
<
0
)
return
-
1
;
}
...
...
@@ -623,7 +623,7 @@ void tFreeSMCreateStbReq(SMCreateStbReq *pReq) {
taosArrayDestroy
(
pReq
->
pColumns
);
taosArrayDestroy
(
pReq
->
pTags
);
taosArrayDestroy
(
pReq
->
pSmas
);
t
free
(
pReq
->
comment
);
t
aosMemoryFreeClear
(
pReq
->
comment
);
pReq
->
pColumns
=
NULL
;
pReq
->
pTags
=
NULL
;
pReq
->
pSmas
=
NULL
;
...
...
@@ -770,22 +770,22 @@ int32_t tDeserializeSMCreateSmaReq(void *buf, int32_t bufLen, SMCreateSmaReq *pR
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
sqlLen
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
astLen
)
<
0
)
return
-
1
;
if
(
pReq
->
exprLen
>
0
)
{
pReq
->
expr
=
m
alloc
(
pReq
->
exprLen
);
pReq
->
expr
=
taosMemoryM
alloc
(
pReq
->
exprLen
);
if
(
pReq
->
expr
==
NULL
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
expr
)
<
0
)
return
-
1
;
}
if
(
pReq
->
tagsFilterLen
>
0
)
{
pReq
->
tagsFilter
=
m
alloc
(
pReq
->
tagsFilterLen
);
pReq
->
tagsFilter
=
taosMemoryM
alloc
(
pReq
->
tagsFilterLen
);
if
(
pReq
->
tagsFilter
==
NULL
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
tagsFilter
)
<
0
)
return
-
1
;
}
if
(
pReq
->
sqlLen
>
0
)
{
pReq
->
sql
=
m
alloc
(
pReq
->
sqlLen
);
pReq
->
sql
=
taosMemoryM
alloc
(
pReq
->
sqlLen
);
if
(
pReq
->
sql
==
NULL
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
sql
)
<
0
)
return
-
1
;
}
if
(
pReq
->
astLen
>
0
)
{
pReq
->
ast
=
m
alloc
(
pReq
->
astLen
);
pReq
->
ast
=
taosMemoryM
alloc
(
pReq
->
astLen
);
if
(
pReq
->
ast
==
NULL
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
ast
)
<
0
)
return
-
1
;
}
...
...
@@ -796,10 +796,10 @@ int32_t tDeserializeSMCreateSmaReq(void *buf, int32_t bufLen, SMCreateSmaReq *pR
}
void
tFreeSMCreateSmaReq
(
SMCreateSmaReq
*
pReq
)
{
t
free
(
pReq
->
expr
);
t
free
(
pReq
->
tagsFilter
);
t
free
(
pReq
->
sql
);
t
free
(
pReq
->
ast
);
t
aosMemoryFreeClear
(
pReq
->
expr
);
t
aosMemoryFreeClear
(
pReq
->
tagsFilter
);
t
aosMemoryFreeClear
(
pReq
->
sql
);
t
aosMemoryFreeClear
(
pReq
->
ast
);
}
int32_t
tSerializeSMDropSmaReq
(
void
*
buf
,
int32_t
bufLen
,
SMDropSmaReq
*
pReq
)
{
...
...
@@ -1987,7 +1987,7 @@ int32_t tDeserializeSShowReq(void *buf, int32_t bufLen, SShowReq *pReq) {
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
payloadLen
)
<
0
)
return
-
1
;
if
(
pReq
->
payloadLen
>
0
)
{
pReq
->
payload
=
m
alloc
(
pReq
->
payloadLen
);
pReq
->
payload
=
taosMemoryM
alloc
(
pReq
->
payloadLen
);
if
(
pReq
->
payload
==
NULL
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
payload
)
<
0
)
return
-
1
;
}
...
...
@@ -1997,7 +1997,7 @@ int32_t tDeserializeSShowReq(void *buf, int32_t bufLen, SShowReq *pReq) {
return
0
;
}
void
tFreeSShowReq
(
SShowReq
*
pReq
)
{
t
free
(
pReq
->
payload
);
}
void
tFreeSShowReq
(
SShowReq
*
pReq
)
{
t
aosMemoryFreeClear
(
pReq
->
payload
);
}
int32_t
tSerializeSRetrieveTableReq
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveTableReq
*
pReq
)
{
SCoder
encoder
=
{
0
};
...
...
@@ -2071,7 +2071,7 @@ static int32_t tDecodeSTableMetaRsp(SCoder *pDecoder, STableMetaRsp *pRsp) {
if
(
tDecodeI32
(
pDecoder
,
&
pRsp
->
vgId
)
<
0
)
return
-
1
;
int32_t
totalCols
=
pRsp
->
numOfTags
+
pRsp
->
numOfColumns
;
pRsp
->
pSchemas
=
m
alloc
(
sizeof
(
SSchema
)
*
totalCols
);
pRsp
->
pSchemas
=
taosMemoryM
alloc
(
sizeof
(
SSchema
)
*
totalCols
);
if
(
pRsp
->
pSchemas
==
NULL
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
totalCols
;
++
i
)
{
...
...
@@ -2152,7 +2152,7 @@ int32_t tDeserializeSTableMetaBatchRsp(void *buf, int32_t bufLen, STableMetaBatc
return
0
;
}
void
tFreeSTableMetaRsp
(
STableMetaRsp
*
pRsp
)
{
t
free
(
pRsp
->
pSchemas
);
}
void
tFreeSTableMetaRsp
(
STableMetaRsp
*
pRsp
)
{
t
aosMemoryFreeClear
(
pRsp
->
pSchemas
);
}
void
tFreeSTableMetaBatchRsp
(
STableMetaBatchRsp
*
pRsp
)
{
int32_t
numOfBatch
=
taosArrayGetSize
(
pRsp
->
pArray
);
...
...
@@ -2304,13 +2304,13 @@ int32_t tDeserializeSCMCreateTopicReq(void *buf, int32_t bufLen, SCMCreateTopicR
if
(
tDecodeI32
(
&
decoder
,
&
astLen
)
<
0
)
return
-
1
;
if
(
sqlLen
>
0
)
{
pReq
->
sql
=
c
alloc
(
1
,
sqlLen
+
1
);
pReq
->
sql
=
taosMemoryC
alloc
(
1
,
sqlLen
+
1
);
if
(
pReq
->
sql
==
NULL
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
sql
)
<
0
)
return
-
1
;
}
if
(
astLen
>
0
)
{
pReq
->
ast
=
c
alloc
(
1
,
astLen
+
1
);
pReq
->
ast
=
taosMemoryC
alloc
(
1
,
astLen
+
1
);
if
(
pReq
->
ast
==
NULL
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
ast
)
<
0
)
return
-
1
;
}
...
...
@@ -2322,8 +2322,8 @@ int32_t tDeserializeSCMCreateTopicReq(void *buf, int32_t bufLen, SCMCreateTopicR
}
void
tFreeSCMCreateTopicReq
(
SCMCreateTopicReq
*
pReq
)
{
t
free
(
pReq
->
sql
);
t
free
(
pReq
->
ast
);
t
aosMemoryFreeClear
(
pReq
->
sql
);
t
aosMemoryFreeClear
(
pReq
->
ast
);
}
int32_t
tSerializeSCMCreateTopicRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SCMCreateTopicRsp
*
pRsp
)
{
...
...
@@ -3074,13 +3074,13 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea
if
(
tDecodeI32
(
&
decoder
,
&
astLen
)
<
0
)
return
-
1
;
if
(
sqlLen
>
0
)
{
pReq
->
sql
=
c
alloc
(
1
,
sqlLen
+
1
);
pReq
->
sql
=
taosMemoryC
alloc
(
1
,
sqlLen
+
1
);
if
(
pReq
->
sql
==
NULL
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
sql
)
<
0
)
return
-
1
;
}
if
(
astLen
>
0
)
{
pReq
->
ast
=
c
alloc
(
1
,
astLen
+
1
);
pReq
->
ast
=
taosMemoryC
alloc
(
1
,
astLen
+
1
);
if
(
pReq
->
ast
==
NULL
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
ast
)
<
0
)
return
-
1
;
}
...
...
@@ -3091,6 +3091,6 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea
}
void
tFreeSCMCreateStreamReq
(
SCMCreateStreamReq
*
pReq
)
{
t
free
(
pReq
->
sql
);
t
free
(
pReq
->
ast
);
t
aosMemoryFreeClear
(
pReq
->
sql
);
t
aosMemoryFreeClear
(
pReq
->
ast
);
}
source/common/src/tname.c
浏览文件 @
222db126
...
...
@@ -30,13 +30,13 @@ SColumnFilterInfo* tFilterInfoDup(const SColumnFilterInfo* src, int32_t numOfFil
return NULL;
}
SColumnFilterInfo* pFilter =
c
alloc(1, numOfFilters * sizeof(SColumnFilterInfo));
SColumnFilterInfo* pFilter =
taosMemoryC
alloc(1, numOfFilters * sizeof(SColumnFilterInfo));
memcpy(pFilter, src, sizeof(SColumnFilterInfo) * numOfFilters);
for (int32_t j = 0; j < numOfFilters; ++j) {
if (pFilter[j].filterstr) {
size_t len = (size_t) pFilter[j].len + 1 * TSDB_NCHAR_SIZE;
pFilter[j].pz = (int64_t)
c
alloc(1, len);
pFilter[j].pz = (int64_t)
taosMemoryC
alloc(1, len);
memcpy((char*)pFilter[j].pz, (char*)src[j].pz, (size_t) pFilter[j].len);
}
...
...
@@ -171,7 +171,7 @@ bool tNameIsValid(const SName* name) {
SName
*
tNameDup
(
const
SName
*
name
)
{
assert
(
name
!=
NULL
);
SName
*
p
=
m
alloc
(
sizeof
(
SName
));
SName
*
p
=
taosMemoryM
alloc
(
sizeof
(
SName
));
memcpy
(
p
,
name
,
sizeof
(
SName
));
return
p
;
}
...
...
source/common/src/trow.c
浏览文件 @
222db126
...
...
@@ -119,7 +119,7 @@ int trbWriteCol(SRowBuilder *pRB, void *pData, col_id_t cid) {
#endif
STSRow
*
tdRowDup
(
STSRow
*
row
)
{
STSRow
*
trow
=
m
alloc
(
TD_ROW_LEN
(
row
));
STSRow
*
trow
=
taosMemoryM
alloc
(
TD_ROW_LEN
(
row
));
if
(
trow
==
NULL
)
return
NULL
;
tdRowCpy
(
trow
,
row
);
...
...
source/common/src/ttszip.c
浏览文件 @
222db126
...
...
@@ -30,7 +30,7 @@ static int32_t STSBufUpdateHeader(STSBuf* pTSBuf, STSBufFileHeader* pHeader);
* @return
*/
STSBuf
*
tsBufCreate
(
bool
autoDelete
,
int32_t
order
)
{
STSBuf
*
pTSBuf
=
c
alloc
(
1
,
sizeof
(
STSBuf
));
STSBuf
*
pTSBuf
=
taosMemoryC
alloc
(
1
,
sizeof
(
STSBuf
));
if
(
pTSBuf
==
NULL
)
{
return
NULL
;
}
...
...
@@ -41,7 +41,7 @@ STSBuf* tsBufCreate(bool autoDelete, int32_t order) {
// pTSBuf->pFile = fopen(pTSBuf->path, "wb+");
pTSBuf
->
pFile
=
taosOpenFile
(
pTSBuf
->
path
,
TD_FILE_CTEATE
|
TD_FILE_WRITE
|
TD_FILE_READ
|
TD_FILE_TRUNC
);
if
(
pTSBuf
->
pFile
==
NULL
)
{
f
ree
(
pTSBuf
);
taosMemoryF
ree
(
pTSBuf
);
return
NULL
;
}
...
...
@@ -66,7 +66,7 @@ STSBuf* tsBufCreate(bool autoDelete, int32_t order) {
}
STSBuf
*
tsBufCreateFromFile
(
const
char
*
path
,
bool
autoDelete
)
{
STSBuf
*
pTSBuf
=
c
alloc
(
1
,
sizeof
(
STSBuf
));
STSBuf
*
pTSBuf
=
taosMemoryC
alloc
(
1
,
sizeof
(
STSBuf
));
if
(
pTSBuf
==
NULL
)
{
return
NULL
;
}
...
...
@@ -78,7 +78,7 @@ STSBuf* tsBufCreateFromFile(const char* path, bool autoDelete) {
// pTSBuf->pFile = fopen(pTSBuf->path, "rb+");
pTSBuf
->
pFile
=
taosOpenFile
(
pTSBuf
->
path
,
TD_FILE_WRITE
|
TD_FILE_READ
);
if
(
pTSBuf
->
pFile
==
NULL
)
{
f
ree
(
pTSBuf
);
taosMemoryF
ree
(
pTSBuf
);
return
NULL
;
}
...
...
@@ -101,7 +101,7 @@ STSBuf* tsBufCreateFromFile(const char* path, bool autoDelete) {
if
(
header
.
numOfGroup
>
pTSBuf
->
numOfAlloc
)
{
pTSBuf
->
numOfAlloc
=
header
.
numOfGroup
;
STSGroupBlockInfoEx
*
tmp
=
r
ealloc
(
pTSBuf
->
pData
,
sizeof
(
STSGroupBlockInfoEx
)
*
pTSBuf
->
numOfAlloc
);
STSGroupBlockInfoEx
*
tmp
=
taosMemoryR
ealloc
(
pTSBuf
->
pData
,
sizeof
(
STSGroupBlockInfoEx
)
*
pTSBuf
->
numOfAlloc
);
if
(
tmp
==
NULL
)
{
tsBufDestroy
(
pTSBuf
);
return
NULL
;
...
...
@@ -122,7 +122,7 @@ STSBuf* tsBufCreateFromFile(const char* path, bool autoDelete) {
size_t
infoSize
=
sizeof
(
STSGroupBlockInfo
)
*
pTSBuf
->
numOfGroups
;
STSGroupBlockInfo
*
buf
=
(
STSGroupBlockInfo
*
)
c
alloc
(
1
,
infoSize
);
STSGroupBlockInfo
*
buf
=
(
STSGroupBlockInfo
*
)
taosMemoryC
alloc
(
1
,
infoSize
);
if
(
buf
==
NULL
)
{
tsBufDestroy
(
pTSBuf
);
return
NULL
;
...
...
@@ -137,7 +137,7 @@ STSBuf* tsBufCreateFromFile(const char* path, bool autoDelete) {
STSGroupBlockInfoEx
*
pBlockList
=
&
pTSBuf
->
pData
[
i
];
memcpy
(
&
pBlockList
->
info
,
&
buf
[
i
],
sizeof
(
STSGroupBlockInfo
));
}
f
ree
(
buf
);
taosMemoryF
ree
(
buf
);
ret
=
taosLSeekFile
(
pTSBuf
->
pFile
,
0
,
SEEK_END
);
UNUSED
(
ret
);
...
...
@@ -166,11 +166,11 @@ void* tsBufDestroy(STSBuf* pTSBuf) {
return
NULL
;
}
t
free
(
pTSBuf
->
assistBuf
);
t
free
(
pTSBuf
->
tsData
.
rawBuf
);
t
aosMemoryFreeClear
(
pTSBuf
->
assistBuf
);
t
aosMemoryFreeClear
(
pTSBuf
->
tsData
.
rawBuf
);
t
free
(
pTSBuf
->
pData
);
t
free
(
pTSBuf
->
block
.
payload
);
t
aosMemoryFreeClear
(
pTSBuf
->
pData
);
t
aosMemoryFreeClear
(
pTSBuf
->
block
.
payload
);
if
(
!
pTSBuf
->
remainOpen
)
{
taosCloseFile
(
&
pTSBuf
->
pFile
);
...
...
@@ -184,7 +184,7 @@ void* tsBufDestroy(STSBuf* pTSBuf) {
}
taosVariantDestroy
(
&
pTSBuf
->
block
.
tag
);
f
ree
(
pTSBuf
);
taosMemoryF
ree
(
pTSBuf
);
return
NULL
;
}
...
...
@@ -200,7 +200,7 @@ static STSGroupBlockInfoEx* addOneGroupInfo(STSBuf* pTSBuf, int32_t id) {
uint32_t
newSize
=
(
uint32_t
)(
pTSBuf
->
numOfAlloc
*
1
.
5
);
assert
((
int32_t
)
newSize
>
pTSBuf
->
numOfAlloc
);
STSGroupBlockInfoEx
*
tmp
=
(
STSGroupBlockInfoEx
*
)
r
ealloc
(
pTSBuf
->
pData
,
sizeof
(
STSGroupBlockInfoEx
)
*
newSize
);
STSGroupBlockInfoEx
*
tmp
=
(
STSGroupBlockInfoEx
*
)
taosMemoryR
ealloc
(
pTSBuf
->
pData
,
sizeof
(
STSGroupBlockInfoEx
)
*
newSize
);
if
(
tmp
==
NULL
)
{
return
NULL
;
}
...
...
@@ -240,7 +240,7 @@ static STSGroupBlockInfoEx* addOneGroupInfo(STSBuf* pTSBuf, int32_t id) {
static
void
shrinkBuffer
(
STSList
*
ptsData
)
{
// shrink tmp buffer size if it consumes too many memory compared to the pre-defined size
if
(
ptsData
->
allocSize
>=
ptsData
->
threshold
*
2
)
{
char
*
rawBuf
=
r
ealloc
(
ptsData
->
rawBuf
,
MEM_BUF_SIZE
);
char
*
rawBuf
=
taosMemoryR
ealloc
(
ptsData
->
rawBuf
,
MEM_BUF_SIZE
);
if
(
rawBuf
)
{
ptsData
->
rawBuf
=
rawBuf
;
ptsData
->
allocSize
=
MEM_BUF_SIZE
;
...
...
@@ -322,7 +322,7 @@ static void writeDataToDisk(STSBuf* pTSBuf) {
static
void
expandBuffer
(
STSList
*
ptsData
,
int32_t
inputSize
)
{
if
(
ptsData
->
allocSize
-
ptsData
->
len
<
inputSize
)
{
int32_t
newSize
=
inputSize
+
ptsData
->
len
;
char
*
tmp
=
r
ealloc
(
ptsData
->
rawBuf
,
(
size_t
)
newSize
);
char
*
tmp
=
taosMemoryR
ealloc
(
ptsData
->
rawBuf
,
(
size_t
)
newSize
);
if
(
tmp
==
NULL
)
{
// todo
}
...
...
@@ -366,7 +366,7 @@ STSBlock* readDataFromDisk(STSBuf* pTSBuf, int32_t order, bool decomp) {
// NOTE: mix types tags are not supported
size_t
sz
=
0
;
if
(
pBlock
->
tag
.
nType
==
TSDB_DATA_TYPE_BINARY
||
pBlock
->
tag
.
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
char
*
tp
=
r
ealloc
(
pBlock
->
tag
.
pz
,
pBlock
->
tag
.
nLen
+
1
);
char
*
tp
=
taosMemoryR
ealloc
(
pBlock
->
tag
.
pz
,
pBlock
->
tag
.
nLen
+
1
);
assert
(
tp
!=
NULL
);
memset
(
tp
,
0
,
pBlock
->
tag
.
nLen
+
1
);
...
...
@@ -812,7 +812,7 @@ int32_t tsBufMerge(STSBuf* pDestBuf, const STSBuf* pSrcBuf) {
if
(
pDestBuf
->
numOfAlloc
<
newSize
)
{
pDestBuf
->
numOfAlloc
=
newSize
;
STSGroupBlockInfoEx
*
tmp
=
r
ealloc
(
pDestBuf
->
pData
,
sizeof
(
STSGroupBlockInfoEx
)
*
newSize
);
STSGroupBlockInfoEx
*
tmp
=
taosMemoryR
ealloc
(
pDestBuf
->
pData
,
sizeof
(
STSGroupBlockInfoEx
)
*
newSize
);
if
(
tmp
==
NULL
)
{
return
-
1
;
}
...
...
@@ -1028,13 +1028,13 @@ static STSBuf* allocResForTSBuf(STSBuf* pTSBuf) {
const
int32_t
INITIAL_GROUPINFO_SIZE
=
4
;
pTSBuf
->
numOfAlloc
=
INITIAL_GROUPINFO_SIZE
;
pTSBuf
->
pData
=
c
alloc
(
pTSBuf
->
numOfAlloc
,
sizeof
(
STSGroupBlockInfoEx
));
pTSBuf
->
pData
=
taosMemoryC
alloc
(
pTSBuf
->
numOfAlloc
,
sizeof
(
STSGroupBlockInfoEx
));
if
(
pTSBuf
->
pData
==
NULL
)
{
tsBufDestroy
(
pTSBuf
);
return
NULL
;
}
pTSBuf
->
tsData
.
rawBuf
=
m
alloc
(
MEM_BUF_SIZE
);
pTSBuf
->
tsData
.
rawBuf
=
taosMemoryM
alloc
(
MEM_BUF_SIZE
);
if
(
pTSBuf
->
tsData
.
rawBuf
==
NULL
)
{
tsBufDestroy
(
pTSBuf
);
return
NULL
;
...
...
@@ -1044,13 +1044,13 @@ static STSBuf* allocResForTSBuf(STSBuf* pTSBuf) {
pTSBuf
->
tsData
.
threshold
=
MEM_BUF_SIZE
;
pTSBuf
->
tsData
.
allocSize
=
MEM_BUF_SIZE
;
pTSBuf
->
assistBuf
=
m
alloc
(
MEM_BUF_SIZE
);
pTSBuf
->
assistBuf
=
taosMemoryM
alloc
(
MEM_BUF_SIZE
);
if
(
pTSBuf
->
assistBuf
==
NULL
)
{
tsBufDestroy
(
pTSBuf
);
return
NULL
;
}
pTSBuf
->
block
.
payload
=
m
alloc
(
MEM_BUF_SIZE
);
pTSBuf
->
block
.
payload
=
taosMemoryM
alloc
(
MEM_BUF_SIZE
);
if
(
pTSBuf
->
block
.
payload
==
NULL
)
{
tsBufDestroy
(
pTSBuf
);
return
NULL
;
...
...
@@ -1079,7 +1079,7 @@ void tsBufGetGroupIdList(STSBuf* pTSBuf, int32_t* num, int32_t** id) {
return
;
}
(
*
id
)
=
m
alloc
(
tsBufGetNumOfGroup
(
pTSBuf
)
*
sizeof
(
int32_t
));
(
*
id
)
=
taosMemoryM
alloc
(
tsBufGetNumOfGroup
(
pTSBuf
)
*
sizeof
(
int32_t
));
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
(
*
id
)[
i
]
=
pTSBuf
->
pData
[
i
].
info
.
id
;
...
...
source/common/src/tvariant.c
浏览文件 @
222db126
...
...
@@ -199,14 +199,14 @@ void taosVariantCreateFromBinary(SVariant *pVar, const char *pz, size_t len, uin
case
TSDB_DATA_TYPE_NCHAR
:
{
// here we get the nchar length from raw binary bits length
size_t
lenInwchar
=
len
/
TSDB_NCHAR_SIZE
;
pVar
->
ucs4
=
c
alloc
(
1
,
(
lenInwchar
+
1
)
*
TSDB_NCHAR_SIZE
);
pVar
->
ucs4
=
taosMemoryC
alloc
(
1
,
(
lenInwchar
+
1
)
*
TSDB_NCHAR_SIZE
);
memcpy
(
pVar
->
ucs4
,
pz
,
lenInwchar
*
TSDB_NCHAR_SIZE
);
pVar
->
nLen
=
(
int32_t
)
len
;
break
;
}
case
TSDB_DATA_TYPE_BINARY
:
{
// todo refactor, extract a method
pVar
->
pz
=
c
alloc
(
len
+
1
,
sizeof
(
char
));
pVar
->
pz
=
taosMemoryC
alloc
(
len
+
1
,
sizeof
(
char
));
memcpy
(
pVar
->
pz
,
pz
,
len
);
pVar
->
nLen
=
(
int32_t
)
len
;
break
;
...
...
@@ -224,7 +224,7 @@ void taosVariantDestroy(SVariant *pVar) {
if
(
pVar
==
NULL
)
return
;
if
(
pVar
->
nType
==
TSDB_DATA_TYPE_BINARY
||
pVar
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
t
free
(
pVar
->
pz
);
t
aosMemoryFreeClear
(
pVar
->
pz
);
pVar
->
nLen
=
0
;
}
...
...
@@ -233,7 +233,7 @@ void taosVariantDestroy(SVariant *pVar) {
size_t
num
=
taosArrayGetSize
(
pVar
->
arr
);
for
(
size_t
i
=
0
;
i
<
num
;
i
++
)
{
void
*
p
=
taosArrayGetP
(
pVar
->
arr
,
i
);
f
ree
(
p
);
taosMemoryF
ree
(
p
);
}
taosArrayDestroy
(
pVar
->
arr
);
pVar
->
arr
=
NULL
;
...
...
@@ -254,7 +254,7 @@ void taosVariantAssign(SVariant *pDst, const SVariant *pSrc) {
pDst
->
nType
=
pSrc
->
nType
;
if
(
pSrc
->
nType
==
TSDB_DATA_TYPE_BINARY
||
pSrc
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
int32_t
len
=
pSrc
->
nLen
+
TSDB_NCHAR_SIZE
;
char
*
p
=
r
ealloc
(
pDst
->
pz
,
len
);
char
*
p
=
taosMemoryR
ealloc
(
pDst
->
pz
,
len
);
assert
(
p
);
memset
(
p
,
0
,
len
);
...
...
@@ -402,18 +402,18 @@ static int32_t toBinary(SVariant *pVariant, char **pDest, int32_t *pDestSize) {
// it is a in-place convert type for SVariant, local buffer is needed
if
(
*
pDest
==
pVariant
->
pz
)
{
pBuf
=
c
alloc
(
1
,
INITIAL_ALLOC_SIZE
);
pBuf
=
taosMemoryC
alloc
(
1
,
INITIAL_ALLOC_SIZE
);
}
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
size_t
newSize
=
pVariant
->
nLen
*
TSDB_NCHAR_SIZE
;
if
(
pBuf
!=
NULL
)
{
if
(
newSize
>=
INITIAL_ALLOC_SIZE
)
{
pBuf
=
r
ealloc
(
pBuf
,
newSize
+
1
);
pBuf
=
taosMemoryR
ealloc
(
pBuf
,
newSize
+
1
);
}
taosUcs4ToMbs
(
pVariant
->
ucs4
,
(
int32_t
)
newSize
,
pBuf
);
f
ree
(
pVariant
->
ucs4
);
taosMemoryF
ree
(
pVariant
->
ucs4
);
pBuf
[
newSize
]
=
0
;
}
else
{
taosUcs4ToMbs
(
pVariant
->
ucs4
,
(
int32_t
)
newSize
,
*
pDest
);
...
...
@@ -460,23 +460,23 @@ static int32_t toNchar(SVariant *pVariant, char **pDest, int32_t *pDestSize) {
}
if
(
*
pDest
==
pVariant
->
pz
)
{
TdUcs4
*
pWStr
=
c
alloc
(
1
,
(
nLen
+
1
)
*
TSDB_NCHAR_SIZE
);
TdUcs4
*
pWStr
=
taosMemoryC
alloc
(
1
,
(
nLen
+
1
)
*
TSDB_NCHAR_SIZE
);
bool
ret
=
taosMbsToUcs4
(
pDst
,
nLen
,
pWStr
,
(
nLen
+
1
)
*
TSDB_NCHAR_SIZE
,
NULL
);
if
(
!
ret
)
{
t
free
(
pWStr
);
t
aosMemoryFreeClear
(
pWStr
);
return
-
1
;
}
// free the binary buffer in the first place
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_BINARY
)
{
f
ree
(
pVariant
->
ucs4
);
taosMemoryF
ree
(
pVariant
->
ucs4
);
}
pVariant
->
ucs4
=
pWStr
;
*
pDestSize
=
taosUcs4len
(
pVariant
->
ucs4
);
// shrink the allocate memory, no need to check here.
char
*
tmp
=
r
ealloc
(
pVariant
->
ucs4
,
(
*
pDestSize
+
1
)
*
TSDB_NCHAR_SIZE
);
char
*
tmp
=
taosMemoryR
ealloc
(
pVariant
->
ucs4
,
(
*
pDestSize
+
1
)
*
TSDB_NCHAR_SIZE
);
assert
(
tmp
!=
NULL
);
pVariant
->
ucs4
=
(
TdUcs4
*
)
tmp
;
...
...
@@ -526,7 +526,7 @@ static FORCE_INLINE int32_t convertToInteger(SVariant *pVariant, int64_t *result
if (token.type == TK_NULL) {
if (releaseVariantPtr) {
f
ree(pVariant->pz);
taosMemoryF
ree(pVariant->pz);
pVariant->nLen = 0;
}
...
...
@@ -547,7 +547,7 @@ static FORCE_INLINE int32_t convertToInteger(SVariant *pVariant, int64_t *result
}
if (releaseVariantPtr) {
f
ree(pVariant->pz);
taosMemoryF
ree(pVariant->pz);
pVariant->nLen = 0;
}
...
...
@@ -566,7 +566,7 @@ static FORCE_INLINE int32_t convertToInteger(SVariant *pVariant, int64_t *result
if (token.type == TK_FLOAT) {
double v = wcstod(pVariant->ucs4, &endPtr);
if (releaseVariantPtr) {
f
ree(pVariant->pz);
taosMemoryF
ree(pVariant->pz);
pVariant->nLen = 0;
}
...
...
@@ -577,7 +577,7 @@ static FORCE_INLINE int32_t convertToInteger(SVariant *pVariant, int64_t *result
*result = (int64_t)v;
} else if (token.type == TK_NULL) {
if (releaseVariantPtr) {
f
ree(pVariant->pz);
taosMemoryF
ree(pVariant->pz);
pVariant->nLen = 0;
}
setNull((char *)result, type, tDataTypes[type].bytes);
...
...
@@ -585,7 +585,7 @@ static FORCE_INLINE int32_t convertToInteger(SVariant *pVariant, int64_t *result
} else {
int64_t val = wcstoll(pVariant->ucs4, &endPtr, 10);
if (releaseVariantPtr) {
f
ree(pVariant->pz);
taosMemoryF
ree(pVariant->pz);
pVariant->nLen = 0;
}
...
...
@@ -971,21 +971,21 @@ int32_t taosVariantTypeSetType(SVariant *pVariant, char type) {
errno
=
0
;
double
v
=
strtod
(
pVariant
->
pz
,
NULL
);
if
((
errno
==
ERANGE
&&
v
==
-
1
)
||
(
isinf
(
v
)
||
isnan
(
v
)))
{
f
ree
(
pVariant
->
pz
);
taosMemoryF
ree
(
pVariant
->
pz
);
return
-
1
;
}
f
ree
(
pVariant
->
pz
);
taosMemoryF
ree
(
pVariant
->
pz
);
pVariant
->
d
=
v
;
}
else
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
errno
=
0
;
double
v
=
wcstod
(
pVariant
->
ucs4
,
NULL
);
if
((
errno
==
ERANGE
&&
v
==
-
1
)
||
(
isinf
(
v
)
||
isnan
(
v
)))
{
f
ree
(
pVariant
->
pz
);
taosMemoryF
ree
(
pVariant
->
pz
);
return
-
1
;
}
f
ree
(
pVariant
->
pz
);
taosMemoryF
ree
(
pVariant
->
pz
);
pVariant
->
d
=
v
;
}
else
if
(
pVariant
->
nType
>=
TSDB_DATA_TYPE_BOOL
&&
pVariant
->
nType
<=
TSDB_DATA_TYPE_BIGINT
)
{
double
tmp
=
(
double
)
pVariant
->
i
;
...
...
source/common/test/commonTests.cpp
浏览文件 @
222db126
...
...
@@ -99,7 +99,7 @@ TEST(testCase, toInteger_test) {
}
TEST
(
testCase
,
Datablock_test
)
{
SSDataBlock
*
b
=
static_cast
<
SSDataBlock
*>
(
c
alloc
(
1
,
sizeof
(
SSDataBlock
)));
SSDataBlock
*
b
=
static_cast
<
SSDataBlock
*>
(
taosMemoryC
alloc
(
1
,
sizeof
(
SSDataBlock
)));
b
->
info
.
numOfCols
=
2
;
b
->
pDataBlock
=
taosArrayInit
(
4
,
sizeof
(
SColumnInfoData
));
...
...
@@ -108,8 +108,8 @@ TEST(testCase, Datablock_test) {
infoData
.
info
.
type
=
TSDB_DATA_TYPE_INT
;
infoData
.
info
.
colId
=
1
;
infoData
.
pData
=
(
char
*
)
c
alloc
(
40
,
infoData
.
info
.
bytes
);
infoData
.
nullbitmap
=
(
char
*
)
c
alloc
(
1
,
sizeof
(
char
)
*
(
40
/
8
));
infoData
.
pData
=
(
char
*
)
taosMemoryC
alloc
(
40
,
infoData
.
info
.
bytes
);
infoData
.
nullbitmap
=
(
char
*
)
taosMemoryC
alloc
(
1
,
sizeof
(
char
)
*
(
40
/
8
));
taosArrayPush
(
b
->
pDataBlock
,
&
infoData
);
SColumnInfoData
infoData1
=
{
0
};
...
...
@@ -117,7 +117,7 @@ TEST(testCase, Datablock_test) {
infoData1
.
info
.
type
=
TSDB_DATA_TYPE_BINARY
;
infoData1
.
info
.
colId
=
2
;
infoData1
.
varmeta
.
offset
=
(
int32_t
*
)
c
alloc
(
40
,
sizeof
(
uint32_t
));
infoData1
.
varmeta
.
offset
=
(
int32_t
*
)
taosMemoryC
alloc
(
40
,
sizeof
(
uint32_t
));
taosArrayPush
(
b
->
pDataBlock
,
&
infoData1
);
char
*
str
=
"the value of: %d"
;
...
...
@@ -178,7 +178,7 @@ TEST(testCase, Datablock_test) {
#if 0
TEST(testCase, non_var_dataBlock_split_test) {
SSDataBlock* b = static_cast<SSDataBlock*>(
c
alloc(1, sizeof(SSDataBlock)));
SSDataBlock* b = static_cast<SSDataBlock*>(
taosMemoryC
alloc(1, sizeof(SSDataBlock)));
b->info.numOfCols = 2;
b->pDataBlock = taosArrayInit(4, sizeof(SColumnInfoData));
...
...
@@ -189,8 +189,8 @@ TEST(testCase, non_var_dataBlock_split_test) {
int32_t numOfRows = 1000000;
infoData.pData = (char*)
c
alloc(numOfRows, infoData.info.bytes);
infoData.nullbitmap = (char*)
c
alloc(1, sizeof(char) * (numOfRows/8));
infoData.pData = (char*)
taosMemoryC
alloc(numOfRows, infoData.info.bytes);
infoData.nullbitmap = (char*)
taosMemoryC
alloc(1, sizeof(char) * (numOfRows/8));
taosArrayPush(b->pDataBlock, &infoData);
SColumnInfoData infoData1 = {0};
...
...
@@ -198,8 +198,8 @@ TEST(testCase, non_var_dataBlock_split_test) {
infoData1.info.type = TSDB_DATA_TYPE_TINYINT;
infoData1.info.colId = 2;
infoData1.pData = (char*)
c
alloc(numOfRows, infoData.info.bytes);
infoData1.nullbitmap = (char*)
c
alloc(1, sizeof(char) * (numOfRows/8));
infoData1.pData = (char*)
taosMemoryC
alloc(numOfRows, infoData.info.bytes);
infoData1.nullbitmap = (char*)
taosMemoryC
alloc(1, sizeof(char) * (numOfRows/8));
taosArrayPush(b->pDataBlock, &infoData1);
for(int32_t i = 0; i < numOfRows; ++i) {
...
...
@@ -233,7 +233,7 @@ TEST(testCase, non_var_dataBlock_split_test) {
#endif
TEST
(
testCase
,
var_dataBlock_split_test
)
{
SSDataBlock
*
b
=
static_cast
<
SSDataBlock
*>
(
c
alloc
(
1
,
sizeof
(
SSDataBlock
)));
SSDataBlock
*
b
=
static_cast
<
SSDataBlock
*>
(
taosMemoryC
alloc
(
1
,
sizeof
(
SSDataBlock
)));
b
->
info
.
numOfCols
=
2
;
b
->
pDataBlock
=
taosArrayInit
(
4
,
sizeof
(
SColumnInfoData
));
...
...
@@ -244,8 +244,8 @@ TEST(testCase, var_dataBlock_split_test) {
infoData
.
info
.
type
=
TSDB_DATA_TYPE_INT
;
infoData
.
info
.
colId
=
1
;
infoData
.
pData
=
(
char
*
)
c
alloc
(
numOfRows
,
infoData
.
info
.
bytes
);
infoData
.
nullbitmap
=
(
char
*
)
c
alloc
(
1
,
sizeof
(
char
)
*
(
numOfRows
/
8
));
infoData
.
pData
=
(
char
*
)
taosMemoryC
alloc
(
numOfRows
,
infoData
.
info
.
bytes
);
infoData
.
nullbitmap
=
(
char
*
)
taosMemoryC
alloc
(
1
,
sizeof
(
char
)
*
(
numOfRows
/
8
));
taosArrayPush
(
b
->
pDataBlock
,
&
infoData
);
SColumnInfoData
infoData1
=
{
0
};
...
...
@@ -253,7 +253,7 @@ TEST(testCase, var_dataBlock_split_test) {
infoData1
.
info
.
type
=
TSDB_DATA_TYPE_BINARY
;
infoData1
.
info
.
colId
=
2
;
infoData1
.
varmeta
.
offset
=
(
int32_t
*
)
c
alloc
(
numOfRows
,
sizeof
(
uint32_t
));
infoData1
.
varmeta
.
offset
=
(
int32_t
*
)
taosMemoryC
alloc
(
numOfRows
,
sizeof
(
uint32_t
));
taosArrayPush
(
b
->
pDataBlock
,
&
infoData1
);
char
buf
[
41
]
=
{
0
};
...
...
source/dnode/bnode/src/bnode.c
浏览文件 @
222db126
...
...
@@ -16,12 +16,12 @@
#include "bndInt.h"
SBnode
*
bndOpen
(
const
char
*
path
,
const
SBnodeOpt
*
pOption
)
{
SBnode
*
pBnode
=
c
alloc
(
1
,
sizeof
(
SBnode
));
SBnode
*
pBnode
=
taosMemoryC
alloc
(
1
,
sizeof
(
SBnode
));
pBnode
->
msgCb
=
pOption
->
msgCb
;
return
pBnode
;
}
void
bndClose
(
SBnode
*
pBnode
)
{
f
ree
(
pBnode
);
}
void
bndClose
(
SBnode
*
pBnode
)
{
taosMemoryF
ree
(
pBnode
);
}
int32_t
bndGetLoad
(
SBnode
*
pBnode
,
SBnodeLoad
*
pLoad
)
{
return
0
;
}
...
...
source/dnode/mgmt/bnode/src/bmInt.c
浏览文件 @
222db126
...
...
@@ -73,7 +73,7 @@ int32_t bmDrop(SMgmtWrapper *pWrapper) {
bmCloseImp
(
pMgmt
);
taosRemoveDir
(
pMgmt
->
path
);
pWrapper
->
pMgmt
=
NULL
;
f
ree
(
pMgmt
);
taosMemoryF
ree
(
pMgmt
);
dInfo
(
"bnode-mgmt is dropped"
);
return
0
;
}
...
...
@@ -85,13 +85,13 @@ static void bmClose(SMgmtWrapper *pWrapper) {
dInfo
(
"bnode-mgmt start to cleanup"
);
bmCloseImp
(
pMgmt
);
pWrapper
->
pMgmt
=
NULL
;
f
ree
(
pMgmt
);
taosMemoryF
ree
(
pMgmt
);
dInfo
(
"bnode-mgmt is cleaned up"
);
}
int32_t
bmOpen
(
SMgmtWrapper
*
pWrapper
)
{
dInfo
(
"bnode-mgmt start to init"
);
SBnodeMgmt
*
pMgmt
=
c
alloc
(
1
,
sizeof
(
SBnodeMgmt
));
SBnodeMgmt
*
pMgmt
=
taosMemoryC
alloc
(
1
,
sizeof
(
SBnodeMgmt
));
if
(
pMgmt
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
source/dnode/mgmt/container/src/dndExec.c
浏览文件 @
222db126
...
...
@@ -139,7 +139,7 @@ static void dndConsumeParentQueue(SMgmtWrapper *pWrapper, SRpcMsg *pRsp, int32_t
dTrace
(
"msg:%p, get from parent queue"
,
pRsp
);
pRsp
->
pCont
=
pCont
;
dndSendRpcRsp
(
pWrapper
,
pRsp
);
f
ree
(
pRsp
);
taosMemoryF
ree
(
pRsp
);
}
static
int32_t
dndRunInMultiProcess
(
SDnode
*
pDnode
)
{
...
...
@@ -174,8 +174,8 @@ static int32_t dndRunInMultiProcess(SDnode *pDnode) {
.
childFreeBodyFp
=
(
ProcFreeFp
)
rpcFreeCont
,
.
parentQueueSize
=
1024
*
1024
*
2
,
// size will be a configuration item
.
parentConsumeFp
=
(
ProcConsumeFp
)
dndConsumeParentQueue
,
.
parentdMallocHeadFp
=
(
ProcMallocFp
)
m
alloc
,
.
parentFreeHeadFp
=
(
ProcFreeFp
)
f
ree
,
.
parentdMallocHeadFp
=
(
ProcMallocFp
)
taosMemoryM
alloc
,
.
parentFreeHeadFp
=
(
ProcFreeFp
)
taosMemoryF
ree
,
.
parentMallocBodyFp
=
(
ProcMallocFp
)
rpcMallocCont
,
.
parentFreeBodyFp
=
(
ProcFreeFp
)
rpcFreeCont
,
.
testFlag
=
0
,
...
...
source/dnode/mgmt/container/src/dndFile.c
浏览文件 @
222db126
...
...
@@ -20,7 +20,7 @@ int32_t dndReadFile(SMgmtWrapper *pWrapper, bool *pDeployed) {
int32_t
code
=
TSDB_CODE_NODE_PARSE_FILE_ERROR
;
int32_t
len
=
0
;
int32_t
maxLen
=
1024
;
char
*
content
=
c
alloc
(
1
,
maxLen
+
1
);
char
*
content
=
taosMemoryC
alloc
(
1
,
maxLen
+
1
);
cJSON
*
root
=
NULL
;
char
file
[
PATH_MAX
];
TdFilePtr
pFile
=
NULL
;
...
...
@@ -57,7 +57,7 @@ int32_t dndReadFile(SMgmtWrapper *pWrapper, bool *pDeployed) {
dDebug
(
"succcessed to read file %s, deployed:%d"
,
file
,
*
pDeployed
);
_OVER:
if
(
content
!=
NULL
)
f
ree
(
content
);
if
(
content
!=
NULL
)
taosMemoryF
ree
(
content
);
if
(
root
!=
NULL
)
cJSON_Delete
(
root
);
if
(
pFile
!=
NULL
)
taosCloseFile
(
&
pFile
);
...
...
@@ -78,7 +78,7 @@ int32_t dndWriteFile(SMgmtWrapper *pWrapper, bool deployed) {
int32_t
len
=
0
;
int32_t
maxLen
=
1024
;
char
*
content
=
c
alloc
(
1
,
maxLen
+
1
);
char
*
content
=
taosMemoryC
alloc
(
1
,
maxLen
+
1
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"{
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
deployed
\"
: %d
\n
"
,
deployed
);
...
...
@@ -87,7 +87,7 @@ int32_t dndWriteFile(SMgmtWrapper *pWrapper, bool deployed) {
taosWriteFile
(
pFile
,
content
,
len
);
taosFsyncFile
(
pFile
);
taosCloseFile
(
&
pFile
);
f
ree
(
content
);
taosMemoryF
ree
(
content
);
char
realfile
[
PATH_MAX
];
snprintf
(
realfile
,
sizeof
(
realfile
),
"%s%s%s.json"
,
pWrapper
->
path
,
TD_DIRSEP
,
pWrapper
->
name
);
...
...
source/dnode/mgmt/container/src/dndObj.c
浏览文件 @
222db126
...
...
@@ -39,19 +39,19 @@ static int32_t dndInitMemory(SDnode *pDnode, const SDnodeOpt *pOption) {
static
void
dndClearMemory
(
SDnode
*
pDnode
)
{
for
(
ENodeType
n
=
0
;
n
<
NODE_MAX
;
++
n
)
{
SMgmtWrapper
*
pMgmt
=
&
pDnode
->
wrappers
[
n
];
t
free
(
pMgmt
->
path
);
t
aosMemoryFreeClear
(
pMgmt
->
path
);
}
if
(
pDnode
->
pLockFile
!=
NULL
)
{
taosUnLockFile
(
pDnode
->
pLockFile
);
taosCloseFile
(
&
pDnode
->
pLockFile
);
pDnode
->
pLockFile
=
NULL
;
}
t
free
(
pDnode
->
localEp
);
t
free
(
pDnode
->
localFqdn
);
t
free
(
pDnode
->
firstEp
);
t
free
(
pDnode
->
secondEp
);
t
free
(
pDnode
->
dataDir
);
f
ree
(
pDnode
);
t
aosMemoryFreeClear
(
pDnode
->
localEp
);
t
aosMemoryFreeClear
(
pDnode
->
localFqdn
);
t
aosMemoryFreeClear
(
pDnode
->
firstEp
);
t
aosMemoryFreeClear
(
pDnode
->
secondEp
);
t
aosMemoryFreeClear
(
pDnode
->
dataDir
);
taosMemoryF
ree
(
pDnode
);
dDebug
(
"dnode object memory is cleared, data:%p"
,
pDnode
);
}
...
...
@@ -61,7 +61,7 @@ SDnode *dndCreate(const SDnodeOpt *pOption) {
char
path
[
PATH_MAX
]
=
{
0
};
SDnode
*
pDnode
=
NULL
;
pDnode
=
c
alloc
(
1
,
sizeof
(
SDnode
));
pDnode
=
taosMemoryC
alloc
(
1
,
sizeof
(
SDnode
));
if
(
pDnode
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_OVER
;
...
...
source/dnode/mgmt/dnode/src/dmFile.c
浏览文件 @
222db126
...
...
@@ -24,7 +24,7 @@ int32_t dmReadFile(SDnodeMgmt *pMgmt) {
int32_t
code
=
TSDB_CODE_NODE_PARSE_FILE_ERROR
;
int32_t
len
=
0
;
int32_t
maxLen
=
256
*
1024
;
char
*
content
=
c
alloc
(
1
,
maxLen
+
1
);
char
*
content
=
taosMemoryC
alloc
(
1
,
maxLen
+
1
);
cJSON
*
root
=
NULL
;
char
file
[
PATH_MAX
];
TdFilePtr
pFile
=
NULL
;
...
...
@@ -134,7 +134,7 @@ int32_t dmReadFile(SDnodeMgmt *pMgmt) {
dmPrintDnodes
(
pMgmt
);
PRASE_DNODE_OVER:
if
(
content
!=
NULL
)
f
ree
(
content
);
if
(
content
!=
NULL
)
taosMemoryF
ree
(
content
);
if
(
root
!=
NULL
)
cJSON_Delete
(
root
);
if
(
pFile
!=
NULL
)
taosCloseFile
(
&
pFile
);
...
...
@@ -171,7 +171,7 @@ int32_t dmWriteFile(SDnodeMgmt *pMgmt) {
int32_t
len
=
0
;
int32_t
maxLen
=
256
*
1024
;
char
*
content
=
c
alloc
(
1
,
maxLen
+
1
);
char
*
content
=
taosMemoryC
alloc
(
1
,
maxLen
+
1
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"{
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
dnodeId
\"
: %d,
\n
"
,
pDnode
->
dnodeId
);
...
...
@@ -197,7 +197,7 @@ int32_t dmWriteFile(SDnodeMgmt *pMgmt) {
taosWriteFile
(
pFile
,
content
,
len
);
taosFsyncFile
(
pFile
);
taosCloseFile
(
&
pFile
);
f
ree
(
content
);
taosMemoryF
ree
(
content
);
char
realfile
[
PATH_MAX
];
snprintf
(
realfile
,
sizeof
(
realfile
),
"%s%smnode.json"
,
pMgmt
->
path
,
TD_DIRSEP
);
...
...
source/dnode/mgmt/dnode/src/dmInt.c
浏览文件 @
222db126
...
...
@@ -80,7 +80,7 @@ static int32_t dmStart(SMgmtWrapper *pWrapper) {
int32_t
dmInit
(
SMgmtWrapper
*
pWrapper
)
{
SDnode
*
pDnode
=
pWrapper
->
pDnode
;
SDnodeMgmt
*
pMgmt
=
c
alloc
(
1
,
sizeof
(
SDnodeMgmt
));
SDnodeMgmt
*
pMgmt
=
taosMemoryC
alloc
(
1
,
sizeof
(
SDnodeMgmt
));
dInfo
(
"dnode-mgmt start to init"
);
pDnode
->
dnodeId
=
0
;
...
...
@@ -138,7 +138,7 @@ void dmCleanup(SMgmtWrapper *pWrapper) {
taosWUnLockLatch
(
&
pMgmt
->
latch
);
f
ree
(
pMgmt
);
taosMemoryF
ree
(
pMgmt
);
pWrapper
->
pMgmt
=
NULL
;
dInfo
(
"dnode-mgmt is cleaned up"
);
}
...
...
source/dnode/mgmt/mnode/src/mmFile.c
浏览文件 @
222db126
...
...
@@ -20,7 +20,7 @@ int32_t mmReadFile(SMnodeMgmt *pMgmt, bool *pDeployed) {
int32_t
code
=
TSDB_CODE_NODE_PARSE_FILE_ERROR
;
int32_t
len
=
0
;
int32_t
maxLen
=
4096
;
char
*
content
=
c
alloc
(
1
,
maxLen
+
1
);
char
*
content
=
taosMemoryC
alloc
(
1
,
maxLen
+
1
);
cJSON
*
root
=
NULL
;
char
file
[
PATH_MAX
];
TdFilePtr
pFile
=
NULL
;
...
...
@@ -97,7 +97,7 @@ int32_t mmReadFile(SMnodeMgmt *pMgmt, bool *pDeployed) {
dDebug
(
"succcessed to read file %s, deployed:%d"
,
file
,
*
pDeployed
);
PRASE_MNODE_OVER:
if
(
content
!=
NULL
)
f
ree
(
content
);
if
(
content
!=
NULL
)
taosMemoryF
ree
(
content
);
if
(
root
!=
NULL
)
cJSON_Delete
(
root
);
if
(
pFile
!=
NULL
)
taosCloseFile
(
&
pFile
);
...
...
@@ -118,7 +118,7 @@ int32_t mmWriteFile(SMnodeMgmt *pMgmt, bool deployed) {
int32_t
len
=
0
;
int32_t
maxLen
=
4096
;
char
*
content
=
c
alloc
(
1
,
maxLen
+
1
);
char
*
content
=
taosMemoryC
alloc
(
1
,
maxLen
+
1
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"{
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
deployed
\"
: %d,
\n
"
,
deployed
);
...
...
@@ -139,7 +139,7 @@ int32_t mmWriteFile(SMnodeMgmt *pMgmt, bool deployed) {
taosWriteFile
(
pFile
,
content
,
len
);
taosFsyncFile
(
pFile
);
taosCloseFile
(
&
pFile
);
f
ree
(
content
);
taosMemoryF
ree
(
content
);
char
realfile
[
PATH_MAX
];
snprintf
(
realfile
,
sizeof
(
realfile
),
"%s%smnode.json"
,
pMgmt
->
path
,
TD_DIRSEP
);
...
...
source/dnode/mgmt/mnode/src/mmInt.c
浏览文件 @
222db126
...
...
@@ -177,7 +177,7 @@ int32_t mmDrop(SMgmtWrapper *pWrapper) {
mmCloseImp
(
pMgmt
);
taosRemoveDir
(
pMgmt
->
path
);
pWrapper
->
pMgmt
=
NULL
;
f
ree
(
pMgmt
);
taosMemoryF
ree
(
pMgmt
);
dInfo
(
"mnode-mgmt is dropped"
);
return
0
;
}
...
...
@@ -189,7 +189,7 @@ static void mmClose(SMgmtWrapper *pWrapper) {
dInfo
(
"mnode-mgmt start to cleanup"
);
mmCloseImp
(
pMgmt
);
pWrapper
->
pMgmt
=
NULL
;
f
ree
(
pMgmt
);
taosMemoryF
ree
(
pMgmt
);
dInfo
(
"mnode-mgmt is cleaned up"
);
}
...
...
@@ -200,7 +200,7 @@ int32_t mmOpenFromMsg(SMgmtWrapper *pWrapper, SDCreateMnodeReq *pReq) {
return
-
1
;
}
SMnodeMgmt
*
pMgmt
=
c
alloc
(
1
,
sizeof
(
SMnodeMgmt
));
SMnodeMgmt
*
pMgmt
=
taosMemoryC
alloc
(
1
,
sizeof
(
SMnodeMgmt
));
if
(
pMgmt
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
source/dnode/mgmt/qnode/src/qmInt.c
浏览文件 @
222db126
...
...
@@ -76,7 +76,7 @@ int32_t qmDrop(SMgmtWrapper *pWrapper) {
qmCloseImp
(
pMgmt
);
taosRemoveDir
(
pMgmt
->
path
);
pWrapper
->
pMgmt
=
NULL
;
f
ree
(
pMgmt
);
taosMemoryF
ree
(
pMgmt
);
dInfo
(
"qnode-mgmt is dropped"
);
return
0
;
}
...
...
@@ -88,13 +88,13 @@ static void qmClose(SMgmtWrapper *pWrapper) {
dInfo
(
"qnode-mgmt start to cleanup"
);
qmCloseImp
(
pMgmt
);
pWrapper
->
pMgmt
=
NULL
;
f
ree
(
pMgmt
);
taosMemoryF
ree
(
pMgmt
);
dInfo
(
"qnode-mgmt is cleaned up"
);
}
int32_t
qmOpen
(
SMgmtWrapper
*
pWrapper
)
{
dInfo
(
"qnode-mgmt start to init"
);
SQnodeMgmt
*
pMgmt
=
c
alloc
(
1
,
sizeof
(
SQnodeMgmt
));
SQnodeMgmt
*
pMgmt
=
taosMemoryC
alloc
(
1
,
sizeof
(
SQnodeMgmt
));
if
(
pMgmt
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
source/dnode/mgmt/snode/src/smInt.c
浏览文件 @
222db126
...
...
@@ -73,7 +73,7 @@ int32_t smDrop(SMgmtWrapper *pWrapper) {
smCloseImp
(
pMgmt
);
taosRemoveDir
(
pMgmt
->
path
);
pWrapper
->
pMgmt
=
NULL
;
f
ree
(
pMgmt
);
taosMemoryF
ree
(
pMgmt
);
dInfo
(
"snode-mgmt is dropped"
);
return
0
;
}
...
...
@@ -85,13 +85,13 @@ static void smClose(SMgmtWrapper *pWrapper) {
dInfo
(
"snode-mgmt start to cleanup"
);
smCloseImp
(
pMgmt
);
pWrapper
->
pMgmt
=
NULL
;
f
ree
(
pMgmt
);
taosMemoryF
ree
(
pMgmt
);
dInfo
(
"snode-mgmt is cleaned up"
);
}
int32_t
smOpen
(
SMgmtWrapper
*
pWrapper
)
{
dInfo
(
"snode-mgmt start to init"
);
SSnodeMgmt
*
pMgmt
=
c
alloc
(
1
,
sizeof
(
SSnodeMgmt
));
SSnodeMgmt
*
pMgmt
=
taosMemoryC
alloc
(
1
,
sizeof
(
SSnodeMgmt
));
if
(
pMgmt
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
source/dnode/mgmt/snode/src/smWorker.c
浏览文件 @
222db126
...
...
@@ -51,7 +51,7 @@ int32_t smStartWorker(SSnodeMgmt *pMgmt) {
}
for
(
int32_t
i
=
0
;
i
<
SND_UNIQUE_THREAD_NUM
;
i
++
)
{
SMultiWorker
*
pUniqueWorker
=
m
alloc
(
sizeof
(
SMultiWorker
));
SMultiWorker
*
pUniqueWorker
=
taosMemoryM
alloc
(
sizeof
(
SMultiWorker
));
if
(
pUniqueWorker
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
source/dnode/mgmt/test/sut/inc/sut.h
浏览文件 @
222db126
...
...
@@ -98,7 +98,7 @@ class Testbase {
#define CheckBinaryByte(b, len) \
{ \
char* bytes = (char*)
c
alloc(1, len); \
char* bytes = (char*)
taosMemoryC
alloc(1, len); \
for (int32_t i = 0; i < len - 1; ++i) { \
bytes[i] = b; \
} \
...
...
source/dnode/mgmt/test/sut/src/client.cpp
浏览文件 @
222db126
...
...
@@ -25,9 +25,9 @@ static void processClientRsp(void* parent, SRpcMsg* pRsp, SEpSet* pEpSet) {
void
TestClient
::
SetRpcRsp
(
SRpcMsg
*
rsp
)
{
if
(
this
->
pRsp
)
{
f
ree
(
this
->
pRsp
);
taosMemoryF
ree
(
this
->
pRsp
);
}
this
->
pRsp
=
(
SRpcMsg
*
)
c
alloc
(
1
,
sizeof
(
SRpcMsg
));
this
->
pRsp
=
(
SRpcMsg
*
)
taosMemoryC
alloc
(
1
,
sizeof
(
SRpcMsg
));
this
->
pRsp
->
msgType
=
rsp
->
msgType
;
this
->
pRsp
->
code
=
rsp
->
code
;
this
->
pRsp
->
pCont
=
rsp
->
pCont
;
...
...
source/dnode/mgmt/vnode/src/vmFile.c
浏览文件 @
222db126
...
...
@@ -21,7 +21,7 @@ SVnodeObj **vmGetVnodesFromHash(SVnodesMgmt *pMgmt, int32_t *numOfVnodes) {
int32_t
num
=
0
;
int32_t
size
=
taosHashGetSize
(
pMgmt
->
hash
);
SVnodeObj
**
pVnodes
=
c
alloc
(
size
,
sizeof
(
SVnodeObj
*
));
SVnodeObj
**
pVnodes
=
taosMemoryC
alloc
(
size
,
sizeof
(
SVnodeObj
*
));
void
*
pIter
=
taosHashIterate
(
pMgmt
->
hash
,
NULL
);
while
(
pIter
)
{
...
...
@@ -48,7 +48,7 @@ int32_t vmGetVnodesFromFile(SVnodesMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t *n
int32_t
code
=
TSDB_CODE_NODE_PARSE_FILE_ERROR
;
int32_t
len
=
0
;
int32_t
maxLen
=
30000
;
char
*
content
=
c
alloc
(
1
,
maxLen
+
1
);
char
*
content
=
taosMemoryC
alloc
(
1
,
maxLen
+
1
);
cJSON
*
root
=
NULL
;
FILE
*
fp
=
NULL
;
char
file
[
PATH_MAX
];
...
...
@@ -85,7 +85,7 @@ int32_t vmGetVnodesFromFile(SVnodesMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t *n
int32_t
vnodesNum
=
cJSON_GetArraySize
(
vnodes
);
if
(
vnodesNum
>
0
)
{
pCfgs
=
c
alloc
(
vnodesNum
,
sizeof
(
SWrapperCfg
));
pCfgs
=
taosMemoryC
alloc
(
vnodesNum
,
sizeof
(
SWrapperCfg
));
if
(
pCfgs
==
NULL
)
{
dError
(
"failed to read %s since out of memory"
,
file
);
goto
PRASE_VNODE_OVER
;
...
...
@@ -140,7 +140,7 @@ int32_t vmGetVnodesFromFile(SVnodesMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t *n
dInfo
(
"succcessed to read file %s"
,
file
);
PRASE_VNODE_OVER:
if
(
content
!=
NULL
)
f
ree
(
content
);
if
(
content
!=
NULL
)
taosMemoryF
ree
(
content
);
if
(
root
!=
NULL
)
cJSON_Delete
(
root
);
if
(
pFile
!=
NULL
)
taosCloseFile
(
&
pFile
);
...
...
@@ -166,7 +166,7 @@ int32_t vmWriteVnodesToFile(SVnodesMgmt *pMgmt) {
int32_t
len
=
0
;
int32_t
maxLen
=
65536
;
char
*
content
=
c
alloc
(
1
,
maxLen
+
1
);
char
*
content
=
taosMemoryC
alloc
(
1
,
maxLen
+
1
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"{
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
vnodes
\"
: [
\n
"
);
...
...
@@ -190,7 +190,7 @@ int32_t vmWriteVnodesToFile(SVnodesMgmt *pMgmt) {
taosWriteFile
(
pFile
,
content
,
len
);
taosFsyncFile
(
pFile
);
taosCloseFile
(
&
pFile
);
f
ree
(
content
);
taosMemoryF
ree
(
content
);
terrno
=
0
;
for
(
int32_t
i
=
0
;
i
<
numOfVnodes
;
++
i
)
{
...
...
@@ -199,7 +199,7 @@ int32_t vmWriteVnodesToFile(SVnodesMgmt *pMgmt) {
}
if
(
pVnodes
!=
NULL
)
{
f
ree
(
pVnodes
);
taosMemoryF
ree
(
pVnodes
);
}
dDebug
(
"successed to write %s"
,
realfile
);
...
...
source/dnode/mgmt/vnode/src/vmInt.c
浏览文件 @
222db126
...
...
@@ -46,7 +46,7 @@ void vmReleaseVnode(SVnodesMgmt *pMgmt, SVnodeObj *pVnode) {
}
int32_t
vmOpenVnode
(
SVnodesMgmt
*
pMgmt
,
SWrapperCfg
*
pCfg
,
SVnode
*
pImpl
)
{
SVnodeObj
*
pVnode
=
c
alloc
(
1
,
sizeof
(
SVnodeObj
));
SVnodeObj
*
pVnode
=
taosMemoryC
alloc
(
1
,
sizeof
(
SVnodeObj
));
if
(
pVnode
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -107,9 +107,9 @@ void vmCloseVnode(SVnodesMgmt *pMgmt, SVnodeObj *pVnode) {
vnodeDestroy
(
pVnode
->
path
);
}
f
ree
(
pVnode
->
path
);
f
ree
(
pVnode
->
db
);
f
ree
(
pVnode
);
taosMemoryF
ree
(
pVnode
->
path
);
taosMemoryF
ree
(
pVnode
->
db
);
taosMemoryF
ree
(
pVnode
);
}
static
void
*
vmOpenVnodeFunc
(
void
*
param
)
{
...
...
@@ -183,11 +183,11 @@ static int32_t vmOpenVnodes(SVnodesMgmt *pMgmt) {
#endif
int32_t
vnodesPerThread
=
numOfVnodes
/
threadNum
+
1
;
SVnodeThread
*
threads
=
c
alloc
(
threadNum
,
sizeof
(
SVnodeThread
));
SVnodeThread
*
threads
=
taosMemoryC
alloc
(
threadNum
,
sizeof
(
SVnodeThread
));
for
(
int32_t
t
=
0
;
t
<
threadNum
;
++
t
)
{
threads
[
t
].
threadIndex
=
t
;
threads
[
t
].
pMgmt
=
pMgmt
;
threads
[
t
].
pCfgs
=
c
alloc
(
vnodesPerThread
,
sizeof
(
SWrapperCfg
));
threads
[
t
].
pCfgs
=
taosMemoryC
alloc
(
vnodesPerThread
,
sizeof
(
SWrapperCfg
));
}
for
(
int32_t
v
=
0
;
v
<
numOfVnodes
;
++
v
)
{
...
...
@@ -217,10 +217,10 @@ static int32_t vmOpenVnodes(SVnodesMgmt *pMgmt) {
if
(
pThread
->
vnodeNum
>
0
&&
taosCheckPthreadValid
(
pThread
->
thread
))
{
taosThreadJoin
(
pThread
->
thread
,
NULL
);
}
f
ree
(
pThread
->
pCfgs
);
taosMemoryF
ree
(
pThread
->
pCfgs
);
}
f
ree
(
threads
);
f
ree
(
pCfgs
);
taosMemoryF
ree
(
threads
);
taosMemoryF
ree
(
pCfgs
);
if
(
pMgmt
->
state
.
openVnodes
!=
pMgmt
->
state
.
totalVnodes
)
{
dError
(
"there are total vnodes:%d, opened:%d"
,
pMgmt
->
state
.
totalVnodes
,
pMgmt
->
state
.
openVnodes
);
...
...
@@ -242,7 +242,7 @@ static void vmCloseVnodes(SVnodesMgmt *pMgmt) {
}
if
(
pVnodes
!=
NULL
)
{
f
ree
(
pVnodes
);
taosMemoryF
ree
(
pVnodes
);
}
if
(
pMgmt
->
hash
!=
NULL
)
{
...
...
@@ -262,14 +262,14 @@ static void vmCleanup(SMgmtWrapper *pWrapper) {
vmStopWorker
(
pMgmt
);
vnodeCleanup
();
// walCleanUp();
f
ree
(
pMgmt
);
taosMemoryF
ree
(
pMgmt
);
pWrapper
->
pMgmt
=
NULL
;
dInfo
(
"vnode-mgmt is cleaned up"
);
}
static
int32_t
vmInit
(
SMgmtWrapper
*
pWrapper
)
{
SDnode
*
pDnode
=
pWrapper
->
pDnode
;
SVnodesMgmt
*
pMgmt
=
c
alloc
(
1
,
sizeof
(
SVnodesMgmt
));
SVnodesMgmt
*
pMgmt
=
taosMemoryC
alloc
(
1
,
sizeof
(
SVnodesMgmt
));
int32_t
code
=
-
1
;
dInfo
(
"vnode-mgmt start to init"
);
...
...
source/dnode/mgmt/vnode/src/vmWorker.c
浏览文件 @
222db126
...
...
@@ -117,7 +117,7 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
if
(
pRsp
!=
NULL
)
{
pRsp
->
ahandle
=
pRpc
->
ahandle
;
dndSendRsp
(
pVnode
->
pWrapper
,
pRsp
);
f
ree
(
pRsp
);
taosMemoryF
ree
(
pRsp
);
}
else
{
if
(
code
!=
0
&&
terrno
!=
0
)
code
=
terrno
;
vmSendRsp
(
pVnode
->
pWrapper
,
pMsg
,
code
);
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
222db126
...
...
@@ -442,7 +442,7 @@ static FORCE_INLINE void* tDecodeSMqConsumerEp(void** buf, SMqConsumerEp* pConsu
static
FORCE_INLINE
void
tDeleteSMqConsumerEp
(
SMqConsumerEp
*
pConsumerEp
)
{
if
(
pConsumerEp
)
{
t
free
(
pConsumerEp
->
qmsg
);
t
aosMemoryFreeClear
(
pConsumerEp
->
qmsg
);
}
}
...
...
@@ -511,7 +511,7 @@ typedef struct {
}
SMqSubscribeObj
;
static
FORCE_INLINE
SMqSubscribeObj
*
tNewSubscribeObj
()
{
SMqSubscribeObj
*
pSub
=
c
alloc
(
1
,
sizeof
(
SMqSubscribeObj
));
SMqSubscribeObj
*
pSub
=
taosMemoryC
alloc
(
1
,
sizeof
(
SMqSubscribeObj
));
if
(
pSub
==
NULL
)
{
return
NULL
;
}
...
...
@@ -538,10 +538,10 @@ static FORCE_INLINE SMqSubscribeObj* tNewSubscribeObj() {
return
pSub
;
_err:
t
free
(
pSub
->
consumers
);
t
free
(
pSub
->
lostConsumers
);
t
free
(
pSub
->
unassignedVg
);
t
free
(
pSub
);
t
aosMemoryFreeClear
(
pSub
->
consumers
);
t
aosMemoryFreeClear
(
pSub
->
lostConsumers
);
t
aosMemoryFreeClear
(
pSub
->
unassignedVg
);
t
aosMemoryFreeClear
(
pSub
);
return
NULL
;
}
...
...
source/dnode/mnode/impl/src/mndAcct.c
浏览文件 @
222db126
...
...
@@ -158,7 +158,7 @@ static SSdbRow *mndAcctActionDecode(SSdbRaw *pRaw) {
ACCT_DECODE_OVER:
if
(
terrno
!=
0
)
{
mError
(
"acct:%s, failed to decode from raw:%p since %s"
,
pAcct
->
acct
,
pRaw
,
terrstr
());
t
free
(
pRow
);
t
aosMemoryFreeClear
(
pRow
);
return
NULL
;
}
...
...
source/dnode/mnode/impl/src/mndBnode.c
浏览文件 @
222db126
...
...
@@ -126,7 +126,7 @@ static SSdbRow *mndBnodeActionDecode(SSdbRaw *pRaw) {
BNODE_DECODE_OVER:
if
(
terrno
!=
0
)
{
mError
(
"bnode:%d, failed to decode from raw:%p since %s"
,
pObj
->
id
,
pRaw
,
terrstr
());
t
free
(
pRow
);
t
aosMemoryFreeClear
(
pRow
);
return
NULL
;
}
...
...
@@ -191,7 +191,7 @@ static int32_t mndSetCreateBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
createReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
m
alloc
(
contLen
);
void
*
pReq
=
taosMemoryM
alloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -206,7 +206,7 @@ static int32_t mndSetCreateBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
action
.
acceptableCode
=
TSDB_CODE_NODE_ALREADY_DEPLOYED
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
return
-
1
;
}
...
...
@@ -218,7 +218,7 @@ static int32_t mndSetCreateBnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
dropReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
m
alloc
(
contLen
);
void
*
pReq
=
taosMemoryM
alloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -233,7 +233,7 @@ static int32_t mndSetCreateBnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
action
.
acceptableCode
=
TSDB_CODE_NODE_NOT_DEPLOYED
;
if
(
mndTransAppendUndoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
return
-
1
;
}
...
...
@@ -341,7 +341,7 @@ static int32_t mndSetDropBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SBn
dropReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
m
alloc
(
contLen
);
void
*
pReq
=
taosMemoryM
alloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -356,7 +356,7 @@ static int32_t mndSetDropBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SBn
action
.
acceptableCode
=
TSDB_CODE_NODE_NOT_DEPLOYED
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
return
-
1
;
}
...
...
source/dnode/mnode/impl/src/mndCluster.c
浏览文件 @
222db126
...
...
@@ -116,7 +116,7 @@ static SSdbRow *mndClusterActionDecode(SSdbRaw *pRaw) {
CLUSTER_DECODE_OVER:
if
(
terrno
!=
0
)
{
mError
(
"cluster:%"
PRId64
", failed to decode from raw:%p since %s"
,
pCluster
->
id
,
pRaw
,
terrstr
());
t
free
(
pRow
);
t
aosMemoryFreeClear
(
pRow
);
return
NULL
;
}
...
...
source/dnode/mnode/impl/src/mndConsumer.c
浏览文件 @
222db126
...
...
@@ -54,7 +54,7 @@ int32_t mndInitConsumer(SMnode *pMnode) {
void
mndCleanupConsumer
(
SMnode
*
pMnode
)
{}
SMqConsumerObj
*
mndCreateConsumer
(
int64_t
consumerId
,
const
char
*
cgroup
)
{
SMqConsumerObj
*
pConsumer
=
c
alloc
(
1
,
sizeof
(
SMqConsumerObj
));
SMqConsumerObj
*
pConsumer
=
taosMemoryC
alloc
(
1
,
sizeof
(
SMqConsumerObj
));
if
(
pConsumer
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
...
...
@@ -79,7 +79,7 @@ SSdbRaw *mndConsumerActionEncode(SMqConsumerObj *pConsumer) {
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_CONSUMER
,
MND_CONSUMER_VER_NUMBER
,
size
);
if
(
pRaw
==
NULL
)
goto
CM_ENCODE_OVER
;
buf
=
m
alloc
(
tlen
);
buf
=
taosMemoryM
alloc
(
tlen
);
if
(
buf
==
NULL
)
goto
CM_ENCODE_OVER
;
void
*
abuf
=
buf
;
...
...
@@ -94,7 +94,7 @@ SSdbRaw *mndConsumerActionEncode(SMqConsumerObj *pConsumer) {
terrno
=
TSDB_CODE_SUCCESS
;
CM_ENCODE_OVER:
t
free
(
buf
);
t
aosMemoryFreeClear
(
buf
);
if
(
terrno
!=
0
)
{
mError
(
"consumer:%"
PRId64
", failed to encode to raw:%p since %s"
,
pConsumer
->
consumerId
,
pRaw
,
terrstr
());
sdbFreeRaw
(
pRaw
);
...
...
@@ -126,7 +126,7 @@ SSdbRow *mndConsumerActionDecode(SSdbRaw *pRaw) {
int32_t
dataPos
=
0
;
int32_t
len
;
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
len
,
CM_DECODE_OVER
);
buf
=
m
alloc
(
len
);
buf
=
taosMemoryM
alloc
(
len
);
if
(
buf
==
NULL
)
goto
CM_DECODE_OVER
;
SDB_GET_BINARY
(
pRaw
,
dataPos
,
buf
,
len
,
CM_DECODE_OVER
);
SDB_GET_RESERVE
(
pRaw
,
dataPos
,
MND_CONSUMER_RESERVE_SIZE
,
CM_DECODE_OVER
);
...
...
@@ -138,10 +138,10 @@ SSdbRow *mndConsumerActionDecode(SSdbRaw *pRaw) {
terrno
=
TSDB_CODE_SUCCESS
;
CM_DECODE_OVER:
t
free
(
buf
);
t
aosMemoryFreeClear
(
buf
);
if
(
terrno
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"consumer:%"
PRId64
", failed to decode from raw:%p since %s"
,
pConsumer
->
consumerId
,
pRaw
,
terrstr
());
t
free
(
pRow
);
t
aosMemoryFreeClear
(
pRow
);
return
NULL
;
}
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
222db126
...
...
@@ -193,7 +193,7 @@ static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw) {
DB_DECODE_OVER:
if
(
terrno
!=
0
)
{
mError
(
"db:%s, failed to decode from raw:%p since %s"
,
pDb
->
name
,
pRaw
,
terrstr
());
t
free
(
pRow
);
t
aosMemoryFreeClear
(
pRow
);
return
NULL
;
}
...
...
@@ -370,7 +370,7 @@ static int32_t mndSetCreateDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
action
.
msgType
=
TDMT_DND_CREATE_VNODE
;
action
.
acceptableCode
=
TSDB_CODE_DND_VNODE_ALREADY_DEPLOYED
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
return
-
1
;
}
}
...
...
@@ -401,7 +401,7 @@ static int32_t mndSetCreateDbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj
action
.
msgType
=
TDMT_DND_DROP_VNODE
;
action
.
acceptableCode
=
TSDB_CODE_DND_VNODE_NOT_DEPLOYED
;
if
(
mndTransAppendUndoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
return
-
1
;
}
}
...
...
@@ -483,7 +483,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SNodeMsg *pReq, SCreateDbReq *pCreate
code
=
0
;
CREATE_DB_OVER:
f
ree
(
pVgroups
);
taosMemoryF
ree
(
pVgroups
);
mndTransDrop
(
pTrans
);
return
code
;
}
...
...
@@ -622,7 +622,7 @@ static int32_t mndBuildUpdateVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_DND_ALTER_VNODE
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
return
-
1
;
}
}
...
...
@@ -802,7 +802,7 @@ static int32_t mndBuildDropVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *
action
.
msgType
=
TDMT_DND_DROP_VNODE
;
action
.
acceptableCode
=
TSDB_CODE_DND_VNODE_NOT_DEPLOYED
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
return
-
1
;
}
}
...
...
@@ -845,7 +845,7 @@ static int32_t mndBuildDropDbRsp(SDbObj *pDb, int32_t *pRspLen, void **ppRsp, bo
if
(
useRpcMalloc
)
{
pRsp
=
rpcMallocCont
(
rspLen
);
}
else
{
pRsp
=
m
alloc
(
rspLen
);
pRsp
=
taosMemoryM
alloc
(
rspLen
);
}
if
(
pRsp
==
NULL
)
{
...
...
@@ -1156,7 +1156,7 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbVgVersion *pDbs, int32_t numOfDbs,
}
int32_t
rspLen
=
tSerializeSUseDbBatchRsp
(
NULL
,
0
,
&
batchUseRsp
);
void
*
pRsp
=
m
alloc
(
rspLen
);
void
*
pRsp
=
taosMemoryM
alloc
(
rspLen
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
tFreeSUseDbBatchRsp
(
&
batchUseRsp
);
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
222db126
...
...
@@ -164,7 +164,7 @@ static SSdbRow *mndDnodeActionDecode(SSdbRaw *pRaw) {
DNODE_DECODE_OVER:
if
(
terrno
!=
0
)
{
mError
(
"dnode:%d, failed to decode from raw:%p since %s"
,
pDnode
->
id
,
pRaw
,
terrstr
());
t
free
(
pRow
);
t
aosMemoryFreeClear
(
pRow
);
return
NULL
;
}
...
...
source/dnode/mnode/impl/src/mndFunc.c
浏览文件 @
222db126
...
...
@@ -127,8 +127,8 @@ static SSdbRow *mndFuncActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pFunc
->
commentSize
,
FUNC_DECODE_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pFunc
->
codeSize
,
FUNC_DECODE_OVER
)
pFunc
->
pComment
=
c
alloc
(
1
,
pFunc
->
commentSize
);
pFunc
->
pCode
=
c
alloc
(
1
,
pFunc
->
codeSize
);
pFunc
->
pComment
=
taosMemoryC
alloc
(
1
,
pFunc
->
commentSize
);
pFunc
->
pCode
=
taosMemoryC
alloc
(
1
,
pFunc
->
codeSize
);
if
(
pFunc
->
pComment
==
NULL
||
pFunc
->
pCode
==
NULL
)
{
goto
FUNC_DECODE_OVER
;
}
...
...
@@ -142,7 +142,7 @@ static SSdbRow *mndFuncActionDecode(SSdbRaw *pRaw) {
FUNC_DECODE_OVER:
if
(
terrno
!=
0
)
{
mError
(
"func:%s, failed to decode from raw:%p since %s"
,
pFunc
->
name
,
pRaw
,
terrstr
());
t
free
(
pRow
);
t
aosMemoryFreeClear
(
pRow
);
return
NULL
;
}
...
...
@@ -157,8 +157,8 @@ static int32_t mndFuncActionInsert(SSdb *pSdb, SFuncObj *pFunc) {
static
int32_t
mndFuncActionDelete
(
SSdb
*
pSdb
,
SFuncObj
*
pFunc
)
{
mTrace
(
"func:%s, perform delete action, row:%p"
,
pFunc
->
name
,
pFunc
);
t
free
(
pFunc
->
pCode
);
t
free
(
pFunc
->
pComment
);
t
aosMemoryFreeClear
(
pFunc
->
pCode
);
t
aosMemoryFreeClear
(
pFunc
->
pComment
);
return
0
;
}
...
...
@@ -196,8 +196,8 @@ static int32_t mndCreateFunc(SMnode *pMnode, SNodeMsg *pReq, SCreateFuncReq *pCr
func
.
signature
=
pCreate
->
signature
;
func
.
commentSize
=
pCreate
->
commentSize
;
func
.
codeSize
=
pCreate
->
codeSize
;
func
.
pComment
=
m
alloc
(
func
.
commentSize
);
func
.
pCode
=
m
alloc
(
func
.
codeSize
);
func
.
pComment
=
taosMemoryM
alloc
(
func
.
commentSize
);
func
.
pCode
=
taosMemoryM
alloc
(
func
.
codeSize
);
if
(
func
.
pCode
==
NULL
||
func
.
pCode
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
CREATE_FUNC_OVER
;
...
...
@@ -228,8 +228,8 @@ static int32_t mndCreateFunc(SMnode *pMnode, SNodeMsg *pReq, SCreateFuncReq *pCr
code
=
0
;
CREATE_FUNC_OVER:
f
ree
(
func
.
pCode
);
f
ree
(
func
.
pComment
);
taosMemoryF
ree
(
func
.
pCode
);
taosMemoryF
ree
(
func
.
pComment
);
mndTransDrop
(
pTrans
);
return
code
;
}
...
...
source/dnode/mnode/impl/src/mndInfoSchema.c
浏览文件 @
222db126
...
...
@@ -152,7 +152,7 @@ static const SInfosTableMeta infosMeta[] = {{TSDB_INS_TABLE_DNODES, dnodesSchema
//connection/application/
int32_t
mndInitInfosTableSchema
(
const
SInfosTableSchema
*
pSrc
,
int32_t
colNum
,
SSchema
**
pDst
)
{
SSchema
*
schema
=
c
alloc
(
colNum
,
sizeof
(
SSchema
));
SSchema
*
schema
=
taosMemoryC
alloc
(
colNum
,
sizeof
(
SSchema
));
if
(
NULL
==
schema
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -210,7 +210,7 @@ int32_t mndBuildInsTableSchema(SMnode *pMnode, const char *dbFName, const char *
*
pRsp
=
*
meta
;
pRsp
->
pSchemas
=
c
alloc
(
meta
->
numOfColumns
,
sizeof
(
SSchema
));
pRsp
->
pSchemas
=
taosMemoryC
alloc
(
meta
->
numOfColumns
,
sizeof
(
SSchema
));
if
(
pRsp
->
pSchemas
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
pRsp
->
pSchemas
=
NULL
;
...
...
@@ -241,7 +241,7 @@ void mndCleanupInfos(SMnode *pMnode) {
while
(
pIter
)
{
STableMetaRsp
*
meta
=
(
STableMetaRsp
*
)
pIter
;
t
free
(
meta
->
pSchemas
);
t
aosMemoryFreeClear
(
meta
->
pSchemas
);
pIter
=
taosHashIterate
(
pMnode
->
infosMeta
,
pIter
);
}
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
222db126
...
...
@@ -180,7 +180,7 @@ static SSdbRow *mndMnodeActionDecode(SSdbRaw *pRaw) {
MNODE_DECODE_OVER:
if
(
terrno
!=
0
)
{
mError
(
"mnode:%d, failed to decode from raw:%p since %s"
,
pObj
->
id
,
pRaw
,
terrstr
());
t
free
(
pRow
);
t
aosMemoryFreeClear
(
pRow
);
return
NULL
;
}
...
...
@@ -313,7 +313,7 @@ static int32_t mndSetCreateMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDno
createReq
.
dnodeId
=
pMObj
->
id
;
int32_t
contLen
=
tSerializeSDCreateMnodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
m
alloc
(
contLen
);
void
*
pReq
=
taosMemoryM
alloc
(
contLen
);
tSerializeSDCreateMnodeReq
(
pReq
,
contLen
,
&
createReq
);
action
.
epSet
=
mndGetDnodeEpset
(
pMObj
->
pDnode
);
...
...
@@ -323,7 +323,7 @@ static int32_t mndSetCreateMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDno
action
.
acceptableCode
=
TSDB_CODE_NODE_ALREADY_DEPLOYED
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pMObj
);
return
-
1
;
...
...
@@ -338,7 +338,7 @@ static int32_t mndSetCreateMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDno
createReq
.
dnodeId
=
pObj
->
id
;
int32_t
contLen
=
tSerializeSDCreateMnodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
m
alloc
(
contLen
);
void
*
pReq
=
taosMemoryM
alloc
(
contLen
);
tSerializeSDCreateMnodeReq
(
pReq
,
contLen
,
&
createReq
);
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
...
...
@@ -347,7 +347,7 @@ static int32_t mndSetCreateMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDno
action
.
msgType
=
TDMT_DND_CREATE_MNODE
;
action
.
acceptableCode
=
TSDB_CODE_NODE_ALREADY_DEPLOYED
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
return
-
1
;
}
}
...
...
@@ -483,7 +483,7 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
alterReq
.
dnodeId
=
pMObj
->
id
;
int32_t
contLen
=
tSerializeSDCreateMnodeReq
(
NULL
,
0
,
&
alterReq
);
void
*
pReq
=
m
alloc
(
contLen
);
void
*
pReq
=
taosMemoryM
alloc
(
contLen
);
tSerializeSDCreateMnodeReq
(
pReq
,
contLen
,
&
alterReq
);
action
.
epSet
=
mndGetDnodeEpset
(
pMObj
->
pDnode
);
...
...
@@ -493,7 +493,7 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
action
.
acceptableCode
=
TSDB_CODE_NODE_ALREADY_DEPLOYED
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pMObj
);
return
-
1
;
...
...
@@ -510,7 +510,7 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
SDDropMnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
pObj
->
id
;
int32_t
contLen
=
tSerializeSMCreateDropMnodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
m
alloc
(
contLen
);
void
*
pReq
=
taosMemoryM
alloc
(
contLen
);
tSerializeSMCreateDropMnodeReq
(
pReq
,
contLen
,
&
dropReq
);
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
...
...
@@ -519,7 +519,7 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
action
.
msgType
=
TDMT_DND_DROP_MNODE
;
action
.
acceptableCode
=
TSDB_CODE_NODE_NOT_DEPLOYED
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
return
-
1
;
}
}
...
...
source/dnode/mnode/impl/src/mndOffset.c
浏览文件 @
222db126
...
...
@@ -59,7 +59,7 @@ SSdbRaw *mndOffsetActionEncode(SMqOffsetObj *pOffset) {
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_OFFSET
,
MND_OFFSET_VER_NUMBER
,
size
);
if
(
pRaw
==
NULL
)
goto
OFFSET_ENCODE_OVER
;
buf
=
m
alloc
(
tlen
);
buf
=
taosMemoryM
alloc
(
tlen
);
if
(
buf
==
NULL
)
goto
OFFSET_ENCODE_OVER
;
void
*
abuf
=
buf
;
...
...
@@ -74,7 +74,7 @@ SSdbRaw *mndOffsetActionEncode(SMqOffsetObj *pOffset) {
terrno
=
TSDB_CODE_SUCCESS
;
OFFSET_ENCODE_OVER:
t
free
(
buf
);
t
aosMemoryFreeClear
(
buf
);
if
(
terrno
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"offset:%s, failed to encode to raw:%p since %s"
,
pOffset
->
key
,
pRaw
,
terrstr
());
sdbFreeRaw
(
pRaw
);
...
...
@@ -107,7 +107,7 @@ SSdbRow *mndOffsetActionDecode(SSdbRaw *pRaw) {
int32_t
dataPos
=
0
;
int32_t
tlen
;
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
tlen
,
OFFSET_DECODE_OVER
);
buf
=
m
alloc
(
tlen
+
1
);
buf
=
taosMemoryM
alloc
(
tlen
+
1
);
if
(
buf
==
NULL
)
goto
OFFSET_DECODE_OVER
;
SDB_GET_BINARY
(
pRaw
,
dataPos
,
buf
,
tlen
,
OFFSET_DECODE_OVER
);
SDB_GET_RESERVE
(
pRaw
,
dataPos
,
MND_OFFSET_RESERVE_SIZE
,
OFFSET_DECODE_OVER
);
...
...
@@ -119,10 +119,10 @@ SSdbRow *mndOffsetActionDecode(SSdbRaw *pRaw) {
terrno
=
TSDB_CODE_SUCCESS
;
OFFSET_DECODE_OVER:
t
free
(
buf
);
t
aosMemoryFreeClear
(
buf
);
if
(
terrno
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"offset:%s, failed to decode from raw:%p since %s"
,
pOffset
->
key
,
pRaw
,
terrstr
());
t
free
(
pRow
);
t
aosMemoryFreeClear
(
pRow
);
return
NULL
;
}
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
222db126
...
...
@@ -130,7 +130,7 @@ static SConnObj *mndCreateConn(SMnode *pMnode, SRpcConnInfo *pInfo, int32_t pid,
}
static
void
mndFreeConn
(
SConnObj
*
pConn
)
{
t
free
(
pConn
->
pQueries
);
t
aosMemoryFreeClear
(
pConn
->
pQueries
);
mTrace
(
"conn:%d, is destroyed, data:%p"
,
pConn
->
id
,
pConn
);
}
...
...
@@ -260,7 +260,7 @@ static int32_t mndSaveQueryStreamList(SConnObj *pConn, SHeartBeatReq *pReq) {
if
(
numOfQueries
>
0
)
{
if
(
pConn
->
pQueries
==
NULL
)
{
pConn
->
pQueries
=
c
alloc
(
sizeof
(
SQueryDesc
),
QUERY_SAVE_SIZE
);
pConn
->
pQueries
=
taosMemoryC
alloc
(
sizeof
(
SQueryDesc
),
QUERY_SAVE_SIZE
);
}
pConn
->
numOfQueries
=
TMIN
(
QUERY_SAVE_SIZE
,
numOfQueries
);
...
...
@@ -276,7 +276,7 @@ static int32_t mndSaveQueryStreamList(SConnObj *pConn, SHeartBeatReq *pReq) {
static
SClientHbRsp
*
mndMqHbBuildRsp
(
SMnode
*
pMnode
,
SClientHbReq
*
pReq
)
{
#if 0
SClientHbRsp* pRsp =
m
alloc(sizeof(SClientHbRsp));
SClientHbRsp* pRsp =
taosMemoryM
alloc(sizeof(SClientHbRsp));
if (pRsp == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return NULL;
...
...
@@ -292,7 +292,7 @@ static SClientHbRsp *mndMqHbBuildRsp(SMnode *pMnode, SClientHbReq *pReq) {
SHashObj* pObj = pReq->info;
SKv* pKv = taosHashGet(pObj, "mq-tmp", strlen("mq-tmp") + 1);
if (pKv == NULL) {
f
ree(pRsp);
taosMemoryF
ree(pRsp);
return NULL;
}
SMqHbMsg mqHb;
...
...
@@ -325,7 +325,7 @@ static SClientHbRsp *mndMqHbBuildRsp(SMnode *pMnode, SClientHbReq *pReq) {
taosArrayPush(batchRsp.batchRsps, &innerBatchRsp);
}
int32_t tlen = taosEncodeSMqHbBatchRsp(NULL, &batchRsp);
void* buf =
m
alloc(tlen);
void* buf =
taosMemoryM
alloc(tlen);
if (buf == NULL) {
//TODO
return NULL;
...
...
@@ -402,7 +402,7 @@ static int32_t mndProcessHeartBeatReq(SNodeMsg *pReq) {
SClientHbRsp
*
pRsp
=
mndMqHbBuildRsp
(
pMnode
,
pHbReq
);
if
(
pRsp
!=
NULL
)
{
taosArrayPush
(
batchRsp
.
rsps
,
pRsp
);
f
ree
(
pRsp
);
taosMemoryF
ree
(
pRsp
);
}
}
}
...
...
@@ -418,7 +418,7 @@ static int32_t mndProcessHeartBeatReq(SNodeMsg *pReq) {
int32_t
kvNum
=
(
rsp
->
info
)
?
taosArrayGetSize
(
rsp
->
info
)
:
0
;
for
(
int32_t
n
=
0
;
n
<
kvNum
;
++
n
)
{
SKv
*
kv
=
taosArrayGet
(
rsp
->
info
,
n
);
t
free
(
kv
->
value
);
t
aosMemoryFreeClear
(
kv
->
value
);
}
taosArrayDestroy
(
rsp
->
info
);
}
...
...
source/dnode/mnode/impl/src/mndQnode.c
浏览文件 @
222db126
...
...
@@ -128,7 +128,7 @@ static SSdbRow *mndQnodeActionDecode(SSdbRaw *pRaw) {
QNODE_DECODE_OVER:
if
(
terrno
!=
0
)
{
mError
(
"qnode:%d, failed to decode from raw:%p since %s"
,
pObj
->
id
,
pRaw
,
terrstr
());
t
free
(
pRow
);
t
aosMemoryFreeClear
(
pRow
);
return
NULL
;
}
...
...
@@ -193,7 +193,7 @@ static int32_t mndSetCreateQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
createReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
m
alloc
(
contLen
);
void
*
pReq
=
taosMemoryM
alloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -208,7 +208,7 @@ static int32_t mndSetCreateQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
action
.
acceptableCode
=
TSDB_CODE_NODE_ALREADY_DEPLOYED
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
return
-
1
;
}
...
...
@@ -220,7 +220,7 @@ static int32_t mndSetCreateQnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
dropReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
m
alloc
(
contLen
);
void
*
pReq
=
taosMemoryM
alloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -235,7 +235,7 @@ static int32_t mndSetCreateQnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
action
.
acceptableCode
=
TSDB_CODE_NODE_NOT_DEPLOYED
;
if
(
mndTransAppendUndoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
return
-
1
;
}
...
...
@@ -343,7 +343,7 @@ static int32_t mndSetDropQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQn
dropReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
m
alloc
(
contLen
);
void
*
pReq
=
taosMemoryM
alloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -358,7 +358,7 @@ static int32_t mndSetDropQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQn
action
.
acceptableCode
=
TSDB_CODE_NODE_NOT_DEPLOYED
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
return
-
1
;
}
...
...
@@ -474,7 +474,7 @@ static int32_t mndProcessQnodeListReq(SNodeMsg *pReq) {
}
int32_t
rspLen
=
tSerializeSQnodeListRsp
(
NULL
,
0
,
&
qlistRsp
);
void
*
pRsp
=
m
alloc
(
rspLen
);
void
*
pRsp
=
taosMemoryM
alloc
(
rspLen
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
QNODE_LIST_OVER
;
...
...
source/dnode/mnode/impl/src/mndScheduler.c
浏览文件 @
222db126
...
...
@@ -41,7 +41,7 @@ int32_t mndPersistTaskDeployReq(STrans* pTrans, SStreamTask* pTask, const SEpSet
int32_t
size
=
encoder
.
pos
;
int32_t
tlen
=
sizeof
(
SMsgHead
)
+
size
;
tCoderClear
(
&
encoder
);
void
*
buf
=
m
alloc
(
tlen
);
void
*
buf
=
taosMemoryM
alloc
(
tlen
);
if
(
buf
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -58,7 +58,7 @@ int32_t mndPersistTaskDeployReq(STrans* pTrans, SStreamTask* pTask, const SEpSet
action
.
contLen
=
tlen
;
action
.
msgType
=
type
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
buf
);
taosMemoryF
ree
(
buf
);
return
-
1
;
}
return
0
;
...
...
source/dnode/mnode/impl/src/mndShow.c
浏览文件 @
222db126
...
...
@@ -146,7 +146,7 @@ static int32_t mndProcessShowReq(SNodeMsg *pReq) {
}
showRsp
.
showId
=
pShow
->
id
;
showRsp
.
tableMeta
.
pSchemas
=
c
alloc
(
TSDB_MAX_COLUMNS
,
sizeof
(
SSchema
));
showRsp
.
tableMeta
.
pSchemas
=
taosMemoryC
alloc
(
TSDB_MAX_COLUMNS
,
sizeof
(
SSchema
));
if
(
showRsp
.
tableMeta
.
pSchemas
==
NULL
)
{
mndReleaseShowObj
(
pShow
,
true
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
source/dnode/mnode/impl/src/mndSma.c
浏览文件 @
222db126
...
...
@@ -160,25 +160,25 @@ static SSdbRow *mndSmaActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pSma
->
astLen
,
_OVER
)
if
(
pSma
->
exprLen
>
0
)
{
pSma
->
expr
=
c
alloc
(
pSma
->
exprLen
,
1
);
pSma
->
expr
=
taosMemoryC
alloc
(
pSma
->
exprLen
,
1
);
if
(
pSma
->
expr
==
NULL
)
goto
_OVER
;
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pSma
->
expr
,
pSma
->
exprLen
,
_OVER
)
}
if
(
pSma
->
tagsFilterLen
>
0
)
{
pSma
->
tagsFilter
=
c
alloc
(
pSma
->
tagsFilterLen
,
1
);
pSma
->
tagsFilter
=
taosMemoryC
alloc
(
pSma
->
tagsFilterLen
,
1
);
if
(
pSma
->
tagsFilter
==
NULL
)
goto
_OVER
;
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pSma
->
tagsFilter
,
pSma
->
tagsFilterLen
,
_OVER
)
}
if
(
pSma
->
sqlLen
>
0
)
{
pSma
->
sql
=
c
alloc
(
pSma
->
sqlLen
,
1
);
pSma
->
sql
=
taosMemoryC
alloc
(
pSma
->
sqlLen
,
1
);
if
(
pSma
->
sql
==
NULL
)
goto
_OVER
;
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pSma
->
sql
,
pSma
->
sqlLen
,
_OVER
)
}
if
(
pSma
->
astLen
>
0
)
{
pSma
->
ast
=
c
alloc
(
pSma
->
astLen
,
1
);
pSma
->
ast
=
taosMemoryC
alloc
(
pSma
->
astLen
,
1
);
if
(
pSma
->
ast
==
NULL
)
goto
_OVER
;
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pSma
->
ast
,
pSma
->
astLen
,
_OVER
)
}
...
...
@@ -189,9 +189,9 @@ static SSdbRow *mndSmaActionDecode(SSdbRaw *pRaw) {
_OVER:
if
(
terrno
!=
0
)
{
mError
(
"sma:%s, failed to decode from raw:%p since %s"
,
pSma
->
name
,
pRaw
,
terrstr
());
t
free
(
pSma
->
expr
);
t
free
(
pSma
->
tagsFilter
);
t
free
(
pRow
);
t
aosMemoryFreeClear
(
pSma
->
expr
);
t
aosMemoryFreeClear
(
pSma
->
tagsFilter
);
t
aosMemoryFreeClear
(
pRow
);
return
NULL
;
}
...
...
@@ -206,8 +206,8 @@ static int32_t mndSmaActionInsert(SSdb *pSdb, SSmaObj *pSma) {
static
int32_t
mndSmaActionDelete
(
SSdb
*
pSdb
,
SSmaObj
*
pSma
)
{
mTrace
(
"sma:%s, perform delete action, row:%p"
,
pSma
->
name
,
pSma
);
t
free
(
pSma
->
tagsFilter
);
t
free
(
pSma
->
expr
);
t
aosMemoryFreeClear
(
pSma
->
tagsFilter
);
t
aosMemoryFreeClear
(
pSma
->
expr
);
return
0
;
}
...
...
@@ -261,7 +261,7 @@ static void *mndBuildVCreateSmaReq(SMnode *pMnode, SVgObj *pVgroup, SSmaObj *pSm
req
.
tSma
.
tagsFilter
=
pSma
->
tagsFilter
;
int32_t
contLen
=
tSerializeSVCreateTSmaReq
(
NULL
,
&
req
)
+
sizeof
(
SMsgHead
);
SMsgHead
*
pHead
=
m
alloc
(
contLen
);
SMsgHead
*
pHead
=
taosMemoryM
alloc
(
contLen
);
if
(
pHead
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
...
...
@@ -287,7 +287,7 @@ static void *mndBuildVDropSmaReq(SMnode *pMnode, SVgObj *pVgroup, SSmaObj *pSma,
tstrncpy
(
req
.
indexName
,
(
char
*
)
tNameGetTableName
(
&
name
),
TSDB_INDEX_NAME_LEN
);
int32_t
contLen
=
tSerializeSVDropTSmaReq
(
NULL
,
&
req
)
+
sizeof
(
SMsgHead
);
SMsgHead
*
pHead
=
m
alloc
(
contLen
);
SMsgHead
*
pHead
=
taosMemoryM
alloc
(
contLen
);
if
(
pHead
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
...
...
@@ -349,7 +349,7 @@ static int32_t mndSetCreateSmaRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_VND_CREATE_SMA
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pVgroup
);
return
-
1
;
...
...
@@ -382,25 +382,25 @@ static int32_t mndCreateSma(SMnode *pMnode, SNodeMsg *pReq, SMCreateSmaReq *pCre
smaObj
.
astLen
=
pCreate
->
astLen
;
if
(
smaObj
.
exprLen
>
0
)
{
smaObj
.
expr
=
m
alloc
(
smaObj
.
exprLen
);
smaObj
.
expr
=
taosMemoryM
alloc
(
smaObj
.
exprLen
);
if
(
smaObj
.
expr
==
NULL
)
goto
_OVER
;
memcpy
(
smaObj
.
expr
,
pCreate
->
expr
,
smaObj
.
exprLen
);
}
if
(
smaObj
.
tagsFilterLen
>
0
)
{
smaObj
.
tagsFilter
=
m
alloc
(
smaObj
.
tagsFilterLen
);
smaObj
.
tagsFilter
=
taosMemoryM
alloc
(
smaObj
.
tagsFilterLen
);
if
(
smaObj
.
tagsFilter
==
NULL
)
goto
_OVER
;
memcpy
(
smaObj
.
tagsFilter
,
pCreate
->
tagsFilter
,
smaObj
.
tagsFilterLen
);
}
if
(
smaObj
.
sqlLen
>
0
)
{
smaObj
.
sql
=
m
alloc
(
smaObj
.
sqlLen
);
smaObj
.
sql
=
taosMemoryM
alloc
(
smaObj
.
sqlLen
);
if
(
smaObj
.
sql
==
NULL
)
goto
_OVER
;
memcpy
(
smaObj
.
sql
,
pCreate
->
sql
,
smaObj
.
sqlLen
);
}
if
(
smaObj
.
astLen
>
0
)
{
smaObj
.
ast
=
m
alloc
(
smaObj
.
astLen
);
smaObj
.
ast
=
taosMemoryM
alloc
(
smaObj
.
astLen
);
if
(
smaObj
.
ast
==
NULL
)
goto
_OVER
;
memcpy
(
smaObj
.
ast
,
pCreate
->
ast
,
smaObj
.
astLen
);
}
...
...
@@ -596,7 +596,7 @@ static int32_t mndSetDropSmaRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
action
.
msgType
=
TDMT_VND_DROP_SMA
;
action
.
acceptableCode
=
TSDB_CODE_VND_SMA_NOT_EXIST
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pVgroup
);
return
-
1
;
...
...
source/dnode/mnode/impl/src/mndSnode.c
浏览文件 @
222db126
...
...
@@ -135,7 +135,7 @@ static SSdbRow *mndSnodeActionDecode(SSdbRaw *pRaw) {
SNODE_DECODE_OVER:
if
(
terrno
!=
0
)
{
mError
(
"snode:%d, failed to decode from raw:%p since %s"
,
pObj
->
id
,
pRaw
,
terrstr
());
t
free
(
pRow
);
t
aosMemoryFreeClear
(
pRow
);
return
NULL
;
}
...
...
@@ -200,7 +200,7 @@ static int32_t mndSetCreateSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
createReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
m
alloc
(
contLen
);
void
*
pReq
=
taosMemoryM
alloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -215,7 +215,7 @@ static int32_t mndSetCreateSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
action
.
acceptableCode
=
TSDB_CODE_NODE_ALREADY_DEPLOYED
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
return
-
1
;
}
...
...
@@ -227,7 +227,7 @@ static int32_t mndSetCreateSnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
dropReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
m
alloc
(
contLen
);
void
*
pReq
=
taosMemoryM
alloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -242,7 +242,7 @@ static int32_t mndSetCreateSnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
action
.
acceptableCode
=
TSDB_CODE_NODE_NOT_DEPLOYED
;
if
(
mndTransAppendUndoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
return
-
1
;
}
...
...
@@ -352,7 +352,7 @@ static int32_t mndSetDropSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SSn
dropReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSMCreateDropQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
m
alloc
(
contLen
);
void
*
pReq
=
taosMemoryM
alloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -367,7 +367,7 @@ static int32_t mndSetDropSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SSn
action
.
acceptableCode
=
TSDB_CODE_NODE_NOT_DEPLOYED
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
return
-
1
;
}
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
222db126
...
...
@@ -175,9 +175,9 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pStb
->
numOfSmas
,
STB_DECODE_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pStb
->
commentLen
,
STB_DECODE_OVER
)
pStb
->
pColumns
=
c
alloc
(
pStb
->
numOfColumns
,
sizeof
(
SSchema
));
pStb
->
pTags
=
c
alloc
(
pStb
->
numOfTags
,
sizeof
(
SSchema
));
pStb
->
pSmas
=
c
alloc
(
pStb
->
numOfSmas
,
sizeof
(
SSchema
));
pStb
->
pColumns
=
taosMemoryC
alloc
(
pStb
->
numOfColumns
,
sizeof
(
SSchema
));
pStb
->
pTags
=
taosMemoryC
alloc
(
pStb
->
numOfTags
,
sizeof
(
SSchema
));
pStb
->
pSmas
=
taosMemoryC
alloc
(
pStb
->
numOfSmas
,
sizeof
(
SSchema
));
if
(
pStb
->
pColumns
==
NULL
||
pStb
->
pTags
==
NULL
||
pStb
->
pSmas
==
NULL
)
{
goto
STB_DECODE_OVER
;
}
...
...
@@ -207,7 +207,7 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) {
}
if
(
pStb
->
commentLen
>
0
)
{
pStb
->
comment
=
c
alloc
(
pStb
->
commentLen
,
1
);
pStb
->
comment
=
taosMemoryC
alloc
(
pStb
->
commentLen
,
1
);
if
(
pStb
->
comment
==
NULL
)
goto
STB_DECODE_OVER
;
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pStb
->
comment
,
pStb
->
commentLen
,
STB_DECODE_OVER
)
}
...
...
@@ -218,10 +218,10 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) {
STB_DECODE_OVER:
if
(
terrno
!=
0
)
{
mError
(
"stb:%s, failed to decode from raw:%p since %s"
,
pStb
->
name
,
pRaw
,
terrstr
());
t
free
(
pStb
->
pColumns
);
t
free
(
pStb
->
pTags
);
t
free
(
pStb
->
comment
);
t
free
(
pRow
);
t
aosMemoryFreeClear
(
pStb
->
pColumns
);
t
aosMemoryFreeClear
(
pStb
->
pTags
);
t
aosMemoryFreeClear
(
pStb
->
comment
);
t
aosMemoryFreeClear
(
pRow
);
return
NULL
;
}
...
...
@@ -236,9 +236,9 @@ static int32_t mndStbActionInsert(SSdb *pSdb, SStbObj *pStb) {
static
int32_t
mndStbActionDelete
(
SSdb
*
pSdb
,
SStbObj
*
pStb
)
{
mTrace
(
"stb:%s, perform delete action, row:%p"
,
pStb
->
name
,
pStb
);
t
free
(
pStb
->
pColumns
);
t
free
(
pStb
->
pTags
);
t
free
(
pStb
->
comment
);
t
aosMemoryFreeClear
(
pStb
->
pColumns
);
t
aosMemoryFreeClear
(
pStb
->
pTags
);
t
aosMemoryFreeClear
(
pStb
->
comment
);
return
0
;
}
...
...
@@ -248,9 +248,9 @@ static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOld, SStbObj *pNew) {
taosWLockLatch
(
&
pOld
->
lock
);
if
(
pOld
->
numOfColumns
<
pNew
->
numOfColumns
)
{
void
*
pColumns
=
m
alloc
(
pNew
->
numOfColumns
*
sizeof
(
SSchema
));
void
*
pColumns
=
taosMemoryM
alloc
(
pNew
->
numOfColumns
*
sizeof
(
SSchema
));
if
(
pColumns
!=
NULL
)
{
f
ree
(
pOld
->
pColumns
);
taosMemoryF
ree
(
pOld
->
pColumns
);
pOld
->
pColumns
=
pColumns
;
}
else
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -260,9 +260,9 @@ static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOld, SStbObj *pNew) {
}
if
(
pOld
->
numOfTags
<
pNew
->
numOfTags
)
{
void
*
pTags
=
m
alloc
(
pNew
->
numOfTags
*
sizeof
(
SSchema
));
void
*
pTags
=
taosMemoryM
alloc
(
pNew
->
numOfTags
*
sizeof
(
SSchema
));
if
(
pTags
!=
NULL
)
{
f
ree
(
pOld
->
pTags
);
taosMemoryF
ree
(
pOld
->
pTags
);
pOld
->
pTags
=
pTags
;
}
else
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -272,9 +272,9 @@ static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOld, SStbObj *pNew) {
}
if
(
pOld
->
numOfSmas
<
pNew
->
numOfSmas
)
{
void
*
pSmas
=
m
alloc
(
pNew
->
numOfSmas
*
sizeof
(
SSchema
));
void
*
pSmas
=
taosMemoryM
alloc
(
pNew
->
numOfSmas
*
sizeof
(
SSchema
));
if
(
pSmas
!=
NULL
)
{
f
ree
(
pOld
->
pSmas
);
taosMemoryF
ree
(
pOld
->
pSmas
);
pOld
->
pSmas
=
pSmas
;
}
else
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -284,9 +284,9 @@ static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOld, SStbObj *pNew) {
}
if
(
pOld
->
commentLen
<
pNew
->
commentLen
)
{
void
*
comment
=
m
alloc
(
pNew
->
commentLen
);
void
*
comment
=
taosMemoryM
alloc
(
pNew
->
commentLen
);
if
(
comment
!=
NULL
)
{
f
ree
(
pOld
->
comment
);
taosMemoryF
ree
(
pOld
->
comment
);
pOld
->
comment
=
comment
;
}
else
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -353,7 +353,7 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt
req
.
stbCfg
.
pTagSchema
=
pStb
->
pTags
;
int32_t
contLen
=
tSerializeSVCreateTbReq
(
NULL
,
&
req
)
+
sizeof
(
SMsgHead
);
SMsgHead
*
pHead
=
m
alloc
(
contLen
);
SMsgHead
*
pHead
=
taosMemoryM
alloc
(
contLen
);
if
(
pHead
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
...
...
@@ -380,7 +380,7 @@ static void *mndBuildVDropStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStb,
req
.
suid
=
pStb
->
uid
;
int32_t
contLen
=
tSerializeSVDropTbReq
(
NULL
,
&
req
)
+
sizeof
(
SMsgHead
);
SMsgHead
*
pHead
=
m
alloc
(
contLen
);
SMsgHead
*
pHead
=
taosMemoryM
alloc
(
contLen
);
if
(
pHead
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
...
...
@@ -508,7 +508,7 @@ static int32_t mndSetCreateStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_VND_CREATE_STB
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pVgroup
);
return
-
1
;
...
...
@@ -547,7 +547,7 @@ static int32_t mndSetCreateStbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_VND_DROP_STB
;
if
(
mndTransAppendUndoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pVgroup
);
return
-
1
;
...
...
@@ -584,7 +584,7 @@ static int32_t mndCreateStb(SMnode *pMnode, SNodeMsg *pReq, SMCreateStbReq *pCre
stbObj
.
numOfSmas
=
pCreate
->
numOfSmas
;
stbObj
.
commentLen
=
pCreate
->
commentLen
;
if
(
stbObj
.
commentLen
>
0
)
{
stbObj
.
comment
=
c
alloc
(
stbObj
.
commentLen
,
1
);
stbObj
.
comment
=
taosMemoryC
alloc
(
stbObj
.
commentLen
,
1
);
if
(
stbObj
.
comment
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -592,9 +592,9 @@ static int32_t mndCreateStb(SMnode *pMnode, SNodeMsg *pReq, SMCreateStbReq *pCre
memcpy
(
stbObj
.
comment
,
pCreate
->
comment
,
stbObj
.
commentLen
);
}
stbObj
.
pColumns
=
m
alloc
(
stbObj
.
numOfColumns
*
sizeof
(
SSchema
));
stbObj
.
pTags
=
m
alloc
(
stbObj
.
numOfTags
*
sizeof
(
SSchema
));
stbObj
.
pSmas
=
m
alloc
(
stbObj
.
numOfSmas
*
sizeof
(
SSchema
));
stbObj
.
pColumns
=
taosMemoryM
alloc
(
stbObj
.
numOfColumns
*
sizeof
(
SSchema
));
stbObj
.
pTags
=
taosMemoryM
alloc
(
stbObj
.
numOfTags
*
sizeof
(
SSchema
));
stbObj
.
pSmas
=
taosMemoryM
alloc
(
stbObj
.
numOfSmas
*
sizeof
(
SSchema
));
if
(
stbObj
.
pColumns
==
NULL
||
stbObj
.
pTags
==
NULL
||
stbObj
.
pSmas
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -777,8 +777,8 @@ static int32_t mndFindSuperTableColumnIndex(const SStbObj *pStb, const char *col
}
static
int32_t
mndAllocStbSchemas
(
const
SStbObj
*
pOld
,
SStbObj
*
pNew
)
{
pNew
->
pTags
=
c
alloc
(
pNew
->
numOfTags
,
sizeof
(
SSchema
));
pNew
->
pColumns
=
c
alloc
(
pNew
->
numOfColumns
,
sizeof
(
SSchema
));
pNew
->
pTags
=
taosMemoryC
alloc
(
pNew
->
numOfTags
,
sizeof
(
SSchema
));
pNew
->
pColumns
=
taosMemoryC
alloc
(
pNew
->
numOfColumns
,
sizeof
(
SSchema
));
if
(
pNew
->
pTags
==
NULL
||
pNew
->
pColumns
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -1071,7 +1071,7 @@ static int32_t mndSetAlterStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_VND_ALTER_STB
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pVgroup
);
return
-
1
;
...
...
@@ -1140,8 +1140,8 @@ static int32_t mndAlterStb(SMnode *pMnode, SNodeMsg *pReq, const SMAltertbReq *p
ALTER_STB_OVER:
mndTransDrop
(
pTrans
);
t
free
(
stbObj
.
pTags
);
t
free
(
stbObj
.
pColumns
);
t
aosMemoryFreeClear
(
stbObj
.
pTags
);
t
aosMemoryFreeClear
(
stbObj
.
pColumns
);
return
code
;
}
...
...
@@ -1251,7 +1251,7 @@ static int32_t mndSetDropStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
action
.
msgType
=
TDMT_VND_DROP_STB
;
action
.
acceptableCode
=
TSDB_CODE_VND_TB_NOT_EXIST
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
pReq
);
taosMemoryF
ree
(
pReq
);
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pVgroup
);
return
-
1
;
...
...
@@ -1348,7 +1348,7 @@ static int32_t mndBuildStbSchemaImp(SDbObj *pDb, SStbObj *pStb, const char *tbNa
taosRLockLatch
(
&
pStb
->
lock
);
int32_t
totalCols
=
pStb
->
numOfColumns
+
pStb
->
numOfTags
;
pRsp
->
pSchemas
=
c
alloc
(
totalCols
,
sizeof
(
SSchema
));
pRsp
->
pSchemas
=
taosMemoryC
alloc
(
totalCols
,
sizeof
(
SSchema
));
if
(
pRsp
->
pSchemas
==
NULL
)
{
taosRUnLockLatch
(
&
pStb
->
lock
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -1498,7 +1498,7 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableMetaVersion *pStbVersions, int
return
-
1
;
}
void
*
pRsp
=
m
alloc
(
rspLen
);
void
*
pRsp
=
taosMemoryM
alloc
(
rspLen
);
if
(
pRsp
==
NULL
)
{
tFreeSTableMetaBatchRsp
(
&
batchMetaRsp
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
222db126
...
...
@@ -84,7 +84,7 @@ SSdbRaw *mndStreamActionEncode(SStreamObj *pStream) {
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_STREAM
,
MND_STREAM_VER_NUMBER
,
size
);
if
(
pRaw
==
NULL
)
goto
STREAM_ENCODE_OVER
;
buf
=
m
alloc
(
tlen
);
buf
=
taosMemoryM
alloc
(
tlen
);
if
(
buf
==
NULL
)
goto
STREAM_ENCODE_OVER
;
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
tlen
,
TD_ENCODER
);
...
...
@@ -102,7 +102,7 @@ SSdbRaw *mndStreamActionEncode(SStreamObj *pStream) {
terrno
=
TSDB_CODE_SUCCESS
;
STREAM_ENCODE_OVER:
t
free
(
buf
);
t
aosMemoryFreeClear
(
buf
);
if
(
terrno
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"stream:%s, failed to encode to raw:%p since %s"
,
pStream
->
name
,
pRaw
,
terrstr
());
sdbFreeRaw
(
pRaw
);
...
...
@@ -135,7 +135,7 @@ SSdbRow *mndStreamActionDecode(SSdbRaw *pRaw) {
int32_t
tlen
;
int32_t
dataPos
=
0
;
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
tlen
,
STREAM_DECODE_OVER
);
buf
=
m
alloc
(
tlen
+
1
);
buf
=
taosMemoryM
alloc
(
tlen
+
1
);
if
(
buf
==
NULL
)
goto
STREAM_DECODE_OVER
;
SDB_GET_BINARY
(
pRaw
,
dataPos
,
buf
,
tlen
,
STREAM_DECODE_OVER
);
...
...
@@ -148,10 +148,10 @@ SSdbRow *mndStreamActionDecode(SSdbRaw *pRaw) {
terrno
=
TSDB_CODE_SUCCESS
;
STREAM_DECODE_OVER:
t
free
(
buf
);
t
aosMemoryFreeClear
(
buf
);
if
(
terrno
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"stream:%s, failed to decode from raw:%p since %s"
,
pStream
->
name
,
pRaw
,
terrstr
());
t
free
(
pRow
);
t
aosMemoryFreeClear
(
pRow
);
return
NULL
;
}
...
...
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
222db126
...
...
@@ -94,7 +94,7 @@ static SMqSubscribeObj *mndCreateSubscription(SMnode *pMnode, const SMqTopicObj
if
(
mndSchedInitSubEp
(
pMnode
,
pTopic
,
pSub
)
<
0
)
{
tDeleteSMqSubscribeObj
(
pSub
);
f
ree
(
pSub
);
taosMemoryF
ree
(
pSub
);
return
NULL
;
}
...
...
@@ -102,7 +102,7 @@ static SMqSubscribeObj *mndCreateSubscription(SMnode *pMnode, const SMqTopicObj
if (mndInitUnassignedVg(pMnode, pTopic, pSub) < 0) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
tDeleteSMqSubscribeObj(pSub);
f
ree(pSub);
taosMemoryF
ree(pSub);
return NULL;
}
#endif
...
...
@@ -118,7 +118,7 @@ static int32_t mndBuildRebalanceMsg(void **pBuf, int32_t *pLen, const SMqConsume
};
int32_t
tlen
=
tEncodeSMqMVRebReq
(
NULL
,
&
req
);
void
*
buf
=
m
alloc
(
sizeof
(
SMsgHead
)
+
tlen
);
void
*
buf
=
taosMemoryM
alloc
(
sizeof
(
SMsgHead
)
+
tlen
);
if
(
buf
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -157,7 +157,7 @@ static int32_t mndPersistRebalanceMsg(SMnode *pMnode, STrans *pTrans, const SMqC
mndReleaseVgroup
(
pMnode
,
pVgObj
);
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
buf
);
taosMemoryF
ree
(
buf
);
return
-
1
;
}
...
...
@@ -169,7 +169,7 @@ static int32_t mndBuildCancelConnReq(void **pBuf, int32_t *pLen, const SMqConsum
req
.
consumerId
=
pConsumerEp
->
consumerId
;
int32_t
tlen
=
tEncodeSMqSetCVgReq
(
NULL
,
&
req
);
void
*
buf
=
m
alloc
(
sizeof
(
SMsgHead
)
+
tlen
);
void
*
buf
=
taosMemoryM
alloc
(
sizeof
(
SMsgHead
)
+
tlen
);
if
(
buf
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -203,7 +203,7 @@ static int32_t mndPersistCancelConnReq(SMnode *pMnode, STrans *pTrans, const SMq
mndReleaseVgroup
(
pMnode
,
pVgObj
);
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
buf
);
taosMemoryF
ree
(
buf
);
return
-
1
;
}
...
...
@@ -229,7 +229,7 @@ static int32_t mndProcessResetOffsetReq(SNodeMsg *pMsg) {
SMqOffset *pOffset = &req.offsets[i];
SMqVgOffsets *pVgOffset = taosHashGet(pHash, &pOffset->vgId, sizeof(int32_t));
if (pVgOffset == NULL) {
pVgOffset =
m
alloc(sizeof(SMqVgOffsets));
pVgOffset =
taosMemoryM
alloc(sizeof(SMqVgOffsets));
if (pVgOffset == NULL) {
return -1;
}
...
...
@@ -407,7 +407,7 @@ static int32_t mndProcessMqTimerMsg(SNodeMsg *pMsg) {
int32_t
removeSz
=
taosArrayGetSize
(
pConsumer
->
recentRemovedTopics
);
for
(
int32_t
i
=
0
;
i
<
removeSz
;
i
++
)
{
char
*
topicName
=
taosArrayGet
(
pConsumer
->
recentRemovedTopics
,
i
);
f
ree
(
topicName
);
taosMemoryF
ree
(
topicName
);
}
taosArrayClear
(
pConsumer
->
recentRemovedTopics
);
}
...
...
@@ -441,7 +441,7 @@ static int32_t mndProcessDoRebalanceMsg(SNodeMsg *pMsg) {
if
(
pIter
==
NULL
)
break
;
SMqRebSubscribe
*
pRebSub
=
(
SMqRebSubscribe
*
)
pIter
;
SMqSubscribeObj
*
pSub
=
mndAcquireSubscribeByKey
(
pMnode
,
pRebSub
->
key
);
t
free
(
pRebSub
->
key
);
t
aosMemoryFreeClear
(
pRebSub
->
key
);
mInfo
(
"mq rebalance subscription: %s"
,
pSub
->
key
);
...
...
@@ -762,8 +762,8 @@ static int32_t mndProcessDoRebalanceMsg(SNodeMsg *pMsg) {
}
mndReleaseTopic(pMnode, pTopic);
mndTransDrop(pTrans);
t
free
(topic);
t
free
(cgroup);
t
aosMemoryFreeClear
(topic);
t
aosMemoryFreeClear
(cgroup);
}
// rebalance condition2 : imbalance assignment
}
...
...
@@ -836,7 +836,7 @@ static int32_t mndPersistMqSetConnReq(SMnode *pMnode, STrans *pTrans, const SMqT
strcpy
(
req
.
cgroup
,
cgroup
);
strcpy
(
req
.
topicName
,
pTopic
->
name
);
int32_t
tlen
=
tEncodeSMqSetCVgReq
(
NULL
,
&
req
);
void
*
buf
=
m
alloc
(
sizeof
(
SMsgHead
)
+
tlen
);
void
*
buf
=
taosMemoryM
alloc
(
sizeof
(
SMsgHead
)
+
tlen
);
if
(
buf
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -860,7 +860,7 @@ static int32_t mndPersistMqSetConnReq(SMnode *pMnode, STrans *pTrans, const SMqT
mndReleaseVgroup
(
pMnode
,
pVgObj
);
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
f
ree
(
buf
);
taosMemoryF
ree
(
buf
);
return
-
1
;
}
return
0
;
...
...
@@ -877,7 +877,7 @@ static SSdbRaw *mndSubActionEncode(SMqSubscribeObj *pSub) {
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_SUBSCRIBE
,
MND_SUBSCRIBE_VER_NUMBER
,
size
);
if
(
pRaw
==
NULL
)
goto
SUB_ENCODE_OVER
;
buf
=
m
alloc
(
tlen
);
buf
=
taosMemoryM
alloc
(
tlen
);
if
(
buf
==
NULL
)
goto
SUB_ENCODE_OVER
;
void
*
abuf
=
buf
;
...
...
@@ -892,7 +892,7 @@ static SSdbRaw *mndSubActionEncode(SMqSubscribeObj *pSub) {
terrno
=
TSDB_CODE_SUCCESS
;
SUB_ENCODE_OVER:
t
free
(
buf
);
t
aosMemoryFreeClear
(
buf
);
if
(
terrno
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"subscribe:%s, failed to encode to raw:%p since %s"
,
pSub
->
key
,
pRaw
,
terrstr
());
sdbFreeRaw
(
pRaw
);
...
...
@@ -925,7 +925,7 @@ static SSdbRow *mndSubActionDecode(SSdbRaw *pRaw) {
int32_t
dataPos
=
0
;
int32_t
tlen
;
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
tlen
,
SUB_DECODE_OVER
);
buf
=
m
alloc
(
tlen
+
1
);
buf
=
taosMemoryM
alloc
(
tlen
+
1
);
if
(
buf
==
NULL
)
goto
SUB_DECODE_OVER
;
SDB_GET_BINARY
(
pRaw
,
dataPos
,
buf
,
tlen
,
SUB_DECODE_OVER
);
SDB_GET_RESERVE
(
pRaw
,
dataPos
,
MND_SUBSCRIBE_RESERVE_SIZE
,
SUB_DECODE_OVER
);
...
...
@@ -937,10 +937,10 @@ static SSdbRow *mndSubActionDecode(SSdbRaw *pRaw) {
terrno
=
TSDB_CODE_SUCCESS
;
SUB_DECODE_OVER:
t
free
(
buf
);
t
aosMemoryFreeClear
(
buf
);
if
(
terrno
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"subscribe:%s, failed to decode from raw:%p since %s"
,
pSub
->
key
,
pRaw
,
terrstr
());
t
free
(
pRow
);
t
aosMemoryFreeClear
(
pRow
);
return
NULL
;
}
...
...
@@ -1140,7 +1140,7 @@ static int32_t mndProcessSubscribeReq(SNodeMsg *pMsg) {
}
}
if
(
oldSub
)
taosArrayDestroyEx
(
oldSub
,
f
ree
);
if
(
oldSub
)
taosArrayDestroyEx
(
oldSub
,
(
void
(
*
)(
void
*
))
taosMemoryF
ree
);
// persist consumerObj
SSdbRaw
*
pConsumerRaw
=
mndConsumerActionEncode
(
pConsumer
);
...
...
source/dnode/mnode/impl/src/mndTelem.c
浏览文件 @
222db126
...
...
@@ -88,7 +88,7 @@ static int32_t mndProcessTelemTimer(SNodeMsg* pReq) {
char
*
pCont
=
mndBuildTelemetryReport
(
pMnode
);
if
(
pCont
!=
NULL
)
{
taosSendHttpReport
(
TELEMETRY_SERVER
,
TELEMETRY_PORT
,
pCont
,
strlen
(
pCont
),
HTTP_FLAT
);
f
ree
(
pCont
);
taosMemoryF
ree
(
pCont
);
}
taosWUnLockLatch
(
&
pMgmt
->
lock
);
return
0
;
...
...
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
222db126
...
...
@@ -129,11 +129,11 @@ SSdbRow *mndTopicActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pTopic
->
version
,
TOPIC_DECODE_OVER
);
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pTopic
->
sqlLen
,
TOPIC_DECODE_OVER
);
pTopic
->
sql
=
c
alloc
(
pTopic
->
sqlLen
+
1
,
sizeof
(
char
));
pTopic
->
sql
=
taosMemoryC
alloc
(
pTopic
->
sqlLen
+
1
,
sizeof
(
char
));
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pTopic
->
sql
,
pTopic
->
sqlLen
,
TOPIC_DECODE_OVER
);
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
len
,
TOPIC_DECODE_OVER
);
pTopic
->
logicalPlan
=
c
alloc
(
len
+
1
,
sizeof
(
char
));
pTopic
->
logicalPlan
=
taosMemoryC
alloc
(
len
+
1
,
sizeof
(
char
));
if
(
pTopic
->
logicalPlan
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
TOPIC_DECODE_OVER
;
...
...
@@ -141,9 +141,9 @@ SSdbRow *mndTopicActionDecode(SSdbRaw *pRaw) {
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pTopic
->
logicalPlan
,
len
,
TOPIC_DECODE_OVER
);
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
len
,
TOPIC_DECODE_OVER
);
pTopic
->
physicalPlan
=
c
alloc
(
len
+
1
,
sizeof
(
char
));
pTopic
->
physicalPlan
=
taosMemoryC
alloc
(
len
+
1
,
sizeof
(
char
));
if
(
pTopic
->
physicalPlan
==
NULL
)
{
f
ree
(
pTopic
->
logicalPlan
);
taosMemoryF
ree
(
pTopic
->
logicalPlan
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
TOPIC_DECODE_OVER
;
}
...
...
@@ -156,7 +156,7 @@ SSdbRow *mndTopicActionDecode(SSdbRaw *pRaw) {
TOPIC_DECODE_OVER:
if
(
terrno
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"topic:%s, failed to decode from raw:%p since %s"
,
pTopic
->
name
,
pRaw
,
terrstr
());
t
free
(
pRow
);
t
aosMemoryFreeClear
(
pRow
);
return
NULL
;
}
...
...
@@ -214,7 +214,7 @@ static SDbObj *mndAcquireDbByTopic(SMnode *pMnode, char *topicName) {
static
SDDropTopicReq
*
mndBuildDropTopicMsg
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
,
SMqTopicObj
*
pTopic
)
{
int32_t
contLen
=
sizeof
(
SDDropTopicReq
);
SDDropTopicReq
*
pDrop
=
c
alloc
(
1
,
contLen
);
SDDropTopicReq
*
pDrop
=
taosMemoryC
alloc
(
1
,
contLen
);
if
(
pDrop
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
...
...
@@ -286,7 +286,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SNodeMsg *pReq, SCMCreateTopicReq
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_TOPIC
,
&
pReq
->
rpcMsg
);
if
(
pTrans
==
NULL
)
{
mError
(
"topic:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
t
free
(
pPlanStr
);
t
aosMemoryFreeClear
(
pPlanStr
);
return
-
1
;
}
mDebug
(
"trans:%d, used to create topic:%s"
,
pTrans
->
id
,
pCreate
->
name
);
...
...
@@ -294,7 +294,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SNodeMsg *pReq, SCMCreateTopicReq
SSdbRaw
*
pRedoRaw
=
mndTopicActionEncode
(
&
topicObj
);
if
(
pRedoRaw
==
NULL
||
mndTransAppendRedolog
(
pTrans
,
pRedoRaw
)
!=
0
)
{
mError
(
"trans:%d, failed to append redo log since %s"
,
pTrans
->
id
,
terrstr
());
t
free
(
pPlanStr
);
t
aosMemoryFreeClear
(
pPlanStr
);
mndTransDrop
(
pTrans
);
return
-
1
;
}
...
...
@@ -302,12 +302,12 @@ static int32_t mndCreateTopic(SMnode *pMnode, SNodeMsg *pReq, SCMCreateTopicReq
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
{
mError
(
"trans:%d, failed to prepare since %s"
,
pTrans
->
id
,
terrstr
());
t
free
(
pPlanStr
);
t
aosMemoryFreeClear
(
pPlanStr
);
mndTransDrop
(
pTrans
);
return
-
1
;
}
t
free
(
pPlanStr
);
t
aosMemoryFreeClear
(
pPlanStr
);
mndTransDrop
(
pTrans
);
return
0
;
}
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
222db126
...
...
@@ -255,7 +255,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
for
(
int32_t
i
=
0
;
i
<
redoLogNum
;
++
i
)
{
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
dataLen
,
TRANS_DECODE_OVER
)
pData
=
m
alloc
(
dataLen
);
pData
=
taosMemoryM
alloc
(
dataLen
);
if
(
pData
==
NULL
)
goto
TRANS_DECODE_OVER
;
mTrace
(
"raw:%p, is created"
,
pData
);
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pData
,
dataLen
,
TRANS_DECODE_OVER
);
...
...
@@ -265,7 +265,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
for
(
int32_t
i
=
0
;
i
<
undoLogNum
;
++
i
)
{
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
dataLen
,
TRANS_DECODE_OVER
)
pData
=
m
alloc
(
dataLen
);
pData
=
taosMemoryM
alloc
(
dataLen
);
if
(
pData
==
NULL
)
goto
TRANS_DECODE_OVER
;
mTrace
(
"raw:%p, is created"
,
pData
);
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pData
,
dataLen
,
TRANS_DECODE_OVER
);
...
...
@@ -275,7 +275,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
for
(
int32_t
i
=
0
;
i
<
commitLogNum
;
++
i
)
{
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
dataLen
,
TRANS_DECODE_OVER
)
pData
=
m
alloc
(
dataLen
);
pData
=
taosMemoryM
alloc
(
dataLen
);
if
(
pData
==
NULL
)
goto
TRANS_DECODE_OVER
;
mTrace
(
"raw:%p, is created"
,
pData
);
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pData
,
dataLen
,
TRANS_DECODE_OVER
);
...
...
@@ -288,7 +288,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT16
(
pRaw
,
dataPos
,
&
action
.
msgType
,
TRANS_DECODE_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
action
.
acceptableCode
,
TRANS_DECODE_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
action
.
contLen
,
TRANS_DECODE_OVER
)
action
.
pCont
=
m
alloc
(
action
.
contLen
);
action
.
pCont
=
taosMemoryM
alloc
(
action
.
contLen
);
if
(
action
.
pCont
==
NULL
)
goto
TRANS_DECODE_OVER
;
SDB_GET_BINARY
(
pRaw
,
dataPos
,
action
.
pCont
,
action
.
contLen
,
TRANS_DECODE_OVER
);
if
(
taosArrayPush
(
pTrans
->
redoActions
,
&
action
)
==
NULL
)
goto
TRANS_DECODE_OVER
;
...
...
@@ -300,7 +300,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT16
(
pRaw
,
dataPos
,
&
action
.
msgType
,
TRANS_DECODE_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
action
.
acceptableCode
,
TRANS_DECODE_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
action
.
contLen
,
TRANS_DECODE_OVER
)
action
.
pCont
=
m
alloc
(
action
.
contLen
);
action
.
pCont
=
taosMemoryM
alloc
(
action
.
contLen
);
if
(
action
.
pCont
==
NULL
)
goto
TRANS_DECODE_OVER
;
SDB_GET_BINARY
(
pRaw
,
dataPos
,
action
.
pCont
,
action
.
contLen
,
TRANS_DECODE_OVER
);
if
(
taosArrayPush
(
pTrans
->
undoActions
,
&
action
)
==
NULL
)
goto
TRANS_DECODE_OVER
;
...
...
@@ -315,9 +315,9 @@ TRANS_DECODE_OVER:
if
(
terrno
!=
0
)
{
mError
(
"trans:%d, failed to parse from raw:%p since %s"
,
pTrans
->
id
,
pRaw
,
terrstr
());
mndTransDropData
(
pTrans
);
t
free
(
pRow
);
t
free
(
pData
);
t
free
(
action
.
pCont
);
t
aosMemoryFreeClear
(
pRow
);
t
aosMemoryFreeClear
(
pData
);
t
aosMemoryFreeClear
(
action
.
pCont
);
return
NULL
;
}
...
...
@@ -428,7 +428,7 @@ static void mndTransDropData(STrans *pTrans) {
mndTransDropActions
(
pTrans
->
redoActions
);
mndTransDropActions
(
pTrans
->
undoActions
);
if
(
pTrans
->
rpcRsp
!=
NULL
)
{
f
ree
(
pTrans
->
rpcRsp
);
taosMemoryF
ree
(
pTrans
->
rpcRsp
);
pTrans
->
rpcRsp
=
NULL
;
pTrans
->
rpcRspLen
=
0
;
}
...
...
@@ -472,7 +472,7 @@ static void mndReleaseTrans(SMnode *pMnode, STrans *pTrans) {
}
STrans
*
mndTransCreate
(
SMnode
*
pMnode
,
ETrnPolicy
policy
,
ETrnType
type
,
const
SRpcMsg
*
pReq
)
{
STrans
*
pTrans
=
c
alloc
(
1
,
sizeof
(
STrans
));
STrans
*
pTrans
=
taosMemoryC
alloc
(
1
,
sizeof
(
STrans
));
if
(
pTrans
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
mError
(
"failed to create transaction since %s"
,
terrstr
());
...
...
@@ -517,7 +517,7 @@ static void mndTransDropActions(SArray *pArray) {
int32_t
size
=
taosArrayGetSize
(
pArray
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
STransAction
*
pAction
=
taosArrayGet
(
pArray
,
i
);
t
free
(
pAction
->
pCont
);
t
aosMemoryFreeClear
(
pAction
->
pCont
);
}
taosArrayDestroy
(
pArray
);
...
...
@@ -527,7 +527,7 @@ void mndTransDrop(STrans *pTrans) {
if
(
pTrans
!=
NULL
)
{
mndTransDropData
(
pTrans
);
mDebug
(
"trans:%d, is dropped, data:%p"
,
pTrans
->
id
,
pTrans
);
t
free
(
pTrans
);
t
aosMemoryFreeClear
(
pTrans
);
}
}
...
...
@@ -762,7 +762,7 @@ static void mndTransSendRpcRsp(STrans *pTrans) {
if
(
rpcCont
!=
NULL
)
{
memcpy
(
rpcCont
,
pTrans
->
rpcRsp
,
pTrans
->
rpcRspLen
);
}
f
ree
(
pTrans
->
rpcRsp
);
taosMemoryF
ree
(
pTrans
->
rpcRsp
);
mDebug
(
"trans:%d, send rsp, code:0x%04x stage:%d app:%p"
,
pTrans
->
id
,
pTrans
->
code
&
0xFFFF
,
pTrans
->
stage
,
pTrans
->
rpcAHandle
);
...
...
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
222db126
...
...
@@ -201,7 +201,7 @@ USER_DECODE_OVER:
mError
(
"user:%s, failed to decode from raw:%p since %s"
,
pUser
->
user
,
pRaw
,
terrstr
());
taosHashCleanup
(
pUser
->
readDbs
);
taosHashCleanup
(
pUser
->
writeDbs
);
t
free
(
pRow
);
t
aosMemoryFreeClear
(
pRow
);
return
NULL
;
}
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
222db126
...
...
@@ -146,7 +146,7 @@ SSdbRow *mndVgroupActionDecode(SSdbRaw *pRaw) {
VG_DECODE_OVER:
if
(
terrno
!=
0
)
{
mError
(
"vgId:%d, failed to decode from raw:%p since %s"
,
pVgroup
->
vgId
,
pRaw
,
terrstr
());
t
free
(
pRow
);
t
aosMemoryFreeClear
(
pRow
);
return
NULL
;
}
...
...
@@ -250,7 +250,7 @@ void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVg
return
NULL
;
}
void
*
pReq
=
m
alloc
(
contLen
);
void
*
pReq
=
taosMemoryM
alloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
...
...
@@ -274,7 +274,7 @@ void *mndBuildDropVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVgOb
return
NULL
;
}
void
*
pReq
=
m
alloc
(
contLen
);
void
*
pReq
=
taosMemoryM
alloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
...
...
@@ -376,7 +376,7 @@ int32_t mndAllocVgroup(SMnode *pMnode, SDbObj *pDb, SVgObj **ppVgroups) {
SArray
*
pArray
=
NULL
;
SVgObj
*
pVgroups
=
NULL
;
pVgroups
=
c
alloc
(
pDb
->
cfg
.
numOfVgroups
,
sizeof
(
SVgObj
));
pVgroups
=
taosMemoryC
alloc
(
pDb
->
cfg
.
numOfVgroups
,
sizeof
(
SVgObj
));
if
(
pVgroups
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
ALLOC_VGROUP_OVER
;
...
...
@@ -430,7 +430,7 @@ int32_t mndAllocVgroup(SMnode *pMnode, SDbObj *pDb, SVgObj **ppVgroups) {
mDebug
(
"db:%s, %d vgroups is alloced, replica:%d"
,
pDb
->
name
,
pDb
->
cfg
.
numOfVgroups
,
pDb
->
cfg
.
replications
);
ALLOC_VGROUP_OVER:
if
(
code
!=
0
)
f
ree
(
pVgroups
);
if
(
code
!=
0
)
taosMemoryF
ree
(
pVgroups
);
taosArrayDestroy
(
pArray
);
return
code
;
}
...
...
source/dnode/mnode/impl/src/mnode.c
浏览文件 @
222db126
...
...
@@ -283,7 +283,7 @@ static int32_t mndSetOptions(SMnode *pMnode, const SMnodeOpt *pOption) {
SMnode
*
mndOpen
(
const
char
*
path
,
const
SMnodeOpt
*
pOption
)
{
mDebug
(
"start to open mnode in %s"
,
path
);
SMnode
*
pMnode
=
c
alloc
(
1
,
sizeof
(
SMnode
));
SMnode
*
pMnode
=
taosMemoryC
alloc
(
1
,
sizeof
(
SMnode
));
if
(
pMnode
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
mError
(
"failed to open mnode since %s"
,
terrstr
());
...
...
@@ -295,7 +295,7 @@ SMnode *mndOpen(const char *path, const SMnodeOpt *pOption) {
pMnode
->
pSteps
=
taosArrayInit
(
24
,
sizeof
(
SMnodeStep
));
if
(
pMnode
->
pSteps
==
NULL
)
{
f
ree
(
pMnode
);
taosMemoryF
ree
(
pMnode
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
mError
(
"failed to open mnode since %s"
,
terrstr
());
return
NULL
;
...
...
@@ -346,8 +346,8 @@ void mndClose(SMnode *pMnode) {
if
(
pMnode
!=
NULL
)
{
mDebug
(
"start to close mnode"
);
mndCleanupSteps
(
pMnode
,
-
1
);
t
free
(
pMnode
->
path
);
t
free
(
pMnode
);
t
aosMemoryFreeClear
(
pMnode
->
path
);
t
aosMemoryFreeClear
(
pMnode
);
mDebug
(
"mnode is closed"
);
}
}
...
...
source/dnode/mnode/impl/test/trans/trans.cpp
浏览文件 @
222db126
...
...
@@ -29,7 +29,7 @@ class MndTestTrans : public ::testing::Test {
char
file
[
PATH_MAX
]
=
"/tmp/mnode_test_trans/mnode/data/sdb.data"
;
TdFilePtr
pFile
=
taosOpenFile
(
file
,
TD_FILE_READ
);
int32_t
size
=
3
*
1024
*
1024
;
void
*
buffer
=
m
alloc
(
size
);
void
*
buffer
=
taosMemoryM
alloc
(
size
);
int32_t
readLen
=
taosReadFile
(
pFile
,
buffer
,
size
);
if
(
readLen
<
0
||
readLen
==
size
)
{
ASSERT
(
1
);
...
...
@@ -43,7 +43,7 @@ class MndTestTrans : public ::testing::Test {
if
(
writeLen
<
0
||
writeLen
==
readLen
)
{
ASSERT
(
1
);
}
f
ree
(
buffer
);
taosMemoryF
ree
(
buffer
);
taosFsyncFile
(
pFile
);
taosCloseFile
(
&
pFile
);
taosMsleep
(
1000
);
...
...
source/dnode/mnode/sdb/src/sdb.c
浏览文件 @
222db126
...
...
@@ -21,7 +21,7 @@ static int32_t sdbCreateDir(SSdb *pSdb);
SSdb
*
sdbInit
(
SSdbOpt
*
pOption
)
{
mDebug
(
"start to init sdb in %s"
,
pOption
->
path
);
SSdb
*
pSdb
=
c
alloc
(
1
,
sizeof
(
SSdb
));
SSdb
*
pSdb
=
taosMemoryC
alloc
(
1
,
sizeof
(
SSdb
));
if
(
pSdb
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
mError
(
"failed to init sdb since %s"
,
terrstr
());
...
...
@@ -67,15 +67,15 @@ void sdbCleanup(SSdb *pSdb) {
sdbWriteFile
(
pSdb
);
if
(
pSdb
->
currDir
!=
NULL
)
{
t
free
(
pSdb
->
currDir
);
t
aosMemoryFreeClear
(
pSdb
->
currDir
);
}
if
(
pSdb
->
syncDir
!=
NULL
)
{
t
free
(
pSdb
->
syncDir
);
t
aosMemoryFreeClear
(
pSdb
->
syncDir
);
}
if
(
pSdb
->
tmpDir
!=
NULL
)
{
t
free
(
pSdb
->
tmpDir
);
t
aosMemoryFreeClear
(
pSdb
->
tmpDir
);
}
for
(
ESdbType
i
=
0
;
i
<
SDB_MAX
;
++
i
)
{
...
...
@@ -102,7 +102,7 @@ void sdbCleanup(SSdb *pSdb) {
mDebug
(
"sdb table:%d is cleaned up"
,
i
);
}
f
ree
(
pSdb
);
taosMemoryF
ree
(
pSdb
);
mDebug
(
"sdb is cleaned up"
);
}
...
...
source/dnode/mnode/sdb/src/sdbFile.c
浏览文件 @
222db126
...
...
@@ -137,7 +137,7 @@ int32_t sdbReadFile(SSdb *pSdb) {
int32_t
readLen
=
0
;
int64_t
ret
=
0
;
SSdbRaw
*
pRaw
=
m
alloc
(
SDB_MAX_SIZE
);
SSdbRaw
*
pRaw
=
taosMemoryM
alloc
(
SDB_MAX_SIZE
);
if
(
pRaw
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
mError
(
"failed read file since %s"
,
terrstr
());
...
...
@@ -150,7 +150,7 @@ int32_t sdbReadFile(SSdb *pSdb) {
TdFilePtr
pFile
=
taosOpenFile
(
file
,
TD_FILE_READ
);
if
(
pFile
==
NULL
)
{
f
ree
(
pRaw
);
taosMemoryF
ree
(
pRaw
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
mError
(
"failed to read file:%s since %s"
,
file
,
terrstr
());
return
0
;
...
...
@@ -159,7 +159,7 @@ int32_t sdbReadFile(SSdb *pSdb) {
if
(
sdbReadFileHead
(
pSdb
,
pFile
)
!=
0
)
{
mError
(
"failed to read file:%s head since %s"
,
file
,
terrstr
());
pSdb
->
curVer
=
-
1
;
f
ree
(
pRaw
);
taosMemoryF
ree
(
pRaw
);
taosCloseFile
(
&
pFile
);
return
-
1
;
}
...
...
source/dnode/mnode/sdb/src/sdbRaw.c
浏览文件 @
222db126
...
...
@@ -17,7 +17,7 @@
#include "sdbInt.h"
SSdbRaw
*
sdbAllocRaw
(
ESdbType
type
,
int8_t
sver
,
int32_t
dataLen
)
{
SSdbRaw
*
pRaw
=
c
alloc
(
1
,
dataLen
+
sizeof
(
SSdbRaw
));
SSdbRaw
*
pRaw
=
taosMemoryC
alloc
(
1
,
dataLen
+
sizeof
(
SSdbRaw
));
if
(
pRaw
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
...
...
@@ -33,7 +33,7 @@ SSdbRaw *sdbAllocRaw(ESdbType type, int8_t sver, int32_t dataLen) {
void
sdbFreeRaw
(
SSdbRaw
*
pRaw
)
{
mTrace
(
"raw:%p, is freed"
,
pRaw
);
f
ree
(
pRaw
);
taosMemoryF
ree
(
pRaw
);
}
int32_t
sdbSetRawInt8
(
SSdbRaw
*
pRaw
,
int32_t
dataPos
,
int8_t
val
)
{
...
...
source/dnode/mnode/sdb/src/sdbRow.c
浏览文件 @
222db126
...
...
@@ -17,7 +17,7 @@
#include "sdbInt.h"
SSdbRow
*
sdbAllocRow
(
int32_t
objSize
)
{
SSdbRow
*
pRow
=
c
alloc
(
1
,
objSize
+
sizeof
(
SSdbRow
));
SSdbRow
*
pRow
=
taosMemoryC
alloc
(
1
,
objSize
+
sizeof
(
SSdbRow
));
if
(
pRow
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
...
...
@@ -46,5 +46,5 @@ void sdbFreeRow(SSdb *pSdb, SSdbRow *pRow) {
sdbPrintOper
(
pSdb
,
pRow
,
"freeRow"
);
mTrace
(
"row:%p, is freed"
,
pRow
->
pObj
);
t
free
(
pRow
);
t
aosMemoryFreeClear
(
pRow
);
}
source/dnode/qnode/src/qnode.c
浏览文件 @
222db126
...
...
@@ -19,14 +19,14 @@
#include "qworker.h"
SQnode
*
qndOpen
(
const
SQnodeOpt
*
pOption
)
{
SQnode
*
pQnode
=
c
alloc
(
1
,
sizeof
(
SQnode
));
SQnode
*
pQnode
=
taosMemoryC
alloc
(
1
,
sizeof
(
SQnode
));
if
(
NULL
==
pQnode
)
{
qError
(
"calloc SQnode failed"
);
return
NULL
;
}
if
(
qWorkerInit
(
NODE_TYPE_QNODE
,
pQnode
->
qndId
,
NULL
,
(
void
**
)
&
pQnode
->
pQuery
,
&
pOption
->
msgCb
))
{
t
free
(
pQnode
);
t
aosMemoryFreeClear
(
pQnode
);
return
NULL
;
}
...
...
@@ -37,7 +37,7 @@ SQnode *qndOpen(const SQnodeOpt *pOption) {
void
qndClose
(
SQnode
*
pQnode
)
{
qWorkerDestroy
((
void
**
)
&
pQnode
->
pQuery
);
f
ree
(
pQnode
);
taosMemoryF
ree
(
pQnode
);
}
int32_t
qndGetLoad
(
SQnode
*
pQnode
,
SQnodeLoad
*
pLoad
)
{
return
0
;
}
...
...
source/dnode/snode/src/snode.c
浏览文件 @
222db126
...
...
@@ -18,14 +18,14 @@
#include "tuuid.h"
SSnode
*
sndOpen
(
const
char
*
path
,
const
SSnodeOpt
*
pOption
)
{
SSnode
*
pSnode
=
c
alloc
(
1
,
sizeof
(
SSnode
));
SSnode
*
pSnode
=
taosMemoryC
alloc
(
1
,
sizeof
(
SSnode
));
if
(
pSnode
==
NULL
)
{
return
NULL
;
}
pSnode
->
msgCb
=
pOption
->
msgCb
;
pSnode
->
pMeta
=
sndMetaNew
();
if
(
pSnode
->
pMeta
==
NULL
)
{
f
ree
(
pSnode
);
taosMemoryF
ree
(
pSnode
);
return
NULL
;
}
return
pSnode
;
...
...
@@ -33,19 +33,19 @@ SSnode *sndOpen(const char *path, const SSnodeOpt *pOption) {
void
sndClose
(
SSnode
*
pSnode
)
{
sndMetaDelete
(
pSnode
->
pMeta
);
f
ree
(
pSnode
);
taosMemoryF
ree
(
pSnode
);
}
int32_t
sndGetLoad
(
SSnode
*
pSnode
,
SSnodeLoad
*
pLoad
)
{
return
0
;
}
SStreamMeta
*
sndMetaNew
()
{
SStreamMeta
*
pMeta
=
c
alloc
(
1
,
sizeof
(
SStreamMeta
));
SStreamMeta
*
pMeta
=
taosMemoryC
alloc
(
1
,
sizeof
(
SStreamMeta
));
if
(
pMeta
==
NULL
)
{
return
NULL
;
}
pMeta
->
pHash
=
taosHashInit
(
64
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_INT
),
true
,
HASH_NO_LOCK
);
if
(
pMeta
->
pHash
==
NULL
)
{
f
ree
(
pMeta
);
taosMemoryF
ree
(
pMeta
);
return
NULL
;
}
return
pMeta
;
...
...
@@ -53,7 +53,7 @@ SStreamMeta *sndMetaNew() {
void
sndMetaDelete
(
SStreamMeta
*
pMeta
)
{
taosHashCleanup
(
pMeta
->
pHash
);
f
ree
(
pMeta
);
taosMemoryF
ree
(
pMeta
);
}
int32_t
sndMetaDeployTask
(
SStreamMeta
*
pMeta
,
SStreamTask
*
pTask
)
{
...
...
@@ -72,9 +72,9 @@ int32_t sndMetaRemoveTask(SStreamMeta *pMeta, int32_t taskId) {
if
(
pTask
==
NULL
)
{
return
-
1
;
}
f
ree
(
pTask
->
exec
.
qmsg
);
taosMemoryF
ree
(
pTask
->
exec
.
qmsg
);
// TODO:free executor
f
ree
(
pTask
);
taosMemoryF
ree
(
pTask
);
return
taosHashRemove
(
pMeta
->
pHash
,
&
taskId
,
sizeof
(
int32_t
));
}
...
...
@@ -94,7 +94,7 @@ void sndProcessUMsg(SSnode *pSnode, SRpcMsg *pMsg) {
// operator exec
if
(
pMsg
->
msgType
==
TDMT_SND_TASK_DEPLOY
)
{
void
*
msg
=
POINTER_SHIFT
(
pMsg
->
pCont
,
sizeof
(
SMsgHead
));
SStreamTask
*
pTask
=
m
alloc
(
sizeof
(
SStreamTask
));
SStreamTask
*
pTask
=
taosMemoryM
alloc
(
sizeof
(
SStreamTask
));
if
(
pTask
==
NULL
)
{
ASSERT
(
0
);
return
;
...
...
source/dnode/vnode/src/inc/tsdbMemory.h
浏览文件 @
222db126
...
...
@@ -30,7 +30,7 @@ static void taosTMemset(void *ptr, int c);
static
FORCE_INLINE
void
*
taosTMalloc
(
size_t
size
)
{
if
(
size
<=
0
)
return
NULL
;
void
*
ret
=
m
alloc
(
size
+
sizeof
(
size_t
));
void
*
ret
=
taosMemoryM
alloc
(
size
+
sizeof
(
size_t
));
if
(
ret
==
NULL
)
return
NULL
;
*
(
size_t
*
)
ret
=
size
;
...
...
@@ -58,7 +58,7 @@ static FORCE_INLINE void * taosTRealloc(void *ptr, size_t size) {
void
*
tptr
=
(
void
*
)((
char
*
)
ptr
-
sizeof
(
size_t
));
size_t
tsize
=
size
+
sizeof
(
size_t
);
void
*
tptr1
=
r
ealloc
(
tptr
,
tsize
);
void
*
tptr1
=
taosMemoryR
ealloc
(
tptr
,
tsize
);
if
(
tptr1
==
NULL
)
return
NULL
;
tptr
=
tptr1
;
...
...
@@ -69,7 +69,7 @@ static FORCE_INLINE void * taosTRealloc(void *ptr, size_t size) {
static
FORCE_INLINE
void
*
taosTZfree
(
void
*
ptr
)
{
if
(
ptr
)
{
f
ree
((
void
*
)((
char
*
)
ptr
-
sizeof
(
size_t
)));
taosMemoryF
ree
((
void
*
)((
char
*
)
ptr
-
sizeof
(
size_t
)));
}
return
NULL
;
}
...
...
source/dnode/vnode/src/meta/metaBDBImpl.c
浏览文件 @
222db126
...
...
@@ -233,7 +233,7 @@ int metaSaveSmaToDB(SMeta *pMeta, STSma *pSmaCfg) {
// save sma info
int32_t
len
=
tEncodeTSma
(
NULL
,
pSmaCfg
);
pBuf
=
c
alloc
(
len
,
1
);
pBuf
=
taosMemoryC
alloc
(
len
,
1
);
if
(
pBuf
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -254,7 +254,7 @@ int metaSaveSmaToDB(SMeta *pMeta, STSma *pSmaCfg) {
metaDBULock
(
pMeta
->
pDB
);
// release
t
free
(
pBuf
);
t
aosMemoryFreeClear
(
pBuf
);
return
0
;
}
...
...
@@ -297,7 +297,7 @@ static void *metaDecodeSchema(void *buf, SSchemaWrapper *pSW) {
SSchema
*
pSchema
;
buf
=
taosDecodeFixedU32
(
buf
,
&
pSW
->
nCols
);
pSW
->
pSchema
=
(
SSchema
*
)
m
alloc
(
sizeof
(
SSchema
)
*
pSW
->
nCols
);
pSW
->
pSchema
=
(
SSchema
*
)
taosMemoryM
alloc
(
sizeof
(
SSchema
)
*
pSW
->
nCols
);
for
(
int
i
=
0
;
i
<
pSW
->
nCols
;
i
++
)
{
pSchema
=
pSW
->
pSchema
+
i
;
buf
=
taosDecodeFixedI8
(
buf
,
&
pSchema
->
type
);
...
...
@@ -311,7 +311,7 @@ static void *metaDecodeSchema(void *buf, SSchemaWrapper *pSW) {
static
SMetaDB
*
metaNewDB
()
{
SMetaDB
*
pDB
=
NULL
;
pDB
=
(
SMetaDB
*
)
c
alloc
(
1
,
sizeof
(
*
pDB
));
pDB
=
(
SMetaDB
*
)
taosMemoryC
alloc
(
1
,
sizeof
(
*
pDB
));
if
(
pDB
==
NULL
)
{
return
NULL
;
}
...
...
@@ -328,7 +328,7 @@ static void metaFreeDB(SMetaDB *pDB) {
#if IMPL_WITH_LOCK
taosThreadRwlockDestroy
(
&
pDB
->
rwlock
);
#endif
f
ree
(
pDB
);
taosMemoryF
ree
(
pDB
);
}
}
...
...
@@ -463,7 +463,7 @@ static int metaCtbIdxCb(DB *pIdx, const DBT *pKey, const DBT *pValue, DBT *pSKey
DBT
*
pDbt
;
if
(
pTbCfg
->
type
==
META_CHILD_TABLE
)
{
// pDbt =
c
alloc(2, sizeof(DBT));
// pDbt =
taosMemoryC
alloc(2, sizeof(DBT));
// // First key is suid
// pDbt[0].data = &(pTbCfg->ctbCfg.suid);
...
...
@@ -545,11 +545,11 @@ static void *metaDecodeTbInfo(void *buf, STbCfg *pTbCfg) {
}
static
void
metaClearTbCfg
(
STbCfg
*
pTbCfg
)
{
t
free
(
pTbCfg
->
name
);
t
aosMemoryFreeClear
(
pTbCfg
->
name
);
if
(
pTbCfg
->
type
==
META_SUPER_TABLE
)
{
tdFreeSchema
(
pTbCfg
->
stbCfg
.
pTagSchema
);
}
else
if
(
pTbCfg
->
type
==
META_CHILD_TABLE
)
{
t
free
(
pTbCfg
->
ctbCfg
.
pTag
);
t
aosMemoryFreeClear
(
pTbCfg
->
ctbCfg
.
pTag
);
}
}
...
...
@@ -574,7 +574,7 @@ STbCfg *metaGetTbInfoByUid(SMeta *pMeta, tb_uid_t uid) {
}
// Decode
pTbCfg
=
(
STbCfg
*
)
m
alloc
(
sizeof
(
*
pTbCfg
));
pTbCfg
=
(
STbCfg
*
)
taosMemoryM
alloc
(
sizeof
(
*
pTbCfg
));
if
(
pTbCfg
==
NULL
)
{
return
NULL
;
}
...
...
@@ -606,7 +606,7 @@ STbCfg *metaGetTbInfoByName(SMeta *pMeta, char *tbname, tb_uid_t *uid) {
// Decode
*
uid
=
*
(
tb_uid_t
*
)(
pkey
.
data
);
pTbCfg
=
(
STbCfg
*
)
m
alloc
(
sizeof
(
*
pTbCfg
));
pTbCfg
=
(
STbCfg
*
)
taosMemoryM
alloc
(
sizeof
(
*
pTbCfg
));
if
(
pTbCfg
==
NULL
)
{
return
NULL
;
}
...
...
@@ -636,13 +636,13 @@ STSma *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid) {
}
// Decode
pCfg
=
(
STSma
*
)
c
alloc
(
1
,
sizeof
(
STSma
));
pCfg
=
(
STSma
*
)
taosMemoryC
alloc
(
1
,
sizeof
(
STSma
));
if
(
pCfg
==
NULL
)
{
return
NULL
;
}
if
(
tDecodeTSma
(
value
.
data
,
pCfg
)
==
NULL
)
{
t
free
(
pCfg
);
t
aosMemoryFreeClear
(
pCfg
);
return
NULL
;
}
...
...
@@ -675,7 +675,7 @@ SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, boo
// Decode the schema
pBuf
=
value
.
data
;
pSW
=
m
alloc
(
sizeof
(
*
pSW
));
pSW
=
taosMemoryM
alloc
(
sizeof
(
*
pSW
));
metaDecodeSchema
(
pBuf
,
pSW
);
return
pSW
;
...
...
@@ -689,7 +689,7 @@ SMTbCursor *metaOpenTbCursor(SMeta *pMeta) {
SMTbCursor
*
pTbCur
=
NULL
;
SMetaDB
*
pDB
=
pMeta
->
pDB
;
pTbCur
=
(
SMTbCursor
*
)
c
alloc
(
1
,
sizeof
(
*
pTbCur
));
pTbCur
=
(
SMTbCursor
*
)
taosMemoryC
alloc
(
1
,
sizeof
(
*
pTbCur
));
if
(
pTbCur
==
NULL
)
{
return
NULL
;
}
...
...
@@ -722,7 +722,7 @@ void metaCloseTbCursor(SMTbCursor *pTbCur) {
if
(
pTbCur
->
pCur
)
{
pTbCur
->
pCur
->
close
(
pTbCur
->
pCur
);
}
f
ree
(
pTbCur
);
taosMemoryF
ree
(
pTbCur
);
}
}
...
...
@@ -737,8 +737,8 @@ char *metaTbCursorNext(SMTbCursor *pTbCur) {
pBuf
=
value
.
data
;
metaDecodeTbInfo
(
pBuf
,
&
tbCfg
);
if
(
tbCfg
.
type
==
META_SUPER_TABLE
)
{
f
ree
(
tbCfg
.
name
);
f
ree
(
tbCfg
.
stbCfg
.
pTagSchema
);
taosMemoryF
ree
(
tbCfg
.
name
);
taosMemoryF
ree
(
tbCfg
.
stbCfg
.
pTagSchema
);
continue
;
}
else
if
(
tbCfg
.
type
==
META_CHILD_TABLE
)
{
kvRowFree
(
tbCfg
.
ctbCfg
.
pTag
);
...
...
@@ -792,7 +792,7 @@ SMCtbCursor *metaOpenCtbCursor(SMeta *pMeta, tb_uid_t uid) {
SMetaDB
*
pDB
=
pMeta
->
pDB
;
int
ret
;
pCtbCur
=
(
SMCtbCursor
*
)
c
alloc
(
1
,
sizeof
(
*
pCtbCur
));
pCtbCur
=
(
SMCtbCursor
*
)
taosMemoryC
alloc
(
1
,
sizeof
(
*
pCtbCur
));
if
(
pCtbCur
==
NULL
)
{
return
NULL
;
}
...
...
@@ -800,7 +800,7 @@ SMCtbCursor *metaOpenCtbCursor(SMeta *pMeta, tb_uid_t uid) {
pCtbCur
->
suid
=
uid
;
ret
=
pDB
->
pCtbIdx
->
cursor
(
pDB
->
pCtbIdx
,
NULL
,
&
(
pCtbCur
->
pCur
),
0
);
if
(
ret
!=
0
)
{
f
ree
(
pCtbCur
);
taosMemoryF
ree
(
pCtbCur
);
return
NULL
;
}
...
...
@@ -813,7 +813,7 @@ void metaCloseCtbCurosr(SMCtbCursor *pCtbCur) {
pCtbCur
->
pCur
->
close
(
pCtbCur
->
pCur
);
}
f
ree
(
pCtbCur
);
taosMemoryF
ree
(
pCtbCur
);
}
}
...
...
@@ -849,7 +849,7 @@ SMSmaCursor *metaOpenSmaCursor(SMeta *pMeta, tb_uid_t uid) {
SMetaDB
*
pDB
=
pMeta
->
pDB
;
int
ret
;
pCur
=
(
SMSmaCursor
*
)
c
alloc
(
1
,
sizeof
(
*
pCur
));
pCur
=
(
SMSmaCursor
*
)
taosMemoryC
alloc
(
1
,
sizeof
(
*
pCur
));
if
(
pCur
==
NULL
)
{
return
NULL
;
}
...
...
@@ -858,7 +858,7 @@ SMSmaCursor *metaOpenSmaCursor(SMeta *pMeta, tb_uid_t uid) {
// TODO: lock?
ret
=
pDB
->
pCtbIdx
->
cursor
(
pDB
->
pSmaIdx
,
NULL
,
&
(
pCur
->
pCur
),
0
);
if
(
ret
!=
0
)
{
f
ree
(
pCur
);
taosMemoryF
ree
(
pCur
);
return
NULL
;
}
...
...
@@ -871,7 +871,7 @@ void metaCloseSmaCurosr(SMSmaCursor *pCur) {
pCur
->
pCur
->
close
(
pCur
->
pCur
);
}
f
ree
(
pCur
);
taosMemoryF
ree
(
pCur
);
}
}
...
...
@@ -896,14 +896,14 @@ const char *metaSmaCursorNext(SMSmaCursor *pCur) {
STSmaWrapper
*
metaGetSmaInfoByTable
(
SMeta
*
pMeta
,
tb_uid_t
uid
)
{
STSmaWrapper
*
pSW
=
NULL
;
pSW
=
c
alloc
(
1
,
sizeof
(
*
pSW
));
pSW
=
taosMemoryC
alloc
(
1
,
sizeof
(
*
pSW
));
if
(
pSW
==
NULL
)
{
return
NULL
;
}
SMSmaCursor
*
pCur
=
metaOpenSmaCursor
(
pMeta
,
uid
);
if
(
pCur
==
NULL
)
{
f
ree
(
pSW
);
taosMemoryF
ree
(
pSW
);
return
NULL
;
}
...
...
@@ -915,11 +915,11 @@ STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid) {
// TODO: lock?
if
(
pCur
->
pCur
->
pget
(
pCur
->
pCur
,
&
skey
,
NULL
,
&
pval
,
DB_NEXT
)
==
0
)
{
++
pSW
->
number
;
STSma
*
tptr
=
(
STSma
*
)
r
ealloc
(
pSW
->
tSma
,
pSW
->
number
*
sizeof
(
STSma
));
STSma
*
tptr
=
(
STSma
*
)
taosMemoryR
ealloc
(
pSW
->
tSma
,
pSW
->
number
*
sizeof
(
STSma
));
if
(
tptr
==
NULL
)
{
metaCloseSmaCurosr
(
pCur
);
tdDestroyTSmaWrapper
(
pSW
);
t
free
(
pSW
);
t
aosMemoryFreeClear
(
pSW
);
return
NULL
;
}
pSW
->
tSma
=
tptr
;
...
...
@@ -927,7 +927,7 @@ STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid) {
if
(
tDecodeTSma
(
pBuf
,
pSW
->
tSma
+
pSW
->
number
-
1
)
==
NULL
)
{
metaCloseSmaCurosr
(
pCur
);
tdDestroyTSmaWrapper
(
pSW
);
t
free
(
pSW
);
t
aosMemoryFreeClear
(
pSW
);
return
NULL
;
}
continue
;
...
...
source/dnode/vnode/src/meta/metaMain.c
浏览文件 @
222db126
...
...
@@ -69,7 +69,7 @@ static SMeta *metaNew(const char *path, const SMetaCfg *pMetaCfg, SMemAllocatorF
SMeta
*
pMeta
;
size_t
psize
=
strlen
(
path
);
pMeta
=
(
SMeta
*
)
c
alloc
(
1
,
sizeof
(
*
pMeta
));
pMeta
=
(
SMeta
*
)
taosMemoryC
alloc
(
1
,
sizeof
(
*
pMeta
));
if
(
pMeta
==
NULL
)
{
return
NULL
;
}
...
...
@@ -88,8 +88,8 @@ static SMeta *metaNew(const char *path, const SMetaCfg *pMetaCfg, SMemAllocatorF
static
void
metaFree
(
SMeta
*
pMeta
)
{
if
(
pMeta
)
{
t
free
(
pMeta
->
path
);
f
ree
(
pMeta
);
t
aosMemoryFreeClear
(
pMeta
->
path
);
taosMemoryF
ree
(
pMeta
);
}
}
...
...
source/dnode/vnode/src/meta/metaTDBImpl.c
浏览文件 @
222db126
...
...
@@ -47,7 +47,7 @@ int metaOpenDB(SMeta *pMeta) {
TDB
*
pCtbIdx
;
int
ret
;
pDb
=
(
SMetaDB
*
)
c
alloc
(
1
,
sizeof
(
*
pDb
));
pDb
=
(
SMetaDB
*
)
taosMemoryC
alloc
(
1
,
sizeof
(
*
pDb
));
if
(
pDb
==
NULL
)
{
return
-
1
;
}
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
222db126
...
...
@@ -26,7 +26,7 @@ void tqCleanUp() { tqPushMgrCleanUp(); }
STQ
*
tqOpen
(
const
char
*
path
,
SVnode
*
pVnode
,
SWal
*
pWal
,
SMeta
*
pVnodeMeta
,
STqCfg
*
tqConfig
,
SMemAllocatorFactory
*
allocFac
)
{
STQ
*
pTq
=
m
alloc
(
sizeof
(
STQ
));
STQ
*
pTq
=
taosMemoryM
alloc
(
sizeof
(
STQ
));
if
(
pTq
==
NULL
)
{
terrno
=
TSDB_CODE_TQ_OUT_OF_MEMORY
;
return
NULL
;
...
...
@@ -44,9 +44,9 @@ STQ* tqOpen(const char* path, SVnode* pVnode, SWal* pWal, SMeta* pVnodeMeta, STq
}
#endif
pTq
->
tqMeta
=
tqStoreOpen
(
pTq
,
path
,
(
FTqSerialize
)
tqSerializeConsumer
,
(
FTqDeserialize
)
tqDeserializeConsumer
,
f
ree
,
0
);
tqStoreOpen
(
pTq
,
path
,
(
FTqSerialize
)
tqSerializeConsumer
,
(
FTqDeserialize
)
tqDeserializeConsumer
,
(
FTqDelete
)
taosMemoryF
ree
,
0
);
if
(
pTq
->
tqMeta
==
NULL
)
{
f
ree
(
pTq
);
taosMemoryF
ree
(
pTq
);
#if 0
allocFac->destroy(allocFac, pTq->tqMemRef.pAllocator);
#endif
...
...
@@ -57,7 +57,7 @@ STQ* tqOpen(const char* path, SVnode* pVnode, SWal* pWal, SMeta* pVnodeMeta, STq
pTq->tqPushMgr = tqPushMgrOpen();
if (pTq->tqPushMgr == NULL) {
// free store
f
ree(pTq);
taosMemoryF
ree(pTq);
return NULL;
}
#endif
...
...
@@ -69,15 +69,15 @@ STQ* tqOpen(const char* path, SVnode* pVnode, SWal* pWal, SMeta* pVnodeMeta, STq
void
tqClose
(
STQ
*
pTq
)
{
if
(
pTq
)
{
t
free
(
pTq
->
path
);
f
ree
(
pTq
);
t
aosMemoryFreeClear
(
pTq
->
path
);
taosMemoryF
ree
(
pTq
);
}
// TODO
}
int
tqPushMsg
(
STQ
*
pTq
,
void
*
msg
,
int32_t
msgLen
,
tmsg_t
msgType
,
int64_t
version
)
{
if
(
msgType
!=
TDMT_VND_SUBMIT
)
return
0
;
void
*
data
=
m
alloc
(
msgLen
);
void
*
data
=
taosMemoryM
alloc
(
msgLen
);
if
(
data
==
NULL
)
{
return
-
1
;
}
...
...
@@ -96,7 +96,7 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t versi
if (pusher->type == TQ_PUSHER_TYPE__STREAM) {
STqStreamPusher* streamPusher = (STqStreamPusher*)pusher;
// repack
STqStreamToken* token =
m
alloc(sizeof(STqStreamToken));
STqStreamToken* token =
taosMemoryM
alloc(sizeof(STqStreamToken));
if (token == NULL) {
taosHashCancelIterate(pTq->tqPushMgr->pHash, pIter);
terrno = TSDB_CODE_OUT_OF_MEMORY;
...
...
@@ -200,9 +200,9 @@ int tqSerializeConsumer(const STqConsumer* pConsumer, STqSerializedHead** ppHead
int32_t
sz
=
tEncodeSTqConsumer
(
NULL
,
pConsumer
);
if
(
sz
>
(
*
ppHead
)
->
ssize
)
{
void
*
tmpPtr
=
r
ealloc
(
*
ppHead
,
sizeof
(
STqSerializedHead
)
+
sz
);
void
*
tmpPtr
=
taosMemoryR
ealloc
(
*
ppHead
,
sizeof
(
STqSerializedHead
)
+
sz
);
if
(
tmpPtr
==
NULL
)
{
f
ree
(
*
ppHead
);
taosMemoryF
ree
(
*
ppHead
);
terrno
=
TSDB_CODE_TQ_OUT_OF_MEMORY
;
return
-
1
;
}
...
...
@@ -219,7 +219,7 @@ int tqSerializeConsumer(const STqConsumer* pConsumer, STqSerializedHead** ppHead
int32_t
tqDeserializeConsumer
(
STQ
*
pTq
,
const
STqSerializedHead
*
pHead
,
STqConsumer
**
ppConsumer
)
{
const
void
*
str
=
pHead
->
content
;
*
ppConsumer
=
c
alloc
(
1
,
sizeof
(
STqConsumer
));
*
ppConsumer
=
taosMemoryC
alloc
(
1
,
sizeof
(
STqConsumer
));
if
(
*
ppConsumer
==
NULL
)
{
terrno
=
TSDB_CODE_TQ_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -393,7 +393,7 @@ int32_t tqProcessSetConnReq(STQ* pTq, char* msg) {
tDecodeSMqSetCVgReq
(
msg
,
&
req
);
/*printf("vg %d set to consumer from %ld to %ld\n", req.vgId, req.oldConsumerId, req.newConsumerId);*/
STqConsumer
*
pConsumer
=
c
alloc
(
1
,
sizeof
(
STqConsumer
));
STqConsumer
*
pConsumer
=
taosMemoryC
alloc
(
1
,
sizeof
(
STqConsumer
));
if
(
pConsumer
==
NULL
)
{
terrno
=
TSDB_CODE_TQ_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -404,10 +404,10 @@ int32_t tqProcessSetConnReq(STQ* pTq, char* msg) {
pConsumer
->
consumerId
=
req
.
consumerId
;
pConsumer
->
epoch
=
0
;
STqTopic
*
pTopic
=
c
alloc
(
1
,
sizeof
(
STqTopic
));
STqTopic
*
pTopic
=
taosMemoryC
alloc
(
1
,
sizeof
(
STqTopic
));
if
(
pTopic
==
NULL
)
{
taosArrayDestroy
(
pConsumer
->
topics
);
f
ree
(
pConsumer
);
taosMemoryF
ree
(
pConsumer
);
return
-
1
;
}
strcpy
(
pTopic
->
topicName
,
req
.
topicName
);
...
...
@@ -451,7 +451,7 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int32_t parallel) {
.
reader
=
pReadHandle
,
.
meta
=
pTq
->
pVnodeMeta
,
};
pTask
->
exec
.
runners
=
c
alloc
(
parallel
,
sizeof
(
SStreamRunner
));
pTask
->
exec
.
runners
=
taosMemoryC
alloc
(
parallel
,
sizeof
(
SStreamRunner
));
if
(
pTask
->
exec
.
runners
==
NULL
)
{
return
-
1
;
}
...
...
@@ -462,7 +462,7 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int32_t parallel) {
}
int32_t
tqProcessTaskDeploy
(
STQ
*
pTq
,
char
*
msg
,
int32_t
msgLen
)
{
SStreamTask
*
pTask
=
m
alloc
(
sizeof
(
SStreamTask
));
SStreamTask
*
pTask
=
taosMemoryM
alloc
(
sizeof
(
SStreamTask
));
if
(
pTask
==
NULL
)
{
return
-
1
;
}
...
...
source/dnode/vnode/src/tq/tqMetaStore.c
浏览文件 @
222db126
...
...
@@ -70,7 +70,7 @@ static inline int tqReadLastPage(TdFilePtr pFile, STqIdxPageBuf* pBuf) {
STqMetaStore
*
tqStoreOpen
(
STQ
*
pTq
,
const
char
*
path
,
FTqSerialize
serializer
,
FTqDeserialize
deserializer
,
FTqDelete
deleter
,
int32_t
tqConfigFlag
)
{
STqMetaStore
*
pMeta
=
c
alloc
(
1
,
sizeof
(
STqMetaStore
));
STqMetaStore
*
pMeta
=
taosMemoryC
alloc
(
1
,
sizeof
(
STqMetaStore
));
if
(
pMeta
==
NULL
)
{
terrno
=
TSDB_CODE_TQ_OUT_OF_MEMORY
;
return
NULL
;
...
...
@@ -79,10 +79,10 @@ STqMetaStore* tqStoreOpen(STQ* pTq, const char* path, FTqSerialize serializer, F
// concat data file name and index file name
size_t
pathLen
=
strlen
(
path
);
pMeta
->
dirPath
=
m
alloc
(
pathLen
+
1
);
pMeta
->
dirPath
=
taosMemoryM
alloc
(
pathLen
+
1
);
if
(
pMeta
->
dirPath
==
NULL
)
{
terrno
=
TSDB_CODE_TQ_OUT_OF_MEMORY
;
f
ree
(
pMeta
);
taosMemoryF
ree
(
pMeta
);
return
NULL
;
}
strcpy
(
pMeta
->
dirPath
,
path
);
...
...
@@ -104,7 +104,7 @@ STqMetaStore* tqStoreOpen(STQ* pTq, const char* path, FTqSerialize serializer, F
}
pMeta
->
pIdxFile
=
pIdxFile
;
pMeta
->
unpersistHead
=
c
alloc
(
1
,
sizeof
(
STqMetaList
));
pMeta
->
unpersistHead
=
taosMemoryC
alloc
(
1
,
sizeof
(
STqMetaList
));
if
(
pMeta
->
unpersistHead
==
NULL
)
{
terrno
=
TSDB_CODE_TQ_OUT_OF_MEMORY
;
return
NULL
;
...
...
@@ -129,7 +129,7 @@ STqMetaStore* tqStoreOpen(STQ* pTq, const char* path, FTqSerialize serializer, F
// read idx file and load into memory
STqIdxPageBuf
idxBuf
;
STqSerializedHead
*
serializedObj
=
m
alloc
(
TQ_PAGE_SIZE
);
STqSerializedHead
*
serializedObj
=
taosMemoryM
alloc
(
TQ_PAGE_SIZE
);
if
(
serializedObj
==
NULL
)
{
terrno
=
TSDB_CODE_TQ_OUT_OF_MEMORY
;
}
...
...
@@ -145,7 +145,7 @@ STqMetaStore* tqStoreOpen(STQ* pTq, const char* path, FTqSerialize serializer, F
ASSERT
(
idxBuf
.
head
.
writeOffset
==
idxRead
);
// loop read every entry
for
(
int
i
=
0
;
i
<
idxBuf
.
head
.
writeOffset
-
TQ_IDX_PAGE_HEAD_SIZE
;
i
+=
TQ_IDX_SIZE
)
{
STqMetaList
*
pNode
=
c
alloc
(
1
,
sizeof
(
STqMetaList
));
STqMetaList
*
pNode
=
taosMemoryC
alloc
(
1
,
sizeof
(
STqMetaList
));
if
(
pNode
==
NULL
)
{
terrno
=
TSDB_CODE_TQ_OUT_OF_MEMORY
;
// TODO: free memory
...
...
@@ -154,7 +154,7 @@ STqMetaStore* tqStoreOpen(STQ* pTq, const char* path, FTqSerialize serializer, F
taosLSeekFile
(
pFile
,
pNode
->
handle
.
offset
,
SEEK_SET
);
if
(
allocated
<
pNode
->
handle
.
serializedSize
)
{
void
*
ptr
=
r
ealloc
(
serializedObj
,
pNode
->
handle
.
serializedSize
);
void
*
ptr
=
taosMemoryR
ealloc
(
serializedObj
,
pNode
->
handle
.
serializedSize
);
if
(
ptr
==
NULL
)
{
terrno
=
TSDB_CODE_TQ_OUT_OF_MEMORY
;
// TODO: free memory
...
...
@@ -225,11 +225,11 @@ STqMetaStore* tqStoreOpen(STQ* pTq, const char* path, FTqSerialize serializer, F
if
(
pBucketNode
->
handle
.
valueInTxn
&&
pBucketNode
->
handle
.
valueInTxn
!=
TQ_DELETE_TOKEN
)
{
pMeta
->
pDeleter
(
pBucketNode
->
handle
.
valueInTxn
);
}
f
ree
(
pBucketNode
);
taosMemoryF
ree
(
pBucketNode
);
}
}
}
f
ree
(
serializedObj
);
taosMemoryF
ree
(
serializedObj
);
return
pMeta
;
}
...
...
@@ -252,13 +252,13 @@ int32_t tqStoreClose(STqMetaStore* pMeta) {
pMeta
->
pDeleter
(
pNode
->
handle
.
valueInUse
);
}
STqMetaList
*
next
=
pNode
->
next
;
f
ree
(
pNode
);
taosMemoryF
ree
(
pNode
);
pNode
=
next
;
}
}
f
ree
(
pMeta
->
dirPath
);
f
ree
(
pMeta
->
unpersistHead
);
f
ree
(
pMeta
);
taosMemoryF
ree
(
pMeta
->
dirPath
);
taosMemoryF
ree
(
pMeta
->
unpersistHead
);
taosMemoryF
ree
(
pMeta
);
return
0
;
}
...
...
@@ -277,14 +277,14 @@ int32_t tqStoreDelete(STqMetaStore* pMeta) {
pMeta
->
pDeleter
(
pNode
->
handle
.
valueInUse
);
}
STqMetaList
*
next
=
pNode
->
next
;
f
ree
(
pNode
);
taosMemoryF
ree
(
pNode
);
pNode
=
next
;
}
}
f
ree
(
pMeta
->
unpersistHead
);
taosMemoryF
ree
(
pMeta
->
unpersistHead
);
taosRemoveDir
(
pMeta
->
dirPath
);
f
ree
(
pMeta
->
dirPath
);
f
ree
(
pMeta
);
taosMemoryF
ree
(
pMeta
->
dirPath
);
taosMemoryF
ree
(
pMeta
);
return
0
;
}
...
...
@@ -293,7 +293,7 @@ int32_t tqStorePersist(STqMetaStore* pMeta) {
int64_t
*
bufPtr
=
(
int64_t
*
)
idxBuf
.
buffer
;
STqMetaList
*
pHead
=
pMeta
->
unpersistHead
;
STqMetaList
*
pNode
=
pHead
->
unpersistNext
;
STqSerializedHead
*
pSHead
=
m
alloc
(
sizeof
(
STqSerializedHead
));
STqSerializedHead
*
pSHead
=
taosMemoryM
alloc
(
sizeof
(
STqSerializedHead
));
if
(
pSHead
==
NULL
)
{
terrno
=
TSDB_CODE_TQ_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -383,12 +383,12 @@ int32_t tqStorePersist(STqMetaStore* pMeta) {
ASSERT
(
pBucketNode
->
next
==
pNode
);
pBucketNode
->
next
=
pNode
->
next
;
}
f
ree
(
pNode
);
taosMemoryF
ree
(
pNode
);
}
}
// write left bytes
f
ree
(
pSHead
);
taosMemoryF
ree
(
pSHead
);
// TODO: write new version in tfile
if
((
char
*
)
bufPtr
!=
idxBuf
.
buffer
)
{
int
nBytes
=
taosWriteFile
(
pMeta
->
pIdxFile
,
&
idxBuf
,
idxBuf
.
head
.
writeOffset
);
...
...
@@ -416,7 +416,7 @@ static int32_t tqHandlePutCommitted(STqMetaStore* pMeta, int64_t key, void* valu
pNode
=
pNode
->
next
;
}
}
STqMetaList
*
pNewNode
=
c
alloc
(
1
,
sizeof
(
STqMetaList
));
STqMetaList
*
pNewNode
=
taosMemoryC
alloc
(
1
,
sizeof
(
STqMetaList
));
if
(
pNewNode
==
NULL
)
{
terrno
=
TSDB_CODE_TQ_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -488,7 +488,7 @@ static inline int32_t tqHandlePutImpl(STqMetaStore* pMeta, int64_t key, void* va
pNode
=
pNode
->
next
;
}
}
STqMetaList
*
pNewNode
=
c
alloc
(
1
,
sizeof
(
STqMetaList
));
STqMetaList
*
pNewNode
=
taosMemoryC
alloc
(
1
,
sizeof
(
STqMetaList
));
if
(
pNewNode
==
NULL
)
{
terrno
=
TSDB_CODE_TQ_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -504,7 +504,7 @@ static inline int32_t tqHandlePutImpl(STqMetaStore* pMeta, int64_t key, void* va
int32_t
tqHandleMovePut
(
STqMetaStore
*
pMeta
,
int64_t
key
,
void
*
value
)
{
return
tqHandlePutImpl
(
pMeta
,
key
,
value
);
}
int32_t
tqHandleCopyPut
(
STqMetaStore
*
pMeta
,
int64_t
key
,
void
*
value
,
size_t
vsize
)
{
void
*
vmem
=
m
alloc
(
vsize
);
void
*
vmem
=
taosMemoryM
alloc
(
vsize
);
if
(
vmem
==
NULL
)
{
terrno
=
TSDB_CODE_TQ_OUT_OF_MEMORY
;
return
-
1
;
...
...
source/dnode/vnode/src/tq/tqOffset.c
浏览文件 @
222db126
...
...
@@ -31,7 +31,7 @@ struct STqOffsetStore {
};
STqOffsetStore
*
STqOffsetOpen
(
STqOffsetCfg
*
pCfg
)
{
STqOffsetStore
*
pStore
=
m
alloc
(
sizeof
(
STqOffsetStore
));
STqOffsetStore
*
pStore
=
taosMemoryM
alloc
(
sizeof
(
STqOffsetStore
));
if
(
pStore
==
NULL
)
{
return
NULL
;
}
...
...
source/dnode/vnode/src/tq/tqPush.c
浏览文件 @
222db126
...
...
@@ -32,7 +32,7 @@ void tqPushMgrCleanUp() {
}
STqPushMgr
*
tqPushMgrOpen
()
{
STqPushMgr
*
mgr
=
m
alloc
(
sizeof
(
STqPushMgr
));
STqPushMgr
*
mgr
=
taosMemoryM
alloc
(
sizeof
(
STqPushMgr
));
if
(
mgr
==
NULL
)
{
return
NULL
;
}
...
...
@@ -42,11 +42,11 @@ STqPushMgr* tqPushMgrOpen() {
void
tqPushMgrClose
(
STqPushMgr
*
pushMgr
)
{
taosHashCleanup
(
pushMgr
->
pHash
);
f
ree
(
pushMgr
);
taosMemoryF
ree
(
pushMgr
);
}
STqClientPusher
*
tqAddClientPusher
(
STqPushMgr
*
pushMgr
,
SRpcMsg
*
pMsg
,
int64_t
consumerId
,
int64_t
ttl
)
{
STqClientPusher
*
clientPusher
=
m
alloc
(
sizeof
(
STqClientPusher
));
STqClientPusher
*
clientPusher
=
taosMemoryM
alloc
(
sizeof
(
STqClientPusher
));
if
(
clientPusher
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
...
...
@@ -57,7 +57,7 @@ STqClientPusher* tqAddClientPusher(STqPushMgr* pushMgr, SRpcMsg* pMsg, int64_t c
clientPusher
->
ttl
=
ttl
;
if
(
taosHashPut
(
pushMgr
->
pHash
,
&
consumerId
,
sizeof
(
int64_t
),
&
clientPusher
,
sizeof
(
void
*
))
<
0
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
f
ree
(
clientPusher
);
taosMemoryF
ree
(
clientPusher
);
// TODO send rsp back
return
NULL
;
}
...
...
@@ -65,7 +65,7 @@ STqClientPusher* tqAddClientPusher(STqPushMgr* pushMgr, SRpcMsg* pMsg, int64_t c
}
STqStreamPusher
*
tqAddStreamPusher
(
STqPushMgr
*
pushMgr
,
int64_t
streamId
,
SEpSet
*
pEpSet
)
{
STqStreamPusher
*
streamPusher
=
m
alloc
(
sizeof
(
STqStreamPusher
));
STqStreamPusher
*
streamPusher
=
taosMemoryM
alloc
(
sizeof
(
STqStreamPusher
));
if
(
streamPusher
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
...
...
@@ -77,7 +77,7 @@ STqStreamPusher* tqAddStreamPusher(STqPushMgr* pushMgr, int64_t streamId, SEpSet
if
(
taosHashPut
(
pushMgr
->
pHash
,
&
streamId
,
sizeof
(
int64_t
),
&
streamPusher
,
sizeof
(
void
*
))
<
0
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
f
ree
(
streamPusher
);
taosMemoryF
ree
(
streamPusher
);
return
NULL
;
}
return
streamPusher
;
...
...
source/dnode/vnode/src/tq/tqRead.c
浏览文件 @
222db126
...
...
@@ -17,7 +17,7 @@
#include "vnode.h"
STqReadHandle
*
tqInitSubmitMsgScanner
(
SMeta
*
pMeta
)
{
STqReadHandle
*
pReadHandle
=
m
alloc
(
sizeof
(
STqReadHandle
));
STqReadHandle
*
pReadHandle
=
taosMemoryM
alloc
(
sizeof
(
STqReadHandle
));
if
(
pReadHandle
==
NULL
)
{
return
NULL
;
}
...
...
@@ -143,7 +143,7 @@ SArray* tqRetrieveDataBlock(STqReadHandle* pHandle) {
colInfo
.
info
.
colId
=
pColSchema
->
colId
;
colInfo
.
info
.
type
=
pColSchema
->
type
;
colInfo
.
pData
=
c
alloc
(
1
,
sz
);
colInfo
.
pData
=
taosMemoryC
alloc
(
1
,
sz
);
if
(
colInfo
.
pData
==
NULL
)
{
// TODO free
taosArrayDestroy
(
pArray
);
...
...
@@ -173,7 +173,7 @@ SArray* tqRetrieveDataBlock(STqReadHandle* pHandle) {
colInfo
.
info
.
colId
=
colId
;
colInfo
.
info
.
type
=
pColSchema
->
type
;
colInfo
.
pData
=
c
alloc
(
1
,
sz
);
colInfo
.
pData
=
taosMemoryC
alloc
(
1
,
sz
);
if
(
colInfo
.
pData
==
NULL
)
{
// TODO free
taosArrayDestroy
(
pArray
);
...
...
source/dnode/vnode/src/tsdb/tsdbBDBImpl.c
浏览文件 @
222db126
...
...
@@ -51,7 +51,7 @@ void tsdbCloseDBF(SDBFile *pDBF) {
tsdbCloseBDBDb
(
pDBF
->
pDB
);
pDBF
->
pDB
=
NULL
;
}
t
free
(
pDBF
->
path
);
t
aosMemoryFreeClear
(
pDBF
->
path
);
}
int32_t
tsdbOpenBDBEnv
(
DB_ENV
**
ppEnv
,
const
char
*
path
)
{
...
...
@@ -159,7 +159,7 @@ void *tsdbGetSmaDataByKey(SDBFile *pDBF, void* key, uint32_t keySize, uint32_t *
return
NULL
;
}
result
=
c
alloc
(
1
,
value1
.
size
);
result
=
taosMemoryC
alloc
(
1
,
value1
.
size
);
if
(
result
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
222db126
...
...
@@ -403,7 +403,7 @@ static int tsdbCreateCommitIters(SCommitH *pCommith) {
STbData
*
pTbData
;
pCommith
->
niters
=
SL_SIZE
(
pMem
->
pSlIdx
);
pCommith
->
iters
=
(
SCommitIter
*
)
c
alloc
(
pCommith
->
niters
,
sizeof
(
SCommitIter
));
pCommith
->
iters
=
(
SCommitIter
*
)
taosMemoryC
alloc
(
pCommith
->
niters
,
sizeof
(
SCommitIter
));
if
(
pCommith
->
iters
==
NULL
)
{
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -424,7 +424,7 @@ static int tsdbCreateCommitIters(SCommitH *pCommith) {
pCommitIter
->
pIter
=
tSkipListCreateIter
(
pTbData
->
pData
);
tSkipListIterNext
(
pCommitIter
->
pIter
);
pCommitIter
->
pTable
=
(
STable
*
)
m
alloc
(
sizeof
(
STable
));
pCommitIter
->
pTable
=
(
STable
*
)
taosMemoryM
alloc
(
sizeof
(
STable
));
pCommitIter
->
pTable
->
uid
=
pTbData
->
uid
;
pCommitIter
->
pTable
->
tid
=
pTbData
->
uid
;
pCommitIter
->
pTable
->
pSchema
=
metaGetTbTSchema
(
pRepo
->
pMeta
,
pTbData
->
uid
,
0
);
...
...
@@ -439,10 +439,10 @@ static void tsdbDestroyCommitIters(SCommitH *pCommith) {
for
(
int
i
=
1
;
i
<
pCommith
->
niters
;
i
++
)
{
tSkipListDestroyIter
(
pCommith
->
iters
[
i
].
pIter
);
tdFreeSchema
(
pCommith
->
iters
[
i
].
pTable
->
pSchema
);
f
ree
(
pCommith
->
iters
[
i
].
pTable
);
taosMemoryF
ree
(
pCommith
->
iters
[
i
].
pTable
);
}
f
ree
(
pCommith
->
iters
);
taosMemoryF
ree
(
pCommith
->
iters
);
pCommith
->
iters
=
NULL
;
pCommith
->
niters
=
0
;
}
...
...
@@ -985,7 +985,7 @@ int tsdbWriteBlockIdx(SDFile *pHeadf, SArray *pIdxA, void **ppBuf) {
// SKVRecord *pRecord;
// void *pBuf = NULL;
// pBuf =
m
alloc((size_t)maxBufSize);
// pBuf =
taosMemoryM
alloc((size_t)maxBufSize);
// if (pBuf == NULL) {
// goto _err;
// }
...
...
@@ -1006,7 +1006,7 @@ int tsdbWriteBlockIdx(SDFile *pHeadf, SArray *pIdxA, void **ppBuf) {
// }
// if (pRecord->size > maxBufSize) {
// maxBufSize = pRecord->size;
// void* tmp =
r
ealloc(pBuf, (size_t)maxBufSize);
// void* tmp =
taosMemoryR
ealloc(pBuf, (size_t)maxBufSize);
// if (tmp == NULL) {
// goto _err;
// }
...
...
@@ -1059,7 +1059,7 @@ int tsdbWriteBlockIdx(SDFile *pHeadf, SArray *pIdxA, void **ppBuf) {
// pfs->metaCacheComp = NULL;
// }
// t
free
(pBuf);
// t
aosMemoryFreeClear
(pBuf);
// ASSERT(mf.info.nDels == 0);
// ASSERT(mf.info.tombSize == 0);
...
...
source/dnode/vnode/src/tsdb/tsdbFS.c
浏览文件 @
222db126
...
...
@@ -134,7 +134,7 @@ static void *tsdbDecodeFSStatus(STsdb*pRepo, void *buf, SFSStatus *pStatus) {
}
static
SFSStatus
*
tsdbNewFSStatus
(
int
maxFSet
)
{
SFSStatus
*
pStatus
=
(
SFSStatus
*
)
c
alloc
(
1
,
sizeof
(
*
pStatus
));
SFSStatus
*
pStatus
=
(
SFSStatus
*
)
taosMemoryC
alloc
(
1
,
sizeof
(
*
pStatus
));
if
(
pStatus
==
NULL
)
{
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
return
NULL
;
...
...
@@ -145,7 +145,7 @@ static SFSStatus *tsdbNewFSStatus(int maxFSet) {
pStatus
->
df
=
taosArrayInit
(
maxFSet
,
sizeof
(
SDFileSet
));
if
(
pStatus
->
df
==
NULL
)
{
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
f
ree
(
pStatus
);
taosMemoryF
ree
(
pStatus
);
return
NULL
;
}
...
...
@@ -155,7 +155,7 @@ static SFSStatus *tsdbNewFSStatus(int maxFSet) {
static
SFSStatus
*
tsdbFreeFSStatus
(
SFSStatus
*
pStatus
)
{
if
(
pStatus
)
{
pStatus
->
df
=
taosArrayDestroy
(
pStatus
->
df
);
f
ree
(
pStatus
);
taosMemoryF
ree
(
pStatus
);
}
return
NULL
;
...
...
@@ -197,7 +197,7 @@ STsdbFS *tsdbNewFS(const STsdbCfg *pCfg) {
int
maxFSet
=
TSDB_MAX_FSETS
(
keep
,
days
);
STsdbFS
*
pfs
;
pfs
=
(
STsdbFS
*
)
c
alloc
(
1
,
sizeof
(
*
pfs
));
pfs
=
(
STsdbFS
*
)
taosMemoryC
alloc
(
1
,
sizeof
(
*
pfs
));
if
(
pfs
==
NULL
)
{
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
return
NULL
;
...
...
@@ -206,7 +206,7 @@ STsdbFS *tsdbNewFS(const STsdbCfg *pCfg) {
int
code
=
taosThreadRwlockInit
(
&
(
pfs
->
lock
),
NULL
);
if
(
code
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
code
);
f
ree
(
pfs
);
taosMemoryF
ree
(
pfs
);
return
NULL
;
}
...
...
@@ -242,7 +242,7 @@ void *tsdbFreeFS(STsdbFS *pfs) {
pfs
->
metaCache
=
NULL
;
pfs
->
cstatus
=
tsdbFreeFSStatus
(
pfs
->
cstatus
);
taosThreadRwlockDestroy
(
&
(
pfs
->
lock
));
f
ree
(
pfs
);
taosMemoryF
ree
(
pfs
);
}
return
NULL
;
...
...
@@ -853,7 +853,7 @@ static int tsdbScanAndTryFixFS(STsdb *pRepo) {
// }
// if (recoverMeta) {
// pBuf =
m
alloc((size_t)maxBufSize);
// pBuf =
taosMemoryM
alloc((size_t)maxBufSize);
// if (pBuf == NULL) {
// terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
// tsdbCloseMFile(pMFile);
...
...
@@ -865,7 +865,7 @@ static int tsdbScanAndTryFixFS(STsdb *pRepo) {
// if (tsdbSeekMFile(pMFile, pRecord->offset + sizeof(SKVRecord), SEEK_SET) < 0) {
// tsdbError("vgId:%d failed to seek file %s since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pMFile),
// tstrerror(terrno));
// t
free
(pBuf);
// t
aosMemoryFreeClear
(pBuf);
// tsdbCloseMFile(pMFile);
// return -1;
// }
...
...
@@ -874,7 +874,7 @@ static int tsdbScanAndTryFixFS(STsdb *pRepo) {
// if (nread < 0) {
// tsdbError("vgId:%d failed to read file %s since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pMFile),
// tstrerror(terrno));
// t
free
(pBuf);
// t
aosMemoryFreeClear
(pBuf);
// tsdbCloseMFile(pMFile);
// return -1;
// }
...
...
@@ -883,7 +883,7 @@ static int tsdbScanAndTryFixFS(STsdb *pRepo) {
// tsdbError("vgId:%d failed to read file %s since file corrupted, expected read:%" PRId64 " actual read:%d",
// REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pMFile), pRecord->size, nread);
// terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
// t
free
(pBuf);
// t
aosMemoryFreeClear
(pBuf);
// tsdbCloseMFile(pMFile);
// return -1;
// }
...
...
@@ -891,7 +891,7 @@ static int tsdbScanAndTryFixFS(STsdb *pRepo) {
// if (tsdbRestoreTable(pRepo, pBuf, (int)pRecord->size) < 0) {
// tsdbError("vgId:%d failed to restore table, uid %" PRId64 ", since %s" PRIu64, REPO_ID(pRepo), pRecord->uid,
// tstrerror(terrno));
// t
free
(pBuf);
// t
aosMemoryFreeClear
(pBuf);
// tsdbCloseMFile(pMFile);
// return -1;
// }
...
...
@@ -903,7 +903,7 @@ static int tsdbScanAndTryFixFS(STsdb *pRepo) {
// }
// tsdbCloseMFile(pMFile);
// t
free
(pBuf);
// t
aosMemoryFreeClear
(pBuf);
// return 0;
// }
...
...
source/dnode/vnode/src/tsdb/tsdbFile.c
浏览文件 @
222db126
...
...
@@ -85,7 +85,7 @@ void *tsdbDecodeSMFileEx(void *buf, SMFile *pMFile) {
strncpy(TSDB_FILE_FULL_NAME(pMFile), aname, TSDB_FILENAME_LEN);
TSDB_FILE_SET_CLOSED(pMFile);
t
free
(aname);
t
aosMemoryFreeClear
(aname);
return buf;
}
...
...
@@ -119,10 +119,10 @@ int tsdbCreateMFile(SMFile *pMFile, bool updateHeader) {
// Try to create directory recursively
char *s = strdup(TFILE_REL_NAME(&(pMFile->f)));
if (tfsMkdirRecurAt(dirname(s), TSDB_FILE_LEVEL(pMFile), TSDB_FILE_ID(pMFile)) < 0) {
t
free
(s);
t
aosMemoryFreeClear
(s);
return -1;
}
t
free
(s);
t
aosMemoryFreeClear
(s);
pMFile->fd = open(TSDB_FILE_FULL_NAME(pMFile), O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0755);
if (pMFile->fd < 0) {
...
...
@@ -352,7 +352,7 @@ static void *tsdbDecodeSDFileEx(void *buf, SDFile *pDFile) {
buf
=
taosDecodeString
(
buf
,
&
aname
);
strncpy
(
TSDB_FILE_FULL_NAME
(
pDFile
),
aname
,
TSDB_FILENAME_LEN
);
TSDB_FILE_SET_CLOSED
(
pDFile
);
t
free
(
aname
);
t
aosMemoryFreeClear
(
aname
);
return
buf
;
}
...
...
@@ -366,10 +366,10 @@ int tsdbCreateDFile(STsdb *pRepo, SDFile *pDFile, bool updateHeader, TSDB_FILE_T
// Try to create directory recursively
char
*
s
=
strdup
(
TSDB_FILE_REL_NAME
(
pDFile
));
if
(
tfsMkdirRecurAt
(
pRepo
->
pTfs
,
taosDirName
(
s
),
TSDB_FILE_DID
(
pDFile
))
<
0
)
{
t
free
(
s
);
t
aosMemoryFreeClear
(
s
);
return
-
1
;
}
t
free
(
s
);
t
aosMemoryFreeClear
(
s
);
pDFile
->
pFile
=
taosOpenFile
(
TSDB_FILE_FULL_NAME
(
pDFile
),
TD_FILE_CTEATE
|
TD_FILE_WRITE
|
TD_FILE_TRUNC
);
if
(
pDFile
->
pFile
==
NULL
)
{
...
...
@@ -692,7 +692,7 @@ int tsdbParseDFilename(const char *fname, int *vid, int *fid, TSDB_FILE_T *ftype
}
}
t
free
(
p
);
t
aosMemoryFreeClear
(
p
);
return
0
;
}
...
...
source/dnode/vnode/src/tsdb/tsdbMain.c
浏览文件 @
222db126
...
...
@@ -68,7 +68,7 @@ static STsdb *tsdbNew(const char *path, int32_t vgId, const STsdbCfg *pTsdbCfg,
SMeta
*
pMeta
,
STfs
*
pTfs
)
{
STsdb
*
pTsdb
=
NULL
;
pTsdb
=
(
STsdb
*
)
c
alloc
(
1
,
sizeof
(
STsdb
));
pTsdb
=
(
STsdb
*
)
taosMemoryC
alloc
(
1
,
sizeof
(
STsdb
));
if
(
pTsdb
==
NULL
)
{
// TODO: handle error
return
NULL
;
...
...
@@ -93,8 +93,8 @@ static void tsdbFree(STsdb *pTsdb) {
tsdbFreeSmaEnv
(
pTsdb
->
pRSmaEnv
);
tsdbFreeSmaEnv
(
pTsdb
->
pTSmaEnv
);
tsdbFreeFS
(
pTsdb
->
fs
);
t
free
(
pTsdb
->
path
);
f
ree
(
pTsdb
);
t
aosMemoryFreeClear
(
pTsdb
->
path
);
taosMemoryF
ree
(
pTsdb
);
}
}
...
...
@@ -507,7 +507,7 @@ uint32_t tsdbGetFileInfo(STsdbRepo *repo, char *name, uint32_t *index, uint32_t
magic = pFile->info.magic;
char *tfname = strdup(fname);
sprintf(name, "tsdb/%s/%s", TSDB_DATA_DIR_NAME, basename(tfname));
t
free
(tfname);
t
aosMemoryFreeClear
(tfname);
} else {
if ((pFGroup->fileId + 1) * TSDB_FILE_TYPE_MAX - 1 < (int)eindex) {
SFile *pFile = &pFGroup->files[0];
...
...
@@ -516,17 +516,17 @@ uint32_t tsdbGetFileInfo(STsdbRepo *repo, char *name, uint32_t *index, uint32_t
magic = pFile->info.magic;
char *tfname = strdup(fname);
sprintf(name, "tsdb/%s/%s", TSDB_DATA_DIR_NAME, basename(tfname));
t
free
(tfname);
t
aosMemoryFreeClear
(tfname);
} else {
return 0;
}
}
}
} else { // get the named file at the specified index. If not there, return 0
fname =
m
alloc(256);
fname =
taosMemoryM
alloc(256);
sprintf(fname, "%s/vnode/vnode%d/%s", tfsGetPrimaryPath(pRepo->pTfs), REPO_ID(pRepo), name);
if (access(fname, F_OK) != 0) {
t
free
(fname);
t
aosMemoryFreeClear
(fname);
return 0;
}
if (*index == TSDB_META_FILE_INDEX) { // get meta file
...
...
@@ -536,19 +536,19 @@ uint32_t tsdbGetFileInfo(STsdbRepo *repo, char *name, uint32_t *index, uint32_t
sprintf(tfname, "vnode/vnode%d/tsdb/%s/%s", REPO_ID(pRepo), TSDB_DATA_DIR_NAME, basename(name));
tsdbGetFileInfoImpl(tfname, &magic, size);
}
t
free
(fname);
t
aosMemoryFreeClear
(fname);
return magic;
}
if (stat(fname, &fState) < 0) {
t
free
(fname);
t
aosMemoryFreeClear
(fname);
return 0;
}
*size = fState.st_size;
// magic = *size;
t
free
(fname);
t
aosMemoryFreeClear
(fname);
return magic;
#endif
}
...
...
@@ -674,7 +674,7 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) {
}
static STsdbRepo *tsdbNewRepo(STsdbCfg *pCfg, STsdbAppH *pAppH) {
STsdbRepo *pRepo = (STsdbRepo *)
c
alloc(1, sizeof(*pRepo));
STsdbRepo *pRepo = (STsdbRepo *)
taosMemoryC
alloc(1, sizeof(*pRepo));
if (pRepo == NULL) {
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
return NULL;
...
...
@@ -748,7 +748,7 @@ static void tsdbFreeRepo(STsdbRepo *pRepo) {
// tsdbFreeMemTable(pRepo->imem);
tsem_destroy(&(pRepo->readyToCommit));
taosThreadMutexDestroy(&pRepo->mutex);
f
ree(pRepo);
taosMemoryF
ree(pRepo);
}
}
...
...
@@ -820,7 +820,7 @@ static int tsdbRestoreLastColumns(STsdbRepo *pRepo, STable *pTable, SReadH* pRea
goto out;
}
pBlockStatis =
c
alloc(numColumns, sizeof(SDataStatis));
pBlockStatis =
taosMemoryC
alloc(numColumns, sizeof(SDataStatis));
if (pBlockStatis == NULL) {
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
err = -1;
...
...
@@ -886,7 +886,7 @@ static int tsdbRestoreLastColumns(STsdbRepo *pRepo, STable *pTable, SReadH* pRea
// save not-null column
uint16_t bytes = IS_VAR_DATA_TYPE(pCol->type) ? varDataTLen(pColData) : pCol->bytes;
SDataCol *pLastCol = &(pTable->lastCols[idx]);
pLastCol->pData =
m
alloc(bytes);
pLastCol->pData =
taosMemoryM
alloc(bytes);
pLastCol->bytes = bytes;
pLastCol->colId = pCol->colId;
memcpy(pLastCol->pData, value, bytes);
...
...
@@ -907,7 +907,7 @@ static int tsdbRestoreLastColumns(STsdbRepo *pRepo, STable *pTable, SReadH* pRea
out:
taosTZfree(row);
t
free
(pBlockStatis);
t
aosMemoryFreeClear
(pBlockStatis);
if (err == 0 && numColumns <= pTable->restoreColumnNum) {
pTable->hasRestoreLastColumn = true;
...
...
source/dnode/vnode/src/tsdb/tsdbMemTable.c
浏览文件 @
222db126
...
...
@@ -25,7 +25,7 @@ static char * tsdbTbDataGetUid(const void *arg);
static
int
tsdbAppendTableRowToCols
(
STable
*
pTable
,
SDataCols
*
pCols
,
STSchema
**
ppSchema
,
STSRow
*
row
);
STsdbMemTable
*
tsdbNewMemTable
(
STsdb
*
pTsdb
)
{
STsdbMemTable
*
pMemTable
=
(
STsdbMemTable
*
)
c
alloc
(
1
,
sizeof
(
*
pMemTable
));
STsdbMemTable
*
pMemTable
=
(
STsdbMemTable
*
)
taosMemoryC
alloc
(
1
,
sizeof
(
*
pMemTable
));
if
(
pMemTable
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
...
...
@@ -38,7 +38,7 @@ STsdbMemTable *tsdbNewMemTable(STsdb *pTsdb) {
pMemTable
->
nRow
=
0
;
pMemTable
->
pMA
=
pTsdb
->
pmaf
->
create
(
pTsdb
->
pmaf
);
if
(
pMemTable
->
pMA
==
NULL
)
{
f
ree
(
pMemTable
);
taosMemoryF
ree
(
pMemTable
);
return
NULL
;
}
...
...
@@ -47,7 +47,7 @@ STsdbMemTable *tsdbNewMemTable(STsdb *pTsdb) {
tSkipListCreate
(
5
,
TSDB_DATA_TYPE_BIGINT
,
sizeof
(
tb_uid_t
),
tsdbTbDataComp
,
SL_DISCARD_DUP_KEY
,
tsdbTbDataGetUid
);
if
(
pMemTable
->
pSlIdx
==
NULL
)
{
pTsdb
->
pmaf
->
destroy
(
pTsdb
->
pmaf
,
pMemTable
->
pMA
);
f
ree
(
pMemTable
);
taosMemoryF
ree
(
pMemTable
);
return
NULL
;
}
...
...
@@ -55,7 +55,7 @@ STsdbMemTable *tsdbNewMemTable(STsdb *pTsdb) {
if
(
pMemTable
->
pHashIdx
==
NULL
)
{
pTsdb
->
pmaf
->
destroy
(
pTsdb
->
pmaf
,
pMemTable
->
pMA
);
tSkipListDestroy
(
pMemTable
->
pSlIdx
);
f
ree
(
pMemTable
);
taosMemoryF
ree
(
pMemTable
);
return
NULL
;
}
...
...
@@ -69,7 +69,7 @@ void tsdbFreeMemTable(STsdb *pTsdb, STsdbMemTable *pMemTable) {
if
(
pMemTable
->
pMA
)
{
pTsdb
->
pmaf
->
destroy
(
pTsdb
->
pmaf
,
pMemTable
->
pMA
);
}
f
ree
(
pMemTable
);
taosMemoryF
ree
(
pMemTable
);
}
}
...
...
@@ -376,7 +376,7 @@ static int tsdbMemTableInsertTbData(STsdb *pTsdb, SSubmitBlk *pBlock, int32_t *p
}
static
STbData
*
tsdbNewTbData
(
tb_uid_t
uid
)
{
STbData
*
pTbData
=
(
STbData
*
)
c
alloc
(
1
,
sizeof
(
*
pTbData
));
STbData
*
pTbData
=
(
STbData
*
)
taosMemoryC
alloc
(
1
,
sizeof
(
*
pTbData
));
if
(
pTbData
==
NULL
)
{
return
NULL
;
}
...
...
@@ -397,14 +397,14 @@ static STbData *tsdbNewTbData(tb_uid_t uid) {
// tkeyComparFn, skipListCreateFlags, tsdbGetTsTupleKey);
// if (pTableData->pData == NULL) {
// terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
//
f
ree(pTableData);
//
taosMemoryF
ree(pTableData);
// return NULL;
// }
pTbData
->
pData
=
tSkipListCreate
(
5
,
TSDB_DATA_TYPE_TIMESTAMP
,
sizeof
(
int64_t
),
tkeyComparFn
,
SL_DISCARD_DUP_KEY
,
tsdbGetTsTupleKey
);
if
(
pTbData
->
pData
==
NULL
)
{
f
ree
(
pTbData
);
taosMemoryF
ree
(
pTbData
);
return
NULL
;
}
...
...
@@ -414,7 +414,7 @@ static STbData *tsdbNewTbData(tb_uid_t uid) {
static
void
tsdbFreeTbData
(
STbData
*
pTbData
)
{
if
(
pTbData
)
{
tSkipListDestroy
(
pTbData
->
pData
);
f
ree
(
pTbData
);
taosMemoryF
ree
(
pTbData
);
}
}
...
...
@@ -582,7 +582,7 @@ int tsdbTakeMemSnapshot(STsdbRepo *pRepo, SMemSnapshot *pSnapshot, SArray *pATab
pSnapshot->mem = &(pSnapshot->mtable);
pSnapshot->mem->tData = (STableData **)
c
alloc(pSnapshot->omem->maxTables, sizeof(STableData *));
pSnapshot->mem->tData = (STableData **)
taosMemoryC
alloc(pSnapshot->omem->maxTables, sizeof(STableData *));
if (pSnapshot->mem->tData == NULL) {
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
taosRUnLockLatch(&(pSnapshot->omem->latch));
...
...
@@ -629,7 +629,7 @@ void tsdbUnTakeMemSnapShot(STsdbRepo *pRepo, SMemSnapshot *pSnapshot) {
tsdbFreeTableData(pTableData);
}
}
t
free
(pSnapshot->mem->tData);
t
aosMemoryFreeClear
(pSnapshot->mem->tData);
tsdbUnRefMemTable(pRepo, pSnapshot->omem);
}
...
...
@@ -990,10 +990,10 @@ static void updateTableLatestColumn(STsdbRepo *pRepo, STable *pTable, STSRow* ro
TSDB_WLOCK_TABLE(pTable);
SDataCol *pDataCol = &(pLatestCols[idx]);
if (pDataCol->pData == NULL) {
pDataCol->pData =
m
alloc(pTCol->bytes);
pDataCol->pData =
taosMemoryM
alloc(pTCol->bytes);
pDataCol->bytes = pTCol->bytes;
} else if (pDataCol->bytes < pTCol->bytes) {
pDataCol->pData =
r
ealloc(pDataCol->pData, pTCol->bytes);
pDataCol->pData =
taosMemoryR
ealloc(pDataCol->pData, pTCol->bytes);
pDataCol->bytes = pTCol->bytes;
}
// the actual value size
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbSma.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/dnode/vnode/src/vnd/vnodeArenaMAImpl.c
浏览文件 @
222db126
...
...
@@ -19,7 +19,7 @@ static SVArenaNode *vArenaNodeNew(uint64_t capacity);
static
void
vArenaNodeFree
(
SVArenaNode
*
pNode
);
SVMemAllocator
*
vmaCreate
(
uint64_t
capacity
,
uint64_t
ssize
,
uint64_t
lsize
)
{
SVMemAllocator
*
pVMA
=
(
SVMemAllocator
*
)
m
alloc
(
sizeof
(
*
pVMA
));
SVMemAllocator
*
pVMA
=
(
SVMemAllocator
*
)
taosMemoryM
alloc
(
sizeof
(
*
pVMA
));
if
(
pVMA
==
NULL
)
{
return
NULL
;
}
...
...
@@ -31,7 +31,7 @@ SVMemAllocator *vmaCreate(uint64_t capacity, uint64_t ssize, uint64_t lsize) {
pVMA
->
pNode
=
vArenaNodeNew
(
capacity
);
if
(
pVMA
->
pNode
==
NULL
)
{
f
ree
(
pVMA
);
taosMemoryF
ree
(
pVMA
);
return
NULL
;
}
...
...
@@ -48,7 +48,7 @@ void vmaDestroy(SVMemAllocator *pVMA) {
vArenaNodeFree
(
pNode
);
}
f
ree
(
pVMA
);
taosMemoryF
ree
(
pVMA
);
}
}
...
...
@@ -99,7 +99,7 @@ bool vmaIsFull(SVMemAllocator *pVMA) {
static
SVArenaNode
*
vArenaNodeNew
(
uint64_t
capacity
)
{
SVArenaNode
*
pNode
=
NULL
;
pNode
=
(
SVArenaNode
*
)
m
alloc
(
sizeof
(
*
pNode
)
+
capacity
);
pNode
=
(
SVArenaNode
*
)
taosMemoryM
alloc
(
sizeof
(
*
pNode
)
+
capacity
);
if
(
pNode
==
NULL
)
{
return
NULL
;
}
...
...
@@ -112,6 +112,6 @@ static SVArenaNode *vArenaNodeNew(uint64_t capacity) {
static
void
vArenaNodeFree
(
SVArenaNode
*
pNode
)
{
if
(
pNode
)
{
f
ree
(
pNode
);
taosMemoryF
ree
(
pNode
);
}
}
source/dnode/vnode/src/vnd/vnodeBufferPool.c
浏览文件 @
222db126
...
...
@@ -34,7 +34,7 @@ static void vBufPoolDestroyMA(SMemAllocatorFactory *pMAF, SMemAllocato
int
vnodeOpenBufPool
(
SVnode
*
pVnode
)
{
uint64_t
capacity
;
if
((
pVnode
->
pBufPool
=
(
SVBufPool
*
)
c
alloc
(
1
,
sizeof
(
SVBufPool
)))
==
NULL
)
{
if
((
pVnode
->
pBufPool
=
(
SVBufPool
*
)
taosMemoryC
alloc
(
1
,
sizeof
(
SVBufPool
)))
==
NULL
)
{
/* TODO */
return
-
1
;
}
...
...
@@ -57,7 +57,7 @@ int vnodeOpenBufPool(SVnode *pVnode) {
TD_DLIST_APPEND
(
&
(
pVnode
->
pBufPool
->
free
),
pVMA
);
}
pVnode
->
pBufPool
->
pMAF
=
(
SMemAllocatorFactory
*
)
m
alloc
(
sizeof
(
SMemAllocatorFactory
));
pVnode
->
pBufPool
->
pMAF
=
(
SMemAllocatorFactory
*
)
taosMemoryM
alloc
(
sizeof
(
SMemAllocatorFactory
));
if
(
pVnode
->
pBufPool
->
pMAF
==
NULL
)
{
// TODO: handle error
return
-
1
;
...
...
@@ -71,7 +71,7 @@ int vnodeOpenBufPool(SVnode *pVnode) {
void
vnodeCloseBufPool
(
SVnode
*
pVnode
)
{
if
(
pVnode
->
pBufPool
)
{
t
free
(
pVnode
->
pBufPool
->
pMAF
);
t
aosMemoryFreeClear
(
pVnode
->
pBufPool
->
pMAF
);
vmaDestroy
(
pVnode
->
pBufPool
->
inuse
);
while
(
true
)
{
...
...
@@ -88,7 +88,7 @@ void vnodeCloseBufPool(SVnode *pVnode) {
vmaDestroy
(
pVMA
);
}
f
ree
(
pVnode
->
pBufPool
);
taosMemoryF
ree
(
pVnode
->
pBufPool
);
pVnode
->
pBufPool
=
NULL
;
}
}
...
...
@@ -161,7 +161,7 @@ static SMemAllocator *vBufPoolCreateMA(SMemAllocatorFactory *pMAF) {
SVnode
*
pVnode
=
(
SVnode
*
)(
pMAF
->
impl
);
SVMAWrapper
*
pWrapper
;
pMA
=
(
SMemAllocator
*
)
c
alloc
(
1
,
sizeof
(
*
pMA
)
+
sizeof
(
SVMAWrapper
));
pMA
=
(
SMemAllocator
*
)
taosMemoryC
alloc
(
1
,
sizeof
(
*
pMA
)
+
sizeof
(
SVMAWrapper
));
if
(
pMA
==
NULL
)
{
return
NULL
;
}
...
...
@@ -182,7 +182,7 @@ static void vBufPoolDestroyMA(SMemAllocatorFactory *pMAF, SMemAllocator *pMA) {
SVnode
*
pVnode
=
pWrapper
->
pVnode
;
SVMemAllocator
*
pVMA
=
pWrapper
->
pVMA
;
f
ree
(
pMA
);
taosMemoryF
ree
(
pMA
);
if
(
--
pVMA
->
_ref
.
val
==
0
)
{
TD_DLIST_POP
(
&
(
pVnode
->
pBufPool
->
incycle
),
pVMA
);
vmaReset
(
pVMA
);
...
...
source/dnode/vnode/src/vnd/vnodeCommit.c
浏览文件 @
222db126
...
...
@@ -24,7 +24,7 @@ int vnodeAsyncCommit(SVnode *pVnode) {
vnodeWaitCommit
(
pVnode
);
vnodeBufPoolSwitch
(
pVnode
);
SVnodeTask
*
pTask
=
(
SVnodeTask
*
)
m
alloc
(
sizeof
(
*
pTask
));
SVnodeTask
*
pTask
=
(
SVnodeTask
*
)
taosMemoryM
alloc
(
sizeof
(
*
pTask
));
pTask
->
execute
=
vnodeCommit
;
// TODO
pTask
->
arg
=
pVnode
;
// TODO
...
...
source/dnode/vnode/src/vnd/vnodeMain.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/dnode/vnode/src/vnd/vnodeMgr.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/dnode/vnode/src/vnd/vnodeWrite.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/dnode/vnode/test/tqMetaTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/dnode/vnode/test/tsdbSmaTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/catalog/src/catalog.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/catalog/test/catalogTests.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/executor/src/dataDispatcher.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/executor/src/executil.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/executor/src/executorimpl.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/executor/src/tlinearhash.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/executor/src/tsimplehash.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/executor/src/tsort.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/executor/test/executorTests.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/executor/test/sortTests.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/function/CMakeLists.txt
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/function/src/taggfunction.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/function/src/texpr.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/function/src/tfill.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/function/src/thistogram.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/function/src/tpercentile.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/function/src/tscript.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/function/src/tudf.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/function/src/udfd.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/function/test/runUdf.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/function/test/udf1.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/index/src/index.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/index/src/index_cache.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/index/src/index_comm.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/index/src/index_fst.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/index/src/index_fst_automation.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/index/src/index_fst_counting_writer.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/index/src/index_fst_node.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/index/src/index_fst_registry.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/index/src/index_fst_util.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/index/src/index_tfile.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/index/src/index_util.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/index/test/fstTest.cc
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/index/test/fstUT.cc
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/index/test/indexTests.cc
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/monitor/src/monitor.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/nodes/src/nodesCloneFuncs.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/nodes/src/nodesCodeFuncs.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/parser/src/parAstCreater.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/parser/src/parAstParser.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/parser/src/parInsert.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/parser/src/parInsertData.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/parser/src/parTokenizer.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/parser/src/parTranslater.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/parser/src/parUtil.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/parser/src/parser.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/parser/src/sql.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/parser/test/mockCatalogService.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/parser/test/mockCatalogService.h
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/parser/test/parserAstTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/planner/src/planScaleOut.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/planner/src/planSpliter.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/planner/test/plannerTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/qcom/src/querymsg.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/qcom/test/queryTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/qworker/src/qworker.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/qworker/src/qworkerMsg.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/qworker/test/qworkerTests.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/scalar/inc/filterInt.h
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/scalar/src/filter.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/scalar/src/scalar.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/scalar/src/sclfunc.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/scalar/src/sclvector.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/scalar/test/filter/filterTests.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/scalar/test/scalar/scalarTests.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/scheduler/src/scheduler.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/scheduler/test/schedulerTests.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/stream/src/tstream.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/src/syncEnv.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/src/syncIO.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/src/syncIndexMgr.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/src/syncMain.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/src/syncMessage.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/src/syncRaftEntry.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/src/syncRaftLog.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/src/syncRaftStore.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/src/syncReplication.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/src/syncUtil.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/src/syncVoteMgr.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncAppendEntriesReplyTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncAppendEntriesTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncClientRequestTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncElectTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncElectTest2.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncElectTest3.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncEncodeTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncEnqTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncEntryTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncIOSendMsgTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncIndexMgrTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncInitTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncLogStoreTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncPingReplyTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncPingSelfTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncPingTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncPingTimerTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncPingTimerTest2.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncRaftStoreTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncRefTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncReplicateLoadTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncReplicateTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncReplicateTest2.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncReplicateTest3.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncRequestVoteReplyTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncRequestVoteTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncTimeoutTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncVotesGrantedTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncVotesRespondTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/sync/test/syncWriteTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/tdb/src/db/tdbBtree.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/tdb/src/db/tdbDb.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/tdb/src/db/tdbEnv.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/tdb/src/db/tdbPCache.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/tdb/src/db/tdbPager.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/tfs/src/tfs.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/tfs/src/tfsDisk.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/tfs/test/tfsTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/transport/inc/transComm.h
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/transport/src/rpcCache.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/transport/src/rpcMain.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/transport/src/rpcTcp.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/transport/src/rpcUdp.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/transport/src/thttp.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/transport/src/trans.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/transport/src/transCli.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/transport/src/transComm.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/transport/src/transSrv.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/transport/test/rclient.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/transport/test/rsclient.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/transport/test/syncClient.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/transport/test/transportTests.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/transport/test/uv.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/wal/src/walMeta.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/wal/src/walMgmt.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/wal/src/walRead.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/libs/wal/test/walMetaTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/os/src/osFile.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/os/src/osLocale.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/os/src/osMemory.c
0 → 100644
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/os/src/osSemaphore.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/os/src/osSocket.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/os/src/osString.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/os/src/osSysinfo.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/talgo.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tarray.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tbase64.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tbuffer.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tcache.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tcompare.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tconfig.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tcrc32c.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tdes.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tencode.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tfunctional.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/thash.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/theap.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tidpool.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tjson.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tlist.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tlog.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tlosertree.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tmallocator.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tmempool.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tpagedbuf.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tprocess.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tqueue.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tref.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tsched.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tskiplist.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tstrbuild.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tthread.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/ttimer.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tutil.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/src/tworker.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/test/hashTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/test/skiplistTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/test/stringTest.cpp
浏览文件 @
222db126
此差异已折叠。
点击以展开。
source/util/test/trefTest.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
tests/script/api/batchprepare.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
tests/script/api/stmtBatchTest.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
tests/script/api/stmtTest.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
tests/script/api/stmt_function.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
tests/script/http/httpTest.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
tests/script/http/httpTestSqlUtc.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
tests/script/http/httpTestSqlt.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
tests/script/sh/sum_double.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
tests/test/c/create_table.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
tests/test/c/tmqDemo.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
tests/tsim/src/simParse.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
tests/tsim/src/simSystem.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
tools/shell/src/backup/shellCheck.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
tools/shell/src/backup/shellDarwin.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
tools/shell/src/backup/shellImport.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
tools/shell/src/backup/shellWindows.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
tools/shell/src/shellCommand.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
tools/shell/src/shellEngine.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
tools/shell/src/shellMain.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
tools/shell/src/tnettest.c
浏览文件 @
222db126
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录