You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by re...@apache.org on 2025/01/20 09:19:15 UTC

(cloudberry) branch main updated: Update appendonlyblockdirectory.c: imporve coding style. (#811)

This is an automated email from the ASF dual-hosted git repository.

reshke pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git


The following commit(s) were added to refs/heads/main by this push:
     new 1b6f6f6ff8 Update appendonlyblockdirectory.c: imporve coding style. (#811)
1b6f6f6ff8 is described below

commit 1b6f6f6ff80b52482f326e2189567fc833336743
Author: reshke <re...@double.cloud>
AuthorDate: Mon Jan 20 14:19:11 2025 +0500

    Update appendonlyblockdirectory.c: imporve coding style. (#811)
    
    Completely remove code pattern unnatural for PostgreSQL kernel code style.
---
 .../access/appendonly/appendonlyblockdirectory.c   | 67 ++++++++++------------
 1 file changed, 31 insertions(+), 36 deletions(-)

diff --git a/src/backend/access/appendonly/appendonlyblockdirectory.c b/src/backend/access/appendonly/appendonlyblockdirectory.c
index b0d4876086..b6a9b17991 100644
--- a/src/backend/access/appendonly/appendonlyblockdirectory.c
+++ b/src/backend/access/appendonly/appendonlyblockdirectory.c
@@ -692,48 +692,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);
 }
 
 /*


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org