[PATCH] src/test/modules/dummy_index -- way to test reloptions from inside of access method

From: Nikolay Shaplov <dhyan(at)nataraj(dot)su>
To: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: [PATCH] src/test/modules/dummy_index -- way to test reloptions from inside of access method
Date: 2019-03-18 19:41:13
Message-ID: 17071942.m9zZutALE6@x200m
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi!

This patch introduce a dummy_index access method module, that does not do any
indexing at all, but allow to test reloptions from inside of access method
extension.

This patch is part of my bigger work on reloptions refactoring.

It came from
https://www.postgresql.org/message-id/20190220060832.GI15532%40paquier.xyz
thread where I suggested to add a "enum" reloption type, and we came to
conclusion that we need to test how this new option works for access method
created from extension (it does not work in the same way as in-core access
methods) . But we can't add this option to bloom index, so we need an index
extension that can be freely used for tests.

So I created src/test/modules/dummy_index, it does no real indexing, but it
has all types of reloptions that can be set (reloption_int, reloption_real,
reloption_bool, reloption_string and reloption_string2). It also has set of
boolean GUC variables that enables test output concerning certain reloption:
(do_test_reloption_int, do_test_reloption_real, do_test_reloption_bool and
do_test_reloption_string and do_test_reloption_string2) also set
do_test_reloptions to true to get any output at all.
Dummy index will print this output when index is created, and when record is
inserted (this needed to check if your ALTER TABLE did well)
Then you just use normal regression tests: turns on test output, sets some
reloption and check test output, that it properly reaches the access method
internals.

While writing this module I kept in mind the idea that this module can be also
used for other am-related tests, so I separated the code into two parts:
dummy_index.c has only code related to implementation of an empty access
method, and all code related to reloptions tests were stored into
direloptions.c. So in future somebody can add di[what_ever_he_wants].c whith
his own tests code, add necessary calls to dummy_index.c, create some GUC
variables, and has his own feature tested.

So I kindly ask you to review and commit this module, so I would be able to
continue my work on reloptions refactoring...

Thanks!

Attachment Content-Type Size
dummy_index_v1.diff text/x-patch 26.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2019-03-18 19:48:04 Re: Speed up transaction completion faster after many relations are accessed in a transaction
Previous Message Robert Haas 2019-03-18 19:35:39 Re: BUG #15641: Autoprewarm worker fails to start on Windows with huge pages in use Old PostgreSQL community/pgsql-bugs x