Skip to content

Optimize Named Locks by Removing __all_dbms_lock_allocated Persistence - #1338

Open
Mai-icy wants to merge 12 commits into
oceanbase:masterfrom
Mai-icy:migrate/gitlab-mr-1089-task-2026072800117800650
Open

Optimize Named Locks by Removing __all_dbms_lock_allocated Persistence#1338
Mai-icy wants to merge 12 commits into
oceanbase:masterfrom
Mai-icy:migrate/gitlab-mr-1089-task-2026072800117800650

Conversation

@Mai-icy

@Mai-icy Mai-icy commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Task Description

Migrate oceanbase/oceanbase-lite!1089 to SeekDB.

The change removes persistence through __all_dbms_lock_allocated and keeps MySQL named-lock state in memory.

Solution Description

  • Keep MySQL named locks in the in-memory named-lock manager.
  • Update session cleanup and reset-connection handling.
  • Expose named locks and their object names through the virtual object-lock view.
  • Preserve named-lock cleanup errors.
  • Remove obsolete named-lock inner-table helpers and storage inventory entries.

Passed Regressions

  • git diff --check upstream/master...HEAD
  • Full compilation and regression testing have not yet been run on the migrated branch.

The original MR updated mysqltest coverage. Five legacy mysqltest files no longer exist on the current GitHub master, so their changes were not reintroduced:

  • tools/deploy/mysql_test/r/mysql/simple_ddl.result
  • tools/deploy/mysql_test/test_suite/table_lock/r/mysql/lock_func_basic.result
  • tools/deploy/mysql_test/test_suite/table_lock/t/lock_func_basic.test
  • tools/deploy/mysql_test/test_suite/view/r/mysql/cdb_objects.ce.result
  • tools/deploy/mysql_test/test_suite/view/r/mysql/cdb_objects.result

Updates to the two test-result files still present in SeekDB were migrated.

Upgrade Compatibility

This changes named-lock state from inner-table persistence to in-memory runtime state. Upgrade and restart behavior should be reviewed before merge.

Other Information

  • Original GitLab MR: oceanbase/oceanbase-lite!1089
  • Original source branch: task/2026072800117800650
  • Original GitLab tip: 1d7f1b4bf05a287147da020de12049dfd249176f
  • The seven original commits were transplanted in order onto the latest oceanbase/seekdb:master; authorship and commit messages were preserved.
  • GitLab and GitHub use unrelated Git histories, so commit SHAs changed during migration.

Release Note

Manage MySQL named locks in memory, expose them through the virtual object-lock view, and remove obsolete __all_dbms_lock_allocated persistence helpers.

@CLAassistant

CLAassistant commented Aug 28, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@Mai-icy
Mai-icy marked this pull request as ready for review August 28, 2026 10:02
@Mai-icy
Mai-icy force-pushed the migrate/gitlab-mr-1089-task-2026072800117800650 branch from 8bd90d4 to a63953f Compare August 31, 2026 02:32
@hnwyllmm
hnwyllmm requested a balanced review from Copilot August 31, 2026 03:23

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

Moves MySQL named locks from inner-table persistence to a server-local in-memory manager.

Changes:

  • Adds in-memory acquisition, release, timeout, deadlock, and cleanup handling.
  • Exposes named locks through the virtual object-lock view.
  • Removes obsolete persistence schema and helpers.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
unittest/storage/transaction/tablelock/test_named_lock_manager.cpp Tests manager behavior.
tools/deploy/mysql_test/test_suite/inner_table/r/mysql/show_sys_tables_in_sys.result Updates expected schemas.
src/storage/tablelock/ob_table_lock_service.h Owns the manager.
src/storage/tablelock/ob_table_lock_service.cpp Manages its lifecycle.
src/storage/tablelock/ob_table_lock_live_detector.h Splits cleanup APIs.
src/storage/tablelock/ob_table_lock_live_detector.cpp Updates cleanup implementation.
src/storage/tablelock/ob_session_table_lock.cpp Adds in-memory lock operations.
src/storage/tablelock/ob_named_lock_manager.h Defines the manager.
src/storage/tablelock/ob_named_lock_manager.cpp Implements locking and deadlock detection.
src/storage/storage_source_inventory.bzl Registers the source.
src/storage/storage_header_inventory.bzl Registers the header.
src/sql/tablelock/ob_lock_func_executor.h Removes persistence helpers.
src/sql/tablelock/ob_lock_func_executor.cpp Routes SQL functions in memory.
src/sql/tablelock/ob_lock_executor.h Removes obsolete APIs.
src/sql/tablelock/ob_lock_executor.cpp Removes inner-table lookups.
src/sql/session/ob_sql_session_info.cpp Cleans locks on disconnect.
src/share/inner_table/ob_inner_table_schema_def.py Removes the table and adds obj_name.
src/observer/virtual_table/ob_all_virtual_obj_lock.h Adds snapshot state.
src/observer/virtual_table/ob_all_virtual_obj_lock.cpp Emits named-lock rows.
src/observer/mysql/obmp_reset_connection.cpp Cleans locks on reset.
src/data_plane/api/data_plane/tablelock/ob_session_table_lock.h Updates the data-plane API.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/storage/tablelock/ob_named_lock_manager.cpp Outdated
Comment thread src/observer/virtual_table/ob_all_virtual_obj_lock.cpp Outdated
Comment thread unittest/storage/transaction/tablelock/test_named_lock_manager.cpp Outdated
Comment thread src/storage/tablelock/ob_named_lock_manager.cpp Outdated
@Mai-icy
Mai-icy force-pushed the migrate/gitlab-mr-1089-task-2026072800117800650 branch 3 times, most recently from 234cda0 to 2248b03 Compare August 31, 2026 08:04

@wangyunlai-seekdb wangyunlai-seekdb 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.

Three Major findings remain at the current PR head: connection reset can retain table locks, mixed named/table wait cycles escape deadlock detection, and the new test suite is not wired into a runnable target.

Comment thread src/observer/mysql/obmp_reset_connection.cpp Outdated
Comment thread src/storage/tablelock/ob_named_lock_manager.cpp Outdated
Comment thread unittest/storage/transaction/tablelock/test_named_lock_manager.cpp Outdated
@Mai-icy
Mai-icy force-pushed the migrate/gitlab-mr-1089-task-2026072800117800650 branch from 3a3fe43 to 7d8849f Compare September 3, 2026 08:54
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.

5 participants