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  (Yura Sokolov <y.sokolov@postgrespro.ru>)
Список 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
   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;



--
Best regards,
Lubennikova Anastasia
Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: WIP: Relaxing the constraints on numeric scale
Следующее
От: Simon Riggs
Дата:
Сообщение: Fix PITR msg for Abort Prepared