Merge pull request #23142 from taosdata/FIX/TS-4096-main

enh: reserve half a buffer size at syncLogBufferInit
This commit is contained in:
wade zhang 2023-10-08 16:00:38 +08:00 committed by GitHub
commit 8e0179b73e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -197,6 +197,7 @@ int32_t syncLogBufferInitWithoutLock(SSyncLogBuffer* pBuf, SSyncNode* pNode) {
SyncIndex index = toIndex;
SSyncRaftEntry* pEntry = NULL;
bool takeDummy = false;
int emptySize = (TSDB_SYNC_LOG_BUFFER_SIZE >> 1);
while (true) {
if (index <= pBuf->commitIndex) {
@ -210,7 +211,6 @@ int32_t syncLogBufferInitWithoutLock(SSyncLogBuffer* pBuf, SSyncNode* pNode) {
}
bool taken = false;
int emptySize = 5;
if (toIndex - index + 1 <= pBuf->size - emptySize) {
SSyncLogBufEntry tmp = {.pItem = pEntry, .prevLogIndex = -1, .prevLogTerm = -1};
pBuf->entries[index % pBuf->size] = tmp;