- Categories:
REPLICATION_ GROUP_ REFRESH_ PROGRESS、REPLICATION_ GROUP_ REFRESH_ PROGRESS_ BY_ JOB、REPLICATION_ GROUP_ REFRESH_ PROGRESS_ ALL¶
您可以使用 REPLICATION_GROUP_REFRESH_PROGRESS 系列表函数来查询复制或故障转移组的刷新操作状态:
- REPLICATION_GROUP_REFRESH_PROGRESS returns a JSON object indicating the refresh status for a secondary replication or failover group by name.
- REPLICATION_GROUP_REFRESH_PROGRESS_BY_JOB returns a JSON object indicating the refresh status for a secondary replication or failover group by query ID.
- REPLICATION_GROUP_REFRESH_PROGRESS_ALL returns a JSON object indicating the refresh status for all the secondary replication and failover groups.
Note
- REPLICATION_GROUP_REFRESH_PROGRESS only returns the replication or failover group refresh activity for the most recent refresh if it occurred within the last 14 days.
- REPLICATION_GROUP_REFRESH_PROGRESS_BY_JOB and REPLICATION_GROUP_REFRESH_PROGRESS_ALL return replication or failover group
refresh activity within the last 14 days. By default (when no date-range arguments are provided),
REPLICATION_GROUP_REFRESH_PROGRESS_ALL returns data for the last 12 hours. Use the optional
DATE_RANGE_STARTandDATE_RANGE_ENDarguments to query a custom range within the 14-day retention window.
语法
实参
'secondary_group_name'辅助复制或故障转移组的名称。请注意,整个名称必须放在单引号内。
'query_id'ID of the replication group refresh query. The query ID can be obtained from the History
page in the web interface.
以下实参对于 REPLICATION_GROUP_REFRESH_PROGRESS_ALL 是可选的。
DATE_RANGE_START => constant_expr,
DATE_RANGE_END => constant_expr返回复制刷新进度的日期/时间范围。
- 如果既未指定开始日期,也未指定结束日期,则默认值为过去 12 小时。
- If a start date is specified but no end date, CURRENT_DATE at midnight is used as the end of the range.
- If an end date is specified but no start date, the range starts 12 hours prior to the start
of
DATE_RANGE_END.
数据保留 14 天。如果请求的范围超出了 14 天的保留期,则该函数将返回错误。
输出
该函数返回以下各列。REPLICATION_GROUP_REFRESH_PROGRESS_ALL 还有其他列,分别为结果集的前两列。
| Column Name | Data Type | Description |
|---|---|---|
| GROUP_NAME | TEXT | 指定哪个二级复制或故障转移组对应于结果集中的此行。仅适用于 REPLICATION_GROUP_REFRESH_PROGRESS_ALL。 |
| GROUP_TYPE | TEXT | Specifies whether the group corresponding to this row in the result set is a failover group or a replication group.
The value is either |
| PHASE_NAME | TEXT | Name of the replication phases completed (or in progress) so far. For the list of phases, see the usage notes. |
| START_TIME | TIMESTAMP_LTZ | Time when the replication phase began. |
| END_TIME | TIMESTAMP_LTZ | Time when the phase finished, if applicable. |
| PROGRESS | TEXT |
剩余阶段为空 |
| DETAILS | VARIANT |
|
使用说明
- When no
DATE_RANGE_STARTorDATE_RANGE_ENDarguments are provided, REPLICATION_GROUP_REFRESH_PROGRESS_ALL returns data for the last 12 hours. To retrieve data beyond the last 12 hours, specify the date range explicitly. Data is available for up to 14 days. - 仅返回对复制组或故障转移组具有任何权限的角色的行。
- 仅返回当前账户中辅助复制或故障转移组的行。
- When calling an Information Schema table function, the session must have an INFORMATION_SCHEMA schema in use or the function name must be fully-qualified. For more details, see Snowflake Information Schema.
-
以下是所处理订单中的阶段列表:
# Phase name Description 1 SECONDARY_SYNCHRONIZING_MEMBERSHIPThe secondary replication or failover group receives information from the primary group about the objects included in the group, and updates its membership metadata. 2 SECONDARY_UPLOADING_INVENTORYThe secondary replication or failover group sends an inventory of its objects in the target account to the primary group. 3 PRIMARY_UPLOADING_METADATAThe primary replication or failover group creates a snapshot of metadata in the source account and sends it to the secondary group. 4 PRIMARY_UPLOADING_DATAThe primary replication or failover group copies the files the secondary group needs to reconcile any deltas between the objects in the source and target accounts. 5 SECONDARY_DOWNLOADING_METADATAThe secondary replication or failover group applies the snapshot of the metadata that was sent by the primary. The metadata updates are not applied atomically and instead applied over time. 6 SECONDARY_DOWNLOADING_DATAThe secondary replication or failover group copies the files sent by the primary group to the target account. 7 COMPLETED/FAILED/CANCELEDRefresh operation status. -
In the
PRIMARY_UPLOADING_DATAandSECONDARY_DOWNLOADING_DATAphases, thetotalBytesToReplicatevalue is estimated prior to the replication operation. This value may differ from thetotalBytesToUploadortotalBytesToDownloadvalue in the respective phase.For example, if during the
PRIMARY_UPLOADING_DATAphase, a previous replication operation uploaded some bytes but was canceled before the operation completed, those bytes would not be uploaded again. In that case,totalBytesToUploadwould be lower thantotalBytesToReplicate.
示例
To retrieve the current refresh progress for replication group rg1, execute the following
statement:
要通过查询 ID 检索复制组刷新进度,请替换示例中的查询 ID 并执行以下语句:
要检索所有故障转移组和复制组过去 12 小时(默认)的刷新进度,请执行以下语句:
要检索所有组过去 7 天的刷新进度,请执行以下操作: