gpdb icon indicating copy to clipboard operation
gpdb copied to clipboard

[WIP] Add a set of new hooks to support data encryption

Open Sasasu opened this issue 1 year ago • 2 comments
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)

Sasasu avatar Feb 29 '24 06:02 Sasasu

https://dev.ci.gpdb.pivotal.io/teams/main/pipelines/gpdb-dev-sasasu-rocky8

beeender avatar Feb 29 '24 06:02 beeender

rebase to head, no code change

Sasasu avatar Mar 07 '24 10:03 Sasasu