使用预聚合数据重新构建分区投影

如果您在早期版本(10.0.x 之前的版本)中已使用预聚合数据创建投影(例如,LAP 和 TopK 投影),并且已使用 GROUP BY 子句对锚表进行了分区,则它们的 ROS 容器很容易被各种 DML 和 ILM 操作损坏。在这种情况下,必须重新构建投影:

  1. 在数据库上运行元函数 REFRESH。如果 REFRESH 检测到投影存在问题,将返回故障消息。例如:

    => SELECT REFRESH();
                                                   REFRESH
    -----------------------------------------------------------------------------------------------------
    Refresh completed with the following outcomes:
    Projection Name: [Anchor Table] [Status] [ Refresh Method] [Error Count]
    "public"."store_sales_udt_sum": [store_sales] [failed: Drop and recreate projection] [] [1]
    "public"."product_sales_largest": [store_sales] [failed: Drop and recreate projection] [] [1]
    "public"."store_sales_recent": [store_sales] [failed: Drop and recreate projection] [] [1]
    
    (1 row)
    

    Vertica 还会将消息记录到 vertica.log

    2020-07-07 11:28:41.618 Init Session:ox7fabbbfff700-aoo000000oosbs [Txnl <INFO> Be in Txn: aoooooooooo5b5 'Refresh: Evaluating which projection to refresh'
    2020-07-07 11:28:41.640 Init Session:ex7fabbbfff7oe-aooooeeeeoosbs [Refresh] <INFO> Storage issues detected, unable to refresh projection 'store_sales_recent'. Drop and recreate this projection, then refresh.
    2020-07-07 11:28:41.641 Init Session:Ox7fabbbfff700-aooooeooooosbs [Refresh] <INFO> Storage issues detected, unable to refresh projection 'product_sales_largest'. Drop and recreate this projection, then refresh.
    2020-07-07 11:28:41.641 Init Session:Ox7fabbbfff700-aeoeeeaeeeosbs [Refresh] <INFO> Storage issues detected, unable to refresh projection 'store_sales_udt_sum'. Drop and recreate this projection, then refresh.
    
  2. 使用 EXPORT_OBJECTSEXPORT_TABLES 导出这些投影的 DDL。

  3. 丢弃这些投影,然后按照导出的 DDL 中的定义重新创建它们。

  4. 运行 REFRESH。Vertica 将使用新的存储容器重新构建这些投影。