Skip to content

[Bug]: TPC-DS 1TB Q80 join-spill cannot admit minimum allocation at 40 GiB #26744

Closed

Description

@Ariznawlll

Description

TPC-DS 1 TB query80 fails on single-CN MatrixOne main when join-spill reaches the 40 GiB process memory ceiling. The spill path cannot admit even its minimum scatter/codec allocation, so the supported query aborts instead of continuing through spill.

Environment

Steps to reproduce

Load TPC-DS SF=1000 and execute the exact generated SQL:

with ssr as
 (select  s_store_id as store_id,
          sum(ss_ext_sales_price) as sales,
          sum(coalesce(sr_return_amt, 0)) as returns,
          sum(ss_net_profit - coalesce(sr_net_loss, 0)) as profit
  from store_sales left outer join store_returns on
         (ss_item_sk = sr_item_sk and ss_ticket_number = sr_ticket_number),
     date_dim,
     store,
     item,
     promotion
 where ss_sold_date_sk = d_date_sk
       and d_date between cast('1998-08-04' as date)
                  and (cast('1998-08-04' as date) +  30 days)
       and ss_store_sk = s_store_sk
       and ss_item_sk = i_item_sk
       and i_current_price > 50
       and ss_promo_sk = p_promo_sk
       and p_channel_tv = 'N'
 group by s_store_id)
 ,
 csr as
 (select  cp_catalog_page_id as catalog_page_id,
          sum(cs_ext_sales_price) as sales,
          sum(coalesce(cr_return_amount, 0)) as returns,
          sum(cs_net_profit - coalesce(cr_net_loss, 0)) as profit
  from catalog_sales left outer join catalog_returns on
         (cs_item_sk = cr_item_sk and cs_order_number = cr_order_number),
     date_dim,
     catalog_page,
     item,
     promotion
 where cs_sold_date_sk = d_date_sk
       and d_date between cast('1998-08-04' as date)
                  and (cast('1998-08-04' as date) +  30 days)
        and cs_catalog_page_sk = cp_catalog_page_sk
       and cs_item_sk = i_item_sk
       and i_current_price > 50
       and cs_promo_sk = p_promo_sk
       and p_channel_tv = 'N'
group by cp_catalog_page_id)
 ,
 wsr as
 (select  web_site_id,
          sum(ws_ext_sales_price) as sales,
          sum(coalesce(wr_return_amt, 0)) as returns,
          sum(ws_net_profit - coalesce(wr_net_loss, 0)) as profit
  from web_sales left outer join web_returns on
         (ws_item_sk = wr_item_sk and ws_order_number = wr_order_number),
     date_dim,
     web_site,
     item,
     promotion
 where ws_sold_date_sk = d_date_sk
       and d_date between cast('1998-08-04' as date)
                  and (cast('1998-08-04' as date) +  30 days)
        and ws_web_site_sk = web_site_sk
       and ws_item_sk = i_item_sk
       and i_current_price > 50
       and ws_promo_sk = p_promo_sk
       and p_channel_tv = 'N'
group by web_site_id)
 select * from ( select  channel
        , id
        , sum(sales) as sales
        , sum(returns) as returns
        , sum(profit) as profit
 from
 (select 'store channel' as channel
        , 'store' || store_id as id
        , sales
        , returns
        , profit
 from   ssr
 union all
 select 'catalog channel' as channel
        , 'catalog_page' || catalog_page_id as id
        , sales
        , returns
        , profit
 from  csr
 union all
 select 'web channel' as channel
        , 'web_site' || web_site_id as id
        , sales
        , returns
        , profit
 from   wsr
 ) x
 group by rollup (channel, id)
 order by channel
         ,id
  ) where rownum <= 100;

Actual behavior

The query failed after 114.623 seconds:

ERROR 1105 (HY000) at line 1:
minimum allocation cannot be admitted:
owner=join-spill
site=scatter-selected-or-codec
used=42872692992
limit=42949672960

Server evidence:

  • pipeline MPool reached 42949737400 bytes, approximately 40.0 GiB;
  • 169 minimum allocation cannot be admitted records were logged;
  • the failing owner/site was the join-spill scatter/codec path;
  • 27 follow-on context canceled records were logged;
  • MatrixOne did not panic or restart.

Expected behavior

The join-spill path should reserve enough bounded recovery/scatter capacity to spill admitted state and complete the supported TPC-DS query while honoring the hard process limit. It should not consume the full ceiling and then fail its own minimum recovery allocation.

Stability and controls

  • Reproducer: observed in one official full TPC-DS SF=1000 run; no manual rerun before filing.
  • Control: 84 of 99 queries completed successfully in the same run.
  • Failure state: MatrixOne stayed alive and later queries continued.

Evidence

  • Actions run/job linked above.
  • Exact generated SQL and query80.err are in the run's tpcds-result artifact.
  • Loki logs for host 10-222-1-129 show the allocation-admission series and MPool peak.

Code analysis

This is a join-spill allocation/reservation failure, distinct from the HashBuild budget error reported for query4/query64. The spill path reaches the process limit before reserving the minimum scatter-selected/codec allocation needed to make forward progress. The follow-on context cancellations are consequences, not the initiating error.

The workflow's intended GOMEMLIMIT was placed after command redirection and was not exported to mo-service; that infrastructure problem will be fixed separately. The error here is nevertheless MatrixOne's explicit query process-limit/spill-recovery failure at 40 GiB.

Regression coverage

Add large-data join-spill coverage for the query80 plan shape under a finite process limit. Assert query completion, result correctness, bounded peak memory, spill cleanup, and successful execution of a following statement.

Related

Activity

  1. added this to the MO-202608 milestone on Aug 6, 2026
  2. added
    kind/bug
    on Aug 6, 2026
  3. added theissue type on Aug 6, 2026
  4. self-assigned this
    on Aug 6, 2026
  5. self-assigned this
    on Aug 7, 2026
  6. removed their assignment
    on Aug 10, 2026
  7. assigned and unassigned on Oct 8, 2026
  8. Ariznawlll commented on Nov 16, 2026

    @Ariznawlll
    CollaboratorAuthor

    结论

    测试通过。兼容改写后的 Q80 在本次复测中三次正常完成,未复现原 issue 报错;按本次查询复测结果,原问题已解决。

    关键证据

    • 2026-11-16 在 129 单机、TPC-DS 1T 新导入并逐表核对的数据上,使用官方 main@4349e7321825639c0f9001e4271df278127060cf;processLimitationSize=42949672960(40 GiB),服务 MemoryMax=180 GiB。
    • 原 issue SQL 为兼容当前语法,将三处日期加法改为 DATE_ADD、派生表加别名、使用外层 ORDER BY ... LIMIT 100,并将三处字符串 || 改为 CONCAT。日期边界和相关 ID 列的 NULL/空字符串检查见测试产物,其中保留了 SQL 及哈希。
    • 三次验证分别耗时 19、18、19 秒,均正常返回;三次输出 SHA-256 均为 9bdeebba980e213903fbb141c6bee880e5bda2446b11dc1ee3a896c9fc5cb176。

    待解决点

    • 本次执行计划包含 shuffle join,但服务日志没有确认实际触发原报告中的 join-spill 路径;也没有独立结果正确性对照。结论针对兼容改写后 Q80 的实际复测,不代表已验证所有 spill 路径。
  9. Ariznawlll commented on Nov 17, 2026

    @Ariznawlll
    CollaboratorAuthor

    重新打开:此前关闭时没有已核实存在的对应 motr 用例 PR,不符合“先完成回归交付,再关闭”的要求。现恢复 Open;原验证证据与未覆盖边界保留,待补齐可核查的 motr 回归交付后再统一给出关闭结论。

  10. Ariznawlll commented on Nov 17, 2026

    @Ariznawlll
    CollaboratorAuthor

    补充专用环境 motr 草案(尚未验收,保持 OPEN)

    matrixorigin/motr#358 已加入原始 TPC-DS Q80 SQL 和专用环境场景草案:

    • script/14_issue_regression/issue_26744_query80.sql
    • script/14_issue_regression/issue_26744_tpcds_query80_join_spill.py

    该 PR 当前 OPEN、尚未合入,4 项离线 CI 通过;这不代表 #26744 已通过。草案没有通过 baseline,未配置专用环境时返回 77/SKIP,启用后参数、文件、断言或实际 spill 证据缺失必须失败。

    草案要求独立参考引擎的完整结果及 SF1000 数据身份,不能从同一 MatrixOne 基表重算相似查询充当独立 oracle;并要求原始 Q80 的 100 行结果、40 GiB 强制资源边界、实际 __spill 文件观察、spill 清理和后续查询。ROLLUP 行语义由独立结果完整比对,不假定固定尾部为 NULL;已移除没有依据的 SIGUSR1 探针,保留的 signal 0 只检查进程存在。

    当前仍未完成真实 SF1000+40 GiB 强制边界+实际 join-spill 的验收,也未验收 Linux RLIMIT_AS/macOS resource receipt 协议。因此本 issue 继续保持 OPEN,不以草案或 SKIP 作为通过证明。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions