Repository navigation
fix: support current seekdb embedded binding #264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cms-cms
wants to merge
26
commits into
oceanbase:develop
Choose a base branch
from
cms-cms:codex/embedded-fulltext-stability
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
abab612
test: cover embedded fulltext first pass and memtable release
cms-cms d85e947
test: prioritize failure traces and stabilize fake scan scheduling
cms-cms 4a5d0d0
ci: verify embedded regression with a pinned fixed source wheel
cms-cms 0b8cbff
ci: capture SeekDB revision from stderr
cms-cms 257f99a
ci: stabilize default embedding model downloads
cms-cms 12386ee
Merge remote-tracking branch 'origin/develop' into codex/embedded-ful…
cms-cms d8d4038
test: make embedding dependencies deterministic
cms-cms 477e07c
test: allow sparse fallback output override
cms-cms ec16471
ci: validate embedded tests with fork timeout fix
cms-cms 19a26a5
ci: validate embedded fork with ddl deadline fix
cms-cms 8bdee2a
fix: prefer source-built seekdb runtime
cms-cms 171c4f3
ci: validate embedded tests with latest seekdb fix
cms-cms c874667
ci: validate embedded tests with combined seekdb fixes
cms-cms aa70f53
refactor: keep pyseekdb pr product-only
cms-cms 9eabb42
test: cover embedded fulltext stability
cms-cms 6bf8473
ci: test embedded regressions with fixed seekdb runtime
cms-cms 458e592
ci: validate fork fix from updated seekdb source
cms-cms fa94bb0
ci: retain embedded diagnostics on failure
cms-cms 695fb15
ci: capture embedded diagnostics for fork analysis
cms-cms 5dfa29d
ci: validate active transaction fork fix
cms-cms 57da5af
ci: validate latest seekdb fork fix
cms-cms 40bc236
ci: validate complete seekdb fork fix
cms-cms 8c581ce
ci: validate open-transaction fork fix
cms-cms d3efb1b
ci: validate committed-log fork watermark
cms-cms 62c5a21
ci: validate fork pre-drain ordering
cms-cms d6f71e5
test: detect current embedded seekdb runtime
cms-cms File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "seekdb_repository": "https://github.com/cms-cms/seekdb.git", | ||
| "seekdb_sha": "b255464c3df78d1b8f769bcb71448e5737940fcc", | ||
| "bindings_sha": "5e8eece63205dccfa9500f98893c91d1f50eb4f1", | ||
| "fix_commit": "48b80f5193bcac0afafba4d4820aebdf1103bc69", | ||
| "platform": "linux-x86_64", | ||
| "python": "3.11" | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| #!/usr/bin/env bash | ||
| # CI-local Linux wheel: not a portable manylinux release or a PyPI publication. | ||
| set -Eeuo pipefail | ||
| REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" | ||
| : "${RUNNER_TEMP:?use an isolated GitHub runner temporary directory}" | ||
| : "${EMBEDDED_WHEEL_DIR:?wheel output/cache directory is required}" | ||
| [[ "$(uname -s)/$(uname -m)" == Linux/x86_64 ]] | ||
| PYTHON="$(command -v python3)" | ||
| "$PYTHON" -c 'import sys; assert sys.version_info[:2] == (3, 11)' | ||
| read -r SEEKDB_REPOSITORY SEEKDB_SHA BINDINGS_SHA FIX_COMMIT < <( | ||
| "$PYTHON" -c 'import json, sys; p=json.load(open(sys.argv[1])); print(p["seekdb_repository"], p["seekdb_sha"], p["bindings_sha"], p["fix_commit"])' \ | ||
| "$REPO_ROOT/.github/embedded-source.json" | ||
| ) | ||
| [[ "$SEEKDB_REPOSITORY" == "https://github.com/cms-cms/seekdb.git" ]] | ||
| [[ "$SEEKDB_SHA" =~ ^[0-9a-f]{40}$ && "$BINDINGS_SHA" =~ ^[0-9a-f]{40}$ && "$FIX_COMMIT" =~ ^[0-9a-f]{40}$ ]] | ||
| BUILD_ROOT="$(mktemp -d "$RUNNER_TEMP/embedded-source.XXXXXX")" | ||
| mkdir -p "$EMBEDDED_WHEEL_DIR" | ||
| [[ -z "$(ls -A "$EMBEDDED_WHEEL_DIR")" ]] || { echo 'refusing to overwrite wheel evidence' >&2; exit 1; } | ||
|
|
||
| checkout_exact() { | ||
| local repository="$1" revision="$2" target="$3" | ||
| git init -q "$target" | ||
| git -C "$target" remote add origin "$repository" | ||
| git -C "$target" config remote.origin.promisor true | ||
| git -C "$target" config remote.origin.partialclonefilter blob:none | ||
| # Full ancestry is needed to prove the kernel contains the required fix. | ||
| # Historical source blobs are not: fetch them lazily for the exact checkout. | ||
| git -C "$target" fetch --filter=blob:none --no-tags origin "$revision" | ||
| git -C "$target" checkout --detach FETCH_HEAD | ||
| [[ "$(git -C "$target" rev-parse HEAD)" == "$revision" ]] | ||
| } | ||
| checkout_exact "$SEEKDB_REPOSITORY" "$SEEKDB_SHA" "$BUILD_ROOT/seekdb" | ||
| git -C "$BUILD_ROOT/seekdb" merge-base --is-ancestor "$FIX_COMMIT" HEAD | ||
| checkout_exact https://github.com/oceanbase/seekdb-bindings.git "$BINDINGS_SHA" "$BUILD_ROOT/bindings" | ||
| git -C "$BUILD_ROOT/bindings" submodule update --init --depth=1 deps/mariadb-connector-c | ||
|
|
||
| # Match the upstream seekdb-bindings Ubuntu source-build recipe. These are | ||
| # packaging/client tools, not dependencies of the seekdb compilation target. | ||
| DEP_PROFILE="$BUILD_ROOT/seekdb/deps/init/oceanbase.el9.x86_64.deps" | ||
| sed -i -E '/^[^#]*(target=(obshell|obdeploy)|(lib)?obclient-)/d' "$DEP_PROFILE" | ||
|
|
||
| # Install the source's exact Rust toolchain once, before parallel compilation; | ||
| # never let two Rust targets race while auto-installing the same components. | ||
| RUST_TOOLCHAIN="$("$PYTHON" -c 'import sys,tomllib; print(tomllib.load(open(sys.argv[1],"rb"))["toolchain"]["channel"])' \ | ||
| "$BUILD_ROOT/seekdb/rust/rust-toolchain.toml")" | ||
| [[ "$RUST_TOOLCHAIN" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] | ||
| export RUSTUP_HOME="$BUILD_ROOT/rustup" CARGO_HOME="$BUILD_ROOT/cargo" | ||
| rustup toolchain install "$RUST_TOOLCHAIN" --profile minimal --no-self-update | ||
| export RUSTUP_TOOLCHAIN="$RUST_TOOLCHAIN" RUSTUP_AUTO_INSTALL=0 | ||
| rustup run "$RUST_TOOLCHAIN" cargo --version | ||
| BUILD_JOBS="$(nproc)" | ||
| (( BUILD_JOBS <= 3 )) || BUILD_JOBS=3 | ||
| MEMORY_JOBS="$(awk '/MemTotal:/ {n=int(($2/1024-3072)/4096); print (n>0?n:1)}' /proc/meminfo)" | ||
| (( BUILD_JOBS <= MEMORY_JOBS )) || BUILD_JOBS="$MEMORY_JOBS" | ||
| export CMAKE_BUILD_PARALLEL_LEVEL="$BUILD_JOBS" CARGO_BUILD_JOBS="$BUILD_JOBS" | ||
| ( | ||
| cd "$BUILD_ROOT/seekdb" | ||
| ./build.sh release --init -DBUILD_EMBED_MODE=ON --make -j"$BUILD_JOBS" | ||
| ) | ||
| mapfile -t binaries < <(find "$BUILD_ROOT/seekdb/build_release" -type f -name seekdb -executable) | ||
| [[ "${#binaries[@]}" == 1 ]] | ||
| SEEKDB_BIN="${binaries[0]}" | ||
| strip --strip-debug --strip-unneeded "$SEEKDB_BIN" | ||
| "$SEEKDB_BIN" -V 2>&1 | tee "$EMBEDDED_WHEEL_DIR/seekdb-version.txt" | ||
| grep -F "$SEEKDB_SHA" "$EMBEDDED_WHEEL_DIR/seekdb-version.txt" | ||
|
|
||
| # Do not call the upstream wheel target (it selects an unqualified `python`). | ||
| # Build only the driver, then build a CPython 3.11 wheel with this exact venv. | ||
| "$PYTHON" -m venv "$BUILD_ROOT/venv" | ||
| BUILD_PYTHON="$BUILD_ROOT/venv/bin/python" | ||
| "$BUILD_PYTHON" -m pip install --disable-pip-version-check \ | ||
| 'pip==25.3' 'build==1.3.0' 'cmake==3.31.6' 'nanobind==3.0.0' 'scikit-build-core==0.11.6' 'ninja==1.11.1.4' | ||
| export PATH="$BUILD_ROOT/venv/bin:$PATH" | ||
| cmake -S "$BUILD_ROOT/bindings" -B "$BUILD_ROOT/bindings/build" \ | ||
| -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DSEEKDB_BUILD_PYTHON=OFF \ | ||
| -DSEEKDB_BIN="$SEEKDB_BIN" | ||
| cmake --build "$BUILD_ROOT/bindings/build" --target seekdb --parallel "$BUILD_JOBS" | ||
| "$BUILD_PYTHON" -m pip wheel --no-deps --no-build-isolation \ | ||
| --config-settings="cmake.define.Python_EXECUTABLE=$BUILD_PYTHON" \ | ||
| --config-settings="cmake.define.Python_FIND_VIRTUALENV=ONLY" \ | ||
| --wheel-dir "$EMBEDDED_WHEEL_DIR" "$BUILD_ROOT/bindings/python" | ||
| "$PYTHON" "$REPO_ROOT/.github/scripts/embedded_wheel_manifest.py" create \ | ||
| "$REPO_ROOT/.github/embedded-source.json" "$EMBEDDED_WHEEL_DIR" "$SEEKDB_BIN" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| """Bind a CI-local wheel to pinned sources and verify the installed payload.""" | ||
|
|
||
| import hashlib | ||
| import importlib.metadata | ||
| import json | ||
| import platform | ||
| import subprocess | ||
| import sys | ||
| import zipfile | ||
| from pathlib import Path | ||
|
|
||
|
|
||
| def digest(path): | ||
| with path.open("rb") as stream: | ||
| return hashlib.file_digest(stream, "sha256").hexdigest() | ||
|
|
||
|
|
||
| def wheel_payload(wheel): | ||
| with zipfile.ZipFile(wheel) as archive, archive.open("pylibseekdb/seekdb") as stream: | ||
| return hashlib.file_digest(stream, "sha256").hexdigest() | ||
|
|
||
|
|
||
| def verify(pin, directory): | ||
| manifest = json.loads((directory / "manifest.json").read_text()) | ||
| if manifest["source"] != pin: | ||
| raise ValueError("cached wheel source identity mismatch") | ||
| if platform.system() != "Linux" or platform.machine() != "x86_64" or sys.version_info[:2] != (3, 11): | ||
| raise ValueError("wheel requires Linux x86_64 CPython 3.11") | ||
| wheels = list(directory.glob("*.whl")) | ||
| if len(wheels) != 1 or wheels[0].name != manifest["wheel"]: | ||
| raise ValueError("expected exactly the manifest wheel") | ||
| if digest(wheels[0]) != manifest["wheel_sha256"]: | ||
| raise ValueError("wheel checksum mismatch") | ||
| if wheel_payload(wheels[0]) != manifest["binary_sha256"]: | ||
| raise ValueError("wheel contains a different SeekDB binary") | ||
| version = (directory / "seekdb-version.txt").read_text() | ||
| if pin["seekdb_sha"] not in version or version != manifest["revision_output"]: | ||
| raise ValueError("SeekDB full REVISION mismatch") | ||
| return manifest | ||
|
|
||
|
|
||
| def main(): | ||
| mode, pin_path, directory_name, *rest = sys.argv[1:] | ||
| pin = json.loads(Path(pin_path).read_text()) | ||
| directory = Path(directory_name) | ||
| if mode == "create": | ||
| (binary_name,) = rest | ||
| (wheel,) = directory.glob("*.whl") | ||
| manifest = { | ||
| "source": pin, | ||
| "wheel": wheel.name, | ||
| "wheel_sha256": digest(wheel), | ||
| "binary_sha256": digest(Path(binary_name)), | ||
| "revision_output": (directory / "seekdb-version.txt").read_text(), | ||
| } | ||
| (directory / "manifest.json").write_text(json.dumps(manifest, indent=2) + "\n") | ||
| elif mode not in {"verify", "installed"}: | ||
| raise ValueError(f"unknown verification mode: {mode}") | ||
| manifest = verify(pin, directory) | ||
| if mode == "installed": | ||
| binary = Path(importlib.metadata.distribution("pylibseekdb").locate_file("pylibseekdb/seekdb")) | ||
| if digest(binary) != manifest["binary_sha256"]: | ||
| raise ValueError("installed SeekDB differs from source-built wheel (dependency resync?)") | ||
| # The executable is the verified local wheel payload, never shell input. | ||
| version = subprocess.check_output( # noqa: S603 | ||
| [str(binary), "-V"], text=True, stderr=subprocess.STDOUT | ||
| ) | ||
| if pin["seekdb_sha"] not in version: | ||
| raise ValueError("installed SeekDB does not report pinned full REVISION") | ||
| print(f"[EMBEDDED_WHEEL] installed={binary}") | ||
| print(json.dumps(manifest, indent=2)) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: oceanbase/pyseekdb
Length of output: 8882
🏁 Script executed:
Repository: oceanbase/pyseekdb
Length of output: 24276
🏁 Script executed:
Repository: oceanbase/pyseekdb
Length of output: 19821
Do not hide initialization failures from the preferred binding.
importlib.import_module(distribution)can raiseModuleNotFoundErrorfor a dependency of an installedseekdb. The currentexcept ImportErrortreats that failure as ifseekdbwere absent, then selectspylibseekdbor reports that no binding exists. Catch only a missing top-level distribution and re-raise other import failures.Update the fallback test to raise
ModuleNotFoundError(name="seekdb")instead of the current genericImportError.🤖 Prompt for AI Agents