Skip to content

Commit

Permalink
add more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
haolinw committed Dec 19, 2024
1 parent 4c3365f commit 98abe5f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions source/dnode/vnode/src/tsdb/tsdbCache.c
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,9 @@ static int32_t reallocVarDataVal(SValue *pValue) {
uint8_t *pVal = pValue->pData;
uint32_t nData = pValue->nData;
if (nData > 0) {
// [TODO]
tsdbInfo("reallocVarDataVal(): nData alloced %u", nData);

uint8_t *p = taosMemoryMalloc(nData);
if (!p) {
TAOS_RETURN(terrno);
Expand Down
6 changes: 4 additions & 2 deletions source/dnode/vnode/src/tsdb/tsdbCacheRead.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,10 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p
int32_t pkBufLen = (pReader->rowKey.numOfPKs > 0) ? pReader->pkColumn.bytes : 0;
uint32_t allocBufLen = pReader->pSchema->columns[slotId].bytes + pkBufLen;
if (allocBufLen < pColVal->colVal.value.nData) {
tsdbError("buffer overflow at row key:%" PRIu64 ", data length %u exceeded the allocated buffer size %u",
ts, pColVal->colVal.value.nData, allocBufLen);
tsdbError("buffer overflow at row key:%" PRIu64
", data length %u exceeded the allocated buffer size %u"
", pkBufLen = %d",
ts, pColVal->colVal.value.nData, allocBufLen, pkBufLen);
code = TSDB_CODE_OUT_OF_RANGE;
TSDB_CHECK_CODE(code, lino, _end);
}
Expand Down
10 changes: 10 additions & 0 deletions source/dnode/vnode/src/tsdb/tsdbUtil.c
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,11 @@ int32_t tsdbRowMergerAdd(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema)
code = tRealloc(&pTColVal->value.pData, pColVal->value.nData);
if (code) return code;

// [TODO]
if (pTColVal->value.nData < pColVal->value.nData) {
tsdbInfo("tsdbRowMergedAdd(1): nData changed from %u to %u", pTColVal->value.nData, pColVal->value.nData);
}

pTColVal->value.nData = pColVal->value.nData;
if (pTColVal->value.nData) {
memcpy(pTColVal->value.pData, pColVal->value.pData, pTColVal->value.nData);
Expand All @@ -837,6 +842,11 @@ int32_t tsdbRowMergerAdd(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema)
code = tRealloc(&tColVal->value.pData, pColVal->value.nData);
if (code) return code;

// [TODO]
if (tColVal->value.nData < pColVal->value.nData) {
tsdbInfo("tsdbRowMergedAdd(-1): nData changed from %u to %u", tColVal->value.nData, pColVal->value.nData);
}

tColVal->value.nData = pColVal->value.nData;
if (pColVal->value.nData) {
memcpy(tColVal->value.pData, pColVal->value.pData, pColVal->value.nData);
Expand Down

0 comments on commit 98abe5f

Please sign in to comment.