Hook scripts for automation and customization
Hook operations allow you to execute custom operations at select points during linking sources and managing virtual datasets. For example, you may want to prevent your monitoring systems from triggering during VDB startup and shutdown. In this case, you would leverage pre- and post-hooks to run required scripts for VDB start/stop operations.
Unix-based operating systems will execute hook scripts in bash, while Windows operating systems will execute using PowerShell.
Each Delphix object will have its own set of hooks you can create. To easily manage hooks across multiple datasets, you can create hook templates to apply the same hook to many objects.
Setting hook operations
You can construct hook operation lists through the Delphix Management application or the command-line interface (CLI). You can either define the hooks as part of the provisioning process or edit them on virtual datasets that already exist.
Hook operations can be created in the Hooks tab of the Add dSource or Add VDB wizards.
To edit hook operations on a dataset, navigate to the datasets page and find the object’s configuration. You will see a ‘Hooks’ tab where you can manage and modify hook operations.
Hook operation templates
You can use templates to store commonly used operations, which allows you to avoid repeated work when an operation is applicable to more than a single virtual dataset. You manage templates through the Delphix Management application.
Hook operations list
dSource hooks
Hook | Description |
---|---|
Pre sync | Pre Sync hook operations are executed before a Snapsync of a dSource. These operations can quiesce data to be captured during the Snapsync, or stop application processes that may interfere with the Snapsync operation. |
Post sync | Post Sync hook operations are executed after a Snapsync operation of a dSource. These operations can undo any changes made by the pre-sync hooks. They will run regardless of the success of pre-sync hook operations or the Snapsync itself. |
Virtual database hooks
Hook | Description |
---|---|
Configure clone | Operations performed after initial provision or after a refresh. This hook will run after the virtual dataset has been started. During a refresh, this hook will run before the Post Refresh hook. |
Pre refresh | Operations performed before a refresh. This hook will run before the virtual dataset has been stopped. These operations can cache data from the virtual dataset to be restored after the refresh completes. |
Post refresh | Operations performed after a refresh. This hook will run after the virtual dataset has been started and after the Configure Clone hook. This hook will not run if the refresh or Pre Refresh hook operations fail. These operations can restore cached data after the refresh completes. |
Pre rollback | Operations performed before a rollback, also known as rewind. This hook will run before the virtual dataset has been stopped. These operations can cache data from the virtual dataset to be restored after the rewind completes. |
Post rollback | Operations performed after a rollback, also known as rewind. This hook will not run if the rewind or Pre Rewind hook operations fail. This hook will run after the virtual dataset has been started. This hook will not run if the rewind or Pre Rewind hook operations fail. These operations can restore cached data after the rewind completes. |
Pre snapshot | Operations performed before a snapshot. These operations can quiesce data to be captured during the snapshot, or stop processes that may interfere with the snapshot. |
Post snapshot | Operations performed after a snapshot. This hook will run regardless of the success of the snapshot or Pre Snapshot hook operations. These operations can undo any changes made by the Pre Snapshot hook. |
Pre start | Operations performed before the startup of a VDB or vFile. These operations can be used to initialize configuration files or stop processes that might interfere with the virtual dataset. |
Post start | Operations performed after the startup of a VDB of vFile. These operations can be used to clean up any temporary files, or restart processes that may have been stopped by a Pre-Start hook, or log notifications. |
Pre stop | Operations performed before the shutdown of a VDB or vFile. These operations can quiesce data or processes prior to the virtual dataset shutdown. |
Post stop | Operations performed after the shutdown of a VDB or vFile. These operations can be used to log notifications, clean up any temporary files, or stop/restart related processes. |
Order of execution of hooks for various VDB Operations
Provision | Refresh | Rollback | Snapshot | Start | Stop |
---|---|---|---|---|---|
Pre start | Pre refresh | Pre Rollback | Pre snapshot | Pre start | Pre stop |
Post start | Pre stop | Pre stop | Post snapshot | Post start | Post stop |
Configure clone | Post stop | Post stop | |||
Run masking job | Pre start | Pre start | |||
Pre snapshot | Post start | Post start | |||
Post snapshot | Configure clone | Configure clone | |||
Run masking job | Run masking job | ||||
Post refresh | Post rollback | ||||
Pre snapshot | Pre snapshot | ||||
Post snapshot | Post snapshot |
Staging server hooks
Staging Server hooks are currently applicable to SAP ASE and staged plugins (Db2, HANA, and PostgreSQL) environments, and will execute on the configured staging server.
Hook | Description |
---|---|
Pre validated sync | Operations performed on a staging server before validated sync. This hook will run before the validated sync operation whenever the validated sync run is triggered. |
Post validated sync | Operations performed on staging server after validated sync. This hook will run after the validated sync operation whenever the validated sync run is triggered. |
Self-service interaction with hooks
These are the operations performed by the various Self-Service operations:
Rollback
Reset, Undo, and any Restore or Branch operation using source point-in-time or a bookmark that’s part of the current container.
Refresh
Refresh and any Restore or Create Branch operation from any shared bookmark or when using the Template as the source of the restore (bookmark or point-in-time).
The Virtual Database Hooks described above will run accordingly. Snapshots are taken, for recovery purposes, before and after every operation that is performed. Bookmark operations will also initiate a snapshot.