使用发布通道升级应用程序

This topic provides information on how to upgrade a Snowflake Native App using release channels.

关于应用程序升级

Snowflake Native App Framework 允许提供商将应用程序升级到新版本或补丁。

提供商可以通过在发布通道上设置发布指令,将应用程序升级到新版本或补丁。修改发布指令后,Snowflake 会自动将当前版本应用程序的所有已安装实例升级到发布指令指定的版本。

当提供商启动升级时,Snowflake 会将每个要升级的应用程序添加到队列中。每个应用程序都会根据可用资源进行升级。在所有已安装的应用程序版本中,升级过程可能需要一段时间才能完成。为了加快升级过程,使用者还可以在有新版本或补丁时手动启动应用程序升级。

Note

在应用程序的升级过程开始后,使用者不能再手动升级应用程序。

升级具有多个版本的应用程序时的注意事项

当提供商发布应用程序的新版本时,Snowflake 确保只有应用程序的上一版本处于活动状态。例如,如果提供商发布了应用程序的版本 v1 和 v2,则 Snowflake 确保在升级到 v3 之前,使用者账户中当前仅安装了 v2。这要求将所有已安装的使用版本 v1 的应用程序迁移到版本 v2。

这样可以确保应用程序的安装脚本只需考虑 v2 和 v3 之间的差异。安装脚本仅向后兼容最新版本的应用程序。如果提供商对应用程序进行状态更改(例如创建新表或向表中添加列),提供商只需确保两个版本之间不存在兼容性问题。

In contrast, when a provider creates a new patch for a version of an app, the Snowflake Native App Framework does not enforce any restrictions on the number of active patches running. Providers must avoid making changes to the state of an app in a patch to avoid incompatibility across multiple patches.

升级后移除应用程序版本时的注意事项

尽管应用程序可能在使用者账户中升级,但之前版本的应用程序可能仍然有正在运行的代码。在先前版本的所有运行代码完成前,提供商无法从发布通道中移除应用程序的先前版本。这适用于所有使用者账户中安装的应用程序的所有版本。如果单项升级失败,提供商必须在移除版本之前修复导致升级失败的问题。

跨区域升级

For information on upgrading an app across multiple regions, see .

用于升级应用程序的工作流程

提供商使用以下工作流程升级应用程序:

  1. 更新应用程序以添加任何新功能。
  2. 如果您要创建应用程序的新版本,并且当前为应用程序定义了两个版本:
  1. 确保当前没有使用者正在运行该版本。
  2. 删除您要更换的应用程序版本。
  1. 为发布通道中的变更创建新版本或补丁。

如果应用程序包的 DISTRIBUTION 属性设置为 EXTERNAL,则启动自动安全扫描。必须先通过安全扫描,然后才能进行升级。

  1. 通过在您的测试账户中安装应用程序来测试新版本。
  2. 更新版本或补丁的发布指令。

这将启动自动升级,该升级将更新先前版本的所有已安装实例。提供商可能会通知使用者有升级可用,并要求他们手动升级应用程序。

为升级设置开始日期和时间

Providers can set a date and time that specifies when an automatic upgrade should begin. This date and time is set in the release directive (default or custom) using the UPGRADE_AFTER clause of the ALTER APPLICATION PACKAGE command. Both default and custom release directives are supported.

The upgrade date and time can be any valid date and time type. If the timestamp has already passed the upgrade is immediately scheduled. This is the same behavior as not setting the UPGRADE_AFTER clause.

You can only use the UPGRADE_AFTER clause if you are setting the version and patch. This clause can’t be used to modify only the upgrade time and date.

为默认发布指令设置升级日期和时间

  1. 为默认发布指令设置升级日期和时间的方法如下:
    ALTER APPLICATION PACKAGE hello_snowflake_package
      MODIFY RELEASE CHANNEL DEFAULT
      SET DEFAULT RELEASE DIRECTIVE
      VERSION = 'v1_0'
      PATCH = '2'
      UPGRADE_AFTER = '2025-04-06T11:00:00Z'

This command sets the upgrade date and time for patch 2 or version v1_0 of the DEFAULT release channel to April 6, 2025 at 11:00 am.

Note

这是升级可以开始的最早日期和时间。实际升级可能会稍后发生,具体取决于要升级的应用程序数量、使用者账户数量等。

为自定义发布指令设置升级日期和时间

  1. 为默认发布指令设置升级日期和时间的方法如下:
    ALTER APPLICATION PACKAGE hello_snowflake_package
      MODIFY RELEASE CHANNEL DEFAULT
      SET DEFAULT RELEASE DIRECTIVE
      VERSION = 'v1_0'
      PATCH = '2'
      UPGRADE_AFTER = '2025-04-06T11:00:00Z'

This command sets the upgrade date and time for patch 2 or version v1_0 of the DEFAULT release channel to April 6, 2025 at 11:00 am.

Note

这是升级可以开始的最早日期和时间。实际升级可能会稍后发生,具体取决于要升级的应用程序数量、使用者账户数量等。

为自定义发布指令更改升级日期和时间

  1. 为默认发布指令更改升级日期和时间的方法如下:
    ALTER APPLICATION PACKAGE hello_snowflake_package
      MODIFY RELEASE CHANNEL DEFAULT
      SET DEFAULT RELEASE DIRECTIVE
      ACCOUNTS = ( USER_ACCOUNT.snowflakecomputing.cn )
      VERSION = 'v1_0'
      PATCH = '2'
      UPGRADE_AFTER = '2025-04-06T11:00:00Z'

This command changes the upgrade date and time for patch 2 or version v1_0 of the DEFAULT release channel to April 6, 2025 at 11:00 am.

Note

这是升级可以开始的最早日期和时间。实际升级可能会稍后发生,具体取决于要升级的应用程序数量、使用者账户数量等。

开始升级

The upgrade process starts automatically when a provider updates the release directive (default or custom) of the release channel to point to a new version or patch. Use the ALTER APPLICATION PACKAGE … RELEASE DIRECTIVE command to set the release directive as shown in the following examples:

ALTER APPLICATION PACKAGE my_application_package
  MODIFY RELEASE CHANNEL DEFAULT
  SET DEFAULT RELEASE DIRECTIVE
  VERSION = v2
  PATCH = 0;

This command sets the default release directive to version v2 and patch 0 for the default release channel.

ALTER APPLICATION PACKAGE my_application_package
  MODIFY RELEASE CHANNEL DEFAULT
  SET RELEASE DIRECTIVE my_custom_release_directive
  ACCOUNTS = ( USER_ACCOUNT.snowflakecomputing.cn )
  VERSION = v2
  PATCH = 0;

This command sets the custom release directive named my_custom_release_directive to version v2 and patch 0 for the account USER_ACCOUNT.snowflakecomputing.cn.

See Set the release directive for an app (Legacy) for more information.

手动升级应用程序

手动升级允许使用者比自动升级更快地升级已安装的应用程序。当有新版本或补丁可用时,提供商可能会要求使用者执行手动升级。

The consumer performs a manual upgrade by running the ALTER APPLICATION. This command initiate the upgrade of an installed version or patch of an app using the release directive specified in the release channel.

To upgrade an installed Snowflake Native App to the latest available version, a consumer can use the UPGRADE clause of the ALTER APPLICATION command to modify the app:

ALTER APPLICATION <name> UPGRADE

跨区域升级应用程序

After upgrading an app, changes to the installed Snowflake Native App in the consumer account might not be visible until the refresh to remote regions is performed.

You can use the APPLICATION_STATE view in the Data Sharing Usage schema to monitor the state. If the upgrade is not complete more than one day after the first refresh following the upgrade, there might be an issue with the refresh process. Contact Snowflake Support.

If a provider publishes a Snowflake Native App using Cross-Cloud Auto-Fulfillment, automated upgrades may take a while to upgrade depending on multiple factors, including:

  • 刷新计划的值。
  • 应用程序的已安装实例数。
  • 部署应用程序的区域数。

If the upgrade contains an urgent fix that needs to be upgraded in a remote region, the provider can reduce the refresh frequency of the listing to a smaller value. See Managing and monitoring auto-fulfillment settings for information on setting the account-level refresh frequency.

Caution

降低刷新频率可能增加与复制相关的成本。

升级状态

在升级过程中,应用程序会经过几个不同的状态。下图显示了从上一个版本 v1 升级到新版本 v2 时可能出现的状态。

Note

虽然此图表显示的是版本升级,但它也适用于补丁升级。

下表显示了应用程序包所在区域内的应用程序升级过程的每个阶段:

暂存区描述
1App 是否处于禁用状态?如果应用程序处于禁用状态,则无法升级。
2将发布指令设置为 v2.0提供商将发布指令设置为 v2.0。
3符合升级条件Snowflake 执行检查以验证应用是否符合升级条件。这些检查包括验证应用程序是否未处于禁用状态、应用程序包是否可用、版本和补丁是否符合升级条件、使用者账户是否有效等。
4是否要获取升级时段?根据要升级的应用程序数量、使用者账户数量等,他们可能必须等待一段时间才能开始升级过程。
5安装脚本是否成功运行?升级开始时,Snowflake 会运行安装脚本。如果发生任何未捕获的错误,安装脚本将停止执行。Snowflake 会根据配置的重试次数再次将应用程序排入升级队列。
6版本是否可更新?Snowflake 检查升级是否适合版本或补丁。如果升级是针对某个版本的,Snowflake 会执行其他检查,并等待旧版本应用程序的所有作业完成。

下表显示了部署到远程区域的应用程序的升级过程:

暂存区描述
7在远程区域复制发布指令 v2.0当提供商为部署到远程区域的应用程序设置发布指令时,该发布指令将传播到部署在远程区域中的应用程序包。
8v2.0 的活动区域是什么?当主要区域中的大多数应用程序都已升级后,Snowflake 会向远程区域发送消息以开始应用程序升级。
9开始升级过程按照上表所述开始应用程序的升级过程。

下表描述了升级过程的每种可能状态:

状态描述
DISABLED应用程序处于禁用状态,不符合升级条件。
QUEUED根据应用程序和使用者账户的数量,应用程序处于待升级队列中。
UPGRADING应用程序正在升级过程中。
COMPLETED应用程序已成功升级。
QUEUED_RETRY安装脚本或其他检查失败,应用程序返回到升级队列。
FAILED应用程序升级失败。升级可能会在提供商端失败,例如由于安装脚本中的错误。如果应用程序处于禁用状态、使用者账户处于非活动状态等,升级也可能在使用者端失败。

监控升级状态

To view the upgrade state of an app, use the APPLICATION_STATE view.

例如,在您更新了默认发布指令并希望查看所有应用程序是否已达到目标版本的情况下。要查找尚未完成升级的应用程序实例,请使用以下示例中的查询:

SELECT * FROM snowflake.data_sharing_usage.APPLICATION_STATE

This view includes columns that are specific to upgrades, including the upgrade state and the region where the app is deployed. For information on upgrade states see 升级状态.

排查升级问题

The Snowflake Native App Framework provides several ways to troubleshoot the upgrade as described in the following sections:

识别升级错误

Consumers can use the DESCRIBE APPLICATION command to view error messages related to failed upgrades. This command provides insight into the errors that occurred during the upgrade process.

Providers can use the APPLICATION_STATE view to view error messages for failed upgrades. Using this view, providers can diagnose issues with specific applications. See 监控升级状态 for more information.

使用日志记录和事件跟踪

If logging and event tracing is configured for the app, providers can query the event table to diagnose problems with the app upgrade.

See View the logs and events in the event table for more information.

监控应用程序服务的状态

要查看应用程序内计算池或服务的状态信息,使用者可以使用以下系统函数:

使用者可以将这些信息共享给提供商。提供商也可以配置事件共享以返回此信息。

处于禁用状态的应用程序

当使用者账户中安装的应用程序处于禁用状态时,它将不再可用。安装在使用者账户中的应用程序可能会因多种原因而处于禁用状态的,其中包括:

  • 应用程序包的问题
  • 已安装应用程序的问题
  • 使用者账户的问题

提供商和使用者都应避免应用程序长时间处于禁用状态的情况。处于禁用状态的应用程序可能无法使用,必须重新安装

升级处于禁用状态的应用程序

处于禁用状态的应用程序不是正常升级过程的一部分,无法升级。如果重新启用处于禁用状态的应用程序,它会自动升级到发布指令的版本和补丁。但是,如果版本或补丁不再可用,则应用程序无法升级,必须重新安装。

For example, if a disabled app is on version v1, but the current and previous versions in the release channel are v2 and v3, the app cannot be upgraded and is unusable.

可能会禁用应用程序的原因

You can view the DISABLEMENT_REASONS column of the APPLICATION_STATE view to see the reasons an app is disabled. The following table lists the possible values for the DISABLEMENT_REASONS column:

ValueStatus descriptionIs recoverable?
MANUALLY_DISABLEDThe app is disabled by SnowflakeYes. To re-enable the app, contact Snowflake Support.
ACCOUNT_INACTIVE

The account becomes inactive by being locked or suspended causing the app to be unavailable. In this state a consumer cannot execute any SQL queries in their account and the app cannot be upgraded.

Yes. The app is automatically re-enabled if the account lock or suspension is removed
PACKAGE_VERSION_IS_MISSINGThe application package version for the app was dropped by the provider.

Possibly. This can be caused by a temporary platform outage, in which case the app may recover automatically. Otherwise, the provider can work with Snowflake Support to attempt version recovery. Contact the application provider for more details.

CMK_ACCESS_DENIED

The consumer manages the encryption key themselves (ENCRYPT_USE_CMK_KMS is enabled) and Snowflake doesn’t have access to this key.

Yes. To re-enable the app, ensure that the cloud provider configuration to retrieve the CMK is correct and that Snowflake has access to the key.

LISTING_ACCESS_REVOKED

The listing used to create the app is no longer available. Possible reasons for this status include:

  • The provider deleted the listing
  • The provider manually removed access to the private listing from the consumer account

Possibly. Recoverability depends on the reason why access was revoked.

For example, if the listing was deleted it is not recoverable. If a consumer account was manually removed from the private listing, access to the listing and app can be restored.

LISTING_TRIAL_USAGE_EXCEEDEDThe application has exceeded the usage limit for a usage-based trial listing.No
LISTING_PAYMENT_REQUIRED

The listing used to install the app is a paid listing and requires payment for further usage.

Yes. The consumer must correctly set up payment for the app.
LISTING_TRIAL_TIME_EXCEEDEDThe application exceeded the trial duration.No
APPLICATION_PACKAGE_NOT_AVAILABLE

The application package used to create the app no longer exists. The provider may have dropped the corresponding application package.

No
APPLICATION_PACKAGE_DISABLEDThe application package used to create the app is disabled by the Snowflake.Yes. The app is re-enabled, if Snowflake re-enables the application package.
APPLICATION_SUSPENDED

The app resources for example, tasks, services, and compute pools, are suspended due to the app being disabled.

The suspended objects remain suspended until the app is re-enabled and there are no other reasons the app was disabled.

Yes
APPLICATION_SUSPEND_RESUME_IN_PROGRESSThe app resources, for example tasks, services, and compute pools, are currently resuming.Yes