Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update appendonlyblockdirectory.c: imporve coding style. #811

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this square bracket?

/*
* 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
Loading