refactor code
This commit is contained in:
parent
04f3784696
commit
64edab6302
|
@ -1134,31 +1134,29 @@ int32_t streamStateDel_rocksdb(SStreamState* pState, const SWinKey* key) {
|
||||||
int32_t streamStateClear_rocksdb(SStreamState* pState) {
|
int32_t streamStateClear_rocksdb(SStreamState* pState) {
|
||||||
qDebug("streamStateClear_rocksdb");
|
qDebug("streamStateClear_rocksdb");
|
||||||
|
|
||||||
SStateKey sKey = {.key = {.ts = 0, .groupId = 0}, .opNum = pState->number};
|
|
||||||
SStateKey eKey = {.key = {.ts = INT64_MAX, .groupId = UINT64_MAX}, .opNum = pState->number};
|
|
||||||
char sKeyStr[128] = {0};
|
char sKeyStr[128] = {0};
|
||||||
char eKeyStr[128] = {0};
|
char eKeyStr[128] = {0};
|
||||||
|
SStateKey sKey = {.key = {.ts = 0, .groupId = 0}, .opNum = pState->number};
|
||||||
|
SStateKey eKey = {.key = {.ts = INT64_MAX, .groupId = UINT64_MAX}, .opNum = pState->number};
|
||||||
|
|
||||||
int sLen = stateKeyEncode(&sKey, sKeyStr);
|
int sLen = stateKeyEncode(&sKey, sKeyStr);
|
||||||
int eLen = stateKeyEncode(&eKey, eKeyStr);
|
int eLen = stateKeyEncode(&eKey, eKeyStr);
|
||||||
|
|
||||||
char toStringStart[128] = {0};
|
|
||||||
char toStringEnd[128] = {0};
|
|
||||||
if (qDebugFlag & DEBUG_TRACE) {
|
|
||||||
stateKeyToString(&sKey, toStringStart);
|
|
||||||
stateKeyToString(&eKey, toStringEnd);
|
|
||||||
}
|
|
||||||
|
|
||||||
char* err = NULL;
|
|
||||||
if (pState->pTdbState->pHandle[1] != NULL) {
|
if (pState->pTdbState->pHandle[1] != NULL) {
|
||||||
|
char* err = NULL;
|
||||||
rocksdb_delete_range_cf(pState->pTdbState->rocksdb, pState->pTdbState->writeOpts, pState->pTdbState->pHandle[1],
|
rocksdb_delete_range_cf(pState->pTdbState->rocksdb, pState->pTdbState->writeOpts, pState->pTdbState->pHandle[1],
|
||||||
sKeyStr, sLen, eKeyStr, eLen, &err);
|
sKeyStr, sLen, eKeyStr, eLen, &err);
|
||||||
}
|
if (err != NULL) {
|
||||||
// rocksdb_compact_range_cf(pState->pTdbState->rocksdb, pState->pTdbState->pHandle[0], sKeyStr, sLen, eKeyStr,
|
char toStringStart[128] = {0};
|
||||||
// eLen);
|
char toStringEnd[128] = {0};
|
||||||
if (err != NULL) {
|
stateKeyToString(&sKey, toStringStart);
|
||||||
qWarn("failed to delete range cf(state) start: %s, end:%s, reason:%s", toStringStart, toStringEnd, err);
|
stateKeyToString(&eKey, toStringEnd);
|
||||||
taosMemoryFree(err);
|
|
||||||
|
qWarn("failed to delete range cf(state) start: %s, end:%s, reason:%s", toStringStart, toStringEnd, err);
|
||||||
|
taosMemoryFree(err);
|
||||||
|
} else {
|
||||||
|
rocksdb_compact_range_cf(pState->pTdbState->rocksdb, pState->pTdbState->pHandle[1], sKeyStr, sLen, eKeyStr, eLen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue