Extensible storage manager API - smgr hooks
От | Anastasia Lubennikova |
---|---|
Тема | Extensible storage manager API - smgr hooks |
Дата | |
Msg-id | CAP4vRV6JKXyFfEOf=n+v5RGsZywAQ3CTM8ESWvgq+S87Tmgx_g@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Extensible storage manager API - smgr hooks
|
Список | pgsql-hackers |
Hi, hackers!
Many recently discussed features can make use of an extensible storage manager API. Namely, storage level compression and encryption [1], [2], [3], disk quota feature [4], SLRU storage changes [5], and any other features that may want to substitute PostgreSQL storage layer with their implementation (i.e. lazy_restore [6]).
Attached is a proposal to change smgr API to make it extensible. The idea is to add a hook for plugins to get control in smgr and define custom storage managers. The patch replaces smgrsw[] array and smgr_sw selector with smgr() function that loads f_smgr implementation.
As before it has only one implementation - smgr_md, which is wrapped into smgr_standard().
To create custom implementation, a developer needs to implement smgr API functions
static const struct f_smgr smgr_custom =
{
.smgr_init = custominit,
...
}
create a hook function
and finally set the hook:
smgr_hook = smgr_custom;
static const struct f_smgr smgr_custom =
{
.smgr_init = custominit,
...
}
create a hook function
const f_smgr * smgr_custom(BackendId backend, RelFileNode rnode) { //Here we can also add some logic and chose which smgr to use based on rnode and backend return &smgr_custom; } |
and finally set the hook:
smgr_hook = smgr_custom;
[1] https://www.postgresql.org/message-id/flat/11996861554042351@iva4-dd95b404a60b.qloud-c.yandex.net
[2] https://www.postgresql.org/message-id/flat/272dd2d9.e52a.17235f2c050.Coremail.chjischj%40163.com
[2] https://www.postgresql.org/message-id/flat/272dd2d9.e52a.17235f2c050.Coremail.chjischj%40163.com
--
Best regards,
Lubennikova Anastasia
Вложения
В списке pgsql-hackers по дате отправления: