You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fluss.apache.org by "nicolazar (via GitHub)" <gi...@apache.org> on 2026/06/01 21:49:14 UTC
[PR] [elixir] feat: Add get_database_info admin call [fluss-rust]
nicolazar opened a new pull request, #586:
URL: https://github.com/apache/fluss-rust/pull/586
<!--
*Thank you very much for contributing to Fluss - we are happy that you want to help us improve Fluss. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.*
## Contribution Checklist
- Make sure that the pull request corresponds to a [GitHub issue](https://github.com/apache/fluss-rust/issues). Exceptions are made for typos in JavaDoc or documentation files, which need no issue.
- Name the pull request in the format "[component] Title of the pull request", where *[component]* should be replaced by the name of the component being changed. Typically, this corresponds to the component label assigned to the issue (e.g., [kv], [log], [client], [flink]). Skip *[component]* if you are unsure about which is the best component.
- Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
- Make sure that the change passes the automated tests, i.e., `mvn clean verify` passes.
- Each pull request should address only one issue, not mix up code from multiple issues.
**(The sections below can be removed for hotfixes or typos)**
-->
### Purpose
<!-- Linking this pull request to the issue -->
Linked issue: part of #466
<!-- What is the purpose of the change -->
This PR adds the `get_database_info` admin call on `Fluss.Admin`, returning a `Fluss.DatabaseInfo` struct that embeds a nested `Fluss.DatabaseDescriptor` (comment + custom properties).
The output-marshaling pattern follows the wrapper convention established by `get_server_nodes` in #583: bindings-local `Nif*` structs with `from_core` builders, derived `NifStruct` for cross-FFI encoding.
<!-- Please describe the changes made in this pull request and explain how they address the issue -->
### Tests
<!-- List UT and IT cases to verify this change -->
Integration tests added for positive case (create db → assert struct shape), as well as for negative case (`{:error, %Fluss.Error{}}` for non-existent db).
--
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: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [elixir] feat: Add get_database_info admin call [fluss-rust]
Posted by "fresh-borzoni (via GitHub)" <gi...@apache.org>.
fresh-borzoni merged PR #586:
URL: https://github.com/apache/fluss-rust/pull/586
--
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: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [elixir] feat: Add get_database_info admin call [fluss-rust]
Posted by "fresh-borzoni (via GitHub)" <gi...@apache.org>.
fresh-borzoni commented on PR #586:
URL: https://github.com/apache/fluss-rust/pull/586#issuecomment-4612303465
## Review — looks solid, a few minor notes
Verified the marshaling path end-to-end against the core crate and rustler behavior. The wrapper convention from #583 (`get_server_nodes` / `Fluss.ServerNode`) is followed faithfully:
- Core accessors line up with the `from_core` builders: `DatabaseInfo::{database_name → &str, database_descriptor → &DatabaseDescriptor, created_time/modified_time → i64}` and `DatabaseDescriptor::{comment → Option<&str>, custom_properties → &HashMap<String,String>}` all exist with matching signatures.
- `FlussAdmin::get_database_info` returns `Result<DatabaseInfo>`, the NIF is auto-registered by `rustler::init!` (no explicit list to update), `NifStruct`/`Encoder` derive cleanly through the nested `NifDatabaseDescriptor`, and `Option<String>`/`HashMap` encode as `nil`/string and a string-keyed map respectively — consistent with the `String.t() | nil` and `%{optional(String.t()) => String.t()}` typespecs.
- Imports are clean (single `HashMap` import, used once); no mix.exs `groups_for_modules` or CHANGELOG to touch.
### Suggestions (non-blocking)
1. **Strengthen the positive test to actually exercise the nested marshaling.** It currently asserts only the struct *shape* (`%Fluss.DatabaseDescriptor{} = info.descriptor`). Because `Fluss.Admin.create_database/3` always passes `None` for the descriptor, the round-tripped values are deterministic, so we can assert them and catch any future regression in `NifDatabaseDescriptor::from_core`:
```elixir
assert info.descriptor.comment == nil
assert info.descriptor.custom_properties == %{}
```
As written, a mis-mapping of `comment`/`custom_properties` would still pass.
2. **Minor idiom nit (optional):** `from_core` mixes `comment().map(String::from)` with `database_name().to_string()`. Harmless, just slightly inconsistent.
3. **Optional ordering:** `get_database_info` is wedged between `create_database` and `drop_database` (two write ops), while the other read op `database_exists` sits further down. Grouping the read operations would read a touch cleaner, but not important.
Nothing blocking from my side — the change is correct and convention-faithful.
--
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: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org