Skip to content

feat(memory): expose module memory statistics - #1350

Open
wangyunlai-seekdb wants to merge 3 commits into
oceanbase:masterfrom
wangyunlai-seekdb:codex/memory-view-module-statistics
Open

feat(memory): expose module memory statistics#1350
wangyunlai-seekdb wants to merge 3 commits into
oceanbase:masterfrom
wangyunlai-seekdb:codex/memory-view-module-statistics

Conversation

@wangyunlai-seekdb

@wangyunlai-seekdb wangyunlai-seekdb commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • replace the obmalloc-oriented __all_virtual_memory_info contract with module-level MOD_NAME, HOLD, USED, and MEM_LIMIT statistics
  • expose 12 module rows, including DTL, TMP_FILE, PS_CACHE, TX_DATA, and MDS, through module-owned memory getters
  • report Vector memory through ObSharedMemAllocMgr::get_vector_memory_info() so the virtual table follows the module's native accounting
  • remove the implicit ORDER BY HOLD DESC from V$OB_MEMORY
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)

Migration notes

This PR migrates the product-code changes from internal GitLab MR !1115.

The GitHub repository does not contain the internal VOSTest files or the plan_cache/ps/px/time_zone mysqltest files changed by the source MR, so those deleted upstream-only test paths were not reintroduced here. Existing GitHub inner-table golden files were updated where applicable.

Validation

  • ob-make ob_server
  • CARGO_NET_OFFLINE=true ob-make seekdb

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Replaces allocator-level memory reporting with fixed module-level statistics exposed through V$OB_MEMORY.

Changes:

  • Adds memory getters and 12 module statistics.
  • Redefines the virtual table/view schema.
  • Updates dependent tests and golden results.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tools/obtest/t/storage/slog_checkpoint_restart.test Removes obsolete memory-label check.
tools/obtest/t/sql/group_concat_memory_eatup.test Removes allocator-label accounting check.
tools/obtest/t/sql/count_distinct_memory_eatup.test Removes allocator-label accounting checks.
tools/obtest/t/quick/minor_freeze_and_restart.test Removes obsolete restart check.
tools/obtest/t/quick/include/restart_cluster.inc Removes obsolete shared restart check.
tools/obtest/t/join/nestloop_join_occupy_too_much_memory.test Removes label-based memory checks.
tools/obtest/r/storage/slog_checkpoint_restart.result Updates expected restart output.
tools/obtest/r/sql/group_concat_memory_eatup.result Updates expected SQL output.
tools/obtest/r/sql/count_distinct_memory_eatup.result Updates expected SQL output.
tools/obtest/r/quick/minor_freeze_and_restart.result Updates expected restart output.
tools/obtest/r/quick/basic_function_standalone.result Updates included restart output.
tools/obtest/r/quick/basic_function_lite.result Updates included restart output.
tools/obtest/r/join/nestloop_join_occupy_too_much_memory.result Removes obsolete memory results.
tools/obtest/r/join/explain_bug.result Updates virtual-table metadata.
tools/deploy/mysql_test/test_suite/inner_table/r/mysql/show_sys_tables_in_sys.result Updates inner-table schema golden.
tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_sys_views_in_sys.result Updates system-view description.
tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_sys_views_in_mysql.result Updates MySQL view description.
tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_sys_views_in_mysql_when_compare_sensitive.result Updates case-sensitive golden.
src/storage/tmp_file/ob_tmp_file_write_buffer_pool.h Declares TMP_FILE memory getter.
src/storage/tmp_file/ob_tmp_file_write_buffer_pool.cpp Implements TMP_FILE statistics.
src/storage/allocator/ob_shared_memory_allocator_mgr.h Declares shared allocator getters.
src/storage/allocator/ob_shared_memory_allocator_mgr.cpp Implements TX_DATA, MDS, and VECTOR statistics.
src/sql/plan_cache/ob_ps_cache.h Declares PS cache memory getter.
src/sql/plan_cache/ob_ps_cache.cpp Implements PS cache statistics.
src/sql/dtl/ob_dtl_fc_server.h Declares DTL memory getter.
src/sql/dtl/ob_dtl_fc_server.cpp Implements DTL statistics.
src/share/inner_table/ob_inner_table_schema_def.py Redefines the table and view schema.
src/observer/virtual_table/ob_all_virtual_memory_info.h Defines the new module-row interface.
src/observer/virtual_table/ob_all_virtual_memory_info.cpp Collects and exposes the 12 module rows.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/storage/allocator/ob_shared_memory_allocator_mgr.cpp
@hnwyllmm
hnwyllmm requested a review from footka September 1, 2026 04:07
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.

2 participants