Skip to content

Commit

Permalink
Remove unnecessary variable (#240)
Browse files Browse the repository at this point in the history
The found variable in ColumnarAddCacheEntry() is only used in the
if-else-branch.  It is true in if-branch, and false in the else-branch,
since the dlist_push_tail() is always executed in the else-branch, the
found variable is unnecessary.
  • Loading branch information
japinli authored Feb 21, 2024
1 parent a935675 commit 43f1ce5
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions columnar/src/backend/columnar/columnar_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,9 @@ ColumnarAddCacheEntry(uint64 relId, uint64 stripeId, uint64 chunkId,
}

ColumnarCacheEntry *entry = ColumnarFindInCache(relId, stripeId, chunkId, columnId);
bool found = false;

if (entry != NULL)
{
found = true;

/* Free up any existing stored data, everything else will be overwritten. */
StringInfo str = entry->store;
if (str->data)
Expand All @@ -347,11 +344,8 @@ ColumnarAddCacheEntry(uint64 relId, uint64 stripeId, uint64 chunkId,
entry->creationTime = entry->lastAccessTime = time(NULL);
entry->readCount = 0;

/* Add the entry into the list if it is not already there. */
if (!found)
{
dlist_push_tail(head, &(entry->list_node));
}
/* Add the entry into the list. */
dlist_push_tail(head, &(entry->list_node));
}

uint64 size = ((StringInfo) data)->len;
Expand Down

0 comments on commit 43f1ce5

Please sign in to comment.