Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support server side session #479

Merged
merged 23 commits into from
Nov 13, 2024
Merged

Conversation

youngsofun
Copy link
Member

@youngsofun youngsofun commented Aug 28, 2024

feat:

  1. try to access /v1/session/login to get session token and refresh token when init APIClient. it got 404, do not use session token in the following request
  2. uses session token when sending and polling query. it session token expired, renew token and retry
    4. upload_stage accept a Reader, so it can not retry, check for expired and renew before request.
  3. call /v1/session/logout when drop APIClient
  4. support cookie to carry session id with each request, and even if session_token is not used.
  5. DSN add param session_token=enable|disable, disable by default now, may changed to enable by default after stable
  6. DSN add param login=enable|disable, enabled by default, so user can choose to disable if only one query in session
  7. after this pr, temp table is available, require databend server version >= 1.2.655 , but since heartbeat is not implemented yet, temp table will be cleaned up after session is idle for 4 hours, it is recommended to drop temp table after use, vacuum is used incase of forget or fail to drop it

fix:

  1. fix auth header when retry request. bug: call self.auth.wrap(builder) when retry not work as what we expect. #477
  2. no sleep when retry fro start query

refactors:

  1. reclassify Errors and add Error::WithContext
  2. unify retry policy
  3. use parking_lock instead of tokio lock
  4. make reading local jwt token file sync, so building request is sync

others:

allow license Unicode-3.0

@youngsofun youngsofun marked this pull request as draft August 28, 2024 11:10
@youngsofun youngsofun marked this pull request as ready for review August 28, 2024 12:01
@youngsofun
Copy link
Member Author

cc @everpcpc @sundy-li plz review

Copy link
Member

@everpcpc everpcpc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DSN param session_token is not supported yet?

@youngsofun youngsofun changed the title feat: use session_token by default. feat: support server side session Nov 6, 2024
@youngsofun
Copy link
Member Author

DSN param session_token is not supported yet?

supported now

@youngsofun
Copy link
Member Author

waiting for databendlabs/databend#16786 to merge

@youngsofun
Copy link
Member Author

@everpcpc do you need to review again?

@everpcpc everpcpc merged commit 6849bbe into databendlabs:main Nov 13, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants