Extract hooks also into their non-WAL location
The TransactionManager is storing new versions of custom hooks always
into a new directory. This ensures we can isolate transactions reading
custom hooks from concurrent updates. This creates a problem if we want
the WAL logic to be safe to toggle off without losing data. If the hooks
are only written to the new location, they won't be used anymore if the
WAL logic is subsequently disabled. To make the WAL safe to toggle on and
off, this commit writes the custom hooks from the log also to their old
location in <repo>/custom_hooks
. This ensures that the hook updates
remain in place even if we have to disable the WAL after enabling it for
some time.
Part of #5058 (closed)