Updated on 2023-10-23 GMT+08:00

Redistribution Parameters

The following functions are system functions used by gs_redis during redistribution. Do not call them unless absolutely necessary.

  • pg_get_redis_rel_end_ctid(text, name, int, int)
  • pg_get_redis_rel_start_ctid(text, name, int, int)
  • pg_enable_redis_proc_cancelable()
  • pg_disable_redis_proc_cancelable()
  • pg_tupleid_get_blocknum(tid)
  • pg_tupleid_get_offset(tid)
  • pg_tupleid_get_ctid_to_bigint (ctid)

The following functions and OIDs are all for time series tables.

  • redis_ts_table(oid)

Description: Moves data from the old table (for example, redis_old_cpu) to the new table (redis_new_cpu) from the last partition of the timeline, deletes the partition if the partition of redis_old_cpu is empty, deletes the old table when only one partition is left, and restores the table to the original CPU table. This function is called by the following job and does not need to be manually called.

Return type: void

Table 1 redis_ts_table parameter description

Parameter

Type

Description

Mandatory or Not

old_oid

oid

ID of redis_old_cpu.

Yes

  • cancel_unuse_redis()

Description: Cancels redistribution of a time series table.

Return value: void

  • submit_redis_task(oid, interval)

Description: Calls the redis_ts_table function. Only one job can be called for a table. For modification, stop the job and call it again.

Parameter: The CPU table is used as an example. For details, see Table 2.

Return type: void

Table 2 submit_redis_task parameter description

Parameter

Type

Description

Mandatory or Not

old_oid

oid

ID of redis_old_cpu.

Yes

schedule_interval

interval

This parameter is used to calculate the input value of interval_time in dbe_task.submit, indicating the interval for executing the job.

No

  • submit_all_redis_task(interval)

Description: Calls the submit_redis_task function for all tables that are not redistributed in the currently connected database.

Return type: void

Table 3 Parameter description

Parameter

Type

Description

Mandatory or Not

schedule_interval

interval

This parameter has the same meaning as the input parameter schedule_interval of submit_redis_task.

No

  • cancel_redis_task(oid)

Description: Stops the job for transferring a table after the table has been transferred.

Parameter: OID of redis_old_cpu (using the cpu table as an example).

Return type: void

  • cancel_all_redis_task()

Description: Stops all the jobs that are being transferred for all the time series tables connected to the database.

Return type: void

  • submit_cancel_redis_task(interval)

Description: Creates jobs for all time series tables connected to the database and calls the cancel_redis_task function.

Parameter: interval for calling the job. The default value is 1h.

Return type: void

  • flush_depend_rule(oid)

Description: Take the CPU table as an example. If a user directly executes some SQL statements on the redis_old_cpu and redis_new_cpu tables, the original rules cannot work properly. In this case, you can use this function to recreate related rules. The statements for creating rules are in the pg_rules system catalog, and you are advised to perform only allowed operations. If you directly run SQL statements on redis_new_cpu and redis_old_cpu, unknown errors may occur.

Parameter: OID of the CPU table.

Return type: void