more
This commit is contained in:
parent
4a4018a31f
commit
699c9572f5
|
@ -25,10 +25,11 @@ extern "C" {
|
|||
static FORCE_INLINE int32_t tRealloc(uint8_t **ppBuf, int64_t size) {
|
||||
int32_t code = 0;
|
||||
int64_t bsize = 0;
|
||||
uint8_t *pBuf;
|
||||
uint8_t *pBuf = NULL;
|
||||
|
||||
if (*ppBuf) {
|
||||
bsize = *(int64_t *)((*ppBuf) - sizeof(int64_t));
|
||||
pBuf = (*ppBuf) - sizeof(int64_t);
|
||||
bsize = *(int64_t *)pBuf;
|
||||
}
|
||||
|
||||
if (bsize >= size) goto _exit;
|
||||
|
@ -38,7 +39,7 @@ static FORCE_INLINE int32_t tRealloc(uint8_t **ppBuf, int64_t size) {
|
|||
bsize *= 2;
|
||||
}
|
||||
|
||||
pBuf = (uint8_t *)taosMemoryRealloc(*ppBuf ? (*ppBuf) - sizeof(int64_t) : *ppBuf, bsize + sizeof(int64_t));
|
||||
pBuf = (uint8_t *)taosMemoryRealloc(pBuf, bsize + sizeof(int64_t));
|
||||
if (pBuf == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _exit;
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
static int metaSaveJsonVarToIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSchema *pSchema);
|
||||
static int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSchema *pSchema);
|
||||
static int metaHandleEntry(SMeta *pMeta, const SMetaEntry *pME);
|
||||
static int metaSaveToTbDb(SMeta *pMeta, const SMetaEntry *pME);
|
||||
static int metaUpdateUidIdx(SMeta *pMeta, const SMetaEntry *pME);
|
||||
static int metaUpdateNameIdx(SMeta *pMeta, const SMetaEntry *pME);
|
||||
|
|
|
@ -394,6 +394,12 @@ _err:
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t tsdbSnapWriteTableData(STsdbSnapWriter* pWriter, uint8_t* pData, uint32_t nData) {
|
||||
int32_t code = 0;
|
||||
// TODO
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t tsdbSnapWriteData(STsdbSnapWriter* pWriter, uint8_t* pData, uint32_t nData) {
|
||||
int32_t code = 0;
|
||||
STsdb* pTsdb = pWriter->pTsdb;
|
||||
|
@ -440,47 +446,50 @@ static int32_t tsdbSnapWriteData(STsdbSnapWriter* pWriter, uint8_t* pData, uint3
|
|||
taosArrayClear(pWriter->aBlockIdxN);
|
||||
}
|
||||
|
||||
// process
|
||||
TABLEID id = {0}; // TODO
|
||||
TSKEY minKey = 0; // TODO
|
||||
TSKEY maxKey = 0; // TODO
|
||||
code = tsdbSnapWriteTableData(pWriter, pData, nData);
|
||||
if (code) goto _err;
|
||||
|
||||
while (true) {
|
||||
if (pWriter->pBlockIdx) {
|
||||
int32_t c = tTABLEIDCmprFn(&id, pWriter->pBlockIdx);
|
||||
// // process
|
||||
// TABLEID id = {0}; // TODO
|
||||
// TSKEY minKey = 0; // TODO
|
||||
// TSKEY maxKey = 0; // TODO
|
||||
|
||||
if (c == 0) {
|
||||
} else if (c < 0) {
|
||||
// keep merge
|
||||
} else {
|
||||
// code = tsdbSnapWriteTableDataEnd(pWriter);
|
||||
if (code) goto _err;
|
||||
// while (true) {
|
||||
// if (pWriter->pBlockIdx) {
|
||||
// int32_t c = tTABLEIDCmprFn(&id, pWriter->pBlockIdx);
|
||||
|
||||
pWriter->iBlockIdx++;
|
||||
if (pWriter->iBlockIdx < taosArrayGetSize(pWriter->aBlockIdx)) {
|
||||
pWriter->pBlockIdx = (SBlockIdx*)taosArrayGet(pWriter->aBlockIdx, pWriter->iBlockIdx);
|
||||
} else {
|
||||
pWriter->pBlockIdx = NULL;
|
||||
}
|
||||
// if (c == 0) {
|
||||
// } else if (c < 0) {
|
||||
// // keep merge
|
||||
// } else {
|
||||
// // code = tsdbSnapWriteTableDataEnd(pWriter);
|
||||
// if (code) goto _err;
|
||||
|
||||
if (pWriter->pBlockIdx) {
|
||||
code = tsdbReadBlock(pWriter->pDataFReader, pWriter->pBlockIdx, &pWriter->mBlock, NULL);
|
||||
if (code) goto _err;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int32_t c = tTABLEIDCmprFn(&id, &pWriter->blockIdx);
|
||||
// pWriter->iBlockIdx++;
|
||||
// if (pWriter->iBlockIdx < taosArrayGetSize(pWriter->aBlockIdx)) {
|
||||
// pWriter->pBlockIdx = (SBlockIdx*)taosArrayGet(pWriter->aBlockIdx, pWriter->iBlockIdx);
|
||||
// } else {
|
||||
// pWriter->pBlockIdx = NULL;
|
||||
// }
|
||||
|
||||
if (c == 0) {
|
||||
// merge commit the block data
|
||||
} else if (c > 0) {
|
||||
// code = tsdbSnapWriteTableDataEnd(pWriter);
|
||||
if (code) goto _err;
|
||||
} else {
|
||||
ASSERT(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (pWriter->pBlockIdx) {
|
||||
// code = tsdbReadBlock(pWriter->pDataFReader, pWriter->pBlockIdx, &pWriter->mBlock, NULL);
|
||||
// if (code) goto _err;
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// int32_t c = tTABLEIDCmprFn(&id, &pWriter->blockIdx);
|
||||
|
||||
// if (c == 0) {
|
||||
// // merge commit the block data
|
||||
// } else if (c > 0) {
|
||||
// // code = tsdbSnapWriteTableDataEnd(pWriter);
|
||||
// if (code) goto _err;
|
||||
// } else {
|
||||
// ASSERT(0);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
return code;
|
||||
|
||||
|
|
Loading…
Reference in New Issue