refactor checkpoint
This commit is contained in:
parent
021859361f
commit
95cfc5eb46
|
@ -64,7 +64,7 @@ typedef struct {
|
||||||
SArray* pDel;
|
SArray* pDel;
|
||||||
int8_t update;
|
int8_t update;
|
||||||
|
|
||||||
SHashObj *pDbChkpTbl;
|
SHashObj* pDbChkpTbl;
|
||||||
|
|
||||||
TdThreadRwlock rwLock;
|
TdThreadRwlock rwLock;
|
||||||
} SBackendManager;
|
} SBackendManager;
|
||||||
|
@ -107,8 +107,6 @@ const char* compactFilteNameState(void* arg);
|
||||||
const char* compactFilteNameFill(void* arg);
|
const char* compactFilteNameFill(void* arg);
|
||||||
const char* compactFilteNameFunc(void* arg);
|
const char* compactFilteNameFunc(void* arg);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
unsigned char compactFilte(void* arg, int level, const char* key, size_t klen, const char* val, size_t vlen,
|
unsigned char compactFilte(void* arg, int level, const char* key, size_t klen, const char* val, size_t vlen,
|
||||||
char** newval, size_t* newvlen, unsigned char* value_changed);
|
char** newval, size_t* newvlen, unsigned char* value_changed);
|
||||||
rocksdb_compactionfilter_t* compactFilteFactoryCreateFilter(void* arg, rocksdb_compactionfiltercontext_t* ctx);
|
rocksdb_compactionfilter_t* compactFilteFactoryCreateFilter(void* arg, rocksdb_compactionfiltercontext_t* ctx);
|
||||||
|
@ -117,7 +115,6 @@ rocksdb_compactionfilter_t* compactFilteFactoryCreateFilterState(void* arg, rock
|
||||||
rocksdb_compactionfilter_t* compactFilteFactoryCreateFilterFunc(void* arg, rocksdb_compactionfiltercontext_t* ctx);
|
rocksdb_compactionfilter_t* compactFilteFactoryCreateFilterFunc(void* arg, rocksdb_compactionfiltercontext_t* ctx);
|
||||||
rocksdb_compactionfilter_t* compactFilteFactoryCreateFilterFill(void* arg, rocksdb_compactionfiltercontext_t* ctx);
|
rocksdb_compactionfilter_t* compactFilteFactoryCreateFilterFill(void* arg, rocksdb_compactionfiltercontext_t* ctx);
|
||||||
|
|
||||||
|
|
||||||
typedef int (*EncodeFunc)(void* key, char* buf);
|
typedef int (*EncodeFunc)(void* key, char* buf);
|
||||||
typedef int (*DecodeFunc)(void* key, char* buf);
|
typedef int (*DecodeFunc)(void* key, char* buf);
|
||||||
typedef int (*ToStringFunc)(void* key, char* buf);
|
typedef int (*ToStringFunc)(void* key, char* buf);
|
||||||
|
@ -129,7 +126,7 @@ typedef int32_t (*DecodeValueFunc)(void* value, int32_t vlen, int64_t* ttl, char
|
||||||
|
|
||||||
typedef rocksdb_compactionfilter_t* (*CreateFactoryFunc)(void* arg, rocksdb_compactionfiltercontext_t* ctx);
|
typedef rocksdb_compactionfilter_t* (*CreateFactoryFunc)(void* arg, rocksdb_compactionfiltercontext_t* ctx);
|
||||||
typedef const char* (*FactoryNameFunc)(void* arg);
|
typedef const char* (*FactoryNameFunc)(void* arg);
|
||||||
typedef void(*DestroyFactoryFunc)(void *arg);
|
typedef void (*DestroyFactoryFunc)(void* arg);
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const char* key;
|
const char* key;
|
||||||
int32_t len;
|
int32_t len;
|
||||||
|
@ -149,10 +146,9 @@ typedef struct {
|
||||||
|
|
||||||
} SCfInit;
|
} SCfInit;
|
||||||
|
|
||||||
|
void dbSetFilterFactory(rocksdb_options_t* opt, int32_t i, void* arg);
|
||||||
void dbSetFilterFactory(rocksdb_options_t* opt, int32_t i, void *arg);
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void *funcName;
|
void* funcName;
|
||||||
DestroyFactoryFunc destroy;
|
DestroyFactoryFunc destroy;
|
||||||
CreateFactoryFunc create;
|
CreateFactoryFunc create;
|
||||||
FactoryNameFunc factoryName;
|
FactoryNameFunc factoryName;
|
||||||
|
@ -205,32 +201,38 @@ void destroyFunc(void* arg);
|
||||||
int32_t encodeValueFunc(void* value, int32_t vlen, int64_t ttl, char** dest);
|
int32_t encodeValueFunc(void* value, int32_t vlen, int64_t ttl, char** dest);
|
||||||
int32_t decodeValueFunc(void* value, int32_t vlen, int64_t* ttl, char** dest);
|
int32_t decodeValueFunc(void* value, int32_t vlen, int64_t* ttl, char** dest);
|
||||||
|
|
||||||
|
|
||||||
static bool streamStateIterSeekAndValid(rocksdb_iterator_t* iter, char* buf, size_t len);
|
static bool streamStateIterSeekAndValid(rocksdb_iterator_t* iter, char* buf, size_t len);
|
||||||
static rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfName,
|
static rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfName,
|
||||||
rocksdb_snapshot_t** snapshot, rocksdb_readoptions_t** readOpt);
|
rocksdb_snapshot_t** snapshot, rocksdb_readoptions_t** readOpt);
|
||||||
|
|
||||||
SCfInit ginitDict[] = {
|
SCfInit ginitDict[] = {
|
||||||
{"default", 7, 0, defaultKeyComp, defaultKeyEncode, defaultKeyDecode, defaultKeyToString, compareDefaultName,
|
{"default", 7, 0, defaultKeyComp, defaultKeyEncode, defaultKeyDecode, defaultKeyToString, compareDefaultName,
|
||||||
destroyFunc, encodeValueFunc, decodeValueFunc, compactFilteFactoryCreateFilter, destroyCompactFilteFactory, compactFilteFactoryName},
|
destroyFunc, encodeValueFunc, decodeValueFunc, compactFilteFactoryCreateFilter, destroyCompactFilteFactory,
|
||||||
|
compactFilteFactoryName},
|
||||||
|
|
||||||
{"state", 5, 1, stateKeyDBComp, stateKeyEncode, stateKeyDecode, stateKeyToString, compareStateName, destroyFunc,
|
{"state", 5, 1, stateKeyDBComp, stateKeyEncode, stateKeyDecode, stateKeyToString, compareStateName, destroyFunc,
|
||||||
encodeValueFunc, decodeValueFunc,compactFilteFactoryCreateFilterState, destroyCompactFilteFactory, compactFilteFactoryNameState},
|
encodeValueFunc, decodeValueFunc, compactFilteFactoryCreateFilterState, destroyCompactFilteFactory,
|
||||||
|
compactFilteFactoryNameState},
|
||||||
|
|
||||||
{"fill", 4, 2, winKeyDBComp, winKeyEncode, winKeyDecode, winKeyToString, compareWinKeyName, destroyFunc,
|
{"fill", 4, 2, winKeyDBComp, winKeyEncode, winKeyDecode, winKeyToString, compareWinKeyName, destroyFunc,
|
||||||
encodeValueFunc, decodeValueFunc,compactFilteFactoryCreateFilterFill, destroyCompactFilteFactory,compactFilteFactoryNameFill},
|
encodeValueFunc, decodeValueFunc, compactFilteFactoryCreateFilterFill, destroyCompactFilteFactory,
|
||||||
|
compactFilteFactoryNameFill},
|
||||||
|
|
||||||
{"sess", 4, 3, stateSessionKeyDBComp, stateSessionKeyEncode, stateSessionKeyDecode, stateSessionKeyToString,
|
{"sess", 4, 3, stateSessionKeyDBComp, stateSessionKeyEncode, stateSessionKeyDecode, stateSessionKeyToString,
|
||||||
compareSessionKeyName, destroyFunc, encodeValueFunc, decodeValueFunc, compactFilteFactoryCreateFilterSess, destroyCompactFilteFactory,compactFilteFactoryNameSess},
|
compareSessionKeyName, destroyFunc, encodeValueFunc, decodeValueFunc, compactFilteFactoryCreateFilterSess,
|
||||||
|
destroyCompactFilteFactory, compactFilteFactoryNameSess},
|
||||||
|
|
||||||
{"func", 4, 4, tupleKeyDBComp, tupleKeyEncode, tupleKeyDecode, tupleKeyToString, compareFuncKeyName, destroyFunc,
|
{"func", 4, 4, tupleKeyDBComp, tupleKeyEncode, tupleKeyDecode, tupleKeyToString, compareFuncKeyName, destroyFunc,
|
||||||
encodeValueFunc, decodeValueFunc, compactFilteFactoryCreateFilterFunc, destroyCompactFilteFactory, compactFilteFactoryNameFunc},
|
encodeValueFunc, decodeValueFunc, compactFilteFactoryCreateFilterFunc, destroyCompactFilteFactory,
|
||||||
|
compactFilteFactoryNameFunc},
|
||||||
|
|
||||||
{"parname", 7, 5, parKeyDBComp, parKeyEncode, parKeyDecode, parKeyToString, compareParKeyName, destroyFunc,
|
{"parname", 7, 5, parKeyDBComp, parKeyEncode, parKeyDecode, parKeyToString, compareParKeyName, destroyFunc,
|
||||||
encodeValueFunc, decodeValueFunc,compactFilteFactoryCreateFilter, destroyCompactFilteFactory, compactFilteFactoryName},
|
encodeValueFunc, decodeValueFunc, compactFilteFactoryCreateFilter, destroyCompactFilteFactory,
|
||||||
|
compactFilteFactoryName},
|
||||||
|
|
||||||
{"partag", 6, 6, parKeyDBComp, parKeyEncode, parKeyDecode, parKeyToString, comparePartagKeyName, destroyFunc,
|
{"partag", 6, 6, parKeyDBComp, parKeyEncode, parKeyDecode, parKeyToString, comparePartagKeyName, destroyFunc,
|
||||||
encodeValueFunc, decodeValueFunc, compactFilteFactoryCreateFilter, destroyCompactFilteFactory, compactFilteFactoryName},
|
encodeValueFunc, decodeValueFunc, compactFilteFactoryCreateFilter, destroyCompactFilteFactory,
|
||||||
|
compactFilteFactoryName},
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* cfName[] = {"default", "state", "fill", "sess", "func", "parname", "partag"};
|
const char* cfName[] = {"default", "state", "fill", "sess", "func", "parname", "partag"};
|
||||||
|
@ -270,7 +272,7 @@ int32_t compareHashTable(SHashObj* p1, SHashObj* p2, SArray* add, SArray* del) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t dbChkpGetDelta(SDbChkp* p, int64_t chkpId, SArray *list) {
|
int32_t dbChkpGetDelta(SDbChkp* p, int64_t chkpId, SArray* list) {
|
||||||
taosThreadRwlockWrlock(&p->rwLock);
|
taosThreadRwlockWrlock(&p->rwLock);
|
||||||
|
|
||||||
p->preCkptId = p->curChkpId;
|
p->preCkptId = p->curChkpId;
|
||||||
|
@ -316,7 +318,6 @@ int32_t dbChkpGetDelta(SDbChkp* p, int64_t chkpId, SArray *list) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (p->init == 0) {
|
if (p->init == 0) {
|
||||||
|
|
||||||
void* pIter = taosHashIterate(p->pSstTbl[1 - p->idx], NULL);
|
void* pIter = taosHashIterate(p->pSstTbl[1 - p->idx], NULL);
|
||||||
while (pIter) {
|
while (pIter) {
|
||||||
size_t len;
|
size_t len;
|
||||||
|
@ -351,7 +352,6 @@ int32_t dbChkpGetDelta(SDbChkp* p, int64_t chkpId, SArray *list) {
|
||||||
p->curChkpId = chkpId;
|
p->curChkpId = chkpId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
taosHashClear(p->pSstTbl[p->idx]);
|
taosHashClear(p->pSstTbl[p->idx]);
|
||||||
p->idx = 1 - p->idx;
|
p->idx = 1 - p->idx;
|
||||||
|
|
||||||
|
@ -359,10 +359,9 @@ int32_t dbChkpGetDelta(SDbChkp* p, int64_t chkpId, SArray *list) {
|
||||||
taosThreadRwlockUnlock(&p->rwLock);
|
taosThreadRwlockUnlock(&p->rwLock);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
SDbChkp* dbChkpCreate(char* path, int64_t initChkpId) {
|
SDbChkp* dbChkpCreate(char* path, int64_t initChkpId) {
|
||||||
SDbChkp *p = taosMemoryCalloc(1, sizeof(SDbChkp));
|
SDbChkp* p = taosMemoryCalloc(1, sizeof(SDbChkp));
|
||||||
p->curChkpId = initChkpId;
|
p->curChkpId = initChkpId;
|
||||||
p->preCkptId = -1;
|
p->preCkptId = -1;
|
||||||
p->pSST = taosArrayInit(64, sizeof(void*));
|
p->pSST = taosArrayInit(64, sizeof(void*));
|
||||||
|
@ -379,7 +378,7 @@ SDbChkp* dbChkpCreate(char* path, int64_t initChkpId) {
|
||||||
p->update = 0;
|
p->update = 0;
|
||||||
taosThreadRwlockInit(&p->rwLock, NULL);
|
taosThreadRwlockInit(&p->rwLock, NULL);
|
||||||
|
|
||||||
SArray *list = NULL;
|
SArray* list = NULL;
|
||||||
int32_t code = dbChkpGetDelta(p, initChkpId, list);
|
int32_t code = dbChkpGetDelta(p, initChkpId, list);
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
|
@ -398,7 +397,6 @@ void dbChkpDestroy(SDbChkp* pChkp) {
|
||||||
|
|
||||||
taosMemoryFree(pChkp->pCurrent);
|
taosMemoryFree(pChkp->pCurrent);
|
||||||
taosMemoryFree(pChkp->pManifest);
|
taosMemoryFree(pChkp->pManifest);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t dbChkpInit(SDbChkp* p) {
|
int32_t dbChkpInit(SDbChkp* p) {
|
||||||
|
@ -487,7 +485,6 @@ _ERROR:
|
||||||
taosMemoryFree(srcDir);
|
taosMemoryFree(srcDir);
|
||||||
taosMemoryFree(dstDir);
|
taosMemoryFree(dstDir);
|
||||||
return code;
|
return code;
|
||||||
|
|
||||||
}
|
}
|
||||||
SBackendManager* bkdMgtCreate(char* path) {
|
SBackendManager* bkdMgtCreate(char* path) {
|
||||||
SBackendManager* p = taosMemoryCalloc(1, sizeof(SBackendManager));
|
SBackendManager* p = taosMemoryCalloc(1, sizeof(SBackendManager));
|
||||||
|
@ -498,9 +495,9 @@ SBackendManager* bkdMgtCreate(char* path) {
|
||||||
|
|
||||||
void bkdMgtDestroy(SBackendManager* bm) {
|
void bkdMgtDestroy(SBackendManager* bm) {
|
||||||
if (bm == NULL) return;
|
if (bm == NULL) return;
|
||||||
void *pIter = taosHashIterate(bm->pDbChkpTbl, NULL);
|
void* pIter = taosHashIterate(bm->pDbChkpTbl, NULL);
|
||||||
while (pIter) {
|
while (pIter) {
|
||||||
SDbChkp *pChkp = *(SDbChkp **)(pIter);
|
SDbChkp* pChkp = *(SDbChkp**)(pIter);
|
||||||
dbChkpDestroy(pChkp);
|
dbChkpDestroy(pChkp);
|
||||||
|
|
||||||
pIter = taosHashIterate(bm->pDbChkpTbl, pIter);
|
pIter = taosHashIterate(bm->pDbChkpTbl, pIter);
|
||||||
|
@ -510,26 +507,26 @@ void bkdMgtDestroy(SBackendManager* bm) {
|
||||||
|
|
||||||
taosMemoryFree(bm);
|
taosMemoryFree(bm);
|
||||||
}
|
}
|
||||||
int32_t bkdMgtGetDelta(SBackendManager* bm, char *taskId, int64_t chkpId, SArray* list) {
|
int32_t bkdMgtGetDelta(SBackendManager* bm, char* taskId, int64_t chkpId, SArray* list) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
taosThreadRwlockWrlock(&bm->rwLock);
|
taosThreadRwlockWrlock(&bm->rwLock);
|
||||||
|
|
||||||
SDbChkp *pChkp = taosHashGet(bm->pDbChkpTbl, taskId, strlen(taskId));
|
SDbChkp* pChkp = taosHashGet(bm->pDbChkpTbl, taskId, strlen(taskId));
|
||||||
code = dbChkpGetDelta(pChkp, chkpId, list);
|
code = dbChkpGetDelta(pChkp, chkpId, list);
|
||||||
|
|
||||||
taosThreadRwlockUnlock(&bm->rwLock);
|
taosThreadRwlockUnlock(&bm->rwLock);
|
||||||
return code ;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t bkdMgtAddChkp(SBackendManager *bm, char *task, char *path) {
|
int32_t bkdMgtAddChkp(SBackendManager* bm, char* task, char* path) {
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
|
|
||||||
taosThreadRwlockWrlock(&bm->rwLock);
|
taosThreadRwlockWrlock(&bm->rwLock);
|
||||||
SDbChkp **pp = taosHashGet(bm->pDbChkpTbl, task, strlen(task));
|
SDbChkp** pp = taosHashGet(bm->pDbChkpTbl, task, strlen(task));
|
||||||
if (pp == NULL) {
|
if (pp == NULL) {
|
||||||
SDbChkp *p = dbChkpCreate(path, 0);
|
SDbChkp* p = dbChkpCreate(path, 0);
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
taosHashPut(bm->pDbChkpTbl, task, strlen(task), &p, sizeof(void *));
|
taosHashPut(bm->pDbChkpTbl, task, strlen(task), &p, sizeof(void*));
|
||||||
code = 0;
|
code = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -541,20 +538,20 @@ int32_t bkdMgtAddChkp(SBackendManager *bm, char *task, char *path) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t bkdMgtDumpTo(SBackendManager* bm, char *taskId, char* dname) {
|
int32_t bkdMgtDumpTo(SBackendManager* bm, char* taskId, char* dname) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
taosThreadRwlockRdlock(&bm->rwLock);
|
taosThreadRwlockRdlock(&bm->rwLock);
|
||||||
|
|
||||||
SDbChkp *p = taosHashGet(bm->pDbChkpTbl, taskId, strlen(taskId));
|
SDbChkp* p = taosHashGet(bm->pDbChkpTbl, taskId, strlen(taskId));
|
||||||
code = dbChkpDumpTo(p, dname);
|
code = dbChkpDumpTo(p, dname);
|
||||||
|
|
||||||
taosThreadRwlockUnlock(&bm->rwLock);
|
taosThreadRwlockUnlock(&bm->rwLock);
|
||||||
return code;
|
return code;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dbSetFilterFactory(rocksdb_options_t* opt, int32_t i, void *arg) {
|
void dbSetFilterFactory(rocksdb_options_t* opt, int32_t i, void* arg) {
|
||||||
rocksdb_compactionfilterfactory_t *filterFactory = rocksdb_compactionfilterfactory_create(arg,ginitDict[i].destroyFilter, ginitDict[i].createFilter, ginitDict[i].funcName);
|
rocksdb_compactionfilterfactory_t* filterFactory = rocksdb_compactionfilterfactory_create(
|
||||||
|
arg, ginitDict[i].destroyFilter, ginitDict[i].createFilter, ginitDict[i].funcName);
|
||||||
rocksdb_options_set_compaction_filter_factory(opt, filterFactory);
|
rocksdb_options_set_compaction_filter_factory(opt, filterFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1357,7 +1354,6 @@ void destroyRocksdbCfInst(RocksdbCfInst* inst) {
|
||||||
// |key|-----value------|
|
// |key|-----value------|
|
||||||
// |key|ttl|len|userData|
|
// |key|ttl|len|userData|
|
||||||
|
|
||||||
|
|
||||||
int defaultKeyComp(void* state, const char* aBuf, size_t aLen, const char* bBuf, size_t bLen) {
|
int defaultKeyComp(void* state, const char* aBuf, size_t aLen, const char* bBuf, size_t bLen) {
|
||||||
int len = aLen < bLen ? aLen : bLen;
|
int len = aLen < bLen ? aLen : bLen;
|
||||||
int ret = memcmp(aBuf, bBuf, len);
|
int ret = memcmp(aBuf, bBuf, len);
|
||||||
|
@ -1777,7 +1773,6 @@ const char* compactFilteFactoryNameFunc(void* arg) {
|
||||||
return "stream_compact_filter_func";
|
return "stream_compact_filter_func";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void destroyCompactFilte(void* arg) { (void)arg; }
|
void destroyCompactFilte(void* arg) { (void)arg; }
|
||||||
unsigned char compactFilte(void* arg, int level, const char* key, size_t klen, const char* val, size_t vlen,
|
unsigned char compactFilte(void* arg, int level, const char* key, size_t klen, const char* val, size_t vlen,
|
||||||
char** newval, size_t* newvlen, unsigned char* value_changed) {
|
char** newval, size_t* newvlen, unsigned char* value_changed) {
|
||||||
|
@ -1793,31 +1788,30 @@ unsigned char compactFilteSess(void* arg, int level, const char* key, size_t kle
|
||||||
char** newval, size_t* newvlen, unsigned char* value_changed) {
|
char** newval, size_t* newvlen, unsigned char* value_changed) {
|
||||||
// not impl yet
|
// not impl yet
|
||||||
return 0;
|
return 0;
|
||||||
//return streamStateValueIsStale((char*)val) ? 1 : 0;
|
// return streamStateValueIsStale((char*)val) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char compactFilteState(void* arg, int level, const char* key, size_t klen, const char* val, size_t vlen,
|
unsigned char compactFilteState(void* arg, int level, const char* key, size_t klen, const char* val, size_t vlen,
|
||||||
char** newval, size_t* newvlen, unsigned char* value_changed) {
|
char** newval, size_t* newvlen, unsigned char* value_changed) {
|
||||||
// not impl yet
|
// not impl yet
|
||||||
return 0;
|
return 0;
|
||||||
//return streamStateValueIsStale((char*)val) ? 1 : 0;
|
// return streamStateValueIsStale((char*)val) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char compactFilteFill(void* arg, int level, const char* key, size_t klen, const char* val, size_t vlen,
|
unsigned char compactFilteFill(void* arg, int level, const char* key, size_t klen, const char* val, size_t vlen,
|
||||||
char** newval, size_t* newvlen, unsigned char* value_changed) {
|
char** newval, size_t* newvlen, unsigned char* value_changed) {
|
||||||
// not impl yet
|
// not impl yet
|
||||||
return 0;
|
return 0;
|
||||||
//return streamStateValueIsStale((char*)val) ? 1 : 0;
|
// return streamStateValueIsStale((char*)val) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char compactFilteFunc(void* arg, int level, const char* key, size_t klen, const char* val, size_t vlen,
|
unsigned char compactFilteFunc(void* arg, int level, const char* key, size_t klen, const char* val, size_t vlen,
|
||||||
char** newval, size_t* newvlen, unsigned char* value_changed) {
|
char** newval, size_t* newvlen, unsigned char* value_changed) {
|
||||||
// not impl yet
|
// not impl yet
|
||||||
return 0;
|
return 0;
|
||||||
//return streamStateValueIsStale((char*)val) ? 1 : 0;
|
// return streamStateValueIsStale((char*)val) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
rocksdb_compactionfilter_t* compactFilteFactoryCreateFilter(void* arg, rocksdb_compactionfiltercontext_t* ctx) {
|
rocksdb_compactionfilter_t* compactFilteFactoryCreateFilter(void* arg, rocksdb_compactionfiltercontext_t* ctx) {
|
||||||
SCompactFilteFactory* state = arg;
|
SCompactFilteFactory* state = arg;
|
||||||
rocksdb_compactionfilter_t* filter =
|
rocksdb_compactionfilter_t* filter =
|
||||||
|
@ -1849,8 +1843,6 @@ rocksdb_compactionfilter_t* compactFilteFactoryCreateFilterFunc(void* arg, rocks
|
||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int32_t taskDbOpenCfs(STaskDbWrapper* pTask, char* path, char** pCfNames, int32_t nCf) {
|
int32_t taskDbOpenCfs(STaskDbWrapper* pTask, char* path, char** pCfNames, int32_t nCf) {
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
char* err = NULL;
|
char* err = NULL;
|
||||||
|
@ -2096,18 +2088,16 @@ void taskDbDestroy(void* pBackend) {
|
||||||
rocksdb_env_destroy(wrapper->env);
|
rocksdb_env_destroy(wrapper->env);
|
||||||
rocksdb_cache_destroy(wrapper->cache);
|
rocksdb_cache_destroy(wrapper->cache);
|
||||||
|
|
||||||
|
|
||||||
taosMemoryFree(wrapper->pCf);
|
taosMemoryFree(wrapper->pCf);
|
||||||
|
|
||||||
for (int i = 0; i < nCf; i++) {
|
for (int i = 0; i < nCf; i++) {
|
||||||
rocksdb_options_t *opt = wrapper->pCfOpts[i];
|
rocksdb_options_t* opt = wrapper->pCfOpts[i];
|
||||||
rocksdb_comparator_t *compare = wrapper->pCompares[i];
|
rocksdb_comparator_t* compare = wrapper->pCompares[i];
|
||||||
rocksdb_block_based_table_options_t *tblOpt = wrapper->pCfParams[i].tableOpt;
|
rocksdb_block_based_table_options_t* tblOpt = wrapper->pCfParams[i].tableOpt;
|
||||||
|
|
||||||
rocksdb_options_destroy(opt);
|
rocksdb_options_destroy(opt);
|
||||||
rocksdb_comparator_destroy(compare);
|
rocksdb_comparator_destroy(compare);
|
||||||
rocksdb_block_based_options_destroy(tblOpt);
|
rocksdb_block_based_options_destroy(tblOpt);
|
||||||
|
|
||||||
}
|
}
|
||||||
taosMemoryFree(wrapper->pCompares);
|
taosMemoryFree(wrapper->pCompares);
|
||||||
taosMemoryFree(wrapper->pCfOpts);
|
taosMemoryFree(wrapper->pCfOpts);
|
||||||
|
@ -2553,7 +2543,8 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfKe
|
||||||
taosMemoryFree(err); \
|
taosMemoryFree(err); \
|
||||||
code = -1; \
|
code = -1; \
|
||||||
} else { \
|
} else { \
|
||||||
qTrace("streamState str:%s succ to write to %s, rowValLen:%d, ttlValLen:%d, %p", toString, funcname, vLen, ttlVLen, wrapper); \
|
qTrace("streamState str:%s succ to write to %s, rowValLen:%d, ttlValLen:%d, %p", toString, funcname, vLen, \
|
||||||
|
ttlVLen, wrapper); \
|
||||||
} \
|
} \
|
||||||
taosMemoryFree(ttlV); \
|
taosMemoryFree(ttlV); \
|
||||||
} while (0);
|
} while (0);
|
||||||
|
@ -2594,7 +2585,8 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfKe
|
||||||
funcname); \
|
funcname); \
|
||||||
code = -1; \
|
code = -1; \
|
||||||
} else { \
|
} else { \
|
||||||
qTrace("streamState str: %s succ to read from %s_%s, valLen:%d, %p", toString, wrapper->idstr, funcname, tlen, wrapper); \
|
qTrace("streamState str: %s succ to read from %s_%s, valLen:%d, %p", toString, wrapper->idstr, funcname, tlen, \
|
||||||
|
wrapper); \
|
||||||
} \
|
} \
|
||||||
taosMemoryFree(val); \
|
taosMemoryFree(val); \
|
||||||
if (vLen != NULL) *vLen = tlen; \
|
if (vLen != NULL) *vLen = tlen; \
|
||||||
|
|
Loading…
Reference in New Issue