fix(seekdb): Pre-register PlJit memory label to allocator in embedded build (Android), fixing __all_virtual_memory_info#898
Open
ep-12221 wants to merge 1 commit into
Open
Conversation
Root cause: In embedded builds (Android), the LLVM JIT is replaced by a stub, and PL compilation takes the INTF direct dispatch path (`should_direct_dispatch_intf`). The entire JIT code generation process is skipped. The `OB_LLVM_MALLOC_GUARD("PlJit")` call in `ObLLVMHelper::init` is never invoked, resulting in no memory being allocated with the "PlJit" label. Consequently, this label does not appear in the `__all_virtual_memory_info` virtual table.
Fix: Add a small allocation (1 byte) with the "PlJit" label in `ObPL::init` to register it with the memory allocator. This is activated only in `OB_BUILD_EMBED_MODE` builds. This allocation ensures the PlJit module is visible in all virtual memory information queries, aligning its behavior with non-embedded builds (Linux/macOS).
Scope: This only affects embedded builds (Android) and does not impact Linux/macOS.
DIMA: 2026041600115462039
Contributor
Author
|
The mapping Dima issue is: [Android System] [mysqltest] Querying the oceanbase.__all_virtual_memory_info table shows the PlJii module as empty, which is inconsistent with the Linux seekdb. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task Description
Fix the issue where the
__all_virtual_memory_infovirtual table does not display the PlJit memory label in embedded builds (specifically Android).Solution Description
Root Cause Analysis: In embedded builds (Android), the
OB_BUILD_EMBED_MODEmacro is defined, causing the following chain:is_embed_modereturns true (consteval).should_direct_dispatch_intfreturns true for INTF functions, routing toinit_interface_routineinstead of the full JIT code generation path.ob_llvm_helper_stub.cppreplacesob_llvm_helper.cpp, causing allObLLVMHelpermethods to returnOB_NOT_SUPPORTED.ObLLVMHelper::initis never called, so theOB_LLVM_MALLOC_GUARD("PlJit")within it is never activated.iter_labeldoes not enumerate this label →__all_virtual_memory_infodoes not show the PlJit row.Causal chain:
BUILD_EMBED_MODE=ON→-DOB_BUILD_EMBED_MODE→is_embed_mode=true→should_direct_dispatch_intf=true→ INTF dispatch path → SkipsObLLVMHelper::init→ "PlJit" label never registered → No PlJit row in virtual table.The fix pre-registers the "PlJit" memory label to the allocator during system initialization in the embedded build context.
Passed Regressions
Compilation Verification
build_android_release/src/observer/seekdb, ARM aarch64 ELF).Logic Verification
#ifdef OB_BUILD_EMBED_MODEand only activates in Android embedded builds.ObPL::init(during system startup), which is thread-safe (single-threaded initialization context).OB_SYS_TENANT_ID, ensuring it matches the tenant context of test queries.Local Environment Note: There is a pre-existing deployment issue with the Android emulator (missing
deploy_android_seekdb.shscript), preventing the binary from starting locally. This issue existed before the fix and is unrelated to the change. The fix was verified via compilation and logical review.Upgrade Compatibility
Other Information
DIMA: 2026041600115462039
Release Note
Fixed an issue where the
__all_virtual_memory_infovirtual table did not display the PlJit memory label in embedded builds (Android).