提交 fe097058 编写于 作者: H Haojun Liao

fix: set the init function pointer.

上级 a5661807
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "taosdef.h" #include "taosdef.h"
#include "tmsg.h" #include "tmsg.h"
#include "tcommon.h" #include "tcommon.h"
#include "index.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
...@@ -544,6 +545,7 @@ typedef struct SStorageAPI { ...@@ -544,6 +545,7 @@ typedef struct SStorageAPI {
SStoreSnapshotFn snapshotFn; SStoreSnapshotFn snapshotFn;
SStoreTqReader tqReaderFn; SStoreTqReader tqReaderFn;
SStateStore stateStore; SStateStore stateStore;
SMetaDataFilterAPI metaFilter;
} SStorageAPI; } SStorageAPI;
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -239,7 +239,6 @@ void indexCleanup(); ...@@ -239,7 +239,6 @@ void indexCleanup();
* @param results * @param results
* @return * @return
*/ */
typedef struct SMetaFltParam { typedef struct SMetaFltParam {
uint64_t suid; uint64_t suid;
int16_t cid; int16_t cid;
...@@ -250,17 +249,12 @@ typedef struct SMetaFltParam { ...@@ -250,17 +249,12 @@ typedef struct SMetaFltParam {
int (*filterFunc)(void *a, void *b, int16_t type); int (*filterFunc)(void *a, void *b, int16_t type);
} SMetaFltParam; } SMetaFltParam;
typedef struct SStoreAPI { typedef struct SMetaDataFilterAPI {
int32_t (*metaFilterTableIds)(); int32_t (*metaFilterTableIds)(void *pVnode, SMetaFltParam *arg, SArray *pUids);
int32_t (*metaFilterCreateTime)(); int32_t (*metaFilterCreateTime)(void *pVnode, SMetaFltParam *arg, SArray *pUids);
int32_t (*metaFilterTableName)(); int32_t (*metaFilterTableName)(void *pVnode, SMetaFltParam *arg, SArray *pUids);
int32_t (*metaFilterTtl)(); int32_t (*metaFilterTtl)(void *pVnode, SMetaFltParam *arg, SArray *pUids);
} SStoreAPI; } SMetaDataFilterAPI;
//int32_t metaFilterTableIds(void *pMeta, SMetaFltParam *param, SArray *results);
//int32_t metaFilterCreateTime(void *pMeta, SMetaFltParam *parm, SArray *pUids);
//int32_t metaFilterTableName(void *pMeta, SMetaFltParam *param, SArray *pUids);
//int32_t metaFilterTtl(void *pMeta, SMetaFltParam *param, SArray *pUids);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -16,4 +16,5 @@ target_link_libraries( ...@@ -16,4 +16,5 @@ target_link_libraries(
PRIVATE executor PRIVATE executor
PRIVATE tdb PRIVATE tdb
PRIVATE wal PRIVATE wal
PRIVATE index
) )
\ No newline at end of file
...@@ -15,4 +15,5 @@ target_link_libraries( ...@@ -15,4 +15,5 @@ target_link_libraries(
PRIVATE qcom PRIVATE qcom
PRIVATE stream PRIVATE stream
PRIVATE wal PRIVATE wal
PRIVATE index
) )
...@@ -151,11 +151,6 @@ int32_t metaGetStbStats(void *pVnode, int64_t uid, int64_t *numOfTables); ...@@ -151,11 +151,6 @@ int32_t metaGetStbStats(void *pVnode, int64_t uid, int64_t *numOfTables);
// //
//} SMetaFltParam; //} SMetaFltParam;
// TODO, refactor later
//int32_t metaFilterTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *results);
//int32_t metaFilterCreateTime(SMeta *pMeta, SMetaFltParam *parm, SArray *pUids);
//int32_t metaFilterTableName(SMeta *pMeta, SMetaFltParam *param, SArray *pUids);
//int32_t metaFilterTtl(SMeta *pMeta, SMetaFltParam *param, SArray *pUids);
#if 1 // refact APIs below (TODO) #if 1 // refact APIs below (TODO)
typedef SVCreateTbReq STbCfg; typedef SVCreateTbReq STbCfg;
......
...@@ -162,6 +162,12 @@ typedef struct { ...@@ -162,6 +162,12 @@ typedef struct {
int metaCreateTagIdxKey(tb_uid_t suid, int32_t cid, const void* pTagData, int32_t nTagData, int8_t type, tb_uid_t uid, int metaCreateTagIdxKey(tb_uid_t suid, int32_t cid, const void* pTagData, int32_t nTagData, int8_t type, tb_uid_t uid,
STagIdxKey** ppTagIdxKey, int32_t* nTagIdxKey); STagIdxKey** ppTagIdxKey, int32_t* nTagIdxKey);
// TODO, refactor later
int32_t metaFilterTableIds(void *pVnode, SMetaFltParam *param, SArray *results);
int32_t metaFilterCreateTime(void *pVnode, SMetaFltParam *parm, SArray *pUids);
int32_t metaFilterTableName(void *pVnode, SMetaFltParam *param, SArray *pUids);
int32_t metaFilterTtl(void *pVnode, SMetaFltParam *param, SArray *pUids);
#ifndef META_REFACT #ifndef META_REFACT
// SMetaDB // SMetaDB
int metaOpenDB(SMeta* pMeta); int metaOpenDB(SMeta* pMeta);
......
...@@ -1012,8 +1012,8 @@ typedef struct { ...@@ -1012,8 +1012,8 @@ typedef struct {
int32_t vLen; int32_t vLen;
} SIdxCursor; } SIdxCursor;
int32_t metaFilterCreateTime(void *meta, void *arg, SArray *pUids) { int32_t metaFilterCreateTime(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
SMeta *pMeta = meta; SMeta *pMeta = ((SVnode*)pVnode)->pMeta;
SMetaFltParam *param = arg; SMetaFltParam *param = arg;
int32_t ret = 0; int32_t ret = 0;
...@@ -1072,8 +1072,8 @@ END: ...@@ -1072,8 +1072,8 @@ END:
return ret; return ret;
} }
int32_t metaFilterTableName(void *meta, void *arg, SArray *pUids) { int32_t metaFilterTableName(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
SMeta *pMeta = meta; SMeta *pMeta = ((SVnode*)pVnode)->pMeta;
SMetaFltParam *param = arg; SMetaFltParam *param = arg;
int32_t ret = 0; int32_t ret = 0;
char *buf = NULL; char *buf = NULL;
...@@ -1139,8 +1139,8 @@ END: ...@@ -1139,8 +1139,8 @@ END:
return ret; return ret;
} }
int32_t metaFilterTtl(void *meta, void *arg, SArray *pUids) { int32_t metaFilterTtl(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
SMeta *pMeta = meta; SMeta *pMeta = ((SVnode*)pVnode)->pMeta;
SMetaFltParam *param = arg; SMetaFltParam *param = arg;
int32_t ret = 0; int32_t ret = 0;
char *buf = NULL; char *buf = NULL;
...@@ -1170,8 +1170,8 @@ END: ...@@ -1170,8 +1170,8 @@ END:
// impl later // impl later
return 0; return 0;
} }
int32_t metaFilterTableIds(void *meta, void *arg, SArray *pUids) { int32_t metaFilterTableIds(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
SMeta *pMeta = meta; SMeta *pMeta = ((SVnode*)pVnode)->pMeta;
SMetaFltParam *param = arg; SMetaFltParam *param = arg;
SMetaEntry oStbEntry = {0}; SMetaEntry oStbEntry = {0};
......
...@@ -16,12 +16,14 @@ ...@@ -16,12 +16,14 @@
#include "storageapi.h" #include "storageapi.h"
#include "vnodeInt.h" #include "vnodeInt.h"
#include "tstreamUpdate.h" #include "tstreamUpdate.h"
#include "meta.h"
static void initTsdbReaderAPI(TsdReader* pReader); static void initTsdbReaderAPI(TsdReader* pReader);
static void initMetadataAPI(SStoreMeta* pMeta); static void initMetadataAPI(SStoreMeta* pMeta);
static void initTqAPI(SStoreTqReader* pTq); static void initTqAPI(SStoreTqReader* pTq);
static void initStateStoreAPI(SStateStore* pStore); static void initStateStoreAPI(SStateStore* pStore);
static void initMetaReaderAPI(SStoreMetaReader* pMetaReader); static void initMetaReaderAPI(SStoreMetaReader* pMetaReader);
static void initMetaFilterAPI(SMetaDataFilterAPI* pFilter);
void initStorageAPI(SStorageAPI* pAPI) { void initStorageAPI(SStorageAPI* pAPI) {
initTsdbReaderAPI(&pAPI->tsdReader); initTsdbReaderAPI(&pAPI->tsdReader);
...@@ -29,6 +31,7 @@ void initStorageAPI(SStorageAPI* pAPI) { ...@@ -29,6 +31,7 @@ void initStorageAPI(SStorageAPI* pAPI) {
initTqAPI(&pAPI->tqReaderFn); initTqAPI(&pAPI->tqReaderFn);
initStateStoreAPI(&pAPI->stateStore); initStateStoreAPI(&pAPI->stateStore);
initMetaReaderAPI(&pAPI->metaReaderFn); initMetaReaderAPI(&pAPI->metaReaderFn);
initMetaFilterAPI(&pAPI->metaFilter);
} }
void initTsdbReaderAPI(TsdReader* pReader) { void initTsdbReaderAPI(TsdReader* pReader) {
...@@ -69,7 +72,6 @@ void initMetadataAPI(SStoreMeta* pMeta) { ...@@ -69,7 +72,6 @@ void initMetadataAPI(SStoreMeta* pMeta) {
pMeta->getInvertIndex = vnodeGetIvtIdx; pMeta->getInvertIndex = vnodeGetIvtIdx;
pMeta->extractTagVal = (const void *(*)(const void *, int16_t, STagVal *))metaGetTableTagVal; pMeta->extractTagVal = (const void *(*)(const void *, int16_t, STagVal *))metaGetTableTagVal;
} }
void initTqAPI(SStoreTqReader* pTq) { void initTqAPI(SStoreTqReader* pTq) {
...@@ -188,4 +190,11 @@ void initMetaReaderAPI(SStoreMetaReader* pMetaReader) { ...@@ -188,4 +190,11 @@ void initMetaReaderAPI(SStoreMetaReader* pMetaReader) {
pMetaReader->getTableEntryByName = metaGetTableEntryByName; pMetaReader->getTableEntryByName = metaGetTableEntryByName;
pMetaReader->readerReleaseLock = metaReaderReleaseLock; pMetaReader->readerReleaseLock = metaReaderReleaseLock;
}
void initMetaFilterAPI(SMetaDataFilterAPI* pFilter) {
pFilter->metaFilterCreateTime = metaFilterCreateTime;
pFilter->metaFilterTableIds = metaFilterTableIds;
pFilter->metaFilterTableName = metaFilterTableName;
pFilter->metaFilterTtl = metaFilterTtl;
} }
\ No newline at end of file
...@@ -39,8 +39,9 @@ typedef int32_t (*__sys_filte)(void* pMeta, SNode* cond, SArray* result); ...@@ -39,8 +39,9 @@ typedef int32_t (*__sys_filte)(void* pMeta, SNode* cond, SArray* result);
typedef int32_t (*__sys_check)(SNode* cond); typedef int32_t (*__sys_check)(SNode* cond);
typedef struct SSTabFltArg { typedef struct SSTabFltArg {
void* pMeta; void* pMeta;
void* pVnode; void* pVnode;
SStorageAPI* pAPI;
} SSTabFltArg; } SSTabFltArg;
typedef struct SSysTableIndex { typedef struct SSysTableIndex {
...@@ -153,11 +154,11 @@ static void relocateAndFilterSysTagsScanResult(SSysTableScanInfo* pInfo, int32_t ...@@ -153,11 +154,11 @@ static void relocateAndFilterSysTagsScanResult(SSysTableScanInfo* pInfo, int32_t
SFilterInfo* pFilterInfo); SFilterInfo* pFilterInfo);
int32_t sysFilte__DbName(void* arg, SNode* pNode, SArray* result) { int32_t sysFilte__DbName(void* arg, SNode* pNode, SArray* result) {
void* pVnode = ((SSTabFltArg*)arg)->pVnode; SSTabFltArg* pArg = arg;
void* pVnode = pArg->pVnode;
const char* db = NULL; const char* db = NULL;
ASSERT(0); pArg->pAPI->metaFn.getBasicInfo(pVnode, &db, NULL, NULL, NULL);
// pAPI->metaFn.getBasicInfo(pVnode, &db, NULL);
SName sn = {0}; SName sn = {0};
char dbname[TSDB_DB_FNAME_LEN + VARSTR_HEADER_SIZE] = {0}; char dbname[TSDB_DB_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
...@@ -181,11 +182,11 @@ int32_t sysFilte__DbName(void* arg, SNode* pNode, SArray* result) { ...@@ -181,11 +182,11 @@ int32_t sysFilte__DbName(void* arg, SNode* pNode, SArray* result) {
} }
int32_t sysFilte__VgroupId(void* arg, SNode* pNode, SArray* result) { int32_t sysFilte__VgroupId(void* arg, SNode* pNode, SArray* result) {
void* pVnode = ((SSTabFltArg*)arg)->pVnode; SSTabFltArg* pArg = arg;
void* pVnode = ((SSTabFltArg*)arg)->pVnode;
int64_t vgId = 0; int64_t vgId = 0;
ASSERT(0); pArg->pAPI->metaFn.getBasicInfo(pVnode, NULL, (int32_t*)&vgId, NULL, NULL);
// pAPI->metaFn.getBasicInfo(pVnode, NULL, (int32_t*)&vgId);
SOperatorNode* pOper = (SOperatorNode*)pNode; SOperatorNode* pOper = (SOperatorNode*)pNode;
SValueNode* pVal = (SValueNode*)pOper->pRight; SValueNode* pVal = (SValueNode*)pOper->pRight;
...@@ -202,7 +203,7 @@ int32_t sysFilte__VgroupId(void* arg, SNode* pNode, SArray* result) { ...@@ -202,7 +203,7 @@ int32_t sysFilte__VgroupId(void* arg, SNode* pNode, SArray* result) {
} }
int32_t sysFilte__TableName(void* arg, SNode* pNode, SArray* result) { int32_t sysFilte__TableName(void* arg, SNode* pNode, SArray* result) {
void* pMeta = ((SSTabFltArg*)arg)->pMeta; SSTabFltArg* pArg = arg;
SOperatorNode* pOper = (SOperatorNode*)pNode; SOperatorNode* pOper = (SOperatorNode*)pNode;
SValueNode* pVal = (SValueNode*)pOper->pRight; SValueNode* pVal = (SValueNode*)pOper->pRight;
...@@ -222,7 +223,8 @@ int32_t sysFilte__TableName(void* arg, SNode* pNode, SArray* result) { ...@@ -222,7 +223,8 @@ int32_t sysFilte__TableName(void* arg, SNode* pNode, SArray* result) {
} }
int32_t sysFilte__CreateTime(void* arg, SNode* pNode, SArray* result) { int32_t sysFilte__CreateTime(void* arg, SNode* pNode, SArray* result) {
void* pMeta = ((SSTabFltArg*)arg)->pMeta; SSTabFltArg* pArg = arg;
SStorageAPI* pAPI = pArg->pAPI;
SOperatorNode* pOper = (SOperatorNode*)pNode; SOperatorNode* pOper = (SOperatorNode*)pNode;
SValueNode* pVal = (SValueNode*)pOper->pRight; SValueNode* pVal = (SValueNode*)pOper->pRight;
...@@ -239,10 +241,8 @@ int32_t sysFilte__CreateTime(void* arg, SNode* pNode, SArray* result) { ...@@ -239,10 +241,8 @@ int32_t sysFilte__CreateTime(void* arg, SNode* pNode, SArray* result) {
.equal = equal, .equal = equal,
.filterFunc = func}; .filterFunc = func};
ASSERT(0); int32_t ret = pAPI->metaFilter.metaFilterCreateTime(pArg->pVnode, &param, result);
return 0; return ret;
// int32_t ret = metaFilterCreateTime(pMeta, &param, result);
// return ret;
} }
int32_t sysFilte__Ncolumn(void* arg, SNode* pNode, SArray* result) { int32_t sysFilte__Ncolumn(void* arg, SNode* pNode, SArray* result) {
......
...@@ -67,9 +67,8 @@ typedef union { ...@@ -67,9 +67,8 @@ typedef union {
typedef struct SIFParam { typedef struct SIFParam {
SHashObj *pFilter; SHashObj *pFilter;
SArray *result;
SArray *result; char *condValue;
char *condValue;
SIdxFltStatus status; SIdxFltStatus status;
uint8_t colValType; uint8_t colValType;
...@@ -79,7 +78,7 @@ typedef struct SIFParam { ...@@ -79,7 +78,7 @@ typedef struct SIFParam {
char colName[TSDB_COL_NAME_LEN * 2 + 4]; char colName[TSDB_COL_NAME_LEN * 2 + 4];
SIndexMetaArg arg; SIndexMetaArg arg;
SStoreAPI api; SMetaDataFilterAPI api;
} SIFParam; } SIFParam;
typedef struct SIFCtx { typedef struct SIFCtx {
......
...@@ -9,11 +9,11 @@ target_include_directories( ...@@ -9,11 +9,11 @@ target_include_directories(
IF (TD_GRANT) IF (TD_GRANT)
TARGET_LINK_LIBRARIES(qworker TARGET_LINK_LIBRARIES(qworker
PRIVATE os util transport nodes planner qcom executor grant PRIVATE os util transport nodes planner qcom executor index grant
) )
ELSE () ELSE ()
TARGET_LINK_LIBRARIES(qworker TARGET_LINK_LIBRARIES(qworker
PRIVATE os util transport nodes planner qcom executor PRIVATE os util transport nodes planner qcom executor index
) )
ENDIF() ENDIF()
......
...@@ -9,7 +9,7 @@ target_include_directories( ...@@ -9,7 +9,7 @@ target_include_directories(
target_link_libraries( target_link_libraries(
scheduler scheduler
PUBLIC os util nodes planner qcom common catalog transport command qworker executor PUBLIC os util nodes planner qcom common catalog transport command qworker executor index
) )
if(${BUILD_TEST}) if(${BUILD_TEST})
......
...@@ -10,7 +10,7 @@ if(${BUILD_WITH_ROCKSDB}) ...@@ -10,7 +10,7 @@ if(${BUILD_WITH_ROCKSDB})
target_link_libraries( target_link_libraries(
stream stream
PUBLIC rocksdb tdb PUBLIC rocksdb tdb
PRIVATE os util transport qcom executor wal PRIVATE os util transport qcom executor wal index
) )
target_include_directories( target_include_directories(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册