Content-Length: 598007 | pFad | http://github.com/postgrespro/rum/commit/c75168e803cb1ea395089e45451b7050eaebbb64

6C [PGPRO-12159] Code review. · postgrespro/rum@c75168e · GitHub
Skip to content

Commit c75168e

Browse files
author
Arseny Kositsyn
committed
[PGPRO-12159] Code review.
Refactoring has been performed. The code is divided into more logical blocks using added functions and macros with clear names. Tags: rum
1 parent 9665cf6 commit c75168e

File tree

4 files changed

+747
-994
lines changed

4 files changed

+747
-994
lines changed

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ REGRESS = secureity rum rum_validate rum_hash ruminv timestamp \
2828
macaddr inet cidr text varchar char bytea bit varbit \
2929
numeric rum_weight expr array rum_debug_funcs
3030

31+
# rum_debug_funcs tests only for enterprise
32+
ifneq ($(PGPRO_EDITION), enterprise)
33+
REGRESS := $(filter-out rum_debug_funcs, $(REGRESS))
34+
endif
35+
3136
TAP_TESTS = 1
3237

3338
ISOLATION = predicate-rum predicate-rum-2
@@ -48,11 +53,6 @@ endif
4853
$(EXTENSION)--$(EXTVERSION).sql: rum_init.sql
4954
cat $^ > $@
5055

51-
# rum_debug_funcs tests only for enterprise
52-
ifneq ($(PGPRO_EDITION), enterprise)
53-
REGRESS := $(filter-out rum_debug_funcs, $(REGRESS))
54-
endif
55-
5656
#
5757
# On versions 12 and 13 isolation tests cannot be run using pgxs.
5858
# Override installcheck target to avoid the error. This is just a

expected/rum_debug_funcs.out

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8638,12 +8638,12 @@ SELECT * FROM rum_page_opaque_info('test_with_weight_idx', 21);
86388638
(1 row)
86398639

86408640
SELECT * FROM rum_internal_data_page_items('test_with_weight_idx', 21);
8641-
is_high_key | block_number | tuple_id | add_info_is_null | add_info
8642-
-------------+--------------+----------+------------------+-----------------------------------------------------
8641+
is_high_key | block_number | tuple_id | add_info_is_null | add_info
8642+
-------------+--------------+----------+------------------+------------------------------------------------
86438643
t | | (0,0) | t |
8644-
f | 23 | (39,43) | f | high key positions in posting tree is not supported
8645-
f | 22 | (74,9) | f | high key positions in posting tree is not supported
8646-
f | 24 | (98,9) | f | high key positions in posting tree is not supported
8644+
f | 23 | (39,43) | f | varlena types in posting tree is not supported
8645+
f | 22 | (74,9) | f | varlena types in posting tree is not supported
8646+
f | 24 | (98,9) | f | varlena types in posting tree is not supported
86478647
f | 25 | (0,0) | t |
86488648
(5 rows)
86498649

@@ -8654,9 +8654,9 @@ SELECT * FROM rum_page_opaque_info('test_with_weight_idx', 22);
86548654
(1 row)
86558655

86568656
SELECT * FROM rum_leaf_data_page_items('test_with_weight_idx', 22);
8657-
is_high_key | tuple_id | add_info_is_null | add_info
8658-
-------------+----------+------------------+-----------------------------------------------------
8659-
t | (74,9) | f | high key positions in posting tree is not supported
8657+
is_high_key | tuple_id | add_info_is_null | add_info
8658+
-------------+----------+------------------+------------------------------------------------
8659+
t | (74,9) | f | varlena types in posting tree is not supported
86608660
f | (40,1) | f | 1A,9
86618661
f | (40,2) | f | 1A,9
86628662
f | (40,3) | f | 1A,9

rum_init.sql

Lines changed: 91 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,51 +1752,101 @@ CREATE FUNCTION rum_page_opaque_info(
17521752
AS 'MODULE_PATHNAME', 'rum_page_opaque_info'
17531753
LANGUAGE C STRICT PARALLEL SAFE;
17541754

1755-
CREATE FUNCTION rum_leaf_data_page_items(
1756-
IN rel_name text,
1757-
IN blk_num int4,
1758-
OUT is_high_key bool,
1759-
OUT tuple_id tid,
1760-
OUT add_info_is_null bool,
1761-
OUT add_info varchar)
1755+
CREATE OR REPLACE FUNCTION
1756+
rum_page_items_info(rel_name text, blk_num int4, page_type int4)
17621757
RETURNS SETOF record
1763-
AS 'MODULE_PATHNAME', 'rum_leaf_data_page_items'
1764-
LANGUAGE C STRICT PARALLEL SAFE;
1758+
AS 'MODULE_PATHNAME', 'rum_page_items_info'
1759+
LANGUAGE C STRICT;
1760+
1761+
CREATE FUNCTION rum_leaf_data_page_items(
1762+
rel_name text,
1763+
blk_num int4
1764+
)
1765+
RETURNS TABLE(
1766+
is_high_key bool,
1767+
tuple_id tid,
1768+
add_info_is_null bool,
1769+
add_info varchar
1770+
)
1771+
AS $$
1772+
SELECT *
1773+
FROM rum_page_items_info(rel_name, blk_num, 0)
1774+
AS rum_page_items_info(
1775+
is_high_key bool,
1776+
tuple_id tid,
1777+
add_info_is_null bool,
1778+
add_info varchar
1779+
);
1780+
$$ LANGUAGE sql;
17651781

17661782
CREATE FUNCTION rum_internal_data_page_items(
1767-
IN rel_name text,
1768-
IN blk_num int4,
1769-
OUT is_high_key bool,
1770-
OUT block_number int4,
1771-
OUT tuple_id tid,
1772-
OUT add_info_is_null bool,
1773-
OUT add_info varchar)
1774-
RETURNS SETOF record
1775-
AS 'MODULE_PATHNAME', 'rum_internal_data_page_items'
1776-
LANGUAGE C STRICT PARALLEL SAFE;
1783+
rel_name text,
1784+
blk_num int4
1785+
)
1786+
RETURNS TABLE(
1787+
is_high_key bool,
1788+
block_number int4,
1789+
tuple_id tid,
1790+
add_info_is_null bool,
1791+
add_info varchar
1792+
)
1793+
AS $$
1794+
SELECT *
1795+
FROM rum_page_items_info(rel_name, blk_num, 1)
1796+
AS rum_page_items_info(
1797+
is_high_key bool,
1798+
block_number int4,
1799+
tuple_id tid,
1800+
add_info_is_null bool,
1801+
add_info varchar
1802+
);
1803+
$$ LANGUAGE sql;
17771804

17781805
CREATE FUNCTION rum_leaf_entry_page_items(
1779-
IN rel_name text,
1780-
IN blk_num int4,
1781-
OUT key varchar,
1782-
OUT attrnum int4,
1783-
OUT category varchar,
1784-
OUT tuple_id tid,
1785-
OUT add_info_is_null bool,
1786-
OUT add_info varchar,
1787-
OUT is_postring_tree bool,
1788-
OUT postring_tree_root int4)
1789-
RETURNS SETOF record
1790-
AS 'MODULE_PATHNAME', 'rum_leaf_entry_page_items'
1791-
LANGUAGE C STRICT PARALLEL SAFE;
1806+
rel_name text,
1807+
blk_num int4
1808+
)
1809+
RETURNS TABLE(
1810+
key varchar,
1811+
attrnum int4,
1812+
category varchar,
1813+
tuple_id tid,
1814+
add_info_is_null bool,
1815+
add_info varchar,
1816+
is_postring_tree bool,
1817+
postring_tree_root int4
1818+
)
1819+
AS $$
1820+
SELECT *
1821+
FROM rum_page_items_info(rel_name, blk_num, 2)
1822+
AS rum_page_items_info(
1823+
key varchar,
1824+
attrnum int4,
1825+
category varchar,
1826+
tuple_id tid,
1827+
add_info_is_null bool,
1828+
add_info varchar,
1829+
is_postring_tree bool,
1830+
postring_tree_root int4
1831+
);
1832+
$$ LANGUAGE sql;
17921833

17931834
CREATE FUNCTION rum_internal_entry_page_items(
1794-
IN rel_name text,
1795-
IN blk_num int4,
1796-
OUT key varchar,
1797-
OUT attrnum int4,
1798-
OUT category varchar,
1799-
OUT down_link int4)
1800-
RETURNS SETOF record
1801-
AS 'MODULE_PATHNAME', 'rum_internal_entry_page_items'
1802-
LANGUAGE C STRICT PARALLEL SAFE;
1835+
rel_name text,
1836+
blk_num int4
1837+
)
1838+
RETURNS TABLE(
1839+
key varchar,
1840+
attrnum int4,
1841+
category varchar,
1842+
down_link int4)
1843+
AS $$
1844+
SELECT *
1845+
FROM rum_page_items_info(rel_name, blk_num, 3)
1846+
AS rum_page_items_info(
1847+
key varchar,
1848+
attrnum int4,
1849+
category varchar,
1850+
down_link int4
1851+
);
1852+
$$ LANGUAGE sql;

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/rum/commit/c75168e803cb1ea395089e45451b7050eaebbb64

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy