Skip to content

[seekdb][memory] Add main memory module statistics view - #1306

Open
hnwyllmm wants to merge 1 commit into
masterfrom
task/2026081400118235536
Open

[seekdb][memory] Add main memory module statistics view#1306
hnwyllmm wants to merge 1 commit into
masterfrom
task/2026081400118235536

Conversation

@hnwyllmm

Copy link
Copy Markdown
Member

Task Description

Existing __all_virtual_memory_info / V$OB_MEMORY rely on obmalloc label statistics, making it impossible to intuitively display the memory usage and limits of main modules after obmalloc is removed.

MySQL [oceanbase]> select * from v$ob_memory order by hold desc;
+--------------+-----------+----------+-------------+
| MOD_NAME | HOLD | USED | MEM_LIMIT |
+--------------+-----------+----------+-------------+
| KV_CACHE | 216156320 | 5673024 | 37006867660 |
| PLAN_CACHE | 24867761 | 24867761 | 42949672 |
| MEMSTORE | 20798160 | 20798160 | 1717986918 |
| STORAGE_META | 3416704 | 3147984 | NULL |
| TX_DATA | 2284736 | 2284736 | 858993459 |
| SCHEMA | 2079744 | 1257680 | NULL |
| PS_CACHE | 589872 | 589872 | 21474836 |
| MDS | 476160 | 476160 | 429496729 |
| VECTOR | 2624 | 2624 | 1717986918 |
| SQL_WORKAREA | 0 | 0 | 107374180 |
| DTL | 0 | 0 | NULL |
| TMP_FILE | 0 | 0 | 43524096 |
+--------------+-----------+----------+-------------+
12 rows in set (0.005 sec)

Solution Description

Adjusted __all_virtual_memory_info and V$OB_MEMORY to have four columns: MOD_NAME, HOLD, USED, MEM_LIMIT, fixed to aggregate 12 modules: KV Cache, Plan/PS Cache, MemStore, TX_DATA, MDS, Storage Meta, Schema, Vector, SQL Workarea, DTL, and Tmp File. Added a narrow-scope module getter, preserving the native statistical scope of each module. Modules without a valid limit return NULL, and no default ordering is provided. Migrated existing tests/golden files and cleaned up isolated results and assertions that depended on the old label statistics.

Passed Regressions

  • ob-make ob_server
  • CARGO_NET_OFFLINE=true ob-make seekdb
  • New binary isolated instance verification: 12 rows with unique module names, HOLD >= USED >= 0, MEM_LIMIT NULL rules correct
  • Passed 30 consecutive aggregation self-checks
  • PS_CACHE cross-checked with __all_virtual_ps_stat is consistent
  • No new dedicated mysqltest added; mysqltest was not run locally

Upgrade Compatibility

Directly replaces the old obmalloc virtual table contract, deleting old fields like ctx/label/count. Queries dependent on the old fields need to migrate to the new four-column module aggregation interface.

Other Information

This MR only contains commit 03a64f8fa00; 2 untracked files are not within the review scope. V$OB_MEMORY does not guarantee a default row order.

Release Note

@hnwyllmm

Copy link
Copy Markdown
Member Author

The mapping Dima issue is to add memory statistics views for each major memory module.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant