hvrcontrol
Usage
hvrcontrol [-Rurl] [-options]... hub chn
Description
The hvrcontrol command either sends 'controls' to replication jobs or removes them. A 'control' is a message file that can serve two purposes:
- Tell a job to do something else when it is already running. For example, wake up or change its default behavior.
- Instruct a job to treat certain rows in a special way, e.g., skip an old or 'bad' row, send a certain change straight to a 'fail table', or be resilient for some rows during an online refresh.
Correct use of command hvrcontrol requires understanding of undocumented HVR internals. For this reason, this command should only be used after consultation with the Fivetran Support or when it is recommended by an error message in HVR.
HVR sends control files internally in the following areas:
- The hvrstart command instructs the Scheduler to send a trigger control file. Jobs that are in a 'cycle loop' will detect this file and do an extra cycle even if they are still running. When this cycle ends, they will delete this control file, so hvrstart
-w
command will terminate. - Online refresh jobs (hvrrefresh
-q
) sends refresh taskname_online (default is refr_online) control files to instruct capture and integrate jobs to skip changes made to the base tables before the refresh and to treat changes made while the refresh is running with resilience.
Options
This section describes the options available for command hvrcontrol.
Parameter | Description |
---|---|
-c | Only send control to capture jobs. Bydefault , the control is sent to both capture and integrate jobs. |
-d | Delete older control files while creating a new control so that the new control replaces any old controls. The older control is deleted if it was for the same job and it had the same control name (see option -n ). |
-D | Delete control files and do not create a new control. All control files for a channel are deleted unless options -c , -i , -l , or -n are supplied. |
-Ename=value | Set environment variable name to value in affected job. |
-f | Affected changes should be sent directly to the 'fail table' instead of trying to integrate them. All changes are failed unless option -m , -r , or -s . |
-F | Affected jobs should finish at the end of the next replication cycle. |
-i | Only send control to integrate jobs. Bydefault , the control is sent to both capture and integrate jobs. |
-jbool | Set the integrate job's journaling state. If enabled, the processed transaction files are moved to journal directory $HVR_CONFIG/hubs/hub/channels/channel/locs/loc/jnl/ on the hub machine. Normally, an integrate job would delete its processed transaction files. The journal files are compressed, but their contents can be viewed using the command hvrrouterview.
If this parameter is defined for any table, then it affects all tables integrated to that location. Values of
|
-lx | Only send controls to jobs for locations specified by Values of
-lx instructions can be supplied together. |
-mcol | For affected changes value of column col should be set to missing. Setting the value to missing means that the change will not have data for col anymore. The column value is set to missing for all changes unless option -w or -t is supplied.
It is not recommended to use this option on a key column. This option cannot be combined with options-f , -r , or -s . |
-nctrlname | Name of control. This is part of the file name of the control created for each job, and it also affects which old control files are deleted if option default is adhoc. |
-r | Affected changes should be treated with resilience (as if parameter Resilient=SILENT is defined in action Integrate) during integration. All changes are resilient unless option -f , -m , or -s . |
-Rurl | Remote hub server. Access the hub server running on a remote machine via the REST interface. This option is required for remote CLI access. When using this option, command hvrlogin should be run first, for authentication. |
-s | Affected changes should be skipped. All changes are skipped unless options -f , -m , or -r . |
-ty | Only filter rows for tables specified by y. Values of y may be one of the following:
Several -f , -m , -r , or -s . |
-wwhere | Where condition which must have form columname operator value.
Valid date formats are YYYY-MM-DD [HH:MM:SS] in local time or YYYY-MM-DDTHH:MM:SS+TZD or YYYY-MM-DDTHH:MM:SSZ or today or now [[±]SECS] or an integer (seconds since 1970-01-01 00:00:00 UTC). For some operators (= != <>) the value can be a list separated by '|'. If multiple -f , -m , -r , or -s . |
-xexpire | Expiry. The affected job should expire the control file and delete it when this time is reached. Valid date formats are YYYY-MM-DD [HH:MM:SS] in local time or YYYY-MM-DDTHH:MM:SS+TZD or YYYY-MM-DDTHH:MM:SSZ or today or now [[±]SECS] or an integer (seconds since 1970-01-01 00:00:00 UTC). Option-x0 , therefore, means that the control will be removed by the job after its first cycle. |
-Xexpire | Receive expiry. The affected job should expire the control file and delete it after it has processed all changes that occurred before this time. Valid date formats are YYYY-MM-DD [HH:MM:SS] in local time or YYYY-MM-DDTHH:MM:SS+TZD or YYYY-MM-DDTHH:MM:SSZ or today or now [[±]SECS] or an integer (seconds since 1970-01-01 00:00:00 UTC). |
Examples
This section provides examples of using the hvrcontrol command.
Example 1. Instruct jobs to skip certain rows
The following command instructs all jobs in channel sales to skip rows for table x with prod_id<5:
hvrcontrol -s -tx "-wprod_id<5" hub sales
Example 2. Instruct jobs to send certain changes to fail tables
The following command instructs all jobs in channel sales to send everything before the transaction with hvr_tx_seq=000014013DF50001 into the fail tables:
hvrcontrol -f "-whvr_tx_seq<'000014013DF50001'" hub sales
Example 3. Instruct jobs to send certain changes into fail tables
The following command instructs all jobs in channel sales to send everything before the change with hvr_tx_seq=000014013DF50001 and hvr_countdown=3 into the fail tables:
hvrcontrol -f "-whvr_tx_seq<<'000014013DF50001'" "-whvr_tx_countdown>3" hub sales
Every change in HVR has a unique hvr_tx_seq and hvr_tx_countdown combination, with these values acting as major and minor numbers, respectively. Note that hvr_tx_countdown has reverse ordering (i.e., for a big transaction, the first change has countdown 100, and the last has countdown 1). Note the use of comparison operator << for major/minor ordering.
Example 4. Instruct an integrate job to be resilient for certain changes
The following command instructs the integrate job in location q to be resilient for all changes where (prod_id=1 and prod_price=10) or (prod_id=2 and (prod_price=20 or prod_price=21)):
hvrcontrol -i -lq -r -wprod_id=1 -wprod_price=10 hub sales
hvrcontrol -i -lq -r -wprod_id=2 "-wprod_price=20|21" hub sales
Example 5. Instruct a capture job to write a dump of its state into a log file
The following command instructs a running log-based capture job to write a dump of its state (including all open transactions) into its log file ($HVR_CONFIG/hubs/hub/logs/chn-cap-loc.out):
hvrcontrol -c hub sales TxDump
Example 6. View the content of all control files of a specific channel
The following command displays the contents of all control files affecting a channel:
hvrrouterview -s hub sales
Command hvrrouterview converts the control file into a readable XML format.
Example 7. Delete all controls for a specific channel
The following command deletes all controls affecting a channel:
hvrcontrol -D hub sales