refactor: do some internal refactor.
This commit is contained in:
parent
e45023f3e9
commit
124fb5fc50
|
@ -220,15 +220,10 @@ void taosArrayClear(SArray* pArray);
|
|||
*/
|
||||
void taosArrayClearEx(SArray* pArray, void (*fp)(void*));
|
||||
|
||||
/**
|
||||
* clear the array (remove all element)
|
||||
* @param pArray
|
||||
* @param fp
|
||||
*/
|
||||
void taosArrayClearP(SArray* pArray, FDelete fp);
|
||||
|
||||
void* taosArrayDestroy(SArray* pArray);
|
||||
|
||||
void taosArrayDestroyP(SArray* pArray, FDelete fp);
|
||||
|
||||
void taosArrayDestroyEx(SArray* pArray, FDelete fp);
|
||||
|
||||
/**
|
||||
|
@ -238,12 +233,6 @@ void taosArrayDestroyEx(SArray* pArray, FDelete fp);
|
|||
*/
|
||||
void taosArraySort(SArray* pArray, __compar_fn_t comparFn);
|
||||
|
||||
/**
|
||||
* sort string array
|
||||
* @param pArray
|
||||
*/
|
||||
void taosArraySortString(SArray* pArray, __compar_fn_t comparFn);
|
||||
|
||||
/**
|
||||
* search the array
|
||||
* @param pArray
|
||||
|
|
|
@ -538,7 +538,7 @@ static int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) {
|
|||
|
||||
int32_t code = -1;
|
||||
SArray *newSub = subscribe.topicNames;
|
||||
taosArraySortString(newSub, taosArrayCompareString);
|
||||
taosArraySort(newSub, taosArrayCompareString);
|
||||
taosArrayRemoveDuplicateP(newSub, taosArrayCompareString, taosMemoryFree);
|
||||
|
||||
int32_t newTopicNum = taosArrayGetSize(newSub);
|
||||
|
@ -850,7 +850,8 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer,
|
|||
|
||||
// add to current topic
|
||||
taosArrayPush(pOldConsumer->currentTopics, &addedTopic);
|
||||
taosArraySortString(pOldConsumer->currentTopics, taosArrayCompareString);
|
||||
taosArraySort(pOldConsumer->currentTopics, taosArrayCompareString);
|
||||
|
||||
// set status
|
||||
if (taosArrayGetSize(pOldConsumer->rebNewTopics) == 0 && taosArrayGetSize(pOldConsumer->rebRemovedTopics) == 0) {
|
||||
if (pOldConsumer->status == MQ_CONSUMER_STATUS__MODIFY ||
|
||||
|
|
|
@ -2543,6 +2543,7 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader*
|
|||
goto _err;
|
||||
}
|
||||
|
||||
// TODO: opt the perf of read del index
|
||||
code = tsdbReadDelIdx(pDelFReader, aDelIdx);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
taosArrayDestroy(aDelIdx);
|
||||
|
|
|
@ -44,6 +44,11 @@ static void windowSBfAdd(SUpdateInfo *pInfo, uint64_t count) {
|
|||
}
|
||||
}
|
||||
|
||||
static void clearItemHelper(void* p) {
|
||||
SScalableBf** pBf = p;
|
||||
tScalableBfDestroy(*pBf);
|
||||
}
|
||||
|
||||
static void windowSBfDelete(SUpdateInfo *pInfo, uint64_t count) {
|
||||
if (count < pInfo->numSBFs) {
|
||||
for (uint64_t i = 0; i < count; ++i) {
|
||||
|
@ -52,7 +57,7 @@ static void windowSBfDelete(SUpdateInfo *pInfo, uint64_t count) {
|
|||
taosArrayRemove(pInfo->pTsSBFs, 0);
|
||||
}
|
||||
} else {
|
||||
taosArrayClearP(pInfo->pTsSBFs, (FDelete)tScalableBfDestroy);
|
||||
taosArrayClearEx(pInfo->pTsSBFs, clearItemHelper);
|
||||
}
|
||||
pInfo->minTS += pInfo->interval * count;
|
||||
}
|
||||
|
|
|
@ -399,9 +399,7 @@ void taosArrayDestroyEx(SArray* pArray, FDelete fp) {
|
|||
}
|
||||
|
||||
void taosArraySort(SArray* pArray, __compar_fn_t compar) {
|
||||
assert(pArray != NULL);
|
||||
assert(compar != NULL);
|
||||
|
||||
ASSERT(pArray != NULL && compar != NULL);
|
||||
taosSort(pArray->pData, pArray->size, pArray->elemSize, compar);
|
||||
}
|
||||
|
||||
|
@ -417,11 +415,6 @@ int32_t taosArraySearchIdx(const SArray* pArray, const void* key, __compar_fn_t
|
|||
return item == NULL ? -1 : (int32_t)((char*)item - (char*)pArray->pData) / pArray->elemSize;
|
||||
}
|
||||
|
||||
void taosArraySortString(SArray* pArray, __compar_fn_t comparFn) {
|
||||
assert(pArray != NULL);
|
||||
taosSort(pArray->pData, pArray->size, pArray->elemSize, comparFn);
|
||||
}
|
||||
|
||||
static int32_t taosArrayPartition(SArray* pArray, int32_t i, int32_t j, __ext_compar_fn_t fn, const void* userData) {
|
||||
void* key = taosArrayGetP(pArray, i);
|
||||
while (i < j) {
|
||||
|
|
Loading…
Reference in New Issue