gpdb
gpdb copied to clipboard
[WIP] Add a set of new hooks to support data encryption
trafficstars
This PR is adding some new hooks:
typedef void (*file_read_buffer_modify_hook_type)(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, char *buffer);
typedef char* (*file_write_buffer_modify_hook_type)(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, char *buffer);
typedef char* (*file_extend_buffer_modify_hook_type)(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, char *buffer);
typedef void (*ao_file_read_buffer_modify_hook_type)(File file, char *buffer, int actualLen, off_t offset);
typedef char* (*ao_file_write_buffer_modify_hook_type)(File file, char *buffer, int amount, off_t offset);
Extensions can use those hooks to modify the read/write buffer before writing to disk.
This PR also adds an example extension, data_encryption, to show how to use those hooks. This extension just inverts all user data bit by bit. The example extension has a test job, it will load the extension and run all pre-existing test cases. But some tests are not supported by design, like read/write file directly (ao_checksum) or not supported for now (pgbasebackup and pg_upgrade)
https://dev.ci.gpdb.pivotal.io/teams/main/pipelines/gpdb-dev-sasasu-rocky8
rebase to head, no code change