fix compact problem
This commit is contained in:
parent
ea5d925c50
commit
f523a96c2d
|
@ -1,27 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
|
||||||
*
|
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _TD_CACHE_H_
|
|
||||||
#define _TD_CACHE_H_
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /*_TD_CACHE_H_*/
|
|
|
@ -314,7 +314,7 @@ static bool tsdbCompactTableIsDropped(STsdbCompactor *pCompactor) {
|
||||||
SMetaInfo info;
|
SMetaInfo info;
|
||||||
|
|
||||||
if (pCompactor->pIter->rowInfo.uid == pCompactor->tbid.uid) return false;
|
if (pCompactor->pIter->rowInfo.uid == pCompactor->tbid.uid) return false;
|
||||||
if (metaGetInfo(pCompactor->pTsdb->pVnode->pMeta, pCompactor->tbid.uid, &info, NULL)) {
|
if (metaGetInfo(pCompactor->pTsdb->pVnode->pMeta, pCompactor->pIter->rowInfo.uid, &info, NULL)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1057,14 +1057,13 @@ _exit:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t tsdbBuildDeleteSkylineImpl(SArray *aSkyline, int32_t sidx, int32_t eidx, SArray *pSkyline) {
|
int32_t tsdbBuildDeleteSkylineImpl(SArray *aSkyline, int32_t sidx, int32_t eidx, SArray *pSkyline) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
SDelData *pDelData;
|
SDelData *pDelData;
|
||||||
int32_t midx;
|
int32_t midx;
|
||||||
|
|
||||||
taosArrayClear(pSkyline);
|
taosArrayClear(pSkyline);
|
||||||
if (sidx == eidx) {
|
if (sidx == eidx) {
|
||||||
TSDBKEY *pItem1 = taosArrayGet(aSkyline, sidx * 2);
|
TSDBKEY *pItem1 = taosArrayGet(aSkyline, sidx * 2);
|
||||||
TSDBKEY *pItem2 = taosArrayGet(aSkyline, sidx * 2 + 1);
|
TSDBKEY *pItem2 = taosArrayGet(aSkyline, sidx * 2 + 1);
|
||||||
taosArrayPush(pSkyline, &pItem1);
|
taosArrayPush(pSkyline, &pItem1);
|
||||||
|
@ -1097,14 +1096,13 @@ int32_t tsdbBuildDeleteSkylineImpl(SArray *aSkyline, int32_t sidx, int32_t eidx,
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t tsdbBuildDeleteSkyline(SArray *aDelData, int32_t sidx, int32_t eidx, SArray *aSkyline) {
|
int32_t tsdbBuildDeleteSkyline(SArray *aDelData, int32_t sidx, int32_t eidx, SArray *aSkyline) {
|
||||||
SDelData *pDelData;
|
SDelData *pDelData;
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
int32_t dataNum = eidx - sidx + 1;
|
int32_t dataNum = eidx - sidx + 1;
|
||||||
SArray *aTmpSkyline = taosArrayInit(dataNum * 2, sizeof(TSDBKEY));
|
SArray *aTmpSkyline = taosArrayInit(dataNum * 2, sizeof(TSDBKEY));
|
||||||
SArray *pSkyline = taosArrayInit(dataNum * 2, POINTER_BYTES);
|
SArray *pSkyline = taosArrayInit(dataNum * 2, POINTER_BYTES);
|
||||||
|
|
||||||
for (int32_t i = sidx; i <= eidx; ++i) {
|
for (int32_t i = sidx; i <= eidx; ++i) {
|
||||||
pDelData = (SDelData *)taosArrayGet(aDelData, i);
|
pDelData = (SDelData *)taosArrayGet(aDelData, i);
|
||||||
taosArrayPush(aTmpSkyline, &(TSDBKEY){.ts = pDelData->sKey, .version = pDelData->version});
|
taosArrayPush(aTmpSkyline, &(TSDBKEY){.ts = pDelData->sKey, .version = pDelData->version});
|
||||||
|
@ -1116,8 +1114,8 @@ int32_t tsdbBuildDeleteSkyline(SArray *aDelData, int32_t sidx, int32_t eidx, SAr
|
||||||
|
|
||||||
int32_t skylineNum = taosArrayGetSize(pSkyline);
|
int32_t skylineNum = taosArrayGetSize(pSkyline);
|
||||||
for (int32_t i = 0; i < skylineNum; ++i) {
|
for (int32_t i = 0; i < skylineNum; ++i) {
|
||||||
TSDBKEY *p = taosArrayGetP(pSkyline, i);
|
TSDBKEY *p = taosArrayGetP(pSkyline, i);
|
||||||
taosArrayPush(aSkyline, p);
|
taosArrayPush(aSkyline, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
_clear:
|
_clear:
|
||||||
|
@ -1394,7 +1392,7 @@ int32_t tBlockDataTryUpsertRow(SBlockData *pBlockData, TSDBROW *pRow, int64_t ui
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tBlockDataUpsertRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTSchema, int64_t uid) {
|
int32_t tBlockDataUpsertRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTSchema, int64_t uid) {
|
||||||
if (pBlockData->aTSKEY[pBlockData->nRow - 1] == TSDBROW_TS(pRow)) {
|
if (pBlockData->nRow > 0 && pBlockData->aTSKEY[pBlockData->nRow - 1] == TSDBROW_TS(pRow)) {
|
||||||
return tBlockDataUpdateRow(pBlockData, pRow, pTSchema);
|
return tBlockDataUpdateRow(pBlockData, pRow, pTSchema);
|
||||||
} else {
|
} else {
|
||||||
return tBlockDataAppendRow(pBlockData, pRow, pTSchema, uid);
|
return tBlockDataAppendRow(pBlockData, pRow, pTSchema, uid);
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
add_subdirectory(tdb)
|
add_subdirectory(tdb)
|
||||||
add_subdirectory(cache)
|
|
||||||
add_subdirectory(transport)
|
add_subdirectory(transport)
|
||||||
add_subdirectory(wal)
|
add_subdirectory(wal)
|
||||||
add_subdirectory(monitor)
|
add_subdirectory(monitor)
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
aux_source_directory(src CACHE_SRC)
|
|
||||||
add_library(cache STATIC ${CACHE_SRC})
|
|
||||||
target_include_directories(
|
|
||||||
cache
|
|
||||||
PUBLIC "${TD_SOURCE_DIR}/include/libs/cache"
|
|
||||||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
|
|
||||||
)
|
|
|
@ -1,27 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
|
||||||
*
|
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _TD_CACHE_DEF_H_
|
|
||||||
#define _TD_CACHE_DEF_H_
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /*_TD_CACHE_DEF_H_*/
|
|
|
@ -1,14 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
|
||||||
*
|
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
Loading…
Reference in New Issue