ump45nose opened a new pull request, #1343: URL: https://github.com/apache/paimon-rust/pull/1343
### Purpose Linked issue: close #1340 `RESTCatalog` already implements `create_branch`, `drop_branch`, `fast_forward` and `list_branches`, but `sys.create_branch` and `sys.delete_branch` refused REST tables and there was no `sys.fast_forward`. This routes the branch procedures for REST tables through the `Catalog` trait, as proposed in the issue. Filesystem tables keep their current behavior. ### Brief change log - `create_branch`: for tables with `rest_env()`, keep the local checks (branch name, no `$`, not a format table, main-branch source table), then call `catalog.create_branch(identifier, branch, tag)`. With `ignore_if_exists => true`, `catalog.list_branches` is checked first, so an existing branch is a no-op without resolving the tag; a `BranchAlreadyExist` from a concurrent create is also treated as success. - `delete_branch`: keep the comma split and the per-name checks (`validate_branch_name`, `ensure_branch_deletable`), require a main-branch source table, and call `catalog.drop_branch` for each name, skipping a missing branch (`BranchNotExist`). - New `fast_forward(table, branch)` procedure: validates the branch name (rejecting `main`) and requires a main-branch source table. REST tables call `catalog.fast_forward`; filesystem tables are refused with `NotImplemented` for now. - Nothing is written to table storage on the REST path. - `rename_branch` keeps its REST refusal (out of scope, no REST endpoint). ### Tests - Mock REST server: added list/create/drop/forward branch endpoints with request recording and error injection (`set_branch_error`), plus `add_tag`/`add_branch` helpers. - `rest_management_procedures.rs`: replaced the tests that asserted the old refusals with tests for creating empty and tagged branches, existing and missing branches or tags with and without `ignore_if_exists`, deleting comma-separated branches including a missing one, fast-forwarding existing and missing branches, 403 errors from every procedure, local rejections before any request, and no change to table storage. - `RUST_MIN_STACK=16777216 cargo test -p paimon-datafusion --test rest_management_procedures --test create_branch --test procedures`: 28, 11 and 72 passed. (Without `RUST_MIN_STACK`, which CI sets, `create_branch` overflows the default 2 MiB test-thread stack on my machine.) - `cargo fmt --all -- --check` passes. `cargo clippy -p paimon-datafusion --all-targets` reports nothing in the changed files; I could not run the CI's `-D warnings` clippy as-is because my local toolchain is rustc 1.99.1, which flags pre-existing code in `paimon` (CI pins 1.98.0). ### API and Format Adds the `sys.fast_forward` SQL procedure. No storage format change. ### Documentation `docs/src/sql.md`: describes the REST behavior of `create_branch` and adds `fast_forward`. --- This change was prepared with AI assistance; I reviewed the diff and ran the tests listed above. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
