)]}'
{
  "commit": "a701e06b1084275d01e7c2a2e1c331c43be1433d",
  "tree": "6794c1e848751f57082371a04ca48533a3c373d5",
  "parents": [
    "abb49c4536f9bbc5501431fae6935268aa9f1387"
  ],
  "author": {
    "name": "Mingyu Chen (Rayner)",
    "email": "morningman.cmy@gmail.com",
    "time": "Thu Sep 10 10:14:24 2026 +0800"
  },
  "committer": {
    "name": "yiguolei",
    "email": "guolei@selectdb.com",
    "time": "Thu Sep 10 10:36:09 2026 +0800"
  },
  "message": "branch-4.1: [fix](regression) Deflake the sql cache regression suites #67734 (#67735)\n\n### What problem does this PR solve?\n\nIssue Number: close #xxx\n\nRelated PR: #67734, #67529\n\nProblem Summary:\n\nTwo flaky sql cache suites on branch-4.1. Both fail the same way — a sql\ncache entry\nthat was primed a moment earlier is gone by the time it is asserted —\nand both were red\ntogether in p0 build 124525 (`5657 passed / 2 failed`; no crash, no OOM,\nunrelated to\nthe PR that build was testing).\n\n**Root cause.** The FE sql cache is a single Caffeine map shared by\nevery session\n(`NereidsSqlCacheManager.sqlCaches`), bounded by\n`Config.sql_cache_manage_num`, which\ndefaults to **100**. Caffeine admits a newcomer through a window sized\nat **1% of that\nbound**, so at the default the admission window holds a single entry and\na just cached\nstatement is dropped as soon as any other session caches anything.\n`SessionVariable.enableSqlCache` defaults to `true`, so the rest of the\np0 suite running\nconcurrently against the same FE is enough. Ordinary LRU pressure is\nruled out: only 15\ndistinct selects ran cluster wide during the 299ms window in which the\nflight suite lost\nits entry. Verified against caffeine 3.2.4:\n\n```\nmaximumSize\u003d100      1 other insert after mine -\u003e survived  7/20\nmaximumSize\u003d10000    1 other insert after mine -\u003e survived 20/20\n```\n\nThis is not an FE bug — the cache is best effort and gives no retention\nguarantee.\n\n### Changes\n\n**1. `arrow_flight_sql_p0/test_sql_cache_over_arrow_flight`** —\ncherry-picked from\n#67734. Raise `sql_cache_manage_num` while the suite runs, as the other\nfive sql cache\nsuites (`mv_with_sql_cache`, `mtmv_with_sql_cache`,\n`parse_sql_from_sql_cache`,\n`union_all_compensate`, `union_rewrite_grace_big`) already do, and\nrestore it afterwards\nso the rest of the run does not keep 10000 cached plans alive in the FE\nheap. This suite\nis identical on master and branch-4.1 and has failed on both.\n\n**2. `query_p0/cache/sql_cache_object_type`** — picks up the hunk that\nthe #67556\nbackport missed. Master fixed this in #67529 on 2026-09-04 by replacing\nthe closing\n`assertTrue(hasSqlCache(objectSql))` with a re-prime, but #67556\nbackported the original\n#67381 version of the file, so branch-4.1 kept the fragile assertion. It\nhas failed **18\ntimes on branch-4.1 since 2026-09-02** and is currently **muted** in\nTeamCity; the three\nmost recent failures were all branch-4.1 PRs. After this change the file\nis byte\nidentical to master again.\n\n**The TeamCity mute on\n`query_p0.cache.sql_cache_object_type.sql_cache_object_type`\nshould be removed once this lands.**\n\n### Release note\n\nNone\n\n### Check List (For Author)\n\n- Test\n    - [x] Regression test\n    - [ ] Unit Test\n    - [ ] Manual test (add detailed scripts or steps below)\n    - [ ] No need to test or manual test. Explain why:\n- [ ] This is a refactor/code format and no logic has been changed.\n        - [ ] Previous test can cover this change.\n        - [ ] No code files have been changed.\n        - [ ] Other reason\n\n- Behavior changed:\n    - [x] No.\n    - [ ] Yes.\n\n- Does this need documentation?\n    - [x] No.\n    - [ ] Yes.\n\n### Check List (For Reviewer who merge this PR)\n\n- [ ] Confirm the release note\n- [ ] Confirm test cases\n- [ ] Confirm document\n- [ ] Add branch pick label\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n\nhttps://claude.ai/code/session_01Njd8iDxdqc19QbLdNtZ7Pt\n\nCo-authored-by: Claude Opus 5 (1M context) \u003cnoreply@anthropic.com\u003e",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "577665b275b47df6117167fda1296f323f72493c",
      "old_mode": 33188,
      "old_path": "regression-test/suites/arrow_flight_sql_p0/test_sql_cache_over_arrow_flight.groovy",
      "new_id": "a3fb39d38d9a60f9402f345087d8f487062a9cd7",
      "new_mode": 33188,
      "new_path": "regression-test/suites/arrow_flight_sql_p0/test_sql_cache_over_arrow_flight.groovy"
    },
    {
      "type": "modify",
      "old_id": "6300840d20ffdfb66004861e5473f9d4932124ec",
      "old_mode": 33188,
      "old_path": "regression-test/suites/query_p0/cache/sql_cache_object_type.groovy",
      "new_id": "4e2520e70c516ca354af761353080b6eeede6452",
      "new_mode": 33188,
      "new_path": "regression-test/suites/query_p0/cache/sql_cache_object_type.groovy"
    }
  ]
}
