fix: leave some free space in log buffer during syncLogBufferInit
This commit is contained in:
parent
22d64b9c0b
commit
6729c130f8
|
@ -182,7 +182,8 @@ int32_t syncLogBufferInitWithoutLock(SSyncLogBuffer* pBuf, SSyncNode* pNode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool taken = false;
|
bool taken = false;
|
||||||
if (toIndex <= index + pBuf->size - 1) {
|
int emptySize = 5;
|
||||||
|
if (toIndex - index + 1 <= pBuf->size - emptySize) {
|
||||||
SSyncLogBufEntry tmp = {.pItem = pEntry, .prevLogIndex = -1, .prevLogTerm = -1};
|
SSyncLogBufEntry tmp = {.pItem = pEntry, .prevLogIndex = -1, .prevLogTerm = -1};
|
||||||
pBuf->entries[index % pBuf->size] = tmp;
|
pBuf->entries[index % pBuf->size] = tmp;
|
||||||
taken = true;
|
taken = true;
|
||||||
|
|
Loading…
Reference in New Issue