Skip to content

Add support for closing a database (session) #13

Open

Description

@kou

It seems that Apache Arrow Flight SQL doesn't provide a command that closes the current session explicitly:
https://arrow.apache.org/docs/format/FlightSql.html

In https://lists.apache.org/thread/0w25o85y8vsndz87kpjljxz24x077o3y , using a custom (close) action was suggested.

@lidavidm Is using a custom close action still a suggested approach to close the current session? I have a concern about this approach. If each Apache Arrow Flight SQL server implementation uses different custom close action, users can't use a general Apache Arrow Flight SQL client including ADBC to use Apache Arrow Flight SQL servers. (Users need to implement a custom close action for each Apache Arrow Flight SQL server.)

Activity

  1. lidavidm commented on Feb 9, 2023

    @lidavidm
    Member

    I've been working on a set of new proposals for Flight SQL. I think we should address this as part of that.

    I don't want us to enforce statefulness if possible, because that runs counter to how gRPC/Flight work. So the server should still be able to deal with clients that do not send the close action.

  2. lidavidm commented on Feb 9, 2023

    @lidavidm
    Member

    Actually, I think James's proposal already covers this fully: https://lists.apache.org/thread/fd6r1n7vt91sg2c7fr35wcrsqz6x4645

    Would you like to follow up there?

  3. kou commented on Feb 10, 2023

    @kou
    MemberAuthor

    Thanks!
    I missed the discussion. I'll reply on the thread.

  4. kou commented on Apr 12, 2023

    @kou
    MemberAuthor

    Note: Session timeout instead of closing session explicitly is implemented for now.

  5. zhjwpku commented on Sep 16, 2023

    @zhjwpku
    Member

    I tried this extension and noticed that each executor will last for 5 minutes due to session timeout, I glanced the FlightSqlServerBase class a little bit, if it has a method knows the client's close action, then we can use it to close the executor. Is there any capability in arrow flight that we can use now?

  6. kou commented on Sep 19, 2023

    @kou
    MemberAuthor

    No there isn't.
    We need to forward the discussion referred at #13 (comment) for it. Could you join the discussion on the dev@arrow.apache.org mailing list?

  7. kou commented on Oct 25, 2023

    @kou
    MemberAuthor

    Ah, apache/arrow#34817 is a proposed implementation.
    I thought that it's not related to #13 (comment) discussion.

  8. cisaacson commented on Oct 4, 2024

    @cisaacson

    I am interested in this capability for the Rust version of arrow-flight-sql. A timeout would not meet our requirements. I would suggest some type of on_close event that the client calls on the server as it is closing. If I can help please let me know.

  9. kou commented on Oct 5, 2024

    @kou
    MemberAuthor
  10. cisaacson commented on Oct 5, 2024

    @cisaacson

    Thanks @kou, the CloseSession command is exactly what I was looking for. I have 2 questions:

    • Is this implemented for arrow-rs? I do not believe so as CloseSession does not appear in the codebase.
    • Is there an example you can point me to?

    If I can help with an example I would be happy to do that, for implementing the Rust version it may be better for someone more familiar with the codebase than me.

    And thanks for all the work on this.

  11. cisaacson commented on Oct 5, 2024

    @cisaacson

    I don't know if this is the right place to report this, but the latest version of master for arrow-rs does not compile:

    no associated item named `GRPC_STATUS` found for struct `Status` in the current scope
        --> arrow-flight/src/arrow.flight.protocol.rs:1578:48
    

    If I should post it somewhere else let me know.

  12. kou commented on Oct 6, 2024

    @kou
    MemberAuthor

    We need the followings for explicit close:

    Could you report arrow-rs error to https://github.com/apache/arrow-rs/issues ?

  13. cisaacson commented on Oct 6, 2024

    @cisaacson

    @kou Sure, I will report it there.

  14. cisaacson commented on Oct 6, 2024

    @cisaacson

    This issue can be closed as it has been reported in the arrow-rs project.

  15. kou commented on Oct 7, 2024

    @kou
    MemberAuthor

    This issue isn't for arrow-rs.
    So we should not close this until we implement CloseSession in this repository.

  16. Phoenix500526 commented on Nov 13, 2026

    @Phoenix500526

    I've opened apache/arrow-rs#12237 to add standard CloseSession support to the Rust Flight SQL client and server.

    For this PostgreSQL adapter, Arrow C++ already provides the CloseSession hook, so the remaining work would be to implement session cleanup here.

    @kou, is this still something you'd like to support? I'm considering working on it, but before committing time, I'd like to check whether you'd be available to review a PR and whether there are any CI or compatibility issues I should address first.

  17. kou commented on Nov 15, 2026

    @kou
    MemberAuthor

    Yes. I'll review the PR. I've fixed CI for it.

  18. kou commented on Nov 16, 2026

    @kou
    MemberAuthor

    Ah, sorry. We miss a feature in apache/arrow to test this feature: apache/arrow#55627

    I'll implement it later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions