Using Spock Functions

Spock Functions

The following user functions are available via the Spock extension:

CommandDescription
Node Management FunctionsYou can add and remove nodes dynamically using Spock interfaces.
spock.node_infoReturns information about the node on which the function is invoked.
spock.node_createDefine a node for spock.
spock.node_dropRemove a spock node.
node_add_interfaceAdd a new node interface.
spock.node_drop_interfaceDelete a node interface.
Replication Set Management FunctionsReplication sets provide a mechanism to control which tables in the database will be replicated and which actions on those tables will be replicated. Each replicated set can specify individually if INSERTs, UPDATEs, DELETEs and TRUNCATEs on the set are replicated. Each table can be in multiple replication sets, and each subscriber can subscribe to multiple replication sets. The resulting set of tables and actions replicated is the union of the sets the table is in. Spock installation creates three replication sets: default, default_insert_only and ddl_sql. The default replication set is defined to replicate all changes to tables in it. The default_insert_only replication set only replicates INSERT statements, and is meant for use by tables that don't have primary key. The ddl_sql replication set is defined to replicate schema changes specified by spock.replicate_ddl.
spock.repset_createDefine a replication set.
spock.repset_alterModify a replication set.
repset_dropRemove a replication set.
spock.repset_add_partitionAdd a partition to a replication set.
spock.repset_remove_partitionRemove a partition from the replication set that the parent table is a part of.
spock.repset_add_tableAdd table(s) to replication set.
spock.repset_add_all_tablesAdd all existing table(s) to the replication set.
spock.repset_remove_tableRemove table from replication set.
[spock.repset_show_table]
repset_add_seqDeprecated; Adds a sequence to a replication set.
repset_add_all_seqsDeprecated; Adds all sequences from the specified schemas to a replication set.
repset_remove_seqDeprecated; Remove a sequence from a replication set.
[spock.sync_seq]Synchronize the specified sequence.
Subscription Management Functions
spock.sub_createCreate a subscription.
spock.sub_dropDelete a subscription.
spock.sub_disablePut a subscription on hold, and disconnect from the provider.
spock.sub_enableMake a subscription live.
spock.sub_add_repsetAdd a replication set to a subscription.
spock.sub_remove_repsetDrop a replication set from a subscription.
spock.sub_show_statusDisplay the status of the subcription.
spock.sub_show_tableShow subscription tables.
spock.sub_alter_interfaceModify an interface to a subscription.
spock.sub_wait_for_syncPause until the subscription is synchronized.
[spock.sub_alter_skiplsn]Skip transactions until the specified lsn.
[spock.sub_alter_sync]Synchronize all missing tables.
[spock.sub_resync_table]Synchronize a specific table.
Miscellaneous Management Functions
spock.table_wait_for_syncPause until a table finishes synchronizing.
spock.replicate_ddlEnable DDL replication.
set_readonlyTurn PostgreSQL read_only mode 'on' or 'off'.
spock.spock_versionReturns the Spock version in a major/minor version form: 4.0.10.
spock.spock_version_numReturns the Spock version in a single numeric form: 40010.
[spock.convert_sequence_to_snowflake]Convert a Postgres native sequence to a Snowflake sequence.
spock.get_channel_statsReturns tuple traffic statistics.
spock.get_countryReturns the country code if explicitly set; returns ?? if not set.
spock.lag_trackerReturns a list of slots, with commit_lsn and commit_timestamp for each.
[spock.repair_mode]Used to manage the state of replication - If set to true, stops replicating statements; when false, resumes replication.
[spock.replicate_ddl]Replicate a specific statement.
[spock.reset_channel_stats]Reset the channel statistics.
[spock.spock_max_proto_version]The highest Spock native protocol supported by the current binary/build.
[spock.spock_min_proto_version]The lowest build for which this Spock binary is backward compatible.
[spock.table_data_filtered]Scans the specified table and returns rows that match the row filter from the specified replication set(s). Row filters are added to a replication set when adding a table with repset_add_table.
[spock.terminate_active_transactions]Terminates all active transactions.
[spock.wait_slot_confirm_lsn]Wait for the confirmed_flush_lsn of the specified slot, or all logical slots if none given.
[spock.xact_commit_timestamp_origin]Returns the commit timestamp and origin of the specified transaction.