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