提交 cbae4594 编写于 作者: X xywang

[TS-1318]<fix>: fixed a coredump bug

上级 10dc27b1
...@@ -172,10 +172,10 @@ int tsdbSetReadTable(SReadH *pReadh, STable *pTable) { ...@@ -172,10 +172,10 @@ int tsdbSetReadTable(SReadH *pReadh, STable *pTable) {
size_t size = taosArrayGetSize(pReadh->aBlkIdx); size_t size = taosArrayGetSize(pReadh->aBlkIdx);
if (size > 0) { if (size > 0) {
size_t left = 0, right = size - 1; int64_t left = 0, right = size - 1;
while (left <= right) { while (left <= right) {
pReadh->cidx = (int)((left + right) / 2); int64_t mid = (left + right) / 2;
SBlockIdx *pBlkIdx = taosArrayGet(pReadh->aBlkIdx, pReadh->cidx); SBlockIdx *pBlkIdx = taosArrayGet(pReadh->aBlkIdx, (size_t)mid);
if (pBlkIdx->tid == TABLE_TID(pTable)) { if (pBlkIdx->tid == TABLE_TID(pTable)) {
if (pBlkIdx->uid == TABLE_UID(pTable)) { if (pBlkIdx->uid == TABLE_UID(pTable)) {
pReadh->pBlkIdx = pBlkIdx; pReadh->pBlkIdx = pBlkIdx;
...@@ -185,9 +185,9 @@ int tsdbSetReadTable(SReadH *pReadh, STable *pTable) { ...@@ -185,9 +185,9 @@ int tsdbSetReadTable(SReadH *pReadh, STable *pTable) {
break; break;
} else if (pBlkIdx->tid < TABLE_TID(pTable)) { } else if (pBlkIdx->tid < TABLE_TID(pTable)) {
left = pReadh->cidx + 1; left = mid + 1;
} else { } else {
right = pReadh->cidx - 1; right = mid - 1;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册