Skip to content

Utilize physical logging for custom hook changes

Sami Hiltunen requested to merge smh-physical-log-custom-hooks into master

Custom hook operations are currently logged by including the TAR that contains them in the log entry's manifest. This has some downsides:

  • The TAR of the hooks is loaded into memory in order to write encode it as part of the log entry's manifest.
  • Applying the log entry requirs more complex logic by untarring the hooks to the correct location and syncing them.

The first problem could also be addressed by instead loging the TAR as a file. It's conveniently handled by the same solution to the second problem.

This commit begins using the physical logging protocol for custom hooks. Instead of logging the TAR, we log the individual file system change that are to be done to apply the custom hooks. Those operations entail removing the existing custom hooks, and writing out the new ones the transaction introduced. The files of the custom hooks are included in the log entry as is.

The post-image of the hooks is recorded from the transaction's snapshot. The RPC handler running in the transaction would extract the hoosk to the disk. We then read the extracted directory and write out a log entry that takes the files from the directory and creates the exact same directory structure on the receiving node.

Before we can write out the new hooks, we have to remove the old ones. As the transaction's snapshot no longer includes them, we currently read the existing structure from the target repository and stage it for before the new hooks are written out. This can be later improved by integrating the removal recording in the RPC handlers or by keeping a pre-image snapshot in the transaction.

Part of #5793 (closed)
Closes #5842 (closed)

Edited by Sami Hiltunen

Merge request reports