Skip to content

Commit 3f1e6cf

Browse files
author
Arseny Kositsyn
committed
[PGPRO-12159] Minor fixes.
Tags: rum
1 parent 7049189 commit 3f1e6cf

File tree

1 file changed

+38
-60
lines changed

1 file changed

+38
-60
lines changed

src/rum_debug_funcs.c

Lines changed: 38 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,7 @@ get_rel_from_name(text *relName)
334334
}
335335

336336
/*
337-
* This function is used to get
338-
* a copy of the relation page.
337+
* Get a copy of the relation page.
339338
*/
340339
static Page
341340
get_rel_page(Relation rel, BlockNumber blkNo)
@@ -625,29 +624,22 @@ get_entry_index_tuple_values(RumPageItemsState piState)
625624
RumState *rumState = piState->rumState;
626625

627626
/* Scanning the IndexTuple */
628-
piState->curKeyAttnum =
629-
rumtuple_get_attrnum(rumState,
630-
piState->curItup);
627+
piState->curKeyAttnum = rumtuple_get_attrnum(rumState, piState->curItup);
631628

632-
piState->curKey =
633-
rumtuple_get_key(rumState,
634-
piState->curItup,
635-
&(piState->curKeyCategory));
629+
piState->curKey = rumtuple_get_key(rumState,
630+
piState->curItup,
631+
&(piState->curKeyCategory));
636632

637-
piState->curKeyOid =
638-
get_cur_tuple_key_oid(piState);
633+
piState->curKeyOid = get_cur_tuple_key_oid(piState);
639634

640635
if (piState->pageType == INTERNAL_ENTRY_PAGE)
641-
piState->curTupleDownLink =
642-
RumGetDownlink(piState->curItup);
636+
piState->curTupleDownLink = RumGetDownlink(piState->curItup);
643637

644638
if (piState->pageType == LEAF_ENTRY_PAGE &&
645639
RumGetAddInfoAttr(piState))
646640
{
647-
(piState)->curKeyAddInfoOid =
648-
RumGetAddInfoAttr(piState)->atttypid;
649-
(piState)->curKeyAddInfoByval =
650-
RumGetAddInfoAttr(piState)->attbyval;
641+
(piState)->curKeyAddInfoOid = RumGetAddInfoAttr(piState)->atttypid;
642+
(piState)->curKeyAddInfoByval = RumGetAddInfoAttr(piState)->attbyval;
651643
}
652644
}
653645

@@ -666,21 +658,18 @@ write_res_cur_tuple_key_to_values(RumPageItemsState piState)
666658
int counter = 0;
667659

668660
if (piState->curKeyCategory == RUM_CAT_NORM_KEY)
669-
piState->values[counter++] =
670-
get_datum_text_by_oid(piState->curKey,
671-
piState->curKeyOid);
661+
piState->values[counter++] = get_datum_text_by_oid(piState->curKey,
662+
piState->curKeyOid);
672663
else
673664
piState->nulls[counter++] = true;
674665

675-
piState->values[counter++] =
676-
UInt16GetDatum(piState->curKeyAttnum);
666+
piState->values[counter++] = UInt16GetDatum(piState->curKeyAttnum);
677667

678668
piState->values[counter++] =
679669
category_get_datum_text(piState->curKeyCategory);
680670

681671
if (piState->pageType == INTERNAL_ENTRY_PAGE)
682-
piState->values[counter] =
683-
UInt32GetDatum(piState->curTupleDownLink);
672+
piState->values[counter] = UInt32GetDatum(piState->curTupleDownLink);
684673
}
685674

686675
/*
@@ -891,21 +880,15 @@ find_min_entry_leaf_page(RumPageItemsState piState)
891880
}
892881

893882
/*
894-
* In the case of scanning a posting tree page, we
895-
* do not know the key for which this posting tree
896-
* was built (as well as the key attribute number).
897-
* This function finds the attribute number of the
898-
* key for which the posting tree was built.
883+
* When scanning a posting tree page, the key used to build the posting tree and
884+
* the corresponding attribute number are not known. This function determines
885+
* the attribute number of the key for which the posting tree was built.
899886
*
900-
* First, the function descends to the leftmost
901-
* leaf page of the entry tree, after which it
902-
* searches for links to the posting tree there and
903-
* searches in each posting tree for the number of
904-
* the page we are scanning. If the page you are
905-
* looking for is found, then you need to return
906-
* the key attribute number that was contained in
907-
* the IndexTuple along with the link to the posting
908-
* tree. If nothing is found, the function returns
887+
* First, the function descends to the leftmost leaf page of the entry tree,
888+
* then searches for links to the posting tree there. In each posting tree,
889+
* it searches for the page number being scanned. If the desired page is found,
890+
* it returns the key attribute number contained in the IndexTuple, along with
891+
* a reference to the posting tree. If nothing is found, the function returns
909892
* InvalidOffsetNumber.
910893
*/
911894
static OffsetNumber
@@ -1034,8 +1017,7 @@ prepare_scan(text *relName, uint32 blkNo,
10341017
* page we are scanning in the posting tree, while remembering which
10351018
* key this posting tree was built for.
10361019
*/
1037-
(*piState)->curKeyAttnum =
1038-
find_attnum_posting_tree_key(*piState);
1020+
(*piState)->curKeyAttnum = find_attnum_posting_tree_key(*piState);
10391021

10401022
/* Error handling find_attnum_posting_tree_key() */
10411023
if ((*piState)->curKeyAttnum == InvalidOffsetNumber)
@@ -1160,9 +1142,7 @@ data_page_get_next_result(RumPageItemsState piState)
11601142
* key */
11611143
{
11621144
if (piState->curKeyAddInfoByval == false)
1163-
piState->values[counter] =
1164-
CStringGetTextDatum(VARLENA_MSG);
1165-
1145+
piState->values[counter] = CStringGetTextDatum(VARLENA_MSG);
11661146
else
11671147
RumWriteResAddInfoToValues(piState, counter);
11681148
}
@@ -1204,8 +1184,7 @@ entry_internal_page_get_next_result(RumPageItemsState piState)
12041184
piState->values[0] = CStringGetTextDatum("+inf");
12051185
piState->nulls[1] = true;
12061186
piState->nulls[2] = true;
1207-
piState->values[3] =
1208-
UInt32GetDatum(piState->curTupleDownLink);
1187+
piState->values[3] = UInt32GetDatum(piState->curTupleDownLink);
12091188
}
12101189

12111190
/* Is not high key */
@@ -1220,10 +1199,10 @@ entry_internal_page_get_next_result(RumPageItemsState piState)
12201199
}
12211200

12221201
/*
1223-
* The Entry Tree leaf pages contain IndexTuples that contain
1202+
* The Entry Tree leaf pages contain IndexTuples containing
12241203
* the key and either a compressed posting list or a link to
12251204
* the root page of the Posting Tree. This function reads all
1226-
* the values from posting list and generates the result tuple.
1205+
* values from posting list and generates the result tuple.
12271206
*/
12281207
static void
12291208
get_entry_leaf_posting_list_result(RumPageItemsState piState)
@@ -1285,8 +1264,7 @@ prepare_new_entry_leaf_posting_list(RumPageItemsState piState)
12851264
Assert(piState->pageType == LEAF_ENTRY_PAGE);
12861265

12871266
/* Getting the posting list */
1288-
piState->itemPtr =
1289-
RumGetPosting(piState->curItup);
1267+
piState->itemPtr = RumGetPosting(piState->curItup);
12901268
piState->curTupleItemNum = 1;
12911269
piState->needNewTuple = false;
12921270
piState->curTupleNum++;
@@ -1299,10 +1277,10 @@ prepare_new_entry_leaf_posting_list(RumPageItemsState piState)
12991277
}
13001278

13011279
/*
1302-
* The Entry Tree leaf pages contain IndexTuples that contain
1280+
* The Entry Tree leaf pages contain IndexTuples containing
13031281
* the key and either a compressed posting list or a link to
13041282
* the root page of the Posting Tree. This function reads all
1305-
* the values from Posting Tree and generates the result tuple.
1283+
* values from Posting Tree and generates the result tuple.
13061284
*/
13071285
static void
13081286
get_entry_leaf_posting_tree_result(RumPageItemsState piState)
@@ -1563,11 +1541,11 @@ rum_page_opaque_info(PG_FUNCTION_ARGS)
15631541
}
15641542

15651543
/*
1566-
* The main universal function that is used to scan
1567-
* all types of pages (except for the meta page).
1568-
* There are four SQL wrappers made around this
1569-
* function, each of which scans a specific type
1570-
* of pages. pageType is used to select the type
1544+
* The main universal function used to scan all
1545+
* page types (except for the meta page). There
1546+
* are four SQL wrappers around this function,
1547+
* each of which scans a specific page type. The
1548+
* page_type argument is used to select the type
15711549
* of page to scan.
15721550
*/
15731551
Datum
@@ -1649,10 +1627,10 @@ rum_page_items_info(PG_FUNCTION_ARGS)
16491627
/*
16501628
* Go through the page.
16511629
*
1652-
* In the case of scanning a Posting Tree page, the counter is
1653-
* fctx->call_cntr, which is 0 on the first call. The first call is
1654-
* special because it returns the high key from the pages of the Posting
1655-
* Tree (the high key is not counted in maxoff).
1630+
* When scanning a Posting Tree page, the counter is fctx->call_cntr,
1631+
* which is 0 on the first call. The first call is special because it
1632+
* returns the high key from the pages of the Posting Tree (the high key
1633+
* is not counted in maxoff).
16561634
*
16571635
* On Entry tree pages, the high key is stored in the IndexTuple.
16581636
*/

0 commit comments

Comments
 (0)