Skip to content

feat: Add C ABI for embedded seekdb (multi‑language SDKs)#674

Open
dengfuping wants to merge 141 commits into
masterfrom
feat/embedded-mode
Open

feat: Add C ABI for embedded seekdb (multi‑language SDKs)#674
dengfuping wants to merge 141 commits into
masterfrom
feat/embedded-mode

Conversation

@dengfuping

Copy link
Copy Markdown
Collaborator

Task Description

Solution Description

  • Architecture Design:
Language Bindings (Node.js, Python, Rust, Go)
           │
           ▼
    SeekDB C ABI (seekdb.h/seekdb.cpp)
           │
           ▼
    OceanBase Core (liboceanbase.so)
  • Source Code Directory (src/include/)
src/include/
├── seekdb.h                          # Public C API header file
│                                     # - All function declarations
│                                     # - Type definitions (SeekdbHandle, SeekdbResult, etc.)
│                                     # - Data structures (SeekdbBind, SeekdbField)
│                                     # - MySQL C API compatible interface
│
├── seekdb.cpp                        # C ABI implementation (~4800 lines)
│                                     # - Global initialization (seekdb_open/close)
│                                     # - Connection management
│                                     # - Query execution & Result set operations
│                                     # - Prepared Statement API
│                                     # - Signal handling & Stack management
│
├── CMakeLists.txt                    # Build configuration for libseekdb.so

Test Directory (unittest/include/)

unittest/include/
├── test_seekdb.cpp                   # C++ unit test suite (comprehensive)
│                                     # - Tests all C API functions directly
│                                     # - Complete API coverage
│
├── nodejs/                           # Node.js FFI binding (koffi)
│   ├── seekdb.js                    # FFI wrapper
│   ├── test.js                      # Test suite
│   └── test.sh                      # Test execution script
│
├── nodejs_napi/                      # Node.js N-API binding (native addon)
│   ├── seekdb.cpp                   # N-API C++ implementation
│   ├── test.js                      # Test suite
│   └── test.sh                      # Test execution script
│
├── python/                           # Python binding (ctypes)
│   ├── seekdb.py                    # FFI wrapper
│   ├── test.py                      # Test suite
│   └── test.sh                      # Test execution script
│
├── rust/                             # Rust FFI binding
│   ├── src/
│   │   ├── lib.rs                   # FFI bindings
│   │   └── test.rs                  # Test suite
│   └── test.sh                      # Test execution script
│
└── go/                               # Go binding (cgo)
    ├── seekdb/seekdb.go              # FFI wrapper
    ├── test.go                       # Test suite
    └── test.sh                       # Test execution script

Passed Regressions

  • Unittest
  • Node.js FFI bindings
  • Node.js N-API bindings
  • Python FFI bindings
  • Go FFI bindings
  • Rust FFI bindings

Build and test:

# build libseekdb library
./build.sh release --init -DBUILD_EMBED_MODE=ON --make

# unittest
make -j$(nproc) test_seekdb
cd build_release/unittest/include && ./test_seekdb

# bindings test
cd unittest/include/nodejs && bash ./test.sh
cd unittest/include/nodejs_napi && bash ./test.sh
cd unittest/include/python && bash ./test.sh
cd unittest/include/go && bash ./test.sh
cd unittest/include/rust && bash ./test.sh

Upgrade Compatibility

  • Compatible

Other Information

Release Note

  • 🆕 Add C ABI for embedded seekdb (multi‑language SDKs).

…ix MTL_SWITCH namespace; remove §7/doc refs

- C ABI: row_nulls for NULL vs empty; read_lob_data for TEXT/JSON LOB; MTL_SWITCH(OB_SYS_TENANT_ID) for ObLobManager; namespace share alias for MTL_SWITCH
- test: 100KB LONGTEXT via SET SESSION ob_default_lob_inrow_threshold=262144, no table option; special chars metadata test; remove §7 and c-abi-modification-reference references from comments and error messages
- Add LOB read paths for TEXT/JSON columns in result row serialization
- Use print_sql_literal for ObJsonType cells and expand buffer to 32KB
- Add col_is_metadata heuristic: write "{}" for empty metadata in fallback paths
- Add unit tests: very long document (100KB), special chars in metadata, empty JSON metadata
- macOS: put ccache in deps devtools/bin so Env.cmake finds it without code change
- Linux: install base deps (incl. wget) first so dep_create.sh can download RPMs
- Linux: try EPEL+ccache; use OB_USE_CCACHE=OFF when ccache not available in container
…cOS cross-build arch

- Checkout PR head ref instead of merge ref to avoid conflict markers in CI
- Restore darwin-x64 job (cross-compile on Apple Silicon for Intel Mac)
- Env.cmake: use CMAKE_OSX_ARCHITECTURES for ARCHITECTURE on macOS x86_64 cross-build
So next push can restore cache and avoid full rebuild from scratch.
- workflow: cd to GITHUB_WORKSPACE/package/libseekdb for Linux pack (was relative to build_release)
- zlib_lite: build QPL only on x86_64 Linux (NOT APPLE); macOS deps do not ship qpl
dengfuping added 30 commits May 25, 2026 14:52
…paths

The C ABI execute path in `do_seekdb_execute_update_inner` was overwriting
the real OB error code/message with a generic "Update execution failed",
making it impossible to diagnose Windows embedded test failures from CI
logs. The query path already extracts errors from the warning buffer; do
the same for the update path, and append the numeric ret code to both
paths so logs always carry the OB error number even when the message is
non-empty.
…paths

The C ABI execute path in `do_seekdb_execute_update_inner` was overwriting
the real OB error code/message with a generic "Update execution failed",
making it impossible to diagnose Windows embedded test failures from CI
logs. The query path already extracts errors from the warning buffer; do
the same for the update path, and append the numeric ret code to both
paths so logs always carry the OB error number even when the message is
non-empty.
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