Skip to content

Commit

Permalink
Update appendonlyblockdirectory.c: imporve coding style.
Browse files Browse the repository at this point in the history
Completely remove code pattern unnatural for PostgreSQL kernel code style.
  • Loading branch information
reshke authored Dec 24, 2024
1 parent 589191e commit 82e2177
Showing 1 changed file with 32 additions and 36 deletions.
68 changes: 32 additions & 36 deletions src/backend/access/appendonly/appendonlyblockdirectory.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ AppendOnlyBlockDirectory_GetEntry(
&blockDirectory->minipages[columnGroupNo];
int entry_no = -1;
int tmpGroupNo;
MinipagePerColumnGroup *minipageInfo;

if (blkdirRel == NULL || blkdirIdx == NULL)
{
Expand Down Expand Up @@ -692,48 +693,43 @@ AppendOnlyBlockDirectory_GetEntry(

systable_endscan_ordered(idxScanDesc);
}


{
MinipagePerColumnGroup *minipageInfo;
minipageInfo = &blockDirectory->minipages[columnGroupNo];

minipageInfo = &blockDirectory->minipages[columnGroupNo];
/*
* Perform a binary search over the minipage to find the entry about
* the AO block.
*/
entry_no = find_minipage_entry(minipageInfo->minipage,
minipageInfo->numMinipageEntries,
rowNum);

/* If there are no entries, return false. */
if (entry_no == -1 && minipageInfo->numMinipageEntries == 0)
return false;

if (entry_no == -1)
{
/*
* Perform a binary search over the minipage to find the entry about
* the AO block.
* Since the last few blocks may not be logged in the block
* directory, we always use the last entry.
*
* FIXME: If we didn't find a suitable entry, why even use the last
* entry? Currently, as it stands we would most likely return
* true from this function. This will lead to us having to do a
* fetch of the tuple from the physical file in the layer above (see
* scanToFetchTuple()), where we would ultimately find the tuple
* missing. Would it be correct to set the directory entry here to
* be the last one (for caching purposes) and return false, in order
* to avoid this physical file read?
*/
entry_no = find_minipage_entry(minipageInfo->minipage,
minipageInfo->numMinipageEntries,
rowNum);

/* If there are no entries, return false. */
if (entry_no == -1 && minipageInfo->numMinipageEntries == 0)
return false;

if (entry_no == -1)
{
/*
* Since the last few blocks may not be logged in the block
* directory, we always use the last entry.
*
* FIXME: If we didn't find a suitable entry, why even use the last
* entry? Currently, as it stands we would most likely return
* true from this function. This will lead to us having to do a
* fetch of the tuple from the physical file in the layer above (see
* scanToFetchTuple()), where we would ultimately find the tuple
* missing. Would it be correct to set the directory entry here to
* be the last one (for caching purposes) and return false, in order
* to avoid this physical file read?
*/
entry_no = minipageInfo->numMinipageEntries - 1;
}
return set_directoryentry_range(blockDirectory,
columnGroupNo,
entry_no,
directoryEntry);
entry_no = minipageInfo->numMinipageEntries - 1;
}

return false;
return set_directoryentry_range(blockDirectory,
columnGroupNo,
entry_no,
directoryEntry);
}

/*
Expand Down

0 comments on commit 82e2177

Please sign in to comment.