From 279af60ef08e56514cfea3229e10fdcc1e959282 Mon Sep 17 00:00:00 2001 From: wangyunlai <5187215+hnwyllmm@users.noreply.github.com> Date: Mon, 30 Nov 2026 14:20:38 +0800 Subject: [PATCH 1/3] chore(rust): prepare seekdb 1.4.1 --- .github/workflows/rust-binding.yml | 2 + rust/Cargo.lock | 2 +- rust/Cargo.toml | 7 +- rust/NOTICE | 234 ++------------------------- rust/README.md | 120 ++++++-------- rust/THIRD_PARTY_NOTICES.md | 63 +++----- rust/build.rs | 14 +- rust/bundle_manifest.rs | 3 +- rust/bundles/manifest-1.4.1.json | 62 +++++++ rust/docs/embedded-native-runtime.md | 26 +-- rust/docs/releasing.md | 58 +++---- rust/native_cache.rs | 61 +++---- rust/src/native_path.rs | 9 +- rust/tests/build_cache.rs | 81 +++++----- rust/tests/check_package.py | 4 +- rust/tests/consumer/Cargo.lock | 2 +- rust/tests/manifest.rs | 18 ++- rust/tests/test_manifest_download.py | 15 +- 18 files changed, 297 insertions(+), 484 deletions(-) create mode 100644 rust/bundles/manifest-1.4.1.json diff --git a/.github/workflows/rust-binding.yml b/.github/workflows/rust-binding.yml index 8fb2b0f..220f0fc 100644 --- a/.github/workflows/rust-binding.yml +++ b/.github/workflows/rust-binding.yml @@ -73,4 +73,6 @@ jobs: run: python rust/tests/check_docs.py - name: Test cold manifest download and offline builds if: runner.os == 'Linux' + env: + SEEKDB_DOWNLOAD_BASE_URL: https://raw.githubusercontent.com/${{ github.event.pull_request.head.repo.full_name || github.repository }}/${{ github.event.pull_request.head.sha || github.sha }}/rust/bundles/ run: python rust/tests/test_manifest_download.py diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 735d4ed..27de52c 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -1118,7 +1118,7 @@ dependencies = [ [[package]] name = "seekdb" -version = "1.4.0" +version = "1.4.1" dependencies = [ "dirs", "flate2", diff --git a/rust/Cargo.toml b/rust/Cargo.toml index ebf1234..9e34c09 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "seekdb" -version = "1.4.0" +version = "1.4.1" edition = "2021" license = "Apache-2.0" description = "Local seekdb lifecycle bindings for Rust" @@ -15,8 +15,9 @@ build = "build.rs" include = ["Cargo.toml", "Cargo.lock", "build.rs", "build_cache.rs", "bundle_manifest.rs", "manifest_cache.rs", "native_cache.rs", "bundles/*.json", "src/**", "examples/**", "tests/*.rs", "LICENSE", "NOTICE", "PATENTS", "THIRD_PARTY_NOTICES.md", "README.md", "docs/**"] [package.metadata.seekdb] -native-version = "1.4.0.0-r2" -manifest-sha256 = "e423d7820050fd5918b1c07748b068d4fc6f3746af61767980a9d8bc1d4f9b49" +native-version = "1.4.1" +manifest-sha256 = "8a0efa7712c822bfad8abac40102aed578f8036ddaf3353e6c57b7247ba269fa" +download-base-url = "https://github.com/oceanbase/seekdb-bindings/releases/download/v1.4.1/" [package.metadata.docs.rs] default-target = "x86_64-unknown-linux-gnu" diff --git a/rust/NOTICE b/rust/NOTICE index 14e0dca..1a5849f 100644 --- a/rust/NOTICE +++ b/rust/NOTICE @@ -1,226 +1,14 @@ -==============================libev============================== +seekdb +Copyright (c) 2026 OceanBase and contributors -libev event processing core, watcher management +This product includes software developed by OceanBase and contributors and is +licensed under the Apache License, Version 2.0 (see LICENSE). -Copyright (c) 2007,2008,2009,2010 Marc Alexander Lehmann -All rights reserved. +The third-party components bundled in this distribution are listed in +THIRD_PARTY_COMPONENTS.md. The original license and notice texts for every +component are under licenses//; those files are the authoritative +notices for this distribution and must be retained together with it. -Redistribution and use in source and binary forms, with or without modifica- -tion, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- -CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- -CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH- -ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -OF THE POSSIBILITY OF SUCH DAMAGE. - -Alternatively, the contents of this file may be used under the terms of -the GNU General Public License ("GPL") version 2 or any later version, -in which case the provisions of the GPL are applicable instead of -the above. If you wish to allow the use of your version of this file -only under the terms of the GPL and not to allow others to use your -version of this file under the BSD license, indicate your decision -by deleting the provisions above and replace them with the notice -and other provisions required by the GPL. If you do not delete the -provisions above, a recipient may use your version of this file under -either the BSD or the GPL. - -==============================http_parser============================== - -Copyright Joyent, Inc. and other Node contributors. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -IN THE SOFTWARE. - -==============================lz4.171============================== - -LZ4 - Fast LZ compression algorithm -Copyright (C) 2011-2015, Yann Collet. - -BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -You can contact the author at : - - LZ4 source repository : https://github.com/Cyan4973/lz4 - - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c - -==============================lz4.191============================== - -LZ4 - Fast LZ compression algorithm -Copyright (C) 2011-present, Yann Collet. - -BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -You can contact the author at : - - LZ4 homepage : http://www.lz4.org - - LZ4 source repository : https://github.com/lz4/lz4 - -==============================snappy============================== - -Copyright 2011 Martin Gieseking . - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -==============================zlib============================== - -Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. - -Jean-loup Gailly Mark Adler -jloup@gzip.org madler@alumni.caltech.edu - - -The data format used by the zlib library is described by RFCs (Request for -Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 -(zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). - -==============================zstd============================== - -Copyright (C) 2013-2016, Yann Collet. - -BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -You can contact the author at : -- Source repository : https://github.com/Cyan4973/FiniteStateEntropy - - -Copyright (c) 2016-present, Yann Collet, Facebook, Inc. -All rights reserved. - -This source code is licensed under the BSD-style license found in the -LICENSE file in the root directory of this source tree. An additional grant -of patent rights can be found in the PATENTS file in the same directory +Components with a separate upstream notice file keep it in this bundle, for +example the Boost.Geometry notices under +licenses/boost/boost-geometry-notices.txt. diff --git a/rust/README.md b/rust/README.md index 26280bc..074969b 100644 --- a/rust/README.md +++ b/rust/README.md @@ -1,4 +1,4 @@ -# seekdb Rust binding 1.4.0 +# seekdb Rust binding 1.4.1 This crate starts or reuses a local seekdb instance, returns its MySQL-protocol endpoint, and closes the lifecycle handle. Applications choose their own SQL @@ -28,40 +28,35 @@ cargo run --manifest-path rust/Cargo.toml --example first_query -- .\seekdb-rust The application's own Rust/MSVC runtime dependencies still apply on Windows; embedding the native bundle does not change its compiler's CRT linkage. -The crates.io package name is **`seekdb`**. Once version `1.4.0` is published, -applications and libraries can use: +The crates.io package name is **`seekdb`**. To depend on version `1.4.1` after +publication, use the following Cargo dependencies. ```toml [dependencies] -seekdb = "1.4.0" +seekdb = "1.4.1" mysql = { version = "28", default-features = false, features = ["minimal-rust"] } ``` -This repository enables publishing to crates.io, but merging a PR does not -upload a release. Before the first publication, use -`seekdb = { path = "../seekdb-bindings/rust" }` with a local checkout, or a Git -dependency pinned to a reviewed commit. See the [release guide](docs/releasing.md) -for the publication steps and remaining registry/distribution checks. +To try this version before publication, use +`seekdb = { path = "../seekdb-bindings/rust" }` with a local checkout or pin a +Git dependency to a reviewed commit. See the [release guide](docs/releasing.md) +for publication steps. Copy the example's connection setup into your application. On POSIX, use `endpoint.unix_socket`; do not assume a TCP listener on port 3306. The endpoint is valid only while its lifecycle handle remains open. +The seekdb engine in 1.4.1 changes the local storage format. To upgrade data +created by 1.4.0 or earlier, export the schema and data, initialize a fresh +1.4.1 instance, and import the export. See the [seekdb 1.4.1 release notes](https://github.com/oceanbase/seekdb/releases/tag/v1.4.1#upgrade-notes). + ## Embedded native runtime -On the first build, `build.rs` downloads the pinned seekdb 1.4.0.0 revision 2 -native archive from OSS, verifies its size and SHA-256, and prepares the native cache. -The release version and manifest SHA-256 are pinned in -`Cargo.toml` under `[package.metadata.seekdb]`. `build.rs` obtains the matching -`manifest-.json` from the configured download directory on a -metadata cache miss and verifies its exact bytes against that pin. It reuses -verified copies in `OUT_DIR` or the shared manifest cache before making a request. -The exact [release snapshot](bundles/manifest-1.4.0.0-r2.json) is also distributed -with the crate as a fallback when the request fails. A remote response with an -incorrect digest, schema or release identity fails the build; it is not silently -replaced with the snapshot. `bundle_manifest.rs` maps Cargo `TARGET` (including -ABI) to the verified manifest; it never selects `HOST` or fetches a latest -manifest. The crate version remains **1.4.0**; the independent native bundle -version is **1.4.0.0-r2**. Debug-symbol archives are not embedded. +On the first build, `build.rs` verifies the [packaged manifest](bundles/manifest-1.4.1.json) +and selects the SDK 1.4.1 archive for Cargo `TARGET`. It downloads the archive +from the [seekdb-bindings release](https://github.com/oceanbase/seekdb-bindings/releases/tag/v1.4.1), +verifies its size and SHA-256, and prepares the native cache. The release +version, manifest SHA-256 and download directory are pinned in `Cargo.toml` +under `[package.metadata.seekdb]`. The SDK contains engine **1.4.1.0**. The binding embeds the compressed archive with `include_bytes!`. Downloads honor standard proxy variables and the platform TLS trust store (including configured enterprise roots), and use Rust HTTP libraries; no external `curl` @@ -115,13 +110,12 @@ The independent native release is selected by source-controlled Cargo metadata: ```toml [package.metadata.seekdb] -native-version = "1.4.0.0-r2" -manifest-sha256 = "e423d7820050fd5918b1c07748b068d4fc6f3746af61767980a9d8bc1d4f9b49" +native-version = "1.4.1" +manifest-sha256 = "8a0efa7712c822bfad8abac40102aed578f8036ddaf3353e6c57b7247ba269fa" +download-base-url = "https://github.com/oceanbase/seekdb-bindings/releases/download/v1.4.1/" ``` -The default download directory is -`https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/download-center/opensource/libseekdb/`. -To use an HTTPS mirror at build time: +To use an HTTPS mirror at build time, set `SEEKDB_DOWNLOAD_BASE_URL`. ```sh SEEKDB_DOWNLOAD_BASE_URL=https://mirror.example/libseekdb/ cargo build --manifest-path rust/Cargo.toml @@ -134,18 +128,19 @@ $env:SEEKDB_DOWNLOAD_BASE_URL = 'https://mirror.example/libseekdb/' cargo build --manifest-path rust/Cargo.toml ``` -The override applies to both `manifest-.json` and the runtime -archive filenames selected from it. The mirror must serve the exact pinned -manifest and archives; the override does not change versions, expected hashes, -or cache identities. A missing trailing slash is added. Only absolute HTTPS +The override applies to `manifest-.json` and the runtime +archives it lists. Serve the exact pinned files at the mirror. On a transport +failure the build can use the packaged manifest. A remote response with an +incorrect digest, schema or release identity fails the build. A missing +trailing slash is added. Only absolute HTTPS directory URLs without credentials, query parameters or fragments are accepted. Standard proxy settings and platform TLS trust still apply. Cargo reruns the build script when the override changes; verified cached contents can still be reused without contacting the new mirror. The override is read by `build.rs`; changing it when launching an already-built application has no effect. -Manifest metadata is shared across targets in a separate cache under the same -root selected by `SEEKDB_CACHE_DIR` (or the platform default): +Mirror builds share verified manifest metadata across targets under the root +selected by `SEEKDB_CACHE_DIR` or the platform default. ```text /manifests///manifest.json @@ -158,24 +153,22 @@ shared metadata cache warns and uses `OUT_DIR`, as the bundle cache does. On Windows, metadata publication uses standard Rust rename handling for open readers. If a foreign handle or filesystem policy still denies replacement, the verified build-local copy remains usable and a later build can repair the -shared copy after the handle closes. Runtime -never reads this metadata cache or contacts OSS; its embedded archive and -`///` entry are unchanged. +shared copy after the handle closes. At runtime the binding uses its embedded +archive and `///` entry. After preparing the cache with `SEEKDB_CACHE_DIR` explicitly set, -`python rust/tests/test_manifest_download.py` exercises a cold real manifest -request without a packaged copy, then Cargo builds using packaged fallback and -shared metadata with an unreachable download prefix. Linux CI runs these checks. +`python rust/tests/test_manifest_download.py` exercises the packaged fallback +and offline reuse of shared metadata. Linux CI also supplies an HTTPS mirror +to exercise a cold manifest request without a packaged copy. An offline build needs a verified bundle in `OUT_DIR` or the shared native cache; the packaged manifest fallback supplies metadata, not the compressed runtime. To upgrade a compatible native release: -1. Fetch the exact release manifest, verify its provenance, artifact hashes, - architectures, ABI and minimum systems, and record its SHA-256. -2. Update only `native-version` and `manifest-sha256` in the metadata above. - Add the exact JSON as `bundles/manifest-.json` for offline - fallback and crate source distribution. +1. Verify the release's provenance, artifact hashes, architectures, ABI and + minimum system versions. Record the verified artifacts in the manifest. +2. Update `native-version`, `manifest-sha256` and `download-base-url` in the + metadata above. Add the JSON as `bundles/manifest-.json`. 3. Run platform tests, examples, deployments and `python rust/tests/check_package.py`, then update requirements and validation evidence. The package check derives the expected snapshot path from the same Cargo metadata. @@ -192,19 +185,14 @@ updated sources/bundles there requires a new Rust crate release. | --- | --- | --- | | `x86_64-unknown-linux-gnu` | glibc 2.28+, x86_64 | Unix socket | | `aarch64-unknown-linux-gnu` | glibc 2.28+, ARM64 | Unix socket | -| `x86_64-apple-darwin` | macOS 15.0+, Intel | Unix socket | +| `x86_64-apple-darwin` | macOS 15.0+, Intel; 1.4.1 archive pending | Unix socket | | `aarch64-apple-darwin` | macOS 15.0+, Apple Silicon | Unix socket | | `x86_64-pc-windows-msvc` | x86_64 Windows, MSVC ABI; Windows Server 2022 CI baseline (preview) | TCP, returned host/port | -All five official runtime archives have been downloaded and their sizes and -SHA-256 values verified. ELF architecture/version requirements and Mach-O -architecture/deployment versions agree with the manifest. Windows has PE x86_64 -binaries and bundled DLL dependencies. The manifest does **not** specify a -Windows minimum OS version; the PE subsystem version alone does not establish -one. Older Windows versions are not claimed supported. The CI matrix exercises -these five targets on native runners; adding a job is not a passing result. -See [validation evidence](docs/native-bundle-validation.md) for the distinction -between local runtime tests, cross-compilation, and native CI results. +The 1.4.1 manifest pins the four published SDK archives for these targets by +size and SHA-256. Windows uses PE x86_64 binaries and bundled DLL dependencies. +The Rust CI matrix validates releases on native runners. See the +[1.4.0 validation record](docs/native-bundle-validation.md) for historical results. There are no assets for Linux musl, Windows ARM64/GNU, 32-bit systems, Android, or iOS in this release manifest. Those targets fail with an explicit diagnostic. @@ -214,13 +202,12 @@ system-library requirements. On Linux/macOS, load `libseekdb.so`/`libseekdb.dylib` directly through its C ABI; the colocated service is `seekdb`. Windows loads the C driver `seekdb.dll` with -an explicit DLL-directory search policy. Its archive has `bin/seekdb.exe` and -`lib/*.dll`: extraction removes the long outer package-name directory, retains -all files, and copies the executable into `lib/` so its dependencies are -colocated. The binding configures that bundled executable through the existing -C API. It does not change the application's `PATH` or add an adapter library. +an explicit DLL-directory search policy. The 1.4.1 archive ships `seekdb.exe` +next to its dependencies in `lib/`. For older archives, extraction flattens +the outer package directory and copies the executable from `bin/` into `lib/`. +The binding selects the bundled executable through the existing C API. -The r2 Windows C driver uses ANSI Windows APIs. Rust converts native paths to +The Windows C driver uses ANSI Windows APIs. Rust converts native paths to the active Windows ANSI code page and rejects lossy conversions, UNC paths, NULs, and paths of 240 UTF-16 units or more. Prefer short local paths; Unicode paths require a code page that represents them (or the system UTF-8 code page). @@ -434,12 +421,11 @@ unpacked sources. It requires a clean checkout; `--allow-dirty` is available for local work in progress only. Nothing is uploaded. Downloaded bundles and Cargo output are not source-package inputs. -docs.rs builds the five declared target APIs without downloading or embedding a -native archive. Its standard `DOCS_RS` build flag selects documentation-only -metadata from the verified packaged manifest. Such a build cannot open a database; -normal application builds must leave `DOCS_RS` unset. Changing that flag reruns the -build script and restores normal embedding. `python rust/tests/check_docs.py` -checks offline documentation, the runtime diagnostic, and that transition. +The `DOCS_RS` build flag selects documentation-only metadata from the verified +packaged manifest. Leave the flag unset for application builds. Changing it +reruns the build script and restores normal embedding. +`python rust/tests/check_docs.py` checks offline documentation, the runtime +diagnostic, and that transition. The [release guide](docs/releasing.md) records registry ownership checks, platform status and the accepted native timeout limitation. See diff --git a/rust/THIRD_PARTY_NOTICES.md b/rust/THIRD_PARTY_NOTICES.md index fe7b036..8830de3 100644 --- a/rust/THIRD_PARTY_NOTICES.md +++ b/rust/THIRD_PARTY_NOTICES.md @@ -10,48 +10,21 @@ and provide them with their product as required by the applicable licenses; embedding bytes or using a private extraction cache does not remove those obligations. The source `.crate` contains no native binaries. -## Evidence from the pinned r2 archives - -All five runtime archives were checked against the sizes and SHA-256 values in -[the release manifest](bundles/manifest-1.4.0.0-r2.json). Each contains the bindings -Apache-2.0 license, the engine Apache-2.0 license and the engine NOTICE. Filename -prefixes differ (`seekdb-src-`, `seekdb-src-local-`, or `seekdb-`). The license -contents agree across platforms. Their SHA-256 is -`c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4`. -The engine NOTICE has SHA-256 -`c753aec56c61055ae25ca41d71984674b1f32d2e1c745efbbaa5bdbaf3ab2a0b`; -an exact copy is included as [NOTICE](NOTICE) in this crate. It contains notices -for libev, http_parser, LZ4 (two versions), snappy, zlib and zstd. - -The inherited zstd notice refers to a sibling `PATENTS` file. This crate includes -that [PATENTS](PATENTS) text unchanged from upstream zstd commit -[`fe007ba8bdea7dcb0ce2fe5f04389252c79212b0`](https://github.com/meta/zstd/blob/fe007ba8bdea7dcb0ce2fe5f04389252c79212b0/PATENTS) -(tag `v1.3.0`), which carries the historical BSD/PATENTS terms cited by the notice. -This supplies the referenced document without modifying the verified NOTICE; it -does not establish that the bundled engine uses zstd version 1.3.0 or complete the -native dependency inventory below. Both files preserve their original bytes in -Windows checkouts and are checked in the actual source package. - -That NOTICE is not a complete inventory of the prebuilt runtime. In particular: - -| Area | Observed dependency/source | Distribution work to verify | -| --- | --- | --- | -| C interface library | The pinned bindings build links `mariadbclient`; [its pinned source license](https://github.com/mariadb-corporation/mariadb-connector-c/blob/46880b003653a000e9588bd73c8b1dd65088c686/COPYING.LIB) is LGPL-2.1 | Connector notices and applicable source/relink requirements for the actual linked build | -| GNU/Linux | Runtime archives also ship `libaio.so.1` | The shipped libaio version, license and required materials | -| macOS Intel | Runtime archive also ships `libomp.dylib` | The shipped OpenMP runtime version and notices | -| macOS ARM64 | Runtime archive also ships `libcrypto.3.dylib` and `libssl.3.dylib` | The shipped OpenSSL version and notices | -| Windows | Dependency DLLs include OpenSSL, OpenMP, Abseil, c-ares, iconv, ICU, curl, protobuf/protobuf-c, libxml2, pthreads, RE2, SQLite, zlib and MSVC runtime DLLs | Exact versions, license texts/notices and applicable redistribution terms, including Microsoft's runtime terms | - -The engine and other libraries also contain statically linked dependencies; a -list of shared-library filenames alone cannot establish a complete inventory. -Use the native producer's build records and corresponding source to finish the -inventory and obtain the required materials before publication/distribution. -Do not assume that the three existing bundle notice files cover all those -components, or that this file grants redistribution rights. - -The manifest identifies engine source commit -`bf450b4c8deb3c45d85efb1bd5f43e282d101914` and bindings source commit -`74034975b164e7df5b2ff48b642d2bb36853f6b3`. Native packaging revision, -per-platform provenance and archive hashes must remain associated with any -completed notice/source inventory. Fixing a published bundle's contents needs a -new verified native revision; do not alter r2 files or their expected hashes. +## Notice files in the pinned 1.4.1 archives + +Each archive contains the engine and bindings license bundles. Their inventories +are `licenses/THIRD_PARTY_COMPONENTS.md` and +`licenses/bindings/THIRD_PARTY_COMPONENTS.md`. Both layers ship `LICENSE`, +`NOTICE`, component license texts, `REDISTRIBUTION.md` and `MANIFEST.sha256`. +Follow the applicable redistribution instructions in the archive, including the +bindings instructions for the linked MariaDB Connector/C. + +The engine `licenses/NOTICE` is byte-identical in the four pinned SDK archives. +Its SHA-256 is `69b514d8f2db8c81495f6faad52918c55efedf9c94703c945a92859402fe1e70`. +The crate includes an exact copy in [NOTICE](NOTICE). The crate also carries the +[historical zstd PATENTS text](PATENTS) shipped with 1.4.0. Use the license and +notice files in the current native archive when distributing its contents. + +The pinned manifest records the release, engine and bindings source commits, +and the verified file sizes and digests. Each SDK includes its platform build +provenance in `BUILD-INFO.json`. See the [native manifest](bundles/manifest-1.4.1.json). diff --git a/rust/build.rs b/rust/build.rs index 0d8ca7b..7f70a21 100644 --- a/rust/build.rs +++ b/rust/build.rs @@ -138,7 +138,8 @@ fn prepare_bundle(out_dir: &Path, target: &str) -> Result<(), String> { // not a runnable native payload. Still verify the packaged release pin. let manifest = fs::read(&bundled).map_err(|error| format!("read documentation manifest: {error}"))?; - let asset = config.asset(&manifest, target, &DownloadBase::new(None)?)?; + let base = DownloadBase::new(config.download_base_url.as_deref())?; + let asset = config.asset(&manifest, target, &base)?; return write_bundle_metadata(out_dir, target, &asset, "&[]"); } let prefix = env::var("SEEKDB_DOWNLOAD_BASE_URL") @@ -149,17 +150,22 @@ fn prepare_bundle(out_dir: &Path, target: &str) -> Result<(), String> { Err("SEEKDB_DOWNLOAD_BASE_URL must be UTF-8".to_string()) } })?; - let base = DownloadBase::new(prefix.as_deref())?; + let packaged_base = config.download_base_url.as_deref(); + let base = DownloadBase::new(prefix.as_deref().or(packaged_base))?; let root = env::var_os("SEEKDB_CACHE_DIR") .map(PathBuf::from) .or_else(native_cache::default_root); if root.as_ref().is_some_and(|path| !path.is_absolute()) { return Err("SEEKDB_CACHE_DIR must be a non-empty absolute path".into()); } - let manifest = + // The release download directory hosts the archives; its manifest comes with the crate. + let manifest = if prefix.is_none() && packaged_base.is_some() { + fs::read(&bundled).map_err(|error| format!("read packaged native manifest: {error}"))? + } else { manifest_cache::prepare_manifest(out_dir, root.as_deref(), &config, &bundled, || { download_manifest(&base.file_url(&config.manifest_name())) - })?; + })? + }; let asset = config.asset(&manifest, target, &base)?; let cache = root.map(|root| native_cache::NativeCache { root, diff --git a/rust/bundle_manifest.rs b/rust/bundle_manifest.rs index 1b58cdf..f137ec9 100644 --- a/rust/bundle_manifest.rs +++ b/rust/bundle_manifest.rs @@ -13,6 +13,7 @@ const DEFAULT_BASE_URL: &str = pub struct Config { pub native_version: String, pub manifest_sha256: String, + pub download_base_url: Option, } #[derive(Deserialize)] @@ -98,7 +99,7 @@ impl Config { .filter(|a| a.os == os && a.architecture == architecture); let runtime = matches .next() - .ok_or("native manifest has no matching asset")? + .ok_or_else(|| format!("native manifest has no matching asset for {target}"))? .runtime; if matches.next().is_some() || !runtime diff --git a/rust/bundles/manifest-1.4.1.json b/rust/bundles/manifest-1.4.1.json new file mode 100644 index 0000000..86f06f2 --- /dev/null +++ b/rust/bundles/manifest-1.4.1.json @@ -0,0 +1,62 @@ +{ + "schema_version": "1.0", + "package": "libseekdb", + "package_version": "1.4.1", + "engine_version": "1.4.1.0", + "release": "https://github.com/oceanbase/seekdb-bindings/releases/tag/v1.4.1", + "sources": { + "seekdb": { + "repository": "https://github.com/oceanbase/seekdb", + "commit": "ab58f3d233bc77481ef409cef7c42abc59326902" + }, + "seekdb_bindings": { + "repository": "https://github.com/oceanbase/seekdb-bindings", + "commit": "0d1cd473db05b37f51496116ca4b7187545f5eb6" + } + }, + "artifacts": [ + { + "platform": "linux-x86_64-glibc2.28", + "os": "linux", + "architecture": "x86_64", + "minimum_glibc": "2.28", + "runtime": { + "file": "libseekdb-1.4.1-linux-x86_64-glibc2.28-20261126T013358Z-sdbab58f3d233bc-bnd0d1cd473db05.tar.gz", + "size_bytes": 53865676, + "sha256": "55fbd0f5e70f570f29483cadb36306f4462893bf1abc8db2dddb70a163ad3450" + } + }, + { + "platform": "linux-aarch64-glibc2.28", + "os": "linux", + "architecture": "aarch64", + "minimum_glibc": "2.28", + "runtime": { + "file": "libseekdb-1.4.1-linux-aarch64-glibc2.28-20261126T013358Z-sdbab58f3d233bc-bnd0d1cd473db05.tar.gz", + "size_bytes": 49074505, + "sha256": "5e564f7103f44e176db8759d3f22a0555c9d31bbc4bb81b891211b555aac79ae" + } + }, + { + "platform": "macos-arm64-min15.0", + "os": "macos", + "architecture": "arm64", + "minimum_os_version": "15.0", + "runtime": { + "file": "libseekdb-1.4.1-macos-arm64-min15.0-20261126T013358Z-sdbab58f3d233bc-bnd0d1cd473db05.tar.gz", + "size_bytes": 48550931, + "sha256": "c56a78f9b8deb391d9ec6b50033378a671f5cb1f46c6ce14b191859ed0718eda" + } + }, + { + "platform": "windows-x86_64-md", + "os": "windows", + "architecture": "x86_64", + "runtime": { + "file": "libseekdb-1.4.1-windows-x86_64-md-20261126T013358Z-sdbab58f3d233bc-bnd0d1cd473db05.tar.gz", + "size_bytes": 48471159, + "sha256": "f135d04bf52f98e06eca07cb469a7fd56fd6c842328756dc8b0cdcb297ab7728" + } + } + ] +} diff --git a/rust/docs/embedded-native-runtime.md b/rust/docs/embedded-native-runtime.md index b379280..d47f150 100644 --- a/rust/docs/embedded-native-runtime.md +++ b/rust/docs/embedded-native-runtime.md @@ -1,19 +1,19 @@ # Embedded native runtime decision -Status: implemented with pinned 1.4.0.0-r2 release assets for GNU/Linux -x86_64/ARM64, macOS Intel/ARM64, and Windows x86_64 MSVC (preview). See -[native validation](native-bundle-validation.md) for evidence and remaining limits. +The 1.4.1 manifest pins SDK archives for GNU/Linux x86_64/ARM64, macOS ARM64, +and Windows x86_64 MSVC (preview). The macOS Intel archive is pending. See the +[1.4.0 validation record](native-bundle-validation.md) for historical results. ## Decision Embed the compressed native seekdb bundle in compiled artifacts that use the binding. During a build, `build.rs` downloads the bundle for the target and verifies its pinned SHA-256. `[package.metadata.seekdb]` pins the native -version and the SHA-256 of its release manifest. The build obtains that exact -manifest from verified local copies or the configured HTTPS download directory; -on a transport failure it can use the matching packaged JSON snapshot. Invalid -remote metadata is an error. `SEEKDB_DOWNLOAD_BASE_URL` overrides the build-time -directory for both metadata and archives while retaining all pins. The binding includes the compressed native archive with +version, manifest digest and default archive directory. The build verifies the +packaged manifest and uses it to select the archive. `SEEKDB_DOWNLOAD_BASE_URL` +selects a mirror for metadata and archives. Mirror builds can use the packaged +manifest on transport failure, and reject remote metadata that fails verification. +The binding includes the compressed native archive with `include_bytes!`. Before loading libseekdb or opening an instance that may start a server, ensure a complete extraction exists. Load libseekdb by its absolute path. Runtime extraction needs no download. @@ -29,8 +29,8 @@ links the binding's runtime code. Use the same `///` entry for both phases. Keep the verified source archive as `bundle.tar.gz` alongside the extracted native bundle and `.complete` manifest. Builds and runtime share the -same implementation, validation, and atomic directory publication. Build-time -manifest metadata uses `/manifests///manifest.json` +same implementation, validation, and atomic directory publication. Mirrors cache +build-time metadata at `/manifests///manifest.json` and an independent `OUT_DIR` copy, publishing complete files by atomic rename. Runtime uses its embedded metadata/archive and never accesses a manifest URL. Each process @@ -134,9 +134,9 @@ Keep all prior files and generations. A stale publisher can replace the inventor with another complete generation without removing paths already used by readers. The loaded driver is retained; its existing `seekdb_set_binary_path` C API selects the server in the latest generation before another open. Windows DLL loading uses -`LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_DEFAULT_DIRS`, and a -server copy is colocated with the bundled DLLs. No global loader path changes or -SDK adapter DLL are required. The long archive wrapper directory is removed on +`LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_DEFAULT_DIRS`, and the +server is colocated with the bundled DLLs. No global loader path changes or +SDK adapter DLL are required. The wrapper on older Windows archives is removed on Windows to keep paths within the pinned ANSI C driver's limits. This generation scheme changes only Windows repair; Unix continues to use the diff --git a/rust/docs/releasing.md b/rust/docs/releasing.md index e2a2529..39dd876 100644 --- a/rust/docs/releasing.md +++ b/rust/docs/releasing.md @@ -1,11 +1,12 @@ # Publishing the seekdb Rust crate -The crates.io package and Rust import are both `seekdb`. This release prepares -crate **1.4.0** with native bundle **1.4.0.0-r2**. The native revision and manifest -digest live in `[package.metadata.seekdb]`; changing them does not require a crate -version change before its first publication. After publication, crates.io versions -are immutable, so any later source or embedded-bundle change needs a new crate -version. +The crates.io package and Rust import are both `seekdb`. Crate **1.4.1** pins +the **1.4.1** SDK archives containing engine **1.4.1.0**. The pins live in +`[package.metadata.seekdb]`. Crates.io versions are immutable after publication, +so any later source or embedded-bundle change needs a new crate version. + +Upgrades from 1.4.0 or earlier require a logical export and import because the +local storage format changed. See the [seekdb 1.4.1 release notes](https://github.com/oceanbase/seekdb/releases/tag/v1.4.1#upgrade-notes). `publish = ["crates-io"]` enables the intended registry. Merging changes does not publish anything. The manual `publish-rust.yml` workflow uses Trusted Publishing @@ -62,32 +63,19 @@ remains independent of the pinned native bundle revision. ## Release scope -The release includes GNU/Linux x86_64 and ARM64 (glibc 2.28+), macOS Intel and -Apple Silicon (15.0+), and Windows x86_64 MSVC as **preview**. The five native -jobs on the final implementation commit `a803099d9a36be82abb8737704806c1e4fe99ea4` -[passed](https://github.com/hnwyllmm/seekdb-bindings/actions/runs/40683968145). -Run the workflow again on the publication commit; historical CI is supporting -evidence, not a substitute for that run. The glibc 2.28 floor is based on manifest -and binary inspection rather than execution on a glibc 2.28 host. Windows Server -2022 is the tested baseline; r2 does not declare a minimum Windows version. -Windows also retains the documented ANSI/local-path and mapped-file restrictions. - -The published r2 driver does not synchronously terminate a spawned native server -when readiness times out. The server may outlive the failed open, and normal -last-client shutdown is asynchronous. The test runner only guarantees cleanup of -its own consumer processes. This release retains that documented behavior; -resolving the review thread did not fix it. A fix needs a coordinated native -startup/ownership policy, concurrent-client and timeout regression tests on Unix -and Windows, and a newly published verified bundle. Do not describe this release -as guaranteeing server exit before cache cleanup after a failed open. - -Read [THIRD_PARTY_NOTICES.md](../THIRD_PARTY_NOTICES.md) before distribution. -The crate includes its Apache-2.0 license and a verified copy of the engine's -NOTICE, but the bundle's notice inventory does not cover every linked/shipped -dependency. Completing that native redistribution inventory, supplying required -notices and any applicable source/relink materials remains a publication -prerequisite for the release maintainer/native package producer. This PR does not -claim legal clearance for the prebuilt binaries. +The 1.4.1 manifest pins GNU/Linux x86_64 and ARM64 (glibc 2.28+), macOS Apple +Silicon (15.0+), and Windows x86_64 MSVC (**preview**). macOS Intel still needs +its 1.4.1 archive and manifest entry. Run the full native matrix on the +publication commit. Windows Server 2022 is the CI baseline. The documented +ANSI/local-path and mapped-file restrictions apply on Windows. + +A readiness timeout can leave a spawned server running. Normal last-client +shutdown is asynchronous. Wait for the server to exit before removing its +runtime cache. + +The native archives ship the engine and bindings license inventories. Preserve +the license directory and follow the archived redistribution instructions when +shipping binaries. See [THIRD_PARTY_NOTICES.md](../THIRD_PARTY_NOTICES.md). ## Check the final source package @@ -114,8 +102,8 @@ It never uploads. For local edits only, pass `--allow-dirty` to the package chec omit that option for the release. Cargo controls `CARGO_TARGET_DIR` normally. The crate source archive does not contain a native runtime. A user's first build -needs network access to the exact pinned manifest/archive or a prepared verified -cache. A built application/cdylib embeds the archive and restores it offline. +uses the packaged manifest and needs access to the pinned archive or a prepared +verified cache. A built application/cdylib embeds the archive and restores it offline. docs.rs receives only the source package and has no network; its `DOCS_RS` mode verifies the packaged manifest and renders API docs without a runtime payload. Leave `DOCS_RS` unset in application, deployment and publish checks. @@ -132,7 +120,7 @@ cargo publish --manifest-path rust/Cargo.toml --locked --registry crates-io This is a separate, explicit release action. Keep credentials out of the repository. After upload, confirm the registered repository/version/owners and -docs.rs build. Build a fresh consumer using `seekdb = "=1.4.0"` from crates.io +docs.rs build. Build a fresh consumer using `seekdb = "=1.4.1"` from crates.io without path or Git patches, run the first SQL query, and repeat deployment verification on the release platforms. Only then announce the published version. diff --git a/rust/native_cache.rs b/rust/native_cache.rs index f85e1b1..320f881 100644 --- a/rust/native_cache.rs +++ b/rust/native_cache.rs @@ -326,38 +326,39 @@ impl NativeCache<'_> { )); } } - // Normalize the Windows wrapper directory to keep the native A API - // paths below MAX_PATH, retaining every file and the lib/bin layout. - // This is driven by the asset, including when cross-compiling on Unix. if self.library == "seekdb.dll" { - let package = fs::read_dir(staging.path()) - .map_err(|e| cache_error(staging.path(), "read native layout", e))? - .filter_map(Result::ok) - .find(|e| e.path().join("lib/seekdb.dll").is_file()) - .ok_or_else(|| { - cache_error( - staging.path(), - "validate native layout", - io::Error::new(io::ErrorKind::InvalidData, "missing Windows driver"), - ) - })? - .path(); - for item in fs::read_dir(&package) - .map_err(|e| cache_error(&package, "read Windows package", e))? - { - let item = - item.map_err(|e| cache_error(&package, "read Windows package entry", e))?; - fs::rename(item.path(), staging.path().join(item.file_name())) - .map_err(|e| cache_error(&package, "normalize Windows layout", e))?; + let root = staging.path(); + // Older bundles have a wrapper directory. Flatten it to keep ANSI API paths short. + if !root.join("lib/seekdb.dll").is_file() { + let package = fs::read_dir(root) + .map_err(|e| cache_error(root, "read native layout", e))? + .filter_map(Result::ok) + .find(|e| e.path().join("lib/seekdb.dll").is_file()) + .ok_or_else(|| { + cache_error( + root, + "validate native layout", + io::Error::new(io::ErrorKind::InvalidData, "missing Windows driver"), + ) + })? + .path(); + for item in fs::read_dir(&package) + .map_err(|e| cache_error(&package, "read Windows package", e))? + { + let item = + item.map_err(|e| cache_error(&package, "read Windows package entry", e))?; + fs::rename(item.path(), root.join(item.file_name())) + .map_err(|e| cache_error(&package, "normalize Windows layout", e))?; + } + fs::remove_dir(&package) + .map_err(|e| cache_error(&package, "remove empty Windows wrapper", e))?; + } + // Keep the server beside its DLL dependencies. Older bundles put it in bin/. + let server = root.join("lib/seekdb.exe"); + if !server.is_file() { + fs::copy(root.join("bin/seekdb.exe"), server) + .map_err(|e| cache_error(root, "colocate Windows server", e))?; } - fs::remove_dir(&package) - .map_err(|e| cache_error(&package, "remove empty Windows wrapper", e))?; - // Colocate the server with its DLL dependencies; do not mutate PATH. - fs::copy( - staging.path().join("bin/seekdb.exe"), - staging.path().join("lib/seekdb.exe"), - ) - .map_err(|e| cache_error(staging.path(), "colocate Windows server", e))?; } let native = native_directory(staging.path(), self.library) .map_err(|error| cache_error(staging.path(), "validate native layout", error))?; diff --git a/rust/src/native_path.rs b/rust/src/native_path.rs index d81b7bf..d4abe11 100644 --- a/rust/src/native_path.rs +++ b/rust/src/native_path.rs @@ -22,7 +22,7 @@ fn windows_drive_path(text: &str) -> Result<&str, Error> { || !matches!(bytes[2], b'\\' | b'/') { return Err(Error::InvalidInput( - "the r2 Windows driver requires an absolute local drive path".into(), + "the Windows driver requires an absolute local drive path".into(), )); } Ok(text) @@ -31,7 +31,7 @@ fn windows_drive_path(text: &str) -> Result<&str, Error> { #[cfg(windows)] pub(crate) fn c_path(path: &Path) -> Result { use std::os::windows::ffi::OsStrExt; - // r2's C driver calls the Windows A APIs. Its strings use the process ANSI + // The C driver calls the Windows A APIs. Its strings use the process ANSI // code page, not necessarily UTF-8. Reject a lossy conversion explicitly. #[link(name = "kernel32")] extern "system" { @@ -54,8 +54,7 @@ pub(crate) fn c_path(path: &Path) -> Result { let wide: Vec = std::ffi::OsStr::new(text).encode_wide().collect(); if wide.contains(&0) || wide.len() >= 240 { return Err(Error::InvalidInput( - "the r2 Windows driver requires a path shorter than 240 UTF-16 units without NUL" - .into(), + "the Windows driver requires a path shorter than 240 UTF-16 units without NUL".into(), )); } let mut used_default = 0; @@ -81,7 +80,7 @@ pub(crate) fn c_path(path: &Path) -> Result { ) }; if count == 0 || used_default != 0 { - return Err(Error::InvalidInput("native path cannot be represented by the Windows ANSI code page used by the r2 driver; choose another path or enable the system UTF-8 code page".into())); + return Err(Error::InvalidInput("native path cannot be represented by the Windows ANSI code page used by the driver; choose another path or enable the system UTF-8 code page".into())); } bytes.truncate(count as usize); CString::new(bytes).map_err(|_| Error::InvalidInput("native path contains NUL".into())) diff --git a/rust/tests/build_cache.rs b/rust/tests/build_cache.rs index afb7385..bfe0e1e 100644 --- a/rust/tests/build_cache.rs +++ b/rust/tests/build_cache.rs @@ -15,11 +15,15 @@ use std::sync::atomic::{AtomicUsize, Ordering}; const NAME: &str = "native.tar.gz"; fn archive() -> Vec { - let mut archive = tar::Builder::new(GzEncoder::new(Vec::new(), Compression::fast())); - for (path, bytes, mode) in [ + archive_with_files(&[ ("package/lib/libseekdb.so", "native", 0o644), ("package/lib/seekdb", "server", 0o755), - ] { + ]) +} + +fn archive_with_files(files: &[(&str, &str, u32)]) -> Vec { + let mut archive = tar::Builder::new(GzEncoder::new(Vec::new(), Compression::fast())); + for &(path, bytes, mode) in files { let mut header = tar::Header::new_gnu(); header.set_size(bytes.len() as u64); header.set_mode(mode); @@ -156,46 +160,35 @@ fn unavailable_user_cache_falls_back_to_cargo_output() { #[test] fn windows_bundle_layout_is_normalized_without_discarding_files() { let temporary = tempfile::tempdir().unwrap(); - let mut builder = tar::Builder::new(GzEncoder::new(Vec::new(), Compression::fast())); - for (path, contents) in [ - ("package/lib/seekdb.dll", "driver"), - ("package/lib/dependency.dll", "dependency"), - ("package/bin/seekdb.exe", "server"), - ("package/licenses/LICENSE", "license"), - ] { - let mut header = tar::Header::new_gnu(); - header.set_size(contents.len() as u64); - header.set_mode(0o666); - header.set_cksum(); - builder - .append_data(&mut header, path, contents.as_bytes()) - .unwrap(); + for (prefix, server) in [("package/", "bin/seekdb.exe"), ("", "lib/seekdb.exe")] { + let bytes = archive_with_files(&[ + (&format!("{prefix}lib/seekdb.dll"), "driver", 0o666), + (&format!("{prefix}lib/dependency.dll"), "dependency", 0o666), + (&format!("{prefix}{server}"), "server", 0o666), + (&format!("{prefix}licenses/LICENSE"), "license", 0o666), + ]); + let hash = format!("{:x}", Sha256::digest(&bytes)); + let native = NativeCache { + root: temporary.path().join("cache"), + target: "x86_64-pc-windows-msvc", + version: "test", + hash: &hash, + library: "seekdb.dll", + }; + let library = native.ensure(&bytes).unwrap(); + assert_eq!(library, native.entry().join("lib/seekdb.dll")); + assert_eq!( + fs::read(library.with_file_name("seekdb.exe")).unwrap(), + b"server" + ); + assert_eq!(fs::read(native.entry().join(server)).unwrap(), b"server"); + assert_eq!( + fs::read(native.entry().join("licenses/LICENSE")).unwrap(), + b"license" + ); + assert_eq!( + fs::read(native.entry().join("lib/dependency.dll")).unwrap(), + b"dependency" + ); } - let bytes = builder.into_inner().unwrap().finish().unwrap(); - let hash = format!("{:x}", Sha256::digest(&bytes)); - let native = NativeCache { - root: temporary.path().join("cache"), - target: "x86_64-pc-windows-msvc", - version: "test", - hash: &hash, - library: "seekdb.dll", - }; - let library = native.ensure(&bytes).unwrap(); - assert_eq!(library, native.entry().join("lib/seekdb.dll")); - assert_eq!( - fs::read(library.with_file_name("seekdb.exe")).unwrap(), - b"server" - ); - assert_eq!( - fs::read(native.entry().join("bin/seekdb.exe")).unwrap(), - b"server" - ); - assert_eq!( - fs::read(native.entry().join("licenses/LICENSE")).unwrap(), - b"license" - ); - assert_eq!( - fs::read(native.entry().join("lib/dependency.dll")).unwrap(), - b"dependency" - ); } diff --git a/rust/tests/check_package.py b/rust/tests/check_package.py index 23409e3..785fd46 100644 --- a/rust/tests/check_package.py +++ b/rust/tests/check_package.py @@ -45,9 +45,9 @@ assert packaged['package']['metadata']['seekdb'] == config for notice in ['NOTICE', 'PATENTS']: assert source.extractfile(f'{package_root}/{notice}').read() == (crate / notice).read_bytes() - # Pin the engine notice from the verified r2 release, independently of + # Pin the engine notice from the verified native release, independently of # the checkout, so editing both copies cannot silently change it. - assert hashlib.sha256(source.extractfile(f'{package_root}/NOTICE').read()).hexdigest() == 'c753aec56c61055ae25ca41d71984674b1f32d2e1c745efbbaa5bdbaf3ab2a0b' + assert hashlib.sha256(source.extractfile(f'{package_root}/NOTICE').read()).hexdigest() == '69b514d8f2db8c81495f6faad52918c55efedf9c94703c945a92859402fe1e70' snapshot = source.extractfile(f'{package_root}/{native_manifest}').read() assert hashlib.sha256(snapshot).hexdigest() == config['manifest-sha256'] assert json.loads(snapshot)['package_version'] == config['native-version'] diff --git a/rust/tests/consumer/Cargo.lock b/rust/tests/consumer/Cargo.lock index 5b42389..f80bfc4 100644 --- a/rust/tests/consumer/Cargo.lock +++ b/rust/tests/consumer/Cargo.lock @@ -980,7 +980,7 @@ dependencies = [ [[package]] name = "seekdb" -version = "1.4.0" +version = "1.4.1" dependencies = [ "dirs", "flate2", diff --git a/rust/tests/manifest.rs b/rust/tests/manifest.rs index a743ccf..4e38a88 100644 --- a/rust/tests/manifest.rs +++ b/rust/tests/manifest.rs @@ -47,9 +47,12 @@ fn selects_exact_target_abi_and_applies_the_mirror_to_both_downloads() { "linux-aarch64-glibc2.28", "libseekdb.so", ), - ("x86_64-apple-darwin", "macos15.0-x86_64", "libseekdb.dylib"), - ("aarch64-apple-darwin", "macos15.0-arm64", "libseekdb.dylib"), - ("x86_64-pc-windows-msvc", "windows-x86_64", "seekdb.dll"), + ( + "aarch64-apple-darwin", + "macos-arm64-min15.0", + "libseekdb.dylib", + ), + ("x86_64-pc-windows-msvc", "windows-x86_64-md", "seekdb.dll"), ] { let asset = config.asset(&bytes, target, &base).unwrap(); assert!(asset.name.contains(platform)); @@ -121,6 +124,15 @@ fn upgrade_uses_only_metadata_and_the_matching_manifest() { .unwrap(); assert_eq!(asset.version, version); assert_eq!(config.manifest_name(), format!("manifest-{version}.json")); + assert!(config + .asset( + &bytes, + "x86_64-apple-darwin", + &DownloadBase::new(None).unwrap() + ) + .err() + .unwrap() + .contains("no matching asset for x86_64-apple-darwin")); for bad in ["../version", "", "/absolute", "1/../../other"] { assert!(Config::from_package(&metadata.replace(version, bad)).is_err()); } diff --git a/rust/tests/test_manifest_download.py b/rust/tests/test_manifest_download.py index 624b793..ad07d9e 100644 --- a/rust/tests/test_manifest_download.py +++ b/rust/tests/test_manifest_download.py @@ -2,6 +2,8 @@ Run after cargo check with SEEKDB_CACHE_DIR set, so the official runtime archive can seed an isolated native cache without downloading another large bundle. +Set SEEKDB_DOWNLOAD_BASE_URL to an HTTPS directory serving the pinned manifest +to exercise a cold remote manifest download as well. """ import hashlib import json @@ -13,7 +15,6 @@ import tempfile CRATE = Path(__file__).resolve().parents[1] -DEFAULT_BASE = 'https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/download-center/opensource/libseekdb/' def main(): @@ -46,7 +47,7 @@ def main(): shared_manifest = cache / 'manifests' / version / config['manifest-sha256'] / 'manifest.json' build_target = root / 'target' env = dict(os.environ, SEEKDB_CACHE_DIR=str(cache), CARGO_TARGET_DIR=str(build_target)) - base = os.environ.get('SEEKDB_DOWNLOAD_BASE_URL', DEFAULT_BASE).rstrip('/') + base = os.environ.get('SEEKDB_DOWNLOAD_BASE_URL') def build(name, base_url, keep_snapshot): source = root / name @@ -70,16 +71,16 @@ def build(name, base_url, keep_snapshot): assert hashlib.sha256(shared_manifest.read_bytes()).hexdigest() == config['manifest-sha256'] return result.stdout + result.stderr - # A cold request is mandatory: no metadata cache and no packaged copy. - # Omitting the trailing slash also checks actual URL normalization. - build('remote-mirror-prefix', base, keep_snapshot=False) - shutil.rmtree(cache / 'manifests') + if base is not None: + # No metadata cache or packaged copy. The missing slash tests URL normalization. + build('remote-mirror-prefix', base.rstrip('/'), keep_snapshot=False) + shutil.rmtree(cache / 'manifests') log = build('offline-packaged-fallback', 'https://127.0.0.1:9', keep_snapshot=True) assert 'using the verified packaged native manifest' in log, log # No packaged copy is available here; a request could not succeed. log = build('offline-shared-cache', 'https://127.0.0.1:9', keep_snapshot=False) assert 'using the verified packaged native manifest' not in log, log - print('Remote manifest, packaged fallback and shared-cache reuse passed.') + print('Packaged manifest fallback and shared-cache reuse passed.') if __name__ == '__main__': From 10bbbffee0ca62916bfbc8b766a3d56e9ead765f Mon Sep 17 00:00:00 2001 From: wangyunlai Date: Mon, 30 Nov 2026 14:30:44 +0800 Subject: [PATCH 2/3] test(rust): locate generated files via Cargo output --- rust/tests/check_docs.py | 24 +++++++++++++----------- rust/tests/test_manifest_download.py | 9 +++++---- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/rust/tests/check_docs.py b/rust/tests/check_docs.py index dbf311e..1af9c07 100644 --- a/rust/tests/check_docs.py +++ b/rust/tests/check_docs.py @@ -11,19 +11,21 @@ 'cargo', 'metadata', '--manifest-path', manifest, '--no-deps', '--format-version', '1' ], text=True)) target = Path(metadata['target_directory']) / 'docs-check' +package_id = next(p['id'] for p in metadata['packages'] if Path(p['manifest_path']) == Path(manifest)) def run(arguments, env): - result = subprocess.run(['cargo', *arguments, '--manifest-path', manifest, '--locked', '--offline'], + result = subprocess.run(['cargo', *arguments, '--manifest-path', manifest, '--locked', '--offline', + '--message-format=json'], env=env, text=True, capture_output=True) if result.returncode: raise AssertionError(result.stdout + result.stderr) - - -def generated(): - paths = list(target.glob('debug/build/seekdb-*/out/native_bundle.rs')) - assert paths, 'build script did not generate native metadata' - return max(paths, key=lambda path: path.stat().st_mtime_ns) + for line in result.stdout.splitlines(): + if line.startswith('{'): + message = json.loads(line) + if message.get('reason') == 'build-script-executed' and message['package_id'] == package_id: + return (Path(message['out_dir']) / 'native_bundle.rs').read_text() + raise AssertionError('Cargo did not report the seekdb build script output directory') with tempfile.TemporaryDirectory(prefix='seekdb-docs-') as directory: @@ -35,9 +37,9 @@ def generated(): SEEKDB_DOWNLOAD_BASE_URL='http://invalid.example/docs-must-not-download', HTTP_PROXY='http://127.0.0.1:9', HTTPS_PROXY='http://127.0.0.1:9', ALL_PROXY='http://127.0.0.1:9', NO_PROXY='', RUSTDOCFLAGS='-D warnings') - run(['doc', '--no-deps', '--lib'], docs_env) + generated = run(['doc', '--no-deps', '--lib'], docs_env) assert (target / 'doc' / 'seekdb' / 'index.html').is_file() - assert 'pub const ARCHIVE: &[u8] = &[];' in generated().read_text() + assert 'pub const ARCHIVE: &[u8] = &[];' in generated assert not cache.exists(), 'docs build touched the runtime cache' # Accidental executable builds with DOCS_RS must report a clear error # before attempting extraction or loading a placeholder native payload. @@ -48,6 +50,6 @@ def generated(): assert result.returncode != 0, result.stdout assert 'rebuild without DOCS_RS' in result.stderr, result.stderr assert not cache.exists() - run(['check', '--lib'], normal_env) - assert 'include_bytes!' in generated().read_text(), 'DOCS_RS change did not restore native embedding' + generated = run(['check', '--lib'], normal_env) + assert 'include_bytes!' in generated, 'DOCS_RS change did not restore native embedding' print('Offline docs, documentation-only runtime guard, and normal-build embedding passed.') diff --git a/rust/tests/test_manifest_download.py b/rust/tests/test_manifest_download.py index ad07d9e..4f671ba 100644 --- a/rust/tests/test_manifest_download.py +++ b/rust/tests/test_manifest_download.py @@ -46,7 +46,8 @@ def main(): shutil.copyfile(seed, destination) shared_manifest = cache / 'manifests' / version / config['manifest-sha256'] / 'manifest.json' build_target = root / 'target' - env = dict(os.environ, SEEKDB_CACHE_DIR=str(cache), CARGO_TARGET_DIR=str(build_target)) + env = dict(os.environ, SEEKDB_CACHE_DIR=str(cache), CARGO_TARGET_DIR=str(build_target), + CARGO_BUILD_BUILD_DIR=str(build_target)) base = os.environ.get('SEEKDB_DOWNLOAD_BASE_URL') def build(name, base_url, keep_snapshot): @@ -60,7 +61,7 @@ def build(name, base_url, keep_snapshot): # Cargo can reuse OUT_DIR across relocated copies of the same # package. Remove only this test's build-local manifest snapshots # so each scenario exercises the intended shared/network source. - for local in build_target.glob(f'debug/build/seekdb-*/out/{manifest_name}'): + for local in build_target.rglob(manifest_name): local.unlink() result = subprocess.run([ 'cargo', 'check', '--manifest-path', str(crate / 'Cargo.toml'), '--locked', '--lib' @@ -77,8 +78,8 @@ def build(name, base_url, keep_snapshot): shutil.rmtree(cache / 'manifests') log = build('offline-packaged-fallback', 'https://127.0.0.1:9', keep_snapshot=True) assert 'using the verified packaged native manifest' in log, log - # No packaged copy is available here; a request could not succeed. - log = build('offline-shared-cache', 'https://127.0.0.1:9', keep_snapshot=False) + # Change the unreachable URL so Cargo reruns the build script without a packaged copy. + log = build('offline-shared-cache', 'https://127.0.0.1:9/shared', keep_snapshot=False) assert 'using the verified packaged native manifest' not in log, log print('Packaged manifest fallback and shared-cache reuse passed.') From 755518032b18347599503bfc644057c8f581ae95 Mon Sep 17 00:00:00 2001 From: wangyunlai <5187215+hnwyllmm@users.noreply.github.com> Date: Mon, 30 Nov 2026 14:48:41 +0800 Subject: [PATCH 3/3] docs(rust): keep release guidance version-independent --- rust/README.md | 100 +++++++++++---------------- rust/THIRD_PARTY_NOTICES.md | 17 +++-- rust/docs/embedded-native-runtime.md | 6 +- rust/docs/releasing.md | 48 ++++++++----- rust/tests/consumer/README.md | 7 +- 5 files changed, 83 insertions(+), 95 deletions(-) diff --git a/rust/README.md b/rust/README.md index 074969b..811b662 100644 --- a/rust/README.md +++ b/rust/README.md @@ -1,4 +1,4 @@ -# seekdb Rust binding 1.4.1 +# seekdb Rust binding This crate starts or reuses a local seekdb instance, returns its MySQL-protocol endpoint, and closes the lifecycle handle. Applications choose their own SQL @@ -28,16 +28,14 @@ cargo run --manifest-path rust/Cargo.toml --example first_query -- .\seekdb-rust The application's own Rust/MSVC runtime dependencies still apply on Windows; embedding the native bundle does not change its compiler's CRT linkage. -The crates.io package name is **`seekdb`**. To depend on version `1.4.1` after -publication, use the following Cargo dependencies. +Add the published `seekdb` crate and the SQL client used by `first_query`. -```toml -[dependencies] -seekdb = "1.4.1" -mysql = { version = "28", default-features = false, features = ["minimal-rust"] } +```sh +cargo add seekdb +cargo add mysql --no-default-features --features minimal-rust ``` -To try this version before publication, use +To try an unpublished build, use `seekdb = { path = "../seekdb-bindings/rust" }` with a local checkout or pin a Git dependency to a reviewed commit. See the [release guide](docs/releasing.md) for publication steps. @@ -45,18 +43,15 @@ Copy the example's connection setup into your application. On POSIX, use `endpoint.unix_socket`; do not assume a TCP listener on port 3306. The endpoint is valid only while its lifecycle handle remains open. -The seekdb engine in 1.4.1 changes the local storage format. To upgrade data -created by 1.4.0 or earlier, export the schema and data, initialize a fresh -1.4.1 instance, and import the export. See the [seekdb 1.4.1 release notes](https://github.com/oceanbase/seekdb/releases/tag/v1.4.1#upgrade-notes). +Before opening an existing database with an upgraded crate, check the native +manifest's `engine_version` and follow that engine release's storage migration +instructions. [seekdb release notes](https://github.com/oceanbase/seekdb/releases) ## Embedded native runtime -On the first build, `build.rs` verifies the [packaged manifest](bundles/manifest-1.4.1.json) -and selects the SDK 1.4.1 archive for Cargo `TARGET`. It downloads the archive -from the [seekdb-bindings release](https://github.com/oceanbase/seekdb-bindings/releases/tag/v1.4.1), -verifies its size and SHA-256, and prepares the native cache. The release -version, manifest SHA-256 and download directory are pinned in `Cargo.toml` -under `[package.metadata.seekdb]`. The SDK contains engine **1.4.1.0**. +On the first build, `build.rs` verifies the packaged manifest and selects the +SDK archive for Cargo `TARGET`. It downloads the archive from the configured +release directory, verifies its size and SHA-256, and prepares the native cache. The binding embeds the compressed archive with `include_bytes!`. Downloads honor standard proxy variables and the platform TLS trust store (including configured enterprise roots), and use Rust HTTP libraries; no external `curl` @@ -106,14 +101,10 @@ CARGO_TARGET_DIR=/tmp/seekdb-target cargo test --manifest-path rust/Cargo.toml - ## Build-time download configuration and upgrades -The independent native release is selected by source-controlled Cargo metadata: - -```toml -[package.metadata.seekdb] -native-version = "1.4.1" -manifest-sha256 = "8a0efa7712c822bfad8abac40102aed578f8036ddaf3353e6c57b7247ba269fa" -download-base-url = "https://github.com/oceanbase/seekdb-bindings/releases/download/v1.4.1/" -``` +The `[package.metadata.seekdb]` table in [Cargo.toml](Cargo.toml) pins +`native-version`, `manifest-sha256` and `download-base-url`. The `native-version` +selects `bundles/manifest-.json`, which records the bundled +engine version and the archive for each available target. To use an HTTPS mirror at build time, set `SEEKDB_DOWNLOAD_BASE_URL`. @@ -163,48 +154,37 @@ to exercise a cold manifest request without a packaged copy. An offline build needs a verified bundle in `OUT_DIR` or the shared native cache; the packaged manifest fallback supplies metadata, not the compressed runtime. -To upgrade a compatible native release: - -1. Verify the release's provenance, artifact hashes, architectures, ABI and - minimum system versions. Record the verified artifacts in the manifest. -2. Update `native-version`, `manifest-sha256` and `download-base-url` in the - metadata above. Add the JSON as `bundles/manifest-.json`. -3. Run platform tests, examples, deployments and `python rust/tests/check_package.py`, - then update requirements and validation evidence. The package check derives - the expected snapshot path from the same Cargo metadata. - -Compatible releases need no Rust version literals changed in the downloader, -parser or file-watch logic. New target mappings, native ABI or layout changes -still require implementation review. The Rust crate version is maintained -separately. Once published, crates.io versions cannot be overwritten; shipping -updated sources/bundles there requires a new Rust crate release. +Follow the [release guide](docs/releasing.md#prepare-a-release) when updating +the pinned native release. ## Native platforms and requirements -| Cargo target | Native requirement | Runtime connection | +A target needs a matching archive in the pinned manifest. Its entry gives the +minimum glibc or macOS version where applicable. The binding recognizes these +target mappings. + +| Cargo target | Platform | Runtime connection | | --- | --- | --- | -| `x86_64-unknown-linux-gnu` | glibc 2.28+, x86_64 | Unix socket | -| `aarch64-unknown-linux-gnu` | glibc 2.28+, ARM64 | Unix socket | -| `x86_64-apple-darwin` | macOS 15.0+, Intel; 1.4.1 archive pending | Unix socket | -| `aarch64-apple-darwin` | macOS 15.0+, Apple Silicon | Unix socket | -| `x86_64-pc-windows-msvc` | x86_64 Windows, MSVC ABI; Windows Server 2022 CI baseline (preview) | TCP, returned host/port | - -The 1.4.1 manifest pins the four published SDK archives for these targets by -size and SHA-256. Windows uses PE x86_64 binaries and bundled DLL dependencies. -The Rust CI matrix validates releases on native runners. See the -[1.4.0 validation record](docs/native-bundle-validation.md) for historical results. - -There are no assets for Linux musl, Windows ARM64/GNU, 32-bit systems, Android, -or iOS in this release manifest. Those targets fail with an explicit diagnostic. -Cross-compilation downloads and embeds the **target** archive without executing -it on the build host. Embedding does not remove OS, architecture, ABI, CPU, or -system-library requirements. +| `x86_64-unknown-linux-gnu` | GNU/Linux x86_64 | Unix socket | +| `aarch64-unknown-linux-gnu` | GNU/Linux ARM64 | Unix socket | +| `x86_64-apple-darwin` | macOS Intel | Unix socket | +| `aarch64-apple-darwin` | macOS Apple Silicon | Unix socket | +| `x86_64-pc-windows-msvc` | Windows x86_64 MSVC (preview) | TCP, returned host/port | + +The Rust CI matrix validates releases on native runners. Earlier results are +available in the [native bundle validation record](docs/native-bundle-validation.md). + +Builds for unsupported targets or targets missing an archive fail with a +diagnostic. Cross-compilation downloads and embeds the **target** archive +without executing it on the build host. The resulting application still needs +the target OS, architecture, ABI, CPU, and system libraries. On Linux/macOS, load `libseekdb.so`/`libseekdb.dylib` directly through its C ABI; the colocated service is `seekdb`. Windows loads the C driver `seekdb.dll` with -an explicit DLL-directory search policy. The 1.4.1 archive ships `seekdb.exe` -next to its dependencies in `lib/`. For older archives, extraction flattens -the outer package directory and copies the executable from `bin/` into `lib/`. +an explicit DLL-directory search policy. Extraction makes `seekdb.exe` +available alongside its DLL dependencies in `lib/`. For wrapped archives, +extraction removes the outer package directory. If the executable is in `bin/`, +extraction copies it to `lib/`. The binding selects the bundled executable through the existing C API. The Windows C driver uses ANSI Windows APIs. Rust converts native paths to diff --git a/rust/THIRD_PARTY_NOTICES.md b/rust/THIRD_PARTY_NOTICES.md index 8830de3..62f830c 100644 --- a/rust/THIRD_PARTY_NOTICES.md +++ b/rust/THIRD_PARTY_NOTICES.md @@ -10,7 +10,7 @@ and provide them with their product as required by the applicable licenses; embedding bytes or using a private extraction cache does not remove those obligations. The source `.crate` contains no native binaries. -## Notice files in the pinned 1.4.1 archives +## Notice files in the pinned archives Each archive contains the engine and bindings license bundles. Their inventories are `licenses/THIRD_PARTY_COMPONENTS.md` and @@ -19,12 +19,11 @@ are `licenses/THIRD_PARTY_COMPONENTS.md` and Follow the applicable redistribution instructions in the archive, including the bindings instructions for the linked MariaDB Connector/C. -The engine `licenses/NOTICE` is byte-identical in the four pinned SDK archives. -Its SHA-256 is `69b514d8f2db8c81495f6faad52918c55efedf9c94703c945a92859402fe1e70`. -The crate includes an exact copy in [NOTICE](NOTICE). The crate also carries the -[historical zstd PATENTS text](PATENTS) shipped with 1.4.0. Use the license and -notice files in the current native archive when distributing its contents. +The source-package check verifies that the crate's [NOTICE](NOTICE) matches +the pinned engine's `licenses/NOTICE`. The crate also carries the +[historical zstd PATENTS text](PATENTS). Use the license and notice files in +the native archive when distributing its contents. -The pinned manifest records the release, engine and bindings source commits, -and the verified file sizes and digests. Each SDK includes its platform build -provenance in `BUILD-INFO.json`. See the [native manifest](bundles/manifest-1.4.1.json). +The manifest in `bundles/` selected by `[package.metadata.seekdb]` records +the SDK release, source commits, archive sizes and digests. Each SDK also +includes `BUILD-INFO.json` with its platform build provenance. [Cargo.toml](Cargo.toml) diff --git a/rust/docs/embedded-native-runtime.md b/rust/docs/embedded-native-runtime.md index d47f150..3142806 100644 --- a/rust/docs/embedded-native-runtime.md +++ b/rust/docs/embedded-native-runtime.md @@ -1,8 +1,8 @@ # Embedded native runtime decision -The 1.4.1 manifest pins SDK archives for GNU/Linux x86_64/ARM64, macOS ARM64, -and Windows x86_64 MSVC (preview). The macOS Intel archive is pending. See the -[1.4.0 validation record](native-bundle-validation.md) for historical results. +The pinned native manifest defines archive availability for each release. For +target mappings and requirements, see the +[Rust README](../README.md#native-platforms-and-requirements). ## Decision diff --git a/rust/docs/releasing.md b/rust/docs/releasing.md index 39dd876..0e62cce 100644 --- a/rust/docs/releasing.md +++ b/rust/docs/releasing.md @@ -1,18 +1,29 @@ # Publishing the seekdb Rust crate -The crates.io package and Rust import are both `seekdb`. Crate **1.4.1** pins -the **1.4.1** SDK archives containing engine **1.4.1.0**. The pins live in -`[package.metadata.seekdb]`. Crates.io versions are immutable after publication, -so any later source or embedded-bundle change needs a new crate version. - -Upgrades from 1.4.0 or earlier require a logical export and import because the -local storage format changed. See the [seekdb 1.4.1 release notes](https://github.com/oceanbase/seekdb/releases/tag/v1.4.1#upgrade-notes). +The crates.io package and Rust import are both `seekdb`. The crate version and +native SDK pins are recorded in [Cargo.toml](../Cargo.toml). `publish = ["crates-io"]` enables the intended registry. Merging changes does not publish anything. The manual `publish-rust.yml` workflow uses Trusted Publishing to upload a new version after its tests and package checks pass. The validation workflow and the checks below never upload, and need no registry credential. +## Prepare a release + +1. Set the crate version in `rust/Cargo.toml` and refresh `rust/Cargo.lock` and + `rust/tests/consumer/Cargo.lock`. +2. Verify the SDK archives' provenance, hashes, target architectures, ABIs and + minimum system versions. Record the engine version and verified artifacts in + `rust/bundles/manifest-.json`. Set `native-version`, + `manifest-sha256` and `download-base-url` in `[package.metadata.seekdb]`. + Review the build and extraction code if the target mappings, ABI or archive + layout changes. +3. If the engine NOTICE changes, copy the new `licenses/NOTICE` to `rust/NOTICE` + and update the expected digest in `rust/tests/check_package.py`. +4. Record platform availability, validation and any data migration requirements + in the release PR. Link the relevant entry from the + [seekdb release notes](https://github.com/oceanbase/seekdb/releases). + ## Registry name and ownership Check the current [crate record](https://crates.io/api/v1/crates/seekdb) and @@ -41,8 +52,8 @@ identity with `id-token: write`, and the pinned official [crates-io-auth-action](https://github.com/rust-lang/crates-io-auth-action) exchanges it for a temporary publish token after preflight succeeds. -After a version-bump PR has passed the five-platform validation workflow and -merged, trigger publication from `main`: +After the release PR passes the Rust validation workflow and merges, trigger +publication from `main`. ```sh gh workflow run publish-rust.yml --repo oceanbase/seekdb-bindings --ref main @@ -63,11 +74,10 @@ remains independent of the pinned native bundle revision. ## Release scope -The 1.4.1 manifest pins GNU/Linux x86_64 and ARM64 (glibc 2.28+), macOS Apple -Silicon (15.0+), and Windows x86_64 MSVC (**preview**). macOS Intel still needs -its 1.4.1 archive and manifest entry. Run the full native matrix on the -publication commit. Windows Server 2022 is the CI baseline. The documented -ANSI/local-path and mapped-file restrictions apply on Windows. +Check that every target in the Rust validation matrix has a matching archive +in the pinned manifest. Run the full native matrix on the publication commit. +The platform requirements and Windows preview restrictions are described in the +[Rust README](../README.md#native-platforms-and-requirements). A readiness timeout can leave a spawned server running. Normal last-client shutdown is asynchronous. Wait for the server to exit before removing its @@ -92,8 +102,8 @@ python rust/tests/check_package.py python rust/tests/check_docs.py ``` -CI runs these on all five native targets, with an explicit noexec mount and -manifest-download/fallback checks on both Linux targets. The package check runs +CI runs these across the native matrix. The Linux jobs exercise a `noexec` +mount and manifest download and fallback. The package check runs `cargo publish --dry-run --locked --registry crates-io` with verification enabled, then runs `cargo package --no-verify` to generate the source archive it inspects. It checks that archive's metadata, manifest pin, build sources, examples and notices, @@ -120,9 +130,9 @@ cargo publish --manifest-path rust/Cargo.toml --locked --registry crates-io This is a separate, explicit release action. Keep credentials out of the repository. After upload, confirm the registered repository/version/owners and -docs.rs build. Build a fresh consumer using `seekdb = "=1.4.1"` from crates.io -without path or Git patches, run the first SQL query, and repeat deployment -verification on the release platforms. Only then announce the published version. +docs.rs build. Build a fresh consumer pinned to the exact published `seekdb` +version from crates.io. Run the first SQL query and repeat deployment +verification on the release platforms before announcing the version. Downstream libraries that publish to crates.io must use a registry dependency version and wait until `seekdb` is published. End users use `cargo install` for an diff --git a/rust/tests/consumer/README.md b/rust/tests/consumer/README.md index 59f4b46..5cd1058 100644 --- a/rust/tests/consumer/README.md +++ b/rust/tests/consumer/README.md @@ -22,10 +22,9 @@ The library is `.so` on Linux, `.dylib` on macOS, and `.dll` on Windows; this is only a test artifact, not an added SDK dependency. Windows cleanup retries while child processes release mapped files; cache deletion during execution is not claimed to work there. Timeout or partial-spawn failures terminate and reap the -runner's own consumer processes before cleanup. Native servers are separate -children of those consumers; r2's asynchronous shutdown/readiness-timeout -behavior is described in the [native limitations](../../docs/native-bundle-validation.md). -The runner does not claim to kill every native descendant after arbitrary hangs. +runner's own consumer processes before cleanup. Native servers run as separate +children of those consumers and can outlive a failed open. See the +[native shutdown behavior](../../docs/releasing.md#release-scope). To also check the error returned for a `noexec` cache filesystem, as CI does: