异步物化视图创建必须使用root用户执行问题

为了更快的定位您的问题,请提供以下信息,谢谢
【详述】场景:从3.1.8版本升级到3.2.6版本后,创建了一个bi_all角色,授权给dev_user用户,bi_all角色有bi数据库的所有table和MATERIALIZED VIEW 的所有操作权限,但是在创建MATERIALIZED VIEW时,刷新分区会报没有MATERIALIZED VIEW的基表select权限,导致目前所有的MATERIALIZED VIEW都需要用root用户去执行创建和刷新分区操作,目前已经升级到3.3.0版本,但是问题还没有解决
【背景】从3.1.8版本升级到3.2.6版本,目前从3.2.6升级到3.3.0版本
【业务影响】无法使用dev用户创建异步物化视图
【是否存算分离】是
【StarRocks版本】3.3.0
【集群规模】例如:3fe(1 leader+2follower)+7cn(独立部署)
【机器信息】CPU虚拟核/内存/网卡,例如:48C/64G/万兆
【联系方式】tanheyuan@outlook.com
【附件】
操作的sql:

-- 授权 bi 权限给 bi_all 角色
GRANT ALL ON DATABASE bi TO ROLE bi_all;
GRANT ALL ON TABLE bi.* TO ROLE bi_all;
GRANT ALL ON VIEW bi.* TO ROLE bi_all;
GRANT ALL ON MATERIALIZED VIEW bi.* TO ROLE bi_all;

-- 授予角色权限
GRANT 'bi_all' TO USER 'dev_user'@'x.x.x.x';

-- 异步物化视图创建sql
CREATE
MATERIALIZED VIEW IF NOT EXISTS bi.business_enter_detail_55 COMMENT '每日进入系统订单毛利表'
PARTITION BY date_trunc('day', dt_format)
DISTRIBUTED BY HASH(`tsale_depart_name`)
REFRESH ASYNC START
('2024-05-27 10:10:00') EVERY (interval 1 hour)
AS
SELECT pi_detail_id,
       account,
       site,
       spu,
       order_id,
       order_number,
       data_type_code,
       send_date,
       pay_date,
       platform,
       original_plat_name,
       original_account_name,
       carrier_name,
       channel_name,
       tracknumber,
       order_recordnumber,
       currency,
       countrysn,
       country_name,
       state,
       continent,
       warehouse,
       order_ppfee,
       sku,
       csku,
       cspu,
       sku_totalcount,
       is_ls_code,
       in_csku_code,
       product_line,
       category,
       category_name,
       category1_name,
       category2_name,
       category3_name,
       category4_name,
       is_resend_code,
       resend_reason,
       sku_weight,
       sku_estimate_weight,
       goods_weight,
       sku_volume,
       sku_volume_weight,
       current2usd_rate,
       usd2cny_rate,
       online_itemprice,
       sku_sales_pay_original,
       sku_sales_pay_usd,
       sku_sales_pay_cny,
       online_skushipfee,
       tsku_sales,
       csku_sales,
       sku_ppfee,
       sku_refundfee,
       sku_platfee,
       sku_shipfee,
       goods_cost,
       check_cost,
       sku_packfee,
       sku_withdrawal_fee,
       sku_disposefee_home,
       sku_disposefee_oversea,
       sku_declared_value,
       sku_vat_tax,
       sku_oceanfee,
       sku_tariff,
       sales_tax,
       sku_grossprofit,
       grossprofit_rate,
       sku_stockup_fee,
       new_sku_grossprofit,
       new_grossprofit_rate,
       amazon_recordnumber,
       amazon_accountid,
       amazon_account,
       amazon_site,
       is_otherfba_code,
       tsale_name,
       tsale_team_name,
       tsale_depart_name,
       csale_name,
       csale_team_name,
       csale_depart_name,
       purchase_name,
       purchase_team_name,
       purchase_depart_name,
       develop_name,
       develop_team_name,
       develop_depart_name,
       gendan_name,
       gendan_team_name,
       gendan_depart_name,
       sku_fba_secondshipfee,
       dt_format,
       user_mail,
       postcode,
       sluggish_status_code,
       changed_type_code,
       sku_cpcfee,
       sku_ocpcfee,
       sku_otherfee,
       sku_refund_return_fee,
       promoter_name,
       category_manager_name,
       sku_create_time,
       sku_publish_time,
       is_new_code,
       director,
       promotionids,
       order_note,
       ph_sluggish_status_code,
       ph_changed_type_code,
       check_time,
       order_type_note_code,
       changed_date,
       ph_changed_date,
       order_status_cny,
       is_promote_order,
       add_date,
       transation_id,
       model_create_date,
       onum,
       leader,
       soft_hard_type_code,
       business_plat,
       real_plat,
       fin_name,
       online_status,
       supplier_second_low_price,
       online_sku,
       season_brand_name,
       sales_tax_original,
       sku_sales_without_tax_original,
       sku_sales_without_tax_cny,
       spu_buz_module,
       dept_buz_module,
       online_itemid,
       sku_shipfee_original_1,
       sku_shipfee_original_currency_1,
       sku_shipfee_original_2,
       sku_shipfee_original_currency_2,
       sku_shipfee_original_3,
       sku_shipfee_original_currency_3,
       sku_shipfee_original_4,
       sku_shipfee_original_currency_4,
       sku_shipfee_original_5,
       sku_shipfee_original_currency_5,
       sku_shipfee_original_6,
       sku_shipfee_original_currency_6,
       is_tax_code,
       is_business_order_code,
       brand_name,
       finance_status_code,
       shipment_status_code,
       pay_type,
       recieve_paypal,
       discard_date,
       carton_sequence_number,
       is_copy,
       wk_sale_tax_original,
       wk_is_include_tax,
       category5_name,
       temu_order_recordnumber,
       star_flag,
       is_offline_code,
       dealer_name,
       dt,
       amazon_order_type,
       primary_level,
       primary_fee,
       first_batch_total,
       final_level
FROM bi.business_enter_detail
WHERE dept_buz_module = '销售中心' and dt_format >= '2024-05-01';
  • 执行 select * from information_schema.task_runs 查看task任务结果得到下列错误信息
  • 错误信息:Refresh materialized view business_enter_detail_55 failed
    after retrying 1 times(try-lock 0 times),
    error-msg : Access denied; you need (at least one of) the SELECT privilege(s) on TABLE business_enter_detail for this operation.
    Please ask the admin to grant permission(s) or try activating existing roles using <set [default] role>.
    Current role(s): NONE. Inactivated role(s): NONE.

GRANT SELECT ON TABLE bi.business_enter_detail TO ROLE bi_all;
你好 验证试下

谢谢解答,目前已经有github 的小伙伴回复了明确是BUG问题,具体请参考:https://github.com/StarRocks/starrocks/pull/47561

临时方案是创建一个dev_user@’%'用户解决用户域的问题~